From c3202f7d43746c084066d88e58913d85c0173d88 Mon Sep 17 00:00:00 2001
From: 杨张扬 <634643841@qq.com>
Date: 星期五, 13 六月 2025 17:14:42 +0800
Subject: [PATCH] 双钱-需求变更,增加复检合格物料自动搬送流程

---
 wms/SpecHelper.cs |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/wms/SpecHelper.cs b/wms/SpecHelper.cs
index 7779c2a..257bb58 100644
--- a/wms/SpecHelper.cs
+++ b/wms/SpecHelper.cs
@@ -77,7 +77,7 @@
                 var log = JsonConvert.SerializeObject(model);
                 if (model != null)
                 {
-                    model.EXPIRATION = System.DateTime.Now.AddMinutes(GetExportTime(model.SPEC));
+                    model.EXPIRATION = System.DateTime.Now.AddHours(GetExportTime(model.SPEC));
 
                     if (db.Insertable<TN_EquipProDetail>(model).ExecuteCommand() > 0)
                     {
@@ -326,7 +326,7 @@
                     {
                         db.Deleteable<TN_InventoryM>(target).ExecuteCommand();
                     }
-                    model.EXPIRATION = System.DateTime.Now.AddMinutes(GetExportTime(model.SPEC));
+                    model.EXPIRATION = System.DateTime.Now.AddHours(GetExportTime(model.SPEC));
                     if (db.Insertable<TN_InventoryM>(model).ExecuteCommand() > 0)
                     {
                         LogHelper.Info($"鎻掑叆WMS搴撳瓨鏄庣粏鎴愬姛锛寋log}");
@@ -354,7 +354,7 @@
                 var target = db.Queryable<TN_CG_Detail>().First(a => a.S_CNTR_CODE == cntId);
                 if (target != null)
                 {
-                    var targetM = db.Queryable<TN_InventoryM>().First(a => a.S_ID == target.S_ID);
+                    var targetM = db.Queryable<TN_InventoryM>().First(a => a.S_ID == target.S_ID || a.RFID == cntId);
 
                     if (targetM != null)
                     {
@@ -403,10 +403,16 @@
             }
             catch (Exception ex)
             {
-                LogHelper.Error("鏇存柊WMS搴撳瓨鏄庣粏鐨勮繃鏈熸椂闂村け璐�, ex);
+                LogHelper.Error("鍒犻櫎WMS搴撳瓨鏄庣粏", ex);
             }
         }
 
+        /// <summary>
+        /// 璁$畻鏃堕棿宸�+        /// </summary>
+        /// <param name="start"></param>
+        /// <param name="end"></param>
+        /// <returns></returns>
         public static int CalculateDaysDifference(DateTime start, DateTime end)
         {
             try
@@ -420,11 +426,12 @@
                     return 0;
                 }
 
-                // 鑾峰彇鎬诲ぉ鏁帮紙鍖呮嫭灏忔暟閮ㄥ垎锛�-                double totalDays = difference.TotalDays;
+
+                // 鑾峰彇鎬诲皬鏃舵暟锛堝寘鎷皬鏁伴儴鍒嗭級
+                double totalHours = difference.TotalHours;
 
                 // 鍚戜笂鍙栨暣
-                return (int)Math.Ceiling(totalDays);
+                return (int)Math.Ceiling(totalHours);
             }
             catch (Exception ex)
             {

--
Gitblit v1.9.1