From 6695afe1e1c478dbb599a1d382d8d6628b456d03 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期六, 18 一月 2025 17:30:49 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs |   38 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 2 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs"
index c5d0066..7f4454c 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs"
@@ -247,6 +247,9 @@
                     Pickcode = outboundOrder.UpperOrderNo,
                     PickList = eRPPickModels
                 };
+                string Createuser = "";
+                if (!string.IsNullOrEmpty(App.User.UserName)) Createuser = App.User.UserName;
+                else Createuser = stockLockInfos.FirstOrDefault().Creater;
                 issueModel = new ERPIssueModel()
                 {
                     UniqueTag = outboundOrder.Id.ToString(),
@@ -256,7 +259,7 @@
                     Deptno = outboundOrder.DepartmentCode,
                     Deptname = outboundOrder.DepartmentName,
                     Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
-                    Createuser = App.User.UserName ?? stockLockInfos.FirstOrDefault().Creater,
+                    Createuser = string.IsNullOrEmpty(Createuser) ? Createuser : "admin",
                     Issitem = new List<ERPIssueItemModel>() { issueItemModel },
                 };
             }
@@ -553,7 +556,7 @@
                         throw new ArgumentNullException(nameof(ruleCode));
                     SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig
                     {
-                        IsAutoCloseConnection = false,
+                        IsAutoCloseConnection = true,
                         DbType = DbType.SqlServer,
                         ConnectionString = DBContext.ConnectionString
                     });
@@ -625,5 +628,36 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
+        /// <summary>
+        /// 鏍规嵁鍑哄簱鍗曟帹閫丒RP绯荤粺
+        /// </summary>
+        /// <param name="outId"></param>
+        /// <param name="WarehouseCode"></param>
+        /// <returns></returns>
+        public WebResponseContent PushERPOutBound(int outId, string WarehouseCode)
+        {
+            WebResponseContent content=new WebResponseContent();
+            try
+            {
+                //鑾峰彇鍑哄簱鍗�
+                Dt_OutboundOrder outboundOrder = Db.Queryable<Dt_OutboundOrder>().Where(x => x.Id == outId).Includes(x => x.Details).First();
+                if (outboundOrder == null)
+                {
+                    return content.Error("鍑哄簱鍗曚笉瀛樺湪");
+                }
+                if (outboundOrder.Details.Count!=(outboundOrder.Details.Where(x=>x.OrderDetailStatus==OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count)||outboundOrder.OrderStatus!=OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt())
+                {
+                    return content.Error("璇ュ嚭搴撳崟鏈畬鎴�");
+                }
+                ERPIssueModel issueModel = GetERPIssueModel(outboundOrder, WarehouseCode);
+                string response=_invokeERPService.InvokeOutStandardsApi(issueModel);
+                return content.OK(response);
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            return content;
+        }
     }
 }

--
Gitblit v1.9.3