From 3460ffdc967b65ea67c959212c2505a19008401e Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期四, 16 四月 2026 13:39:56 +0800
Subject: [PATCH] 盘点优化,智仓调智仓防呆
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundQueryService.cs | 130 +++++++++++++++++++++++++++++++++++++++----
1 files changed, 118 insertions(+), 12 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundQueryService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundQueryService.cs"
index 494e6d2..73a7aa1 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundQueryService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundQueryService.cs"
@@ -4,6 +4,7 @@
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
+using SqlSugar.Extensions;
using WIDESEA_Common.StockEnum;
using WIDESEA_Core;
using WIDESEA_DTO.CalcOut;
@@ -26,27 +27,132 @@
}
}
+ //public WebResponseContent QueryPickingTasks(string palletCode, string orderNo)
+ //{
+ // try
+ // {
+ // Dt_StockInfo stockInfo = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First();
+
+ // var outboundOrder = _outboundRepository.QueryFirst(x => x.OrderNo == orderNo);
+
+ // bool isMatMixed = false;
+ // if (stockInfo != null)
+ // {
+ // isMatMixed = stockInfo.Details.GroupBy(x => new
+ // {
+ // x.MaterielCode,
+ // x.MaterielName,
+ // x.BatchNo,
+ // x.SupplyCode,
+ // x.WarehouseCode
+ // }).Count() > 1;
+ // }
+
+
+ // List<Dt_OutStockLockInfo> outStockLockInfos = _outboundLockInfoRepository.QueryData(x => x.PalletCode == palletCode && x.OrderNo == orderNo);
+ // return WebResponseContent.Instance.OK(data: new { outStockLockInfos, stockInfo, isMatMixed });
+ // }
+ // catch (Exception ex)
+ // {
+ // return WebResponseContent.Instance.Error(ex.Message);
+ // }
+ //}
+
public WebResponseContent QueryPickingTasks(string palletCode, string orderNo)
{
try
{
- Dt_StockInfo stockInfo = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First();
+ Dt_StockInfo stockInfo = _stockInfoRepository.Db.Queryable<Dt_StockInfo>()
+ .Where(x => x.PalletCode == palletCode)
+ .Includes(x => x.Details)
+ .First();
+
+ List<Dt_OutStockLockInfo> outStockLockInfos = _outboundLockInfoRepository
+ .QueryData(x => x.PalletCode == palletCode && x.OrderNo == orderNo);
+
bool isMatMixed = false;
- if (stockInfo != null)
+ bool orderOver = false;
+ decimal sumQty = 0;
+ if (stockInfo != null && stockInfo.Details != null && stockInfo.Details.Any())
{
- isMatMixed = stockInfo.Details.GroupBy(x => new
+ if (outStockLockInfos.FirstOrDefault() != null)
{
- x.MaterielCode,
- x.MaterielName,
- x.BatchNo,
- x.SupplyCode,
- x.WarehouseCode
- }).Count() > 1;
+ bool includeBatchNo = !string.IsNullOrEmpty(outStockLockInfos.FirstOrDefault().BatchNo);
+ bool includeSupplyCode = !string.IsNullOrEmpty(outStockLockInfos.FirstOrDefault().SupplyCode);
+ var orderId = outStockLockInfos.FirstOrDefault().OrderDetailIds.Split(",");
+ foreach (var item in orderId)
+ {
+ Dt_OutboundOrderDetail outboundOrderDetail = _outboundRepository.Db.Queryable<Dt_OutboundOrderDetail>().Where(x=>x.Id == item.ObjToInt()).First();
+ if(outboundOrderDetail == null)
+ {
+ return WebResponseContent.Instance.Error("璇ユ墭鐩樼殑鍑哄簱鏄庣粏鏈壘鍒�");
+ }
+ sumQty += (outboundOrderDetail.OrderQuantity - outboundOrderDetail.OverOutQuantity - outboundOrderDetail.MoveQty);
+ }
+ if(sumQty < outStockLockInfos.FirstOrDefault().AssignQuantity)
+ {
+ orderOver = true;
+ }
+ if (includeBatchNo && includeSupplyCode)
+ {
+ isMatMixed = stockInfo.Details.GroupBy(x => new
+ {
+ x.MaterielCode,
+ x.MaterielName,
+ x.BatchNo,
+ x.SupplyCode,
+ x.WarehouseCode
+ }).Count() > 1;
+ }
+ else if (includeBatchNo && !includeSupplyCode)
+ {
+ isMatMixed = stockInfo.Details.GroupBy(x => new
+ {
+ x.MaterielCode,
+ x.MaterielName,
+ x.BatchNo,
+ x.WarehouseCode
+ }).Count() > 1;
+ }
+ else if (!includeBatchNo && includeSupplyCode)
+ {
+ isMatMixed = stockInfo.Details.GroupBy(x => new
+ {
+ x.MaterielCode,
+ x.MaterielName,
+ x.SupplyCode,
+ x.WarehouseCode
+ }).Count() > 1;
+ }
+ else
+ {
+ isMatMixed = stockInfo.Details.GroupBy(x => new
+ {
+ x.MaterielCode,
+ x.MaterielName,
+ x.WarehouseCode
+ }).Count() > 1;
+ }
+ }
+ else
+ {
+ isMatMixed = stockInfo.Details.GroupBy(x => new
+ {
+ x.MaterielCode,
+ x.MaterielName,
+ x.WarehouseCode
+ }).Count() > 1;
+
+ Dt_OutStockLockInfo outStockLockInfo = _outboundLockInfoRepository.QueryFirst(x=>x.PalletCode == palletCode);
+
+ if (outStockLockInfo != null)
+ {
+ return WebResponseContent.Instance.Error($"璇ユ墭鐩樺湪璇ュ崟鎹腑鏃犳嫞閫夎褰曪紝璇峰墠寰�{outStockLockInfo.OrderNo}鍗曟嵁涓繘琛屾嫞璐ф搷浣�");
+ }
+ }
}
-
- List<Dt_OutStockLockInfo> outStockLockInfos = _outboundLockInfoRepository.QueryData(x => x.PalletCode == palletCode && x.OrderNo == orderNo);
- return WebResponseContent.Instance.OK(data: new { outStockLockInfos, stockInfo, isMatMixed });
+ return WebResponseContent.Instance.OK(data: new { outStockLockInfos, stockInfo, isMatMixed, orderOver });
}
catch (Exception ex)
{
--
Gitblit v1.9.3