From e83c793bebdb1b9ecdcd79fab8d83fd167baa817 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期一, 19 一月 2026 15:51:56 +0800
Subject: [PATCH] 盘点流程

---
 WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/495dcb7d-0808-4295-8344-22604b0512d1.vsidx |    0 
 WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs                        |    2 
 WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_FL.cs             |    4 
 WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/CodeChunks.db                |    0 
 WMS/WIDESEA_WMSServer/.vs/ProjectEvaluation/widesea_wmsserver.strings.v9.bin                            |    0 
 WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_PrintSetting.cs                                     |   54 ++++
 WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/PalletTypeInfoService.cs                                |   75 +++++
 WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs                     |   33 ++
 WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs                                            |  354 +++++++++++++++++++++++++-
 WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs                                |   46 ---
 WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json                                                |   82 +++---
 WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/8243996f-363c-4613-87cd-1d30cb87c16e.vsidx |    0 
 /dev/null                                                                                               |    0 
 WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IPalletTypeInfoService.cs                                   |    4 
 WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs                                   |    1 
 WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs                                  |  107 ++++++++
 WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/46068755-0c27-498e-b4ef-d2ee7f39e8af.vsidx |    0 
 WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs                   |    6 
 WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b8266b88-93a1-4523-87b3-6859ba57591b.vsidx |    0 
 WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs                                        |    3 
 WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/475e0097-8d79-4ade-8115-2df3f6920ebc.vsidx |    0 
 WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/SemanticSymbols.db           |    0 
 22 files changed, 660 insertions(+), 111 deletions(-)

diff --git a/WMS/WIDESEA_WMSServer/.vs/ProjectEvaluation/widesea_wmsserver.strings.v9.bin b/WMS/WIDESEA_WMSServer/.vs/ProjectEvaluation/widesea_wmsserver.strings.v9.bin
index 25591d5..2c80a91 100644
--- a/WMS/WIDESEA_WMSServer/.vs/ProjectEvaluation/widesea_wmsserver.strings.v9.bin
+++ b/WMS/WIDESEA_WMSServer/.vs/ProjectEvaluation/widesea_wmsserver.strings.v9.bin
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/CodeChunks.db b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/CodeChunks.db
new file mode 100644
index 0000000..123dd67
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/CodeChunks.db
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/SemanticSymbols.db b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/SemanticSymbols.db
new file mode 100644
index 0000000..5b77860
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/SemanticSymbols.db
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/46068755-0c27-498e-b4ef-d2ee7f39e8af.vsidx b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/46068755-0c27-498e-b4ef-d2ee7f39e8af.vsidx
new file mode 100644
index 0000000..130a85d
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/46068755-0c27-498e-b4ef-d2ee7f39e8af.vsidx
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/475e0097-8d79-4ade-8115-2df3f6920ebc.vsidx b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/475e0097-8d79-4ade-8115-2df3f6920ebc.vsidx
new file mode 100644
index 0000000..c0ed198
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/475e0097-8d79-4ade-8115-2df3f6920ebc.vsidx
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/495dcb7d-0808-4295-8344-22604b0512d1.vsidx b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/495dcb7d-0808-4295-8344-22604b0512d1.vsidx
new file mode 100644
index 0000000..eea8ec1
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/495dcb7d-0808-4295-8344-22604b0512d1.vsidx
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/8243996f-363c-4613-87cd-1d30cb87c16e.vsidx b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/8243996f-363c-4613-87cd-1d30cb87c16e.vsidx
new file mode 100644
index 0000000..b765096
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/8243996f-363c-4613-87cd-1d30cb87c16e.vsidx
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b8266b88-93a1-4523-87b3-6859ba57591b.vsidx b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b8266b88-93a1-4523-87b3-6859ba57591b.vsidx
new file mode 100644
index 0000000..50e55a2
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b8266b88-93a1-4523-87b3-6859ba57591b.vsidx
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/c62f823c-87b1-4254-8b92-340321c32c9b.vsidx b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/c62f823c-87b1-4254-8b92-340321c32c9b.vsidx
deleted file mode 100644
index 6f7ceb5..0000000
--- a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/c62f823c-87b1-4254-8b92-340321c32c9b.vsidx
+++ /dev/null
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/PalletTypeInfoService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/PalletTypeInfoService.cs
index 0a5bb15..52f4b6f 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/PalletTypeInfoService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/PalletTypeInfoService.cs
@@ -1,9 +1,13 @@
-锘縰sing System;
+锘縰sing Newtonsoft.Json;
+using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Net.Http;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Core;
 using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Const;
 using WIDESEA_IBasicRepository;
 using WIDESEA_IBasicService;
 using WIDESEA_Model.Models;
@@ -15,5 +19,74 @@
         public PalletTypeInfoService(IPalletTypeInfoRepository BaseDal) : base(BaseDal)
         {
         }
+
+        /// <summary>
+        /// 鎵撳嵃鎵樼洏鐮�
+        /// </summary>
+        /// <param name="num"></param>
+        /// <returns></returns>
+        public WebResponseContent PrintPalletCode(int num, string palletCodeType)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                List<string> PalletCodes = new List<string>();
+                for (int i = 0; i < num; i++)
+                {
+                    //PalletCodes.Add(GetOrderPintCode("PalletCodes"),palletCodeType);
+                }
+                content= PrintPallet(PalletCodes);
+                return content.OK();
+            }
+            catch (Exception ex)
+            {
+                return content.Error("鏈煡閿欒锛岃鑱旂郴绠$悊鍛�");
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇璁㈠崟缂栧彿
+        /// </summary>
+        /// <param name="printCode"></param>
+        /// <returns></returns>
+        public string GetOrderPintCode(string printCode,string palletCodeType)
+        {
+            string PrintCode = "";
+            //var PrintSetting = SqlSugarHelper.DbWMS.Queryable<Dt_PrintSetting>().Where(x => x.PrintCode == printCode).ToList().FirstOrDefault();
+
+            //if (PrintSetting.Spare1 == DateTime.Now.ToString("yyyyMMdd"))
+            //{
+            //    PrintCode = PrintSetting.Spare1 + PrintSetting.PrintNo.ToString().PadLeft(PrintSetting.Spare2, '0');
+            //    PrintSetting.PrintNo = PrintSetting.PrintNo + 1;
+            //}
+            //else
+            //{
+            //    PrintSetting.Spare1 = DateTime.Now.ToString("yyyyMMdd");
+            //    PrintSetting.PrintNo = 2;
+            //    PrintCode = PrintSetting.Spare1 + 1.ToString().PadLeft(PrintSetting.Spare2, '0');
+            //}
+            //SqlSugarHelper.DbWMS.Updateable(PrintSetting).ExecuteCommand();
+            return PrintCode;
+        }
+
+        /// <summary>
+        /// 璋冪敤鎵撳嵃鎵樼洏鐮佹帴鍙�
+        /// </summary>
+        /// <param name="palletCodes"></param>
+        /// <returns></returns>
+        /// <exception cref="InvalidOperationException"></exception>
+        public WebResponseContent PrintPallet(List<string> palletCodes)
+        {
+            var Base = "";
+            var ipAddress = "";
+            if (Base == null || ipAddress == null)
+            {
+                throw new InvalidOperationException("WMS IP 鏈厤缃�");
+            }
+            var IpAddress = Base + ipAddress;
+            //var result = HttpsClient.PostAsync(palletCodes.ToJsonString()).Result; 
+            //return JsonConvert.DeserializeObject<WebResponseContent>();
+            return WebResponseContent.Instance.OK();
+        }
     }
 }
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_FL.cs b/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_FL.cs
index 6f3578c..59fa7bf 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_FL.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_FL.cs
@@ -90,7 +90,7 @@
 
                 if (palletTypeInfo.LocaitonCount == 2)
                 {
-                    if (roadwayNo != "SC01_FL")
+                    if (roadwayNo != "SC01_DW")
                         definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Column % 2 == 1).ToList();
                     else
                         definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Column % 2 == 0).ToList();
