From a372b271c01f5ad0491c74b7e9fd4a078ad526cc Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期一, 10 十一月 2025 18:37:26 +0800
Subject: [PATCH] 优化退货代码

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs |   12 +++++++++++-
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs           |    4 ++--
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs              |    4 +++-
 新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs                      |   13 ++++++++++++-
 新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs                     |   14 +++++++-------
 5 files changed, 35 insertions(+), 12 deletions(-)

diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs"
index 4e8d747..fa7bf08 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs"
@@ -214,6 +214,7 @@
                 var url = "http://121.37.118.63:80/GYZ2/95fck/inOrderOk";
                 foreach (var item in Orders.GroupBy(x => x.Order_no))
                 {
+                    //鍙湁褰撹璁㈠崟鍙蜂笅鐨勬墍鏈夎褰曢兘鏄�"宸插畬鎴�"鐘舵�佹椂锛屾墠缁х画澶勭悊
                     if (!item.Where(x => x.OdrderStatus != "宸插畬鎴�").Any())
                     {
                         if (item.First().Order_type == InOrderTypeEnum.Allocat.ObjToInt().ToString())
@@ -293,7 +294,7 @@
                         }
                         else
                         {
-                            if (item.First().Out_type == "3") url = "http://121.37.118.63:80/GYZ2/95fck/inOrderOk";//鍏ュ簱閫�璐�
+                            if (item.First().Out_type == "3") url = "http://121.37.118.63:80/GYZ2/95fck/inOrderOk";//鍏ュ簱閫�璐� 鍑哄簱鍗�
                             var result = HttpHelper.Post(url, new { order_no = item.Key }.ToJsonString());
                             var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
                             if (response != null && response.resultCode == "0")
@@ -327,5 +328,6 @@
             }
         }
         #endregion
+      
     }
 }
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
index 4a33baa..97ae41b 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
@@ -1489,7 +1489,17 @@
                     materielInfo.Business_qty -= supplyTask.StockQuantity;
                     if (materielInfo.Business_qty < materielInfo.MinQty)
                     {
-                        CreateAllocatInOut(materielInfo);//鍒涘缓璋冩嫧浠诲姟
+                        var result = CreateAllocatInOut(materielInfo); // 鍒涘缓璋冩嫧浠诲姟
+                        if (!result.Status)
+                        {
+                            // 璋冩嫧浠诲姟鍒涘缓澶辫触锛屼絾浠嶇劧瑕佹洿鏂扮墿鏂欎俊鎭�
+                            _materielInfoService.UpdateData(materielInfo);
+                            // 鍙互閫夋嫨璁板綍鏃ュ織鎴栨坊鍔犳彁绀轰俊鎭�
+                            _messageInfoService.AddMessageInfo(MessageGroupByEnum.InventoryLowAlarm,
+                                $"璋冩嫧浠诲姟鍒涘缓澶辫触",
+                                $"鐗╂枡{materielInfo.MaterielCode}涓氬姟搴撳瓨宸叉洿鏂帮紝浣嗚皟鎷ㄤ换鍔″垱寤哄け璐�: {result.Message}");
+                        }
+                        // 濡傛灉鎴愬姛锛岀墿鏂欎俊鎭凡缁忓湪 CreateAllocatInOut 鍐呴儴鏇存柊浜�
                     }
                     else
                     {
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs"
index 7c2b623..3ebd163 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs"
@@ -239,7 +239,7 @@
                         else if (order.order_type == "3")//鍏ュ簱閫�鏂�
                         {
                             #region 杞崲涓哄嚭搴撳崟
-                            UpstramOutOrderInfo upstramOutOrderInfo = new UpstramOutOrderInfo()
+                             UpstramOutOrderInfo upstramOutOrderInfo = new UpstramOutOrderInfo()
                             {
                                 order_no = order.order_no,
                                 order_type = order.order_type,
@@ -255,7 +255,7 @@
                                 {
                                     batch_num = item.batch_num,
                                     goods_no = item.goods_no,
-                                    order_qty = item.order_qty,
+                                    order_qty = Math.Abs(item.order_qty),
                                     exp_date = item.exp_date,
                                 };
                                 upstramOutOrderInfo.details.Add(detail);
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs"
index 0b814d0..a35156c 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs"
@@ -14,15 +14,26 @@
             _materielInfoService = materielInfoService;
         }
         //姣忛殧1绉掓墽琛屼竴娆�
-        [Invoke(Begin = "2025-11-01", Interval = 1000 * 5, IsEnabled = true, SkipWhileExecuting = true)]
+        [Invoke(Begin = "2025-11-01", Interval = 1000 * 18, IsEnabled = true, SkipWhileExecuting = true)]
         public void Run()
         {
             _materielInfoService.GetMedicineGoodsInfom();
+            Thread.Sleep(1000);
             _business.GetInOrder();
+            Thread.Sleep(1000);
             _business.GetOutOrder();
+            Thread.Sleep(1000);
             _business.CompleteAllOrders();
+            Thread.Sleep(1000);
             _business.CompleteAllOutOrders();
+            Thread.Sleep(1000);
             Console.WriteLine($"ERP浠诲姟鎵ц缁撴潫锛歿DateTime.Now}");
+            _materielInfoService.ProductSynchronous();
+            Thread.Sleep(1000);
+            _business.EdiIn();
+            Thread.Sleep(1000);
+            _business.EdiOut();
+            Console.WriteLine($"WCS浠诲姟鎵ц缁撴潫锛歿DateTime.Now}");
         }
     }
 }
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs"
index a6fc209..7fcde26 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs"
@@ -14,15 +14,15 @@
             _materielInfoService = materielInfoService;
         }
         //姣忛殧1绉掓墽琛屼竴娆�
-        [Invoke(Begin = "2025-11-01", Interval = 1000 * 5, IsEnabled = true, SkipWhileExecuting = true)]
+        [Invoke(Begin = "2025-11-01", Interval = 1000 * 5, IsEnabled = false, SkipWhileExecuting = true)]
         public void Run()
         {
-            Thread.Sleep(3000);
-            //鑾峰彇涓婃父鍑哄簱鍗曟暟鎹�
-            _materielInfoService.ProductSynchronous();
-            _business.EdiIn();
-            _business.EdiOut();
-            Console.WriteLine($"WCS浠诲姟鎵ц缁撴潫锛歿DateTime.Now}");
+            //Thread.Sleep(3000);
+            ////鑾峰彇涓婃父鍑哄簱鍗曟暟鎹�
+            //_materielInfoService.ProductSynchronous();
+            //_business.EdiIn();
+            //_business.EdiOut();
+            //Console.WriteLine($"WCS浠诲姟鎵ц缁撴潫锛歿DateTime.Now}");
         }
     }
 }

--
Gitblit v1.9.3