From fa1710525de985e99562e066c755c9ce3061a38e Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期一, 23 十二月 2024 11:04:05 +0800 Subject: [PATCH] PDA组盘 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_MenuController.cs | 10 ++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs | 159 +++++++++++++++++++++++++++++++++++++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ISystemRepository/ISys_MenuRepository.cs | 4 + 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_MenuService.cs | 14 +++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs | 14 +++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ISystemService/ISys_MenuService.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs | 8 + 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs | 3 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 7 + 10 files changed, 211 insertions(+), 12 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs" index a23bac9..db7d5b0 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs" @@ -22,5 +22,7 @@ WebResponseContent MaterielGroup(int inboundOrderId, string palletCode, List<string> serNums); WebResponseContent FeedbackInboundOrder(int id); + + WebResponseContent MaterielGroup(SaveModel saveModel); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemRepository/ISys_MenuRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemRepository/ISys_MenuRepository.cs" index b9e9f7b..aa11059 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemRepository/ISys_MenuRepository.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemRepository/ISys_MenuRepository.cs" @@ -13,6 +13,10 @@ public interface ISys_MenuRepository : IRepository<Sys_Menu> { List<MenuDTO> GetAllMenu(); + /// <summary> + /// 鑾峰彇鎵�鏈塒DA鏉冮檺 + /// </summary> + /// <returns></returns> List<MenuDTO> GetAllMenuPDA(); object GetSuperAdminMenu(); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemService/ISys_MenuService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemService/ISys_MenuService.cs" index 636fb9d..80b5af3 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemService/ISys_MenuService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemService/ISys_MenuService.cs" @@ -31,5 +31,7 @@ WebResponseContent Save(Sys_Menu menu); WebResponseContent DelMenu(int menuId); + + object? GetTreeMenuPDAStash(int ParentId); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" index 19272e1..7d2eb1b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" @@ -47,7 +47,8 @@ /// <param name="palletCode">鎵樼洏鍙�</param> /// <param name="stationCode">绔欏彴鍙�</param> /// <returns></returns> - WebResponseContent RequestInboundTask(string palletCode, string stationCode); + //WebResponseContent RequestInboundTask(string palletCode, string stationCode); + WebResponseContent RequestInboundTask(SaveModel saveModel); /// <summary> /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅 diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" index f21b03a..86ee62b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" @@ -64,15 +64,16 @@ try { int pageNo = saveModel.MainData["pageNo"].ObjToInt(); - string orderNo = saveModel.MainData["orderNo"].ToString(); + string? orderNo = saveModel.MainData["orderNo"].ToString(); + int warehouseId = saveModel.MainData["warehouseId"].ObjToInt(); List<Dt_InboundOrder> dt_ReceiveOrders = new List<Dt_InboundOrder>(); if (string.IsNullOrEmpty(orderNo)) { - dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt()).ToPageList(pageNo, 5); + dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).ToPageList(pageNo, 5); } else { - dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.InboundOrderNo.Contains(orderNo)) && x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt()).ToPageList(pageNo, 5); + dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.InboundOrderNo.Contains(orderNo)) && x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).ToPageList(pageNo, 5); } content.OK(data: dt_ReceiveOrders); @@ -172,7 +173,159 @@ return WebResponseContent.Instance.Error(ex.Message); } } + /// <summary> + /// 缁勭洏 + /// </summary> + /// <param name="saveModel"></param> + /// <returns></returns> + public WebResponseContent MaterielGroup(SaveModel saveModel) + { + WebResponseContent content = new WebResponseContent(); + try + { + var orderNo = saveModel.MainData["orderNo"].ToString(); + var palletCode = saveModel.MainData["palletCode"].ToString(); + var warehouseId = saveModel.MainData["warehouseId"].ObjToInt(); + var serNums = saveModel.DelKeys.Select(x => x.ToString()).ToList(); + Dt_InboundOrder inboundOrder = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == orderNo && x.WarehouseId == warehouseId).Includes(x => x.Details).First(); + if (inboundOrder == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟淇℃伅"); + } + if (inboundOrder.Details == null || inboundOrder.Details.Count <= 0) + { + return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟鏄庣粏淇℃伅"); + } + Dt_ReceiveOrder receiveOrder = _inboundRepository.ReceiveOrderRepository.Db.Queryable<Dt_ReceiveOrder>().Where(x => x.ReceiveOrderNo == inboundOrder.UpperOrderNo).Includes(x => x.Details).First(); + if (receiveOrder == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑鏀惰揣鍗�"); + } + if (receiveOrder.Details == null || receiveOrder.Details.Count <= 0) + { + return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑鏀惰揣鍗曟槑缁�"); + } + + List<string> purchaseOrderNos = receiveOrder.Details.Select(x => x.PurchaseOrderNo).ToList(); + + List<MatSerNumAnalysisModel> models = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(AnalysisCodeEnum.MatSerNumAnalysis, serNums); + + if (models.Select(x => x.MaterielCode).Distinct().Count() > 1) + { + return WebResponseContent.Instance.Error($"鐗╂枡涓嶅彲娣锋斁"); + } + + string materielCode = models.FirstOrDefault()?.MaterielCode ?? ""; + Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == materielCode); + if (materielInfo == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒拌鐗╂枡鐨勪俊鎭�"); + } + + List<Dt_InboundOrderDetail> inboundOrderDetails = inboundOrder.Details.Where(x => x.MaterielCode == materielCode).ToList(); + + if (inboundOrderDetails == null || inboundOrderDetails.Count <= 0) + { + return WebResponseContent.Instance.Error($"鏈湪鍏ュ簱鍗曟槑缁嗕腑鎵惧埌璇ョ墿鏂欎俊鎭�"); + } + if (receiveOrder.Details.FirstOrDefault(x => x.MaterielCode == materielCode) == null) + { + return WebResponseContent.Instance.Error($"鏈湪鏀惰揣鍗曟槑缁嗕腑鎵惧埌璇ョ墿鏂欎俊鎭�"); + } + + float beforeQuantity = 0; + + Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); + if (stockInfo == null) + { + stockInfo = new Dt_StockInfo() + { + PalletCode = palletCode, + StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(), + WarehouseId = inboundOrder.WarehouseId, + PalletType = PalletTypeEnum.SmallPallet.ObjToInt(), + Details = new List<Dt_StockInfoDetail>() + }; + } + else + { + if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt()) + { + return WebResponseContent.Instance.Error($"鎵樼洏鍙烽噸澶�"); + } + beforeQuantity = stockInfo.Details.Sum(x => x.StockQuantity); + } + + List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); + List<int> detailKeys = new List<int>(); + foreach (var model in models) + { + if (purchaseOrderNos.FirstOrDefault(x => x == model.PurchaseOrderNo) == null) + { + return WebResponseContent.Instance.Error($"鏈湪鏀惰揣鍗曟槑缁嗕腑鎵惧埌璇ラ噰璐崟"); + } + + Dt_InboundOrderDetail? notGroupDetail = inboundOrderDetails.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt() && x.OrderQuantity == model.Quantity && !detailKeys.Contains(x.Id) && x.OrderQuantity > x.ReceiptQuantity).FirstOrDefault(); + + if (notGroupDetail == null) + { + return WebResponseContent.Instance.Error($"璇ョ墿鏂欏湪璇ュ叆搴撳崟涓凡鍏ㄩ儴缁勭洏瀹屾垚"); + } + detailKeys.Add(notGroupDetail.Id); + Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() + { + BatchNo = model.LotNo, + MaterielCode = materielInfo.MaterielCode, + MaterielName = materielInfo.MaterielName, + OrderNo = inboundOrder.InboundOrderNo, + SerialNumber = model.SerialNumber, + StockQuantity = model.Quantity, + OutboundQuantity = 0, + Status = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(), + ProductionDate = model.ProductionDate, + EffectiveDate = model.EffectiveDate, + InboundOrderRowNo = notGroupDetail.RowNo, + }; + + if (stockInfo.Id > 0) + { + stockInfoDetail.StockId = stockInfo.Id; + } + stockInfo.Details.Add(stockInfoDetail); + + stockInfoDetails.Add(stockInfoDetail); + + notGroupDetail.ReceiptQuantity = model.Quantity; + notGroupDetail.OrderDetailStatus = OrderDetailStatusEnum.GroupAndInbound.ObjToInt(); + } + + float totalQuantity = stockInfo.Details.Sum(x => x.StockQuantity); + + inboundOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱涓�.ObjToInt(); + + _unitOfWorkManage.BeginTran(); + if (stockInfo.Id == 0) + { + _stockRepository.StockInfoRepository.Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); + } + else + { + _stockRepository.StockInfoRepository.Db.UpdateNav(stockInfo).Include(x => x.Details, new UpdateNavOptions() { OneToManyInsertOrUpdate = true }).ExecuteCommand(); + } + _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetails); + _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder); + _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.MaterielGroup); + _unitOfWorkManage.CommitTran(); + content.OK(); + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + content.Error(ex.Message); + } + return content; + } public WebResponseContent MaterielGroup(int inboundOrderId, string palletCode, List<string> serNums) { try diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_MenuService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_MenuService.cs" index 82d9289..57fa60c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_MenuService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_MenuService.cs" @@ -50,6 +50,16 @@ } /// <summary> + /// 鑾峰彇PDA棣栭〉浠撳簱鏉冮檺 + /// </summary> + /// <returns></returns> + public object GetTreeMenuPDAStash(int ParentId) + { + List<MenuDTO> _menus = BaseDal.GetAllMenuPDA().Where(x => x.ParentId == ParentId).ToList(); + return _menus; + } + + /// <summary> /// 鏍规嵁瑙掕壊ID鑾峰彇鑿滃崟涓庢潈闄� /// </summary> /// <param name="roleId"></param> @@ -167,7 +177,7 @@ if (menu.MenuId == menu.ParentId) { return webResponse.Error($"鐖剁骇id涓嶈兘涓鸿嚜宸�"); - } + } if (BaseDal.QueryFirst(x => x.ParentId == menu.MenuId && menu.ParentId == x.MenuId) != null) { return webResponse.Error($"涓嶈兘閫夋嫨姝ょ埗绾d锛岄�夋嫨鐨勭埗绾d涓庡綋鍓嶈彍鍗曞舰鎴愪緷璧栧叧绯�"); @@ -190,7 +200,7 @@ public WebResponseContent DelMenu(int menuId) { WebResponseContent webResponse = new WebResponseContent(); - if(BaseDal.QueryFirst(x=>x.ParentId == menuId) != null) + if (BaseDal.QueryFirst(x => x.ParentId == menuId) != null) { return webResponse = WebResponseContent.Instance.Error("褰撳墠鑿滃崟瀛樺湪瀛愯彍鍗�,璇峰厛鍒犻櫎瀛愯彍鍗�!"); } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" index 42c290b..f1a3944 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" @@ -21,11 +21,14 @@ /// <param name="palletCode">鎵樼洏鍙�</param> /// <param name="stationCode">绔欏彴鍙�</param> /// <returns></returns> - public WebResponseContent RequestInboundTask(string palletCode, string stationCode) + public WebResponseContent RequestInboundTask(SaveModel saveModel) { try { - Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode); + var palletCode = saveModel.MainData["barcode"].ToString(); + var warehouseId = saveModel.MainData["warehouseId"].ObjToInt(); + var stationCode = saveModel.MainData["startPoint"].ToString(); + Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode && x.WarehouseId == warehouseId); if (task != null) { return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡鐢熸垚浠诲姟"); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs" index 1b4e531..e202106 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs" @@ -46,10 +46,20 @@ /// <param name="palletCode"></param> /// <param name="serNums"></param> /// <returns></returns> + //[HttpPost, HttpGet, Route("MaterielGroup")] + //public WebResponseContent MaterielGroup(int inboundOrderId, string palletCode, List<string> serNums) + //{ + // return Service.MaterielGroup(inboundOrderId, palletCode, serNums); + //} + /// <summary> + /// + /// </summary> + /// <param name="saveModel"></param> + /// <returns></returns> [HttpPost, HttpGet, Route("MaterielGroup")] - public WebResponseContent MaterielGroup(int inboundOrderId, string palletCode, List<string> serNums) + public WebResponseContent MaterielGroup([FromBody] SaveModel saveModel) { - return Service.MaterielGroup(inboundOrderId, palletCode, serNums); + return Service.MaterielGroup(saveModel); } /// <summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_MenuController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_MenuController.cs" index 4bddd8e..b86710c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_MenuController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_MenuController.cs" @@ -50,5 +50,15 @@ { return Service.DelMenu(menuId); } + + /// <summary> + /// 鑾峰彇棣栭〉鎵�鏈変粨搴撴潈闄� + /// </summary> + /// <returns></returns> + [HttpGet, HttpPost, Route("GetTreeMenuPDAStash")] + public IActionResult GetTreeMenuPDAStash(int ParentId) + { + return Json(Service.GetTreeMenuPDAStash(ParentId)); + } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" index 30aaf39..e4e773a 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" @@ -35,10 +35,14 @@ /// <param name="stationCode"></param> /// <returns></returns> [HttpPost, HttpGet, Route("RequestInboundTask"), AllowAnonymous] - public WebResponseContent RequestInboundTask(string palletCode, string stationCode) + public WebResponseContent RequestInboundTask([FromBody] SaveModel saveModel) { - return Service.RequestInboundTask(palletCode, stationCode); + return Service.RequestInboundTask(saveModel); } + //public WebResponseContent RequestInboundTask(string palletCode, string stationCode) + //{ + // return Service.RequestInboundTask(palletCode, stationCode); + //} /// <summary> /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅 -- Gitblit v1.9.3