From 958bc4d177f7ddd0560b48dedd845833197513cc Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期五, 16 一月 2026 13:37:54 +0800
Subject: [PATCH] 代码优化

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockInfoDetailWithPalletDto.cs |    2 ++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_CheckService/ReCheckOrderService.cs       |   24 ++++++++++++++++++------
 项目代码/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue                       |    7 +++++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs        |    4 ++--
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs          |    2 +-
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs            |    6 +++++-
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs    |    5 ++++-
 7 files changed, 39 insertions(+), 11 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue"
index 1969c39..d0d612f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue"
@@ -193,6 +193,13 @@
         bind: { key: "stockStatusEmun", data: [] },
       },
       {
+        field: "validDate",
+        title: "鏈夋晥鏈�",
+        type: "datetime",
+        width: 160,
+        align: "left",
+      },
+      {
         field: "creater",
         title: "鍒涘缓浜�",
         type: "string",
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_CheckService/ReCheckOrderService.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_CheckService/ReCheckOrderService.cs"
index 02f8616..35d8435 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_CheckService/ReCheckOrderService.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_CheckService/ReCheckOrderService.cs"
@@ -2,9 +2,11 @@
 using Microsoft.Extensions.Logging;
 using Newtonsoft.Json;
 using SqlSugar;
+using StackExchange.Profiling.Internal;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection.Metadata;
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEA_Common.OrderEnum;
@@ -124,37 +126,47 @@
                 if (model.Result == 1 && recheckOrder.SignSeq != model.SignSeq)
                 {
                     var stockDetailIds = BaseDal.Db.Queryable<Dt_StockInfoDetail>()
-                    .Where(x => x.MaterielCode == model.MaterielCode && x.BatchNo == model.BatchNo && x.ValidDate != null && x.Status == (int)StockStatusEmun.鎵嬪姩鍐荤粨)
+                    .Where(x => x.MaterielCode == model.MaterielCode && x.BatchNo == model.BatchNo && x.ValidDate != null && (x.Status == (int)StockStatusEmun.鎵嬪姩鍐荤粨 ||x.Status == (int)StockStatusEmun.閲嶆涓�))
                     .Select(x => x.Id)
                     .ToList();
 
                     if (stockDetailIds.Count > 0)
                     {
                         var datevaliDate = BaseDal.Db.Queryable<Dt_MaterialExpirationDate>().Where(x => x.MaterialCode.Contains(model.MaterielCode.Substring(0, 6))).First();
-
+                        if(datevaliDate == null)
+                        {
+                            return WebResponseContent.Instance.Error($"璇ョ墿鏂欐湭鎵惧埌MES鎺ㄩ�佺殑鏈夋晥鏈熸暟鎹紝璇峰厛鎺ㄩ�佽鐗╂枡鐨勬湁鏁堟湡鏁版嵁");
+                        }
                         BaseDal.Db.Updateable<Dt_StockInfoDetail>()
                             .SetColumns(x => x.Status == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt())
-                            .Where(x => stockDetailIds.Contains(x.Id))
+                            .Where(x => stockDetailIds.Contains(x.Id) && x.Status == (int)StockStatusEmun.鎵嬪姩鍐荤粨)
                             .ExecuteCommand();
+
+                        //璁$畻褰撳墠澶嶆鍗曟嵁缁撴灉鏃堕棿
+                        DateTime newDate;
 
                         if (1 == reCheckOrders.Count())
                         {
+                            //鍗曟嵁缁撴灉鎺ㄩ�佹椂闂�+鐗╂枡澶嶆寤堕暱鏃堕棿涓庢湁鏁堟湡鍋氬姣旓紝璋佸ぇ鍙栬皝
+                            newDate = Convert.ToDateTime(DateTime.Now).AddDays(Convert.ToDouble(datevaliDate.OneExtensionDays));
                             BaseDal.Db.Updateable<Dt_StockInfoDetail>()
-                            .SetColumns(x => x.ValidDate == Convert.ToDateTime(x.ValidDate).AddDays(Convert.ToDouble(datevaliDate.OneExtensionDays)))
+                            .SetColumns(x => x.ValidDate == SqlFunc.IIF(x.ValidDate > newDate, x.ValidDate, newDate))
                             .Where(x => stockDetailIds.Contains(x.Id))
                             .ExecuteCommand();
                         }
                         else if (2 == reCheckOrders.Count())
                         {
+                            newDate = Convert.ToDateTime(DateTime.Now).AddDays(Convert.ToDouble(datevaliDate.TwoExtensionDays));
                             BaseDal.Db.Updateable<Dt_StockInfoDetail>()
-                            .SetColumns(x => x.ValidDate == Convert.ToDateTime(x.ValidDate).AddDays(Convert.ToDouble(datevaliDate.TwoExtensionDays)))
+                            .SetColumns(x => x.ValidDate == SqlFunc.IIF(x.ValidDate > newDate, x.ValidDate, newDate))
                             .Where(x => stockDetailIds.Contains(x.Id))
                             .ExecuteCommand();
                         }
                         else if (3 == reCheckOrders.Count())
                         {
+                            newDate = Convert.ToDateTime(DateTime.Now).AddDays(Convert.ToDouble(datevaliDate.ThreeExtensionDays));
                             BaseDal.Db.Updateable<Dt_StockInfoDetail>()
-                            .SetColumns(x => x.ValidDate == Convert.ToDateTime(x.ValidDate).AddDays(Convert.ToDouble(datevaliDate.ThreeExtensionDays)))
+                            .SetColumns(x => x.ValidDate == SqlFunc.IIF(x.ValidDate > newDate, x.ValidDate, newDate))
                             .Where(x => stockDetailIds.Contains(x.Id))
                             .ExecuteCommand();
                         }
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_DTO/Stock/StockInfoDetailWithPalletDto.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_DTO/Stock/StockInfoDetailWithPalletDto.cs"
index 33fed9b..07309b1 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_DTO/Stock/StockInfoDetailWithPalletDto.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_DTO/Stock/StockInfoDetailWithPalletDto.cs"
@@ -36,5 +36,7 @@
         // 涓昏〃鎵樼洏缂栧彿锛堝墠绔渶鏄剧ず鐨勫瓧娈碉級
         public string PalletCode { get; set; }
         public string LocationCode { get; set; }
+
+        public DateTime? ValidDate { get; set; }
     }
 }
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 700891d..355709d 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"
@@ -790,7 +790,7 @@
                 Dt_ReCheckOrder reCheckOrder = _stockInfoRepository.Db.Queryable<Dt_ReCheckOrder>().Where(x => x.MaterielCode == stockInfoDetail.MaterielCode && x.BatchNo == stockInfoDetail.BatchNo && x.OrderNo == stockInfoDetail.OrderNo && (x.Result == 1 || x.Result == 2 )).First();
                 if(reCheckOrder == null)
                 {
-                    return content.Error($"璇ラ噸妫�鏉$爜鐨勬壒娆″湪閲嶆鍗曚腑鏈嬁鍒伴噸妫�缁撴灉锛岃妫�娴嬮噸妫�鍗晎reCheckOrder.OrderNo}鐘舵��");
+                    return content.Error($"璇ラ噸妫�鏉$爜鐨勬壒娆″湪閲嶆鍗曚腑鏈嬁鍒伴噸妫�缁撴灉锛岃妫�鏌ラ噸妫�鍗曚腑鐗╂枡{stockInfoDetail.MaterielCode}鍜寋stockInfoDetail.BatchNo}鐗╂枡鎵规鐘舵��");
                 }
 
                 int newStatus = reCheckOrder.Result == 1 ? StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(): StockStatusEmun.鎵嬪姩鍐荤粨.ObjToInt();
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_OutboundService/OutboundService.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_OutboundService/OutboundService.cs"
index 9caca85..14ca9ad 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_OutboundService/OutboundService.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_OutboundService/OutboundService.cs"
@@ -491,7 +491,7 @@
                 x => request.StockDetailIds.Contains(x.Id)
                 && x.MaterielCode == materielCalc.MaterielCode
                 && x.StockQuantity > 0
-                && (x.Status == (int)StockStatusEmun.鍏ュ簱瀹屾垚 || x.Status == (int)StockStatusEmun.鎵嬪姩鍐荤粨)|| x.Status == (int)StockStatusEmun.鎵嬪姩瑙i攣);
+                && (x.Status == (int)StockStatusEmun.鍏ュ簱瀹屾垚 || x.Status == (int)StockStatusEmun.鎵嬪姩鍐荤粨 || x.Status == (int)StockStatusEmun.鎵嬪姩瑙i攣 || x.Status == (int)StockStatusEmun.杩囨湡));
 
             if (!specifiedStockDetails.Any())
             {
@@ -2042,7 +2042,7 @@
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒拌寰呴噸鎷g殑鍗曟嵁{pickingDTO.orderNo}");
                 }
