From c1c85f2683f2aba57c9dc62f936b05b5fd988616 Mon Sep 17 00:00:00 2001
From: pulg <plg@Haninfo>
Date: 星期一, 23 六月 2025 11:36:51 +0800
Subject: [PATCH] 1

---
 HH.WCS.QingXiNongfu/process/DeviceProcess.cs |   50 ++++++++++++++++++++++++++++----------------------
 1 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/HH.WCS.QingXiNongfu/process/DeviceProcess.cs b/HH.WCS.QingXiNongfu/process/DeviceProcess.cs
index 32b7729..c49bdd3 100644
--- a/HH.WCS.QingXiNongfu/process/DeviceProcess.cs
+++ b/HH.WCS.QingXiNongfu/process/DeviceProcess.cs
@@ -1,28 +1,14 @@
-锘縰sing HH.WCS.QingXigongchang.core;
-using HH.WCS.QingXigongchang.device;
+锘縰sing HH.WCS.QingXigongchang.device;
 using HH.WCS.QingXigongchang.dispatch;
 using HH.WCS.QingXigongchang.util;
 using HH.WCS.QingXigongchang.wms;
-using Microsoft.SqlServer.Server;
 using Newtonsoft.Json;
-using NLog.Time;
 using SqlSugar;
 using System;
-using System.Collections;
 using System.Collections.Generic;
 using System.Data;
-using System.Diagnostics.Eventing.Reader;
 using System.Linq;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Security.Cryptography;
 using System.Threading;
-using System.Threading.Tasks;
-using System.Timers;
-using System.Web.Http.Results;
-using System.Web.Security;
-using System.Web.UI.WebControls;
-using static HH.WCS.QingXigongchang.dispatch.NDC;
 using static HH.WCS.QingXigongchang.util.Settings;
 
 namespace HH.WCS.QingXigongchang.process
@@ -178,6 +164,7 @@
                     {
                         if (od.SQL_Total >= v[0])
                         {
+                            LogHelper.Info(plc.deviceName + $"宸茬疮璁′俊鍙烽噺{od.SQL_Total} 寰呴鏂欐暟{od.OutNum}--寮�杞崲锛堜俊鍙烽噺>{(od.SQL_Total - v[0])} 棰嗘枡鏁�{od.OutNum + v[1]}");
                             od.SQL_Total -= v[0];
                             od.OutNum += v[1];
                             WCSHelper.Do(db =>
@@ -285,6 +272,7 @@
                         if (!string.IsNullOrEmpty(od.S_ROW))
                             list.Add(od.S_ROW);
                         ma = string.Join(",", list);
+
                         List<LocCntrRel> lcrl = new List<LocCntrRel>
                         {
                             new LocCntrRel
@@ -299,6 +287,10 @@
                         {
                             db.Insertable(lirl).ExecuteCommand();
                             db.Insertable(lcrl).ExecuteCommand();
+                            db.Insertable(new Container
+                            {
+                                S_CNTR_CODE = lirl.FirstOrDefault().S_CNTR_CODE,
+                            }).ExecuteCommand();
                             db.Updateable(_cl).UpdateColumns(x => new { x.N_CURRENT_NUM }).ExecuteCommand();
                         });
                         goto ballll;
@@ -321,7 +313,7 @@
                     si = "0";
 
                 }
-                else if (data.Contains("11") && (ods.Find(x => x.SQL_PLineNo.Contains("绾哥")) != null||plc.deviceName.Contains("T1")))
+                else if (data.Contains("11"))// && (ods.Find(x => x.SQL_PLineNo.Contains("绾哥")) != null || plc.deviceName.Contains("T1"))
                 {
                     //if (!ods.Any())
                     //    return;
@@ -330,16 +322,21 @@
                     {
                         LogHelper.Info($" time锛歿_clrel0?.T_CREATE} = s_type锛歿_clrel0.S_TYPE}");
                         if (_clrel.Any())
-                            if (DateTime.Now.Subtract(_clrel0.T_CREATE).TotalSeconds < 10 || !string.IsNullOrEmpty(_clrel0.S_TYPE))
+                            //if (DateTime.Now.Subtract(_clrel0.T_CREATE).TotalSeconds < 10 || !string.IsNullOrEmpty(_clrel0.S_TYPE))
+                            //    goto ballll;
+                            //plg 2025骞�鏈�3鏃� 鍘婚櫎10绉掓椂闂撮檺鍒�+                            if (DateTime.Now.Subtract(_clrel0.T_CREATE).TotalSeconds < 3 || !string.IsNullOrEmpty(_clrel0.S_TYPE))
                                 goto ballll;
 
                         LocationHelper.DoAction(db =>
-                        {
-                            db.Deleteable(_clrel).ExecuteCommand();
-                            _cl.N_CURRENT_NUM = 0;
-                            return db.Updateable(_cl).UpdateColumns(x => new { x.N_CURRENT_NUM }).ExecuteCommand() > 0;
-                        });
+                            {
+                                db.Deleteable(_clrel).ExecuteCommand();
+                                _cl.N_CURRENT_NUM = 0;
+                                return db.Updateable(_cl).UpdateColumns(x => new { x.N_CURRENT_NUM }).ExecuteCommand() > 0;
+                            });
                     }
+                    if (!plc.deviceName.Contains("T1"))
+                        goto ballll;
                     else if (!plc.deviceName.Contains("姘寸嚎鏍囩"))
                     {
                         LogHelper.Info(_cl.S_LOC_CODE + $"璐т綅 鎵捐捣鐐�);
@@ -1809,9 +1806,18 @@
             }
             if (add)
             {
+                LogHelper.Info($@"{plc.deviceName}鏂板埌浣嶄俊鍙枫� 鎵цYWL宸ュ崟淇″彿閲忓鍔�");
                 var ods = LocationHelper.GetList<YWLWorkOrder>(x => x.SQL_State == "鎵ц涓� && x.WorkType == 6 && x.SQL_LinkLineNO == plc.deviceName);//.FirstOrDefault();
                 if (ods.Any())
                 {
+                    LogHelper.Info($@"{plc.deviceName}鏂板埌浣嶄俊鍙凤紝鎵惧埌宸ュ崟{JsonConvert.SerializeObject(ods.Select(x => new
+                    {
+                        x.SQL_PLineNo,
+                        x.SQL_LinkLineNO,
+                        x.SQL_Total,
+                        x.OutNum
+                    }))}");
+
                     foreach (var od in ods)
                     {
                         od.SQL_Total += 1;

--
Gitblit v1.9.1