From 5f0b86328b2678a326166e84b461e9ede3dc4715 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期一, 01 十二月 2025 21:03:46 +0800
Subject: [PATCH] 提交

---
 项目代码/WIDESEA_WMSClient/src/extension/check/extend/StockSelect.vue                         |    4 +-
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs |    9 ++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs                   |   33 +++++++++++-----
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs            |   11 ++++-
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs                     |    7 ++-
 5 files changed, 46 insertions(+), 18 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/check/extend/StockSelect.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/check/extend/StockSelect.vue"
index ae450b1..388b79d 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/check/extend/StockSelect.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/check/extend/StockSelect.vue"
@@ -224,10 +224,10 @@
     
     // 鍥哄畾鏌ヨ绔嬪簱搴撳瓨
     getData() {
-      const url = "api/StockInfo/GetStockSelectViews?materielCode=";
+      const url = "api/StockInfo/GetSelectViewDTOs?materielCode=";
       this.http
         .post(
-          url + this.row.materielCode + "&orderId=" + this.row.id,
+          url + this.row.materielCode + "&orderNo=" + this.row.orderNo,
           null,
           "鏌ヨ涓�"
         )
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_StockService/StockInfoService.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_StockService/StockInfoService.cs"
index 81e4e71..3142415 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_StockService/StockInfoService.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_StockService/StockInfoService.cs"
@@ -283,6 +283,10 @@
         public List<StockSelectViewDTO> GetSelectViewDTOs(string orderNo,string materielCode)
         {
             var outboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == orderNo).First();
+            if(outboundOrder == null)
+            {
+                throw new Exception($"鏈壘鍒板崟鎹紪鍙蜂负{orderNo}鐨勫嚭搴撳崟淇℃伅");
+            }
             return GetStockSelectViews(outboundOrder.Id, materielCode);
         }
 
@@ -315,22 +319,29 @@
                     .Includes(x => x.Details);
 
                 // 鎵ц鏌ヨ骞舵寜鍏堣繘鍏堝嚭鎺掑簭