-                Dt_StockInfoDetail stockInfoDetail = _stockDetailRepository.QueryFirst(x=>x.Barcode == pickingDTO.barCode && x.Status == StockStatusEmun.鎵嬪姩鍐荤粨.ObjToInt());
+                Dt_StockInfoDetail stockInfoDetail = _stockDetailRepository.QueryFirst(x=>x.Barcode == pickingDTO.barCode && x.Status == StockStatusEmun.鎵嬪姩鍐荤粨.ObjToInt() );
                 if(stockInfoDetail == null)
                 {
                     return WebResponseContent.Instance.Error($"鏈湪搴撳瓨涓壘鍒拌鍐荤粨/闅旂鏉$爜 {pickingDTO.barCode}");
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/StockInfoDetailService.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/StockInfoDetailService.cs"
index 14763de..37acfdf 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/StockInfoDetailService.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/StockInfoDetailService.cs"
@@ -120,7 +120,10 @@
                  Modifier = detail.Modifier,
                  ModifyDate = detail.ModifyDate,
                  PalletCode = item.PalletCode,
-                 LocationCode = item.LocationCode
+                 LocationCode = item.LocationCode,
+                 ValidDate = detail.ValidDate,
+
+
              })
              .ToPageList(options.Page, options.Rows, ref totalCount);
 
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 5298302..5a6c56d 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"
@@ -746,7 +746,11 @@
                 var beforelocationStatus = locationInfo.LocationStatus;
                 locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
                 _locationInfoService.Repository.UpdateData(locationInfo);
-
+                stockInfo.Details.ForEach(x =>
+                {
+                    x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+                });
+                _stockService.StockInfoDetailService.Repository.UpdateData(stockInfo.Details);
                 stockInfo.LocationCode = locationInfo.LocationCode;
                 stockInfo.PalletCode = task.PalletCode;
                 stockInfo.LocationCode = task.TargetAddress;

--
Gitblit v1.9.3