From a89c018c3afa43a529f9eb54725bc92ed2b996e8 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期二, 24 九月 2024 15:04:45 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs |  104 ++-------------------------------------------------
 1 files changed, 5 insertions(+), 99 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs"
similarity index 70%
rename from "\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
rename to "\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs"
index 0342543..9fd4301 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs"
@@ -23,102 +23,8 @@
 
 namespace WIDESEA_InboundService
 {
-    public class InboundOrderService : ServiceBase<Dt_InboundOrder, IInboundOrderRepository>, IInboundOrderService
+    public partial class InboundOrderService : ServiceBase<Dt_InboundOrder, IInboundOrderRepository>, IInboundOrderService
     {
-        private readonly IMapper _mapper;
-        private readonly IUnitOfWorkManage _unitOfWorkManage;
-        private readonly ITaskRepository _taskRepository;
-
-        private IBasicService _basicService;
-        private IStockService _stockService;
-        private IInboundOrderDetailService _inboundOrderDetailService;
-
-        public IInboundOrderRepository Repository => BaseDal;
-
-        public InboundOrderService(IInboundOrderRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, ITaskRepository taskRepository, IBasicService basicService, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService) : base(BaseDal)
-        {
-            _mapper = mapper;
-            _unitOfWorkManage = unitOfWorkManage;
-            _taskRepository = taskRepository;
-            _basicService = basicService;
-            _stockService = stockService;
-            _inboundOrderDetailService = inboundOrderDetailService;
-        }
-
-        /// <summary>
-        /// 娣诲姞鍗曟嵁
-        /// </summary>
-        /// <param name="saveModel"></param>
-        /// <returns></returns>
-        public override WebResponseContent AddData(SaveModel saveModel)
-        {
-            InboundOrderAddDTO orderAddDTO = saveModel.MainData.DicToModel<InboundOrderAddDTO>();
-            orderAddDTO.Details = saveModel.DetailData.DicToIEnumerable<InboundOrderDetailAddDTO>();
-            return AddInboundOrder(orderAddDTO);
-        }
-
-        /// <summary>
-        /// 娣诲姞鍗曟嵁
-        /// </summary>
-        /// <param name="orderAddDTO">鍗曟嵁娣诲姞DTO</param>
-        /// <returns></returns>
-        public WebResponseContent AddInboundOrder(InboundOrderAddDTO orderAddDTO)
-        {
-            WebResponseContent content = new();
-            try
-            {
-                #region 楠岃瘉鏁版嵁
-                (bool, string, object?) result = CheckInboundOrderAddData(orderAddDTO);
-                if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2);
-                #endregion
-
-                Dt_InboundOrder inboundOrder = _mapper.Map<Dt_InboundOrder>(orderAddDTO);
-                inboundOrder.OrderStatus = InboundStatusEmun.鏈紑濮�.ObjToInt();
-                bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
-                content = WebResponseContent.Instance.OK();
-            }
-            catch (Exception ex)
-            {
-                content = WebResponseContent.Instance.Error(ex.Message);
-            }
-            finally
-            {
-
-            }
-            return content;
-        }
-
-        /// <summary>
-        /// 楠岃瘉鍗曟嵁娣诲姞DTO瀵硅薄
-        /// </summary>
-        /// <param name="inboundOrderAddDTO">鍗曟嵁娣诲姞DTO</param>
-        /// <returns></returns>
-        private (bool, string, object?) CheckInboundOrderAddData(InboundOrderAddDTO inboundOrderAddDTO)
-        {
-            (bool, string, object?) result1 = ModelValidate.ValidateModelData(inboundOrderAddDTO);
-            if (!result1.Item1) return result1;
-
-            (bool, string, object?) result2 = ModelValidate.ValidateModelData(inboundOrderAddDTO.Details);
-            if (!result2.Item1) return result2;
-
-            IEnumerable<int> inOrderTypes = Enum.GetValues<InOrderTypeEnum>().Cast<int>();
-            if (!inOrderTypes.Contains(inboundOrderAddDTO.OrderType))
-            {
-                return (false, "鏈壘鍒拌鍗曟嵁绫诲瀷", inboundOrderAddDTO);
-            }
-
-            List<string> materielCodes = inboundOrderAddDTO.Details.Select(x => x.MaterielCode).ToList();
-            if (!_basicService.MaterielInfoService.ExsitMateriels(materielCodes))
-            {
-                return (false, "鏈夌墿鏂欎俊鎭湭褰曞叆锛岃褰曞叆鐗╂枡淇℃伅", inboundOrderAddDTO);
-            }
-
-            if (BaseDal.QueryFirst(x => x.UpperOrderNo == inboundOrderAddDTO.UpperOrderNo && !string.IsNullOrEmpty(x.UpperOrderNo)) != null)
-            {
-                return (false, "鍗曟嵁宸插瓨鍦�", inboundOrderAddDTO);
-            }
-            return (true, "鎴愬姛", inboundOrderAddDTO);
-        }
 
         /// <summary>
         /// 鏍规嵁鍏ュ簱鍗曞彿鑾峰彇鍏ュ簱鍗�(鍚槑缁�)
@@ -186,11 +92,11 @@
                 List<int> updateDetailIds = inboundOrderDetails.Select(x => x.Id).ToList();
                 if (inboundOrderDetails.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()) == null && inboundOrder.Details.FirstOrDefault(x => !updateDetailIds.Contains(x.Id) && x.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()) == null)
                 {
-                    inboundOrder.OrderStatus = InboundStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+                    inboundOrder.OrderStatus = InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
                 }
-                else if (inboundOrder.OrderStatus == InboundStatusEmun.鏈紑濮�.ObjToInt())
+                else if (inboundOrder.OrderStatus == InboundStatusEnum.鏈紑濮�.ObjToInt())
                 {
-                    inboundOrder.OrderStatus = InboundStatusEmun.鍏ュ簱涓�.ObjToInt();
+                    inboundOrder.OrderStatus = InboundStatusEnum.鍏ュ簱涓�.ObjToInt();
                 }
 
                 content = MaterielGroupUpdateData(inboundOrder, inboundOrderDetails, stockInfo);
@@ -287,7 +193,7 @@
                 return (false, "鏃犲崟鎹槑缁嗕俊鎭�", materielGroupDTO);
             }
 
-            if (inboundOrder.OrderStatus != InboundStatusEmun.鏈紑濮�.ObjToInt() && inboundOrder.OrderStatus != InboundStatusEmun.鍏ュ簱涓�.ObjToInt())
+            if (inboundOrder.OrderStatus != InboundStatusEnum.鏈紑濮�.ObjToInt() && inboundOrder.OrderStatus != InboundStatusEnum.鍏ュ簱涓�.ObjToInt())
             {
                 return (false, "璇ュ崟鎹笉鍙啀缁勭洏", materielGroupDTO);
             }

--
Gitblit v1.9.3