From d58d59407f6d15980356473e2e570fe4a3318e29 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期五, 30 一月 2026 18:56:17 +0800
Subject: [PATCH] 1
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs | 129 ++++++++++++++++++++++++-
项目代码/WIDESEA_WMSClient/src/views/inbound/inboundOrder.vue | 15 +-
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs | 34 ++++++
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs | 51 ++++++---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_InboundOrderDetail.cs | 6 +
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Allocate/Dt_AllocateOrderDetail.cs | 6 +
6 files changed, 210 insertions(+), 31 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/inboundOrder.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/inboundOrder.vue"
index 74cbe3d..fa3313e 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/inboundOrder.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/inboundOrder.vue"
@@ -335,14 +335,13 @@
align: "left",
bind: { key: "orderDetailStatusEnum", data: [] },
},
- // {
- // field: "returnToMESStatus",
- // title: "鍥炰紶鐘舵��",
- // type: "string",
- // width: 90,
- // align: "left",
- // bind: { key: "returnStatus", data: [{ key: 0, value: "鏈洖浼�" }, { key: 1, value: "宸插洖浼犳垚鍔�" }, { key: 2, value: "鍥炰紶澶辫触" }] }
- // },
+ {
+ field: "palletCode",
+ title: "宸茬粍鎵樼洏鍙�",
+ type: "string",
+ width: 100,
+ align: "left",
+ },
{
field: "creater",
title: "鍒涘缓浜�",
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_Core/BaseServices/ServiceBase.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_Core/BaseServices/ServiceBase.cs"
index 31e32eb..921062c 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_Core/BaseServices/ServiceBase.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_Core/BaseServices/ServiceBase.cs"
@@ -453,19 +453,138 @@
Type t = typeof(TEntity);
if (pageData.Value == null) return new PageGridData<object>(total: 0, null);
+
string keyName = t.GetKeyName();
- ////鐢熸垚鏌ヨ鏉′欢
- //Expression<Func<TEntity, bool>> whereExpression = keyName.CreateExpression<TEntity>(pageData.Value, LinqExpressionType.Equal);
int totalCount = 0;
PropertyInfo propertyInfo = t.GetProperties().FirstOrDefault(x => x.GetCustomAttribute<Navigate>() != null);
+ List<ExpandoObject> detailList = new List<ExpandoObject>();
+
if (propertyInfo != null)
{
Type detailType = propertyInfo.PropertyType.GetGenericArguments()[0];
Navigate navigate = propertyInfo.GetCustomAttribute<Navigate>();
- List<ExpandoObject> list = BaseDal.Db.Queryable(detailType.Name, "detail").Where(navigate.GetName(), "=", pageData.Value).ToPageList(pageData.Page, pageData.Rows, ref totalCount);
- return new PageGridData<ExpandoObject>(totalCount, list);
+
+ detailList = BaseDal.Db.Queryable(detailType.Name, "detail")
+ .Where(navigate.GetName(), "=", pageData.Value)
+ .ToPageList(pageData.Page, pageData.Rows, ref totalCount);
+
+ if (detailList.Any())
+ {
+ // 1. 鎻愬彇鏄庣粏鏈夋晥barcode
+ List<string> allBarcodes = new List<string>();
+ foreach (var expando in detailList)
+ {
+ var detailDict = (IDictionary<string, object>)expando;
+ if (detailDict.ContainsKey("barcode") && detailDict["barcode"] != null)
+ {
+ string barcodeValue = (detailDict["barcode"] as string)?.Trim() ?? string.Empty;
+ if (!string.IsNullOrWhiteSpace(barcodeValue))
+ {
+ allBarcodes.Add(barcodeValue);
+ }
+ }
+ }
+
+ if (allBarcodes.Count == 0)
+ {
+ foreach (var expando in detailList)
+ {
+ var detailDict = (IDictionary<string, object>)expando;
+ detailDict["palletCode"] = "";
+ }
+ return new PageGridData<ExpandoObject>(totalCount, detailList);
+ }
+
+ // 2. 鏌ュ簱瀛樻槑缁嗚〃锛岃幏鍙朾arcode 鈫� StockId鏄犲皠
+ Dictionary<string, object> barcodeToStockIdDict = new Dictionary<string, object>();
+ var distinctBarcodes = allBarcodes.Distinct().ToList();
+ var barcodeStockIdList = BaseDal.Db.Queryable("Dt_StockInfoDetail", "sd")
+ .In("sd.barcode", distinctBarcodes)
+ .Select("sd.barcode, sd.StockId")
+ .ToList();
+
+ foreach (var item in barcodeStockIdList)
+ {
+ if (item == null) continue;
+ var itemDict = (IDictionary<string, object>)item;
+
+ if (itemDict.ContainsKey("barcode") && itemDict["barcode"] != null)
+ {
+ string barcode = (itemDict["barcode"] as string)?.Trim() ?? string.Empty;
+ object stockId = itemDict.ContainsKey("StockId") ? itemDict["StockId"] : null;
+
+ if (!string.IsNullOrWhiteSpace(barcode) && !barcodeToStockIdDict.ContainsKey(barcode))
+ {
+ barcodeToStockIdDict.Add(barcode, stockId);
+ }
+ }
+ }
+
+ if (barcodeToStockIdDict.Count == 0)
+ {
+ foreach (var expando in detailList)
+ {
+ var detailDict = (IDictionary<string, object>)expando;
+ detailDict["palletCode"] = "";
+ }
+ return new PageGridData<ExpandoObject>(totalCount, detailList);
+ }
+
+ Dictionary<object, string> stockIdToPalletDict = new Dictionary<object, string>();
+ var allStockIds = barcodeToStockIdDict.Values.Distinct().ToList();
+ var stockIdPalletList = BaseDal.Db.Queryable("Dt_StockInfo", "s")
+ .In("s.Id", allStockIds)
+ .Select("s.Id, s.PalletCode")
+ .ToList();
+
+ // 鎻愬彇 PalletCode
+ foreach (var item in stockIdPalletList)
+ {
+ if (item == null) continue;
+ var itemDict = (IDictionary<string, object>)item;
+ if (itemDict.ContainsKey("Id") && itemDict["Id"] != null)
+ {
+ object stockId = itemDict["Id"];
+ string palletCode = itemDict.ContainsKey("PalletCode") && itemDict["PalletCode"] != null
+ ? (itemDict["PalletCode"] as string)?.Trim() ?? string.Empty
+ : string.Empty;
+ if (!stockIdToPalletDict.ContainsKey(stockId))
+ {
+ stockIdToPalletDict.Add(stockId, palletCode);
+ }
+ }
+ }
+
+ // 5. 缁欐槑缁嗙殑palletCode瀛楁璧嬪�间富琛ㄧ殑PalletCode鍊�
+ foreach (var expando in detailList)
+ {
+ var detailDict = (IDictionary<string, object>)expando;
+ string palletValue = string.Empty;
+
+ if (detailDict.ContainsKey("barcode") && detailDict["barcode"] != null)
+ {
+ string barcode = (detailDict["barcode"] as string)?.Trim() ?? string.Empty;
+ // 閫氳繃barcode鑾峰彇StockId
+ if (!string.IsNullOrWhiteSpace(barcode) && barcodeToStockIdDict.TryGetValue(barcode, out var stockId))
+ {
+ // 閫氳繃StockId鑾峰彇涓昏〃鐨凱alletCode
+ stockIdToPalletDict.TryGetValue(stockId, out palletValue);
+ }
+ }
+ // 鍔ㄦ�佹洿鏂�/娣诲姞palletCode瀛楁
+ if (detailDict.ContainsKey("palletCode"))
+ {
+ detailDict["palletCode"] = palletValue;
+ }
+ else
+ {
+ detailDict.Add("palletCode", palletValue);
+ }
+ }
+ }
}
- return new PageGridData<object>(total: 0, null);
+
+ return new PageGridData<ExpandoObject>(totalCount, detailList);
}
/// <summary>
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_InboundService/InboundService.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_InboundService/InboundService.cs"
index 430bdb3..4e18074 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_InboundService/InboundService.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_InboundService/InboundService.cs"
@@ -12,6 +12,7 @@
using System.Data;
using System.Linq;
using System.Net;
+using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.AllocateEnum;
@@ -95,10 +96,12 @@
var details = _inboundOrderDetailRepository.QueryData(x => (x.OutBoxbarcodes == palletDto.Barcode|| x.Barcode == palletDto.Barcode) && x.OrderDetailStatus == (int)InOrderStatusEnum.鏈紑濮�);
+
if (details.Count() <= 0)
{
- var inbounddetail =_inboundOrderDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode);
- if(inbounddetail == null)
+
+ var inbounddetail = _inboundOrderDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode);
+ if (inbounddetail == null)
{
return content.Error($"鏉$爜{palletDto.Barcode}涓嶅瓨鍦�");
}
@@ -108,26 +111,26 @@
return content.Error("鍗曟嵁涓嶈兘涓虹┖");
}
- var detail = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().LeftJoin<Dt_InboundOrder>((d,o)=>d.OrderId==o.Id).Where((d, o) => d.OrderId == inbound.Id
+ var detail = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().LeftJoin<Dt_InboundOrder>((d, o) => d.OrderId == o.Id).Where((d, o) => d.OrderId == inbound.Id
&& d.ReceiptQuantity != 0
&& d.OverInQuantity == 0).Select((d, o) => new
- {
- orderNo=o.InboundOrderNo,
- d.Barcode,
- d.MaterielCode,
- d.BatchNo,
- d.ReceiptQuantity,
- d.Unit,
- d.SupplyCode,
- d.WarehouseCode
- }).ToList();
- var palletId = _stockInfoDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode);
+ {
+ orderNo = o.InboundOrderNo,
+ d.Barcode,
+ d.MaterielCode,
+ d.BatchNo,
+ d.ReceiptQuantity,
+ d.Unit,
+ d.SupplyCode,
+ d.WarehouseCode
+ }).ToList();
+ var palletId = _stockInfoDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode);
if (palletId == null)
{
- return content.Error($"鏉$爜鏉$爜{palletDto.Barcode}涓嶅瓨鍦�");
+ return content.Error($"鏉$爜{palletDto.Barcode}宸茬粍鐩�");
}
- var pallet =_stockInfoRepository.QueryFirst(x => x.Id == palletId.StockId);
- return content.Error($"鏉$爜{palletDto.Barcode}宸茬粡缁勫埌{pallet.PalletCode}",detail);
+ var pallet = _stockInfoRepository.QueryFirst(x => x.Id == palletId.StockId);
+ return content.Error($"鏉$爜{palletDto.Barcode}宸茬粡缁勫埌{pallet.PalletCode}", detail);
}
inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Includes(x=>x.Details).Where(x => x.Id == details.First().OrderId).First();
@@ -285,7 +288,16 @@
{
return content.Error("宸蹭笂鏋剁殑鎵樼洏涓嶈兘鍐嶆缁勭洏");
}
-
+ var nullpallet = _stockInfoRepository.QueryFirst(x => x.PalletType == -1 && x.PalletCode == palletDto.PalletCode);
+ if (nullpallet != null)
+ {
+ return content.Error($"璇ユ墭鐩榹palletDto.PalletCode}宸茬粡杩涜绌烘墭缁勭洏,涓嶈兘鍦ㄨ繘琛岀粍鐩�");
+ }
+ var outbundPallet = _stockInfoRepository.QueryFirst(x => x.StockStatus == (int)StockStatusEmun.鍑哄簱瀹屾垚 && x.PalletCode == palletDto.PalletCode);
+ if (outbundPallet != null)
+ {
+ return content.Error($"璇ユ墭鐩榹palletDto.PalletCode}鏈繘琛屽彇绌虹,涓嶈兘杩涜缁勭洏");
+ }
if (_stockService.StockInfoDetailService.ExistBarcodes(palletDto.Barcode))
{
return content.Error($"{palletDto.Barcode} 鏉$爜鍦ㄥ簱瀛樹腑宸插瓨鍦�");
@@ -927,5 +939,8 @@
return content.Error(ex.Message);
}
}
+
+
+
}
}
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_Model/Models/Allocate/Dt_AllocateOrderDetail.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_Model/Models/Allocate/Dt_AllocateOrderDetail.cs"
index 6e9655f..945641f 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_Model/Models/Allocate/Dt_AllocateOrderDetail.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_Model/Models/Allocate/Dt_AllocateOrderDetail.cs"
@@ -131,5 +131,11 @@
[SugarColumn(IsNullable = true, ColumnDescription = "杩囨湡鏃ユ湡")]
public DateTime ValidDate { get; set; }
+
+ /// <summary>
+ /// 鎵樼洏缂栧彿
+ /// </summary>
+ [SugarColumn(IsIgnore = true, IsNullable = true)]
+ public string Pallet { get; set; }
}
}
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_Model/Models/Inbound/Dt_InboundOrderDetail.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_Model/Models/Inbound/Dt_InboundOrderDetail.cs"
index 9e7bf01..7e79a58 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_Model/Models/Inbound/Dt_InboundOrderDetail.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_Model/Models/Inbound/Dt_InboundOrderDetail.cs"
@@ -151,5 +151,11 @@
/// </summary>
[SugarColumn(IsNullable = true, ColumnDescription = "杩囨湡鏃ユ湡")]
public DateTime ValidDate { get; set; }
+
+ /// <summary>
+ /// 鎵樼洏缂栧彿
+ /// </summary>
+ [SugarColumn(IsIgnore = true, IsNullable = true)]
+ public string Pallet { get; set; }
}
}
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/OutboundOrderService.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/OutboundOrderService.cs"
index f361834..4319e11 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/OutboundOrderService.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/OutboundOrderService.cs"
@@ -399,6 +399,40 @@
string returnToMESStatus = returnToMESStatusParam.Value.ToString().Trim();
sugarQueryable1 = sugarQueryable1.Where(x => x.ReturnToMESStatus.Equals(returnToMESStatus));
}
+
+ var createDateParams = searchParametersList
+ .Where(x => x.Name.Equals("createDate", StringComparison.OrdinalIgnoreCase)
+ && !string.IsNullOrEmpty(x.Value?.ToString()))
+ .ToList();
+
+ DateTime? minCreateDate = null;
+ DateTime? maxCreateDate = null;
+
+ foreach (var dateParam in createDateParams)
+ {
+ if (DateTime.TryParse(dateParam.Value.ToString(), out DateTime dateValue))
+ {
+ LinqExpressionType expressionType = dateParam.DisplayType.GetLinqCondition();
+ switch (expressionType)
+ {
+ case LinqExpressionType.ThanOrEqual:
+ minCreateDate = dateValue;
+ break;
+ case LinqExpressionType.LessThanOrEqual:
+ maxCreateDate = dateValue;
+ break;
+ }
+ }
+ }
+
+ if (minCreateDate.HasValue)
+ {
+ sugarQueryable1 = sugarQueryable1.Where(x => x.CreateDate >= minCreateDate.Value);
+ }
+ if (maxCreateDate.HasValue)
+ {
+ sugarQueryable1 = sugarQueryable1.Where(x => x.CreateDate <= maxCreateDate.Value);
+ }
}
}
catch { }
--
Gitblit v1.9.3