From 44fe437ed95b89a38fc78b2905073e085eeebf51 Mon Sep 17 00:00:00 2001
From: pulg <plg@Haninfo>
Date: 星期日, 06 七月 2025 10:50:31 +0800
Subject: [PATCH] 1

---
 HH.WCS.QingXiNongfu/wms/WCSHelper.cs         |    2 
 HH.WCS.QingXiNongfu/process/DeviceProcess.cs |  112 +++++++++++++++++++++++--------------
 HH.WCS.QingXiNongfu/core/Monitor.cs          |   22 +++---
 HH.WCS.QingXiNongfu/wms/WCSModel.cs          |    4 +
 4 files changed, 87 insertions(+), 53 deletions(-)

diff --git a/HH.WCS.QingXiNongfu/core/Monitor.cs b/HH.WCS.QingXiNongfu/core/Monitor.cs
index 330f190..569c8a8 100644
--- a/HH.WCS.QingXiNongfu/core/Monitor.cs
+++ b/HH.WCS.QingXiNongfu/core/Monitor.cs
@@ -1752,8 +1752,8 @@
                                         var cirs = ContainerHelper.GetCntrItemRel(CNTR.FirstOrDefault().S_CNTR_CODE);
                                         if (!cirs.Any()) continue;
                                         cir = cirs.OrderByDescending(x => x.T_CREATE).FirstOrDefault();
-                                        LogHelper.Info($"鏀剁缉鑶�鍑哄簱锛亄item.Key}鎺�[{cir.S_ITEM_CODE}-{order.SQL_ItemCode}]   [{cir.S_ITEM_NAME}-{order.SQL_ItemName}]  [{cir.S_CJ_NAME}-{order.S_CJ_NAME}]  {(cir.S_ITEM_CODE == order.SQL_ItemCode && cir.S_ITEM_NAME == order.SQL_ItemName && cir.S_CJ_NAME == order.S_CJ_NAME)}");
-                                        if (cir.S_ITEM_CODE == order.SQL_ItemCode && cir.S_ITEM_NAME == order.SQL_ItemName && cir.S_CJ_NAME == order.S_CJ_NAME)
+                                        LogHelper.Info($"鏀剁缉鑶�鍑哄簱锛亄item.Key}鎺�[{cir.S_ITEM_CODE}-{order.SQL_ItemCode}]   [{cir.S_ITEM_NAME}-{order.SQL_ItemName}]  [{cir.S_CJ_NAME}-{order.S_CJ_NAME}]  {(cir.S_ITEM_CODE == order.SQL_ItemCode && cir.S_ITEM_NAME == order.SQL_ItemName)}");
+                                        if (cir.S_ITEM_CODE == order.SQL_ItemCode && cir.S_ITEM_NAME == order.SQL_ItemName)
                                         {
                                             //plg 2025骞�鏈�3鏃�09:08:10 
                                             Temp = new locCntItem
@@ -1797,15 +1797,15 @@
                                         {
                                             var re = TaskProcess.CreateTransport("", tagLoc.S_LOC_CODE.Trim(), loc.S_LOC_CODE, "鏀剁缉鑶滃弶杩�璐ф灦鍑烘彁鍗囨満", new List<string> { tagLoc.S_CNTR_CODE }, StartBit.N_CURRENT_NUM, 1, 1, 62);
                                             LogHelper.CSucessLog($"from {tagLoc.S_LOC_CODE} to {loc.S_LOC_CODE} 鏀剁缉鑶滃弶杩�璐ф灦鍑烘彁鍗囨満 锛屽垱寤簕re} ");
-                                            if (re)
-                                            {
-                                                oto.Add(oic);
-                                                if (outlock == null)
-                                                {
-                                                    var r = new RowLock { S_LOCK_SRC = (StartBit.S_NOTE /*+ StartBit.HalfOrFull*/), T_LOCK_TIME = DateTime.Now, S_LOCK_STATE = "鍑哄簱閿�, S_AREA_CODE = StartBit.S_AREA_CODE, N_ROW = StartBit.N_ROW };
-                                                    db.Insertable(r).ExecuteCommand();
-                                                }
-                                            }
+                                            //if (re)
+                                            //{
+                                            //    oto.Add(oic);
+                                            //    if (outlock == null)
+                                            //    {
+                                            //        var r = new RowLock { S_LOCK_SRC = (StartBit.S_NOTE /*+ StartBit.HalfOrFull*/), T_LOCK_TIME = DateTime.Now, S_LOCK_STATE = "鍑哄簱閿�, S_AREA_CODE = StartBit.S_AREA_CODE, N_ROW = StartBit.N_ROW };
+                                            //        db.Insertable(r).ExecuteCommand();
+                                            //    }
+                                            //}
                                         }
                                     }
                                 }
