From b56aea4956fd8b4951cbed02103e47aff574d36b Mon Sep 17 00:00:00 2001
From: admin <qiutairan163@163.com>
Date: 星期一, 10 十一月 2025 13:24:39 +0800
Subject: [PATCH] AddExportNotice的出库数量Qty<=0校验
---
Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs | 105 +++++++++++++++++++++++++++++++++++++---------------
1 files changed, 75 insertions(+), 30 deletions(-)
diff --git a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
index 501707c..2916583 100644
--- a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -273,6 +273,7 @@
*/
var TypeLot = "1, 5, 6, 7"; //鎵规鍙负绌哄崟鎹被鍨�
+ int codeStrNum = 0;
try
{
if (model.Origin == "褰曞叆" || model.Origin == "瀵煎叆")
@@ -378,13 +379,16 @@
&& m.CreateTime.ToString("yyyyMM") == DateTime.Now.ToString("yyyyMM")).Max(m => m.BoxCodeStr);
if(string.IsNullOrWhiteSpace(maxBoxCodeStr))
{
- maxBoxCodeStr = "BK" + toDayTime.Substring(2, 4) + "0001";
+ string codeEndStr = (1 + codeStrNum).ToString().PadLeft(4, '0');
+ maxBoxCodeStr = "BK" + toDayTime.Substring(2, 4) + codeEndStr;
}
else
{
- maxBoxCodeStr = "BK" + (int.Parse(maxBoxCodeStr.Replace("BK", "")) + 1).ToString();
+ maxBoxCodeStr = "BK" + (int.Parse(maxBoxCodeStr.Replace("BK", "")) + 1 + codeStrNum).ToString();
}
detailModel.BoxCodeStr = maxBoxCodeStr;
+
+ codeStrNum++;
}
// 鍒ゆ柇鏄惁宸插瓨鍦ㄥ綋鍓嶆槑缁�
@@ -410,22 +414,41 @@
}
string lot1 = detailModel.Lot1;
string lot2 = detailModel.Lot2;
- if (sku.IsControlled == "0")//鏄惁璇烽獙锛�0锛氭槸 1锛氬惁
+ //if (sku.IsControlled == "0")//鏄惁璇烽獙锛�0锛氭槸 1锛氬惁
+ //{
+ // //闇�瑕佽楠岀墿鏂� 鐢熶骇鏃ユ湡銆佹湁鏁堟湡涓嶈兘涓虹┖
+ // DateTime lot12;
+ // DateTime lot22;
+ // if (!DateTime.TryParse(detailModel.Lot1, out lot12))
+ // {
+ // throw new Exception("闇�瑕佽楠屾枡鐢熶骇鏃ユ湡杞崲澶辫触");
+ // }
+ // if (!DateTime.TryParse(detailModel.Lot2, out lot22))
+ // {
+ // throw new Exception("闇�瑕佽楠屾枡杩囨湡鏃ユ湡杞崲澶辫触");
+ // }
+ // lot1 = lot12.ToString("yyyy-MM-dd");
+ // lot2 = lot22.ToString("yyyy-MM-dd");
+ //}
+ if (!string.IsNullOrEmpty(lot1))
{
- //闇�瑕佽楠岀墿鏂� 鐢熶骇鏃ユ湡銆佹湁鏁堟湡涓嶈兘涓虹┖
DateTime lot12;
- DateTime lot22;
if (!DateTime.TryParse(detailModel.Lot1, out lot12))
{
- throw new Exception("闇�瑕佽楠岀墿鏂欑敓浜ф棩鏈熻浆鎹㈠け璐�");
- }
- if (!DateTime.TryParse(detailModel.Lot2, out lot22))
- {
- throw new Exception("闇�瑕佽楠屾枡杩囨湡鏃ユ湡杞崲澶辫触");
+ throw new Exception("鐢熶骇鏃ユ湡杞崲澶辫触锛岃妫�鏌ユ牸寮忔槸鍚︽纭�");
}
lot1 = lot12.ToString("yyyy-MM-dd");
+ }
+ if (!string.IsNullOrEmpty(lot2))
+ {
+ DateTime lot22;
+ if (!DateTime.TryParse(detailModel.Lot2, out lot22))
+ {
+ throw new Exception("鍒版湡鏃ユ湡杞崲澶辫触锛岃妫�鏌ユ牸寮忔槸鍚︽纭�");
+ }
lot2 = lot22.ToString("yyyy-MM-dd");
}
+
if (string.IsNullOrWhiteSpace(detailModel.PackagNo))
{
detailModel.PackagNo = sku.PackagNo;
@@ -501,6 +524,7 @@
}
catch (Exception ex)
{
+ Db.Ado.RollbackTran();
throw new Exception(ex.Message);
}
}
@@ -649,27 +673,47 @@
//}
// 3. 鏍规嵁鍙楁帶鐘舵�侀獙璇佹棩鏈�
- if (material.IsControlled=="0")
+ //if (material.IsControlled=="0")
+ //{
+ // // 鍙楁帶鐘舵�侊細鐢熶骇鏃ユ湡蹇呭~
+ // if (string.IsNullOrWhiteSpace(detailModel.Lot1))
+ // return $"-1:鐗╂枡{detailModel.SkuNo}涓洪渶璇烽獙鐗╂枡锛岀敓浜ф棩鏈熶笉鍙负绌�;";
+
+ // // 鍙楁帶鐘舵�侊細杩囨湡鏃ユ湡蹇呭~
+ // if (string.IsNullOrWhiteSpace(detailModel.Lot2))
+ // return $"-1:鐗╂枡{detailModel.SkuNo}涓洪渶璇烽獙鐗╂枡锛岃繃鏈熸棩鏈熶笉鍙负绌�;";
+
+ // // 楠岃瘉鏃ユ湡鏍煎紡鏈夋晥鎬�
+ // if (!DateTime.TryParse(detailModel.Lot1, out DateTime productionDate))
+ // return $"-1:鐗╂枡{detailModel.SkuNo}鐨勭敓浜ф棩鏈熸牸寮忛敊璇紝璇蜂娇鐢ㄦ湁鏁堟棩鏈熸牸寮�;";
+
+ // if (!DateTime.TryParse(detailModel.Lot2, out DateTime expiryDate))
+ // return $"-1:鐗╂枡{detailModel.SkuNo}鐨勮繃鏈熸棩鏈熸牸寮忛敊璇紝璇蜂娇鐢ㄦ湁鏁堟棩鏈熸牸寮�;";
+
+ // // 楠岃瘉杩囨湡鏃ユ湡涓嶈兘鏃╀簬鐢熶骇鏃ユ湡
+ // if (expiryDate <= productionDate)
+ // return $"-1:鐗╂枡{detailModel.SkuNo}鐨勮繃鏈熸棩鏈熶笉鑳芥棭浜庣敓浜ф棩鏈�;";
+ //}
+
+ if (!string.IsNullOrEmpty(detailModel.Lot1))
{
- // 鍙楁帶鐘舵�侊細鐢熶骇鏃ユ湡蹇呭~
- if (string.IsNullOrWhiteSpace(detailModel.Lot1))
- return $"-1:鐗╂枡{detailModel.SkuNo}涓洪渶璇烽獙鐗╂枡锛岀敓浜ф棩鏈熶笉鍙负绌�;";
-
- // 鍙楁帶鐘舵�侊細杩囨湡鏃ユ湡蹇呭~
- if (string.IsNullOrWhiteSpace(detailModel.Lot2))
- return $"-1:鐗╂枡{detailModel.SkuNo}涓洪渶璇烽獙鐗╂枡锛岃繃鏈熸棩鏈熶笉鍙负绌�;";
-
- // 楠岃瘉鏃ユ湡鏍煎紡鏈夋晥鎬�
- if (!DateTime.TryParse(detailModel.Lot1, out DateTime productionDate))
- return $"-1:鐗╂枡{detailModel.SkuNo}鐨勭敓浜ф棩鏈熸牸寮忛敊璇紝璇蜂娇鐢ㄦ湁鏁堟棩鏈熸牸寮�;";
-
- if (!DateTime.TryParse(detailModel.Lot2, out DateTime expiryDate))
- return $"-1:鐗╂枡{detailModel.SkuNo}鐨勮繃鏈熸棩鏈熸牸寮忛敊璇紝璇蜂娇鐢ㄦ湁鏁堟棩鏈熸牸寮�;";
-
- // 楠岃瘉杩囨湡鏃ユ湡涓嶈兘鏃╀簬鐢熶骇鏃ユ湡
- if (expiryDate <= productionDate)
- return $"-1:鐗╂枡{detailModel.SkuNo}鐨勮繃鏈熸棩鏈熶笉鑳芥棭浜庣敓浜ф棩鏈�;";
+ DateTime lot12;
+ if (!DateTime.TryParse(detailModel.Lot1, out lot12))
+ {
+ throw new Exception("鐢熶骇鏃ユ湡杞崲澶辫触锛岃妫�鏌ユ牸寮忔槸鍚︽纭�");
+ }
+ detailModel.Lot1 = lot12.ToString("yyyy-MM-dd");
}
+ if (!string.IsNullOrEmpty(detailModel.Lot2))
+ {
+ DateTime lot22;
+ if (!DateTime.TryParse(detailModel.Lot2, out lot22))
+ {
+ throw new Exception("鍒版湡鏃ユ湡杞崲澶辫触锛岃妫�鏌ユ牸寮忔槸鍚︽纭�");
+ }
+ detailModel.Lot2 = lot22.ToString("yyyy-MM-dd");
+ }
+
// 涓嶅彈鎺х姸鎬侊細鏃ユ湡闈炲繀濉紝鏃犻渶楠岃瘉
// 鍘熸湁鎵规鐩稿叧楠岃瘉锛堜繚鐣欙級
@@ -693,7 +737,7 @@
// 澶勭悊浠锋牸榛樿鍊�
detailModel.Price ??= 0;
-
+ detailModel.BoxCodeStr = detailModel.LotNo;
// 鐢熸垚绠辩爜锛堣嚜鏈夋壒娆¢�昏緫锛�
if (detailModel.Id == 0 || detailModel.Id == null || string.IsNullOrWhiteSpace(detailModel.LotNo))
{
@@ -825,6 +869,7 @@
}
catch (Exception ex)
{
+ Db.Ado.RollbackTran();
throw ex;
}
}
--
Gitblit v1.8.0