Browse Source

叫料任务上限wms配置

xu.lu 3 years ago
parent
commit
339b386ea9

BIN
DLL/PLC.Siemens.dll


+ 16 - 0
Projects/永冠/WCS.Service/Extensions/TypeExtension.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WCS.Service.Extensions
+{
+    public static class TypeExtension
+    {
+        public static int ToInt(this string value)
+        {
+            return Convert.ToInt32(value);
+        }
+    }
+}

+ 3 - 0
Projects/永冠/WCS.Service/ProtocolProxy.cs

@@ -105,10 +105,13 @@ namespace WCS.Service
         static Dictionary<string, Playerback> Clients = new Dictionary<string, Playerback>();
         static RedisClient Redis;
         public static RedisClient YGWCS150Redis;
+        public static RedisClient WMS120Redis;
         static ProtocolProxy()
         {
             MessagePackSerializer.DefaultOptions = StandardResolver.Options.WithCompression(MessagePackCompression.Lz4Block);
             Redis = new RedisClient("212.64.66.35,database=11");
+            WMS120Redis = new RedisClient("192.168.249.120,password=123456,database=0");
+
             Redis.Serialize = obj =>
             {
                 var bytes = MessagePackSerializer.Serialize(obj); 

+ 7 - 2
Projects/永冠/WCS.Service/Works/Stations/AGV交互.cs

@@ -4,6 +4,7 @@ using System.Linq;
 using WCS.Core;
 using WCS.Entity;
 using WCS.Entity.Protocol;
+using WCS.Service.Extensions;
 using WCS.Service.Helpers;
 
 namespace WCS.Service.Works.Stations
@@ -333,18 +334,22 @@ namespace WCS.Service.Works.Stations
                             {
                                 if (station == "2086")
                                 {
+                                    var count1 = ProtocolProxy.WMS120Redis.Get("MaxLineCallTaskCount_13_14").ToInt();
+
                                     var qty = db.Default.Set<WCS_AGVTask>().Where(v => v.TaskType == AGVTaskType.叫料 && v.Status > AGVTaskStatus.新建 && v.Status < AGVTaskStatus.完成)
                                    .Where(v => v.Position == agvtask.Position).Count();
-                                    if (Ltc.Do(qty, OutTaskQty => OutTaskQty >= 3))
+                                    if (Ltc.Do(qty, OutTaskQty => OutTaskQty >= count1))
                                     {
                                         throw new Exception($"{agvtask.Position}正在执行的叫料任务数量已达{qty},暂停出库");
                                     }
                                 }
                                 else
                                 {
+                                    var count2 = ProtocolProxy.WMS120Redis.Get("MaxLineCallTaskCount_1_2_3").ToInt();
+
                                     var qty = db.Default.Set<WCS_AGVTask>().Where(v => v.TaskType == AGVTaskType.叫料 && v.Status > AGVTaskStatus.新建 && v.Status < AGVTaskStatus.完成)
                                     .Where(v => v.Position == agvtask.Position).Count();
-                                    if (Ltc.Do(qty, OutTaskQty => OutTaskQty >= 2))
+                                    if (Ltc.Do(qty, OutTaskQty => OutTaskQty >= count2))
                                     {
                                         throw new Exception($"{agvtask.Position}正在执行的叫料任务数量已达{qty},暂停出库");
                                     }