From 37454e625df68d40897112b2e8c2e3cf4d7163e3 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期三, 25 三月 2026 11:43:10 +0800
Subject: [PATCH] 1
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 50 insertions(+), 4 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_TaskInfoService/TaskService_Outbound.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_TaskInfoService/TaskService_Outbound.cs"
index 901532d..32ae529 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_TaskInfoService/TaskService_Outbound.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_TaskInfoService/TaskService_Outbound.cs"
@@ -4,6 +4,7 @@
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
using SqlSugar;
using System;
+using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
@@ -43,12 +44,47 @@
WebResponseContent content = new WebResponseContent();
try
{
- var stockInfos = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()).WhereIF(locationType != 0, x => x.LocationType == locationType).Take(num).ToList();
+ Dictionary<string, SqlSugar.OrderByType> orderByDict = new Dictionary<string, SqlSugar.OrderByType>()
+ {
+ { nameof(Dt_LocationInfo.Layer), SqlSugar.OrderByType.Asc },
+ { nameof(Dt_LocationInfo.Row), SqlSugar.OrderByType.Asc },
+ { nameof(Dt_LocationInfo.Column), SqlSugar.OrderByType.Asc },
+ { nameof(Dt_LocationInfo.Depth), SqlSugar.OrderByType.Desc },
+ };
- if (stockInfos.Count() == 0)
+ var query = _stockRepository.Db.Queryable<Dt_StockInfo>()
+ .Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt()
+ && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt())
+ .WhereIF(locationType != 0, x => x.LocationType == locationType)
+ .LeftJoin<Dt_LocationInfo>((s, l) => s.LocationCode == l.LocationCode);
+
+ if (query.Count() == 0)
{
return WebResponseContent.Instance.Error("鏈壘鍒扮┖鎵樼洏搴撳瓨");
}
+
+ bool isFirstOrder = true;
+ foreach (var item in orderByDict)
+ {
+ string fieldName = item.Key.Equals("Column", StringComparison.OrdinalIgnoreCase)
+ ? $"l.[{item.Key}]"
+ : $"l.{item.Key}";
+
+ string sortSql = $"{fieldName} {(item.Value == SqlSugar.OrderByType.Asc ? "ASC" : "DESC")}";
+
+ if (isFirstOrder)
+ {
+ query = query.OrderBy(sortSql);
+ isFirstOrder = false;
+ }
+ else
+ {
+ query = query.OrderBy(sortSql);
+ }
+ }
+
+ var stockInfos = await query.Take(num).ToListAsync();
+
foreach (var stockInfo in stockInfos)
{
Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode);
@@ -96,6 +132,8 @@
return WebResponseContent.Instance.Error(ex.Message);
}
}
+
+
/// <summary>
@@ -1090,6 +1128,14 @@
WebResponseContent content = new WebResponseContent();
try
{
+ var allFactoryAreas = stockViews.SelectMany(sv => sv.Details)
+ .Select(x => x.FactoryArea)
+ .GroupBy(x => x)
+ .ToList();
+ if (allFactoryAreas.Count >= 2)
+ {
+ return content.Error($"璇烽�夋嫨鍚屼竴鍘傚尯鍖哄煙鐨勫簱瀛樿繘琛岀洏鐐癸紝褰撳墠娑夊強{allFactoryAreas.Count}涓笉鍚岀殑鍘傚尯");
+ }
List<int> ids = stockViews.Select(x => x.StockId).ToList();
//鑾峰彇搴撳瓨
List<Dt_StockInfo> stockInfos = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => ids.Contains(x.Id)).Includes(x => x.Details).ToList();
@@ -1122,9 +1168,9 @@
return content.Error($"鏈壘鍒皗item.PalletCode}搴撳瓨鏄庣粏鏁版嵁");
}
Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == item.LocationCode);
- if (locationInfo == null && (locationInfo.EnableStatus == EnableStatusEnum.Disable.ObjToInt() || locationInfo.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && item.StockStatus != StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt())
+ if (locationInfo == null || (locationInfo.EnableStatus == EnableStatusEnum.Disable.ObjToInt() || locationInfo.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) || locationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt() || item.StockStatus != StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt())
{
- content.Error($"{item.PalletCode}璐т綅鎴栧簱瀛樼姸鎬佷笉婊¤冻鍑哄簱鏉′欢");
+ return content.Error($"{item.PalletCode}璐т綅鎴栧簱瀛樼姸鎬佷笉婊¤冻鍑哄簱鏉′欢");
}
}
List<Dt_Task> tasks = GetTasks(stockInfos, TaskTypeEnum.OutInventory,outStation);
--
Gitblit v1.9.3