@@ -122,7 +122,7 @@
                 {
                     if (palletTypeInfo.LocaitonCount == 2)
                     {
-                        if (roadwayNo != "SC01_FL")
+                        if (roadwayNo != "SC01_DW")
                             undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 1).ToList();
                         else
                             undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Column % 2 == 0).ToList();
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs b/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs
index 6379ac6..92009dd 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs
@@ -52,7 +52,7 @@
                 "SC01_CP" => AssignLocation_CP(roadwayNo, palletType, palletTypeInfo, beRelocationCode, heightType),
                 "SC02_CP" => AssignLocation_CP(roadwayNo, palletType, palletTypeInfo, beRelocationCode, heightType),
                 "SC01_YS" => AssignLocation_YS(roadwayNo, palletType, palletTypeInfo, beRelocationCode, heightType),
-                "SC01_FL" => AssignLocation_FL(roadwayNo, palletType, palletTypeInfo, beRelocationCode, heightType),
+                "SC01_DW" => AssignLocation_FL(roadwayNo, palletType, palletTypeInfo, beRelocationCode, heightType),
                 //"HA58" => AssignLocation_PP(roadwayNo, palletType, palletTypeInfo, beRelocationCode),
                 //"HA152" => AssignLocation_GM(roadwayNo, palletType, palletTypeInfo, beRelocationCode),
                 //"HA64" => AssignLocation_CSJ(roadwayNo, palletType, palletTypeInfo, beRelocationCode),
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IPalletTypeInfoService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IPalletTypeInfoService.cs
index a743ab1..357bd6a 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IPalletTypeInfoService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/IPalletTypeInfoService.cs
@@ -3,6 +3,7 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Core;
 using WIDESEA_Core.BaseServices;
 using WIDESEA_Model.Models;
 
@@ -10,5 +11,8 @@
 {
     public interface IPalletTypeInfoService : IService<Dt_PalletTypeInfo>
     {
+        WebResponseContent PrintPalletCode(int num, string palletCodeType);
+
+        string GetOrderPintCode(string printCode,string palletCodeType);
     }
 }
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs
index 86065c1..4040a24 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs
@@ -21,6 +21,7 @@
 
         //WebResponseContent MaterielGroup(MaterielGroupDTO materielGroupDTO);
         WebResponseContent MaterielGroup(SaveModel saveModel);
+         WebResponseContent NewMaterielGroup(SaveModel saveModel);
 
         WebResponseContent CPMaterielGroup(SaveModel saveModel);
 
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs
index 69a9a40..3ca9c01 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs
@@ -31,5 +31,8 @@
         List<StockSelectViewDTO> GetStockSelectViews(string materielCode);
 
         List<Dt_StockInfo> GetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, decimal needQuantity, out decimal residueQuantity);
+
+        public List<Dt_StockInfo> DWANDYSGetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, string batchNo, decimal needQuantity, out decimal residueQuantity);
+
     }
 }
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
index 50a36ba..cf22938 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
@@ -349,7 +349,7 @@
         }
 
         //鑽按锛屼綆娓╀粨缁勭洏
