From ac3ce47deac633b4856ed6349286dffc81f93690 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 01 十一月 2025 19:52:36 +0800
Subject: [PATCH] 优化出入库单人工完成

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs |   29 ++++++++++++++++++-----------
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs    |   23 +++++++++++++++--------
 新建文件夹/WMS/src/views/Index.vue                                                |    3 ++-
 3 files changed, 35 insertions(+), 20 deletions(-)

diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
index 2b8f8b7..6a764ee 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
@@ -476,18 +476,24 @@
                         }
                         //_materielInfoService.UpdateData(materielInfo);
                     }
-                    _unitOfWorkManage.BeginTran();
-                    if (materielInfosUp.Count > 0) _materielInfoService.UpdateData(materielInfosUp);
-                    if (entityOrder.Details.Count > 0) dt_CabinOrders.Add(entityOrder);
-                    if (entityOrderLK.Details.Count > 0) dt_CabinOrders.Add(entityOrderLK);
-                    if (dt_CabinOrders.Count > 0) BaseDal.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
-                    _unitOfWorkManage.CommitTran();
+                    try
+                    {
+                        _unitOfWorkManage.BeginTran();
+                        if (materielInfosUp.Count > 0) _materielInfoService.UpdateData(materielInfosUp);
+                        if (entityOrder.Details.Count > 0) dt_CabinOrders.Add(entityOrder);
+                        if (entityOrderLK.Details.Count > 0) dt_CabinOrders.Add(entityOrderLK);
+                        if (dt_CabinOrders.Count > 0) BaseDal.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
+                        _unitOfWorkManage.CommitTran();
+                    }
+                    catch (Exception)
+                    {
+                        _unitOfWorkManage.RollbackTran();
+                    }
                     //webResponseContent.OK(data: dt_CabinOrders);
                 }
             }
             catch (Exception ex)
             {
-                _unitOfWorkManage.RollbackTran();
                 _messageInfoService.AddMessageInfo(MessageGroupByEnum.InOrderAlarm, (order.order_type == "2" ? "鍑哄簱閫�璐�" : "姝e父鍏ュ簱") + $"锛氬崟鍙枫�恵order.order_no}銆�", ex.Message);
                 webResponseContent.Error(ex.Message);
             }
@@ -832,6 +838,7 @@
                 else
                 {
                     var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
+                    if (cabinOrder.Order_type == "2") url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
                     var requestDate = new
                     {
                         order_no = cabinOrder.Order_no
@@ -839,7 +846,7 @@
                     var result = HttpHelper.Post(url, requestDate.ToJsonString());
                     var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
                     if (response == null) throw new Exception("涓婃姤ERP鍏ュ簱鍗曞畬鎴愬け璐ワ紒");
-                    if (response.resultCode != "0") throw new Exception(response.resultMsg);
+                    if (response.resultCode != "0" && response.resultMsg != "鏈壘鍒板悎娉曞崟鎹�") throw new Exception(response.resultMsg);
 
                     _cabinOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetails, OperateTypeEnum.浜哄伐瀹屾垚);
                     BaseDal.DeleteAndMoveIntoHty(cabinOrders, OperateTypeEnum.浜哄伐瀹屾垚);
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 b9b42b1..44d2925 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"
@@ -464,15 +464,22 @@
                             //_supplyTaskService.AddData(supplyTasks);
                         }
                     }
-                    _unitOfWorkManage.BeginTran();
-                    _supplyTaskService.AddData(supplyTasks);
-                    _inventory_BatchServices.UpdateData(batchesUp);
-                    _inventoryInfoService.UpdateData(inventoryInfosUp);
-                    if (entityOrder.Details.Count > 0)
-                        BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
-                    if (entityOrderLK.Details.Count > 0)
-                        BaseDal.Db.CopyNew().InsertNav(entityOrderLK).Include(x => x.Details).ExecuteCommand();
-                    _unitOfWorkManage.CommitTran();
+                    try
+                    {
+                        _unitOfWorkManage.BeginTran();
+                        _supplyTaskService.AddData(supplyTasks);
+                        _inventory_BatchServices.UpdateData(batchesUp);
+                        _inventoryInfoService.UpdateData(inventoryInfosUp);
+                        if (entityOrder.Details.Count > 0)
+                            BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
+                        if (entityOrderLK.Details.Count > 0)
+                            BaseDal.Db.CopyNew().InsertNav(entityOrderLK).Include(x => x.Details).ExecuteCommand();
+                        _unitOfWorkManage.CommitTran();
+                    }
+                    catch (Exception ex)
+                    {
+                        _unitOfWorkManage.RollbackTran();
+                    }
                     #endregion
                 }
                 webResponseContent.OK();
@@ -480,7 +487,6 @@
             catch (Exception ex)
             {
                 _messageInfoService.AddMessageInfo(MessageGroupByEnum.OutOrderAlarm, (outorder.order_type == "3" ? "鍏ュ簱閫�璐�" : "姝e父鍑哄簱") + $"锛氬崟鍙枫�恵outorder.order_no}銆�", ex.Message);
-                _unitOfWorkManage.RollbackTran();
                 webResponseContent.Error(ex.Message);
             }
             return webResponseContent;
@@ -1147,6 +1153,7 @@
                 else
                 {
                     var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
+                    if (deliveryOrder.Out_type == "3") url = "http://121.37.118.63:80/GYZ2/95fck/inOrderOk";
                     var requestDate = new
                     {
                         order_no = deliveryOrder.Out_no
@@ -1154,7 +1161,7 @@
                     var result = HttpHelper.Post(url, requestDate.ToJsonString());
                     var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
                     if (response == null) throw new Exception("涓婃姤ERP鍑哄簱鍗曞畬鎴愬け璐ワ紒");
-                    if (response.resultCode != "0") throw new Exception(response.resultMsg);
+                    if (response.resultCode != "0" && response.resultMsg != "鏈壘鍒板悎娉曞崟鎹�") throw new Exception(response.resultMsg);
                     _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(deliveryOrderDetails, OperateTypeEnum.浜哄伐瀹屾垚);
                     BaseDal.DeleteAndMoveIntoHty(deliveryOrders, OperateTypeEnum.浜哄伐瀹屾垚);
                 }
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/views/Index.vue" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/views/Index.vue"
index aade1a5..5d52cad 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/views/Index.vue"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/views/Index.vue"
@@ -612,7 +612,8 @@
         }
       }
 
-      createSocket("ws://172.16.1.4:9296/" + _userInfo.userName);
+      //createSocket("ws://127.0.0.1:9296/" + _userInfo.userName);
+       createSocket("ws://172.16.1.4:9296/" + _userInfo.userName);
 
       Object.assign(_config.$tabs, { open: open, close: close });
 

--
Gitblit v1.9.3