From c6f52253a482e866640dd075fd3dcbb56687f4f2 Mon Sep 17 00:00:00 2001
From: czw <selecti@yeah.net>
Date: 星期六, 31 五月 2025 12:38:17 +0800
Subject: [PATCH] New

---
 S7/Scripts/Script.json |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/S7/Scripts/Script.json b/S7/Scripts/Script.json
index 2951f77..1e2e745 100644
--- a/S7/Scripts/Script.json
+++ b/S7/Scripts/Script.json
@@ -131,14 +131,14 @@
           "ID": "20250323151832119",
           "Name": "Program4",
           "Desc": "",
-          "Content": "Conn.榛樿Redis.SetValue(\"瑗块棬瀛�.Param3\",\"300\",\"瑗块棬瀛�Queue\");",
-          "ContentCopy": "Conn.榛樿Redis.SetValue(\"瑗块棬瀛�.Param3\",\"300\",\"瑗块棬瀛�Queue\");",
+          "Content": "//Conn.榛樿Redis.SetValue(\"瑗块棬瀛�.Param3\",\"300\",\"瑗块棬瀛�Queue\");\r\n\r\n                    List<string> locs = new List<string>() { \"vxr1l\", \"vx1r\", \"vxr1c1\", \"vxr1c2\", \"vxr2l\", \"vxr2r\", \"vxr2c1\", \"vxr2c2\" };\r\n                    List<string> sites = new List<string>() { \"196365BB283162\", \"193841BB283149\", \"198756BB287300\", \"198767BB286133\", \"206987BB282931\", \"204460BB282975\", \"209405BB287057\", \"209377BB285899\" };\r\n\r\n                    LocRepository locservice = new LocRepository();\r\n                    for (int i = 0; i < locs.Count; i++)\r\n                    {\r\n                        string loccode = locs[i];\r\n                        string sitesss = sites[i];\r\n                        var loc = locservice.FindEntity(x => x.S_LOC_CODE == loccode);\r\n                        if (loc == null)\r\n                        {\r\n                            locservice.Insert(new LocEntity\r\n                            {\r\n                                S_ID = Guid.NewGuid().ToString(),\r\n                                S_STATE = \"缂栬緫\",\r\n                                T_CREATE = DateTime.Now,\r\n                                T_MODIFY = DateTime.Now,\r\n                                S_DEEP = \"vxr\",\r\n\r\n                                S_LOC_CODE = loccode,\r\n                                S_AGV_SITE = sitesss,\r\n\r\n                                S_LOCK_STATE = \"鏃燶",\r\n                                N_ROW = 1,\r\n                                N_COL = 1,\r\n                                N_AGV_CODE = 0,\r\n                                N_AGV_SITE_LAYER = 0,\r\n                                N_CAPACITY = 1,\r\n                                N_CURRENT_NUM = 0,\r\n                                S_TYPE = \"\",\r\n\r\n                            });\r\n                        }\r\n                    }\r\n                   // TaskProcess.CreateTask(\"\", locs[6], locs[7], \"test\", 9, new List<string> { \"test\" }, 1, 1, 1);\r\n",
+          "ContentCopy": "//Conn.榛樿Redis.SetValue(\"瑗块棬瀛�.Param3\",\"300\",\"瑗块棬瀛�Queue\");\r\n\r\n                    List<string> locs = new List<string>() { \"vxr1l\", \"vx1r\", \"vxr1c1\", \"vxr1c2\", \"vxr2l\", \"vxr2r\", \"vxr2c1\", \"vxr2c2\" };\r\n                    List<string> sites = new List<string>() { \"196365BB283162\", \"193841BB283149\", \"198756BB287300\", \"198767BB286133\", \"206987BB282931\", \"204460BB282975\", \"209405BB287057\", \"209377BB285899\" };\r\n\r\n                    LocRepository locservice = new LocRepository();\r\n                    for (int i = 0; i < locs.Count; i++)\r\n                    {\r\n                        string loccode = locs[i];\r\n                        string sitesss = sites[i];\r\n                        var loc = locservice.FindEntity(x => x.S_LOC_CODE == loccode);\r\n                        if (loc == null)\r\n                        {\r\n                            locservice.Insert(new LocEntity\r\n                            {\r\n                                S_ID = Guid.NewGuid().ToString(),\r\n                                S_STATE = \"缂栬緫\",\r\n                                T_CREATE = DateTime.Now,\r\n                                T_MODIFY = DateTime.Now,\r\n                                S_DEEP = \"vxr\",\r\n\r\n                                S_LOC_CODE = loccode,\r\n                                S_AGV_SITE = sitesss,\r\n\r\n                                S_LOCK_STATE = \"鏃燶",\r\n                                N_ROW = 1,\r\n                                N_COL = 1,\r\n                                N_AGV_CODE = 0,\r\n                                N_AGV_SITE_LAYER = 0,\r\n                                N_CAPACITY = 1,\r\n                                N_CURRENT_NUM = 0,\r\n                                S_TYPE = \"\",\r\n\r\n                            });\r\n                        }\r\n                    }\r\n                   // TaskProcess.CreateTask(\"\", locs[6], locs[7], \"test\", 9, new List<string> { \"test\" }, 1, 1, 1);\r\n",
           "ParentID": "20250226153120175",
           "Children": [],
           "Type": "Program",
           "Property": {
-            "SyncExec": "False",
-            "RepeatExec": "None",
+            "SyncExec": "True",
+            "RepeatExec": "Count",
             "ExceCount": 1,
             "ExceInternal": 3000,
             "StartCondition": {
@@ -147,7 +147,11 @@
               "Expression": "",
               "Judge": "",
               "Command": {},
-              "HmiEvent": {}
+              "HmiEvent": {
+                "20250306140515428": [
+                  "Open"
+                ]
+              }
             },
             "EndCondition": {
               "Type": "None",
@@ -174,8 +178,8 @@
               "ID": "20250325083149366",
               "Name": "缁村笇灏旀姄鑷�",
               "Desc": "",
-              "Content": "\r\nvar VERX = Settings.deviceInfos?.Find(x => x.deviceName == \"缁村笇灏旀姄鑷�\");\r\n\r\nif (VERX != null)\r\n{\r\nLocRepository locservice = new LocRepository();\r\nLocContainerRepository loccontainerservice = new LocContainerRepository();\r\nLocEntity v1l = null;\r\nLocEntity v1r = null;\r\nLocEntity startLoc = null;\r\nLocEntity endLoc = null;\r\nList<LocEntity> emptyLoc = new List<LocEntity>();\r\n    if (!string.IsNullOrEmpty(VERX.location[0]))\r\n    {\r\n        v1l = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[0]);\r\n        //if (startLoc == null && startLoc.S_LOCK_STATE == \"鏃燶")\r\n        if (v1l != null && v1l.N_CURRENT_NUM == 0 && v1l.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1l);\r\n    }\r\n    if (!string.IsNullOrEmpty(VERX.location[1]))\r\n    {\r\n        v1r = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[1]);\r\n        if (v1r != null && v1r.N_CURRENT_NUM == 0 && v1r.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1r);\r\n    }\r\n    if (Tag.wxr1.R44)\r\n    {\r\n        startLoc = v1l;\r\n    }\r\n    else if (Tag.wxr1.R46)\r\n    {\r\n        startLoc = v1r;\r\n    }\r\n\r\n    ContainerRepository containerservice = new ContainerRepository();\r\n    if (startLoc != null)\r\n    {\r\n        if (startLoc.N_CURRENT_NUM == 1)\r\n        {\r\n            if (startLoc.T_FULL_TIME == null)\r\n            {\r\n                //locservice.dbcontext.Set<LocEntity>().Attach(startLoc);\r\n                startLoc.T_FULL_TIME = DateTime.Now;\r\n                locservice.Update(startLoc);\r\n                //locservice.dbcontext.Entry(startLoc).Property(x => x.T_FULL_TIME).IsModified = true;\r\n                //locservice.dbcontext.SaveChanges();\r\n            }\r\n            if (startLoc.T_FULL_TIME != null && DateTime.Now.Subtract(startLoc.T_FULL_TIME ?? DateTime.Now).TotalSeconds > 30)\r\n            {\r\n                LocContainerEntity ent = loccontainerservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                foreach (var item in VERX.deviceNo)\r\n                {\r\n                    var loc = locservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                    if (loc != null)\r\n                    {\r\n                        if (loc.N_CURRENT_NUM == 0)\r\n                        {\r\n                            endLoc = loc;\r\n                            break;\r\n                        }\r\n                    }\r\n                }\r\n                if (endLoc != null && ent != null)\r\n                {\r\n                    var c = containerservice.FindEntity(x => x.S_CODE == ent.S_CNTR_CODE);\r\n                    c.S_TYPE = \"F\";\r\n                    containerservice.Update(c);\r\n                    TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"vxr1涓嬫枡\", 6, new List<string> { ent?.S_CNTR_CODE ?? \"TP\" + Settings.GetTimeStamp() }, 1, 1, 1);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    if (emptyLoc.Any())\r\n    {\r\n        List<string> exclist = new List<string>();\r\n    next:\r\n        endLoc = emptyLoc.First();\r\n        emptyLoc.Remove(endLoc);\r\n        startLoc = null;\r\n        ContainerEntity c = null;\r\n        foreach (var lcode in VERX.deviceNo)\r\n        {\r\n            if (exclist.Contains(lcode))\r\n                continue;\r\n            var loc = locservice.FindEntity(x => x.S_LOC_CODE == lcode && x.S_LOCK_STATE == \"鏃燶" && x.N_CURRENT_NUM == 1);\r\n            if (loc != null)\r\n            {\r\n                var cntr = loccontainerservice.FindEntity(x => x.S_LOC_CODE == lcode);\r\n                if (cntr != null)\r\n                {\r\n                    c = containerservice.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);\r\n                    if (c != null && c.S_TYPE == \"E\")\r\n                    {\r\n                        startLoc = loc;\r\n                    }\r\n                }\r\n            }\r\n            exclist.Add(lcode);\r\n            if (startLoc != null)\r\n                break;\r\n        }\r\n        if (startLoc != null)\r\n        {\r\n            TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"vxr1涓婄┖鎵樼洏\", 7, new List<string> { c?.S_CODE }, 1, 1, 1);\r\n        }\r\n        if (emptyLoc.Any()) goto next;\r\n    }\r\n}",
-              "ContentCopy": "\r\nvar VERX = Settings.deviceInfos?.Find(x => x.deviceName == \"缁村笇灏旀姄鑷�\");\r\n\r\nif (VERX != null)\r\n{\r\nLocRepository locservice = new LocRepository();\r\nLocContainerRepository loccontainerservice = new LocContainerRepository();\r\nLocEntity v1l = null;\r\nLocEntity v1r = null;\r\nLocEntity startLoc = null;\r\nLocEntity endLoc = null;\r\nList<LocEntity> emptyLoc = new List<LocEntity>();\r\n    if (!string.IsNullOrEmpty(VERX.location[0]))\r\n    {\r\n        v1l = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[0]);\r\n        //if (startLoc == null && startLoc.S_LOCK_STATE == \"鏃燶")\r\n        if (v1l != null && v1l.N_CURRENT_NUM == 0 && v1l.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1l);\r\n    }\r\n    if (!string.IsNullOrEmpty(VERX.location[1]))\r\n    {\r\n        v1r = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[1]);\r\n        if (v1r != null && v1r.N_CURRENT_NUM == 0 && v1r.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1r);\r\n    }\r\n    if (Tag.wxr1.R44)\r\n    {\r\n        startLoc = v1l;\r\n    }\r\n    else if (Tag.wxr1.R46)\r\n    {\r\n        startLoc = v1r;\r\n    }\r\n\r\n    ContainerRepository containerservice = new ContainerRepository();\r\n    if (startLoc != null)\r\n    {\r\n        if (startLoc.N_CURRENT_NUM == 1)\r\n        {\r\n            if (startLoc.T_FULL_TIME == null)\r\n            {\r\n                //locservice.dbcontext.Set<LocEntity>().Attach(startLoc);\r\n                startLoc.T_FULL_TIME = DateTime.Now;\r\n                locservice.Update(startLoc);\r\n                //locservice.dbcontext.Entry(startLoc).Property(x => x.T_FULL_TIME).IsModified = true;\r\n                //locservice.dbcontext.SaveChanges();\r\n            }\r\n            if (startLoc.T_FULL_TIME != null && DateTime.Now.Subtract(startLoc.T_FULL_TIME ?? DateTime.Now).TotalSeconds > 30)\r\n            {\r\n                LocContainerEntity ent = loccontainerservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                foreach (var item in VERX.deviceNo)\r\n                {\r\n                    var loc = locservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                    if (loc != null)\r\n                    {\r\n                        if (loc.N_CURRENT_NUM == 0)\r\n                        {\r\n                            endLoc = loc;\r\n                            break;\r\n                        }\r\n                    }\r\n                }\r\n                if (endLoc != null && ent != null)\r\n                {\r\n                    var c = containerservice.FindEntity(x => x.S_CODE == ent.S_CNTR_CODE);\r\n                    c.S_TYPE = \"F\";\r\n                    containerservice.Update(c);\r\n                    TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"vxr1涓嬫枡\", 6, new List<string> { ent?.S_CNTR_CODE ?? \"TP\" + Settings.GetTimeStamp() }, 1, 1, 1);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    if (emptyLoc.Any())\r\n    {\r\n        List<string> exclist = new List<string>();\r\n    next:\r\n        endLoc = emptyLoc.First();\r\n        emptyLoc.Remove(endLoc);\r\n        startLoc = null;\r\n        ContainerEntity c = null;\r\n        foreach (var lcode in VERX.deviceNo)\r\n        {\r\n            if (exclist.Contains(lcode))\r\n                continue;\r\n            var loc = locservice.FindEntity(x => x.S_LOC_CODE == lcode && x.S_LOCK_STATE == \"鏃燶" && x.N_CURRENT_NUM == 1);\r\n            if (loc != null)\r\n            {\r\n                var cntr = loccontainerservice.FindEntity(x => x.S_LOC_CODE == lcode);\r\n                if (cntr != null)\r\n                {\r\n                    c = containerservice.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);\r\n                    if (c != null && c.S_TYPE == \"E\")\r\n                    {\r\n                        startLoc = loc;\r\n                    }\r\n                }\r\n            }\r\n            exclist.Add(lcode);\r\n            if (startLoc != null)\r\n                break;\r\n        }\r\n        if (startLoc != null)\r\n        {\r\n            TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"vxr1涓婄┖鎵樼洏\", 7, new List<string> { c?.S_CODE }, 1, 1, 1);\r\n        }\r\n        if (emptyLoc.Any()) goto next;\r\n    }\r\n}",
+              "Content": "\r\nvar VERX = Settings.deviceInfos?.Find(x => x.deviceName == \"缁村笇灏旀姄鑷�\");\r\n\r\nif (VERX != null)\r\n{\r\nLocRepository locservice = new LocRepository();\r\nLocContainerRepository loccontainerservice = new LocContainerRepository();\r\nLocEntity v1l = null;\r\nLocEntity v1r = null;\r\nLocEntity startLoc = null;\r\nLocEntity endLoc = null;\r\nList<LocEntity> emptyLoc = new List<LocEntity>();\r\n    if (!string.IsNullOrEmpty(VERX.location[0]))\r\n    {\r\n        v1l = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[0]);\r\n        //if (startLoc == null && startLoc.S_LOCK_STATE == \"鏃燶")\r\n        if (v1l != null && v1l.N_CURRENT_NUM == 0 && v1l.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1l);\r\n    }\r\n    if (!string.IsNullOrEmpty(VERX.location[1]))\r\n    {\r\n        v1r = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[1]);\r\n        if (v1r != null && v1r.N_CURRENT_NUM == 0 && v1r.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1r);\r\n    }\r\n    if (Tag.wxr1.R44&&Tag.wxr1.R10)\r\n    {\r\n        startLoc = v1l;\r\n    }\r\n    else if (Tag.wxr1.R46&&Tag.wxr1.R11)\r\n    {\r\n        startLoc = v1r;\r\n    }\r\n\r\n    ContainerRepository containerservice = new ContainerRepository();\r\n    if (startLoc != null)\r\n    {\r\n        if (startLoc.N_CURRENT_NUM == 1)\r\n        {\r\n            if (startLoc.T_FULL_TIME == null)\r\n            {\r\n                //locservice.dbcontext.Set<LocEntity>().Attach(startLoc);\r\n                startLoc.T_FULL_TIME = DateTime.Now;\r\n                locservice.Update(startLoc);\r\n                //locservice.dbcontext.Entry(startLoc).Property(x => x.T_FULL_TIME).IsModified = true;\r\n                //locservice.dbcontext.SaveChanges();\r\n            }\r\n            if (startLoc.T_FULL_TIME != null && DateTime.Now.Subtract(startLoc.T_FULL_TIME ?? DateTime.Now).TotalSeconds > 30)\r\n            {\r\n                LocContainerEntity ent = loccontainerservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                foreach (var item in VERX.deviceNo)\r\n                {\r\n                    var loc = locservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                    if (loc != null)\r\n                    {\r\n                        if (loc.N_CURRENT_NUM == 0)\r\n                        {\r\n                            endLoc = loc;\r\n                            break;\r\n                        }\r\n                    }\r\n                }\r\n                if (endLoc != null && ent != null)\r\n                {\r\n                    var c = containerservice.FindEntity(x => x.S_CODE == ent.S_CNTR_CODE);\r\n                    c.S_TYPE = \"F\";\r\n                    containerservice.Update(c);\r\n                    TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"vxr1涓嬫枡\", 6, new List<string> { ent?.S_CNTR_CODE ?? \"TP\" + Settings.GetTimeStamp() }, 1, 1, 1);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    if (emptyLoc.Any())\r\n    {\r\n        List<string> exclist = new List<string>();\r\n    next:\r\n        endLoc = emptyLoc.First();\r\n        emptyLoc.Remove(endLoc);\r\n        startLoc = null;\r\n        ContainerEntity c = null;\r\n        foreach (var lcode in VERX.deviceNo)\r\n        {\r\n            if (exclist.Contains(lcode))\r\n                continue;\r\n            var loc = locservice.FindEntity(x => x.S_LOC_CODE == lcode && x.S_LOCK_STATE == \"鏃燶" && x.N_CURRENT_NUM == 1);\r\n            if (loc != null)\r\n            {\r\n                var cntr = loccontainerservice.FindEntity(x => x.S_LOC_CODE == lcode);\r\n                if (cntr != null)\r\n                {\r\n                    c = containerservice.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);\r\n                    if (c != null && c.S_TYPE == \"E\")\r\n                    {\r\n                        startLoc = loc;\r\n                    }\r\n                }\r\n            }\r\n            exclist.Add(lcode);\r\n            if (startLoc != null)\r\n                break;\r\n        }\r\n        if (startLoc != null)\r\n        {\r\n            TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"vxr1涓婄┖鎵樼洏\", 7, new List<string> { c?.S_CODE }, 1, 1, 1);\r\n        }\r\n        if (emptyLoc.Any()) goto next;\r\n    }\r\n}",
+              "ContentCopy": "\r\nvar VERX = Settings.deviceInfos?.Find(x => x.deviceName == \"缁村笇灏旀姄鑷�\");\r\n\r\nif (VERX != null)\r\n{\r\nLocRepository locservice = new LocRepository();\r\nLocContainerRepository loccontainerservice = new LocContainerRepository();\r\nLocEntity v1l = null;\r\nLocEntity v1r = null;\r\nLocEntity startLoc = null;\r\nLocEntity endLoc = null;\r\nList<LocEntity> emptyLoc = new List<LocEntity>();\r\n    if (!string.IsNullOrEmpty(VERX.location[0]))\r\n    {\r\n        v1l = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[0]);\r\n        //if (startLoc == null && startLoc.S_LOCK_STATE == \"鏃燶")\r\n        if (v1l != null && v1l.N_CURRENT_NUM == 0 && v1l.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1l);\r\n    }\r\n    if (!string.IsNullOrEmpty(VERX.location[1]))\r\n    {\r\n        v1r = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[1]);\r\n        if (v1r != null && v1r.N_CURRENT_NUM == 0 && v1r.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1r);\r\n    }\r\n    if (Tag.wxr1.R44&&Tag.wxr1.R10)\r\n    {\r\n        startLoc = v1l;\r\n    }\r\n    else if (Tag.wxr1.R46&&Tag.wxr1.R11)\r\n    {\r\n        startLoc = v1r;\r\n    }\r\n\r\n    ContainerRepository containerservice = new ContainerRepository();\r\n    if (startLoc != null)\r\n    {\r\n        if (startLoc.N_CURRENT_NUM == 1)\r\n        {\r\n            if (startLoc.T_FULL_TIME == null)\r\n            {\r\n                //locservice.dbcontext.Set<LocEntity>().Attach(startLoc);\r\n                startLoc.T_FULL_TIME = DateTime.Now;\r\n                locservice.Update(startLoc);\r\n                //locservice.dbcontext.Entry(startLoc).Property(x => x.T_FULL_TIME).IsModified = true;\r\n                //locservice.dbcontext.SaveChanges();\r\n            }\r\n            if (startLoc.T_FULL_TIME != null && DateTime.Now.Subtract(startLoc.T_FULL_TIME ?? DateTime.Now).TotalSeconds > 30)\r\n            {\r\n                LocContainerEntity ent = loccontainerservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                foreach (var item in VERX.deviceNo)\r\n                {\r\n                    var loc = locservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                    if (loc != null)\r\n                    {\r\n                        if (loc.N_CURRENT_NUM == 0)\r\n                        {\r\n                            endLoc = loc;\r\n                            break;\r\n                        }\r\n                    }\r\n                }\r\n                if (endLoc != null && ent != null)\r\n                {\r\n                    var c = containerservice.FindEntity(x => x.S_CODE == ent.S_CNTR_CODE);\r\n                    c.S_TYPE = \"F\";\r\n                    containerservice.Update(c);\r\n                    TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"vxr1涓嬫枡\", 6, new List<string> { ent?.S_CNTR_CODE ?? \"TP\" + Settings.GetTimeStamp() }, 1, 1, 1);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    if (emptyLoc.Any())\r\n    {\r\n        List<string> exclist = new List<string>();\r\n    next:\r\n        endLoc = emptyLoc.First();\r\n        emptyLoc.Remove(endLoc);\r\n        startLoc = null;\r\n        ContainerEntity c = null;\r\n        foreach (var lcode in VERX.deviceNo)\r\n        {\r\n            if (exclist.Contains(lcode))\r\n                continue;\r\n            var loc = locservice.FindEntity(x => x.S_LOC_CODE == lcode && x.S_LOCK_STATE == \"鏃燶" && x.N_CURRENT_NUM == 1);\r\n            if (loc != null)\r\n            {\r\n                var cntr = loccontainerservice.FindEntity(x => x.S_LOC_CODE == lcode);\r\n                if (cntr != null)\r\n                {\r\n                    c = containerservice.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);\r\n                    if (c != null && c.S_TYPE == \"E\")\r\n                    {\r\n                        startLoc = loc;\r\n                    }\r\n                }\r\n            }\r\n            exclist.Add(lcode);\r\n            if (startLoc != null)\r\n                break;\r\n        }\r\n        if (startLoc != null)\r\n        {\r\n            TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"vxr1涓婄┖鎵樼洏\", 7, new List<string> { c?.S_CODE }, 1, 1, 1);\r\n        }\r\n        if (emptyLoc.Any()) goto next;\r\n    }\r\n}",
               "ParentID": "20250325083047245",
               "Children": [],
               "Type": "Program",
@@ -291,8 +295,8 @@
               "ID": "20250325083325390",
               "Name": "鎹风灛鎶撹噦1",
               "Desc": "",
-              "Content": "//jsz1鎹风灛鎶撹噦1\r\nvar VERX = Settings.deviceInfos?.Find(x => x.deviceName == \"鎹风灛鎶撹噦1\");\r\n\r\nif (VERX != null)\r\n{\r\nLocRepository locservice = new LocRepository();\r\nLocContainerRepository loccontainerservice = new LocContainerRepository();\r\nLocEntity v1l = null;\r\nLocEntity v1r = null;\r\nLocEntity startLoc = null;\r\nLocEntity endLoc = null;\r\nList<LocEntity> emptyLoc = new List<LocEntity>();\r\n    if (!string.IsNullOrEmpty(VERX.location[0]))\r\n    {\r\n        v1l = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[0]);\r\n        //if (startLoc == null && startLoc.S_LOCK_STATE == \"鏃燶")\r\n        if (v1l != null && v1l.N_CURRENT_NUM == 0 && v1l.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1l);\r\n    }\r\n    if (!string.IsNullOrEmpty(VERX.location[1]))\r\n    {\r\n        v1r = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[1]);\r\n        if (v1r != null && v1r.N_CURRENT_NUM == 0 && v1r.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1r);\r\n    }\r\n    if (Tag.js1.M40)\r\n    {\r\n        startLoc = v1l;\r\n    }\r\n    else if (Tag.js1.M41)\r\n    {\r\n        startLoc = v1r;\r\n    }\r\n\r\n    ContainerRepository containerservice = new ContainerRepository();\r\n    if (startLoc != null)\r\n    {\r\n        if (startLoc.N_CURRENT_NUM == 1)\r\n        {\r\n            if (startLoc.T_FULL_TIME == null)\r\n            {\r\n                //locservice.dbcontext.Set<LocEntity>().Attach(startLoc);\r\n                startLoc.T_FULL_TIME = DateTime.Now;\r\n                locservice.Update(startLoc);\r\n                //locservice.dbcontext.Entry(startLoc).Property(x => x.T_FULL_TIME).IsModified = true;\r\n                //locservice.dbcontext.SaveChanges();\r\n            }\r\n            if (startLoc.T_FULL_TIME != null && DateTime.Now.Subtract(startLoc.T_FULL_TIME ?? DateTime.Now).TotalSeconds > 30)\r\n            {\r\n                LocContainerEntity ent = loccontainerservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                foreach (var item in VERX.deviceNo)\r\n                {\r\n                    var loc = locservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                    if (loc != null)\r\n                    {\r\n                        if (loc.N_CURRENT_NUM == 0)\r\n                        {\r\n                            endLoc = loc;\r\n                            break;\r\n                        }\r\n                    }\r\n                }\r\n                if (endLoc != null && ent != null)\r\n                {\r\n                    var c = containerservice.FindEntity(x => x.S_CODE == ent.S_CNTR_CODE);\r\n                    c.S_TYPE = \"E\";\r\n                    containerservice.Update(c);\r\n                    TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS1涓嬬┖\", 6, new List<string> { ent?.S_CNTR_CODE ?? \"TP\" + Settings.GetTimeStamp() }, 1, 1, 1);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    if (emptyLoc.Any())\r\n    {\r\n        List<string> exclist = new List<string>();\r\n    next:\r\n        endLoc = emptyLoc.First();\r\n        emptyLoc.Remove(endLoc);\r\n        startLoc = null;\r\n        ContainerEntity c = null;\r\n        foreach (var lcode in VERX.deviceNo)\r\n        {\r\n            if (exclist.Contains(lcode))\r\n                continue;\r\n            var loc = locservice.FindEntity(x => x.S_LOC_CODE == lcode && x.S_LOCK_STATE == \"鏃燶" && x.N_CURRENT_NUM == 1);\r\n            if (loc != null)\r\n            {\r\n                var cntr = loccontainerservice.FindEntity(x => x.S_LOC_CODE == lcode);\r\n                if (cntr != null)\r\n                {\r\n                    c = containerservice.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);\r\n                    if (c != null && c.S_TYPE == \"F\")\r\n                    {\r\n                        startLoc = loc;\r\n                    }\r\n                }\r\n            }\r\n            exclist.Add(lcode);\r\n            if (startLoc != null)\r\n                break;\r\n        }\r\n        if (startLoc != null)\r\n        {\r\n            TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS1涓婃枡\", 7, new List<string> { c?.S_CODE }, 1, 1, 1);\r\n        }\r\n        if (emptyLoc.Any()) goto next;\r\n    }\r\n}",
-              "ContentCopy": "//jsz1鎹风灛鎶撹噦1\r\nvar VERX = Settings.deviceInfos?.Find(x => x.deviceName == \"鎹风灛鎶撹噦1\");\r\n\r\nif (VERX != null)\r\n{\r\nLocRepository locservice = new LocRepository();\r\nLocContainerRepository loccontainerservice = new LocContainerRepository();\r\nLocEntity v1l = null;\r\nLocEntity v1r = null;\r\nLocEntity startLoc = null;\r\nLocEntity endLoc = null;\r\nList<LocEntity> emptyLoc = new List<LocEntity>();\r\n    if (!string.IsNullOrEmpty(VERX.location[0]))\r\n    {\r\n        v1l = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[0]);\r\n        //if (startLoc == null && startLoc.S_LOCK_STATE == \"鏃燶")\r\n        if (v1l != null && v1l.N_CURRENT_NUM == 0 && v1l.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1l);\r\n    }\r\n    if (!string.IsNullOrEmpty(VERX.location[1]))\r\n    {\r\n        v1r = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[1]);\r\n        if (v1r != null && v1r.N_CURRENT_NUM == 0 && v1r.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1r);\r\n    }\r\n    if (Tag.js1.M40)\r\n    {\r\n        startLoc = v1l;\r\n    }\r\n    else if (Tag.js1.M41)\r\n    {\r\n        startLoc = v1r;\r\n    }\r\n\r\n    ContainerRepository containerservice = new ContainerRepository();\r\n    if (startLoc != null)\r\n    {\r\n        if (startLoc.N_CURRENT_NUM == 1)\r\n        {\r\n            if (startLoc.T_FULL_TIME == null)\r\n            {\r\n                //locservice.dbcontext.Set<LocEntity>().Attach(startLoc);\r\n                startLoc.T_FULL_TIME = DateTime.Now;\r\n                locservice.Update(startLoc);\r\n                //locservice.dbcontext.Entry(startLoc).Property(x => x.T_FULL_TIME).IsModified = true;\r\n                //locservice.dbcontext.SaveChanges();\r\n            }\r\n            if (startLoc.T_FULL_TIME != null && DateTime.Now.Subtract(startLoc.T_FULL_TIME ?? DateTime.Now).TotalSeconds > 30)\r\n            {\r\n                LocContainerEntity ent = loccontainerservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                foreach (var item in VERX.deviceNo)\r\n                {\r\n                    var loc = locservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                    if (loc != null)\r\n                    {\r\n                        if (loc.N_CURRENT_NUM == 0)\r\n                        {\r\n                            endLoc = loc;\r\n                            break;\r\n                        }\r\n                    }\r\n                }\r\n                if (endLoc != null && ent != null)\r\n                {\r\n                    var c = containerservice.FindEntity(x => x.S_CODE == ent.S_CNTR_CODE);\r\n                    c.S_TYPE = \"E\";\r\n                    containerservice.Update(c);\r\n                    TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS1涓嬬┖\", 6, new List<string> { ent?.S_CNTR_CODE ?? \"TP\" + Settings.GetTimeStamp() }, 1, 1, 1);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    if (emptyLoc.Any())\r\n    {\r\n        List<string> exclist = new List<string>();\r\n    next:\r\n        endLoc = emptyLoc.First();\r\n        emptyLoc.Remove(endLoc);\r\n        startLoc = null;\r\n        ContainerEntity c = null;\r\n        foreach (var lcode in VERX.deviceNo)\r\n        {\r\n            if (exclist.Contains(lcode))\r\n                continue;\r\n            var loc = locservice.FindEntity(x => x.S_LOC_CODE == lcode && x.S_LOCK_STATE == \"鏃燶" && x.N_CURRENT_NUM == 1);\r\n            if (loc != null)\r\n            {\r\n                var cntr = loccontainerservice.FindEntity(x => x.S_LOC_CODE == lcode);\r\n                if (cntr != null)\r\n                {\r\n                    c = containerservice.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);\r\n                    if (c != null && c.S_TYPE == \"F\")\r\n                    {\r\n                        startLoc = loc;\r\n                    }\r\n                }\r\n            }\r\n            exclist.Add(lcode);\r\n            if (startLoc != null)\r\n                break;\r\n        }\r\n        if (startLoc != null)\r\n        {\r\n            TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS1涓婃枡\", 7, new List<string> { c?.S_CODE }, 1, 1, 1);\r\n        }\r\n        if (emptyLoc.Any()) goto next;\r\n    }\r\n}",
+              "Content": "//jsz1鎹风灛鎶撹噦1\r\nvar VERX = Settings.deviceInfos?.Find(x => x.deviceName == \"鎹风灛鎶撹噦1\");\r\n\r\nif (VERX != null)\r\n{\r\nLocRepository locservice = new LocRepository();\r\nLocContainerRepository loccontainerservice = new LocContainerRepository();\r\nLocEntity v1l = null;\r\nLocEntity v1r = null;\r\nLocEntity startLoc = null;\r\nLocEntity endLoc = null;\r\nList<LocEntity> emptyLoc = new List<LocEntity>();\r\n    if (!string.IsNullOrEmpty(VERX.location[0]))\r\n    {\r\n        v1l = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[0]);\r\n        //if (startLoc == null && startLoc.S_LOCK_STATE == \"鏃燶")\r\n        if (v1l != null && v1l.N_CURRENT_NUM == 0 && v1l.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1l);\r\n    }\r\n    if (!string.IsNullOrEmpty(VERX.location[1]))\r\n    {\r\n        v1r = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[1]);\r\n        if (v1r != null && v1r.N_CURRENT_NUM == 0 && v1r.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1r);\r\n    }\r\n    if (Tag.js1.M40==1)\r\n    {\r\n        startLoc = v1l;\r\n    }\r\n    else if (Tag.js1.M41==1)\r\n    {\r\n        startLoc = v1r;\r\n    }\r\n\r\n    ContainerRepository containerservice = new ContainerRepository();\r\n    if (startLoc != null)\r\n    {\r\n        if (startLoc.N_CURRENT_NUM == 1)\r\n        {\r\n            if (startLoc.T_FULL_TIME == null)\r\n            {\r\n                //locservice.dbcontext.Set<LocEntity>().Attach(startLoc);\r\n                startLoc.T_FULL_TIME = DateTime.Now;\r\n                locservice.Update(startLoc);\r\n                //locservice.dbcontext.Entry(startLoc).Property(x => x.T_FULL_TIME).IsModified = true;\r\n                //locservice.dbcontext.SaveChanges();\r\n            }\r\n            if (startLoc.T_FULL_TIME != null && DateTime.Now.Subtract(startLoc.T_FULL_TIME ?? DateTime.Now).TotalSeconds > 30)\r\n            {\r\n                LocContainerEntity ent = loccontainerservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                foreach (var item in VERX.deviceNo)\r\n                {\r\n                    var loc = locservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                    if (loc != null)\r\n                    {\r\n                        if (loc.N_CURRENT_NUM == 0)\r\n                        {\r\n                            endLoc = loc;\r\n                            break;\r\n                        }\r\n                    }\r\n                }\r\n                if (endLoc != null && ent != null)\r\n                {\r\n                    var c = containerservice.FindEntity(x => x.S_CODE == ent.S_CNTR_CODE);\r\n                    c.S_TYPE = \"E\";\r\n                    containerservice.Update(c);\r\n                    TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS1涓嬬┖\", 6, new List<string> { ent?.S_CNTR_CODE ?? \"TP\" + Settings.GetTimeStamp() }, 1, 1, 1);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    if (emptyLoc.Any())\r\n    {\r\n        List<string> exclist = new List<string>();\r\n    next:\r\n        endLoc = emptyLoc.First();\r\n        emptyLoc.Remove(endLoc);\r\n        startLoc = null;\r\n        ContainerEntity c = null;\r\n        foreach (var lcode in VERX.deviceNo)\r\n        {\r\n            if (exclist.Contains(lcode))\r\n                continue;\r\n            var loc = locservice.FindEntity(x => x.S_LOC_CODE == lcode && x.S_LOCK_STATE == \"鏃燶" && x.N_CURRENT_NUM == 1);\r\n            if (loc != null)\r\n            {\r\n                var cntr = loccontainerservice.FindEntity(x => x.S_LOC_CODE == lcode);\r\n                if (cntr != null)\r\n                {\r\n                    c = containerservice.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);\r\n                    if (c != null && c.S_TYPE == \"F\")\r\n                    {\r\n                        startLoc = loc;\r\n                    }\r\n                }\r\n            }\r\n            exclist.Add(lcode);\r\n            if (startLoc != null)\r\n                break;\r\n        }\r\n        if (startLoc != null)\r\n        {\r\n            TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS1涓婃枡\", 7, new List<string> { c?.S_CODE }, 1, 1, 1);\r\n        }\r\n        if (emptyLoc.Any()) goto next;\r\n    }\r\n}",
+              "ContentCopy": "//jsz1鎹风灛鎶撹噦1\r\nvar VERX = Settings.deviceInfos?.Find(x => x.deviceName == \"鎹风灛鎶撹噦1\");\r\n\r\nif (VERX != null)\r\n{\r\nLocRepository locservice = new LocRepository();\r\nLocContainerRepository loccontainerservice = new LocContainerRepository();\r\nLocEntity v1l = null;\r\nLocEntity v1r = null;\r\nLocEntity startLoc = null;\r\nLocEntity endLoc = null;\r\nList<LocEntity> emptyLoc = new List<LocEntity>();\r\n    if (!string.IsNullOrEmpty(VERX.location[0]))\r\n    {\r\n        v1l = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[0]);\r\n        //if (startLoc == null && startLoc.S_LOCK_STATE == \"鏃燶")\r\n        if (v1l != null && v1l.N_CURRENT_NUM == 0 && v1l.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1l);\r\n    }\r\n    if (!string.IsNullOrEmpty(VERX.location[1]))\r\n    {\r\n        v1r = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[1]);\r\n        if (v1r != null && v1r.N_CURRENT_NUM == 0 && v1r.S_LOCK_STATE == \"鏃燶")\r\n            emptyLoc.Add(v1r);\r\n    }\r\n    if (Tag.js1.M40==1)\r\n    {\r\n        startLoc = v1l;\r\n    }\r\n    else if (Tag.js1.M41==1)\r\n    {\r\n        startLoc = v1r;\r\n    }\r\n\r\n    ContainerRepository containerservice = new ContainerRepository();\r\n    if (startLoc != null)\r\n    {\r\n        if (startLoc.N_CURRENT_NUM == 1)\r\n        {\r\n            if (startLoc.T_FULL_TIME == null)\r\n            {\r\n                //locservice.dbcontext.Set<LocEntity>().Attach(startLoc);\r\n                startLoc.T_FULL_TIME = DateTime.Now;\r\n                locservice.Update(startLoc);\r\n                //locservice.dbcontext.Entry(startLoc).Property(x => x.T_FULL_TIME).IsModified = true;\r\n                //locservice.dbcontext.SaveChanges();\r\n            }\r\n            if (startLoc.T_FULL_TIME != null && DateTime.Now.Subtract(startLoc.T_FULL_TIME ?? DateTime.Now).TotalSeconds > 30)\r\n            {\r\n                LocContainerEntity ent = loccontainerservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                foreach (var item in VERX.deviceNo)\r\n                {\r\n                    var loc = locservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                    if (loc != null)\r\n                    {\r\n                        if (loc.N_CURRENT_NUM == 0)\r\n                        {\r\n                            endLoc = loc;\r\n                            break;\r\n                        }\r\n                    }\r\n                }\r\n                if (endLoc != null && ent != null)\r\n                {\r\n                    var c = containerservice.FindEntity(x => x.S_CODE == ent.S_CNTR_CODE);\r\n                    c.S_TYPE = \"E\";\r\n                    containerservice.Update(c);\r\n                    TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS1涓嬬┖\", 6, new List<string> { ent?.S_CNTR_CODE ?? \"TP\" + Settings.GetTimeStamp() }, 1, 1, 1);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    if (emptyLoc.Any())\r\n    {\r\n        List<string> exclist = new List<string>();\r\n    next:\r\n        endLoc = emptyLoc.First();\r\n        emptyLoc.Remove(endLoc);\r\n        startLoc = null;\r\n        ContainerEntity c = null;\r\n        foreach (var lcode in VERX.deviceNo)\r\n        {\r\n            if (exclist.Contains(lcode))\r\n                continue;\r\n            var loc = locservice.FindEntity(x => x.S_LOC_CODE == lcode && x.S_LOCK_STATE == \"鏃燶" && x.N_CURRENT_NUM == 1);\r\n            if (loc != null)\r\n            {\r\n                var cntr = loccontainerservice.FindEntity(x => x.S_LOC_CODE == lcode);\r\n                if (cntr != null)\r\n                {\r\n                    c = containerservice.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);\r\n                    if (c != null && c.S_TYPE == \"F\")\r\n                    {\r\n                        startLoc = loc;\r\n                    }\r\n                }\r\n            }\r\n            exclist.Add(lcode);\r\n            if (startLoc != null)\r\n                break;\r\n        }\r\n        if (startLoc != null)\r\n        {\r\n            TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS1涓婃枡\", 7, new List<string> { c?.S_CODE }, 1, 1, 1);\r\n        }\r\n        if (emptyLoc.Any()) goto next;\r\n    }\r\n}",
               "ParentID": "20250325083047245",
               "Children": [],
               "Type": "Program",
@@ -330,8 +334,8 @@
               "ID": "20250325083326611",
               "Name": "鎹风灛鎶撹噦2",
               "Desc": "",
-              "Content": "//jsz2鎹风灛鎶撹噦2\r\n\r\n                        var VERX = Settings.deviceInfos?.Find(x => x.deviceName == \"鎹风灛鎶撹噦2\");\r\n\r\n                        if (VERX != null)\r\n                        {\r\nLocRepository locservice = new LocRepository();\r\nLocContainerRepository loccontainerservice = new LocContainerRepository();\r\nLocEntity v1l = null;\r\nLocEntity v1r = null;\r\nLocEntity startLoc = null;\r\nLocEntity endLoc = null;\r\nList<LocEntity> emptyLoc = new List<LocEntity>();\r\n                            if (!string.IsNullOrEmpty(VERX.location[0]))\r\n                            {\r\n                                v1l = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[0]);\r\n                                //if (startLoc == null && startLoc.S_LOCK_STATE == \"鏃燶")\r\n                                if (v1l != null && v1l.N_CURRENT_NUM == 0 && v1l.S_LOCK_STATE == \"鏃燶")\r\n                                    emptyLoc.Add(v1l);\r\n                            }\r\n                            if (!string.IsNullOrEmpty(VERX.location[1]))\r\n                            {\r\n                                v1r = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[1]);\r\n                                if (v1r != null && v1r.N_CURRENT_NUM == 0 && v1r.S_LOCK_STATE == \"鏃燶")\r\n                                    emptyLoc.Add(v1r);\r\n                            }\r\n                                if (Tag.js2.M40)\r\n\t\t\t\t    {\r\n\t\t\t\t        startLoc = v1l;\r\n\t\t\t\t    }\r\n\t\t\t\t    else if (Tag.js2.M41)\r\n                            {\r\n                                startLoc = v1r;\r\n                            }\r\n\r\n                            ContainerRepository containerservice = new ContainerRepository();\r\n                            if (startLoc != null)\r\n                            {\r\n                                if (startLoc.N_CURRENT_NUM == 1)\r\n                                {\r\n                                    if (startLoc.T_FULL_TIME == null)\r\n                                    {\r\n                                        //locservice.dbcontext.Set<LocEntity>().Attach(startLoc);\r\n                                        startLoc.T_FULL_TIME = DateTime.Now;\r\n                                        locservice.Update(startLoc);\r\n                                        //locservice.dbcontext.Entry(startLoc).Property(x => x.T_FULL_TIME).IsModified = true;\r\n                                        //locservice.dbcontext.SaveChanges();\r\n                                    }\r\n                                    if (startLoc.T_FULL_TIME != null && DateTime.Now.Subtract(startLoc.T_FULL_TIME ?? DateTime.Now).TotalSeconds > 30)\r\n                                    {\r\n                                        LocContainerEntity ent = loccontainerservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                                        foreach (var item in VERX.deviceNo)\r\n                                        {\r\n                                            var loc = locservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                                            if (loc != null)\r\n                                            {\r\n                                                if (loc.N_CURRENT_NUM == 0)\r\n                                                {\r\n                                                    endLoc = loc;\r\n                                                    break;\r\n                                                }\r\n                                            }\r\n                                        }\r\n                                        if (endLoc != null && ent != null)\r\n                                        {\r\n                                            var c = containerservice.FindEntity(x => x.S_CODE == ent.S_CNTR_CODE);\r\n                                            c.S_TYPE = \"E\";\r\n                                            containerservice.Update(c);\r\n                                            TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS2涓嬬┖\", 6, new List<string> { ent?.S_CNTR_CODE ?? \"TP\" + Settings.GetTimeStamp() }, 1, 1, 1);\r\n                                        }\r\n                                    }\r\n                                }\r\n                            }\r\n\r\n                            if (emptyLoc.Any())\r\n                            {\r\n                                List<string> exclist = new List<string>();\r\n                            next:\r\n                                endLoc = emptyLoc.First();\r\n                                emptyLoc.Remove(endLoc);\r\n                                startLoc = null;\r\n                                ContainerEntity c = null;\r\n                                foreach (var lcode in VERX.deviceNo)\r\n                                {\r\n                                    if (exclist.Contains(lcode))\r\n                                        continue;\r\n                                    var loc = locservice.FindEntity(x => x.S_LOC_CODE == lcode && x.S_LOCK_STATE == \"鏃燶" && x.N_CURRENT_NUM == 1);\r\n                                    if (loc != null)\r\n                                    {\r\n                                        var cntr = loccontainerservice.FindEntity(x => x.S_LOC_CODE == lcode);\r\n                                        if (cntr != null)\r\n                                        {\r\n                                            c = containerservice.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);\r\n                                            if (c != null && c.S_TYPE == \"F\")\r\n                                            {\r\n                                                startLoc = loc;\r\n                                            }\r\n                                        }\r\n                                    }\r\n                                    exclist.Add(lcode);\r\n                                    if (startLoc != null)\r\n                                        break;\r\n                                }\r\n                                if (startLoc != null)\r\n                                {\r\n                                    TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS2涓婃枡\", 7, new List<string> { c?.S_CODE }, 1, 1, 1);\r\n                                }\r\n                                if (emptyLoc.Any()) goto next;\r\n                            }\r\n                        }",
-              "ContentCopy": "//jsz2鎹风灛鎶撹噦2\r\n\r\n                        var VERX = Settings.deviceInfos?.Find(x => x.deviceName == \"鎹风灛鎶撹噦2\");\r\n\r\n                        if (VERX != null)\r\n                        {\r\nLocRepository locservice = new LocRepository();\r\nLocContainerRepository loccontainerservice = new LocContainerRepository();\r\nLocEntity v1l = null;\r\nLocEntity v1r = null;\r\nLocEntity startLoc = null;\r\nLocEntity endLoc = null;\r\nList<LocEntity> emptyLoc = new List<LocEntity>();\r\n                            if (!string.IsNullOrEmpty(VERX.location[0]))\r\n                            {\r\n                                v1l = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[0]);\r\n                                //if (startLoc == null && startLoc.S_LOCK_STATE == \"鏃燶")\r\n                                if (v1l != null && v1l.N_CURRENT_NUM == 0 && v1l.S_LOCK_STATE == \"鏃燶")\r\n                                    emptyLoc.Add(v1l);\r\n                            }\r\n                            if (!string.IsNullOrEmpty(VERX.location[1]))\r\n                            {\r\n                                v1r = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[1]);\r\n                                if (v1r != null && v1r.N_CURRENT_NUM == 0 && v1r.S_LOCK_STATE == \"鏃燶")\r\n                                    emptyLoc.Add(v1r);\r\n                            }\r\n                                if (Tag.js2.M40)\r\n\t\t\t\t    {\r\n\t\t\t\t        startLoc = v1l;\r\n\t\t\t\t    }\r\n\t\t\t\t    else if (Tag.js2.M41)\r\n                            {\r\n                                startLoc = v1r;\r\n                            }\r\n\r\n                            ContainerRepository containerservice = new ContainerRepository();\r\n                            if (startLoc != null)\r\n                            {\r\n                                if (startLoc.N_CURRENT_NUM == 1)\r\n                                {\r\n                                    if (startLoc.T_FULL_TIME == null)\r\n                                    {\r\n                                        //locservice.dbcontext.Set<LocEntity>().Attach(startLoc);\r\n                                        startLoc.T_FULL_TIME = DateTime.Now;\r\n                                        locservice.Update(startLoc);\r\n                                        //locservice.dbcontext.Entry(startLoc).Property(x => x.T_FULL_TIME).IsModified = true;\r\n                                        //locservice.dbcontext.SaveChanges();\r\n                                    }\r\n                                    if (startLoc.T_FULL_TIME != null && DateTime.Now.Subtract(startLoc.T_FULL_TIME ?? DateTime.Now).TotalSeconds > 30)\r\n                                    {\r\n                                        LocContainerEntity ent = loccontainerservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                                        foreach (var item in VERX.deviceNo)\r\n                                        {\r\n                                            var loc = locservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                                            if (loc != null)\r\n                                            {\r\n                                                if (loc.N_CURRENT_NUM == 0)\r\n                                                {\r\n                                                    endLoc = loc;\r\n                                                    break;\r\n                                                }\r\n                                            }\r\n                                        }\r\n                                        if (endLoc != null && ent != null)\r\n                                        {\r\n                                            var c = containerservice.FindEntity(x => x.S_CODE == ent.S_CNTR_CODE);\r\n                                            c.S_TYPE = \"E\";\r\n                                            containerservice.Update(c);\r\n                                            TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS2涓嬬┖\", 6, new List<string> { ent?.S_CNTR_CODE ?? \"TP\" + Settings.GetTimeStamp() }, 1, 1, 1);\r\n                                        }\r\n                                    }\r\n                                }\r\n                            }\r\n\r\n                            if (emptyLoc.Any())\r\n                            {\r\n                                List<string> exclist = new List<string>();\r\n                            next:\r\n                                endLoc = emptyLoc.First();\r\n                                emptyLoc.Remove(endLoc);\r\n                                startLoc = null;\r\n                                ContainerEntity c = null;\r\n                                foreach (var lcode in VERX.deviceNo)\r\n                                {\r\n                                    if (exclist.Contains(lcode))\r\n                                        continue;\r\n                                    var loc = locservice.FindEntity(x => x.S_LOC_CODE == lcode && x.S_LOCK_STATE == \"鏃燶" && x.N_CURRENT_NUM == 1);\r\n                                    if (loc != null)\r\n                                    {\r\n                                        var cntr = loccontainerservice.FindEntity(x => x.S_LOC_CODE == lcode);\r\n                                        if (cntr != null)\r\n                                        {\r\n                                            c = containerservice.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);\r\n                                            if (c != null && c.S_TYPE == \"F\")\r\n                                            {\r\n                                                startLoc = loc;\r\n                                            }\r\n                                        }\r\n                                    }\r\n                                    exclist.Add(lcode);\r\n                                    if (startLoc != null)\r\n                                        break;\r\n                                }\r\n                                if (startLoc != null)\r\n                                {\r\n                                    TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS2涓婃枡\", 7, new List<string> { c?.S_CODE }, 1, 1, 1);\r\n                                }\r\n                                if (emptyLoc.Any()) goto next;\r\n                            }\r\n                        }",
+              "Content": "//jsz2鎹风灛鎶撹噦2\r\n\r\n                        var VERX = Settings.deviceInfos?.Find(x => x.deviceName == \"鎹风灛鎶撹噦2\");\r\n\r\n                        if (VERX != null)\r\n                        {\r\nLocRepository locservice = new LocRepository();\r\nLocContainerRepository loccontainerservice = new LocContainerRepository();\r\nLocEntity v1l = null;\r\nLocEntity v1r = null;\r\nLocEntity startLoc = null;\r\nLocEntity endLoc = null;\r\nList<LocEntity> emptyLoc = new List<LocEntity>();\r\n                            if (!string.IsNullOrEmpty(VERX.location[0]))\r\n                            {\r\n                                v1l = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[0]);\r\n                                //if (startLoc == null && startLoc.S_LOCK_STATE == \"鏃燶")\r\n                                if (v1l != null && v1l.N_CURRENT_NUM == 0 && v1l.S_LOCK_STATE == \"鏃燶")\r\n                                    emptyLoc.Add(v1l);\r\n                            }\r\n                            if (!string.IsNullOrEmpty(VERX.location[1]))\r\n                            {\r\n                                v1r = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[1]);\r\n                                if (v1r != null && v1r.N_CURRENT_NUM == 0 && v1r.S_LOCK_STATE == \"鏃燶")\r\n                                    emptyLoc.Add(v1r);\r\n                            }\r\n                                if (Tag.js2.M40==1)\r\n\t\t\t\t    {\r\n\t\t\t\t        startLoc = v1l;\r\n\t\t\t\t    }\r\n\t\t\t\t    else if (Tag.js2.M41==1)\r\n                            {\r\n                                startLoc = v1r;\r\n                            }\r\n\r\n                            ContainerRepository containerservice = new ContainerRepository();\r\n                            if (startLoc != null)\r\n                            {\r\n                                if (startLoc.N_CURRENT_NUM == 1)\r\n                                {\r\n                                    if (startLoc.T_FULL_TIME == null)\r\n                                    {\r\n                                        //locservice.dbcontext.Set<LocEntity>().Attach(startLoc);\r\n                                        startLoc.T_FULL_TIME = DateTime.Now;\r\n                                        locservice.Update(startLoc);\r\n                                        //locservice.dbcontext.Entry(startLoc).Property(x => x.T_FULL_TIME).IsModified = true;\r\n                                        //locservice.dbcontext.SaveChanges();\r\n                                    }\r\n                                    if (startLoc.T_FULL_TIME != null && DateTime.Now.Subtract(startLoc.T_FULL_TIME ?? DateTime.Now).TotalSeconds > 30)\r\n                                    {\r\n                                        LocContainerEntity ent = loccontainerservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                                        foreach (var item in VERX.deviceNo)\r\n                                        {\r\n                                            var loc = locservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                                            if (loc != null)\r\n                                            {\r\n                                                if (loc.N_CURRENT_NUM == 0)\r\n                                                {\r\n                                                    endLoc = loc;\r\n                                                    break;\r\n                                                }\r\n                                            }\r\n                                        }\r\n                                        if (endLoc != null && ent != null)\r\n                                        {\r\n                                            var c = containerservice.FindEntity(x => x.S_CODE == ent.S_CNTR_CODE);\r\n                                            c.S_TYPE = \"E\";\r\n                                            containerservice.Update(c);\r\n                                            TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS2涓嬬┖\", 6, new List<string> { ent?.S_CNTR_CODE ?? \"TP\" + Settings.GetTimeStamp() }, 1, 1, 1);\r\n                                        }\r\n                                    }\r\n                                }\r\n                            }\r\n\r\n                            if (emptyLoc.Any())\r\n                            {\r\n                                List<string> exclist = new List<string>();\r\n                            next:\r\n                                endLoc = emptyLoc.First();\r\n                                emptyLoc.Remove(endLoc);\r\n                                startLoc = null;\r\n                                ContainerEntity c = null;\r\n                                foreach (var lcode in VERX.deviceNo)\r\n                                {\r\n                                    if (exclist.Contains(lcode))\r\n                                        continue;\r\n                                    var loc = locservice.FindEntity(x => x.S_LOC_CODE == lcode && x.S_LOCK_STATE == \"鏃燶" && x.N_CURRENT_NUM == 1);\r\n                                    if (loc != null)\r\n                                    {\r\n                                        var cntr = loccontainerservice.FindEntity(x => x.S_LOC_CODE == lcode);\r\n                                        if (cntr != null)\r\n                                        {\r\n                                            c = containerservice.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);\r\n                                            if (c != null && c.S_TYPE == \"F\")\r\n                                            {\r\n                                                startLoc = loc;\r\n                                            }\r\n                                        }\r\n                                    }\r\n                                    exclist.Add(lcode);\r\n                                    if (startLoc != null)\r\n                                        break;\r\n                                }\r\n                                if (startLoc != null)\r\n                                {\r\n                                    TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS2涓婃枡\", 7, new List<string> { c?.S_CODE }, 1, 1, 1);\r\n                                }\r\n                                if (emptyLoc.Any()) goto next;\r\n                            }\r\n                        }",
+              "ContentCopy": "//jsz2鎹风灛鎶撹噦2\r\n\r\n                        var VERX = Settings.deviceInfos?.Find(x => x.deviceName == \"鎹风灛鎶撹噦2\");\r\n\r\n                        if (VERX != null)\r\n                        {\r\nLocRepository locservice = new LocRepository();\r\nLocContainerRepository loccontainerservice = new LocContainerRepository();\r\nLocEntity v1l = null;\r\nLocEntity v1r = null;\r\nLocEntity startLoc = null;\r\nLocEntity endLoc = null;\r\nList<LocEntity> emptyLoc = new List<LocEntity>();\r\n                            if (!string.IsNullOrEmpty(VERX.location[0]))\r\n                            {\r\n                                v1l = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[0]);\r\n                                //if (startLoc == null && startLoc.S_LOCK_STATE == \"鏃燶")\r\n                                if (v1l != null && v1l.N_CURRENT_NUM == 0 && v1l.S_LOCK_STATE == \"鏃燶")\r\n                                    emptyLoc.Add(v1l);\r\n                            }\r\n                            if (!string.IsNullOrEmpty(VERX.location[1]))\r\n                            {\r\n                                v1r = locservice.FindEntity(x => x.S_LOC_CODE == VERX.location[1]);\r\n                                if (v1r != null && v1r.N_CURRENT_NUM == 0 && v1r.S_LOCK_STATE == \"鏃燶")\r\n                                    emptyLoc.Add(v1r);\r\n                            }\r\n                                if (Tag.js2.M40==1)\r\n\t\t\t\t    {\r\n\t\t\t\t        startLoc = v1l;\r\n\t\t\t\t    }\r\n\t\t\t\t    else if (Tag.js2.M41==1)\r\n                            {\r\n                                startLoc = v1r;\r\n                            }\r\n\r\n                            ContainerRepository containerservice = new ContainerRepository();\r\n                            if (startLoc != null)\r\n                            {\r\n                                if (startLoc.N_CURRENT_NUM == 1)\r\n                                {\r\n                                    if (startLoc.T_FULL_TIME == null)\r\n                                    {\r\n                                        //locservice.dbcontext.Set<LocEntity>().Attach(startLoc);\r\n                                        startLoc.T_FULL_TIME = DateTime.Now;\r\n                                        locservice.Update(startLoc);\r\n                                        //locservice.dbcontext.Entry(startLoc).Property(x => x.T_FULL_TIME).IsModified = true;\r\n                                        //locservice.dbcontext.SaveChanges();\r\n                                    }\r\n                                    if (startLoc.T_FULL_TIME != null && DateTime.Now.Subtract(startLoc.T_FULL_TIME ?? DateTime.Now).TotalSeconds > 30)\r\n                                    {\r\n                                        LocContainerEntity ent = loccontainerservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                                        foreach (var item in VERX.deviceNo)\r\n                                        {\r\n                                            var loc = locservice.FindEntity(x => x.S_LOC_CODE == startLoc.S_LOC_CODE);\r\n                                            if (loc != null)\r\n                                            {\r\n                                                if (loc.N_CURRENT_NUM == 0)\r\n                                                {\r\n                                                    endLoc = loc;\r\n                                                    break;\r\n                                                }\r\n                                            }\r\n                                        }\r\n                                        if (endLoc != null && ent != null)\r\n                                        {\r\n                                            var c = containerservice.FindEntity(x => x.S_CODE == ent.S_CNTR_CODE);\r\n                                            c.S_TYPE = \"E\";\r\n                                            containerservice.Update(c);\r\n                                            TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS2涓嬬┖\", 6, new List<string> { ent?.S_CNTR_CODE ?? \"TP\" + Settings.GetTimeStamp() }, 1, 1, 1);\r\n                                        }\r\n                                    }\r\n                                }\r\n                            }\r\n\r\n                            if (emptyLoc.Any())\r\n                            {\r\n                                List<string> exclist = new List<string>();\r\n                            next:\r\n                                endLoc = emptyLoc.First();\r\n                                emptyLoc.Remove(endLoc);\r\n                                startLoc = null;\r\n                                ContainerEntity c = null;\r\n                                foreach (var lcode in VERX.deviceNo)\r\n                                {\r\n                                    if (exclist.Contains(lcode))\r\n                                        continue;\r\n                                    var loc = locservice.FindEntity(x => x.S_LOC_CODE == lcode && x.S_LOCK_STATE == \"鏃燶" && x.N_CURRENT_NUM == 1);\r\n                                    if (loc != null)\r\n                                    {\r\n                                        var cntr = loccontainerservice.FindEntity(x => x.S_LOC_CODE == lcode);\r\n                                        if (cntr != null)\r\n                                        {\r\n                                            c = containerservice.FindEntity(x => x.S_CODE == cntr.S_CNTR_CODE);\r\n                                            if (c != null && c.S_TYPE == \"F\")\r\n                                            {\r\n                                                startLoc = loc;\r\n                                            }\r\n                                        }\r\n                                    }\r\n                                    exclist.Add(lcode);\r\n                                    if (startLoc != null)\r\n                                        break;\r\n                                }\r\n                                if (startLoc != null)\r\n                                {\r\n                                    TaskProcess.CreateTask(\"\", startLoc.S_LOC_CODE, endLoc.S_LOC_CODE, \"JS2涓婃枡\", 7, new List<string> { c?.S_CODE }, 1, 1, 1);\r\n                                }\r\n                                if (emptyLoc.Any()) goto next;\r\n                            }\r\n                        }",
               "ParentID": "20250325083047245",
               "Children": [],
               "Type": "Program",
@@ -1028,6 +1032,6 @@
     }
   ],
   "CreationTime": "2025-02-26 15:31:20",
-  "LastWriteTime": "2025-04-11 20:39:15",
+  "LastWriteTime": "2025-04-17 09:48:04",
   "HasSaved": true
 }
\ No newline at end of file

--
Gitblit v1.9.1