From bdd84cc48ba7b2527584c44d174da8e7d20c5375 Mon Sep 17 00:00:00 2001 From: zhaowc <526854230@qq.com> Date: 星期三, 18 九月 2024 16:37:13 +0800 Subject: [PATCH] 增加对申请入库时对平库库位的校验 --- Wms/Wms/Controllers/BllAsnController.cs | 160 +++++++++++++++++++++++++++++----------------------- 1 files changed, 89 insertions(+), 71 deletions(-) diff --git a/Wms/Wms/Controllers/BllAsnController.cs b/Wms/Wms/Controllers/BllAsnController.cs index 3a703ac..b4e38cc 100644 --- a/Wms/Wms/Controllers/BllAsnController.cs +++ b/Wms/Wms/Controllers/BllAsnController.cs @@ -9,6 +9,13 @@ using WMS.IBLL.IBllAsnServer; using WMS.IBLL.ILogServer; using Model.ModelVm.BllAsnVm; +using Utility; +using Model.ModelDto.BllAsnDto; +using System.Threading.Tasks; +using SqlSugar; +using System.Diagnostics; +using Model.ModelDto.SysDto; +using static System.Reflection.Metadata.BlobBuilder; namespace Wms.Controllers { @@ -27,10 +34,11 @@ private readonly IAuditLogServer _auditLog; // 瀹℃牳璁板綍 private readonly IBllLabelBoxNoServer _labelBox; // 绠辩爜鏍囩 private readonly IProcurePlanServer _procurePlanSvc; // 绠辩爜鏍囩 + private readonly IPalletUpShelfServer _palletUpShelfSvc; // 涓婃灦璁板綍 #endregion #region 鏋勯�犲嚱鏁� - public BllAsnController(IArrivalNoticeServer arrivalNoticeSvc, IPalletBindServer palletBindSvc,IBllBoxInfoServer bllBoxInfoSvc, ITaskServer taskSvc,IOperationASNServer logSvc, IPalletUnbindServer palletUnbind,IAuditLogServer auditLog,IBllLabelBoxNoServer labelBox, IProcurePlanServer procurePlanSvc) + public BllAsnController(IArrivalNoticeServer arrivalNoticeSvc, IPalletBindServer palletBindSvc, IBllBoxInfoServer bllBoxInfoSvc, ITaskServer taskSvc, IOperationASNServer logSvc, IPalletUnbindServer palletUnbind, IAuditLogServer auditLog, IBllLabelBoxNoServer labelBox, IProcurePlanServer procurePlanSvc, IPalletUpShelfServer palletUpShelfSvc) { _arrivalNoticeSvc = arrivalNoticeSvc; _PalletBindSvc = palletBindSvc; @@ -41,6 +49,7 @@ _auditLog = auditLog; _labelBox = labelBox; _procurePlanSvc = procurePlanSvc; + _palletUpShelfSvc = palletUpShelfSvc; } #endregion @@ -51,33 +60,23 @@ /// <param name="model">鏌ヨ鏉′欢</param> /// <returns>鍏ュ簱鍗曚俊鎭�</returns> [HttpPost] - public IActionResult GetArrivalNoticeList(ArrivalNoticeVm model) + [ServiceFilter(typeof(ApiResponseActionFilter))] + public async Task<SqlSugarPagedList> GetArrivalNoticeList(ArrivalNoticeVm model) { - try - { - var models = _arrivalNoticeSvc.GetArrivalNoticeList(model, out int count); - return Ok(new { code = 0, count, msg = "鍏ュ簱鍗曚俊鎭�", data = models }); - } - catch (Exception e) - { - return Ok(new { code = 1, msg = e.Message }); - } - } + RefAsync<int> count = new RefAsync<int>(); + var bolls = await _arrivalNoticeSvc.GetArrivalNoticeList(model, count); + return new SqlSugarPagedList() { Items = bolls, Total = count }; + } + [HttpPost] - public IActionResult GetArrivalNoticeDetailList(ArrivalNoticeDetailVm model) + [ServiceFilter(typeof(ApiResponseActionFilter))] + public async Task<SqlSugarPagedList> GetArrivalNoticeDetailList(ArrivalNoticeDetailVm model) { - try - { - var models = _arrivalNoticeSvc.GetArrivalNoticeDetailList(model, out int count); - - return Ok(new { code = 0, count, msg = "鍏ュ簱鍗曟槑缁嗕俊鎭�", data = models }); - } - catch (Exception e) - { - return Ok(new { code = 1, msg = e.Message }); - } + RefAsync<int> count = new RefAsync<int>(); + var bolls = await _arrivalNoticeSvc.GetArrivalNoticeDetailList(model, count); + return new SqlSugarPagedList() { Items = bolls, Total = count }; } /// <summary> @@ -172,6 +171,10 @@ { throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅"); } + if (string.IsNullOrWhiteSpace(model.ASNNo)) + { + throw new Exception("鍗曟嵁鍙蜂笉鍙负null!"); + } model.CreateUser = int.Parse(UserId); string strMesage = _arrivalNoticeSvc.EditArrivalNotice(model); @@ -182,7 +185,7 @@ } if (strMesage.Contains("-1")) { - return Ok(new { code = 0, msg = "閮ㄥ垎鎴愬姛 "+ strMesage }); + return Ok(new { code = 0, msg = "閮ㄥ垎鎴愬姛 " + strMesage }); } else { @@ -270,7 +273,7 @@ /// <param name="reason"></param> /// <returns></returns> [HttpGet] - public IActionResult CancelOrder(int id,string reason) + public IActionResult CancelOrder(int id, string reason) { try { @@ -284,12 +287,12 @@ { throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅"); } - - _arrivalNoticeSvc.CancelOrder(id,reason,int.Parse(userId)); - + _arrivalNoticeSvc.CancelOrder(id, reason, int.Parse(userId)); + + return Ok(new { code = 0, msg = "鍏ュ簱鍗曟挙閿�鐢宠鎴愬姛" }); - + } catch (Exception e) { @@ -332,7 +335,7 @@ } #endregion - #region 鎵樼洏缁戝畾 + #region 缁勬墭鏀惰揣 [HttpPost] public IActionResult GetPalletBindList(PalletBindVm model) { @@ -364,13 +367,13 @@ } [HttpGet] - public IActionResult GetBoxInfoByBoxNo(string boxNo, string boxNo3,int bindNo=0) + public IActionResult GetBoxInfoByBoxNo(string boxNo, string boxNo3, int bindNo = 0) { try { - var models = _PalletBindSvc.GetBoxInfoByBoxNo(boxNo, boxNo3,bindNo); + var models = _PalletBindSvc.GetBoxInfoByBoxNo(boxNo, boxNo3, bindNo); - return Ok(new { code = 0, count= models.Count, msg = "绠辨敮鏄庣粏淇℃伅", data = models }); + return Ok(new { code = 0, count = models.Count, msg = "绠辨敮鏄庣粏淇℃伅", data = models }); } catch (Exception e) { @@ -428,7 +431,7 @@ { throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅"); } - _PalletBindSvc.DelBindBoxInfo(boxNo,int.Parse(userId)); + _PalletBindSvc.DelBindBoxInfo(boxNo, int.Parse(userId)); return Ok(new { code = 0, count = 0, msg = "鍒犻櫎鎴愬姛", data = "" }); } @@ -460,7 +463,7 @@ { throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅"); } - _PalletBindSvc.CancelPalletBind(id, reason,int.Parse(userId)); + _PalletBindSvc.CancelPalletBind(id, reason, int.Parse(userId)); return Ok(new { code = 0, count = 0, msg = "鎵樼洏缁戝畾鎾ら攢鐢宠鎴愬姛", data = "" }); } @@ -484,7 +487,7 @@ { var list = _BoxInfoSvc.GetBoxInfoList(boxNo, isContinue, boxNo2); var num = 0; - if (list!=null) + if (list != null) { num = list.Count; } @@ -510,7 +513,8 @@ { try { - var models = _PalletBindSvc.GetLocateList("W01",model.RoadwayNo,model.Row,model.Column,model.Layer,model.LocateNo,model.StockDetailId, model.Page,model.Limit, out int count); + var models = _PalletBindSvc.GetLocateList("W01", model.RoadwayNo, model.Row, model.Column, model.Layer, model.LocateNo, + model.StockDetailId, model.Page, model.Limit, out int count); return Ok(new { code = 0, count, msg = "鑾峰彇鎸囧畾鍌ㄤ綅淇℃伅", data = models }); } @@ -540,7 +544,7 @@ { throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅"); } - _PalletBindSvc.SaveAppointSlot(model.BindId,model.LocateId,int.Parse(userId)); + _PalletBindSvc.SaveAppointSlot(model.BindId, model.LocateId, int.Parse(userId)); return Ok(new { code = 0, count = 0, msg = "鎸囧畾鍌ㄤ綅鎴愬姛", data = "" }); } @@ -684,14 +688,15 @@ /// <param name="model"></param> /// <returns></returns> [HttpPost] - public IActionResult GetArrivalTaskList(GetTaskVm model) + public async Task<IActionResult> GetArrivalTaskList(GetTaskVm model) { try { var type = new List<string>() { "0" }; - var bolls = _taskSvc.GetTaskList(type, model.Type, model.Status, model.TaskNo, model.IsSuccess, model.PalletNo, model.Msg, model.Page, model.Limit, out int count); + RefAsync<int> count = new RefAsync<int>(); + var bolls = await _taskSvc.GetTaskList(type, model.Type, model.Status, model.TaskNo, model.IsSuccess, model.PalletNo, model.Msg, model.Page, model.Limit, count); - return Ok(new { code = 0, count, msg = "鍏ュ簱浠诲姟淇℃伅", data = bolls }); + return Ok(new { code = 0, count = count.Value, msg = "鍏ュ簱浠诲姟淇℃伅", data = bolls }); } catch (Exception e) { @@ -860,9 +865,9 @@ { return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" }); } - _auditLog.EditAudit(model.Id,model.Status,model.Opinion, int.Parse(userId)); + _auditLog.EditAudit(model.Id, model.Status, model.Opinion, int.Parse(userId)); - return Ok(new { code = 0, count=0, msg = "瀹℃牳璁板綍鍒楄〃", data = "" }); + return Ok(new { code = 0, count = 0, msg = "瀹℃牳璁板綍鍒楄〃", data = "" }); } catch (Exception e) { @@ -919,7 +924,7 @@ return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" }); } var list = _BoxInfoSvc.AddLabelBox(model.Id, model.IsReset, decimal.Parse(model.ArriveQty), model.ProductionTime, model.ExpirationTime, model.StoreTime, model.SupplierLot, int.Parse(userId)); - return Ok(new { code = 0, msg = "鐢熸垚绠辩爜鏍囩鎴愬姛", data = list }); + return Ok(new { code = 0, msg = "鐢熸垚绠辩爜鏍囩鎴愬姛", data = list }); } catch (Exception e) { @@ -944,7 +949,7 @@ { return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" }); } - var list = _BoxInfoSvc.GetBuDaLabelList(model.BoxNo, model.EndBoxNo, model.BoxNo2, model.EndBoxNo2,model.Type,int.Parse(userId)); + var list = _BoxInfoSvc.GetBuDaLabelList(model.BoxNo, model.EndBoxNo, model.BoxNo2, model.EndBoxNo2, model.Type, int.Parse(userId)); return Ok(new { code = 0, msg = "鑾峰彇琛ユ墦绠辩爜鏍囩淇℃伅", data = list }); } catch (Exception e) @@ -985,7 +990,7 @@ { return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" }); } - _BoxInfoSvc.DelLabelByAsnNo(model.AsnNo,model.LotNo,int.Parse(userId)); + _BoxInfoSvc.DelLabelByAsnNo(model.AsnNo, model.LotNo, int.Parse(userId)); return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛", data = "" }); } catch (Exception e) @@ -1127,7 +1132,7 @@ { try { - var type = new List<string>() { "0","1","2" }; + var type = new List<string>() { "0", "1", "2" }; var bolls = _taskSvc.GetArchivingTaskList(type, model.Type, model.Status, model.TaskNo, model.IsSuccess, model.PalletNo, model.Msg, model.Page, model.Limit, out int count); return Ok(new { code = 0, count, msg = "浠诲姟淇℃伅", data = bolls }); @@ -1148,7 +1153,7 @@ { try { - var bolls = _logSvc.GetArchivingLogOperationList(model.ComeFrom,model.MenuName, model.Type, model.Msg, model.StartTime, model.EndTime, model.Page, model.Limit, out int count); + var bolls = _logSvc.GetArchivingLogOperationList(model.ComeFrom, model.MenuName, model.Type, model.Msg, model.StartTime, model.EndTime, model.Page, model.Limit, out int count); return Ok(new { code = 0, count, msg = "鍏ュ簱鎿嶄綔鏃ュ織淇℃伅", data = bolls }); } @@ -1164,40 +1169,36 @@ /// 鑾峰彇閲囪喘鍗曚俊鎭� /// </summary> /// <param name="model">鏌ヨ鏉′欢</param> - /// <returns>鍏ュ簱鍗曚俊鎭�</returns> + /// <returns>閲囪喘鍗曚俊鎭�</returns> [HttpPost] - public IActionResult GetProcurePlanNoticeList(ProcurePlanNoticeVm model) + [ServiceFilter(typeof(ApiResponseActionFilter))] + public async Task<SqlSugarPagedList> GetProcurePlanNoticeList(ProcurePlanNoticeVm model) { - try - { - var models = _procurePlanSvc.GetProcurePlanNoticeList(model, out int count); - - return Ok(new { code = 0, count, msg = "鍏ュ簱鍗曚俊鎭�", data = models }); - } - catch (Exception e) - { - return Ok(new { code = 1, msg = e.Message }); - } + RefAsync<int> count = new RefAsync<int>(); + var bolls = await _procurePlanSvc.GetProcurePlanNoticeList(model, count); + return new SqlSugarPagedList() { Items = bolls, Total = count }; } + /// <summary> /// 鑾峰彇閲囪喘鍗曟槑缁嗕俊鎭� /// </summary> /// <param name="model"></param> /// <returns></returns> [HttpPost] - public IActionResult GetProcurePlanNoticeDetailList(ProcurePlanNoticeDetailVm model) + [ServiceFilter(typeof(ApiResponseActionFilter))] + public async Task<SqlSugarPagedList> GetProcurePlanNoticeDetailList(ProcurePlanNoticeDetailVm model) { - try - { - var models = _procurePlanSvc.GetProcurePlanNoticeDetailList(model, out int count); + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + RefAsync<int> count = new RefAsync<int>(); + var bolls = await _procurePlanSvc.GetProcurePlanNoticeDetailList(model, count); + stopwatch.Stop(); - return Ok(new { code = 0, count, msg = "鍏ュ簱鍗曟槑缁嗕俊鎭�", data = models }); - } - catch (Exception e) - { - return Ok(new { code = 1, msg = e.Message }); - } + var time = stopwatch.ElapsedMilliseconds; + return new SqlSugarPagedList() { Items = bolls, Total = count }; } + + /// <summary> /// 閫氳繃閲囪喘鍗曠敓鎴愬叆搴撳崟鎹� /// </summary> @@ -1218,7 +1219,7 @@ { throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅"); } - + _procurePlanSvc.CreateAsnByProcurePlan(Convert.ToInt32(model.Id), int.Parse(UserId)); return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" }); @@ -1260,6 +1261,23 @@ } } #endregion + + #region 涓婃灦浠诲姟璁板綍 + + /// <summary> + /// 鑾峰彇涓婃灦浠诲姟璁板綍淇℃伅鍒嗛〉闆嗗悎 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + [ServiceFilter(typeof(ApiResponseActionFilter))] + public async Task<SqlSugarPagedList> GetPalletUpShelfList(PalletUpShelfVm model) + { + RefAsync<int> count = new RefAsync<int>(); + var data = await _palletUpShelfSvc.GetPalletUpShelfList(model.TraceNo, model.TaskNo,model.PalletNo,model.SkuNo,model.SkuName,model.LotNo,model.Status,model.Page,model.Limit, count); + return new SqlSugarPagedList() { Items = data, Total = count }; + } + #endregion } } -- Gitblit v1.8.0