-        public WebResponseContent NEWMaterielGroup(SaveModel saveModel)
+        public WebResponseContent NewMaterielGroup(SaveModel saveModel)
         {
             WebResponseContent content = new WebResponseContent();
             try
@@ -443,7 +443,7 @@
                 {
                     stockInfo = new Dt_StockInfo()
                     {
-                        BatchNo = "",
+                        BatchNo ="",
                         PalletCode = palletCode,
                         PalletType = GetPalletType(warehouse, palletCode),//GetPalletType(warehouse, palletCode)
                         IsFull = true,
@@ -461,43 +461,8 @@
                 }
                 else
                 {
-                    //if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt())
-                    //{
                     return WebResponseContent.Instance.Error($"鎵樼洏鍙烽噸澶�,璇ユ墭鐩樺凡缁勮繃鐗╂枡");
-                    //}
-                    //beforeQuantity = stockInfo.Details.Sum(x => x.StockQuantity);
                 }
-
-                if (warehouse.WarehouseCode == WarehouseEnum.SC01_BC.ToString())
-                {
-                    stockInfo.Remark = Initiallife.ToString();
-                    string batchNo = models.FirstOrDefault()?.LotNo ?? "";
-                    //Dt_StockInfoDetail existDetail = _stockRepository.StockInfoDetailRepository.QueryFirst(x => x.BatchNo == batchNo);
-                    //if (existDetail != null)
-                    //{
-                    //    return WebResponseContent.Instance.Error($"{batchNo}娴嬭瘯鏋跺凡瀛樺湪");
-                    //}
-                    if (models.Count >= 2)
-                    {
-                        return WebResponseContent.Instance.Error($"缁勭洏鏄庣粏涓嶅敮涓�");
-                    }
-                    //if (palletCode.Substring(0, 1) == "6")
-                    //{
-                    //    stockInfo.PalletType = PalletTypeEnum.MediumPallet.ObjToInt();
-                    //}
-                    //else
-                    //{
-                    //    stockInfo.PalletType = PalletTypeEnum.LargestPallet.ObjToInt();
-                    //}
-                }
-                else if (warehouse.WarehouseCode == WarehouseEnum.SC01_BC.ToString())
-                {
-                    if (models.Count >= 2)
-                    {
-                        return WebResponseContent.Instance.Error($"缁勭洏鏄庣粏涓嶅敮涓�");
-                    }
-                }
-
                 List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>();
                 foreach (var model in models)
                 {
@@ -517,7 +482,7 @@
                         OrderNo = inboundOrder.OrderNo,
                         BatchNo = notGroupDetail.BatchNo,
                         LinId = notGroupDetail.LinId,
-                        StockQuantity = (quantitys.FirstOrDefault()),
+                        StockQuantity = model.Quantity,
                         Status = (int)StockStatusEmun.缁勭洏鏆傚瓨,
                         Creater = "WMS",
                         CreateDate = DateTime.Now,
@@ -537,9 +502,9 @@
                     stockInfoDetails.Add(stockInfoDetail);
 
                     decimal decimalReceiptQuantity = Convert.ToDecimal(notGroupDetail.ReceiptQuantity);
-                    decimal decimalModelQuantity = Convert.ToDecimal((quantitys.FirstOrDefault()));
+                    decimal decimalModelQuantity = Convert.ToDecimal(notGroupDetail.OrderQuantity);
                     decimal decimalOrderQuantity = Convert.ToDecimal(notGroupDetail.OrderQuantity);
-                    decimalReceiptQuantity += decimalModelQuantity;
+                    decimalReceiptQuantity += model.Quantity;
                     // 妫�鏌ユ槸鍚﹁秴鍑鸿鍗曟暟閲�
                     if (decimalReceiptQuantity > decimalOrderQuantity)
                     {
@@ -1311,6 +1276,7 @@
                             if (inboundOrderDetailOld != null)
                             {
                                 inboundOrderDetailOld.OrderQuantity += item.OrderQuantity;
+                                inboundOrderDetailOld.OrderDetailStatus = OrderDetailStatusEnum.Inbounding.ObjToInt();
                                 _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetailOld);
                             }
                             else
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_PrintSetting.cs b/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_PrintSetting.cs
new file mode 100644
index 0000000..630fdc9
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_PrintSetting.cs
@@ -0,0 +1,54 @@
+锘縰sing SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core.DB.Models;
+
+namespace WIDESEA_Model.Models
+{
+    /// <summary>
+    /// 鎵撳嵃閰嶇疆
+    ///</summary>
+    [SugarTable("Dt_PrintSetting")]
+    public class Dt_PrintSetting : BaseEntity
+    {
+        /// <summary>
+        /// 澶�  娉�:鍖哄煙ID
+        /// 榛樿鍊�:
+        ///</summary>
+        [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 澶�  娉�:鎵撳嵃缂栫爜
+        /// 榛樿鍊�:
+        ///</summary>
+        [SugarColumn(ColumnName = "PrintCode")]
+        public string PrintCode { get; set; }
+
+        /// <summary>
+        /// 澶�  娉�:鎵撳嵃鏁伴噺
+        /// 榛樿鍊�:
+        ///</summary>
+        [SugarColumn(ColumnName = "PrintNo")]
+        public int PrintNo { get; set; }
+
+        /// <summary>
+        /// 澶�  娉�:澶囩敤
+        /// 榛樿鍊�:
+        ///</summary>
+        [SugarColumn(ColumnName = "Spare1")]
+        public string? Spare1 { get; set; }
+
+        /// <summary>
+        /// 澶�  娉�:澶囩敤
+        /// 榛樿鍊�:
+        ///</summary>
+        [SugarColumn(ColumnName = "Spare2")]
+        public int Spare2 { get; set; }
+
+
+    }
+}
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
index a60e0fb..493c5f0 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
@@ -355,11 +355,21 @@
                 {
                     throw new Exception($"鏈壘鍒板彲鍒嗛厤搴撳瓨");
                 }
-                List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, item.MaterielCode, needQuantity, out decimal residueQuantity);
-
-                item.LockQuantity += needQuantity - residueQuantity;
+                List<Dt_StockInfo> autoAssignStocks = new List<Dt_StockInfo>();
+                decimal newResidueQuantity = 0; 
+                if (warehouse.Any(x => x.WarehouseCode.Contains("DW")) || warehouse.Any(x => x.WarehouseCode.Contains("YS")))
+                {
+                    autoAssignStocks = _stockService.StockInfoService.DWANDYSGetOutboundStocks(stockInfos, item.MaterielCode, item.BatchNo, needQuantity,out decimal residueQuantity);
+                    newResidueQuantity = residueQuantity;   
+                }
+                else
+                {
+                    autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, item.MaterielCode, needQuantity, out decimal residueQuantity);
+                    newResidueQuantity = residueQuantity;
+                }
+                item.LockQuantity += needQuantity - newResidueQuantity;
                 outStocks.AddRange(autoAssignStocks);
-                decimal assignQuantity = needQuantity - residueQuantity;
+                decimal assignQuantity = needQuantity - newResidueQuantity;
 
                 List<Dt_OutboundOrderDetail> details = outboundOrderDetails.Where(x => !string.IsNullOrEmpty(x.BatchNo) ? x.BatchNo == item.BatchNo : true && x.MaterielCode == item.MaterielCode).ToList();
 
@@ -375,7 +385,17 @@
                         {
                             palletAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == item.MaterielCode && x.PalletCode == autoAssignStocks[j].PalletCode).Sum(x => x.AssignQuantity);//鍑哄簱璇︽儏宸插垎閰嶆暟閲�
                         }
-                        decimal palletOutboundQuantity = autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity);
+                        decimal palletOutboundQuantity = 0;
+                        if (warehouse.Any(x => x.WarehouseCode.Contains("DW")) || warehouse.Any(x => x.WarehouseCode.Contains("YS")))
+                        {
+                            palletOutboundQuantity = autoAssignStocks[j].Details.Where(x => x.BatchNo == item.BatchNo).Sum(x => x.OutboundQuantity);
+
+                        }
+                        else
+                        {
+                             palletOutboundQuantity = autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity);
+
+                        }
                         if (palletAssignQuantity < palletOutboundQuantity)//濡傛灉鍑哄簱璇︽儏宸插垎閰嶆暟閲忓皬浜庢墭鐩樺凡鍒嗛厤鏁伴噺锛屽垯鍙互缁х画娣诲姞璇ユ墭鐩樺嚭搴撲俊鎭�
                         {
                             decimal orderDetailNeedQuantity = details[i].OrderQuantity - detailAssignQuantity;
@@ -506,7 +526,8 @@
                     using (client = new HttpClient())
                     {
                         // 2. 鍙戦�佽姹�
-                        var response = HttpHelper.Post<WebResponseContent>(ToCancelOutFeedbackERP, postContent, "鍑哄簱鏄庣粏鍙栨秷鍥炰紶ERP");
+                        string url = $"{ToCancelOutFeedbackERP}?ids={Uri.EscapeDataString(ids)}";
+                        var response = HttpHelper.Post<WebResponseContent>(url, "鍑哄簱鏄庣粏鍙栨秷鍥炰紶ERP");
 
                         if (response.Code !=0)
                         {
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs
index 029a2cd..8f4388d 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs
@@ -1,6 +1,7 @@
 锘縰sing AutoMapper;
 using Magicodes.ExporterAndImporter.Core;
 using Magicodes.ExporterAndImporter.Excel;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
 using SqlSugar;
 using System;
@@ -192,6 +193,112 @@
             return outStocks;
         }
 
+        //浣庢俯銆佽嵂姘村垎閰嶅簱瀛�
+        public List<Dt_StockInfo> DWANDYSGetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode,string batchNo ,decimal needQuantity, out decimal residueQuantity)
+        {
+            List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>();
+            decimal stockTotalQuantity = stockInfos.SelectMany(x => x.Details).Where(d => d.BatchNo == batchNo).Sum(v => v.StockQuantity - v.OutboundQuantity);
+            stockInfos = stockInfos.Where(x => x.Details.Any(x => x.BatchNo == batchNo)).OrderBy(x => x.Id).ToList();
+            if (stockTotalQuantity >= needQuantity)//搴撳瓨澶�
+            {
+                int index = 0;
+                while (needQuantity > 0)
+                {
+
+                    Dt_StockInfo stockInfo = stockInfos[index];
+                    Dt_StockInfoDetail dt_StockInfoDetail = new Dt_StockInfoDetail();
+                    foreach(var detail in stockInfo.Details)
+                    {
+                        if(detail.BatchNo == batchNo && detail.MaterielCode == materielCode)
+                        {
+                            dt_StockInfoDetail = detail;
+                        }
+                    }
+                    decimal useableStockQuantity = dt_StockInfoDetail.StockQuantity - dt_StockInfoDetail.OutboundQuantity;
+                    if (useableStockQuantity < needQuantity)
+                    {
+                        stockInfo.Details.ForEach(x =>
+                        {
+                            if(x.MaterielCode == materielCode && x.BatchNo == batchNo)
+                            {
+                                x.OutboundQuantity = x.StockQuantity;
+                            }
+                        });
+                        needQuantity -= useableStockQuantity;
+                    }
+                    else
+                    {
+
+                        stockInfo.Details.ForEach(x =>
+                        {
+                            if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == materielCode && x.BatchNo == batchNo)
+                            {
+                                if (x.StockQuantity - x.OutboundQuantity >= needQuantity)
+                                {
+                                    x.OutboundQuantity += needQuantity;
+                                    needQuantity = 0;
+                                }
+                                else
+                                {
+                                    needQuantity -= (x.StockQuantity - x.OutboundQuantity);
+                                    x.OutboundQuantity = x.StockQuantity;
+                                }
+                            }
+                        });
+                    }
+                    outStocks.Add(stockInfo);
+                    index++;
+                }
+            }
+            else
+            {
+                for (int i = 0; i < stockInfos.Count; i++)
+                {
+                    Dt_StockInfo stockInfo = stockInfos[i];
+                    decimal useableStockQuantity = 0;
+                    foreach (var detail in stockInfo.Details)
+                    {
+                        if(detail.MaterielCode == materielCode && detail.BatchNo == batchNo)
+                        {
+                            useableStockQuantity = detail.StockQuantity - detail.OutboundQuantity;
+                        }
+                    }
+                    
+                    if (useableStockQuantity < needQuantity)
+                    {
+                        stockInfo.Details.ForEach(x => { 
+                            if(x.MaterielCode == materielCode && x.BatchNo == batchNo)
+                            {
+                                x.OutboundQuantity = x.StockQuantity;
+                            }
+                        });
+                        needQuantity -= useableStockQuantity;
+                    }
+                    else
+                    {
+                        stockInfo.Details.ForEach(x =>
+                        {
+                            if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == materielCode && x.BatchNo == batchNo)
+                            {
+                                if (x.StockQuantity - x.OutboundQuantity >= needQuantity)
+                                {
+                                    x.OutboundQuantity += needQuantity;
+                                    needQuantity = 0;
+                                }
+                                else
+                                {
+                                    needQuantity -= (x.StockQuantity - x.OutboundQuantity);
+                                    x.OutboundQuantity = x.StockQuantity;
+                                }
+                            }
+                        });
+                    }
+                    outStocks.Add(stockInfo);
+                }
+            }
+            residueQuantity = needQuantity;
+            return outStocks;
+        }
         //瀵煎嚭
         public override WebResponseContent Export(PageDataOptions options)
         {
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index 405b670..d63db3f 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -889,6 +889,158 @@
                             }
                         }
                     }
