From 5b8bf171b9afda52fa366a72e54eedbd9e6d4d17 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期六, 01 十一月 2025 19:54:25 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhiHuiQiCe/FangCangZhiNeng

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 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 0bc06b6..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"
@@ -125,13 +125,15 @@
                 var LocationCode = saveModel.MainData["LocationCode"].ToString();
                 var orderNo = saveModel.MainData["orderNo"].ToString();
                 var batchNo = saveModel.MainData["batchNo"].ToString();
+                var id = saveModel.MainData["id"].ObjToInt();
                 var materielCode = saveModel.MainData["materielCode"].ToString();
                 var Inqty = saveModel.MainData["Inqty"].ObjToInt();
                 var warehouseCode = saveModel.MainData["warehouseCode"].ToString();
                 Dt_CabinOrder cabinOrder = BaseDal.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == orderNo && x.Warehouse_no == warehouseCode).Includes(x => x.Details).First();
                 if (cabinOrder == null || cabinOrder.OdrderStatus == "宸插畬鎴�")
                     return WebResponseContent.Instance.Error($"鍏ュ簱鍗曞凡瀹屾垚");
-                Dt_CabinOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Goods_no == materielCode && x.Batch_num == batchNo && x.Status == 2).FirstOrDefault();
+                //Dt_CabinOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Goods_no == materielCode && x.Batch_num == batchNo && x.Status == 2).FirstOrDefault();
+                Dt_CabinOrderDetail? cabinOrderDetail = cabinOrder.Details.Where(x => x.Id == id).FirstOrDefault();
                 if (cabinOrderDetail == null || cabinOrderDetail.OrderDetailStatus == "宸插畬鎴�")
                     return WebResponseContent.Instance.Error($"鍏ュ簱鍗曟槑缁嗗凡瀹屾垚");
                 Dt_MaterielInfo materielInfo = _materielInfoService.Repository.QueryFirst(x => x.MaterielCode == cabinOrderDetail.Goods_no);
@@ -474,18 +476,25 @@
                         }
                         //_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);
             }
             return webResponseContent;
@@ -829,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
@@ -836,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.浜哄伐瀹屾垚);

--
Gitblit v1.9.3