WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/CodeChunks.db-shmBinary files differ
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/CodeChunks.db-walBinary files differ
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/SemanticSymbols.db-shmBinary files differ
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/SemanticSymbols.db-walBinary files differ
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/00351db1-9e11-40ea-ae5a-60b802e9090b.vsidxBinary files differ
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/2a767928-fd5b-4e36-8c14-d55cf9bf3c7e.vsidxBinary files differ
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/927f8f99-0da5-491f-9629-b7444b682f34.vsidxBinary files differ
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/9af5db90-4300-4bcc-9ffe-576081c855e3.vsidxBinary files differ
WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/PalletTypeInfoService.cs
@@ -33,9 +33,13 @@ List<string> PalletCodes = new List<string>(); for (int i = 0; i < num; i++) { //PalletCodes.Add(GetOrderPintCode("PalletCodes"),palletCodeType); PalletCodes.Add(GetOrderPintCode($"{palletCodeType}PalletCodes",palletCodeType)); } content= PrintPallet(PalletCodes); //content= PrintPallet(PalletCodes); foreach(var PalletCode in PalletCodes) { Console.WriteLine(PalletCode); } return content.OK(); } catch (Exception ex) @@ -52,20 +56,20 @@ public string GetOrderPintCode(string printCode,string palletCodeType) { string PrintCode = ""; //var PrintSetting = SqlSugarHelper.DbWMS.Queryable<Dt_PrintSetting>().Where(x => x.PrintCode == printCode).ToList().FirstOrDefault(); var PrintSetting = Db.Queryable<Dt_PrintSetting>().Where(x => x.PrintCode == printCode).ToList().FirstOrDefault(); //if (PrintSetting.Spare1 == DateTime.Now.ToString("yyyyMMdd")) //{ // PrintCode = PrintSetting.Spare1 + PrintSetting.PrintNo.ToString().PadLeft(PrintSetting.Spare2, '0'); // PrintSetting.PrintNo = PrintSetting.PrintNo + 1; //} //else //{ // PrintSetting.Spare1 = DateTime.Now.ToString("yyyyMMdd"); // PrintSetting.PrintNo = 2; // PrintCode = PrintSetting.Spare1 + 1.ToString().PadLeft(PrintSetting.Spare2, '0'); //} //SqlSugarHelper.DbWMS.Updateable(PrintSetting).ExecuteCommand(); if (PrintSetting.Spare1 == DateTime.Now.ToString("yyyyMMdd")) { PrintCode = palletCodeType+PrintSetting.Spare1 + PrintSetting.PrintNo.ToString().PadLeft(PrintSetting.Spare2, '0'); PrintSetting.PrintNo = PrintSetting.PrintNo + 1; } else { PrintSetting.Spare1 = DateTime.Now.ToString("yyyyMMdd"); PrintSetting.PrintNo = 2; PrintCode = palletCodeType+PrintSetting.Spare1 + 1.ToString().PadLeft(PrintSetting.Spare2, '0'); } Db.Updateable(PrintSetting).ExecuteCommand(); return PrintCode; } WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderDetailService.cs
@@ -28,6 +28,14 @@ /// <param name="outboundOrderDetails"></param> /// <returns></returns> (List<Dt_StockInfo>, List<Dt_OutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(List<Dt_OutboundOrderDetail> outboundOrderDetails); /// <summary> /// 低温、药水出库逻辑 /// </summary> /// <param name="outboundOrderDetails"></param> /// <returns></returns> public (List<Dt_StockInfo>, List<Dt_OutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) DWANDYSAssignStockOutbound(List<Dt_OutboundOrderDetail> outboundOrderDetails); WebResponseContent LockOutboundStock(int orderDetailId, List<StockSelectViewDTO> stockSelectViews); WebResponseContent LockOutboundStock(int[] keys); WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs
@@ -32,7 +32,16 @@ List<Dt_StockInfo> GetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, decimal needQuantity, out decimal residueQuantity); public List<Dt_StockInfo> DWANDYSGetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, string batchNo, decimal needQuantity, out decimal residueQuantity); public List<Dt_StockInfo> DWANDYSGetOutboundStocks(List<Dt_StockInfo> stockInfos,List<Dt_OutboundOrderDetail> dt_OutboundOrderDetails, out List<residueQuantity> residueQuantitys); /// <summary> /// /// </summary> public class residueQuantity { public string MaterielCode { get; set; } public string BatchNo { get; set; } public decimal NewNeendQuantity { get; set; } } } } WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
@@ -357,16 +357,10 @@ } List<Dt_StockInfo> autoAssignStocks = new List<Dt_StockInfo>(); decimal newResidueQuantity = 0; if (warehouse.Any(x => x.WarehouseCode.Contains("DW")) || warehouse.Any(x => x.WarehouseCode.Contains("YS"))) { autoAssignStocks = _stockService.StockInfoService.DWANDYSGetOutboundStocks(stockInfos, item.MaterielCode, item.BatchNo, needQuantity,out decimal residueQuantity); newResidueQuantity = residueQuantity; } else { autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, item.MaterielCode, needQuantity, out decimal residueQuantity); newResidueQuantity = residueQuantity; } item.LockQuantity += needQuantity - newResidueQuantity; outStocks.AddRange(autoAssignStocks); decimal assignQuantity = needQuantity - newResidueQuantity; @@ -419,9 +413,173 @@ locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList())); } return (outStocks, outboundOrderDetails, outStockLockInfos, locationInfos); } /// <summary> /// 低温、药水库存分配 /// </summary> /// <param name="outboundOrderDetails"></param> /// <returns></returns> /// <exception cref="Exception"></exception> public (List<Dt_StockInfo>, List<Dt_OutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) DWANDYSAssignStockOutbound(List<Dt_OutboundOrderDetail> outboundOrderDetails) { if (!outboundOrderDetails.Any()) { throw new Exception($"未找到出库单明细信息"); } if (outboundOrderDetails.GroupBy(x => x.OrderId).Count() > 1) { throw new Exception($"请勿同时操作多个单据明细"); } Dt_OutboundOrder outboundOrder = _outboundRepository.OutboundOrderRepository.QueryFirst(x => x.Id == outboundOrderDetails.FirstOrDefault().OrderId); List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); List<Dt_OutboundOrderDetail> groupDetails = outboundOrderDetails.GroupBy(x => new { x.MaterielCode, x.BatchNo, x.LocationName }).Select(x => new Dt_OutboundOrderDetail { OrderQuantity = x.Sum(v => v.OrderQuantity) - x.Sum(v => v.LockQuantity), MaterielCode = x.Key.MaterielCode, BatchNo = x.Key.BatchNo, LocationName = x.Key.LocationName }).ToList(); List<Dt_Warehouse> warehouse = new List<Dt_Warehouse>(); warehouse = _basicService.WarehouseService.Repository.QueryData(x => x.WarehouseDes == outboundOrder.OutWareHouse); List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); List<string> PalletCodes = new List<string>(); foreach(var groupDetail in groupDetails) { Dt_StockInfo dt_StockInfo = new Dt_StockInfo(); List<Dt_StockInfoDetail> dt_StockInfoDetails = _stockService.StockInfoDetailService.Repository.QueryData(x => x.MaterielCode == groupDetail.MaterielCode && x.BatchNo == groupDetail.BatchNo); foreach(var stockInfoDetail in dt_StockInfoDetails) { dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.Id == stockInfoDetail.StockId && x.StockStatus == StockStatusEmun.入库完成.ObjToInt()); if(dt_StockInfo != null) { PalletCodes.Add(dt_StockInfo.PalletCode); } } if(!PalletCodes.Any()) { throw new Exception($"未找到可分配库存"); } } foreach(var PalletCode in PalletCodes.Distinct()) { List<Dt_StockInfo> stockInfos = new List<Dt_StockInfo>(); if (outboundOrderDetails.All(x => x.OrderQuantity == x.LockQuantity)) break; foreach (var item in groupDetails) { if (item.OrderQuantity == item.LockQuantity) continue; ///出库指定库位出库判断 if (item.LocationName != null && item.LocationName != "") { //stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterielCode, item.BatchNo, warehouse).Where(x => x.LocationCode == item.LocationName).ToList(); List<Dt_StockInfo> nowStockInfos = Db.Queryable<Dt_StockInfo>() .Where(x => x.PalletCode == PalletCode && x.Details.Any(v => v.BatchNo == item.BatchNo && v.MaterielCode == item.MaterielCode) && x.LocationCode == item.LocationName) .Includes(x => x.Details).ToList(); if (stockInfos.Count() == 0 && nowStockInfos.Count() > 0) { stockInfos.AddRange(nowStockInfos); } } else { //stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterielCode, item.BatchNo, warehouse); List<Dt_StockInfo> nowStockInfos = Db.Queryable<Dt_StockInfo>() .Where(x => x.PalletCode == PalletCode && x.Details.Any(v => v.BatchNo == item.BatchNo && v.MaterielCode == item.MaterielCode)) .Includes(x => x.Details).ToList(); if(stockInfos.Count() == 0 && nowStockInfos.Count() > 0) { stockInfos.AddRange(nowStockInfos); } } } if(stockInfos.Count() == 0) { continue; } List<Dt_StockInfo> autoAssignStocks = new List<Dt_StockInfo>(); List<IStockInfoService.residueQuantity> newResidueQuantitys = new List<IStockInfoService.residueQuantity>(); if (warehouse.Any(x => x.WarehouseCode.Contains("DW")) || warehouse.Any(x => x.WarehouseCode.Contains("YS"))) { autoAssignStocks = _stockService.StockInfoService.DWANDYSGetOutboundStocks(stockInfos,groupDetails, out List<IStockInfoService.residueQuantity> residueQuantitys); newResidueQuantitys.AddRange(residueQuantitys); outStocks.AddRange(autoAssignStocks); } foreach(var residueQuantity in newResidueQuantitys) { foreach (var item in groupDetails) { if(residueQuantity.MaterielCode == item.MaterielCode && residueQuantity.BatchNo == item.BatchNo) { decimal originalNeedQuantity = item.OrderQuantity; decimal needQuantity = originalNeedQuantity - item.LockQuantity; item.LockQuantity += needQuantity - residueQuantity.NewNeendQuantity; decimal assignQuantity = needQuantity - residueQuantity.NewNeendQuantity; List<Dt_OutboundOrderDetail> details = outboundOrderDetails.Where(x => !string.IsNullOrEmpty(x.BatchNo) ? x.BatchNo == item.BatchNo : true && x.MaterielCode == item.MaterielCode).ToList(); for (int i = 0; i < details.Count; i++) { decimal orderQuantity = details[i].OrderQuantity; for (int j = 0; j < autoAssignStocks.Count; j++) { decimal detailAssignQuantity = outStockLockInfos.Where(x => !string.IsNullOrEmpty(x.BatchNo) ? x.BatchNo == item.BatchNo : true && x.MaterielCode == item.MaterielCode && x.OrderDetailId == details[i].Id).Sum(x => x.AssignQuantity);//出库订单明细已分配数量 decimal palletAssignQuantity = outStockLockInfos.Where(x => x.BatchNo == item.BatchNo && x.MaterielCode == item.MaterielCode && x.PalletCode == autoAssignStocks[j].PalletCode).Sum(x => x.AssignQuantity);//出库详情已分配数量 if (string.IsNullOrEmpty(item.BatchNo)) { palletAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == item.MaterielCode && x.PalletCode == autoAssignStocks[j].PalletCode).Sum(x => x.AssignQuantity);//出库详情已分配数量 } decimal palletOutboundQuantity = 0; if (warehouse.Any(x => x.WarehouseCode.Contains("DW")) || warehouse.Any(x => x.WarehouseCode.Contains("YS"))) { palletOutboundQuantity = autoAssignStocks[j].Details.Where(x => x.BatchNo == item.BatchNo && x.MaterielCode == item.MaterielCode).Sum(x => x.OutboundQuantity); } if (palletAssignQuantity < palletOutboundQuantity)//如果出库详情已分配数量小于托盘已分配数量,则可以继续添加该托盘出库信息 { decimal orderDetailNeedQuantity = details[i].OrderQuantity - detailAssignQuantity; if (orderDetailNeedQuantity > autoAssignStocks[j].Details.Where(x => x.MaterielCode == details[i].MaterielCode && x.BatchNo == details[i].BatchNo).Sum(v => v.OutboundQuantity) - palletAssignQuantity) { //details[i].LockQuantity += autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity) - palletAssignQuantity; Dt_StockInfoDetail dt_StockInfoDetail = new Dt_StockInfoDetail(); foreach(var autoStockDestail in autoAssignStocks[j].Details) { if(autoStockDestail.MaterielCode == details[i].MaterielCode && autoStockDestail.BatchNo == details[i].BatchNo) { dt_StockInfoDetail = autoStockDestail; } } Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(outboundOrder, details[i], autoAssignStocks[j],dt_StockInfoDetail.OutboundQuantity); outStockLockInfos.Add(outStockLockInfo); details[i].LockQuantity += outStockLockInfo.AssignQuantity; break; } else { Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(outboundOrder, details[i], autoAssignStocks[j], details[i].OrderQuantity - details[i].LockQuantity); outStockLockInfos.Add(outStockLockInfo); details[i].LockQuantity = details[i].OrderQuantity; break; } } } } locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(autoAssignStocks.Select(x => x.LocationCode).ToList())); } } } newResidueQuantitys = new List<IStockInfoService.residueQuantity>(); } return (outStocks, outboundOrderDetails, outStockLockInfos, locationInfos); } private (bool, string) CheckSelectStockDeital(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews) { if (outboundOrderDetail == null) WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs
@@ -21,6 +21,7 @@ using WIDESEA_IStockRepository; using WIDESEA_IStockService; using WIDESEA_Model.Models; using static WIDESEA_IStockService.IStockInfoService; namespace WIDESEA_StockService { @@ -194,11 +195,18 @@ } //低温、药水分配库存 public List<Dt_StockInfo> DWANDYSGetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode,string batchNo ,decimal needQuantity, out decimal residueQuantity) public List<Dt_StockInfo> DWANDYSGetOutboundStocks(List<Dt_StockInfo> stockInfos,List<Dt_OutboundOrderDetail> dt_OutboundOrderDetails, out List<IStockInfoService.residueQuantity> residueQuantitys) { List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); decimal stockTotalQuantity = stockInfos.SelectMany(x => x.Details).Where(d => d.BatchNo == batchNo).Sum(v => v.StockQuantity - v.OutboundQuantity); stockInfos = stockInfos.Where(x => x.Details.Any(x => x.BatchNo == batchNo)).OrderBy(x => x.Id).ToList(); List<IStockInfoService.residueQuantity> newresidueQantity = new List<IStockInfoService.residueQuantity>(); List<Dt_StockInfo> notStocks = new List<Dt_StockInfo>(); ; foreach(var dt_OutboundOrderDetail in dt_OutboundOrderDetails) { notStocks = stockInfos.Where(x => x.Details.Any(x => x.BatchNo == dt_OutboundOrderDetail.BatchNo && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode)).OrderBy(x => x.Id).ToList(); if(notStocks.Count > 0) { decimal stockTotalQuantity = stockInfos.SelectMany(x => x.Details).Where(d => d.BatchNo == dt_OutboundOrderDetail.BatchNo).Sum(v => v.StockQuantity - v.OutboundQuantity); decimal needQuantity = dt_OutboundOrderDetail.OrderQuantity - dt_OutboundOrderDetail.LockQuantity; if (stockTotalQuantity >= needQuantity)//库存够 { int index = 0; @@ -209,7 +217,7 @@ Dt_StockInfoDetail dt_StockInfoDetail = new Dt_StockInfoDetail(); foreach(var detail in stockInfo.Details) { if(detail.BatchNo == batchNo && detail.MaterielCode == materielCode) if (detail.BatchNo == dt_OutboundOrderDetail.BatchNo && detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode) { dt_StockInfoDetail = detail; } @@ -219,7 +227,7 @@ { stockInfo.Details.ForEach(x => { if(x.MaterielCode == materielCode && x.BatchNo == batchNo) if (x.MaterielCode == dt_OutboundOrderDetail.MaterielCode && x.BatchNo == dt_OutboundOrderDetail.BatchNo) { x.OutboundQuantity = x.StockQuantity; } @@ -231,7 +239,7 @@ stockInfo.Details.ForEach(x => { if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == materielCode && x.BatchNo == batchNo) if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode && x.BatchNo == dt_OutboundOrderDetail.BatchNo) { if (x.StockQuantity - x.OutboundQuantity >= needQuantity) { @@ -258,7 +266,7 @@ decimal useableStockQuantity = 0; foreach (var detail in stockInfo.Details) { if(detail.MaterielCode == materielCode && detail.BatchNo == batchNo) if (detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode && detail.BatchNo == dt_OutboundOrderDetail.BatchNo) { useableStockQuantity = detail.StockQuantity - detail.OutboundQuantity; } @@ -267,7 +275,7 @@ if (useableStockQuantity < needQuantity) { stockInfo.Details.ForEach(x => { if(x.MaterielCode == materielCode && x.BatchNo == batchNo) if (x.MaterielCode == dt_OutboundOrderDetail.MaterielCode && x.BatchNo == dt_OutboundOrderDetail.BatchNo) { x.OutboundQuantity = x.StockQuantity; } @@ -278,7 +286,7 @@ { stockInfo.Details.ForEach(x => { if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == materielCode && x.BatchNo == batchNo) if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode && x.BatchNo == dt_OutboundOrderDetail.BatchNo) { if (x.StockQuantity - x.OutboundQuantity >= needQuantity) { @@ -296,7 +304,23 @@ outStocks.Add(stockInfo); } } residueQuantity = needQuantity; IStockInfoService.residueQuantity newResidueQuantity = new IStockInfoService.residueQuantity(); newResidueQuantity.MaterielCode = dt_OutboundOrderDetail.MaterielCode; newResidueQuantity.BatchNo = dt_OutboundOrderDetail.BatchNo; newResidueQuantity.NewNeendQuantity = needQuantity; newresidueQantity.Add(newResidueQuantity); } else { continue; } } residueQuantitys = newresidueQantity; if(outStocks.Count() > 1) { outStocks.RemoveRange(0, outStocks.Count - 1); } return outStocks; } //导出 WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
@@ -152,7 +152,16 @@ List<Dt_LocationInfo>? locationInfos = null; //if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) { (List<Dt_StockInfo>, List<Dt_OutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrderDetails); Dt_OutboundOrder dt_OutboundOrder = _outboundService.OutboundOrderService.Repository.QueryData(x => x.Id == outboundOrderDetails.First().OrderId).First(); (List<Dt_StockInfo>, List<Dt_OutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = new(); if (dt_OutboundOrder.OutWareHouse.Contains("DW") || dt_OutboundOrder.OutWareHouse.Contains("YS")) { result = _outboundService.OutboundOrderDetailService.DWANDYSAssignStockOutbound(outboundOrderDetails); } else { result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrderDetails); } if (result.Item1 != null && result.Item1.Count > 0) { Dt_OutboundOrder outboundOrder = _outboundService.OutboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetails.FirstOrDefault().OrderId); @@ -932,13 +941,23 @@ } if (result.Item5 != null && result.Item5.Count > 0) { if (locationInfos.First().RoadwayNo.Contains("DW") || locationInfos.First().RoadwayNo.Contains("YS")) { locationInfos.AddRange(result.Item5.Distinct()); } else { locationInfos.AddRange(result.Item5); } } if (result.Item1 != null && result.Item1.Count > 0) { tasks.AddRange(result.Item1); } if(locationInfos.First().RoadwayNo.Contains("DW") || locationInfos.First().RoadwayNo.Contains("YS")) { break; } } WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -1004,7 +1004,7 @@ } if (inboundOrder.OrderStatus == InboundStatusEnum.入库完成.ObjToInt() && inboundOrder.OrderType == 0 && inboundOrder.System.Equals("SMOM")) { //SendInboundInfoToWMS(task, inboundOrder, stockInfo); } else if (inboundOrder.OrderStatus == InboundStatusEnum.入库完成.ObjToInt() && inboundOrder.OrderType == 2 && inboundOrder.System.Equals("SMOM")) { @@ -1949,31 +1949,32 @@ if (inboundOrder == null) return WebResponseContent.Instance.Error("未找到出库单信息"); Dt_OutboundOrderDetail outboundOrderDetail = new Dt_OutboundOrderDetail(); List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>(); foreach (var detail in stockInfo.Details) { outboundOrderDetail = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>() .Where(x => x.OrderId == inboundOrder.Id && x.BatchNo == detail.BatchNo) .First(); if (outboundOrderDetail != null) break; Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>() .Where(x => x.OrderId == inboundOrder.Id && x.BatchNo == detail.BatchNo).First(); outboundOrderDetails.Add(outboundOrderDetail); } if (outboundOrderDetail.LocationName != null && outboundOrderDetail.LocationName != "") for(var i = 0; i<outboundOrderDetails.Count; i++) { if (outboundOrderDetails[i].LocationName != null && outboundOrderDetails[i].LocationName != "") { foreach (var detail in stockInfo.Details) { outboundOrderDetail = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>() Dt_OutboundOrderDetail newOutboundOrderDetail = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>() .Where(x => x.OrderId == inboundOrder.Id && x.BatchNo == detail.BatchNo && x.LocationName == stockInfo.LocationCode) .First(); if (outboundOrderDetail != null) break; outboundOrderDetails[i] = newOutboundOrderDetail; } } } if (outboundOrderDetail == null) return WebResponseContent.Instance.Error("未找到出库单信息"); DWANDYSUpdateOutboundOrderDetails(stockInfo, inboundOrder, ref outboundOrderDetail); if (outboundOrderDetails == null) return WebResponseContent.Instance.Error("未找到出库单信息"); DWANDYSUpdateOutboundOrderDetails(stockInfo, inboundOrder, ref outboundOrderDetails); // 3. 执行核心出库逻辑 return ExecuteOutboundLogic(task, stockInfo, locationInfo, outboundOrderDetail, inboundOrder); return DWANDYSExecuteOutboundLogic(task, stockInfo, locationInfo, outboundOrderDetails, inboundOrder); } else { @@ -2068,14 +2069,9 @@ _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails); // 更新库存状态 回库单 if (locationInfo.RoadwayNo.Contains("DW") || locationInfo.RoadwayNo.Contains("YS")) { AddDWANDYSRetrueOrder(stockInfo, inboundOrder); } else { AddRetrueOrder(stockInfo, inboundOrder); } // 区分单据数据来源更新货位状态 if (inboundOrder.System == null) @@ -2134,6 +2130,82 @@ throw; } } private WebResponseContent DWANDYSExecuteOutboundLogic(Dt_Task task, Dt_StockInfo stockInfo, Dt_LocationInfo locationInfo, List<Dt_OutboundOrderDetail> outboundOrderDetails, Dt_OutboundOrder inboundOrder) { try { _unitOfWorkManage.BeginTran(); ///更新出库单 _outboundService.OutboundOrderService.Repository.UpdateData(inboundOrder); // 更新出库订单详情 _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails); // 更新库存状态 回库单 if (locationInfo.RoadwayNo.Contains("DW") || locationInfo.RoadwayNo.Contains("YS")) { AddDWANDYSRetrueOrder(stockInfo, inboundOrder); } // 区分单据数据来源更新货位状态 if (inboundOrder.System == null) { return WebResponseContent.Instance.Error("出库单数据源为空"); } if (!inboundOrder.System.Equals("SMOM")) { UpdateLocationStatus(locationInfo); } // 处理任务完成 CompleteTask(task); // 添加状态变更记录 AddStatusChangeRecord(task, stockInfo, locationInfo); // 根据订单类型处理不同逻辑 var outboundOrder = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrder>() .Where(x => x.OrderNo == inboundOrder.OrderNo).First(); foreach(var outboundOrderDetail in outboundOrderDetails) { var outDetail = _outboundService.OutboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>() .Where(x => x.OrderId == outboundOrder.Id && x.BatchNo == outboundOrderDetail.BatchNo).First(); string path = "http://fr.mankun.com:8080/webroot/decision/view/report?viewlet=fr-report\\SMOM/Product/Produce/OutBoundDetileReport.cpt&op=write&format=pdf"; string fullPath = AppDomain.CurrentDomain.BaseDirectory; var url = Path.Combine(fullPath, "wwwroot", "Reports"); string savePath = Path.Combine(url, "本次出库.pdf"); if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt() && inboundOrder.System.Equals("ERP")) { FeedBackOutERP(outboundOrder.OrderNo, outboundOrderDetail.LinId); DownloadReport(path, savePath, outboundOrderDetail.Id); } ///单据完成推送SMOM系统 if (outboundOrder.OrderStatus == OutboundStatusEnum.出库完成.ObjToInt() && inboundOrder.System.Equals("SMOM")) { var stockInfoDetail = stockInfo.Details.FirstOrDefault(); ProcessNormalOutbound(task, stockInfo, outboundOrder, outDetail); //DownloadReport(path, savePath, outboundOrderDetails.Id); //printTest(savePath); //SendNormalOutboundToWMS(task, outboundOrder, stockInfoDetail, outDetail); } if (outboundOrder.OrderType == 240) // 盘点出库 { // 盘点出库特殊处理逻辑 } } _unitOfWorkManage.CommitTran(); return WebResponseContent.Instance.OK(); } catch { _unitOfWorkManage.RollbackTran(); throw; } } private void UpdateOutboundOrderDetails(Dt_StockInfo stockInfo, Dt_OutboundOrder inboundOrder, ref Dt_OutboundOrderDetail inboundOrderDetail) { int overCount = inboundOrder.Details.Count(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()); @@ -2163,38 +2235,45 @@ } //低温、药水 private void DWANDYSUpdateOutboundOrderDetails(Dt_StockInfo stockInfo, Dt_OutboundOrder inboundOrder, ref Dt_OutboundOrderDetail inboundOrderDetail) private void DWANDYSUpdateOutboundOrderDetails(Dt_StockInfo stockInfo, Dt_OutboundOrder inboundOrder, ref List<Dt_OutboundOrderDetail> inboundOrderDetails) { string BatchNo = inboundOrderDetail.BatchNo; int overCount = inboundOrder.Details.Where(x => x.BatchNo == BatchNo).Count(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()); List<Dt_OutboundOrderDetail> newOutboundOrderDetails = inboundOrderDetails; int overCount = inboundOrder.Details.Count(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()); foreach (var newOutboundOrderDetail in newOutboundOrderDetails) { string BatchNo = newOutboundOrderDetail.BatchNo; //inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfo.Details.FirstOrDefault()?.BatchNo&&x.LPNNo==stockInfo.PalletCode); foreach (var item in stockInfo.Details) { if (inboundOrderDetail == null) continue; if (newOutboundOrderDetail == null) continue; if (inboundOrderDetail.BatchNo == item.BatchNo) { inboundOrderDetail.OverOutQuantity += item.OutboundQuantity; if (newOutboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()) continue; if (inboundOrderDetail.OverOutQuantity == inboundOrderDetail.OrderQuantity) if (newOutboundOrderDetail.BatchNo == item.BatchNo) { inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); newOutboundOrderDetail.OverOutQuantity += item.OutboundQuantity; if (newOutboundOrderDetail.OverOutQuantity == newOutboundOrderDetail.OrderQuantity) { newOutboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); overCount++; } else if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) else if (newOutboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) { inboundOrderDetail.OrderDetailStatus = OutboundStatusEnum.出库中.ObjToInt(); newOutboundOrderDetail.OrderDetailStatus = OutboundStatusEnum.出库中.ObjToInt(); inboundOrder.OrderStatus = OutboundStatusEnum.出库中.ObjToInt(); } } } if (inboundOrder.Details.Count == overCount) if (inboundOrder.Details.Count() == overCount) { inboundOrder.OrderStatus = OutboundStatusEnum.出库完成.ObjToInt(); } } } private void DeleteAndMoveIntoHtStockStatus(Dt_StockInfo stockInfo) { _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateType.自动完成 : OperateType.人工完成); WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/PalletTypeInfoController.cs
@@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using WIDESEA_Core; using WIDESEA_Core.BaseController; using WIDESEA_IBasicService; using WIDESEA_Model.Models; @@ -13,5 +14,12 @@ public PalletTypeInfoController(IPalletTypeInfoService service) : base(service) { } [HttpGet,HttpPost, Route("PrintPalletCode"), AllowAnonymous] public WebResponseContent PrintPalletCode(int num, string palletCodeType) { return Service.PrintPalletCode(num, palletCodeType); } } }