+                    else if (warehouse.WarehouseCode.Contains("DW") || warehouse.WarehouseCode.Contains("YS"))
+                    {
+                        Dt_InboundOrder? inboundOrder = _inboundService.InbounOrderService.Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderNo == dt_StockInfo.Details.FirstOrDefault().OrderNo).Includes(x => x.Details).First();
+                        //Dt_InboundOrderDetail? inboundOrderDetail = null;
+                        //鍑哄簱鍏ュ簱閫昏緫
+                        if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt())
+                        {
+                            int lastStatus = dt_LocationInfo.LocationStatus;
+                            dt_LocationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+                            // 鏍规嵁鎵樼洏鏄庣粏鑾峰彇瀵瑰簲鐨勫叆搴撳崟鏄庣粏
+                            List<Dt_InboundOrderDetail> inboundOrderDetails = new List<Dt_InboundOrderDetail>();
+
+                            // 澶勭悊澶氫釜搴撳瓨鏄庣粏鐨勬儏鍐�
+                            foreach (var stockDetail in dt_StockInfo.Details)
+                            {
+                                if (!string.IsNullOrEmpty(stockDetail.OrderNo))
+                                {
+                                    var detail = inboundOrder.Details.FirstOrDefault(x => x.LinId == stockDetail.LinId && x.BatchNo == stockDetail.BatchNo);
+
+                                    if (detail != null && !inboundOrderDetails.Any(x => x.Id == detail.Id))
+                                    {
+                                        inboundOrderDetails.Add(detail);
+                                    }
+                                }
+                            }
+                            if (!inboundOrderDetails.Any())
+                            {
+                                return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑鍏ュ簱鍗曟槑缁�");
+                            }
+                            // 鏇存柊鍏ュ簱鍗曟槑缁嗙姸鎬�
+                            foreach (var inboundOrderDetail in inboundOrderDetails)
+                            {
+                                // 妫�鏌ヨ鏄庣粏鏄惁宸插叏閮ㄥ叆搴�
+                                decimal totalStockQuantity = dt_StockInfo.Details
+                                    .Where(x => x.LinId == inboundOrderDetail.LinId && x.BatchNo == inboundOrderDetail.BatchNo)
+                                    .Sum(x => x.StockQuantity);
+
+                                decimal orderQuantity = Convert.ToDecimal(inboundOrderDetail.OrderQuantity);
+                                decimal receiptQuantity = Convert.ToDecimal(inboundOrderDetail.ReceiptQuantity);
+                                decimal overInQuantity = Convert.ToDecimal(inboundOrderDetail.OverInQuantity);
+
+                                // 鏇存柊鏀惰揣鏁伴噺
+                                inboundOrderDetail.OverInQuantity = totalStockQuantity += overInQuantity;
+
+                                // 妫�鏌ユ槸鍚﹀叏閮ㄥ畬鎴�
+                                if (inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity)
+                                {
+                                    inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
+                                }
+                                else
+                                {
+                                    inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Inbounding.ObjToInt();
+                                }
+                            }
+                            ///鏇存柊搴撳瓨鐘舵��
+                            dt_StockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+                            // 鏇存柊搴撳瓨鏄庣粏鐘舵��
+                            dt_StockInfo.Details.ForEach(x => x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt());
+                            try
+                            {
+                                _unitOfWorkManage.BeginTran();
+
+                                // 鏇存柊浠诲姟鐘舵��
+                                UpdateTaskStatus(task);
+
+                                // 鏇存柊璐т綅鐘舵��
+                                UpdateLocationStatus(dt_LocationInfo, lastStatus);
+
+                                // 鏇存柊搴撳瓨淇℃伅
+                                UpdateStockInfo(dt_StockInfo);
+
+                                // 娣诲姞璁板綍
+                                AddRecords(task, dt_StockInfo, dt_LocationInfo, lastStatus);
+
+                                // 鏇存柊鍏ュ簱鍗曟槑缁�
+                                if (inboundOrderDetails.Any())
+                                {
+                                    BaseDal.Db.Updateable(inboundOrderDetails).ExecuteCommand();
+
+                                    // 妫�鏌ュ叆搴撳崟鏄惁鍏ㄩ儴瀹屾垚
+                                    bool allCompleted = inboundOrder.Details.All(x =>
+                                        x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt());
+
+                                    if (allCompleted)
+                                    {
+                                        inboundOrder.OrderStatus = InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
+                                    }
+                                    else
+                                    {
+                                        inboundOrder.OrderStatus = InboundStatusEnum.鍏ュ簱涓�.ObjToInt();
+                                    }
+                                }
+
+                                // 鏇存柊鍏ュ簱鍗�
+                                UpdateInboundOrder(inboundOrder, inboundOrderDetails.FirstOrDefault());
+
+                                // 鍗曟嵁鏁伴噺鍏ㄩ儴涓婃灦瀹屾垚锛屽鐞哤MS鍥炰紶
+                                if (inboundOrderDetails.Any(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()) && inboundOrder.System.Equals("ERP"))
+                                {
+                                    if(inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt())
+                                    {
+                                        bool allCompleted = inboundOrder.Details.All(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt());
+                                        if (allCompleted)
+                                        {
+                                            foreach (var detail in inboundOrder.Details)
+                                            {
+                                                FeedBackInboundERP(inboundOrder.UpperOrderNo, detail.LinId);
+                                            }
+                                        }
+                                    }
+                                }
+                                if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 0 && inboundOrder.System.Equals("SMOM"))
+                                {
+
+                                }
+                                else if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 2 && inboundOrder.System.Equals("SMOM"))
+                                {
+                                    SendAllocateInfoToWMS(task, inboundOrder, dt_StockInfo);
+                                }
+
+                                _unitOfWorkManage.CommitTran();
+                                return WebResponseContent.Instance.OK();
+                            }
+                            catch (Exception ex)
+                            {
+                                _unitOfWorkManage.RollbackTran();
+                                throw new Exception($"鍏ュ簱澶勭悊澶辫触锛歿ex.Message}", ex);
+                            }
+
+                        }
+                        if (task.TaskType == TaskTypeEnum.SurplusReturn.ObjToInt() || task.TaskType == TaskTypeEnum.ReverseIn.ObjToInt())
+                        {
+                            return ReturnInbound(task, dt_StockInfo, dt_LocationInfo);
+                        }
+                        if (task.TaskType == TaskTypeEnum.InInventory.ObjToInt())
+                        {
+                            int lastStatus = dt_LocationInfo.LocationStatus;
+                            dt_LocationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+                            dt_StockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+                            // 鏇存柊搴撳瓨鏄庣粏鐘舵��
+                            dt_StockInfo.Details.ForEach(x => x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt());
+                            _unitOfWorkManage.BeginTran();
+                            UpdateTaskStatus(task);
+                            UpdateLocationStatus(dt_LocationInfo, lastStatus);
+                            UpdateStockInfo(dt_StockInfo);
+                            AddRecords(task, dt_StockInfo, dt_LocationInfo, lastStatus);
+                            _unitOfWorkManage.CommitTran();
+                            return WebResponseContent.Instance.OK();
+
+                        }
+
+                    }
                     else
                     {
                         Dt_InboundOrder? inboundOrder = _inboundService.InbounOrderService.Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderNo == dt_StockInfo.Details.FirstOrDefault().OrderNo).Includes(x => x.Details).First();
