From 5610ce8f05f45e8da7bffa286c6db5c61ea06a79 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 16 十月 2025 17:00:12 +0800
Subject: [PATCH] 改为按采集时间查询采集数

---
 Services/MesOrderStaManager.cs |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/Services/MesOrderStaManager.cs b/Services/MesOrderStaManager.cs
index 625be1a..89adf53 100644
--- a/Services/MesOrderStaManager.cs
+++ b/Services/MesOrderStaManager.cs
@@ -104,15 +104,18 @@
         // 濡傛灉鏍囪涓�1,闇�瑕佸鐞嗛妫�鐩稿叧閫昏緫
         if (entity.Flag == 1)
         {
-            // 璋冪敤瀛樺偍杩囩▼鎵ц鑷姩棣栨
-            // Db.Ado.ExecuteCommand(
-            //     "BEGIN AUTOMATIC_IPQC_FIRST_CHECK(:BILL_NO); END;",
-            //     new SugarParameter("BILL_NO", womdaa.Daa001,
-            //         DbType.String));
+            //璋冪敤瀛樺偍杩囩▼鎵ц鑷姩棣栨
+             Db.Ado.ExecuteCommand(
+                 "BEGIN AUTOMATIC_IPQC_FIRST_CHECK(:BILL_NO); END;",
+                 new SugarParameter("BILL_NO", womdaa.Daa001, System.Data.DbType.String));
             var automaticIpqcFirstCheck =
                 mesQaItemsDetect02Manager
                     .AutomaticIpqcFirstCheck(womdaa.Daa001);
-            if (!automaticIpqcFirstCheck) throw new Exception("棣栨鐢熸垚澶辫触");
+            if (!automaticIpqcFirstCheck)
+            {
+                Console.WriteLine($"鑷姩棣栨澶辫触锛屽伐鍗曞彿锛歿womdaa.Daa001}");
+                throw new Exception("棣栨鐢熸垚澶辫触");
+            }
 
             // 鑾峰彇褰撳墠鏃堕棿
             var s1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
@@ -135,7 +138,7 @@
         var editDate = DateTime.Now.ToString("yyyy-MM-dd");
 
         // 鍙戦�丠TTP璇锋眰鍒版暟鎹埛鏂版帴鍙�
-        MesNumerical mesNumerical = null;
+        MesNumericalBycl mesNumerical = null;
         try
         {
             using (var httpClient = new HttpClient())
@@ -162,7 +165,7 @@
                     if (responseObj != null && responseObj.code == 200)
                     {
                         // 璇锋眰鎴愬姛锛岃幏鍙朚esNumerical鏁版嵁
-                        mesNumerical = Db.Queryable<MesNumerical>()
+                        mesNumerical = Db.Queryable<MesNumericalBycl>()
                             .Where(s => s.EditDate == editDate
                                         && s.MachineNo == entity.MachineNo)
                             .OrderByDescending(s => s.Id)
@@ -201,6 +204,12 @@
             // 濡傛灉鏈夐�佹鏃堕棿鍒欐洿鏂�
             .SetColumnsIF(entity.MaShoutTime != null,
                 s => s.MaShoutTime == entity.MaShoutTime)
+            // 濡傛灉鏈夎皟鏈哄紑濮嬫椂闂村垯鏇存柊
+            .SetColumnsIF(entity.MaStartTime != null,
+                s => s.MaStartTime == entity.MaStartTime)
+            // 濡傛灉鏈夎皟鏈哄畬鎴愭椂闂村垯鏇存柊
+            .SetColumnsIF(entity.MaEndTime != null,
+                s => s.MaEndTime == entity.MaEndTime)
             // 濡傛灉鏍囪涓�1鍒欐洿鏂板娉ㄤ俊鎭�
             .SetColumnsIF(entity.Flag == 1,
                 s => s.remark == "浜�" + entity.MaShoutTime + "鏃堕棿鏈変竴娆¢�佹")
@@ -446,7 +455,7 @@
                         // var reportingOkQty =
                         //     Convert.ToDecimal(vOrder.todayOutput) -
                         //     reporting.OkQty;
-                        var CjQty = Db.Queryable<MesNumerical>()
+                        var CjQty = Db.Queryable<MesNumericalBycl>()
                             .Where(s => s.MachineNo == entity.MachineNo && s.EditDate == date)
                             .OrderByDescending(s=>s.CjTiem)
                             .Select<long?>(s=>s.CjNum).First();
@@ -578,7 +587,7 @@
 
         if (binding)
             return Db.Updateable<MesOrderSta>()
-                .SetColumns(s => s.MaEndTime == endDate)
+                .SetColumns(s => s.MaEndTime == endDate) // 鑷姩鍐欏叆璋冩満瀹屾垚鏃堕棿
                 .SetColumns(s => s.StartTime == entity.MaShoutTime)
                 .Where(s => s.OrderId == query.OrderId).ExecuteCommand() > 0;
 

--
Gitblit v1.9.3