-                var stocks = stockQuery.ToList()
-                    .Where(x => x.Details.Any(d =>
-                        d.MaterielCode == materielCode && 
-                        string.IsNullOrEmpty(orderDetail.BatchNo)?true: d.BatchNo == orderDetail.BatchNo&&
-                        string.IsNullOrEmpty(orderDetail.BatchNo)?true:d.SupplyCode == orderDetail.SupplyCode &&
-                        d.StockQuantity > d.OutboundQuantity
-                    ))
-                    .OrderBy(x => x.CreateDate)
-                    .ToList();
+                var Qstocks = stockQuery.Where(x => x.Details.Any(d => d.MaterielCode == materielCode &&d.StockQuantity > d.OutboundQuantity));
+
+                if (!string.IsNullOrEmpty(orderDetail.BatchNo))
+                {
+
+                    Qstocks = stockQuery.Where(x => x.Details.Any(d => d.BatchNo == orderDetail.BatchNo));
+
+                }
+                if (!string.IsNullOrEmpty(orderDetail.SupplyCode))
+                {
+
+                    Qstocks = stockQuery.Where(x => x.Details.Any(d => d.SupplyCode == orderDetail.SupplyCode));
+
+                }
+
+              var stocks=  Qstocks.OrderBy(x => x.CreateDate) .ToList();
 
                 foreach (var stock in stocks)
                 {
                     var relevantDetails = stock.Details
                         .Where(d => d.MaterielCode == materielCode &&
                                    string.IsNullOrEmpty(orderDetail.BatchNo) ? true : d.BatchNo == orderDetail.BatchNo &&
-                                   string.IsNullOrEmpty(orderDetail.BatchNo) ? true : d.SupplyCode == orderDetail.SupplyCode &&
+                                   string.IsNullOrEmpty(orderDetail.SupplyCode) ? true : d.SupplyCode == orderDetail.SupplyCode &&
                                    d.StockQuantity > d.OutboundQuantity)
                         .ToList();
 
@@ -342,7 +353,7 @@
                         result.Add(new StockSelectViewDTO
                         {
                             LocationCode = stock.LocationCode,
-                            MaterielCode = materielCode,
+                            MaterielCode = firstDetail.  MaterielCode,
                             MaterielName = firstDetail.MaterielName,
                             BatchNo = orderDetail.BatchNo,
                             SupplyCode = orderDetail.SupplyCode,
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_TaskInfoService/TaskService.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_TaskInfoService/TaskService.cs"
index 6e8308a..04a0dbf 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_TaskInfoService/TaskService.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_TaskInfoService/TaskService.cs"
@@ -51,6 +51,7 @@
 using WIDESEA_IStockService;
 using WIDESEA_ITaskInfoService;
 using WIDESEA_Model.Models;
+using WIDESEA_Model.Models.Check;
 using WIDESEA_Model.Models.Outbound;
 
 namespace WIDESEA_TaskInfoService
@@ -66,6 +67,7 @@
         private readonly IInboundOrderService _inboundOrderService;
         private readonly IInboundOrderDetailService _inboundOrderDetailService;
 
+        private readonly IRepository<Dt_ReCheckOrder> _reCheckOrderRepository;
         private readonly IRepository<Dt_OutboundBatch> _OutboundBatchRepository;
         private readonly IOutboundOrderService _outboundOrderService;
         private readonly IOutboundOrderDetailService _outboundOrderDetailService;
@@ -95,7 +97,7 @@
 
         public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList();
 
-        public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository) : base(BaseDal)
+        public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository,IRepository<Dt_ReCheckOrder> reCheckOrderRepository) : base(BaseDal)
         {
             _mapper = mapper;
             _unitOfWorkManage = unitOfWorkManage;
@@ -114,6 +116,7 @@
             _outStockLockInfoService = outStockLockInfoService;
             _allocateService = allocateService;
             _OutboundBatchRepository = outboundBatchRepository;
+            _reCheckOrderRepository = reCheckOrderRepository;
         }
 
 
@@ -629,7 +632,7 @@
                         {
                             ReqCode = Guid.NewGuid().ToString(),
                             ReqTime = DateTime.Now.ToString(),
-                            BusinessType = "3",
+                            BusinessType = "2",
                             FactoryArea = outboundOrder.FactoryArea,
                             OperationType = 1,
                             Operator = outboundOrder.Operator,
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_TaskInfoService/TaskService_Outbound.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_TaskInfoService/TaskService_Outbound.cs"
index 338279e..8f26611 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_TaskInfoService/TaskService_Outbound.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_TaskInfoService/TaskService_Outbound.cs"
@@ -19,6 +19,7 @@
 using WIDESEA_DTO.Stock;
 using WIDESEA_Model.Models;
 using WIDESEA_Model.Models.Basic;
+using WIDESEA_Model.Models.Check;
 using WIDESEA_Model.Models.Outbound;
 
 namespace WIDESEA_TaskInfoService
@@ -476,7 +477,7 @@
             }
         }
 
-
+       
         /// <summary>
         /// 鐢熸垚鍑哄簱浠诲姟
         /// </summary>
@@ -487,7 +488,13 @@
         {
             try
             {
-                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(orderDetailId, stockSelectViews);
+                var orderNo = _reCheckOrderRepository.Db.Queryable<Dt_ReCheckOrder>().First(x => x.Id == orderDetailId)?.OrderNo;
+               var outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().Includes(x => x.Details).First(x => x.UpperOrderNo == orderNo);
+                if(outboundOrder == null)
+                {
+                    return WebResponseContent.Instance.Error("鎵句笉鍒板崟鎹�");
+                }
+                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(outboundOrder.Details.First().Id, stockSelectViews);
 
                 WebResponseContent content = GenerateOutboundTaskDataUpdate(result.Item1, result.Item2, result.Item3, result.Item4, result.Item5);
 
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/Stock/StockInfoController.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/Stock/StockInfoController.cs"
index d3fcdff..880b502 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/Stock/StockInfoController.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/Stock/StockInfoController.cs"
@@ -40,7 +40,14 @@
         [HttpPost, HttpGet, Route("GetSelectViewDTOs"), AllowAnonymous]
         public List<StockSelectViewDTO> GetSelectViewDTOs(string orderNo, string materielCode)
         {
-            return Service.GetSelectViewDTOs(orderNo, materielCode);
+            try
+            {
+                return Service.GetSelectViewDTOs(orderNo, materielCode);
+            }
+            catch(Exception ex)
+            {
+                return new List<StockSelectViewDTO>();
+            }
         }
     }
 }

--
Gitblit v1.9.3