@@ -987,7 +1139,7 @@
             int lastStatus, Dt_InboundOrder inboundOrder, Dt_InboundOrderDetail inboundOrderDetail)
         {
             // 鏇存柊鍏ュ簱鍗曟槑缁嗙姸鎬�
-            UpdateInboundOrderDetails(stockInfo, inboundOrder, ref inboundOrderDetail);
+               UpdateInboundOrderDetails(stockInfo, inboundOrder, ref inboundOrderDetail);
             ///鏇存柊搴撳瓨鐘舵��
             stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
             // 鏇存柊搴撳瓨鏄庣粏鐘舵��
@@ -1010,21 +1162,21 @@
                 AddRecords(task, stockInfo, locationInfo, lastStatus);
 
                 // 鏇存柊鍏ュ簱鍗�
-                UpdateInboundOrder(inboundOrder, inboundOrderDetail);
+                    UpdateInboundOrder(inboundOrder, inboundOrderDetail);
 
-                // 鍗曟嵁鏁伴噺鍏ㄩ儴涓婃灦瀹屾垚锛屽鐞哤MS鍥炰紶
-                if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt() && inboundOrder.System.Equals("ERP"))
-                {
-                    FeedBackInboundERP(inboundOrder.UpperOrderNo, inboundOrderDetail.LinId);
+                    // 鍗曟嵁鏁伴噺鍏ㄩ儴涓婃灦瀹屾垚锛屽鐞哤MS鍥炰紶
+                    if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt() && inboundOrder.System.Equals("ERP"))
+                    {
+                            FeedBackInboundERP(inboundOrder.UpperOrderNo, inboundOrderDetail.LinId);
+                        }
+                    if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 0 && inboundOrder.System.Equals("SMOM"))
+                    {
+                        //SendInboundInfoToWMS(task, inboundOrder, stockInfo);
                 }
-                if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 0 && inboundOrder.System.Equals("SMOM"))
-                {
-                    //SendInboundInfoToWMS(task, inboundOrder, stockInfo);
-                }
-                else if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 2 && inboundOrder.System.Equals("SMOM"))
-                {
-                    SendAllocateInfoToWMS(task, inboundOrder, stockInfo);
-                }
+                    else if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 2 && inboundOrder.System.Equals("SMOM"))
+                    {
+                        SendAllocateInfoToWMS(task, inboundOrder, stockInfo);
+                    }
 
                 _unitOfWorkManage.CommitTran();
                 return WebResponseContent.Instance.OK();
@@ -1786,6 +1938,41 @@
                             return WebResponseContent.Instance.Error($"澶勭悊澶辫触: {ex.Message}");
                         }
                     }
