From 7d9d48cf1e9d5b28e59ea52a0ee1acdfd15f88e7 Mon Sep 17 00:00:00 2001
From: IPC-610 <IPC-610@DESKTOP-6LEOOS3>
Date: 星期二, 07 一月 2025 08:32:34 +0800
Subject: [PATCH] 问题修改

---
 Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs |   62 +++++++++++++++---------------
 1 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs b/Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs
index 2033a79..b99dd08 100644
--- a/Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs
+++ b/Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs
@@ -224,16 +224,42 @@
     }
 
     /// <summary>
-    /// 浠诲姟缁撴壒
+    /// 浠诲姟寮哄埗缁撴壒
     /// </summary>
     /// <param name="input"></param>
     /// <returns></returns>
     [HttpPost]
     [ApiDescriptionSettings(Name = "CloseTaskForPLC")]
-    [DisplayName("浠诲姟缁撴壒")]
+    [DisplayName("浠诲姟寮哄埗缁撴壒")]
     public async Task CloseTaskForPLC(CloseTaskPLCInput input)
     {
-        //鍒嗘嫞浠诲姟淇℃伅
+        //  娉ㄩ噴锛氭紨绀烘ā寮忎笉缁戝畾鍒嗛亾銆俵iudl 2024-10-30
+        //if (PLCTaskAction.boDemo)
+        //{
+        //    //婕旂ず妯″紡
+        //    var checkTaskList2 = await _wcsCheckTaskRep.Context.Queryable<WcsCheckTask>().FirstAsync(w => w.Port == "208");
+
+        //    var deviceInfo = await _wcsDeviceRep.Context.Queryable<WcsDevice>().FirstAsync(w => w.StationNum == "208");
+        //    if (deviceInfo == null)
+        //    {
+        //        throw Oops.Bah($"鎵句笉鍒板伐浣嶅彿锛�208鐨勭爜鍨涘伐浣嶄俊鎭�");
+        //    }
+        //    var modPlc = await _wcsDeviceRep.Context.Queryable<WcsPlc>().FirstAsync(s => s.Id == deviceInfo.PlcId);
+        //    if (modPlc == null)
+        //    {
+        //        throw Oops.Bah($"鎵句笉鍒板伐浣嶅彿锛�208鐨勮澶囦俊鎭�");
+        //    }
+        //    PLCUtil modUtil = new PLCUtil(modPlc);
+            
+        //    var ret = modUtil.SetPlcDBValue(checkTaskList2.PosTypeLot, checkTaskList2.DbNumber, checkTaskList2.PosLot, "1");
+        //    return;
+        //}
+
+        // 姝e父妯″紡
+        if (string.IsNullOrWhiteSpace(input.lotNo))
+        {
+            throw Oops.Bah($"璇ュ伐浣嶆湭缁戝畾浠诲姟锛�");
+        }
         var checkTaskList = _wcsCheckTaskRep.Context.Queryable<WcsCheckTask>().Where(w => w.LotNo == input.lotNo && w.Status == "1").ToList();
         if (checkTaskList.Count <= 0)
         {
@@ -255,7 +281,7 @@
             PLCUtil modUtil = new PLCUtil(modPlc);
             if (modUtil.Connected)
             {
-                var ret = modUtil.SetPlcDBValue(item.PosTypeLot, item.DbNumber, item.PosLot, "1");
+                var ret = modUtil.SetPlcDBValue(item.PosTypeLot, item.DbNumber, item.PosLot, "0");    // 瑙g粦鍒嗛亾
                 if (ret.IsSucceed)
                 {
                     //鍐欏叆娴佺▼瀛楁垚鍔熷悗鏇存柊鍒嗘嫞浠诲姟
@@ -281,33 +307,7 @@
             {
                 throw Oops.Bah("PCL鏈繛鎺ワ紝缁撴壒澶辫触锛�");
             }
-
-
-            //Service.WcsDevice.Dto.WcsDeviceTaskOrderDto order=  await _wcsDeviceRep.Context.Queryable<WcsDevice>()
-            //    .InnerJoin<WcsPlc>((device, plc) => device.PlcId == plc.Id)
-            //    .LeftJoin<WcsCheckTask>((device, plc, task) => device.StationNum == task.Port)
-            //    .Where((device, plc, task) => device.PlcId == 1000 && task.Port=="")
-            //    .Select((device, plc, task) => new Service.WcsDevice.Dto.WcsDeviceTaskOrderDto()
-            //    {
-            //        Id = device.Id,
-            //        Text = device.Text,
-            //        TaskNo = task.TaskNo,
-            //        OrderNo = task.OrderNo,
-            //        LotNo = task.LotNo,
-            //        SkuNo = task.SkuNo,
-            //        SkuName = task.SkuName,
-            //        LineNo = task.LineNo,
-            //        Status = task.Status,
-            //        PZNo = task.PZNo,
-            //        Qty = task.Qty,
-
-            //        Type = plc.Type
-            //    })
-            //    .FirstAsync();
-            ////涓嬪彂鍒嗘嫞浠诲姟
-            //HubUtil.PublicCheckTask(order.Adapt<Service.WcsDevice.Dto.WcsDeviceTaskOrderDto>());
-
             #endregion
-        }  
+        }
     }
 }

--
Gitblit v1.8.0