diff --git a/HH.WCS.QingXiNongfu/process/DeviceProcess.cs b/HH.WCS.QingXiNongfu/process/DeviceProcess.cs
index 65da30a..3efb1c9 100644
--- a/HH.WCS.QingXiNongfu/process/DeviceProcess.cs
+++ b/HH.WCS.QingXiNongfu/process/DeviceProcess.cs
@@ -1743,41 +1743,41 @@
 
             if (data.Length == 4)
             {
-                //if (data == "1122")//A鍙e伐浣滀俊鍙�-                //{
-                //    if (BottlePEMInfoFullTwo(plc, plc.location[0]))
-                //    {
-
-                //    }
-                //}
-                //else if (data == "1221")//B鍙e伐浣滀俊鍙�-                //{
-                //    if (BottlePEMInfoFullTwo(plc, plc.location[1]))
-                //    {
-
-                //    }
-                //}
-                //else if (data == "1121")//B鍙e伐浣滀俊鍙�-                //{
-                //    if (BottlePEMInfoFullTwo(plc, plc.location[0]))
-                //    {
-
-                //    }
-                //    if (BottlePEMInfoFullTwo(plc, plc.location[1]))
-                //    {
-
-                //    }
-                //}
-
-                if (data.Substring(1, 1) == "1")
+                if (data == "1122")//A鍙e伐浣滀俊鍙�                 {
-                    if (BottlePEMInfoFull(plc, plc.location[0]))
+                    if (BottlePEMInfoFullTwo(plc, plc.location[0]))
                     {
-                        //璁惧娌℃湁鎵樼洏锛屾垨鑰呭凡缁忔湁浠诲姟锛屼笉澶勭悊婊℃墭淇″彿锛岃繑鍥炲凡缁忓彇璐у畬鎴�-                        //3F 00 11 0d 0a
-                        //PlcHelper.SendHex(plc.address, "3F00110d0a");
+
                     }
                 }
+                else if (data == "1221")//B鍙e伐浣滀俊鍙�+                {
+                    if (BottlePEMInfoFullTwo(plc, plc.location[1]))
+                    {
+
+                    }
+                }
+                else if (data == "1121")//B鍙e伐浣滀俊鍙�+                {
+                    if (BottlePEMInfoFullTwo(plc, plc.location[0]))
+                    {
+
+                    }
+                    if (BottlePEMInfoFullTwo(plc, plc.location[1]))
+                    {
+
+                    }
+                }
+
+                //if (data.Substring(1, 1) == "1")
+                //{
+                //    if (BottlePEMInfoFull(plc, plc.location[0]))
+                //    {
+                //        //璁惧娌℃湁鎵樼洏锛屾垨鑰呭凡缁忔湁浠诲姟锛屼笉澶勭悊婊℃墭淇″彿锛岃繑鍥炲凡缁忓彇璐у畬鎴�+                //        //3F 00 11 0d 0a
+                //        //PlcHelper.SendHex(plc.address, "3F00110d0a");
+                //    }
+                //}
                 //else if (data.Substring(1, 1) == "3")
                 //{
                 //    if (BottleCapInfoEmpty(plc, plc.location[0]))
@@ -1786,13 +1786,13 @@
                 //    }
                 //}
 
