From efbeb93b3d454f06d65dbcc68ad828cc95bc9404 Mon Sep 17 00:00:00 2001
From: 刘磊 <1161824510@qq.com>
Date: 星期一, 17 十一月 2025 09:36:03 +0800
Subject: [PATCH] 同步文件

---
 项目代码/WMS/WMSServer/WIDESEA_IStorageBasicService/BasicInfo/IDt_BDCConfigurationService.cs       |   82 +++++++++++++
 项目代码/WMS/WMSServer/WIDESEA_StorageBasicRepository/BasicInfo/Dt_BDCConfigurationRepository.cs   |   28 ++++
 项目代码/WMS/WMSServer/WIDESEA_Common/BDC/BDCEnum.cs                                               |   24 ++++
 项目代码/WMS/WMSServer/WIDESEA_StorageBasicServices/BasicInfo/Dt_BDCConfigurationService.cs        |  109 ++++++++++++++++++
 项目代码/WMS/WMSServer/WIDESEA_IStorageBasicRepository/BasicInfo/IDt_BDCConfigurationRepository.cs |   31 +++++
 项目资料/项目图纸/零跑金华四厂BDC4巷道方案20250829.dwg                                                           |    0 
 项目代码/WMS/WMSServer/WIDESEA_Model/Models/BasicInfo/Dt_BDCConfiguration.cs                       |   67 +++++++++++
 项目代码/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/removeWorkOrderInfo.cs        |   10 +
 8 files changed, 348 insertions(+), 3 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_Common/BDC/BDCEnum.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_Common/BDC/BDCEnum.cs"
