From cde56aae50adc11ff8db84e424d873843c566bfd Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 24 二月 2025 23:40:41 +0800
Subject: [PATCH] 优化WCS移库逻辑

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 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 64c2a2b..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"
@@ -1,4 +1,5 @@
 锘縰sing AutoMapper;
+using Microsoft.IdentityModel.Tokens;
 using SqlSugar;
 using System;
 using System.Collections.Generic;
@@ -72,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