林豪 左 1 năm trước cách đây
mục cha
commit
1a905f9c51

+ 21 - 28
WCS.Core/DataBlock.cs

@@ -1,7 +1,5 @@
 using System.Collections;
-using System.Net.NetworkInformation;
 using System.Reflection;
-using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace WCS.Core
@@ -16,8 +14,7 @@ namespace WCS.Core
 
         public ushort Start { get; private set; }
         public ushort Length { get; private set; }
-        public World World { get; private set; }
-        public bool Failed { get; private set; }
+        private bool failed = false;
         private byte[] Data = new byte[0];
         private int id = 0;
 
@@ -26,51 +23,48 @@ namespace WCS.Core
             return id.ToString();
         }
 
-        public DataBlock(DBInfo ent,World world) : base(ent)
+        public DataBlock(DBInfo ent) : base(ent)
         {
-            this.World= world;
             DBList.Add(this);
             id = DBList.Count;
         }
 
-        DateTime faildTime = DateTime.MinValue;
+        private DateTime faildTime = DateTime.MinValue;
 
         public void RefreshData()
         {
             var isPing = false;
             try
             {
-                var plc = Entity.PLCInfo.Ex(World);
-                if (Failed)
+                if (failed && !Entity.PLCInfo.Ex().Ping)
                 {
-                    if (!plc.Ping)
-                    {
-                        isPing = true;
-                        throw new Exception($"网络异常IP为{Entity.PLCInfo.IP}的设备PLC无法访问");
-                    }
-                } 
+                    isPing = true;
+                    throw new Exception($"网络异常IP为{Entity.PLCInfo.IP}的设备PLC无法访问");
+                }
+
                 Start = (ushort)ProxyList.Min(v => v.Info.Position);
                 var last = ProxyList.OrderBy(v => v.Info.Position).Last();
                 Length = (ushort)(last.Info.Position + last.BytesCount);
+
                 var data = new byte[0];
-                lock (plc)
+                lock (Entity.PLCInfo.Ex())
                 {
-                    data = plc.Accessor.ReadBytes(Entity.No, Start, (ushort)(Length - Start));
+                    data = Entity.PLCInfo.Ex().Accessor.ReadBytes(Entity.No, Start, (ushort)(Length - Start));
                 }
                 if (!Data.SequenceEqual(data))
                 {
                     Data = data;
                     DbChanged?.Invoke(Data);
                 }
-                Failed = false;
+                failed = false;
             }
             catch (Exception ex)
             {
-                Failed = true;
+                failed = true;
                 if (isPing) throw new Exception($"{ex.Message}");
                 throw new Exception($"{ex.Message}:\r{ex.StackTrace}");
             }