+                    else if(warehouse.WarehouseCode.Contains("DW") || warehouse.WarehouseCode.Contains("YS"))
+                    {
+                        Dt_OutboundOrder inboundOrder = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrder>()
+                        .Where(x => x.OrderNo == task.OrderNo)
+                        .Includes(x => x.Details)
+                        .First();
+
+                        if (inboundOrder == null) return WebResponseContent.Instance.Error("鏈壘鍒板嚭搴撳崟淇℃伅");
+
+                        Dt_OutboundOrderDetail outboundOrderDetail = new Dt_OutboundOrderDetail();
+                        foreach(var detail in stockInfo.Details)
+                        {
+                            outboundOrderDetail = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>()
+                            .Where(x => x.OrderId == inboundOrder.Id && x.BatchNo == detail.BatchNo)
+                            .First();
+                            if(outboundOrderDetail != null) break;
+
+                        }
+
+                        if (outboundOrderDetail.LocationName != null && outboundOrderDetail.LocationName != "")
+                        {
+                          foreach(var detail in stockInfo.Details)
+                          {
+                                outboundOrderDetail = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>()
+                                .Where(x => x.OrderId == inboundOrder.Id && x.BatchNo == detail.BatchNo && x.LocationName == stockInfo.LocationCode)
+                                .First();
+                                if (outboundOrderDetail != null) break;
+                           }
+                        }
+
+                        if (outboundOrderDetail == null) return WebResponseContent.Instance.Error("鏈壘鍒板嚭搴撳崟淇℃伅");
+                        DWANDYSUpdateOutboundOrderDetails(stockInfo, inboundOrder, ref outboundOrderDetail);
+                        // 3. 鎵ц鏍稿績鍑哄簱閫昏緫
+                        return ExecuteOutboundLogic(task, stockInfo, locationInfo, outboundOrderDetail, inboundOrder);
+                    }
                     else
                     {
                         Dt_OutboundOrder inboundOrder = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrder>()
@@ -1879,8 +2066,15 @@
                 _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails);
 
                 // 鏇存柊搴撳瓨鐘舵�� 鍥炲簱鍗�
-                AddRetrueOrder(stockInfo, inboundOrder);
-
+                if(locationInfo.RoadwayNo.Contains("DW") || locationInfo.RoadwayNo.Contains("YS"))
+                {
+                    AddDWANDYSRetrueOrder(stockInfo, inboundOrder);
+                }
+                else
+                {
+                    AddRetrueOrder(stockInfo, inboundOrder);
+                }
+                   
                 // 鍖哄垎鍗曟嵁鏁版嵁鏉ユ簮鏇存柊璐т綅鐘舵��
                 if (inboundOrder.System == null)
                 {
@@ -1958,6 +2152,39 @@
                 {
                     inboundOrderDetail.OrderDetailStatus = OutboundStatusEnum.鍑哄簱涓�.ObjToInt();
                     inboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱涓�.ObjToInt();
+                }
+            }
+            if (inboundOrder.Details.Count == overCount)
+            {
+                inboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
+            }
+        }
+
+        //浣庢俯銆佽嵂姘�
+        private void DWANDYSUpdateOutboundOrderDetails(Dt_StockInfo stockInfo, Dt_OutboundOrder inboundOrder, ref Dt_OutboundOrderDetail inboundOrderDetail)
+        {
+            string BatchNo = inboundOrderDetail.BatchNo;
+            int overCount = inboundOrder.Details.Where(x => x.BatchNo == BatchNo).Count(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt());
+            //inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfo.Details.FirstOrDefault()?.BatchNo&&x.LPNNo==stockInfo.PalletCode);
+
+            foreach (var item in stockInfo.Details)
+            {
+                if (inboundOrderDetail == null) continue;
+
+                if(inboundOrderDetail.BatchNo == item.BatchNo)
+                {
+                    inboundOrderDetail.OverOutQuantity += item.OutboundQuantity;
+
+                    if (inboundOrderDetail.OverOutQuantity == inboundOrderDetail.OrderQuantity)
+                    {
+                        inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
+                        overCount++;
+                    }
+                    else if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
+                    {
+                        inboundOrderDetail.OrderDetailStatus = OutboundStatusEnum.鍑哄簱涓�.ObjToInt();
+                        inboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱涓�.ObjToInt();
+                    }
                 }
             }
             if (inboundOrder.Details.Count == overCount)
@@ -2228,8 +2455,7 @@
         private void AddRetrueOrder(Dt_StockInfo stockInfo, Dt_OutboundOrder outboundOrder)
         {
             Dt_StockInfoDetail stockInfoDetail = _stockService.StockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
-           .Where(x => x.StockId == stockInfo.Id)
-           .First();
+           .Where(x => x.StockId == stockInfo.Id).First();
             if (stockInfoDetail == null)
             {
                 throw new Exception("寤虹珛鍥炲簱鍗曟椂锛屾湭鎵惧埌璇ュ簱瀛樹俊鎭�");
@@ -2289,6 +2515,95 @@
                     DeleteAndMoveIntoHtStockStatus(stockInfo);
                 }
             }
+
+
+        }
+
+        //浣庢俯銆佽嵂姘村洖搴撳崟
+        private void AddDWANDYSRetrueOrder(Dt_StockInfo stockInfo, Dt_OutboundOrder outboundOrder)
+        {
+
+            List<Dt_StockInfoDetail> stockInfoDetails = _stockService.StockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
+           .Where(x => x.StockId == stockInfo.Id).ToList();
+
+            Dt_ReturnOrder? lastReturnOrder = null; 
+            foreach (var stockInfoDetail in stockInfoDetails)
+            {
+                if (stockInfoDetail == null)
+                {
+                    throw new Exception("寤虹珛鍥炲簱鍗曟椂锛屾湭鎵惧埌璇ュ簱瀛樹俊鎭�");
+                }
+                if (outboundOrder.OrderType == OrderTypeEnum.鍙嶆嫞鍑哄簱鍗�.ObjToInt())
+                {
+                    Dt_ReturnOrder returnOrder = _returnOrderRepository.QueryFirst(x => x.LPNNo == stockInfo.PalletCode && x.LocationCode == stockInfo.LocationCode && x.OrderStatus == InOrderStatusEnum.鏈紑濮�.ObjToInt());
+                    if (returnOrder == null)
+                    {
+                        throw new Exception("鍙嶆嫞鍑哄簱鍚庯紝鏈壘鍒板搴斿弽鎷e洖搴撳崟淇℃伅");
+                    }
+                    stockInfo.LocationCode = "";
+                    stockInfo.StockStatus = StockStatusEmun.鍙嶆嫞鍏ュ簱.ObjToInt();
+                    stockInfo.Remark = "鍙嶆嫞鍏ュ簱";
+                    stockInfoDetail.OutboundQuantity = 0;
+                    stockInfoDetail.StockQuantity += returnOrder.OrderQuantity;
+                    stockInfoDetail.OrderNo = returnOrder.OrderNo;
+                }
+                else
+                {
+                    bool allowCompeted = stockInfo.Details.All(x => x.StockQuantity == x.OutboundQuantity);
+                    if (allowCompeted)
+                    {
+                        DeleteAndMoveIntoHtStockStatus(stockInfo);
+                    }
+                    else
+                    {
+                        decimal returnQuantity = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity;
+                        if (returnQuantity > 0)
+                        {
+                            Dt_ReturnOrder returnOrder = new Dt_ReturnOrder
+                            {
+                                MaterielCode = stockInfoDetail.MaterielCode,
+                                MaterielName = stockInfoDetail.MaterielName,
+                                BatchNo = stockInfoDetail.BatchNo,
+                                OrderQuantity = returnQuantity,
+                                ReceiptQuantity = returnQuantity,
+                                OrderStatus = InOrderStatusEnum.鏈紑濮�.ObjToInt(),
+                                LinId = stockInfoDetail.LinId,
+                                LPNNo = stockInfo.PalletCode,
+                                Creater = "LK",
+                                CreateDate = DateTime.Now,
+                                OrderType = OrderTypeEnum.浣欐枡鍥炲簱鍗�.ObjToInt(),
+                                System = "WMS",
+                                Remark = stockInfoDetail.BatchNo
+                            };
+                            if(lastReturnOrder != null)
+                            {
+                                lastReturnOrder.Remark = lastReturnOrder.Remark + $", {returnOrder.BatchNo}";
+                                _returnOrderRepository.UpdateData(lastReturnOrder);
+                            }
+                            if (outboundOrder.System == "SMOM" && stockInfo.LocationCode != null)
+                            {
+                                returnOrder.LocationCode = stockInfo.LocationCode;
+                            }
+                            _unitOfWorkManage.BeginTran();
+                            if(lastReturnOrder == null)
+                            {
+                                _returnOrderRepository.AddData(returnOrder);
+                                lastReturnOrder = returnOrder;
+                            }
+                            stockInfo.LocationCode = "";
+                            stockInfo.StockStatus = StockStatusEmun.浣欐枡閫�搴�.ObjToInt();
+                            stockInfo.Remark = "浣欐枡閫�搴�";
+                            stockInfoDetail.OutboundQuantity = 0;
+                            stockInfoDetail.StockQuantity = returnQuantity;
+                            stockInfoDetail.OrderNo = lastReturnOrder.OrderNo;
+                            _stockService.StockInfoService.Repository.UpdateData(stockInfo);
+                            _stockService.StockInfoDetailService.Repository.UpdateData(stockInfoDetail);
+                            _unitOfWorkManage.CommitTran();
+                        }
+                    }
+                }
+            }
+
 
         }
 