new file mode 100644
index 0000000..382b929
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_Common/BDC/BDCEnum.cs"
@@ -0,0 +1,24 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Common
+{
+    public enum BodyType
+    {
+        WhiteBody = 1,
+        PaintedBody,
+
+    }
+
+    public enum BodyStatus
+    {
+        InWeldingShop = 1,
+        InBDC,
+        InPaintingShop,
+        InAssemblyShop,
+        Completed
+    }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_IStorageBasicRepository/BasicInfo/IDt_BDCConfigurationRepository.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_IStorageBasicRepository/BasicInfo/IDt_BDCConfigurationRepository.cs"
new file mode 100644
index 0000000..5f99996
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_IStorageBasicRepository/BasicInfo/IDt_BDCConfigurationRepository.cs"
@@ -0,0 +1,31 @@
+锘�#region << 鐗� 鏈� 娉� 閲� >>
+/*----------------------------------------------------------------
+ * 鍛藉悕绌洪棿锛歐IDESEAWCS_ITaskInfoRepository
+ * 鍒涘缓鑰咃細鑳$搴�
+ * 鍒涘缓鏃堕棿锛�2024/8/2 16:13:36
+ * 鐗堟湰锛歏1.0.0
+ * 鎻忚堪锛�
+ *
+ * ----------------------------------------------------------------
+ * 淇敼浜猴細
+ * 淇敼鏃堕棿锛�
+ * 鐗堟湰锛歏1.0.1
+ * 淇敼璇存槑锛�
+ * 
+ *----------------------------------------------------------------*/
+#endregion << 鐗� 鏈� 娉� 閲� >>
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_BasicInfoRepository
+{
+    public interface IDt_BDCConfigurationRepository : IRepository<Dt_BDCConfiguration>
+    {
+
+    }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_IStorageBasicService/BasicInfo/IDt_BDCConfigurationService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_IStorageBasicService/BasicInfo/IDt_BDCConfigurationService.cs"
new file mode 100644
index 0000000..461e05c
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_IStorageBasicService/BasicInfo/IDt_BDCConfigurationService.cs"
@@ -0,0 +1,82 @@
+锘�#region << 鐗� 鏈� 娉� 閲� >>
+
+/*----------------------------------------------------------------
+ * 鍛藉悕绌洪棿锛歐IDESEAWCS_ITaskInfoService
+ * 鍒涘缓鑰咃細鑳$搴�
+ * 鍒涘缓鏃堕棿锛�2024/8/2 16:13:36
+ * 鐗堟湰锛歏1.0.0
+ * 鎻忚堪锛�
+ *
+ * ----------------------------------------------------------------
+ * 淇敼浜猴細
+ * 淇敼鏃堕棿锛�
+ * 鐗堟湰锛歏1.0.1
+ * 淇敼璇存槑锛�
+ *
+ *----------------------------------------------------------------*/
+
+#endregion << 鐗� 鏈� 娉� 閲� >>
+
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_BasicInfoService
+{
+    public interface IDt_BDCConfigurationService : IService<Dt_BDCConfiguration>
+    {
+        /// <summary>
+        /// 鑾峰彇褰撳墠鐢熸晥鐨勭紦瀛橀厤缃�
+        /// </summary>
+        Task<Dt_BDCConfiguration> GetCurrentConfiguration();
+
+        /// <summary>
+        /// 鏇存柊缂撳瓨閰嶇疆
+        /// </summary>
+        Task<Dt_BDCConfiguration> UpdateConfiguration(int maxWhiteBody, int maxPaintedBody,
+            int maxBatteryCase, int maxEmptySled, string updatedBy);
+
+        /// <summary>
+        /// 妫�鏌ョ櫧杞﹁韩鏄惁鍙互鍏ュ簱锛堟湭瓒呰繃鏈�澶х紦瀛樻暟锛�
+        /// </summary>
+        Task<bool> CanAddWhiteBody();
+
+        /// <summary>
+        /// 妫�鏌ュ僵杞﹁韩鏄惁鍙互鍏ュ簱锛堟湭瓒呰繃鏈�澶х紦瀛樻暟锛�
+        /// </summary>
+        Task<bool> CanAddPaintedBody();
+
+        /// <summary>
+        /// 妫�鏌ョ數姹犲3鏄惁鍙互鍏ュ簱锛堟湭瓒呰繃鏈�澶х紦瀛樻暟锛�
+        /// </summary>
+        //Task<bool> CanAddBatteryCase();
+
+        /// <summary>
+        /// 妫�鏌ョ┖婊戞﹪鏄惁鍙互鍏ュ簱锛堟湭瓒呰繃鏈�澶х紦瀛樻暟锛�
+        /// </summary>
+        Task<bool> CanAddEmptySled();
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠鐧借溅韬紦瀛樻暟閲�
+        /// </summary>
+        int GetWhiteBodyCount();
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠褰╄溅韬紦瀛樻暟閲�
+        /// </summary>
+        int GetPaintedBodyCount();
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠鐢垫睜澹崇紦瀛樻暟閲�
+        /// </summary>
+       int GetBatteryCaseCount();
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠绌烘粦姗囩紦瀛樻暟閲�
+        /// </summary>
+      int GetEmptySledCount();
+
+        /// <summary>
+        /// 鐢熸垚搴撳瓨瀹归噺鎶ュ憡
+        /// </summary>
+        //Task<InventoryCapacityReport> GenerateCapacityReport();
+    }
+}
\ No newline at end of file
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_Model/Models/BasicInfo/Dt_BDCConfiguration.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_Model/Models/BasicInfo/Dt_BDCConfiguration.cs"
new file mode 100644
index 0000000..5c5188d
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_Model/Models/BasicInfo/Dt_BDCConfiguration.cs"
@@ -0,0 +1,67 @@
+锘縰sing SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Model.Models
+{
+    /// <summary>
+    /// BDC缂撳瓨閰嶇疆锛屽瓨鍌ㄥ悇绫荤墿鏂欑殑鏈�澶х紦瀛樻暟閲忛檺鍒�
+    /// </summary>
+    [SugarTable(nameof(Dt_BDCConfiguration), "BDC缂撳瓨閰嶇疆")]
+    public class Dt_BDCConfiguration
+    {
+        [Key]
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 閰嶇疆鍚嶇О
+        /// </summary>
+        [Required]
+        [MaxLength(100)]
+        public string Name { get; set; } = "Default Configuration";
+
+        /// <summary>
+        /// 鐧借溅韬渶澶х紦瀛樻暟
+        /// </summary>
+        [Range(0, int.MaxValue)]
+        public int MaxWhiteBodyCache { get; set; } = 100;
+
+        /// <summary>
+        /// 褰╄溅韬渶澶х紦瀛樻暟
+        /// </summary>
+        [Range(0, int.MaxValue)]
+        public int MaxPaintedBodyCache { get; set; } = 100;
+
+        /// <summary>
+        /// 鐢垫睜澹虫渶澶х紦瀛樻暟
+        /// </summary>
+        [Range(0, int.MaxValue)]
+        public int MaxBatteryCaseCache { get; set; } = 50;
+
+        /// <summary>
+        /// 绌烘粦姗囨渶澶х紦瀛樻暟
+        /// </summary>
+        [Range(0, int.MaxValue)]
+        public int MaxEmptySledCache { get; set; } = 30;
+
+        /// <summary>
+        /// 鏈�鍚庢洿鏂版椂闂�
+        /// </summary>
+        public DateTime LastUpdatedTime { get; set; } = DateTime.Now;
+
+        /// <summary>
+        /// 鏇存柊浜�
+        /// </summary>
+        [MaxLength(50)]
+        public string UpdatedBy { get; set; } = "System";
+
+        /// <summary>
+        /// 鏄惁鍚敤
+        /// </summary>
+        public int IsActive { get; set; }
+    }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/removeWorkOrderInfo.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/removeWorkOrderInfo.cs"
index fbd7dda..d16860a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/removeWorkOrderInfo.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/removeWorkOrderInfo.cs"
@@ -8,8 +8,12 @@
 namespace WIDESEA_StoragIntegrationServices
 {
     /// <summary>
-    /// BDC璇锋眰鐒婅鐗瑰緛涓嬪彂
-    /// 鎺ュ彛鎻忚堪: 杞﹁韩杩涘叆BDC鏃讹紝BDC璇诲彇杞﹁韩涓婄殑涓�缁存潯鐮佸悜MES璇锋眰鐒婅鐗瑰緛淇℃伅
+    /// 璁㈠崟銆佸伐鍗曟挙鎺�
+    /// 鎺ュ彛鎻忚堪:閫氱煡BDC娑傝宸ュ崟/鎬昏宸ュ崟/璁㈠崟鎾ゆ帓
+    /// 1- 宸ュ崟/璁㈠崟鎾ゆ帓鏀寔閮ㄥ垎鎾ゆ帓
+    /// 2- 璇曞埗绫诲瀷宸ュ崟/璁㈠崟鎾ゆ帓BDC搴撳凡杩嘊DC03/BDC05宸ュ崟涓嶆敮鎸佹挙鎺�
+    /// 3-闈炶瘯鍒剁被鍨嬪伐鍗�/璁㈠崟鎾ゆ帓涓�鍙ョ粦瀹氱姸鎬侊紝宸插畬鎴愮粦瀹氱殑宸ュ崟/璁㈠崟涓嶆敮鎸佹挙鎺�
+    /// 4-鎬昏宸ュ崟宸叉媺鍔ㄩ攣杞︾殑杞﹁韩宸ュ崟涓嶆敮鎸佹挙鎺�
     /// </summary>
     public partial class MESService
     {
@@ -17,7 +21,7 @@
         {
             WebResponseContent content = new WebResponseContent();
             try
-            {   
+            {
 
 
                 return content.OK();
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicRepository/BasicInfo/Dt_BDCConfigurationRepository.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicRepository/BasicInfo/Dt_BDCConfigurationRepository.cs"
new file mode 100644
index 0000000..afe8875
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicRepository/BasicInfo/Dt_BDCConfigurationRepository.cs"
@@ -0,0 +1,28 @@
+锘�#region << 鐗� 鏈� 娉� 閲� >>
+/*----------------------------------------------------------------
+ * 鍛藉悕绌洪棿锛歐IDESEAWCS_TaskInfoRepository
+ * 鍒涘缓鑰咃細鑳$搴�
+ * 鍒涘缓鏃堕棿锛�2024/8/2 16:13:36
+ * 鐗堟湰锛歏1.0.0
+ * 鎻忚堪锛�
+ *
+ * ----------------------------------------------------------------
+ * 淇敼浜猴細
+ * 淇敼鏃堕棿锛�
+ * 鐗堟湰锛歏1.0.1
+ * 淇敼璇存槑锛�
+ * 
+ *----------------------------------------------------------------*/
+#endregion << 鐗� 鏈� 娉� 閲� >>
+
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_BasicInfoRepository
+{
+    public class Dt_BDCConfigurationRepository : RepositoryBase<Dt_BDCConfiguration>, IDt_BDCConfigurationRepository
+    {
+        public Dt_BDCConfigurationRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
+        {
+        }
+    }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/BasicInfo/Dt_BDCConfigurationService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/BasicInfo/Dt_BDCConfigurationService.cs"
new file mode 100644
index 0000000..210c6e1
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/BasicInfo/Dt_BDCConfigurationService.cs"
@@ -0,0 +1,109 @@
+锘縰sing WIDESEA_Common;
+using WIDESEA_IServices;
+using WIDESEAWCS_BasicInfoRepository;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_BasicInfoService
+{
+    public partial class Dt_BDCConfigurationService : ServiceBase<Dt_BDCConfiguration, IDt_BDCConfigurationRepository>, IDt_BDCConfigurationService
+    {
+        private readonly ISys_ConfigService _sys_ConfigService;
+        private readonly IDt_PalletStockInfoRepository _palletStockInfoRepository;
+
+        public Dt_BDCConfigurationService(IDt_BDCConfigurationRepository BaseDal, ISys_ConfigService sys_ConfigService, IDt_PalletStockInfoRepository palletStockInfoRepository) : base(BaseDal)
+        {
+            _sys_ConfigService = sys_ConfigService;
+            _palletStockInfoRepository = palletStockInfoRepository;
+        }
+
+        public async Task<Dt_BDCConfiguration> GetCurrentConfiguration()
+        {
+            // 鑾峰彇褰撳墠鐢熸晥鐨勯厤缃�
+            var currentConfig = await BaseDal.QueryFirstAsync(c => c.IsActive == 1);
+
+            // 濡傛灉娌℃湁閰嶇疆锛屽垱寤洪粯璁ら厤缃�
+            if (currentConfig == null)
+            {
+                currentConfig = new Dt_BDCConfiguration();
+                BaseDal.AddData(currentConfig);
+            }
+            return currentConfig;
+        }
+
+        public async Task<Dt_BDCConfiguration> UpdateConfiguration(int maxWhiteBody, int maxPaintedBody,
+           int maxBatteryCase, int maxEmptySled, string updatedBy)
+        {
+            // 绂佺敤褰撳墠閰嶇疆
+            var currentConfigs = await BaseDal.QueryDataAsync(c => c.IsActive == 1);
+
+            currentConfigs.ForEach(c => c.IsActive = 2);
+
+            // 鍒涘缓鏂伴厤缃�
+            var newConfig = new Dt_BDCConfiguration
+            {
+                MaxWhiteBodyCache = maxWhiteBody,
+                MaxPaintedBodyCache = maxPaintedBody,
+                MaxBatteryCaseCache = maxBatteryCase,
+                MaxEmptySledCache = maxEmptySled,
+                LastUpdatedTime = DateTime.Now,
+                UpdatedBy = updatedBy,
+                IsActive = 1
+            };
+
+            BaseDal.UpdateData(currentConfigs);
+            BaseDal.AddData(newConfig);
+            return newConfig;
+        }
+
+        public async Task<bool> CanAddWhiteBody()
+        {
+            var config = await GetCurrentConfiguration();
+            var currentCount =  GetWhiteBodyCount();
+
+            // 棰勭暀5%鐨勭紦鍐茬┖闂�
+            var threshold = (int)(config.MaxWhiteBodyCache * 0.95);
+            return currentCount < threshold;
+        }
+
+        public async Task<bool> CanAddPaintedBody()
+        {
+            var config = await GetCurrentConfiguration();
+            var currentCount =  GetPaintedBodyCount();
+
+            // 棰勭暀5%鐨勭紦鍐茬┖闂�
+            var threshold = (int)(config.MaxPaintedBodyCache * 0.95);
+            return currentCount < threshold;
+        }
+
+
+        public async Task<bool> CanAddEmptySled()
+        {
+            var config = await GetCurrentConfiguration();
+            var currentCount =  GetEmptySledCount();
+
+            // 棰勭暀5%鐨勭紦鍐茬┖闂�
+            var threshold = (int)(config.MaxEmptySledCache * 0.95);
+            return currentCount < threshold;
+        }
+
+        public int GetWhiteBodyCount()
+        {
+            return _palletStockInfoRepository.QueryData(b => b.CarType == (int)BodyType.WhiteBody && b.StockStatus == (int)BodyStatus.InBDC).Count;
+        }
+
+        public int GetPaintedBodyCount()
+        {
+            return  _palletStockInfoRepository.QueryData(b => b.CarType == (int)BodyType.PaintedBody && b.StockStatus == (int)BodyStatus.InBDC).Count;
+        }
+
+        public int GetBatteryCaseCount()
+        {
+            return _palletStockInfoRepository.QueryData(b => b.StockStatus == (int)BodyStatus.InBDC).Count;
+        }
+
+        public int GetEmptySledCount()
+        {
+            return _palletStockInfoRepository.QueryData(s => s.StockStatus == (int)BodyStatus.InBDC).Count;
+        }
+    }
+}
\ No newline at end of file
diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\241\271\347\233\256\345\233\276\347\272\270/\351\233\266\350\267\221\351\207\221\345\215\216\345\233\233\345\216\202BDC4\345\267\267\351\201\223\346\226\271\346\241\21020250829.dwg" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\241\271\347\233\256\345\233\276\347\272\270/\351\233\266\350\267\221\351\207\221\345\215\216\345\233\233\345\216\202BDC4\345\267\267\351\201\223\346\226\271\346\241\21020250829.dwg"
new file mode 100644
index 0000000..31ce2f0
--- /dev/null
+++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\241\271\347\233\256\345\233\276\347\272\270/\351\233\266\350\267\221\351\207\221\345\215\216\345\233\233\345\216\202BDC4\345\267\267\351\201\223\346\226\271\346\241\21020250829.dwg"
Binary files differ

--
Gitblit v1.9.3