From 2a978847c0dfef510349b097ef8202afe5647997 Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期四, 22 一月 2026 15:47:27 +0800
Subject: [PATCH] 1

---
 WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs |  235 +++++++++++++++++-----------------------------------------
 1 files changed, 70 insertions(+), 165 deletions(-)

diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
index 10355c2..ea0c35f 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
@@ -297,181 +297,90 @@
                 }
                 if (warehouse.WarehouseCode.Contains("CP"))
                 {
-                    Dt_NewOutboundOrder newOutboundOrder = BaseDal.Db.Queryable<Dt_NewOutboundOrder>().Where(x => x.UpperOrderNo == orderAddDTO.No).Includes(x => x.Details).First();
+
                     Dt_Production production1 = new Dt_Production();
-                    if (newOutboundOrder != null)
+                    OutboundOrderAddDTO orderAddDTO1 = new OutboundOrderAddDTO();
+                    orderAddDTO1.OrderNo = orderAddDTO.No;
+                    orderAddDTO1.UpperOrderNo = orderAddDTO.No;
+                    orderAddDTO1.OutWareHouse = orderAddDTO.OutWareHouse;
+                    orderAddDTO1.TransactionCode = orderAddDTO.TransactionCode ?? "宸ュ崟鍙戞枡";
+                    orderAddDTO1.InoutType = orderAddDTO.OrderType ?? InoutTypeEnum.WorkFeed.ToString();
+                    orderAddDTO1.OrderType = orderAddDTO.InoutType;
+                    orderAddDTO1.System = orderAddDTO.System;
+                    IEnumerable<int> inOrderTypes = Enum.GetValues<OrderTypeEmun>().Cast<int>();
+                    orderAddDTO1.Details = orderAddDTO.DetailList.DicToIEnumerable<OutboundOrderDetailAddDTO>();
+                    #region 楠岃瘉鏁版嵁
+                    (bool, string, object?) result = CheckOutboundOrderAddData(orderAddDTO1);
+                    if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2);
+                    #endregion
+                    Dt_NewOutboundOrder inboundOrder = _mapper.Map<Dt_NewOutboundOrder>(orderAddDTO1);
+                    inboundOrder.OrderStatus = InboundStatusEnum.鏈紑濮�.ObjToInt();
+                    inboundOrder.Creater = "WMS";
+                    inboundOrder.CreateDate = DateTime.Now;
+                    inboundOrder.CreateType = CreateType.UpperSystemPush.ObjToInt();
+                    _unitOfWorkManage.BeginTran();
+                    bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
+
+                    foreach (var item in orderAddDTO1.Details)
                     {
-                        if (newOutboundOrder.OutWareHouse != warehouse.WarehouseCode)
+                        if (string.IsNullOrWhiteSpace(item.Remark))
                         {
-                            return WebResponseContent.Instance.Error($"浠撳簱涓嶄竴鑷�");
+                            continue;
                         }
-                        else
+                        string[] remarkEntries = item.Remark.Split(
+                            new[] { ';' },
+                            StringSplitOptions.RemoveEmptyEntries
+                        );
+
+                        foreach (var entry in remarkEntries)
                         {
-                            OutboundOrderAddDTO orderAddDTO1 = new OutboundOrderAddDTO();
-                            orderAddDTO1.Details = orderAddDTO.DetailList.DicToIEnumerable<OutboundOrderDetailAddDTO>();
-                            var details = orderAddDTO1.Details.FirstOrDefault();
-                            Dt_NewOutboundOrderDetail outboundOrderDetail = new Dt_NewOutboundOrderDetail()
-                            {
-                                LPNNo = details.LPNNo,
-                                BatchNo = details.BatchNo,
-                                MaterielCode = details.MaterielCode,
-                                MaterielName = details.MaterielName,
-                                MaterieSpec = details.MaterieSpec,
-                                OrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(),
-                                OrderQuantity = details.OrderQuantity,
-                                LinId = details.LinId,
-                                OrderId = newOutboundOrder.Id,
-                                Creater = "WMS",
-                                CreateDate = DateTime.Now,
-                                Remark = details.Remark,
-                                SupplierBatch = details.SupplierBatch,
-                                OrinalLocation = details.OrinalLocation,
-                            };
-                            _newOutboundOrderDetailRepository.AddData(outboundOrderDetail);
-                            foreach (var item in orderAddDTO1.Details)
-                            {
-                                if (string.IsNullOrWhiteSpace(item.Remark))
-                                {
-                                    continue;
-                                }
-                                string[] remarkEntries = item.Remark.Split(
-                                    new[] { ';' },
-                                    StringSplitOptions.RemoveEmptyEntries
-                                );
-
-                                foreach (var entry in remarkEntries)
-                                {
-                                    string[] keyValuePairs = entry.Split(
-                                        new[] { ',' },
-                                        StringSplitOptions.RemoveEmptyEntries
-                                    );
-
-                                    foreach (var kvp in keyValuePairs)
-                                    {
-                                        int colonIndex = kvp.IndexOf(':');
-                                        if (colonIndex <= 0 || colonIndex >= kvp.Length - 1)
-                                        {
-                                            continue;
-                                        }
-
-                                        string key = kvp.Substring(0, colonIndex).Trim();
-                                        string value = kvp.Substring(colonIndex + 1).Trim();
-
-                                        switch (key)
-                                        {
-                                            case "鍒堕�犲崟鍙�":
-                                                production1.ProductionNo = value;
-                                                break;
-                                            case "鍒堕�犻儴浠�":
-                                                production1.ManufacturingCo = value;
-                                                break;
-                                            case "鍑哄簱鏁伴噺":
-                                                if (decimal.TryParse(value, out decimal outQuantity))
-                                                {
-                                                    production1.OutQuantity = outQuantity;
-                                                }
-                                                else
-                                                {
-                                                    Console.WriteLine($"鍑哄簱鏁伴噺鏍煎紡閿欒锛歿value}锛堝簲涓烘暟鍊硷紝濡�14.0000锛�");
-                                                }
-                                                break;
-                                            default:
-                                                Console.WriteLine($"鏈煡閿悕锛歿key}锛堝搴斿�硷細{value}锛岃烦杩囪閿�煎锛�");
-                                                break;
-                                        }
-
-                                    }
-                                    production1.Creater = "WMS";
-                                    production1.OrderId = outboundOrderDetail.Id;
-                                    _productionRepository.AddData(production1);
-                                }
-                            }
-                        }
-                    }
-                    else
-                    {
-                        OutboundOrderAddDTO orderAddDTO1 = new OutboundOrderAddDTO();
-                        orderAddDTO1.OrderNo = orderAddDTO.No;
-                        orderAddDTO1.UpperOrderNo = orderAddDTO.No;
-                        orderAddDTO1.OutWareHouse = orderAddDTO.OutWareHouse;
-                        orderAddDTO1.TransactionCode = orderAddDTO.TransactionCode ?? "宸ュ崟鍙戞枡";
-                        orderAddDTO1.InoutType = orderAddDTO.OrderType ?? InoutTypeEnum.WorkFeed.ToString();
-                        orderAddDTO1.OrderType = orderAddDTO.InoutType;
-                        orderAddDTO1.System = orderAddDTO.System;
-                        IEnumerable<int> inOrderTypes = Enum.GetValues<OrderTypeEmun>().Cast<int>();
-                        orderAddDTO1.Details = orderAddDTO.DetailList.DicToIEnumerable<OutboundOrderDetailAddDTO>();
-                        #region 楠岃瘉鏁版嵁
-                        (bool, string, object?) result = CheckOutboundOrderAddData(orderAddDTO1);
-                        if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2);
-                        #endregion
-                        Dt_NewOutboundOrder inboundOrder = _mapper.Map<Dt_NewOutboundOrder>(orderAddDTO1);
-                        inboundOrder.OrderStatus = InboundStatusEnum.鏈紑濮�.ObjToInt();
-                        inboundOrder.Creater = "WMS";
-                        inboundOrder.CreateDate = DateTime.Now;
-                        inboundOrder.CreateType = CreateType.UpperSystemPush.ObjToInt();
-                        _unitOfWorkManage.BeginTran();
-                        bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
-
-                        foreach (var item in orderAddDTO1.Details)
-                        {
-                            if (string.IsNullOrWhiteSpace(item.Remark))
-                            {
-                                continue;
-                            }
-                            string[] remarkEntries = item.Remark.Split(
-                                new[] { ';' },
+                            string[] keyValuePairs = entry.Split(
+                                new[] { ',' },
                                 StringSplitOptions.RemoveEmptyEntries
                             );
 
-                            foreach (var entry in remarkEntries)
+                            foreach (var kvp in keyValuePairs)
                             {
-                                string[] keyValuePairs = entry.Split(
-                                    new[] { ',' },
-                                    StringSplitOptions.RemoveEmptyEntries
-                                );
-
-                                foreach (var kvp in keyValuePairs)
+                                int colonIndex = kvp.IndexOf(':');
+                                if (colonIndex <= 0 || colonIndex >= kvp.Length - 1)
                                 {
-                                    int colonIndex = kvp.IndexOf(':');
-                                    if (colonIndex <= 0 || colonIndex >= kvp.Length - 1)
-                                    {
-                                        continue;
-                                    }
-
-                                    string key = kvp.Substring(0, colonIndex).Trim();
-                                    string value = kvp.Substring(colonIndex + 1).Trim();
-
-                                    switch (key)
-                                    {
-                                        case "鍒堕�犲崟鍙�":
-                                            production1.ProductionNo = value;
-                                            break;
-                                        case "鍒堕�犻儴浠�":
-                                            production1.ManufacturingCo = value;
-                                            break;
-                                        case "鍑哄簱鏁伴噺":
-                                            if (decimal.TryParse(value, out decimal outQuantity))
-                                            {
-                                                production1.OutQuantity = outQuantity;
-                                            }
-                                            else
-                                            {
-                                                Console.WriteLine($"鍑哄簱鏁伴噺鏍煎紡閿欒锛歿value}锛堝簲涓烘暟鍊硷紝濡�14.0000锛�");
-                                            }
-                                            break;
-                                        default:
-                                            Console.WriteLine($"鏈煡閿悕锛歿key}锛堝搴斿�硷細{value}锛岃烦杩囪閿�煎锛�");
-                                            break;
-                                    }
-
+                                    continue;
                                 }
-                                production1.Creater = "WMS";
-                                production1.OrderId = inboundOrder.Details.FirstOrDefault().Id;
-                                _productionRepository.AddData(production1);
+
+                                string key = kvp.Substring(0, colonIndex).Trim();
+                                string value = kvp.Substring(colonIndex + 1).Trim();
+
+                                switch (key)
+                                {
+                                    case "鍒堕�犲崟鍙�":
+                                        production1.ProductionNo = value;
+                                        break;
+                                    case "鍒堕�犻儴浠�":
+                                        production1.ManufacturingCo = value;
+                                        break;
+                                    case "鍑哄簱鏁伴噺":
+                                        if (decimal.TryParse(value, out decimal outQuantity))
+                                        {
+                                            production1.OutQuantity = outQuantity;
+                                        }
+                                        else
+                                        {
+                                            Console.WriteLine($"鍑哄簱鏁伴噺鏍煎紡閿欒锛歿value}锛堝簲涓烘暟鍊硷紝濡�14.0000锛�");
+                                        }
+                                        break;
+                                    default:
+                                        Console.WriteLine($"鏈煡閿悕锛歿key}锛堝搴斿�硷細{value}锛岃烦杩囪閿�煎锛�");
+                                        break;
+                                }
+
                             }
+                            production1.Creater = "WMS";
+                            production1.OrderId = inboundOrder.Details.FirstOrDefault().Id;
+                            _productionRepository.AddData(production1);
                         }
-                        _unitOfWorkManage.CommitTran();
                     }
+                    _unitOfWorkManage.CommitTran();
+
                 }
                 else
                 {
@@ -1175,10 +1084,6 @@
                     if (item.Details.Count <= 0)
                     {
                         return content.Error($"鏈壘鍒皗item.PalletCode}搴撳瓨鏄庣粏鏁版嵁");
-                    }
-                    if (item.System.Contains("SMOM"))
-                    {
-                        return content.Error($"SMOM绯荤粺搴撳瓨鏁版嵁涓嶅彲鎵嬪姩鐩樼偣锛屾墭鐩樺彿{item.PalletCode}");
                     }
                     Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == item.LocationCode);
                     if (locationInfo != null && (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || locationInfo.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && item.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt())

--
Gitblit v1.9.3