From 3c5a57e55861a305b53089c91ef12c9edfbdafd0 Mon Sep 17 00:00:00 2001
From: admin <qiutairan163@163.com>
Date: 星期二, 18 十一月 2025 11:46:40 +0800
Subject: [PATCH] 托盘中含有的执行中的单据GetRunSoNoticeList增加SONo降序排序

---
 Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
index a850df2..bdd298f 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");
                         }
@@ -732,7 +737,7 @@
 
                         // 澶勭悊浠锋牸榛樿鍊�
                         detailModel.Price ??= 0;
-
+                        detailModel.BoxCodeStr = detailModel.LotNo;
                         // 鐢熸垚绠辩爜锛堣嚜鏈夋壒娆¢�昏緫锛�
                         if (detailModel.Id == 0 || detailModel.Id == null || string.IsNullOrWhiteSpace(detailModel.LotNo))
                         {
@@ -864,6 +869,7 @@
             }
             catch (Exception ex)
             {
+                Db.Ado.RollbackTran();
                 throw ex;
             }
         }
@@ -1533,10 +1539,10 @@
 
                 var response = HttpHelper.DoPost(url, jsonData, "鍏ュ簱鍗曞畬鎴愪笂浼�", "SAP");
 
-                var obj = JsonConvert.DeserializeObject<ErpModel>(response);//瑙f瀽杩斿洖鏁版嵁
-                if (obj.Success != 0)
+                var obj = JsonConvert.DeserializeObject<SapResultModel>(response);//瑙f瀽杩斿洖鏁版嵁
+                if (obj.RESULT != true)
                 {
-                    throw new Exception("涓婁紶澶辫触" + obj.Message);
+                    throw new Exception("涓婁紶澶辫触" + obj.MESSAGE);
                 }
                 #endregion
 

--
Gitblit v1.8.0