-        } 
+        }
 
         public PlcItem<T> Regist<T>(ProtocolProxyBase proxy, string objid, string name, int start, byte arrLen = 1, byte strLen = 0)
         {
@@ -110,10 +104,9 @@ namespace WCS.Core
 
         private object Read(Type type, ref int bitStart, int strLength, int arrLength)
         {
-            if (Failed)
-            {
+            if (failed)
                 throw new Exception(this.Entity.No + "连接失败");
-            }
+
             if (type.IsArray)
             {
                 var t = type.GetElementType();
@@ -121,7 +114,7 @@ namespace WCS.Core
                 {
                     throw new Exception("只支持一维数组");
                 }
-                var arr = Array.CreateInstance(t, arrLength);   
+                var arr = Array.CreateInstance(t, arrLength);
 
                 for (int i = 0; i < arr.Length; i++)
                 {
@@ -451,11 +444,11 @@ namespace WCS.Core
 
         private void WriteBytes(ref int bitStart, byte[] data)
         {
-            lock (Entity.PLCInfo.Ex(World))
+            lock (Entity.PLCInfo.Ex())
             {
                 var start = GetByteStart(bitStart);
 
-                Entity.PLCInfo.Ex(World).Accessor.WriteBytes(Entity.No, start, data);
+                Entity.PLCInfo.Ex().Accessor.WriteBytes(Entity.No, start, data);
                 data.CopyTo(Data, start - Start);
                 bitStart += data.Length * 8;
             }
@@ -463,7 +456,7 @@ namespace WCS.Core
 
         private void WriteBit(ref int bitStart, bool flag)
         {
-            lock (Entity.PLCInfo.Ex(World))
+            lock (Entity.PLCInfo.Ex())
             {
                 var start = GetByteStart(bitStart);
                 var bitIndex = GetBitIndex(bitStart);
@@ -472,7 +465,7 @@ namespace WCS.Core
                 b = b.SetBit(bitIndex, flag);
                 var data = new byte[] { b };
 
-                Entity.PLCInfo.Ex(World).Accessor.WriteBytes(Entity.No, (ushort)start, data);
+                Entity.PLCInfo.Ex().Accessor.WriteBytes(Entity.No, (ushort)start, data);
                 data.CopyTo(Data, start - Start);
 
                 bitStart += 1;

+ 22 - 14
WCS.Core/Device.cs

@@ -45,7 +45,7 @@ namespace WCS.Core
             all[code] = this;
         }
 
-        public ConcurrentDictionary<Type, object> ProtocolObjs(World world)
+        private ConcurrentDictionary<Type, object> ProtocolObjs(World world)
         {
             if (!ProtocolObjsOfWorld.TryGetValue(world, out var pobjs))
             {
@@ -101,6 +101,20 @@ namespace WCS.Core
             return ProtocolObjs(world)[protocolType];
         }
 
+        //object Copy(object obj, Type type)
+        //{
+        //    var res = Activator.CreateInstance(type);
+        //    foreach (var p in type.GetProperties())
+        //    {
+        //        var p2 = obj.GetType().GetProperty(p.Name);
+        //        if (p2 != null && p2.PropertyType == p.PropertyType)
+        //        {
+        //            p.SetValue(res, p2.GetValue(obj));
+        //        }
+        //    }
+        //    return res;
+        //}
+
         public override string ToString()
         {
             return Code;
@@ -186,11 +200,6 @@ namespace WCS.Core
             Flags[key].Add(flag);
         }
 
-        //public void SetFlag(string flag)
-        //{
-        //    SetFlag("Globals", flag);
-        //}
-
         public void SetFlag(string key, string flag)
         {
             var list = new List<string>();
@@ -217,14 +226,15 @@ namespace WCS.Core
             return Flags[key].Contains(flag);
         }
 
-        public bool HasFlagKey(string key)
+        public void AddFlag(string flag)
         {
-            return Flags.ContainsKey(key);
+            SetFlag("Globals", flag);
+        }
+
+        public bool HasFlag(string flag)
+        {
+            return HasFlag("Globals", flag);
         }
-        //public bool HasFlag(string flag)
-        //{
-        //    return HasFlag("Globals", flag);
-        //}
 
         public void AddFlag<T>(T flag) where T : struct, Enum
         {
@@ -254,12 +264,10 @@ namespace WCS.Core
 
     public class Device<T> : EntityEx<Device>
     {
-        public World World { get; private set; }
         public T Data { get; set; }
 
         public Device(Device device, World world) : base(device)
         {
-            this.World = world;
             Data = Entity.Protocol<T>(world);
         }
 

+ 13 - 30
WCS.Core/Extentions.cs

@@ -7,16 +7,16 @@ using System.Linq;
 using System.Linq.Expressions;
 using System.Reflection;
 using System.Text;
-using System.Threading.Tasks; 
+using System.Threading.Tasks;
 
 namespace WCS.Core
 {
     public static class Extentions
-    { 
+    {
         static ConcurrentDictionary<object, object> ExObjs = new ConcurrentDictionary<object, object>();
 
         public static T GetEx<T>(object entity)
-        { 
+        {
             lock (ExObjs)
             {
                 if (!ExObjs.ContainsKey(entity))
@@ -25,15 +25,15 @@ namespace WCS.Core
                     ExObjs[entity] = obj;
                 }
                 return (T)ExObjs[entity];
-            } 
+            }
         }
 
-        public static PLC Ex(this PLCInfo source,World world)
+        public static PLC Ex(this PLCInfo source)
         {
-            return GetExOfWorld<PLC>(source,world);
+            return GetEx<PLC>(source);
         }
 
-        static ConcurrentDictionary<World, ConcurrentDictionary<object, object>> ExObjsOfWorld = new ConcurrentDictionary<World, ConcurrentDictionary<object, object>>(); 
+        static ConcurrentDictionary<World, ConcurrentDictionary<object, object>> ExObjsOfWorld = new ConcurrentDictionary<World, ConcurrentDictionary<object, object>>();
 
         static T GetExOfWorld<T>(this object source, World world)
         {
@@ -44,7 +44,7 @@ namespace WCS.Core
             }
             if (!objs.TryGetValue(source, out var obj))
             {
-                obj = Activator.CreateInstance(typeof(T), source, world);
+                obj = Activator.CreateInstance(typeof(T), source);
                 objs[source] = obj;
             }
             return (T)obj;
@@ -60,17 +60,17 @@ namespace WCS.Core
             ExObjsOfWorld.TryGetValue(source, out var dic);
             if (dic == null)
                 return new DataBlock[0];
-            var res= dic.Values.OfType<DataBlock>().ToArray();
+            var res = dic.Values.OfType<DataBlock>().ToArray();
             return res;
-        } 
+        }
 
         public static WorldEx Ex(this World source)
         {
             return GetEx<WorldEx>(source);
         }
-        
 
-        public static void AddSafe<T>(this List<T> source,T item)
+
+        public static void AddSafe<T>(this List<T> source, T item)
         {
             lock (source)
             {
@@ -78,7 +78,7 @@ namespace WCS.Core
             }
         }
 
-        public static void AddSafe<T>(this List<T> source,IEnumerable<T> item)
+        public static void AddSafe<T>(this List<T> source, IEnumerable<T> item)
         {
             lock (source)
             {
@@ -97,23 +97,6 @@ namespace WCS.Core
                 return attr.Description;
         }
 
-        public static object Copy(this object source, Type t)
-        { 
-            var obj=Activator.CreateInstance(t);
-            foreach (var p in t.GetProperties())
-            {
-                var p2 = source.GetType().GetProperty(p.Name);
-                var value = p2.GetValue(source);
-                p.SetValue(obj, value);
-            }
-            return obj;
-        }
-
-        public static T Copy<T>(this object source)
-        {
-            return (T)source.Copy(typeof(T));
-        }
-
     }
 
 

+ 6 - 7
WCS.Core/Ltc.cs

@@ -8,9 +8,9 @@ using System.Threading.Channels;
 
 namespace WCS.Core
 {
-    public static class Ltc
-    {  
-        private static ConcurrentDictionary<Thread, Channel> Channels = new ConcurrentDictionary<Thread, Channel>(); 
+    internal static class Ltc
+    {
+        private static ConcurrentDictionary<Thread, Channel> Channels = new ConcurrentDictionary<Thread, Channel>();
 
         public static void SetChannel(Channel channel)
         {
@@ -20,8 +20,7 @@ namespace WCS.Core
 
         public static Channel GetChannel()
         {
-            if (Channels.ContainsKey(Thread.CurrentThread))return Channels[Thread.CurrentThread];
-            else return null;
+            return Channels[Thread.CurrentThread];
         }
 
         //static ConcurrentDictionary<Channel, List<LogInfo>> Msgs = new ConcurrentDictionary<Channel, List<LogInfo>>();
@@ -60,7 +59,7 @@ namespace WCS.Core
         //public static void Log(string msg,LogLevel level,ErrorType type)
         //{ 
         //    var channel = GetChannel();
-            
+
         //    if (!Msgs.TryGetValue(channel, out var list))
         //    {
         //        list = new List<LogInfo>();
@@ -68,7 +67,7 @@ namespace WCS.Core
         //    }
         //    list.Add(new LogInfo { Message = msg, Level = level, Type = type, Channel = channel });
         //}
-  
+
         //public static void Publish(World world)
         //{ 
         //    var channel = GetChannel();

+ 34 - 15
WCS.Core/PLC.cs

@@ -1,16 +1,13 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net.NetworkInformation;
+using System.Net.NetworkInformation;
 using System.Text;
-using System.Threading.Tasks; 
 
 namespace WCS.Core
 {
     public class PLC : EntityEx<PLCInfo>
     {
         public bool Ping { get; private set; }
-        public PLC(PLCInfo ent,World world) : base(ent)
+
+        public PLC(PLCInfo ent) : base(ent)
         {
             if (Configs.PLCAccessorCreater != null)
             {
@@ -23,29 +20,51 @@ namespace WCS.Core
             {
                 while (true)
                 {
-                    Ping=ping();
+                    Ping = ping();
                     Task.Delay(1000);
                 }
             });
-        }      
+        }
+
         public IPLCAccessor Accessor { get; private set; }
 
-        bool ping(int timeout = 100)
-        { 
-            var p = new Ping();
-            var res = p.Send(Entity.IP, timeout);
-            return res.Status == IPStatus.Success;
+        private bool ping(int timeout = 100)
+        {
+            if (Entity.IP == "1") return false;
+            try
+            {
+                var objPingSender = new Ping();
+                var objPinOptions = new PingOptions
+                {
+                    DontFragment = true
+                };
+                const string data = "";
+                var buffer = Encoding.UTF8.GetBytes(data);
+                var objPinReply = objPingSender.Send(Entity.IP, timeout, buffer, objPinOptions);
+                var strInfo = objPinReply.Status.ToString();
+                return strInfo == "Success";
+            }
+            catch (Exception)
+            {
+                return false;
+            }
+
+            //var p = new Ping();
+            //var res = p.Send(Entity.IP, timeout);
+            //return res.Status == IPStatus.Success;
+            ////return true;
         }
-      
     }
 
     public interface IPLCAccessorCreater
     {
         IPLCAccessor Create(PLCInfo data);
     }
+
     public interface IPLCAccessor
     {
         void WriteBytes(ushort db, ushort address, byte[] data);
+
         byte[] ReadBytes(ushort db, ushort address, ushort length);
     }
-}
+}

+ 3 - 3
WCS.Core/PlcItem.cs

@@ -23,7 +23,7 @@ namespace WCS.Core
         /// <summary>
         /// 数据类型所占的字节数
         /// </summary>
-        public int DataSize { get; private set; }
+        public byte DataSize { get; private set; }
 
         public int DataSizeOfBits { get; private set; }
 
@@ -38,7 +38,7 @@ namespace WCS.Core
             this.ArrayLength = arrLen;
             this.StringLength = strLength;
 
-            DataSize = GetTypeLen(DataType);
+            DataSize = (byte)GetTypeLen(DataType);
 
             DataSizeOfBits = _getBitLen(DataType);
         }
@@ -117,7 +117,7 @@ namespace WCS.Core
                 }
                 catch (Exception ex)
                 {
-                    if (i >= 3) throw new Exception($"写入出错{ex.Message}--{Start}--{(T)value}--{StringLength}--{ArrayLength}--{Db.Entity.No}"); ;
+                    if (i >= 3) throw new Exception($"写入出错{ex.Message}--{Start}--{(T)value}--{StringLength}--{ArrayLength}--{Db.Entity.No}");
                     i++;
                     Thread.Sleep(100);
                 }

+ 7 - 14
WCS.Core/ProtocolProxyBase.cs

@@ -8,18 +8,16 @@ namespace WCS.Core
     {
         private string Id = Guid.NewGuid().ToString();
         public ProtocolInfo Info { get; private set; }
-        public int BytesCount { get; private set; }
+        public ushort BytesCount { get; private set; }
         public Dictionary<string, PlcItem> Items = new Dictionary<string, PlcItem>();
         public Type ProtocolType, ProtocolDataType;
         public Device Device { get; private set; }
         public World World { get; private set; }
-        public DataBlock Db { get; private set; }
-        public DateTime Frame;
+        private DataBlock Db;
 
         public ProtocolProxyBase(Device dev, ProtocolInfo info, Type protocolType, World world)
         {
-            this.World= world;
-            this.Frame = world.Frame;
+            this.World = world;
             this.Device = dev;
             this.Info = info;
             Db = info.DBInfo.Ex(world);
@@ -84,6 +82,7 @@ namespace WCS.Core
                 bitStart += item.DataSizeOfBits;
                 BytesCount += item.DataSize;
             }
+
             ProtocolDataType = ProtocolType.Assembly.GetTypes().Where(v => v.IsClass).First(v => v.GetInterface(ProtocolType.Name) != null && v != this.GetType());
         }
 
@@ -93,9 +92,7 @@ namespace WCS.Core
         {
             var pos = Info.Position - Db.Start;
             var bytes = data.Skip(pos).Take(BytesCount).ToArray();
-            if (Data.SequenceEqual(bytes)) 
-                return;
-            this.Frame = World.Frame;
+            if (Data.SequenceEqual(bytes)) return;
             Data = bytes;
             DataChanged();
         }
@@ -129,8 +126,7 @@ namespace WCS.Core
             var item = Items[propertyName] as PlcItem<T>;
             var res = item.Value;
             var channel = Ltc.GetChannel();
-            //if (channel != null)
-            //    this.World.OnInternalLog(channel, $"获取{Device.Code}.{ProtocolType.Name}.{propertyName} 值:{res}");
+            //if (channel != null && !ProtocolType.Name.Contains("525") && !ProtocolType.Name.Contains("83")) this.World.OnInternalLog(channel, $"获取值:{Device.Code}.{ProtocolType.Name}.{propertyName}:{res}");
             return res;
         }
 
@@ -139,10 +135,7 @@ namespace WCS.Core
             var item = Items[propertyName] as PlcItem<T>;
             item.Value = value;
             var channel = Ltc.GetChannel();
-            if (channel != null)
-                this.World.OnInternalLog(channel, $"设置{Device.Code}.{ProtocolType.Name}.{propertyName} 值:{value}");
-            this.Frame = World.Frame;
-            //DataChanged(); 
+            if (channel != null) this.World.OnInternalLog(channel, $"设置值:{Device.Code}.{ProtocolType.Name}.{propertyName} :{value}");
         }
 
         #endregion

+ 8 - 17
WCS.Core/System.cs

@@ -29,6 +29,7 @@ namespace WCS.Core
         /// 对所有Objects并行循环执行Do
         /// </summary>
         protected abstract bool ParallelDo { get; }
+
         /// <summary>
         /// 保存日志到文件
         /// </summary>
@@ -115,25 +116,15 @@ namespace WCS.Core
                 if (t.IsGenericType) break;
                 t = t.BaseType;
             }
-            if (t == typeof(EntityEx<Device>))
-            {
-                var list = Device.All
-                   .Where(Select)
-                   .Select(v => Activator.CreateInstance(typeof(T), v)).OfType<T>().ToList();//此时才实例化Protocol 
-                return list;
-            }
-            else
+
+            var types = t.GetGenericArguments();
+            var list = Device.All.Where(v => types.All(v.HasProtocol)).Where(Select).Select(v => Activator.CreateInstance(typeof(T), v, World)).OfType<T>().ToList();//此时才实例化Protocol
+
+            if (list.Count == 0)
             {
-                var types = t.GetGenericArguments();
-                var list = Device.All.Where(v => types.All(v.HasProtocol))
-                    .Where(Select)
-                    .Select(v => Activator.CreateInstance(typeof(T), v, World)).OfType<T>().ToList();//此时才实例化Protocol
-                if (list.Count == 0)
-                {
-                    //throw new Exception($"{this.GetType().Name}未匹配到任何Device");
-                }
-                return list;
+                //throw new Exception($"{this.GetType().Name}未匹配到任何Device");
             }
+            return list;
         }
 
         /// <summary>

+ 18 - 22
WCS.Core/World.cs

@@ -109,8 +109,6 @@ namespace WCS.Core
             get;
         }
 
-        public DateTime Frame { get; private set; }
-
         public World()
         {
             SystemTypes = GetSystemTypes();
@@ -208,13 +206,12 @@ namespace WCS.Core
             var sw = new Stopwatch();
             while (!Stoped)
             {
-                this.Frame = DateTime.Now;
                 WorkTimes wt = new WorkTimes();
                 wt.Key = $"{this.Description} 周期:{Interval}";
                 sw.Restart();
-                BeforeUpdate(wt.Items);
+                BeforeUpdate();
                 Update(wt.Items);
-                AfterUpdate(wt.Items);
+                AfterUpdate();
                 sw.Stop();
                 var workTimes = (int)sw.ElapsedMilliseconds;
                 var ms = Interval - workTimes;
@@ -257,14 +254,17 @@ namespace WCS.Core
 
         private void LoadPlcData(List<WorkTimes> list)
         {
+            var a = this.GetDataBlocks();
             Parallel.ForEach(this.GetDataBlocks(), db =>
             {
+                var b = GetType();
+                var a = b.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;
                 var channel = new Channel
                 {
-                    World = GetType().Name,
+                    World = a.Description,
                     Stage = "LoadPlcData",
                     System = "",
-                    Item = $"{db.Entity.PLCInfo.IP}_{db.Entity.No}"
+                    Item = $"{db.Entity.PLCInfo.IP}"
                 };
                 var sw = new Stopwatch();
                 sw.Start();
@@ -275,6 +275,9 @@ namespace WCS.Core
                 catch (Exception ex)
                 {
                     this.Ex().Publish(channel, ex.GetBaseException().Message);
+                    sw.Stop();
+                    list.AddSafe(new WorkTimes { Key = $"{db.Entity.PLCInfo.IP}/{db.Entity.No}", Total = sw.ElapsedMilliseconds });
+                    OnLog(channel, ex.Message);
                 }
                 sw.Stop();
                 list.AddSafe(new WorkTimes { Key = $"{db.Entity.PLCInfo.IP}/{db.Entity.No}", Total = sw.ElapsedMilliseconds });
@@ -315,11 +318,11 @@ namespace WCS.Core
             }
         }
 
-        protected virtual void BeforeUpdate(List<WorkTimes> list)
+        protected virtual void BeforeUpdate()
         {
         }
 
-        protected virtual void AfterUpdate(List<WorkTimes> list)
+        protected virtual void AfterUpdate()
         {
         }
 
@@ -352,9 +355,7 @@ namespace WCS.Core
 
         public void Log<T>(T log) where T : ILog
         {
-            var channel = Ltc.GetChannel();
-            if (channel != null)
-                OnLog(Ltc.GetChannel(), log);
+            OnLog(Ltc.GetChannel(), log);
         }
 
         protected internal abstract void OnError(Channel channel, Exception exception);
@@ -368,12 +369,9 @@ namespace WCS.Core
         internal void Publish()
         {
             var channel = Ltc.GetChannel();
-            if (channel != null)
-            {
-                var msgs = GetChannelMsg(channel);
-                var msg = string.Join("\n", msgs);
-                this.Ex().Publish(channel, msg);
-            }
+            var msgs = GetChannelMsg(channel);
+            var msg = string.Join("\n", msgs);
+            this.Ex().Publish(channel, msg);
         }
     }
 
@@ -405,8 +403,7 @@ namespace WCS.Core
 
         public void Publish(Channel channel, string msg)
         {
-            if ((DateTime.Now - SubTime).TotalSeconds > 20)
-                return;
+            if ((DateTime.Now - SubTime).TotalSeconds > 20) return;
             var flag = false;
 
             flag = ChannelList.Any(v =>
@@ -415,8 +412,7 @@ namespace WCS.Core
                 return b.Success;
             });
 
-            if (flag)
-                Redis.Publish(channel.ToString(), msg);
+            if (flag) Redis.Publish(channel.ToString(), msg);
         }
     }
 

+ 1 - 0
业务工程/分拣库/WCS.WorkEngineering/Extensions/DeviceExtension.cs

@@ -313,6 +313,7 @@ namespace WCS.WorkEngineering.Extensions
                 //南
                 "SRM4" => "2S",
                 "1018" => "2S",
+                "3128" => "2S",
                 "1711" => "2SR",
                 "1706" => "2SR",
 

+ 1 - 1
业务工程/分拣库/WCS.WorkEngineering/Extensions/FlagExtension.cs

@@ -16,7 +16,7 @@ namespace WCS.WorkEngineering.Extensions
         /// <returns></returns>
         public static T GetFlag<T>(this Device device, string key)
         {
-            if (!device.HasFlagKey(key))
+            if (!device.HasFlag(key))
             {
                 if (typeof(T) == typeof(int)) device.AddFlag(key, default(int).ToString());
                 else if (typeof(T) == typeof(short)) device.AddFlag(key, default(bool).ToString());

+ 16 - 7
业务工程/分拣库/WCS.WorkEngineering/Extensions/TaskExtension.cs

@@ -3,7 +3,9 @@ using ServiceCenter.Logs;
 using ServiceCenter.Redis;
 using ServiceCenter.SqlSugars;
 using SqlSugar;
+using System.Xml.Linq;
 using WCS.Entity;
+using static System.Runtime.InteropServices.JavaScript.JSType;
 using TaskStatus = WCS.Entity.TaskStatus;
 
 namespace WCS.WorkEngineering.Extensions
@@ -87,7 +89,10 @@ namespace WCS.WorkEngineering.Extensions
         {
             if (taskInfo.Status == TaskStatus.NewBuild) return;
             // 同步任务信息
-            var taskOld = db.Queryable<WCS_TaskOld>().Where(v => v.Id == taskInfo.ID).SplitTable(tabs => tabs.Take(2)).OrderByDescending(v => v.AddTime).First();
+            //Console.WriteLine($"开始找任务:{taskInfo.ID}");
+            var name = db.SplitHelper<WCS_TaskOld>().GetTableName(taskInfo.AddTime);
+            var taskOld = db.Queryable<WCS_TaskOld>().Where(v => v.Id == taskInfo.ID).SplitTable(tabs => tabs.InTableNames(name)).ToList().OrderByDescending(v => v.AddTime).First();
+            //Console.WriteLine($"找到任务:{taskInfo.ID}");
             if (taskOld is not null)
             {
                 if (taskInfo.Status >= TaskStatus.Finish) taskInfo.CompleteOrCancelTasks(db);
@@ -95,7 +100,9 @@ namespace WCS.WorkEngineering.Extensions
                 {
                     taskOld = taskInfo.Mapper<WCS_TaskOld, WCS_TaskInfo>();
                     taskOld.Id = taskInfo.ID;
-                    db.Updateable(taskOld).Where(x => x.Id == taskOld.Id).SplitTable(x => x.Take(2)).ExecuteCommand();
+                    //Console.WriteLine($"开始更新:{taskInfo.ID}");
+                    db.Updateable(taskOld).Where(x => x.Id == taskOld.Id).SplitTable(tabs => tabs.InTableNames(name)).ExecuteCommand();
+                    //Console.WriteLine($"更新结束:{taskInfo.ID}");
                 }
             }
             else
@@ -113,13 +120,14 @@ namespace WCS.WorkEngineering.Extensions
         {
             if (taskInfo.Status is not Entity.TaskStatus.Finish and not Entity.TaskStatus.Cancel) throw new KnownException("任务未完成或取消,无法执行WCS_TaskInfo与WCS_TaskOld同步动作", LogLevelEnum.Mid);
             // 任务完成或取消,进行相关同步动作
-            var taskOld = db.Queryable<WCS_TaskOld>().Where(v => v.Id == taskInfo.ID).SplitTable(tabs => tabs.Take(2)).OrderByDescending(v => v.AddTime).First();
+            var name = db.SplitHelper<WCS_TaskOld>().GetTableName(taskInfo.AddTime);
+            var taskOld = db.Queryable<WCS_TaskOld>().Where(v => v.Id == taskInfo.ID).SplitTable(tabs => tabs.InTableNames(name)).ToList().OrderByDescending(v => v.AddTime).First();
             if (taskOld is not null)
             {
                 taskOld = taskInfo.Mapper<WCS_TaskOld, WCS_TaskInfo>();
                 taskOld.Id = taskInfo.ID;
                 //更新任务历史表,删除任务当前表
-                db.Updateable(taskOld).SplitTable(x => x.Take(2)).ExecuteCommand();
+                db.Updateable(taskOld).Where(x => x.Id == taskOld.Id).SplitTable(tabs => tabs.InTableNames(name)).ExecuteCommand();
                 db.Deleteable(taskInfo).ExecuteCommand();
             }
             else
@@ -192,9 +200,10 @@ namespace WCS.WorkEngineering.Extensions
         /// <param name="task"></param>
         public static void InitStackStructure(this WCS_TaskInfo task, SqlSugarScopeProvider db)
         {
-            var billBomsetinfo = db.Queryable<BillBomsetinfo>().First(x => x.MatCode == task.MatCode);
-            var billBomsetinfos = db.Queryable<BillBomsetinfo>().Where(x => x.BomSetHdrId == billBomsetinfo.BomSetHdrId).ToList();
-            var billBomsetgrp = db.Queryable<BillBomsetgrp>().Single(x => x.Id == billBomsetinfo.BomSetHdrId);
+            var billBomsetgrp = db.Queryable<BillBomsetgrp>().Single(x => x.IsStop == 0 && x.BomCode.Contains(task.MatCode));
+            if (billBomsetgrp == null) throw new KnownException($"物料规格[{task.MatCode}]无可用码垛垛形", LogLevelEnum.Mid);
+            var billBomsetinfos = db.Queryable<BillBomsetinfo>().Where(x => x.BomSetHdrId == billBomsetgrp.Id).ToList();
+
 
             //开始构造垛形信息
             var palletizing = new WCS_Palletizing()

+ 174 - 162
业务工程/分拣库/WCS.WorkEngineering/Systems/NoInteractionSystems.cs

@@ -1,7 +1,7 @@
-using PlcSiemens.Core.Extension;
+using Newtonsoft.Json;
+using PlcSiemens.Core.Extension;
 using ServiceCenter.Extensions;
 using ServiceCenter.Logs;
-using ServiceCenter.Redis;
 using ServiceCenter.SqlSugars;
 using System.ComponentModel;
 using WCS.Core;
@@ -31,185 +31,197 @@ namespace WCS.WorkEngineering.Systems
 
         public override void Do(Device<IStation520> obj)
         {
-            RedisHub.Do(obj.Entity.Code, redis =>
+            var taskInfos = new List<int>();
+            World.Log($"进入处理");
+            SqlSugarHelper.Do(db =>
             {
-                var taskInfos = new List<WCS_TaskInfo>();
-                SqlSugarHelper.Do(db =>
-                {
-                    //获取所有的新建任务,组盘任务不需要
-                    taskInfos = db.Default.Queryable<WCS_TaskInfo>().Where(t => t.Status == Entity.TaskStatus.NewBuild && !(t.Type == TaskType.SetPlate && t.AddrFrom == "Robot")).ToList();
-                });
-                if (!taskInfos.Any()) return;
-                foreach (var item in taskInfos)
+                //获取所有的新建任务,组盘任务不需要
+                World.Log($"开始查询新建任务");
+                //taskInfos = db.Default.Queryable<WCS_TaskInfo>().Where(t => t.Status == Entity.TaskStatus.NewBuild && !(t.Type == TaskType.SetPlate && t.AddrFrom == "Robot")).Select(x => x.ID).ToList();
+                taskInfos = db.Default.Queryable<WCS_TaskInfo>().Where(x => x.Status == 0).ToList().Where(x => x.Type != TaskType.SetPlate || (x.Type == TaskType.SetPlate && x.AddrFrom != "Robot")).Select(x => x.ID).ToList();
+                World.Log($"查询结束");
+            });
+            if (!taskInfos.Any())
+            {
+                World.Log($"无可用执行任务");
+                return;
+            }
+            World.Log($"准备更新任务:{JsonConvert.SerializeObject(taskInfos)}");
+            foreach (var item in taskInfos)
+            {
+                try
                 {
-                    try
+                    SqlSugarHelper.Do(db =>
                     {
-                        SqlSugarHelper.Do(db =>
+                        //Console.WriteLine($"开始处理任务{item}");
+                        var task = db.Default.Queryable<WCS_TaskInfo>().Where(t => t.ID == item).First() ?? throw new Exception($"未找到对应的WCS任务[{item}]");
+                        switch (task.Type)
                         {
-                            var task = db.Default.Queryable<WCS_TaskInfo>().Where(t => t.ID == item.ID).First() ?? throw new Exception($"未找到对应的WCS任务[{item.ID}]");
-                            switch (task.Type)
-                            {
-                                case TaskType.SetPlate:
-                                    if (task.AddrFrom != "Robot")
-                                    {
-                                        //更新任务状态
-                                        task.Status = TaskStatus.WaitingToExecute;
-                                        db.Default.Updateable(task).ExecuteCommand();
-                                        task.AddWCS_TASK_DTL(db.Default, task.Device, $"初始化入库任务信息");
-                                    }
-                                    break;
-
-                                case TaskType.EnterDepot:
+                            case TaskType.SetPlate:
+                                if (task.AddrFrom != "Robot")
+                                {
                                     //更新任务状态
-                                    task.Status = Entity.TaskStatus.WaitingToExecute;
-                                    task.Device = task.WarehouseCode switch
-                                    {
-                                        "1N" => "SRM1",
-                                        "1S" => "SRM2",
-                                        "2N" => "SRM3",
-                                        "2S" => "SRM4",
-                                        "3N" => "SRM5",
-                                        "3S" => "SRM6",
-                                        _ => task.Device
-                                    };
-
-                                    task.Device = task.AddrFrom switch
-                                    {
-                                        "1666" or "1661" => "SRM1",
-                                        "1681" or "1676" => "SRM2",
-                                        "1696" or "1691" => "SRM3",
-                                        "1711" or "1706" => "SRM4",
-                                        "1726" or "1721" => "SRM5",
-                                        "1741" or "1736" => "SRM6",
-                                        _ => task.Device
-                                    };
-
-                                    //计算下一个地址
-                                    var path1 = DevicePath.GetPath(task.AddrFrom, task.Device);
-                                    task.AddrNext = path1.Points[1].Code;
-                                    task.SrmStation = task.BarCode.Contains("TPA") || task.BarCode.Contains("TPB") ? task.AddrFrom : path1.Points[2].Code;
-
+                                    task.Status = TaskStatus.WaitingToExecute;
+                                    World.Log($"准备更新任务:{task.ID}");
                                     db.Default.Updateable(task).ExecuteCommand();
+                                    World.Log($"更新任务:{task.ID}");
                                     task.AddWCS_TASK_DTL(db.Default, task.Device, $"初始化入库任务信息");
-                                    break;
-
-                                case TaskType.OutDepot:
+                                }
+                                break;
+
+                            case TaskType.EnterDepot:
+                                //更新任务状态
+                                task.Status = Entity.TaskStatus.WaitingToExecute;
+                                task.Device = task.WarehouseCode switch
+                                {
+                                    "1N" => "SRM1",
+                                    "1S" => "SRM2",
+                                    "2N" => "SRM3",
+                                    "2S" => "SRM4",
+                                    "3N" => "SRM5",
+                                    "3S" => "SRM6",
+                                    _ => task.Device
+                                };
+
+                                task.Device = task.AddrFrom switch
+                                {
+                                    "1666" or "1661" => "SRM1",
+                                    "1681" or "1676" => "SRM2",
+                                    "1696" or "1691" => "SRM3",
+                                    "1711" or "1706" => "SRM4",
+                                    "1726" or "1721" => "SRM5",
+                                    "1741" or "1736" => "SRM6",
+                                    _ => task.Device
+                                };
+
+                                //计算下一个地址
+                                var path1 = DevicePath.GetPath(task.AddrFrom, task.Device);
+                                task.AddrNext = path1.Points[1].Code;
+                                task.SrmStation = task.BarCode.Contains("TPA") || task.BarCode.Contains("TPB") ? task.AddrFrom : path1.Points[2].Code;
+
+                                db.Default.Updateable(task).ExecuteCommand();
+                                task.AddWCS_TASK_DTL(db.Default, task.Device, $"初始化入库任务信息");
+                                break;
+
+                            case TaskType.OutDepot:
+                                {
+                                    if (task.Device.Contains("Robot"))
                                     {
-                                        if (task.Device.Contains("Robot"))
-                                        {
-                                            var pos = task.AddrFrom.Split("-");
-                                            task.Status = Entity.TaskStatus.WaitingToExecute;
-                                            task.Line = pos[0].ToShort();
-                                            task.Col = pos[1].ToShort();
-                                            task.Layer = pos[2].ToShort();
-                                            task.Depth = pos[3].ToShort();
-                                            db.Default.Updateable(task).ExecuteCommand();
-                                            task.AddWCS_TASK_DTL(db.Default, task.Device, $"初始化出库任务信息,放货站台:{task.SrmStation}");
-                                        }
-                                        else
+                                        var pos = task.AddrFrom.Split("-");
+                                        task.Status = Entity.TaskStatus.WaitingToExecute;
+                                        task.Line = pos[0].ToShort();
+                                        task.Col = pos[1].ToShort();
+                                        task.Layer = pos[2].ToShort();
+                                        task.Depth = pos[3].ToShort();
+                                        db.Default.Updateable(task).ExecuteCommand();
+                                        task.AddWCS_TASK_DTL(db.Default, task.Device, $"初始化出库任务信息,放货站台:{task.SrmStation}");
+                                    }
+                                    else
+                                    {
+                                        if (task.SrmStation == "1")
                                         {
-                                            if (task.SrmStation == "1")
+                                            var srmStation = new string[2];
+                                            switch (task.Device)
                                             {
-                                                var srmStation = new string[2];
-                                                switch (task.Device)
-                                                {
-                                                    case "SRM1":
-                                                        srmStation[0] = "2534";
-                                                        srmStation[1] = "2533";
-                                                        break;
-
-                                                    case "SRM2":
-                                                        srmStation[0] = "2734";
-                                                        srmStation[1] = "2733";
-                                                        break;
-                                                    case "SRM3":
-                                                        srmStation[0] = "2934";
-                                                        srmStation[1] = "2933";
-                                                        break;
-                                                    case "SRM4":
-                                                        srmStation[0] = "3134";
-                                                        srmStation[1] = "3133";
-
-
-                                                        break;
-                                                    case "SRM5":
-                                                        srmStation[0] = "3334";
-                                                        srmStation[1] = "3333";
-                                                        break;
-                                                    case "SRM6":
-                                                        srmStation[0] = "3534";
-                                                        srmStation[1] = "3533";
-                                                        break;
-                                                }
-
-                                                //TODO:暂时不考虑入库卡控
-                                                //开始计算当前这个任务要从哪个站台出
-                                                //计算两个站台小于取货完成数量的AGV任务
-                                                var agv1 = db.Default.Queryable<WCS_AgvTaskInfo>().SplitTable(x => x.Take(2)).Count(x => x.Status <= AGVTaskStatus.LeaveGet && x.Station == srmStation[0]);
-                                                var agv2 = db.Default.Queryable<WCS_AgvTaskInfo>().SplitTable(x => x.Take(2)).Count(x => x.Status <= AGVTaskStatus.LeaveGet && x.Station == srmStation[1]);
-                                                task.SrmStation = "";
-                                                task.AddrTo = agv1 > agv2 ? srmStation[1] : srmStation[0];
+                                                case "SRM1":
+                                                    srmStation[0] = "2534";
+                                                    srmStation[1] = "2533";
+                                                    break;
+
+                                                case "SRM2":
+                                                    srmStation[0] = "2734";
+                                                    srmStation[1] = "2733";
+                                                    break;
+
+                                                case "SRM3":
+                                                    srmStation[0] = "2934";
+                                                    srmStation[1] = "2933";
+                                                    break;
+
+                                                case "SRM4":
+                                                    srmStation[0] = "3134";
+                                                    srmStation[1] = "3133";
+
+                                                    break;
+
+                                                case "SRM5":
+                                                    srmStation[0] = "3334";
+                                                    srmStation[1] = "3333";
+                                                    break;
+
+                                                case "SRM6":
+                                                    srmStation[0] = "3534";
+                                                    srmStation[1] = "3533";
+                                                    break;
                                             }
-                                            if (task.SrmStation.IsNullOrEmpty()) //如果没有指定放货站台
+
+                                            //TODO:暂时不考虑入库卡控
+                                            //开始计算当前这个任务要从哪个站台出
+                                            //计算两个站台小于取货完成数量的AGV任务
+                                            var agv1 = db.Default.Queryable<WCS_AgvTaskInfo>().Where(x => x.Status <= AGVTaskStatus.LeaveGet && x.Station == srmStation[0]).SplitTable(x => x.Take(2)).Count();
+                                            var agv2 = db.Default.Queryable<WCS_AgvTaskInfo>().Where(x => x.Status <= AGVTaskStatus.LeaveGet && x.Station == srmStation[1]).SplitTable(x => x.Take(2)).Count();
+                                            task.SrmStation = "";
+                                            task.AddrTo = agv1 > agv2 ? srmStation[1] : srmStation[0];
+                                        }
+                                        if (task.SrmStation.IsNullOrEmpty()) //如果没有指定放货站台
+                                        {
+                                            if (task.Device.IsNullOrEmpty())
                                             {
-                                                if (task.Device.IsNullOrEmpty())
-                                                {
-                                                    task.Device = "SRM" + task.Tunnel.GetLastDigit();
-                                                }
-                                                //获取堆垛机到目标地址的路径信息
-                                                var path = DevicePath.GetPath(task.Device, task.AddrTo);
-                                                task.SrmStation = path.Points[1].Code;
+                                                task.Device = "SRM" + task.Tunnel.GetLastDigit();
                                             }
+                                            //获取堆垛机到目标地址的路径信息
+                                            var path = DevicePath.GetPath(task.Device, task.AddrTo);
+                                            task.SrmStation = path.Points[1].Code;
+                                        }
 
-                                            var devs = Device.All.Where(x => x.HasFlag(DeviceFlags.AGV取货站台口)).Select(x => x.Code);
-                                            if (devs.Contains(task.SrmStation))
+                                        var devs = Device.All.Where(x => x.HasFlag(DeviceFlags.AGV取货站台口)).Select(x => x.Code);
+                                        if (devs.Contains(task.SrmStation))
+                                        {
+                                            //开始处理车间叫料AGV任务任务
+                                            db.Default.Insertable(new WCS_AgvTaskInfo()
                                             {
-                                                //开始处理车间叫料AGV任务任务
-                                                db.Default.Insertable(new WCS_AgvTaskInfo()
-                                                {
-                                                    ID = db.GetAgvTaskId(),
-                                                    TaskType = AGVTaskType.CallMaterial,
-                                                    Status = AGVTaskStatus.NewBuild,
-                                                    TaskId = task.ID,
-                                                    Position = task.WorkBench,
-                                                    Station = task.SrmStation,
-                                                    AddWho = "WCS",
-                                                    AddTime = DateTime.Now
-                                                }).SplitTable().ExecuteCommand();
-
-                                                db.Default.Insertable(new WCS_AgvTaskInfo()
-                                                {
-                                                    ID = db.GetAgvTaskId(),
-                                                    TaskType = AGVTaskType.EnterDepot,
-                                                    Status = AGVTaskStatus.NewBuild,
-                                                    TaskId = task.ID,
-                                                    Position = task.WorkBench,
-                                                    Station = "2501",
-                                                    AddWho = "WCS",
-                                                    AddTime = DateTime.Now
-                                                }).SplitTable().ExecuteCommand();
-                                            }
-                                            //更新任务状态
-                                            task.Status = Entity.TaskStatus.WaitingToExecute;
-                                            db.Default.Updateable(task).ExecuteCommand();
-                                            task.AddWCS_TASK_DTL(db.Default, task.Device, $"初始化出库任务信息,放货站台:{task.SrmStation}");
+                                                ID = db.GetAgvTaskId(),
+                                                TaskType = AGVTaskType.CallMaterial,
+                                                Status = AGVTaskStatus.NewBuild,
+                                                TaskId = task.ID,
+                                                Position = task.WorkBench,
+                                                Station = task.SrmStation,
+                                                AddWho = "WCS",
+                                                AddTime = DateTime.Now
+                                            }).SplitTable().ExecuteCommand();
+
+                                            db.Default.Insertable(new WCS_AgvTaskInfo()
+                                            {
+                                                ID = db.GetAgvTaskId(),
+                                                TaskType = AGVTaskType.EnterDepot,
+                                                Status = AGVTaskStatus.NewBuild,
+                                                TaskId = task.ID,
+                                                Position = task.WorkBench,
+                                                Station = "2501",
+                                                AddWho = "WCS",
+                                                AddTime = DateTime.Now
+                                            }).SplitTable().ExecuteCommand();
                                         }
-                                        break;
+                                        //更新任务状态
+                                        task.Status = Entity.TaskStatus.WaitingToExecute;
+                                        db.Default.Updateable(task).ExecuteCommand();
+                                        task.AddWCS_TASK_DTL(db.Default, task.Device, $"初始化出库任务信息,放货站台:{task.SrmStation}");
                                     }
-                                case TaskType.Delivery:
-                                    break;
-
-                                case TaskType.EmptyInit:
                                     break;
-                            }
-                        });
-                    }
-                    catch (Exception ex)
-                    {
-                        World.Log(ex.Message, LogLevelEnum.Mid);
-                    }
+                                }
+                            case TaskType.Delivery:
+                                break;
+
+                            case TaskType.EmptyInit:
+                                break;
+                        }
+                    });
                 }
-            });
+                catch (Exception ex)
+                {
+                    World.Log(ex.Message, LogLevelEnum.Mid);
+                }
+            }
         }
 
         public override bool Select(Device dev)

+ 10 - 3
业务工程/分拣库/WCS.WorkEngineering/Systems/分拣支线/环形库分流点.cs

@@ -40,15 +40,22 @@ namespace WCS.WorkEngineering.Systems
                 var taskInfo = db.Queryable<WCS_TaskInfo>().First(v => v.ID == obj.Data2.TaskNumber && v.Status == TaskStatus.WaitingToExecute && !v.BarCode.Contains("Error"));
                 if (obj.Data2.TaskNumber == 1)
                 {
-                    var type = obj.Data4.Length.ToInt().ToString();
-
+                    var goodsType = obj.Data4.Length.ToInt();
+                    var type = goodsType.ToString();
                     //找到一条起点是当前位置且状态小于2的任务
-                    taskInfo = db.Queryable<WCS_TaskInfo>().OrderBy(x => x.AddTime).First(x => x.AddrFrom == obj.Entity.Code && x.Status == TaskStatus.WaitingToExecute && x.BarCode.Contains("Error") && x.AddrNext == null);
+                    taskInfo = db.Queryable<WCS_TaskInfo>().OrderBy(x => x.AddTime).First(x => x.AddrFrom == obj.Entity.Code
+                        && x.BarCode.Contains("Error")
+                        && x.AddrNext == null && x.GoodsType == goodsType);
                     if (taskInfo == null)
                     {
                         WmsApi.PalletizingCreateseErrorTasks(obj.Entity.Code, type);
                         return;
                     }
+                    if (taskInfo.Status == TaskStatus.NewBuild)
+                    {
+                        World.Log($"等待任务{taskInfo.ID}完成初始化");
+                        return;
+                    }
                 }
                 else
                 if (taskInfo == null) throw new KnownException($"未找到对应的WCS任务{obj.Data2.TaskNumber}", LogLevelEnum.Mid);

+ 1 - 1
业务工程/分拣库/WCS.WorkEngineering/Systems/环形库/机械臂cs.cs

@@ -426,7 +426,7 @@ namespace WCS.WorkEngineering.Systems
 
         public override bool Select(Device dev)
         {
-            return dev.Code is "Robot1" or "Robot2" or "Robot3" or "Robot4" or "Robot5" or "Robot6";
+            return dev.Code is "Robot1" or "Robot2" or "Robot3" or "Robot4"/* or "Robot5" or "Robot6"*/;
         }
     }
 }

+ 4 - 3
业务工程/分拣库/WCS.WorkEngineering/Systems/环形库/环形库码垛区补空托盘任务生成.cs

@@ -17,15 +17,15 @@ namespace WCS.WorkEngineering.Systems
     /// </summary>
     [BelongTo(typeof(PalletizingWorld))]
     [Description("码垛区域生成空托盘任务")]
-    public class 码垛区域生成空托盘任务 : DeviceSystem<Device<IStation520, IStation521, IStation523>>
+    public class 码垛区域生成空托盘任务 : DeviceSystem<Device<IStation520>>
     {
         protected override bool ParallelDo => true;
 
         protected override bool SaveLogsToFile => true;
 
-        public override void Do(Device<IStation520, IStation521, IStation523> obj)
+        public override void Do(Device<IStation520> objDev)
         {
-            if (obj.Entity.Code == nameof(TrussCreateEmptyTray))
+            if (objDev.Entity.Code == nameof(TrussCreateEmptyTray))
             {
                 WCS_Palletizing palletizing = null;
                 SqlSugarHelper.Do(_db =>
@@ -83,6 +83,7 @@ namespace WCS.WorkEngineering.Systems
             }
             else
             {
+                var obj = new Device<IStation520, IStation521, IStation523>(Device.All.First(x => x.Code == objDev.Entity.Code), World);
                 if (obj.Data3.Status.HasFlag(StationStatus.PH_Status)) return;
                 WCS_TaskInfo deliveryTask = null;
                 SqlSugarHelper.Do(_db =>

+ 1 - 1
业务工程/分拣库/WCS.WorkEngineering/WebApi/Controllers/WmsApi.cs

@@ -496,7 +496,7 @@ namespace WCS.WorkEngineering.WebApi.Controllers
         /// <exception cref="KnownException"></exception>
         public static SRes PalletizingCreateseErrorTasks(string loc, string type)
         {
-            var res = APICaller.CallApi<SRes>(WmsUrl + "/api/FJ/PalletizingCreateseErrorTasks", new Models.WMS.Request.PalletizingCreateseErrorTasksRequest(loc, type, loc.GetWareCode()));
+            var res = APICaller.CallApi2<SRes>(WmsUrl + "/api/FJ/PalletizingCreateseErrorTasks", new Models.WMS.Request.PalletizingCreateseErrorTasksRequest(loc, type, loc.GetWareCode()));
 
             if (res.ResCode != ResponseStatusCodeEnum.Sucess)
             {

+ 2 - 2
业务工程/分拣库/WCS.WorkEngineering/Worlds/MainWorld.cs

@@ -36,7 +36,7 @@ namespace WCS.WorkEngineering.Worlds
         ///  更新前执行,重写改方法后请自行添加执行内容
         ///  执行内容:清空日志队列
         /// </summary>
-        protected override void BeforeUpdate(List<WorkTimes> list)
+        protected override void BeforeUpdate()
         {
             // 清空日志队列,确保日志队列中只会有当前周期日志
             Logs.Clear();
@@ -46,7 +46,7 @@ namespace WCS.WorkEngineering.Worlds
         /// 更新后执行,重写改方法后请自行添加执行内容
         /// 执行内容:清空日志队列
         /// </summary>
-        protected override void AfterUpdate(List<WorkTimes> list)
+        protected override void AfterUpdate()
         {
             LogHub.WorldPublish(Logs, this.GetType().Name);
         }