From d690043276ef1b0862d2a841f23dfcde2bb7384d Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-5BIMHQ3>
Date: 星期二, 27 二月 2024 16:02:56 +0800
Subject: [PATCH] Merge branch 'wxw'
---
Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs | 79 ++++++++++++++++++++++++++++-----------
1 files changed, 56 insertions(+), 23 deletions(-)
diff --git a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
index 870b0e8..34dfa59 100644
--- a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
@@ -576,7 +576,7 @@
packStr += "-" + pack.L5Num + "/" + pack.L5Name;
}
//鏍囩琛�
- var label = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.ASNDetailNo == imId).ToList();
+ var label = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.Origin == "WMS鐢熸垚").ToList();
#endregion
@@ -618,7 +618,7 @@
{
throw new Exception("鍒拌揣鏁伴噺涓嶈兘灏忎簬0!");
}
-
+ Db.BeginTran();
if (packLevel == 1)
{
#region 涓�绾у寘瑁�
@@ -661,19 +661,34 @@
string maxBoxCode = ""; //绠辩爜鍙�
// 鐢熸垚鑷紪鎵瑰彿
string toDayTime = DateTime.Now.ToString("yyyyMMdd");
-
-
- var maxLotNo = label.Max(a => a.LotNo);
- var maxBoxNo = label.Max(a => a.BoxNo);
+
if (isReset == "0")
{
-
- maxLotNoStr = maxLotNo;
- maxBoxCode = maxBoxNo;
- if (string.IsNullOrWhiteSpace(maxLotNoStr))
+ //鍒ゆ柇鍗曟嵁鏄惁鏄綑鏂欓��鍥炲崟
+ if (asn.Type == "4")
{
- maxLotNoStr = toDayTime.Substring(2, 6) + "0001";
+ maxLotNoStr = asnList.LotNo;
+ maxBoxCode = label.Where(m=>m.LotNo == maxLotNoStr).Max(a => a.BoxNo);
+ if (string.IsNullOrWhiteSpace(maxLotNoStr))
+ {
+ throw new Exception("杞﹂棿浣欐枡閫�鍥炲崟鎹壒娆′笉鑳戒负绌�");
+ }
}
+ else
+ {
+ var labelCount = label.Where(m => m.ASNDetailNo == imId).ToList();
+ if (labelCount.Count <= 0)
+ {
+ throw new Exception("褰撳墠鍗曟嵁鏄庣粏杩樻湭鐢熸垚鏍囩锛岃閫夋嫨閲嶇疆鎵规閫夐」涓衡�樻槸鈥欙紱");
+ }
+ maxLotNoStr = label.Max(a => a.LotNo);
+ maxBoxCode = label.Max(a => a.BoxNo);
+ if (string.IsNullOrWhiteSpace(maxLotNoStr))
+ {
+ maxLotNoStr = toDayTime.Substring(2, 6) + "0001";
+ }
+ }
+
}
else
{
@@ -725,7 +740,7 @@
}
//鑾峰彇绠辩爜
- if (maxBoxCode == "")
+ if (string.IsNullOrWhiteSpace(maxBoxCode))
{
var str = "B"+maxLotNoStr + "000001"; //鎵瑰彿+ 娴佹按 2302010001000001
maxBoxCode = str;
@@ -813,16 +828,33 @@
string toDayTime2 = DateTime.Now.ToString("yyyyMMdd");
if (isReset == "0")
{
- var maxCode = label.Max(a => a.LotNo);
- var boxCode1 = label.Max(a => a.BoxNo);//绠卞彿
- var boxCode2 = label.Max(a => a.BoxNo3);//鏀彿
- maxCodestr2 = maxCode;
- maxboxcode2 = boxCode1;
- maxboxcode3 = boxCode2;
- if (string.IsNullOrWhiteSpace(maxCodestr2))
+ //鍒ゆ柇鍗曟嵁鏄惁鏄綑鏂欓��鍥炲崟
+ if (asn.Type == "4")
{
- maxCodestr2 = toDayTime2.Substring(2, 6) + "0001";
+ maxCodestr2 = asnList.LotNo;
+ maxboxcode2 = label.Where(m => m.LotNo == maxCodestr2).Max(a => a.BoxNo);
+ maxboxcode3 = label.Where(m => m.LotNo == maxCodestr2).Max(a => a.BoxNo3);//鏀彿
+ if (string.IsNullOrWhiteSpace(maxCodestr2))
+ {
+ throw new Exception("杞﹂棿浣欐枡閫�鍥炲崟鎹壒娆′笉鑳戒负绌�");
+ }
}
+ else
+ {
+ var labelCount = label.Where(m => m.ASNDetailNo == imId).ToList();
+ if (labelCount.Count <= 0)
+ {
+ throw new Exception("褰撳墠鍗曟嵁鏄庣粏杩樻湭鐢熸垚鏍囩锛岃閫夋嫨閲嶇疆鎵规閫夐」涓衡�樻槸鈥欙紱");
+ }
+ maxCodestr2 = label.Max(a => a.LotNo); ;
+ maxboxcode2 = label.Max(a => a.BoxNo);//绠卞彿;
+ maxboxcode3 = label.Max(a => a.BoxNo3);//鏀彿;
+ if (string.IsNullOrWhiteSpace(maxCodestr2))
+ {
+ maxCodestr2 = toDayTime2.Substring(2, 6) + "0001";
+ }
+ }
+
}
else
{
@@ -875,7 +907,7 @@
}
//鑾峰彇绠辩爜
- if (maxboxcode2 == "")
+ if (string.IsNullOrWhiteSpace(maxboxcode2))
{
maxboxcode2 = "B"+maxCodestr2 + "000001"; // 绠卞彿 鎵瑰彿+绗嚑绠�
}
@@ -919,7 +951,7 @@
}
}
- if (maxboxcode3 == "")
+ if (string.IsNullOrWhiteSpace(maxboxcode3))
{
maxboxcode3 = "Z"+maxCodestr2 + "0001"; // 鏀彿 鎵瑰彿+绗嚑绠�
}
@@ -982,7 +1014,7 @@
Db.Updateable(asnList).ExecuteCommand();
}
}
-
+ Db.CommitTran();
return modelList;
@@ -990,6 +1022,7 @@
}
catch (Exception e)
{
+ Db.RollbackTran();
throw new Exception(e.Message);
}
}
--
Gitblit v1.8.0