From f43b7df8400f4fcffc9f19dca0888d61e2b33d5f Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 12 三月 2025 18:41:52 +0800
Subject: [PATCH] WMS系统添加PDA权限,PDA程序

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs"
index 7bc0dac..eb0d255 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs"
@@ -55,14 +55,6 @@
         {
             InboundOrderAddDTO orderAddDTO = saveModel.MainData.DicToModel<InboundOrderAddDTO>();
             orderAddDTO.Details = saveModel.DetailData.DicToIEnumerable<InboundOrderDetailAddDTO>();
-            List<string> LocationCodes = orderAddDTO.Details
-                .Where(x => !string.IsNullOrEmpty(x.LocationCode))
-                .Select(x => x.LocationCode).ToList();
-            if (LocationCodes.Any())
-            {
-                var content = _basicService.LocationInfoService.UpdateStatus(LocationCodes, LocationStatusEnum.PalletLock.ObjToInt());
-                if (!content.Status) return WebResponseContent.Instance.Error("鎸囧畾璐т綅寮傚父");
-            }
             return AddInboundOrder(orderAddDTO);
         }
 
@@ -81,14 +73,28 @@
                 if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2);
                 #endregion
 
+                List<string> LocationCodes = orderAddDTO.Details
+                    .Where(x => !string.IsNullOrEmpty(x.LocationCode))
+                    .Select(x => x.LocationCode).ToList();
+
                 Dt_InboundOrder inboundOrder = _mapper.Map<Dt_InboundOrder>(orderAddDTO);
-                inboundOrder.OrderNo = DateTime.Now.ToString("yyMMddHHmmss");
+                //inboundOrder.OrderNo = DateTime.Now.ToString("yyMMddHHmmss");
                 inboundOrder.OrderStatus = InboundStatusEnum.鏈紑濮�.ObjToInt();
-                bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
+                Db.Ado.BeginTran();
+                if (LocationCodes.Any())
+                {
+                    content = _basicService.LocationInfoService.UpdateStatus(LocationCodes, LocationStatusEnum.PalletLock.ObjToInt());
+                    if (!content.Status)
+                        throw new Exception(content.Message);
+                }
+                    
+                BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
+                Db.Ado.CommitTran();
                 content = WebResponseContent.Instance.OK();
             }
             catch (Exception ex)
             {
+                Db.Ado.RollbackTran();
                 content = WebResponseContent.Instance.Error(ex.Message);
             }
             finally

--
Gitblit v1.9.3