From c30ac3ad95328c1a34661ecde471e4215df9dab3 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 17 十月 2025 19:54:03 +0800
Subject: [PATCH] 添加盘点功能、添加立方智能库补货功能(入库平库调拨出库,立库调拨入库)

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs               |    2 
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs                     |  139 +++++++++++++++++++
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs                       |  106 +++++++++++++++
 新建文件夹/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskStatusEnum.cs                         |   33 ++++
 新建文件夹/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_Inventory_Batch.cs                |    8 
 新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/Properties/PublishProfiles/FolderProfile.pubxml |    2 
 新建文件夹/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_SupplyTask.cs                     |   16 +
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs              |   16 +
 新建文件夹/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskTypeEnum.cs                           |   12 +
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs                 |   12 +
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs                  |   20 +-
 新建文件夹/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs                             |   10 
 新建文件夹/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_InventoryInfo.cs                  |    6 
 13 files changed, 343 insertions(+), 39 deletions(-)

diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs"
index 858b401..4b6696c 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs"
@@ -83,14 +83,14 @@
                     switch (request.orderType)
                     {
                         case "1": // 鍏ュ簱
-                            entity.StockQuantity += (float)orderQty;
+                            entity.StockQuantity += orderQty;
                             entity.InDate = DateTime.Now;
                             entity.Remark = "鍏ュ簱鍗曞洖浼�";
                             break;
 
                         case "2": // 鍑哄簱
-                            entity.OutboundQuantity += (float)orderQty;
-                            entity.StockQuantity -= (float)orderQty;
+                            entity.OutboundQuantity += orderQty;
+                            entity.StockQuantity -= orderQty;
                             if (entity.StockQuantity < 0) entity.StockQuantity = 0;
                             entity.Remark = "鍑哄簱鍗曞洖浼�";
                             break;
@@ -103,11 +103,11 @@
                                     decimal diff = Convert.ToDecimal(stock.differenceQuantity);
                                     if (stock.IsProfit == "1") // 鐩樼泩
                                     {
-                                        entity.SupplyQuantity += (float)Math.Abs(diff);
+                                        entity.SupplyQuantity += Math.Abs(diff);
                                     }
                                     else // 鐩樹簭
                                     {
-                                        entity.SupplyQuantity -= (float)Math.Abs(diff);
+                                        entity.SupplyQuantity -= Math.Abs(diff);
                                         if (entity.SupplyQuantity < 0) entity.SupplyQuantity = 0;
                                     }
                                     entity.PalletCode = stock.palletCode;
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskStatusEnum.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskStatusEnum.cs"
index fdea881..8d347e5 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskStatusEnum.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskStatusEnum.cs"
@@ -7,6 +7,39 @@
 
 namespace WIDESEA_Common.TaskEnum
 {
+    public enum SupplyStatusEnum
+    {
+        /// <summary>
+        /// 寰呭叆搴�
+        /// </summary>
+        [Description("寰呭叆搴�")]
+        NewIn,
+        /// <summary>
+        /// 寰呭嚭搴�
+        /// </summary>
+        [Description("寰呭嚭搴�")]
+        NewOut,
+        /// <summary>
+        /// 寰呯洏鐐�
+        /// </summary>
+        [Description("寰呯洏鐐�")]
+        NewCheck,
+        /// <summary>
+        /// 鍏ュ簱瀹屾垚
+        /// </summary>
+        [Description("鍏ュ簱瀹屾垚")]
+        InFinish,
+        /// <summary>
+        /// 鍑哄簱瀹屾垚
+        /// </summary>
+        [Description("鍑哄簱瀹屾垚")]
+        OutFinish,
+        /// <summary>
+        /// 鐩樼偣瀹屾垚
+        /// </summary>
+        [Description("鐩樼偣瀹屾垚")]
+        CheckFinish,
+    }
     /// <summary>
     /// 浠诲姟鐘舵��
     /// </summary>
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskTypeEnum.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskTypeEnum.cs"
index e5abb46..726d932 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskTypeEnum.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskTypeEnum.cs"
@@ -10,6 +10,16 @@
     public enum TaskTypeEnum
     {
         /// <summary>
+        /// 璋冩嫧鍏ュ簱
+        /// </summary>
+        [Description("璋冩嫧鍏ュ簱")]
+        AllocatIn,
+        /// <summary>
+        /// 璋冩嫧鍑哄簱
+        /// </summary>
+        [Description("璋冩嫧鍑哄簱")]
+        AllocatOut,
+        /// <summary>
         /// 棰嗘枡鍑哄簱
         /// </summary>
         [Description("棰嗘枡鍑哄簱")]
@@ -98,7 +108,7 @@
         /// </summary>
         [Description("宸烽亾鍐呯Щ搴�")]
         Relocation = 900
-        
+
     }
 
     public enum TaskTypeGroup
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs"
index 1da20f3..9d67ca9 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs"
@@ -4,6 +4,7 @@
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
 using WIDESEA_Model.Models;
 
@@ -11,6 +12,7 @@
 {
     public interface ICabinOrderServices: IService<Dt_CabinOrder>
     {
+        IRepository<Dt_CabinOrder> Repository { get; }
         /// <summary>
         /// 鑾峰彇涓婃父鍏ュ簱璁㈠崟
         /// </summary>
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_InventoryInfo.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_InventoryInfo.cs"
index 1885343..9c10f4d 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_InventoryInfo.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_InventoryInfo.cs"
@@ -90,7 +90,7 @@
         [ImporterHeader(Name = "瀹為檯搴撳瓨鏁�")]
         [ExporterHeader(DisplayName = "瀹為檯搴撳瓨鏁�")]
         [SugarColumn(IsNullable = false, ColumnDescription = "瀹為檯搴撳瓨鏁�")]
-        public float StockQuantity { get; set; }
+        public decimal StockQuantity { get; set; }
 
         /// <summary>
         /// 鍑哄簱鏁�
@@ -98,7 +98,7 @@
         [ImporterHeader(Name = "鍑哄簱鏁�")]
         [ExporterHeader(DisplayName = "鍑哄簱鏁�")]
         [SugarColumn(IsNullable = false, ColumnDescription = "鍑哄簱鏁�", DefaultValue = "0")]
-        public float OutboundQuantity { get; set; }
+        public decimal OutboundQuantity { get; set; }
 
         /// <summary>
         /// 鐩樼偣鏁帮紱鐩樼偣鍚庡疄闄呮暟閲�
@@ -106,7 +106,7 @@
         [ImporterHeader(Name = "鐩樼偣鏁�")]
         [ExporterHeader(DisplayName = "鐩樼偣鏁�")]
         [SugarColumn(IsNullable = false, ColumnDescription = "鐩樼偣鏁�", DefaultValue = "0")]
-        public float SupplyQuantity { get; set; }
+        public decimal SupplyQuantity { get; set; }
 
         /// <summary>
         /// 鍏ュ簱鏃堕棿
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_Inventory_Batch.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_Inventory_Batch.cs"
index 58b4659..cc87e64 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_Inventory_Batch.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_Inventory_Batch.cs"
@@ -58,7 +58,7 @@
         [ImporterHeader(Name = "搴撳瓨鏁�")]
         [ExporterHeader(DisplayName = "搴撳瓨鏁�")]
         [SugarColumn(IsNullable = false, ColumnDescription = "搴撳瓨鏁�")]
-        public float StockQuantity { get; set; }
+        public decimal StockQuantity { get; set; }
 
         /// <summary>
         /// 鍑哄簱鏁帮紙鍚岀墿鏂欏悓鎵规鎬诲拰锛�
@@ -66,7 +66,7 @@
         [ImporterHeader(Name = "鍑哄簱鏁�")]
         [ExporterHeader(DisplayName = "鍑哄簱鏁�")]
         [SugarColumn(IsNullable = false, ColumnDescription = "鍑哄簱鏁�", DefaultValue = "0")]
-        public float OutboundQuantity { get; set; }
+        public decimal OutboundQuantity { get; set; }
 
         /// <summary>
         /// 鐩樼偣鏁帮紱鐩樼偣鍚庡疄闄呮暟閲忥紙鍚岀墿鏂欏悓鎵规鎬诲拰锛�
@@ -74,7 +74,7 @@
         [ImporterHeader(Name = "鐩樼偣鏁�")]
         [ExporterHeader(DisplayName = "鐩樼偣鏁�")]
         [SugarColumn(IsNullable = false, ColumnDescription = "鐩樼偣鏁�", DefaultValue = "0")]
-        public float SupplyQuantity { get; set; }
+        public decimal SupplyQuantity { get; set; }
 
         /// <summary>
         /// ERP瀹為檯搴撳瓨鏁�
@@ -82,7 +82,7 @@
         [ImporterHeader(Name = "ERP瀹為檯搴撳瓨鏁�")]
         [ExporterHeader(DisplayName = "ERP瀹為檯搴撳瓨鏁�")]
         [SugarColumn(IsNullable = false, ColumnDescription = "ERP瀹為檯搴撳瓨鏁�")]
-        public float ERPStockQuantity { get; set; }
+        public decimal ERPStockQuantity { get; set; }
 
         /// <summary>
         /// 搴撳瓨宸紓锛氬簱瀛樻暟涓嶦RP瀹為檯搴撳瓨鏁版槸鍚︾浉绛�
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_SupplyTask.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_SupplyTask.cs"
index ebb9e78..6d4c6a1 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_SupplyTask.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_SupplyTask.cs"
@@ -26,7 +26,7 @@
         public int TaskId { get; set; }
 
         /// <summary>
-        /// 浠诲姟鍙�
+        /// 浠诲姟鍙凤紱璁㈠崟璇︽儏涓婚敭锛欼D
         /// </summary>
         [ImporterHeader(Name = "浠诲姟鍙�")]
         [ExporterHeader(DisplayName = "浠诲姟鍙�")]
@@ -82,6 +82,14 @@
         public int TaskType { get; set; }
 
         /// <summary>
+        /// 浠诲姟鐘舵��
+        /// </summary>
+        [ImporterHeader(Name = "浠诲姟鐘舵��")]
+        [ExporterHeader(DisplayName = "浠诲姟鐘舵��")]
+        [SugarColumn(IsNullable = false, ColumnDescription = "浠诲姟鐘舵��")]
+        public int TaskStatus { get; set; }
+
+        /// <summary>
         /// 搴撴埧缂栧彿
         /// </summary>
         [SugarColumn(IsNullable = false, Length = 30, ColumnDescription = "搴撴埧缂栧彿")]
@@ -96,12 +104,12 @@
         public string LocationCode { get; set; }
 
         /// <summary>
-        /// 搴撳瓨鏁�
+        /// 搴撳瓨鏁�,浠诲姟鏁伴噺
         /// </summary>
         [ImporterHeader(Name = "搴撳瓨鏁�")]
         [ExporterHeader(DisplayName = "搴撳瓨鏁�")]
         [SugarColumn(IsNullable = false, ColumnDescription = "搴撳瓨鏁�")]
-        public float StockQuantity { get; set; }
+        public decimal StockQuantity { get; set; }
 
         /// <summary>
         /// 鐩樼偣鏁帮紱鐩樼偣鍚庡疄闄呮暟閲�
@@ -109,7 +117,7 @@
         [ImporterHeader(Name = "鐩樼偣鏁�")]
         [ExporterHeader(DisplayName = "鐩樼偣鏁�")]
         [SugarColumn(IsNullable = false, ColumnDescription = "鐩樼偣鏁�", DefaultValue = "0")]
-        public float SupplyQuantity { get; set; }
+        public decimal SupplyQuantity { get; set; }
 
         /// <summary>
         /// 鍗曟嵁缂栧彿
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
index e1c8101..415829a 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
@@ -273,11 +273,13 @@
                 Dt_SupplyTask supplyTask = new Dt_SupplyTask()
                 {
                     WarehouseCode = cabinOrderDetail.Reservoirarea,
-                    BatchNo=inventoryInfo.BatchNo,
-                    MaterielName= inventoryInfo.MaterielName,
-                    MaterielCode= inventoryInfo.MaterielCode,
-                    MaterielSpec= inventoryInfo.MaterielSpec,
-                    TaskType=TaskTypeEnum.InPick.ObjToInt(),
+                    TaskNum = cabinOrderDetail.Id,
+                    TaskStatus = SupplyStatusEnum.InFinish.ObjToInt(),
+                    BatchNo = inventoryInfo.BatchNo,
+                    MaterielName = inventoryInfo.MaterielName,
+                    MaterielCode = inventoryInfo.MaterielCode,
+                    MaterielSpec = inventoryInfo.MaterielSpec,
+                    TaskType = TaskTypeEnum.InPick.ObjToInt(),
                     CreateDate = DateTime.Now,
                     Creater = App.User.UserName,
                     LocationCode = location.LocationCode,
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
index 14d643e..9b662bd 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
@@ -24,7 +24,7 @@
 
 namespace WIDESEA_SquareCabinServices
 {
-    public class DeliveryOrderServices : ServiceBase<Dt_DeliveryOrder, IRepository<Dt_DeliveryOrder>>, IDeliveryOrderServices
+    public partial class DeliveryOrderServices : ServiceBase<Dt_DeliveryOrder, IRepository<Dt_DeliveryOrder>>, IDeliveryOrderServices
     {
         static string SearchDate = "";
         private readonly IBasicService _basicService;
@@ -33,8 +33,9 @@
         private readonly IInventoryInfoService _inventoryInfoService;
         private readonly IDeliveryOrderDetailServices _deliveryOrderDetailServices;
         private readonly ISupplyTaskService _supplyTaskService;
+        private readonly ICabinOrderServices _cabinOrderServices;
         public IRepository<Dt_DeliveryOrder> Repository => BaseDal;
-        public DeliveryOrderServices(IRepository<Dt_DeliveryOrder> BaseDal, IBasicService basicService, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, IDeliveryOrderDetailServices deliveryOrderDetailServices, ISupplyTaskService supplyTaskService) : base(BaseDal)
+        public DeliveryOrderServices(IRepository<Dt_DeliveryOrder> BaseDal, IBasicService basicService, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, IDeliveryOrderDetailServices deliveryOrderDetailServices, ISupplyTaskService supplyTaskService, ICabinOrderServices cabinOrderServices) : base(BaseDal)
         {
             _basicService = basicService;
             _unitOfWorkManage = unitOfWorkManage;
@@ -42,6 +43,7 @@
             _supplyTaskService = supplyTaskService;
             _inventory_BatchServices = inventory_BatchServices;
             _inventoryInfoService = inventoryInfoService;
+            _cabinOrderServices = cabinOrderServices;
         }
 
         /// <summary>
@@ -300,7 +302,7 @@
                                     };
                                     entityOrder.Details.Add(detail);
 
-                                    inv.OutboundQuantity += (float)use;
+                                    inv.OutboundQuantity += use;
                                     BaseDal.Db.Updateable(inv).ExecuteCommand();
 
                                     remainingPartial -= use;
@@ -331,7 +333,7 @@
                                         };
                                         entityOrder.Details.Add(detail);
 
-                                        inv.OutboundQuantity += (float)use;
+                                        inv.OutboundQuantity += use;
                                         BaseDal.Db.Updateable(inv).ExecuteCommand();
 
                                         remainingPartial -= use;
@@ -374,7 +376,7 @@
                                     };
                                     entityOrder.Details.Add(detail);
 
-                                    inv.OutboundQuantity += (float)useQty;
+                                    inv.OutboundQuantity += useQty;
                                     BaseDal.Db.Updateable(inv).ExecuteCommand();
 
                                     remainingFullBoxes -= useBoxes;
@@ -409,7 +411,7 @@
                                         };
                                         entityOrder.Details.Add(detail);
 
-                                        inv.OutboundQuantity += (float)useQty;
+                                        inv.OutboundQuantity += useQty;
                                         BaseDal.Db.Updateable(inv).ExecuteCommand();
 
                                         remainingFullBoxes -= useBoxes;
@@ -1242,6 +1244,7 @@
                     MaterielCode = inventoryInfo.MaterielCode,
                     MaterielSpec = inventoryInfo.MaterielSpec,
                     TaskType = TaskTypeEnum.OutInventory.ObjToInt(),
+                    TaskStatus = SupplyStatusEnum.CheckFinish.ObjToInt(),
                     CreateDate = DateTime.Now,
                     Creater = App.User.UserName,
                     LocationCode = LocationCode,
@@ -1345,6 +1348,7 @@
                     MaterielName = inventoryInfo.MaterielName,
                     MaterielCode = inventoryInfo.MaterielCode,
                     MaterielSpec = inventoryInfo.MaterielSpec,
+                    TaskStatus = SupplyStatusEnum.OutFinish.ObjToInt(),
                     TaskType = TaskTypeEnum.OutPick.ObjToInt(),
                     CreateDate = DateTime.Now,
                     Creater = App.User.UserName,
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
index bc9f8d3..6f83567 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
@@ -250,22 +250,22 @@
                     switch (request.orderType)
                     {
                         case "1": // 鍏ュ簱
-                            entity.StockQuantity += (float)orderQty;
+                            entity.StockQuantity += orderQty;
                             entity.InDate = DateTime.Now;
                             entity.Remark = "鍏ュ簱鍗曞洖浼�";
 
-                            batch.StockQuantity += (float)orderQty;
+                            batch.StockQuantity += orderQty;
                             batch.Remark = "鍏ュ簱鍗曞洖浼�";
                             break;
 
                         case "2": // 鍑哄簱
-                            entity.OutboundQuantity += (float)orderQty;
-                            entity.StockQuantity -= (float)orderQty;
+                            entity.OutboundQuantity += orderQty;
+                            entity.StockQuantity -= orderQty;
                             if (entity.StockQuantity < 0) entity.StockQuantity = 0;
                             entity.Remark = "鍑哄簱鍗曞洖浼�";
 
-                            batch.OutboundQuantity += (float)orderQty;
-                            batch.StockQuantity -= (float)orderQty;
+                            batch.OutboundQuantity += orderQty;
+                            batch.StockQuantity -= orderQty;
                             if (batch.StockQuantity < 0) batch.StockQuantity = 0;
                             batch.Remark = "鍑哄簱鍗曞洖浼�";
                             break;
@@ -278,13 +278,13 @@
                                     decimal diff = Convert.ToDecimal(stock.differenceQuantity);
                                     if (stock.IsProfit == "1") // 鐩樼泩
                                     {
-                                        entity.SupplyQuantity += (float)Math.Abs(diff);
-                                        batch.SupplyQuantity += (float)Math.Abs(diff);
+                                        entity.SupplyQuantity += Math.Abs(diff);
+                                        batch.SupplyQuantity += Math.Abs(diff);
                                     }
                                     else // 鐩樹簭
                                     {
-                                        entity.SupplyQuantity -= (float)Math.Abs(diff);
-                                        batch.SupplyQuantity -= (float)Math.Abs(diff);
+                                        entity.SupplyQuantity -= Math.Abs(diff);
+                                        batch.SupplyQuantity -= Math.Abs(diff);
                                         if (entity.SupplyQuantity < 0) entity.SupplyQuantity = 0;
                                         if (batch.SupplyQuantity < 0) batch.SupplyQuantity = 0;
                                     }
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs"
new file mode 100644
index 0000000..d840053
--- /dev/null
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs"
@@ -0,0 +1,139 @@
+锘縰sing HslCommunication.Secs.Types;
+using SqlSugar.Extensions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.NetworkInformation;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Common.OrderEnum;
+using WIDESEA_Common.StockEnum;
+using WIDESEA_Common.TaskEnum;
+using WIDESEA_Core;
+using WIDESEA_ISquareCabinServices;
+using WIDESEA_Model.Models;
+using static WIDESEA_DTO.SquareCabin.OrderDto;
+
+namespace WIDESEA_SquareCabinServices
+{
+    public partial class DeliveryOrderServices
+    {
+        #region 鍒涘缓骞冲簱璋冩嫧鍑哄簱鍗曘�佺珛搴撹皟鎷ㄥ叆搴撳崟
+        /// <summary>
+        /// 鍒涘缓璋冩嫧鍗�
+        /// </summary>
+        /// <param name="materielInfo">鐗╂枡淇℃伅</param>
+        /// <returns></returns>
+        public WebResponseContent CreateAllocatInOut(Dt_MaterielInfo materielInfo)
+        {
+            WebResponseContent response = new WebResponseContent();
+            try
+            {
+                List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
+                List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == materielInfo.MaterielCode && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.StockQuantity > x.OutboundQuantity).OrderBy(x => x.InDate).ToList();
+                decimal Qty = 0;
+                foreach (var item in dt_InventoryInfos)
+                {
+                    if (materielInfo.Business_qty >= materielInfo.MinQty) break;
+                    item.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+                    while (item.StockQuantity > item.OutboundQuantity && materielInfo.Business_qty < materielInfo.MinQty)
+                    {
+                        Qty += materielInfo.BoxQty;
+                        materielInfo.Business_qty += materielInfo.BoxQty;
+                        item.OutboundQuantity += materielInfo.BoxQty;
+                    }
+                }
+
+                #region 娣诲姞璋冩嫧鍑哄簱鍗�
+                Dt_DeliveryOrder deliveryOrder = new Dt_DeliveryOrder()
+                {
+                    Out_no = DateTime.Now.ToString("yyMMddHHmmss"),
+                    Out_type = OutOrderTypeEnum.Allocate.ObjToInt().ToString(),
+                    OutStatus = "鏂板缓",
+                    Details = new List<Dt_DeliveryOrderDetail>()
+                };
+                dt_InventoryInfos = dt_InventoryInfos.Where(X => X.StockStatus == StockStatusEmun.鍑哄簱閿佸畾.ObjToInt()).ToList();
+                foreach (var item in dt_InventoryInfos.GroupBy(x => x.BatchNo))
+                {
+                    Dt_DeliveryOrderDetail deliveryOrderDetail = new Dt_DeliveryOrderDetail()
+                    {
+                        Batch_num = item.Key,
+                        Order_Outqty = 0,
+                        Order_qty = item.Select(x => x.OutboundQuantity).Sum(),
+                        CreateDate = DateTime.Now,
+                        Creater = App.User.UserName ?? "System",
+                        Goods_no = item.First().MaterielCode,
+                        OotDetailStatus = "鏂板缓",
+                        Status = 2,
+                        Reservoirarea = item.First().WarehouseCode
+                    };
+                    deliveryOrder.Details.Add(deliveryOrderDetail);
+                }
+                #endregion
+
+                #region 娣诲姞璋冩嫧鍑哄簱浠诲姟
+                foreach (var item in dt_InventoryInfos)
+                {
+                    Dt_SupplyTask supplyTask = new Dt_SupplyTask()
+                    {
+                        WarehouseCode = item.WarehouseCode,
+                        BatchNo = item.BatchNo,
+                        MaterielName = item.MaterielName,
+                        MaterielCode = item.MaterielCode,
+                        MaterielSpec = item.MaterielSpec,
+                        TaskStatus = SupplyStatusEnum.NewOut.ObjToInt(),
+                        TaskType = TaskTypeEnum.AllocatOut.ObjToInt(),
+                        CreateDate = DateTime.Now,
+                        Creater = App.User.UserName ?? "System",
+                        LocationCode = item.LocationCode,
+                        OrderNo = deliveryOrder.Out_no,
+                        StockQuantity = item.OutboundQuantity,
+                        SupplyQuantity = 0,
+                        Remark = "璋冩嫧鍑哄簱"
+                    };
+                    supplyTasks.Add(supplyTask);
+                }
+                #endregion
+
+                #region 娣诲姞璋冩嫧鍏ュ簱鍗�
+                Dt_CabinOrder cabinOrder = new Dt_CabinOrder()
+                {
+                    Order_no = deliveryOrder.Out_no,
+                    Order_type = InOrderTypeEnum.Allocat.ObjToInt().ToString(),
+                    Warehouse_no = "001",
+                    OdrderStatus = "鏂板缓",
+                    Details = new List<Dt_CabinOrderDetail>()
+                };
+                foreach (var item in deliveryOrder.Details)
+                {
+                    Dt_CabinOrderDetail orderDetail = new Dt_CabinOrderDetail()
+                    {
+                        Reservoirarea = cabinOrder.Warehouse_no,
+                        Goods_no = item.Goods_no,
+                        Order_qty = item.Order_qty,
+                        Order_Inqty = item.Order_qty,
+                        Batch_num = item.Batch_num,
+                        OrderDetailStatus = "鏂板缓",
+                        Status = 0
+                    };
+                    cabinOrder.Details.Add(orderDetail);
+                }
+                #endregion
+
+                _unitOfWorkManage.BeginTran();
+                _inventoryInfoService.Repository.UpdateData(dt_InventoryInfos);
+                _supplyTaskService.AddData(supplyTasks);
+                BaseDal.Db.InsertNav(deliveryOrder).Include(x => x.Details).ExecuteCommand();
+                _cabinOrderServices.Repository.Db.InsertNav(cabinOrder).Include(x => x.Details).ExecuteCommand();
+                _unitOfWorkManage.CommitTran();
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                response.Error(ex.Message);
+            }
+            return response;
+        }
+        #endregion
+    }
+}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
new file mode 100644
index 0000000..5bb01d2
--- /dev/null
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
@@ -0,0 +1,106 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Common.OrderEnum;
+using WIDESEA_Common.TaskEnum;
+using WIDESEA_Core;
+using WIDESEA_Core.Helper;
+using WIDESEA_Model.Models;
+using static WIDESEA_DTO.SquareCabin.OrderDto;
+
+namespace WIDESEA_SquareCabinServices
+{
+    public partial class DeliveryOrderServices
+    {
+        #region 鍒涘缓鐩樼偣鍗曘�佺洏鐐逛换鍔�
+        /// <summary>
+        /// 鍒涘缓鐩樼偣鍗�
+        /// </summary>
+        /// <param name="keys"></param>
+        /// <returns></returns>
+        public WebResponseContent CreateCheckOrder(int[] keys)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                List<Dt_DeliveryOrder> deliveryOrders = new List<Dt_DeliveryOrder>();
+                List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
+                List<Dt_Inventory_Batch> inventory_Batches = _inventory_BatchServices.Repository.QueryData(x => keys.Contains(x.Id));
+                foreach (var item in inventory_Batches)
+                {
+                    List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => item.MaterielCode == x.MaterielCode && x.BatchNo == item.BatchNo);
+                    if (inventoryInfos.Count > 0)
+                    {
+                        Dt_DeliveryOrder deliveryOrder = new Dt_DeliveryOrder()
+                        {
+                            Out_no = item.MaterielCode + "_" + item.BatchNo,
+                            Out_type = "3",
+                            OutStatus = "鏂板缓",
+                            Details = new List<Dt_DeliveryOrderDetail>()
+                        };
+                        foreach (var items in inventoryInfos.GroupBy(x => x.WarehouseCode))
+                        {
+                            var Status = items.Key == "001" ? 0 : 2;//鍒ゆ柇鏄惁涓虹珛搴撳尯鍩�
+                            Dt_DeliveryOrderDetail deliveryOrderDetail = new Dt_DeliveryOrderDetail()
+                            {
+                                Batch_num = item.BatchNo,
+                                Order_Outqty = 0,
+                                Order_qty = items.Select(x => x.StockQuantity).Sum(),
+                                CreateDate = DateTime.Now,
+                                Creater = App.User.UserName,
+                                Goods_no = item.MaterielCode,
+                                OotDetailStatus = "鏂板缓",
+                                Status = Status,
+                                Reservoirarea = items.Key
+                            };
+                            deliveryOrder.Details.Add(deliveryOrderDetail);
+                            #region 鍒涘缓鐩樼偣浠诲姟
+                            if (items.Key != "001")
+                            {
+                                foreach (var inventory in items)
+                                {
+                                    Dt_SupplyTask supplyTask = new Dt_SupplyTask()
+                                    {
+                                        WarehouseCode = inventory.WarehouseCode,
+                                        TaskStatus = SupplyStatusEnum.NewCheck.ObjToInt(),
+                                        BatchNo = inventory.BatchNo,
+                                        MaterielName = inventory.MaterielName,
+                                        MaterielCode = inventory.MaterielCode,
+                                        MaterielSpec = inventory.MaterielSpec,
+                                        TaskType = TaskTypeEnum.OutInventory.ObjToInt(),
+                                        CreateDate = DateTime.Now,
+                                        Creater = App.User.UserName,
+                                        LocationCode = inventory.LocationCode,
+                                        OrderNo = deliveryOrder.Out_no,
+                                        StockQuantity = inventory.StockQuantity,
+                                        SupplyQuantity = 0,
+                                        Remark = "鐩樼偣"
+                                    };
+                                    supplyTasks.Add(supplyTask);
+                                }
+                            }
+                            #endregion
+                        }
+                        deliveryOrders.Add(deliveryOrder);
+                    }
+                }
+                _unitOfWorkManage.BeginTran();
+                _supplyTaskService.AddData(supplyTasks);
+                BaseDal.Db.InsertNav(deliveryOrders)
+                        .Include(x => x.Details)
+                        .ExecuteCommand();
+                _unitOfWorkManage.CommitTran();
+                content.OK();
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                content.Error(ex.Message);
+            }
+            return content;
+        }
+        #endregion
+    }
+}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Properties/PublishProfiles/FolderProfile.pubxml" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Properties/PublishProfiles/FolderProfile.pubxml"
index 86bb19c..b608ce8 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Properties/PublishProfiles/FolderProfile.pubxml"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Properties/PublishProfiles/FolderProfile.pubxml"
@@ -10,7 +10,7 @@
     <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
     <LastUsedPlatform>Any CPU</LastUsedPlatform>
     <PublishProvider>FileSystem</PublishProvider>
-    <PublishUrl>E:\IISText\HuanAn\WMS</PublishUrl>
+    <PublishUrl>E:\IISText\FangCang</PublishUrl>
     <WebPublishMethod>FileSystem</WebPublishMethod>
     <_TargetId>Folder</_TargetId>
     <SiteUrlToLaunchAfterPublish />

--
Gitblit v1.9.3