From 0b5ccdca6263cf7a2cee460f30c76ef1efea2811 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 27 四月 2024 17:47:27 +0800
Subject: [PATCH] 人工出库,人工入库,人工移库,PDA扫码确认外协物料已被取走接口

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/GantryJob.cs |  135 +++++---------------------------------------
 1 files changed, 16 insertions(+), 119 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/GantryJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/GantryJob.cs"
index baffdeb..21d47a4 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/GantryJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/GantryJob.cs"
@@ -5,11 +5,13 @@
 using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
+using System.Xml.Linq;
 using WIDESEA_Comm.DBItem;
 using WIDESEA_Comm.ItemDB;
 using WIDESEA_Core.EFDbContext;
 using WIDESEA_Entity.DomainModels;
 using WIDESEA_WCS.IRepositories;
+using WIDESEA_WCS.Jobs;
 using WIDESEA_WCS.Repositories;
 using WIDESEA_WCS.WCSClient;
 
@@ -19,137 +21,32 @@
     /// 妗佹灦
     /// </summary>
     [DisallowConcurrentExecution]
-    public class GantryJob : IJob
+    public class GantryJob : JobBase, IJob
     {
         public Task Execute(IJobExecutionContext context)
         {
             try
             {
-                var client = context.JobDetail.JobDataMap.Get("JobParams") as PLCClient;
-                if (client == null)
-                {
-                    return Task.CompletedTask;
-                }
-
-                //鑷姩閲嶈繛
-                if (!client.IsConnected)
-                {
-                    client.Connect();
-                    return Task.CompletedTask;
-                }
-
-                //DoAction(client);
-                //ExecuteJob(context, DoAction);
+                ExecuteJob(context, DoAction);
             }
             catch { }
             return Task.CompletedTask;
         }
-        static List<MachineDB> MachineDBs = new List<MachineDB>();
-        static List<WheelDataDB> wheelDataDBs = new List<WheelDataDB>();
-        private void DoAction(PLCClient client)
+
+        private void DoAction(IJobExecutionContext context)
         {
-            try
+            var client = context.JobDetail.JobDataMap.Get("JobParams") as PLCClient;
+            //鑷姩閲嶈繛
+            if (!client.IsConnected)
             {
-                VOLContext Context = new VOLContext();
-                Idt_plcinfoheadRepository repository = new dt_plcinfoheadRepository(Context);
-                Idt_plcinfodetailRepository plcRepository = new dt_plcinfodetailRepository(Context);
-
-                var plc = repository.FindFirst(x => x.plcinfo_name == client.PLCName);
-                var numbers = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep).GroupBy(x => x.plcdetail_number).ToList();
-                foreach (var number in numbers)
-                {
-                    if (number.Key.Contains("杈婇亾涓嬫枡"))
-                    {
-                        PropertyInfo[] propertyInfos = typeof(WheelDataDB).GetProperties();//鑾峰彇鎵�鏈夊睘鎬�
-                        WheelDataDB dBItem = wheelDataDBs.Where(x => x.R_Name == number.Key).FirstOrDefault();
-                        if (dBItem == null)
-                        {
-                            dBItem = new();
-                            dBItem.OnReadSignal += HandleReadSignal;
-                            wheelDataDBs.Add(dBItem);
-                        }
-                        List<dt_plcinfodetail> details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == number.Key).ToList();
-                        for (int i = 0; i < propertyInfos.Length; i++)
-                        {
-                            if (i == 0)
-                            {
-                                dBItem.R_Name = number.Key;
-                            }
-                            else
-                            {
-                                object readData = DBExtension.Read(details.Where(x => x.plcdetail_name == propertyInfos[i].Name).FirstOrDefault(), client);
-                                if (readData != null) { }
-                                object obj = propertyInfos[i].GetValue(dBItem);
-                                if (obj != readData)
-                                    propertyInfos[i].SetValue(dBItem, readData);
-                            }
-                        }
-                    }
-                    else
-                    {
-
-                        PropertyInfo[] propertyInfos = typeof(MachineDB).GetProperties();//鑾峰彇鎵�鏈夊睘鎬�
-                        MachineDB dBItem = MachineDBs.Where(x => x.R_Name == number.Key).FirstOrDefault();
-                        if (dBItem == null)
-                        {
-                            dBItem = new();
-                            dBItem.OnReadSignal += HandleReadSignal;
-                            MachineDBs.Add(dBItem);
-                        }
-                        List<dt_plcinfodetail> details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == number.Key).ToList();
-                        for (int i = 0; i < propertyInfos.Length; i++)
-                        {
-                            if (i == 0)
-                            {
-                                dBItem.R_Name = number.Key;
-                            }
-                            else
-                            {
-                                object readData = DBExtension.Read(details.Where(x => x.plcdetail_name == propertyInfos[i].Name).FirstOrDefault(), client);
-                                if (readData != null) { }
-                                object obj = propertyInfos[i].GetValue(dBItem);
-                                if (obj != readData)
-                                    propertyInfos[i].SetValue(dBItem, readData);
-                            }
-                        }
-                    }
-                }
+                client.Connect();
+                return;
             }
-            catch (Exception ex)
-            {
-
-                throw;
-            }
-        }
-        public void HandleReadSignal(string type, MachineDB DBItem)
-        {
-            switch (type)
-            {
-                case OperationType.OperationType_Record:
-
-                    break;
-                case OperationType.OperationType_Processor:
-
-                    break;
-                case OperationType.OperationType_WheelData:
-
-                    break;
-            }
-        }
-        public void HandleReadSignal(string type, WheelDataDB DBItem)
-        {
-            switch (type)
-            {
-                case OperationType.OperationType_Record:
-
-                    break;
-                case OperationType.OperationType_Processor:
-
-                    break;
-                case OperationType.OperationType_WheelData:
-
-                    break;
-            }
+            client.WriteByOrder("W_Palpitate", client.ReadByOrder<bool>("R_Palpitate", "蹇冭烦"));
+            Gantry gantry = new Gantry();
+            gantry.QueryOrder(client);
+            gantry.QueryWheeldata(client);
+            gantry.Layofflevel(client);
         }
     }
 }

--
Gitblit v1.9.3