-                if (data.Substring(3, 1) == "1")
-                {
-                    if (BottlePEMInfoFull(plc, plc.location[1]))
-                    {
-                        //PlcHelper.SendHex(plc.address, "3F00210d0a");
-                    }
-                }
+                //if (data.Substring(3, 1) == "1")
+                //{
+                //    if (BottlePEMInfoFull(plc, plc.location[1]))
+                //    {
+                //        //PlcHelper.SendHex(plc.address, "3F00210d0a");
+                //    }
+                //}
                 //else if (data.Substring(3, 1) == "3")
                 //{
                 //    if (BottleCapInfoEmpty(plc, plc.location[1]))
@@ -1997,23 +1997,51 @@
                 }
             }
         }
+        private static object locko = new object();
+
         static bool BottlePEMInfoFullTwo(Settings.deviceInfo plc, string location)
         {
+
+
             try
             {
-                if (location != "")
+                lock (locko)
                 {
+                    var chi = new SqlHelper<object>().GetInstance();
+                    var newDb = chi.CopyNew();
+                    Location endBit = null;
+                    if (location == "")
+                    {
+                        throw new Exception("璐т綅涓虹┖");
+                    }
                     var workOrder = WCSHelper.GetWorkOrder(plc.deviceName);
                     if (workOrder == null)
                     {
-                        LogHelper.Info(plc.deviceName + "娌℃湁銆愭墽琛屼腑銆戠殑宸ュ崟");
-                        return false;
+                        throw new Exception("娌℃湁銆愭墽琛屼腑銆戠殑宸ュ崟");
                     }
+                    if (workOrder.SQL_UsingNow == "Y")//鍗充骇鍗崇敤
+                    {
+                        //鏌ヨ 鍗婃垚鍝佸尯鍩熻〃 BcpQyOrder
+
+                    }
+                    else//闈炲嵆浜у嵆鐢�+                    {
+
+                    }
+                    if (endBit != null)
+                    {
+                        var _ctrl = LocationHelper.GetLocCntrRel(location);
+                        int endLayer = endBit.N_CURRENT_NUM + 1;
+                        var carryCntrs = new List<string> { _ctrl.FirstOrDefault().S_CNTR_CODE };//DateTime.Now.ToString("yyMMddHHmmss") };
+                        var bb = TaskProcess.CreateTransport(workOrder.SQL_WorkNo, location, endBit.S_LOC_CODE, "婊$摱鍧�鍏ュ簱", carryCntrs, 1, endLayer, carryCntrs.Count, plc.taskPri);
+                    }
+                    return true;
                 }
-                return false;
+
             }
             catch (Exception ex)
             {
+                LogHelper.Info(plc.deviceName + $" 鎶ラ敊: {ex.Message}");
                 return false;
             }
         }
diff --git a/HH.WCS.QingXiNongfu/wms/WCSHelper.cs b/HH.WCS.QingXiNongfu/wms/WCSHelper.cs
index 06d3e77..8904e2a 100644
--- a/HH.WCS.QingXiNongfu/wms/WCSHelper.cs
+++ b/HH.WCS.QingXiNongfu/wms/WCSHelper.cs
@@ -27,6 +27,8 @@
             return order;
         }
 
+        //public static 
+
         public static List<WorkOrder> GetWorkOrder(Expression<Func<WorkOrder, bool>> expression)
         {
             //|| a.SQL_State == "鏆傚仠"
diff --git a/HH.WCS.QingXiNongfu/wms/WCSModel.cs b/HH.WCS.QingXiNongfu/wms/WCSModel.cs
index 29531c3..dba41a6 100644
--- a/HH.WCS.QingXiNongfu/wms/WCSModel.cs
+++ b/HH.WCS.QingXiNongfu/wms/WCSModel.cs
@@ -288,6 +288,10 @@
     [SuGG("鍗婃垚鍝佸尯鍩熻〃")]
     public class BcpQyOrder : BaseModel
     {
+        /// <summary>
+        /// 浜х嚎鍙�+        /// </summary>
+        public string SQL_PLineNo { get; set; }
     }
 
     [SuGG("鍘傚鏃堕棿琛�)]

--
Gitblit v1.9.1