From d9c99e0480b4910cdb134778dd5c314b35ec4cf2 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期一, 29 九月 2025 10:05:23 +0800 Subject: [PATCH] 1 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_AGV.cs | 49 ++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 38 insertions(+), 11 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_AGV.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_AGV.cs" index d1ca057..d6653b6 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_AGV.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_AGV.cs" @@ -127,7 +127,7 @@ var qty = saveModel.MainData["qty"].ToString(); if (string.IsNullOrEmpty(qty)) throw new Exception("琚嬫暟涓嶅彲涓虹┖"); var batchNo = saveModel.MainData["batchNo"].ToString(); - if (string.IsNullOrEmpty(batchNo)) throw new Exception("鏌滃彿涓嶅彲涓虹┖"); + if (string.IsNullOrEmpty(batchNo)) throw new Exception("鎵瑰彿涓嶅彲涓虹┖"); #region 鏌ヨ搴撳瓨銆佸叆搴撳崟 Dt_InventoryInfo inventoryInfo = _inventoryInfoRepository.QueryFirst(x => x.PalletCode == palletCode); @@ -137,8 +137,27 @@ if (inboundOrderDetail.OrderQuantity - inboundOrderDetail.ReceiptQuantity < qty.ObjToInt()) throw new Exception($"鎵瑰彿銆恵batchNo}銆戝彲缁勭洏鏁伴噺涓嶈冻"); Dt_InboundOrder? inboundOrder = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.Id == inboundOrderDetail.OrderId); if (inboundOrder == null) throw new Exception($"鏈壘鍒版壒鍙蜂负銆恵batchNo}銆戠殑鍏ュ簱鍗�"); - Dt_Inventory_Batch inventory_Batch = _inventoryBatchRepository.QueryFirst(x => x.BatchNo == batchNo); - if (inventory_Batch == null) throw new Exception($"鏈壘鍒版壒鍙蜂负銆恵batchNo}銆戠殑鎵规淇℃伅"); + var materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == inboundOrderDetail.MaterielCode); + if (materielInfo == null) throw new Exception($"鏈壘鍒扮墿鏂欎俊鎭�,鐗╂枡缂栫爜銆恵inboundOrderDetail.MaterielCode}銆�"); + //Dt_Inventory_Batch inventory_Batch = _inventoryBatchRepository.QueryFirst(x => x.BatchNo == batchNo); + //if (inventory_Batch == null && inboundOrder.OrderType == InOrderTypeEnum.Quality.ObjToInt()) + // throw new Exception($"鏈壘鍒版壒鍙蜂负銆恵batchNo}銆戠殑鎵规淇℃伅"); + //bool add = inventory_Batch == null; + //if (add) + //{ + var productionDate = DateTime.Now.ToString("yyyy-MM-dd"); + var validityPeriod = DateTime.Now.AddDays(materielInfo.Validity).ToString("yyyy-MM-dd");//鍔犲ぉ + // inventory_Batch = new Dt_Inventory_Batch() + // { + // BatchNo = inboundOrderDetail.BatchNo, + // MaterielCode = inboundOrderDetail.MaterielCode, + // MaterielName = inboundOrderDetail.MaterielName, + // ProductionDate = productionDate, + // ShelfLife = materielInfo.Validity, + // ValidityPeriod = validityPeriod, + // Creater = "System" + // }; + //} #endregion #region 鍒涘缓浠诲姟 @@ -163,15 +182,15 @@ #region 娣诲姞搴撳瓨淇℃伅銆佸鐞嗗叆搴撳崟 inventoryInfo = new Dt_InventoryInfo() { - BatchNo = inventory_Batch.BatchNo, - MaterielCode = inventory_Batch.MaterielCode, - MaterielName = inventory_Batch.MaterielName, + BatchNo = inboundOrderDetail.BatchNo, + MaterielCode = inboundOrderDetail.MaterielCode, + MaterielName = inboundOrderDetail.MaterielName, PalletCode = palletCode, - ProductionDate = inventory_Batch.ProductionDate, + ProductionDate = productionDate, StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(), ProductStatus = dt_Task.TaskType == TaskTypeEnum.InQuality.ObjToInt() ? ProductStatusEmun.寰呮2.ObjToInt() : ProductStatusEmun.寰呮1.ObjToInt(), - ShelfLife = inventory_Batch.ShelfLife, - ValidityPeriod = inventory_Batch.ValidityPeriod, + ShelfLife = materielInfo.Validity, + ValidityPeriod = validityPeriod, StockQuantity = qty.ObjToInt(), BoxQuantity = (qty.ObjToInt() % 8 > 0) ? (qty.ObjToInt() / 8) + 1 : qty.ObjToInt() / 8, Creater = "System" @@ -179,14 +198,22 @@ inboundOrder.OrderStatus = InboundStatusEnum.鍏ュ簱涓�.ObjToInt(); inboundOrderDetail.ReceiptQuantity += inventoryInfo.StockQuantity; inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.GroupAndInbound.ObjToInt(); - inventory_Batch.ProductStatus = inventoryInfo.ProductStatus; + //inventory_Batch.ProductStatus = inventoryInfo.ProductStatus; #endregion Db.Ado.BeginTran(); _inboundService.InbounOrderService.UpdateData(inboundOrder); _inboundService.InboundOrderDetailService.UpdateData(inboundOrderDetail); _inventoryInfoRepository.AddData(inventoryInfo); - _inventoryBatchRepository.UpdateData(inventory_Batch); + //if (add) + //{ + // inventory_Batch.BoxQuantity = inventoryInfo.BoxQuantity; + // inventory_Batch.OutboundQuantity = inventoryInfo.OutboundQuantity; + // inventory_Batch.StockQuantity = inventoryInfo.StockQuantity; + // _inventoryBatchRepository.AddData(inventory_Batch); + //} + //else + // _inventoryBatchRepository.UpdateData(inventory_Batch); AddData(dt_Task); List<WMSTaskDTO> wMSTaskDTOs = _mapper.Map<List<WMSTaskDTO>>(new List<Dt_Task> { dt_Task }); var ResultData = HttpHelper.PostAsync(WCSInterfaceAddress.ReceiveTask, wMSTaskDTOs.ToJson(), headers: new Dictionary<string, string>()); -- Gitblit v1.9.3