From 51f7eb771322a65ee552ca9b60280632f72760e6 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期三, 15 十月 2025 16:55:08 +0800
Subject: [PATCH] 修改物料管理列表
---
Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs | 87 +++++++++++++++++++++++++++++++++++--------
1 files changed, 70 insertions(+), 17 deletions(-)
diff --git a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
index 3aa92c5..6296674 100644
--- a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
@@ -514,7 +514,7 @@
CreateTime = a.CreateTime,
UpdateTime = a.UpdateTime
- }).OrderByDescending(a => a.CreateTime).OrderBy(a => a.BoxNo).ToOffsetPage(model.Page, model.Limit, ref total);
+ }).OrderByDescending(a => a.ASNNo).OrderBy(a => a.BoxNo).ToOffsetPage(model.Page, model.Limit, ref total);
count = total;
return data;
}
@@ -534,8 +534,17 @@
{
throw new Exception("鏈煡璇㈠埌鍗曟嵁鏄庣粏淇℃伅锛岃鏍稿疄");
}
+ var skuInfo = Db.Queryable<SysMaterials>().First(w => w.IsDel == "0" && w.SkuNo == asnDetail.SkuNo);
+ if (skuInfo == null)
+ {
+ throw new Exception("鏈煡璇㈠埌鐗╂枡淇℃伅锛岃鏍稿疄");
+ }
+ if (string.IsNullOrEmpty(skuInfo.PackagNo))
+ {
+ throw new Exception("鏈煡璇㈠埌鐗╂枡鐨勫寘瑁呬俊鎭紝璇锋牳瀹�");
+ }
- var packInfo = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == asnDetail.PackagNo);
+ var packInfo = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == skuInfo.PackagNo);
if (packInfo == null)
{
throw new Exception("鏈煡璇㈠埌鍗曟嵁鏄庣粏涓殑鐗╂枡鍖呰淇℃伅");
@@ -597,17 +606,31 @@
{
throw new Exception("鍗曟嵁鏁伴噺涓嶈兘灏忎簬绛変簬0");
}
- if (string.IsNullOrWhiteSpace(asnList.LotNo))
+ //if (string.IsNullOrWhiteSpace(asnList.LotNo))
+ //{
+ // throw new Exception("鍗曟嵁鎵规鍙蜂笉鑳戒负绌�");
+ //}
+ if (string.IsNullOrWhiteSpace(asnList.BoxCodeStr))
{
- throw new Exception("鍗曟嵁鎵规鍙蜂笉鑳戒负绌�");
+ throw new Exception("鍗曟嵁绠辩爜甯稿�间笉鑳戒负绌�");
}
var asn = Db.Queryable<BllArrivalNotice>().First(m => m.ASNNo == asnList.ASNNo && m.IsDel == "0");
if (asn == null)
{
throw new Exception("鏈煡璇㈠埌鍗曟嵁淇℃伅");
}
-
- var pack = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == asnList.PackagNo);
+ //鍖呰缂栫爜
+ var packagNo = asnList.PackagNo;
+ if (string.IsNullOrEmpty(packagNo))
+ {
+ var skuInfo = Db.Queryable<SysMaterials>().First(w => w.IsDel == "0" && w.SkuNo == asnList.SkuNo);
+ if (skuInfo == null)
+ {
+ throw new Exception("鏈煡璇㈠埌鐗╂枡淇℃伅");
+ }
+ packagNo = skuInfo.PackagNo;
+ }
+ var pack = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == packagNo);
if (pack == null)
{
throw new Exception("鏈煡璇㈠埌褰撳墠鍗曟嵁涓墿鏂欑殑鍖呰淇℃伅");
@@ -723,9 +746,16 @@
string maxLotNoStr = ""; //鎵规鍙�
string maxBoxCode = ""; //绠辩爜鍙�
-
- maxLotNoStr = asnList.LotNo;
- maxBoxCode = label.Where(m => m.LotNo == maxLotNoStr).Max(a => a.BoxNo);
+
+ maxLotNoStr = asnList.BoxCodeStr;//asnList.LotNo;
+ if (string.IsNullOrEmpty(asnList.LotNo))
+ {
+ maxBoxCode = label.Where(m => m.ASNDetailNo == asnList.Id).Max(a => a.BoxNo);
+ }
+ else
+ {
+ maxBoxCode = label.Where(m => m.LotNo == maxLotNoStr).Max(a => a.BoxNo);
+ }
#endregion
for (int i = 1; i <= labelNum; i++)
@@ -760,7 +790,6 @@
maxBoxCode = maxBoxCode.Substring(0, maxBoxCode.Length-6) + (int.Parse(maxBoxCode.Substring(maxBoxCode.Length - 6, 6)) + 1).ToString().PadLeft(6, '0');
}
- DateTime? storeTime2 = null;
// 灏嗘潯鐮佷繚瀛樺埌鍘熸枡鏉$爜琛�
var labelModel = new BllBoxInfo()
{
@@ -772,7 +801,7 @@
Status = "0",
SkuNo = asnList.SkuNo,
SkuName = asnList.SkuName,
- LotNo = maxLotNoStr,
+ LotNo = asnList.LotNo,//maxLotNoStr,
Standard = asnList.Standard,
PackageStandard = packStr,
SupplierLot = supplierLot,
@@ -780,14 +809,26 @@
BitBoxMark = bNum > boxQty ? "1" : "0",
InspectStatus = "0",
- ProductionTime = DateTime.Parse(productionTime),
- StoreTime = string.IsNullOrWhiteSpace(storeTime) ? storeTime2 : DateTime.Parse(storeTime ),
- ExpirationTime = DateTime.Parse(expirationTime),
+ ProductionTime = null,
+ StoreTime = null,
+ ExpirationTime = null,
Origin = "WMS鐢熸垚",
CreateUser = userId,
CreateTime = DateTime.Now,
};
+ if (!string.IsNullOrEmpty(productionTime))
+ {
+ labelModel.ProductionTime = DateTime.Parse(productionTime);
+ }
+ if (!string.IsNullOrEmpty(storeTime))
+ {
+ labelModel.StoreTime = DateTime.Parse(storeTime);
+ }
+ if (!string.IsNullOrEmpty(expirationTime))
+ {
+ labelModel.ExpirationTime = DateTime.Parse(expirationTime);
+ }
Db.Insertable(labelModel).ExecuteCommand();
modelList.Add(labelModel);
@@ -932,14 +973,26 @@
BitBoxMark = bNum > boxQty ? "1" : "0",
InspectStatus = "0",
- ProductionTime = DateTime.Parse(productionTime),
- StoreTime = DateTime.Parse(storeTime),
- ExpirationTime = DateTime.Parse(expirationTime),
+ ProductionTime = null,
+ StoreTime = null,
+ ExpirationTime = null,
Origin = "WMS鐢熸垚",
CreateUser = userId,
CreateTime = DateTime.Now,
};
+ if (!string.IsNullOrEmpty(productionTime))
+ {
+ labelModel.ProductionTime = DateTime.Parse(productionTime);
+ }
+ if (!string.IsNullOrEmpty(storeTime))
+ {
+ labelModel.StoreTime = DateTime.Parse(storeTime);
+ }
+ if (!string.IsNullOrEmpty(expirationTime))
+ {
+ labelModel.ExpirationTime = DateTime.Parse(expirationTime);
+ }
Db.Insertable(labelModel).ExecuteCommand();
modelList.Add(labelModel);
--
Gitblit v1.8.0