分支自 SuZhouGuanHong/TaiYuanTaiZhong

huanghongfeng
2024-07-07 b3be11f03a2537238fef3ea59503029ee822b7b0
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK4Job.cs
@@ -6,7 +6,7 @@
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Comm.PLCDBItem;
using WIDESEA_Comm;
using WIDESEA_Core.Extensions;
using WIDESEA_WCS.Jobs;
using WIDESEA_WCS.WCSClient;
@@ -30,7 +30,6 @@
            return Task.CompletedTask;
        }
        public static StackerReadDBItem StackerDBItem;
        private void DoAction(IJobExecutionContext context)
        {
            var client = context.JobDetail.JobDataMap.Get("JobParams") as PLCClient;
@@ -40,40 +39,22 @@
                client.Connect();
                return;
            }
            PropertyInfo[] propertyInfos = typeof(StackerReadDBItem).GetProperties();
            if (StackerDBItem == null)
            {
                StackerDBItem = new();
                //StackerDBItem.OnReadStackerSignal += HandleReadStackerSignal;
            }
            List<StackerReadDBItem> StackerReadDBItems = new List<StackerReadDBItem>();
            var groups = client.itemGroups.OrderBy(x => x.Methods).ThenBy(x=>x.name).GroupBy(x => x.Methods);
            foreach (var key in groups)
            {
                //foreach (var item in key)
                //{
                    for (int i = 0; i < propertyInfos.Length; i++)
                    {
                        if (i == 0)
                        {
                            StackerDBItem.StackerNo = key.First(x=>true).Methods;
                        }
                        else
                        {
                            DBItemGroup group = key.FirstOrDefault(x => x.name == propertyInfos[i].Name);
                            if (group != null)
                            {
                                object readData = DBExtension.Read(group, client);
                                object obj = propertyInfos[i].GetValue(StackerDBItem);
                                if (obj != readData)
                                    propertyInfos[i].SetValue(StackerDBItem, readData);
                            }
                        }
                    }
                    StackerReadDBItems.Add(StackerDBItem);
                //}
            }
            #region 淇℃伅浜や簰
            info_interaction.wheeldata(client);
            info_interaction.scan(client);
            info_interaction.labeller(client);
            #endregion
            #region 杞﹁疆淇℃伅杩芥函
            Wheel_info_trace.Wheel_online(client);
            Wheel_info_trace.Wheel_machine(client);
            Wheel_info_trace.Wheel_offline(client);
            #endregion
            #region 淇℃伅閲囬泦
            WheelDBItem.VK4WheelDBItem = GetDate.GetWheelDate(client);
            VKDBItem.VK4DBItem = GetDate.GetVKDate(client);
            GantryDBItem.VK4GantryDBItem = GetDate.GetGantryDate(client);
            MachineDBItem.VK4MachineDBItem = GetDate.GetMachineDate(client);
            #endregion
        }
    }
}