From d815631fcd784ad92feca35bc9f0357c3ee65dde Mon Sep 17 00:00:00 2001
From: admin <qiutairan163@163.com>
Date: 星期一, 10 十一月 2025 13:15:42 +0800
Subject: [PATCH] Merge branch 'master' of http://47.95.120.53:8083/r/JC34WMS

---
 Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
index b2366e1..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++;
                         }
 
                         // 鍒ゆ柇鏄惁宸插瓨鍦ㄥ綋鍓嶆槑缁�
@@ -417,7 +421,7 @@
                         //    DateTime lot22;
                         //    if (!DateTime.TryParse(detailModel.Lot1, out lot12))
                         //    {
-                        //        throw new Exception("闇�瑕佽楠岀墿鏂欑敓浜ф棩鏈熻浆鎹㈠け璐�");
+                        //        throw new Exception("闇�瑕佽楠屾枡鐢熶骇鏃ユ湡杞崲澶辫触");
                         //    }
                         //    if (!DateTime.TryParse(detailModel.Lot2, out lot22))
                         //    {
@@ -431,16 +435,16 @@
                             DateTime lot12;
                             if (!DateTime.TryParse(detailModel.Lot1, out lot12))
                             {
-                                throw new Exception("闇�瑕佽楠岀墿鏂欑敓浜ф棩鏈熻浆鎹㈠け璐�");
+                                throw new Exception("鐢熶骇鏃ユ湡杞崲澶辫触锛岃妫�鏌ユ牸寮忔槸鍚︽纭�");
                             }
                             lot1 = lot12.ToString("yyyy-MM-dd");
                         }
                         if (!string.IsNullOrEmpty(lot2))
                         {
                             DateTime lot22;
-                            if (!DateTime.TryParse(detailModel.Lot1, out lot22))
+                            if (!DateTime.TryParse(detailModel.Lot2, out lot22))
                             {
-                                throw new Exception("闇�瑕佽楠岀墿鏂欑敓浜ф棩鏈熻浆鎹㈠け璐�");
+                                throw new Exception("鍒版湡鏃ユ湡杞崲澶辫触锛岃妫�鏌ユ牸寮忔槸鍚︽纭�");
                             }
                             lot2 = lot22.ToString("yyyy-MM-dd");
                         }
@@ -520,6 +524,7 @@
             }
             catch (Exception ex)
             {
+                Db.Ado.RollbackTran();
                 throw new Exception(ex.Message);
             }
         }
@@ -695,16 +700,16 @@
                             DateTime lot12;
                             if (!DateTime.TryParse(detailModel.Lot1, out lot12))
                             {
-                                throw new Exception("闇�瑕佽楠岀墿鏂欑敓浜ф棩鏈熻浆鎹㈠け璐�");
+                                throw new Exception("鐢熶骇鏃ユ湡杞崲澶辫触锛岃妫�鏌ユ牸寮忔槸鍚︽纭�");
                             }
                             detailModel.Lot1 = lot12.ToString("yyyy-MM-dd");
                         }
                         if (!string.IsNullOrEmpty(detailModel.Lot2))
                         {
                             DateTime lot22;
-                            if (!DateTime.TryParse(detailModel.Lot1, out lot22))
+                            if (!DateTime.TryParse(detailModel.Lot2, out lot22))
                             {
-                                throw new Exception("闇�瑕佽楠岀墿鏂欑敓浜ф棩鏈熻浆鎹㈠け璐�");
+                                throw new Exception("鍒版湡鏃ユ湡杞崲澶辫触锛岃妫�鏌ユ牸寮忔槸鍚︽纭�");
                             }
                             detailModel.Lot2 = lot22.ToString("yyyy-MM-dd");
                         }
@@ -864,6 +869,7 @@
             }
             catch (Exception ex)
             {
+                Db.Ado.RollbackTran();
                 throw ex;
             }
         }

--
Gitblit v1.8.0