@@ -2363,8 +2678,7 @@
                         var matchedStockDetail = stockInfoDetails.FirstOrDefault(x => x.MaterielCode == outboundDetail.MaterielCode && x.BatchNo == outboundDetail.BatchNo);
                         if (matchedStockDetail == null)
                         {
-                            matchedStockDetail = stockInfoDetails.FirstOrDefault(x =>
-               x.MaterielCode == outboundDetail.MaterielCode);
+                            matchedStockDetail = stockInfoDetails.FirstOrDefault(x =>x.MaterielCode == outboundDetail.MaterielCode);
 
                             if (matchedStockDetail == null)
                             {
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs b/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs
index c5982bc..3c5eb4e 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs
@@ -45,6 +45,12 @@
             return Service.MaterielGroup(saveModel);
         }
 
+        [HttpPost, HttpGet, Route("NewMaterielGroup")]
+        public WebResponseContent NewMaterielGroup([FromBody] SaveModel saveModel)
+        {
+            return Service.NewMaterielGroup(saveModel);
+        }
+
         [HttpPost, HttpGet, Route("CPMaterielGroup")]
         public WebResponseContent CPMaterielGroup([FromBody] SaveModel saveModel)
         {
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json b/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
index a10af63..aae5a9f 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
@@ -1,45 +1,45 @@
 {
-    "urls": "http://*:9290", //web鏈嶅姟绔彛锛屽鏋滅敤IIS閮ㄧ讲锛屾妸杩欎釜鍘绘帀
-    "Logging": {
-        "LogLevel": {
-            "Default": "Information",
-            "Microsoft.AspNetCore": "Warning"
-        }
-    },
-    "dics": "inOrderType,inoutType,outOrderType,inboundState,createType,enableEnum,enableStatusEnum,locationStatusEnum,locationTypeEnum,taskTypeEnum,taskStatusEnum,outboundStatusEnum,orderDetailStatusEnum,stockStatusEmun,stockChangeType,outStockStatus,InventoryMaterialType,Inventory,materialStatus,warehouses,inoutTypeEnum,takeStockStatusEnum,takeStockDetailStatusEnum",
-    "AllowedHosts": "*",
+  "urls": "http://*:9290", //web鏈嶅姟绔彛锛屽鏋滅敤IIS閮ㄧ讲锛屾妸杩欎釜鍘绘帀
+  "Logging": {
+    "LogLevel": {
+      "Default": "Information",
+      "Microsoft.AspNetCore": "Warning"
+    }
+  },
+  "dics": "inOrderType,inoutType,outOrderType,inboundState,createType,enableEnum,enableStatusEnum,locationStatusEnum,locationTypeEnum,taskTypeEnum,taskStatusEnum,outboundStatusEnum,orderDetailStatusEnum,stockStatusEmun,stockChangeType,outStockStatus,InventoryMaterialType,Inventory,materialStatus,warehouses,inoutTypeEnum,takeStockStatusEnum,takeStockDetailStatusEnum",
+  "AllowedHosts": "*",
 
-    "ReceiveTask": "http://192.168.110.172:9291/api/Task/ReceiveTask", //涓嬪彂鍑哄簱浠诲姟鑷砏CS
-    "ReceiveWMSTaskin": "http://172.30.0.190:1031/api/dataportal/invoke", //绔嬪簱鍏ュ簱鏁伴噺淇℃伅鍥炰紶WMS
-    "ReceiveWMSTaskreturn": "http://172.30.0.190:1031/api/dataportal/invoke", //绔嬪簱鍥炲簱鏁伴噺淇℃伅鍥炰紶WMS
-    "ReceiveWMSTaskout": "http://172.30.0.190:1031/api/dataportal/invoke", //绔嬪簱鍑哄簱鏁伴噺淇℃伅鍥炰紶WMS
-    "ReceiveWMSTaskAUT": "http://172.30.0.190:1031/api/dataportal/invoke", //绔嬪簱鍏ュ簱鏁伴噺淇℃伅鍥炰紶WMS楠岃瘉
-    "ReceiveWMSInventoryIn": "http://172.30.0.190:1031/api/dataportal/invoke", //鐩樼偣宸紓鏁伴噺鍥炰紶WMS
-    "ReceiveWMSTaskAllocatein": "http://172.30.0.190:1031/api/dataportal/invoke", //璋冩嫧浠诲姟鏁伴噺鍥炰紶WMS
-    "ReceiveWMSTask": "http://192.168.110.172:9291/ReceiveWMSTask", //鏌ヨ搴撳瓨锛岀‘璁ゅ叆搴撶珯鍙�
+  "ReceiveTask": "http://192.168.110.172:9291/api/Task/ReceiveTask", //涓嬪彂鍑哄簱浠诲姟鑷砏CS
+  "ReceiveWMSTaskin": "http://172.30.0.190:1031/api/dataportal/invoke", //绔嬪簱鍏ュ簱鏁伴噺淇℃伅鍥炰紶WMS
+  "ReceiveWMSTaskreturn": "http://172.30.0.190:1031/api/dataportal/invoke", //绔嬪簱鍥炲簱鏁伴噺淇℃伅鍥炰紶WMS
+  "ReceiveWMSTaskout": "http://172.30.0.190:1031/api/dataportal/invoke", //绔嬪簱鍑哄簱鏁伴噺淇℃伅鍥炰紶WMS
+  "ReceiveWMSTaskAUT": "http://172.30.0.190:1031/api/dataportal/invoke", //绔嬪簱鍏ュ簱鏁伴噺淇℃伅鍥炰紶WMS楠岃瘉
+  "ReceiveWMSInventoryIn": "http://172.30.0.190:1031/api/dataportal/invoke", //鐩樼偣宸紓鏁伴噺鍥炰紶WMS
+  "ReceiveWMSTaskAllocatein": "http://172.30.0.190:1031/api/dataportal/invoke", //璋冩嫧浠诲姟鏁伴噺鍥炰紶WMS
+  "ReceiveWMSTask": "http://192.168.110.172:9291/ReceiveWMSTask", //鏌ヨ搴撳瓨锛岀‘璁ゅ叆搴撶珯鍙�
 
-    "ReceiveERPTaskout": "http://172.30.0.192:99/external/asrs/api/OutMaterialWarehousingCallback", //绔嬪簱鍑哄簱鏁伴噺淇℃伅鍥炰紶ERP
-    "CancelOutFeedbackERP": "http://172.30.0.192:99/external/asrs/api/CancelOutMaterialWarehousing", //鍑哄簱鍗曟槑缁嗗彇娑堝洖浼燛RP
-    "InMaterialWarehousingCallback": "http://172.30.0.184:99/external/asrs/api/InMaterialWarehousingCallback", //鍏ュ簱鍗曞畬鎴愬洖浼燛RP
-    "CancelInMaterialWarehousing": "http://172.30.0.184:99/external/asrs/api/CancelInMaterialWarehousing", //鍏ュ簱鍗曞彇娑堝洖浼燛RP
-    "ConnectionStringsEncryption": false,
-    "MainDB": "DB_WIDESEA", //褰撳墠椤圭洰鐨勪富搴擄紝鎵�瀵瑰簲鐨勮繛鎺ュ瓧绗︿覆鐨凟nabled蹇呴』涓簍rue
-    //杩炴帴瀛楃涓�
-    //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
-    "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_JAMK;User ID=sa;Password=sa123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-    //"ConnectionString": "Data Source=10.168.1.226,1443;Initial Catalog=WIDESEAWMS_JAMK;User ID=sa;Password=sa123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-    //璺ㄥ煙
-    "Cors": {
-        "PolicyName": "CorsIpAccess", //绛栫暐鍚嶇О
-        "EnableAllIPs": true, //褰撲负true鏃讹紝寮�鏀炬墍鏈塈P鍧囧彲璁块棶銆�
-        // 鏀寔澶氫釜鍩熷悕绔彛锛屾敞鎰忕鍙e彿鍚庝笉瑕佸甫/鏂滄潌锛氭瘮濡俵ocalhost:8000/锛屾槸閿欑殑
-        // 娉ㄦ剰锛宧ttp://127.0.0.1:1818 鍜� http://localhost:1818 鏄笉涓�鏍风殑
-        "IPs": "http://127.0.0.1:8080,http://localhost:8080"
-    },
-    "ERP": "http://172.30.0.184:99",
-    "WCS": "http://localhost:9291",
-    "PrinterName": "192.168.99.3涓婄殑LenovoM7605D",
-    "ApiName": "WIDESEA",
-    "ExpMinutes": 120,
-    "QuartzJobAutoStart": true
+  "ReceiveERPTaskout": "http://172.30.0.184:99/external/asrs/api/OutMaterialWarehousingCallback", //绔嬪簱鍑哄簱鏁伴噺淇℃伅鍥炰紶ERP
+  "CancelOutFeedbackERP": "http://172.30.0.184:99/external/asrs/api/CancelOutMaterialWarehousing", //鍑哄簱鍗曟槑缁嗗彇娑堝洖浼燛RP
+  "InMaterialWarehousingCallback": "http://172.30.0.184:99/external/asrs/api/InMaterialWarehousingCallback", //鍏ュ簱鍗曞畬鎴愬洖浼燛RP
+  "CancelInMaterialWarehousing": "http://172.30.0.184:99/external/asrs/api/CancelInMaterialWarehousing", //鍏ュ簱鍗曞彇娑堝洖浼燛RP
+  "ConnectionStringsEncryption": false,
+  "MainDB": "DB_WIDESEA", //褰撳墠椤圭洰鐨勪富搴擄紝鎵�瀵瑰簲鐨勮繛鎺ュ瓧绗︿覆鐨凟nabled蹇呴』涓簍rue
+  //杩炴帴瀛楃涓�
+  //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
+  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_JAMK;User ID=sa;Password=sa123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  //"ConnectionString": "Data Source=10.168.1.226,1443;Initial Catalog=WIDESEAWMS_JAMK;User ID=sa;Password=sa123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  //璺ㄥ煙
+  "Cors": {
+    "PolicyName": "CorsIpAccess", //绛栫暐鍚嶇О
+    "EnableAllIPs": true, //褰撲负true鏃讹紝寮�鏀炬墍鏈塈P鍧囧彲璁块棶銆�
+    // 鏀寔澶氫釜鍩熷悕绔彛锛屾敞鎰忕鍙e彿鍚庝笉瑕佸甫/鏂滄潌锛氭瘮濡俵ocalhost:8000/锛屾槸閿欑殑
+    // 娉ㄦ剰锛宧ttp://127.0.0.1:1818 鍜� http://localhost:1818 鏄笉涓�鏍风殑
+    "IPs": "http://127.0.0.1:8080,http://localhost:8080"
+  },
+  "ERP": "http://172.30.0.184:99",
+  "WCS": "http://localhost:9291",
+  "PrinterName": "SHARP MX-5148NC PCL6",
+  "ApiName": "WIDESEA",
+  "ExpMinutes": 120,
+  "QuartzJobAutoStart": true
 }

--
Gitblit v1.9.3