From 3b3ff1836b8837ffd541cc7eefde8d5e5d195110 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期四, 18 十二月 2025 16:32:13 +0800
Subject: [PATCH] 1

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundController.cs |   11 +++++
 项目代码/WIDESEA_WMSClient/src/extension/inbound/Dt_AllocateOrder.js                          |    2 
 项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/AllcatedPallet.vue                    |    2 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs                   |   92 +++++++++++++++++++++++++++++++++++++++++++++
 项目代码/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js                              |    2 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundService.cs                 |    9 ++++
 6 files changed, 114 insertions(+), 4 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/Dt_AllocateOrder.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/Dt_AllocateOrder.js"
index 1607c90..add6a92 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/Dt_AllocateOrder.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/Dt_AllocateOrder.js"
@@ -4,7 +4,7 @@
 import { h,createVNode, render,reactive,ref  } from 'vue';
 import { ElDialog , ElForm, ElFormItem, ElInput, ElButton, ElMessage ,ElSelect ,ElOption } from 'element-plus'; // 寮曞叆ElMessage锛岃В鍐虫彁绀烘棤鍙嶅簲
 import gridBody from './extend/allocateOrderDetail.vue'
-import gridHeader from './extend/Pallet.vue'
+import gridHeader from './extend/AllcatedPallet.vue'
 let extension = {
     components: {
       //鏌ヨ鐣岄潰鎵╁睍缁勪欢
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllcatedPallet.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllcatedPallet.vue"
index d401f8b..7706fbe 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllcatedPallet.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllcatedPallet.vue"
@@ -681,7 +681,7 @@
     // API璇锋眰 - 鏇挎崲涓哄疄闄呯殑API璋冪敤
     async fetchMaterialData(barcode) {
       try {
-        const response = await http.post('/api/Inbound/GroupPallet',
+        const response = await http.post('/api/Inbound/AllGroupPallet',
           {
             palletCode: this.trayBarcode,
             barcode: barcode,
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
index 0afde7a..9b7a790 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
@@ -1,6 +1,6 @@
 //姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜
 import gridHeader from './extend/EmptyTrayInbound.vue'
-import gridBody from './extend/AllcatedPallet.vue'
+import gridBody from './extend/Pallet.vue'
 let extension = {
   components: {
     //鏌ヨ鐣岄潰鎵╁睍缁勪欢
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundService.cs"
index 2b55554..f21ad9b 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundService.cs"
@@ -20,5 +20,14 @@
         /// <param name="palletDto"></param>
         /// <returns></returns>
         Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto);
+
+
+        /// <summary>
+        /// 璋冩嫧缁勭洏
+        /// </summary>
+        /// <param name="palletDto"></param>
+        /// <returns></returns>
+        Task<WebResponseContent> AllcatedGroupPallet(GroupPalletDto palletDto);
+
     }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs"
index 75a8640..a950a3a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs"
@@ -34,8 +34,9 @@
         private readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository;
         private readonly IRepository<Dt_Task> _taskRepository;
         private IStockService _stockService;
+        private readonly IRepository<Dt_AllocateMaterialInfo> _allocateMaterialInfo;
 
-        public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository)
+        public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo)
         {
             _unitOfWorkManage = unitOfWorkManage;
             InboundOrderDetailService = inboundOrderDetailService;
@@ -47,6 +48,7 @@
             _inboundOrderDetailRepository = inboundOrderDetailRepository;
             _stockService = stockService;
             _taskRepository = taskRepository;
+            _allocateMaterialInfo = allocateMaterialInfo;
         }
 
         public async Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto)
@@ -156,6 +158,94 @@
             return content;
         }
 
+        public async Task<WebResponseContent> AllcatedGroupPallet(GroupPalletDto palletDto)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                (bool, string, object?) result2 = ModelValidate.ValidateModelData(palletDto);
+                if (!result2.Item1) return content.Error(result2.Item2);
+
+                var code = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().Where(x => x.Code == palletDto.WarehouseType).Select(x => x.Code).First();
+                if (string.IsNullOrEmpty(code))
+                {
+                    return content.Error($"浠撳簱涓病鏈夎{palletDto.WarehouseType}缂栧彿銆�");
+                }
+
+                Dt_StockInfo? stockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync();
+
+                if (_taskRepository.QueryFirst(x => x.PalletCode == palletDto.PalletCode) != null)
+                {
+                    return content.Error($"璇ユ墭鐩樺凡鐢熸垚浠诲姟");
+                }
+                if (stockInfo != null && !string.IsNullOrEmpty(stockInfo.LocationCode) && stockInfo.StockStatus != (int)StockStatusEmun.缁勭洏鏆傚瓨)
+                {
+                    return content.Error("宸蹭笂鏋剁殑鎵樼洏涓嶈兘鍐嶆缁勭洏");
+                }
+
+                if (_stockService.StockInfoDetailService.ExistBarcodes(palletDto.Barcode))
+                {
+                    return content.Error($"{palletDto.Barcode} 鏉$爜鍦ㄥ簱瀛樹腑宸插瓨鍦�");
+                }
+
+                if (stockInfo == null)
+                {
+                    stockInfo = new Dt_StockInfo() { PalletType = (int)PalletTypeEnum.None, LocationType = Convert.ToInt32(palletDto.locationType) };
+                    stockInfo.Details = new List<Dt_StockInfoDetail>();
+                }
+
+                if (stockInfo != null && stockInfo.Details.Count > 0 && stockInfo.Details.FirstOrDefault()?.WarehouseCode != palletDto.WarehouseType)
+                {
+                    return content.Error($"璇ユ墭鐩樼粍鐩樹粨搴撲负{stockInfo.Details.FirstOrDefault()?.WarehouseCode}涓庡綋鍓嶄粨搴搟palletDto.WarehouseType}涓嶄竴鑷达紝涓嶅厑璁哥粍鐩�");
+                }
+                Dt_AllocateMaterialInfo allocateMaterialInfo = _allocateMaterialInfo.QueryFirst(x => x.Barcode == palletDto.Barcode);
+                if(allocateMaterialInfo == null)
+                {
+                    return content.Error($"鏈壘鍒拌鏉$爜{palletDto.Barcode}闇�璋冨叆鏅轰粨鐨勪俊鎭�");
+                }
+
+                stockInfo.Details.Add(new Dt_StockInfoDetail
+                {
+                    StockId = stockInfo == null ? 0 : stockInfo.Id,
+                    Barcode = allocateMaterialInfo.Barcode,
+                    MaterielCode = allocateMaterialInfo.MaterialCode,
+                    BatchNo = allocateMaterialInfo.BatchNo,
+                    Unit = allocateMaterialInfo.Unit,
+                    SupplyCode = allocateMaterialInfo.SupplyCode,
+                    WarehouseCode = palletDto.WarehouseType,
+                    StockQuantity = allocateMaterialInfo.Quantity,
+                    BarcodeQty = allocateMaterialInfo.Quantity,
+                    BarcodeUnit = allocateMaterialInfo.Unit,
+                    FactoryArea = allocateMaterialInfo.FactoryArea,
+                    Status = 0,
+                    OrderNo = allocateMaterialInfo.OrderNo,
+                    BusinessType = "1",
+
+                });
+
+                if (stockInfo.Id == 0)
+                {
+                    stockInfo.PalletCode = palletDto.PalletCode;
+                    stockInfo.StockStatus = (int)StockStatusEmun.缁勭洏鏆傚瓨;
+                }
+                stockInfo.PalletType = (int)PalletTypeEnum.None;
+                _unitOfWorkManage.BeginTran();
+                _stockService.StockInfoService.AddMaterielGroup(stockInfo);
+                _unitOfWorkManage.CommitTran();
+
+                Dt_StockInfo? NewstockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync();
+
+                return WebResponseContent.Instance.OK(data: NewstockInfo.Details.OrderByDescending(x => x.Id));
+
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                LogFactory.GetLog($"缁勭洏淇℃伅").Info(true, $"銆愬紓甯搞�戯細銆恵ex.Message}銆憑Environment.NewLine}銆恵ex.StackTrace}銆憑Environment.NewLine}{Environment.NewLine}");
+                return content.Error(ex.Message);
+            }
+        }
+
         /// <summary>
         /// 楠岃瘉缁勭洏鏁版嵁
         /// </summary>
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundController.cs"
index df6c7a3..73a3a98 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundController.cs"
@@ -28,5 +28,16 @@
         {
             return await Service.GroupPallet(palletDto);
         }
+
+        /// <summary>
+        /// 璋冩嫧缁勭洏
+        /// </summary>
+        /// <param name="palletDto"></param>
+        /// <returns></returns>
+        [HttpPost, Route("AllGroupPallet"), AllowAnonymous]
+        public async Task<WebResponseContent> AllGroupPallet([FromBody] GroupPalletDto palletDto)
+        {
+            return await Service.AllcatedGroupPallet(palletDto);
+        }
     }
 }

--
Gitblit v1.9.3