From 7ca9651f81d7b84f054194d3d46fdbd1d9c8b922 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期三, 09 七月 2025 22:55:27 +0800 Subject: [PATCH] 增加质检出入库逻辑 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_ProductionLine.cs | 59 +++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 41 insertions(+), 18 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_ProductionLine.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_ProductionLine.cs" index a8b8f2f..7cfc6a2 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_ProductionLine.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_ProductionLine.cs" @@ -25,20 +25,16 @@ WebResponseContent content = new WebResponseContent(); try { - Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(productionlineDTO.Barcode); - if (stockInfo != null) throw new Exception($"鎵樼洏銆恵productionlineDTO.Barcode}銆戝凡瀛樺湪搴撳瓨淇℃伅"); - stockInfo = new Dt_StockInfo(); - stockInfo.Details = new List<Dt_StockInfoDetail>(); #region MyRegion - string OrderNo = productionlineDTO.batchNo.Substring(0, 8);// DateTime.Now.ToString("yyMMdd"); - Dt_InboundOrder? inboundOrder = _inboundService.InbounOrderService.GetInboundOrder(OrderNo); - if (inboundOrder == null) throw new Exception($"鏈壘鍒版壒鍙蜂负銆恵OrderNo}銆戠殑鍏ュ簱鍗�"); - //var BatchNo = string.Join("", productionlineDTO.batchNo.Except(OrderNo)); - var BatchNo = productionlineDTO.batchNo.Substring(8); - Dt_InboundOrderDetail? inboundOrderDetail = inboundOrder.Details.Where(x => x.BatchNo == BatchNo).FirstOrDefault(); - if (inboundOrderDetail == null) throw new Exception($"鎵瑰彿銆恵OrderNo}銆戠殑鍏ュ簱鍗曟湭鎵惧埌鏌滃彿銆恵BatchNo}銆�"); - if (inboundOrderDetail.OrderQuantity - inboundOrderDetail.ReceiptQuantity < 1) throw new Exception($"鎵瑰彿銆恵OrderNo}銆戠殑鏌滃彿銆恵BatchNo}銆戝彲缁勭洏鏁伴噺涓嶈冻"); - + Dt_InventoryInfo inventoryInfo = _inventoryInfoRepository.QueryFirst(x => x.PalletCode == productionlineDTO.Barcode); + if (inventoryInfo != null) throw new Exception($"鎵樼洏銆恵productionlineDTO.Barcode}銆戝凡瀛樺湪搴撳瓨淇℃伅"); + Dt_InboundOrderDetail inboundOrderDetail = _inboundService.InboundOrderDetailService.Repository.QueryFirst(x => x.BatchNo == productionlineDTO.batchNo); + if (inboundOrderDetail == null) throw new Exception($"鏈壘鍒版壒鍙枫�恵productionlineDTO.batchNo}銆戠殑鍏ュ簱鍗�"); + if (inboundOrderDetail.OrderQuantity - inboundOrderDetail.ReceiptQuantity < 1) throw new Exception($"鎵瑰彿銆恵productionlineDTO.batchNo}銆戠殑鍙粍鐩樻暟閲忎笉瓒�"); + Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.Id == inboundOrderDetail.OrderId); + if (inboundOrder == null) throw new Exception($"鏈壘鍒版壒鍙蜂负銆恵productionlineDTO.batchNo}銆戠殑鍏ュ簱鍗�"); + var materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == inboundOrderDetail.MaterielCode); + if (materielInfo == null) throw new Exception($"鏈壘鍒扮墿鏂欎俊鎭�,鐗╂枡缂栫爜銆恵inboundOrderDetail.MaterielCode}銆�"); Dt_Task dt_Task = new Dt_Task() { CurrentAddress = productionlineDTO.stationCode, @@ -56,12 +52,39 @@ Dispatchertime = DateTime.Now, }; - productionlineDTO.batchNo = BatchNo; - content = _stockService.StockInfoService.AddStockInfo(ref stockInfo, ref inboundOrder, productionlineDTO); - if (!content.Status) throw new Exception(content.Message); + var productionDate = DateTime.Now.ToString("yyyy-MM-dd"); + var validityPeriod = DateTime.Now.AddDays(materielInfo.Validity).ToString("yyyy-MM-dd");//鍔犲ぉ + //var validityPeriod = DateTime.Now.AddMonths(materielInfo.Validity).ToString("yyyy-MM-dd");//鍔犳湀 + //var validityPeriod = DateTime.Now.AddYears(materielInfo.Validity).ToString("yyyy-MM-dd");//鍔犲勾 + #region 搴撳瓨 + inventoryInfo = new Dt_InventoryInfo() + { + BatchNo = productionlineDTO.batchNo, + MaterielCode = inboundOrderDetail.MaterielCode, + MaterielName = inboundOrderDetail.MaterielName, + PalletCode = productionlineDTO.Barcode, + ProductionDate = productionDate, + StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(), + ProductStatus = ProductStatusEmun.寰呮1.ObjToInt(), + ShelfLife = materielInfo.Validity, + ValidityPeriod = validityPeriod, + Creater = "System" + }; + #endregion + + #region 鍏ュ簱鍗� + inboundOrder.OrderStatus = InboundStatusEnum.鍏ュ簱涓�.ObjToInt(); + var Item1 = _inboundService.InboundOrderDetailService.GetBoxStockQuantity(inboundOrderDetail); + inventoryInfo.StockQuantity = Item1.StockQuantity; + inventoryInfo.BoxQuantity = Item1.BoxQuantity; + inboundOrderDetail.ReceiptQuantity = inboundOrderDetail.ReceiptQuantity + Item1.StockQuantity; + inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.GroupAndInbound.ObjToInt(); + #endregion + Db.Ado.BeginTran(); - _inboundService.InbounOrderService.UpdateDataWithDetail(inboundOrder); - _stockService.StockInfoService.AddMaterielGroup(stockInfo); + _inboundService.InbounOrderService.UpdateData(inboundOrder); + _inboundService.InboundOrderDetailService.UpdateData(inboundOrderDetail); + _inventoryInfoRepository.AddData(inventoryInfo); AddData(dt_Task); content.OK(data: dt_Task); Db.Ado.CommitTran(); -- Gitblit v1.9.3