From 227cf5ae845198eb25552d3db7509c0ed517f69a Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 07 六月 2024 14:20:13 +0800
Subject: [PATCH] 获取VK4和VK5的所有显示工位车轮数据
---
代码管理/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/StackerReadDBItem.cs | 16 -
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/One_two_unitJob.cs | 291 +++++++++++++------------------
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/GetWheelDate.cs | 66 +++++++
代码管理/PCS/WCS_Server/WIDESEA_WCS/WCSClient/Siemens/SiemensPLCClient.cs | 8
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK4Job.cs | 40 ----
.gitignore | 1
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK5Job.cs | 43 ++++
代码管理/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/WheelDBItem.cs | 46 +++++
8 files changed, 296 insertions(+), 215 deletions(-)
diff --git a/.gitignore b/.gitignore
index a7080f8..4c2bb8f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,4 @@
/浠g爜绠$悊/WMS/WMS_Client/dist.zip
/浠g爜绠$悊/WMS/WMS_Client/dist.zip
/浠g爜绠$悊/WMS/WMS_Client/dist.zip
+/浠g爜绠$悊/PCS/WCS_Server.zip
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/StackerReadDBItem.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/StackerReadDBItem.cs"
index eeab48c..20cf590 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/StackerReadDBItem.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/StackerReadDBItem.cs"
@@ -4,15 +4,17 @@
using System.Text;
using System.Threading.Tasks;
-namespace WIDESEA_Comm.PLCDBItem
+namespace WIDESEA_Comm
{
/// <summary>
/// 杈婇亾淇℃伅
/// </summary>
public class StackerReadDBItem
{
- public event Action<string, StackerReadDBItem> OnReadStackerSignal;
-
+ /// <summary>
+ /// 瀵硅薄闆嗗悎
+ /// </summary>
+ public static List<StackerReadDBItem> StackerReadDBItems = new List<StackerReadDBItem>();
/// <summary>
/// 杈婇亾缂栧彿
/// </summary>
@@ -47,13 +49,5 @@
/// 璇诲彇杈婇亾direction
/// </summary>
public byte R_direction { get; set; }
-
- public void ReadSignal(string signalType, StackerReadDBItem dBItem)
- {
- Task.Run(() =>
- {
- OnReadStackerSignal?.Invoke(signalType, dBItem);
- });
- }
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/WheelDBItem.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/WheelDBItem.cs"
new file mode 100644
index 0000000..c24e8b6
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/WheelDBItem.cs"
@@ -0,0 +1,46 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Comm
+{
+ public class WheelDBItem
+ {
+ /// <summary>
+ /// 瀵硅薄闆嗗悎
+ /// </summary>
+ public static List<WheelDBItem> VK4WheelDBItem = new List<WheelDBItem>();
+
+ /// <summary>
+ /// 瀵硅薄闆嗗悎
+ /// </summary>
+ public static List<WheelDBItem> VK5WheelDBItem = new List<WheelDBItem>();
+
+ /// <summary>
+ /// 缂栧彿
+ /// </summary>
+ public string StackerNo { get; set; }
+
+ /// <summary>
+ /// 杞﹁疆SN鍙�
+ /// </summary>
+ public string R_wheel_SN { get; set; }
+
+ /// <summary>
+ /// 杞﹁疆绫诲瀷
+ /// </summary>
+ public Int16 R_wheel_type { get; set; }
+
+ /// <summary>
+ /// 杞﹁疆鐘舵��
+ /// </summary>
+ public byte R_part_status { get; set; }
+
+ /// <summary>
+ /// 杞﹁疆宸ヨ壓
+ /// </summary>
+ public byte R_part_process { get; set; }
+ }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/GetWheelDate.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/GetWheelDate.cs"
new file mode 100644
index 0000000..75c32e3
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/equipment/GetWheelDate.cs"
@@ -0,0 +1,66 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm;
+using WIDESEA_WCS.WCSClient;
+
+namespace WIDESEA_WCS
+{
+ public class GetDate
+ {
+ /// <summary>
+ /// 鑾峰彇杞﹁疆鏁版嵁
+ /// </summary>
+ public static void GetWheelDate(PLCClient client)
+ {
+ PropertyInfo[] propertyInfos = typeof(WheelDBItem).GetProperties();
+ var groups = client.itemGroups.OrderBy(x => x.Methods).ThenBy(x => x.name).GroupBy(x => x.Methods).ToList();
+ foreach (var key in groups)
+ {
+ WheelDBItem StackerDBItem = new WheelDBItem();
+ foreach (var propertyInfo in propertyInfos)
+ {
+ if (propertyInfo.Name == "StackerNo")
+ {
+ StackerDBItem.StackerNo = key.Key;
+ }
+ else
+ {
+ DBItemGroup group = key.FirstOrDefault(x => x.name == propertyInfo.Name);
+ if (group != null)
+ {
+ var readData = DBExtension.Read(group, client);
+ switch (propertyInfo.Name)
+ {
+ case "R_wheel_SN":
+ StackerDBItem.R_wheel_SN = readData.ToString();
+ break;
+ case "R_wheel_type":
+ StackerDBItem.R_wheel_type = Convert.ToInt16(readData);
+ break;
+ case "R_part_status":
+ StackerDBItem.R_part_status = Convert.ToByte(readData);
+ break;
+ case "R_part_process":
+ StackerDBItem.R_part_process = Convert.ToByte(readData);
+ break;
+ }
+ }
+ }
+ }
+ switch (client.PLCName)
+ {
+ case "VK4":
+ WheelDBItem.VK4WheelDBItem.Add(StackerDBItem);
+ break;
+ case "VK5":
+ WheelDBItem.VK5WheelDBItem.Add(StackerDBItem);
+ break;
+ }
+ }
+ }
+ }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/One_two_unitJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/One_two_unitJob.cs"
index 4d1d7fc..3e7898c 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/One_two_unitJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/One_two_unitJob.cs"
@@ -1,4 +1,5 @@
锘縰sing FreeSql;
+using OfficeOpenXml.Drawing.Chart;
using Quartz;
using System;
using System.Collections.Generic;
@@ -6,12 +7,15 @@
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using WIDESEA_Comm;
using WIDESEA_Comm.ItemDB;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Core.EFDbContext;
+using WIDESEA_Core.Extensions;
using WIDESEA_Entity.DomainModels;
using WIDESEA_WCS.IRepositories;
using WIDESEA_WCS.IServices;
+using WIDESEA_WCS.Jobs;
using WIDESEA_WCS.Repositories;
using WIDESEA_WCS.Services;
using WIDESEA_WCS.WCSClient;
@@ -23,186 +27,141 @@
/// 涓�浜屽崟鍏冭皟搴�
/// </summary>
[DisallowConcurrentExecution]
- public class One_two_unitJob : IJob
+ public class One_two_unitJob : 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);
- }
- catch { }
- return Task.CompletedTask;
- }
- static List<GDXDB> gDXDBs = new List<GDXDB>();
- private void DoAction(PLCClient client)
- {
- try
- {
- #region 璇诲啓鏂规硶銆佹棩蹇椼�佹墽琛屾椂闂�
- //client.Write("DB400.DBX0", "123456");
- //client.WriteByOrder("R_wheel_SN", "123456", "4.1");
- //client.WriteByOrder("R_wheel_SN", "666666", "4.2");
-
- //var res = client.Read<string>("DB400.DBX0", 20);
- //var res1 = client.ReadByOrder<string>("R_wheel_SN", "4.1");
- //var res2 = client.ReadByOrder<string>("R_wheel_SN", "4.2");
-
- //鏃ュ織鍐欏叆
- //WriteDBLog.Info("涓�浜屽崟鍏冭皟搴�", "4.1:" + res1 + ";4.2:" + res2, "PCS");
-
- //鎵ц瀹屾垚鏃堕棿
- //Console.WriteLine(DateTime.Now);
- #endregion
-
- #region 娣诲姞PLC鍦板潃淇℃伅
- //VOLContext Context = new VOLContext();
- //Idt_plcinfodetailRepository dt_PlcinfodetailService = new dt_plcinfodetailRepository(Context);
- //List<dt_plcinfodetail> plcinfodetails = new List<dt_plcinfodetail>();
- //for (int i = 106; i <= 110; i++)
- //{
- // dt_plcinfodetail dt_Plcinfodetail = new dt_plcinfodetail()
- // {
- // plcdetail_id = Guid.NewGuid(),
- // plcdetail_iotype = "One_two_unit",
- // plcdetail_db = "DB400",
- // plcdetail_value = "DBX" + ((i - 1) * 30),
- // plcdetail_valtype = "string",
- // plcdetail_len = 20,
- // plcdetail_name = "R_wheel_SN",
- // plcdetail_number = "7." + (i - 80),
- // plcdetail_remark = "璇诲彇杞﹁疆SN鍙�"
- // };
- // plcinfodetails.Add(dt_Plcinfodetail);
- // dt_plcinfodetail dt_Plcinfodetail1 = new dt_plcinfodetail()
- // {
- // plcdetail_id = Guid.NewGuid(),
- // plcdetail_iotype = "One_two_unit",
- // plcdetail_db = "DB400",
- // plcdetail_value = "DBX" + ((i - 1) * 30 + 20),
- // plcdetail_valtype = "int",
- // plcdetail_name = "R_wheel_type",
- // plcdetail_number = "7." + (i - 80),
- // plcdetail_remark = "璇诲彇杞﹁疆绫诲瀷"
- // };
- // plcinfodetails.Add(dt_Plcinfodetail1);
- // dt_plcinfodetail dt_Plcinfodetail2 = new dt_plcinfodetail()
- // {
- // plcdetail_id = Guid.NewGuid(),
- // plcdetail_iotype = "One_two_unit",
- // plcdetail_db = "DB400",
- // plcdetail_value = "DBX" + ((i - 1) * 30 + 22),
- // plcdetail_valtype = "byte",
- // plcdetail_name = "R_part_status",
- // plcdetail_number = "7." + (i - 80),
- // plcdetail_remark = "璇诲彇杞﹁疆闆朵欢鐘舵��"
- // };
- // plcinfodetails.Add(dt_Plcinfodetail2);
- // dt_plcinfodetail dt_Plcinfodetail3 = new dt_plcinfodetail()
- // {
- // plcdetail_id = Guid.NewGuid(),
- // plcdetail_iotype = "One_two_unit",
- // plcdetail_db = "DB400",
- // plcdetail_value = "DBX" + ((i - 1) * 30 + 23),
- // plcdetail_valtype = "byte",
- // plcdetail_name = "R_part_process",
- // plcdetail_number = "7." + (i - 80),
- // plcdetail_remark = "璇诲彇杞﹁疆闆朵欢宸ヨ壓"
- // };
- // plcinfodetails.Add(dt_Plcinfodetail3);
- // dt_plcinfodetail dt_Plcinfodetail4 = new dt_plcinfodetail()
- // {
- // plcdetail_id = Guid.NewGuid(),
- // plcdetail_iotype = "One_two_unit",
- // plcdetail_db = "DB400",
- // plcdetail_value = "DBX" + ((i - 1) * 30 + 24),
- // plcdetail_valtype = "byte",
- // plcdetail_name = "R_machine_nr",
- // plcdetail_number = "7." + (i - 80),
- // plcdetail_remark = "璇诲彇杈婇亾machine_nr"
- // };
- // plcinfodetails.Add(dt_Plcinfodetail4);
- // dt_plcinfodetail dt_Plcinfodetail5 = new dt_plcinfodetail()
- // {
- // plcdetail_id = Guid.NewGuid(),
- // plcdetail_iotype = "One_two_unit",
- // plcdetail_db = "DB400",
- // plcdetail_value = "DBX" + ((i - 1) * 30 + 25),
- // plcdetail_valtype = "byte",
- // plcdetail_name = "R_direction",
- // plcdetail_number = "7." + (i - 80),
- // plcdetail_remark = "璇诲彇杈婇亾direction"
- // };
- // plcinfodetails.Add(dt_Plcinfodetail5);
- //}
- //dt_PlcinfodetailService.AddRange(plcinfodetails, true);
- #endregion
-
- VOLContext Context = new VOLContext();
- Idt_plcinfoheadRepository repository = new dt_plcinfoheadRepository(Context);
- Idt_plcinfodetailRepository plcRepository = new dt_plcinfodetailRepository(Context);
-
- PropertyInfo[] propertyInfos = typeof(GDXDB).GetProperties();//鑾峰彇鎵�鏈夊睘鎬�
- 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)
- {
- GDXDB dBItem = gDXDBs.Where(x => x.R_Name == number.Key).FirstOrDefault();
- if (dBItem == null)
- {
- dBItem = new();
- dBItem.OnReadSignal += HandleReadSignal;
- gDXDBs.Add(dBItem);
- //object obj = dBItem.R_part_status;
- //dBItem.R_part_status = client.Read<byte>(number.Key);
- }
- 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);
- }
- }
- }
+ AddDB();
+ //ExecuteJob(context, DoAction);
}
catch (Exception ex)
{
- Console.WriteLine(ex.Message);
+
}
+ return Task.CompletedTask;
}
- public void HandleReadSignal(GDXDB DBItem)
+ private void DoAction(IJobExecutionContext context)
{
- VOLContext Context = new VOLContext();
- Idt_ActualProductionRepository repository = new dt_ActualProductionRepository(Context);
- var info = repository.FindFirst(x => x.SN == DBItem.R_wheel_SN);//鏌ヨ杞﹁疆鐨勮缁嗕俊鎭�
- if (info != null)
+ var client = context.JobDetail.JobDataMap.Get("JobParams") as PLCClient;
+ //鑷姩閲嶈繛
+ if (!client.IsConnected)
{
- //鍛婅瘔妗佹灦
-
+ client.Connect();
+ return;
}
+ StackerReadDBItem.StackerReadDBItems = new List<StackerReadDBItem>();
+ PropertyInfo[] propertyInfos = typeof(StackerReadDBItem).GetProperties();
+ var groups = client.itemGroups.OrderBy(x => x.Methods).ThenBy(x => x.name).GroupBy(x => x.Methods).ToList();
+ foreach (var key in groups)
+ {
+ StackerReadDBItem StackerDBItem = new StackerReadDBItem();
+ foreach (var propertyInfo in propertyInfos)
+ {
+ if (propertyInfo.Name == "StackerNo")
+ {
+ StackerDBItem.StackerNo = key.Key;
+ }
+ else
+ {
+ DBItemGroup group = key.FirstOrDefault(x => x.name == propertyInfo.Name);
+ if (group != null)
+ {
+ var readData = DBExtension.Read(group, client);
+ switch (propertyInfo.Name)
+ {
+ case "R_wheel_SN":
+ StackerDBItem.R_wheel_SN = readData.ToString();
+ break;
+ case "R_wheel_type":
+ StackerDBItem.R_wheel_type = Convert.ToInt16(readData);
+ break;
+ case "R_part_status":
+ StackerDBItem.R_part_status = Convert.ToByte(readData);
+ break;
+ case "R_part_process":
+ StackerDBItem.R_part_process = Convert.ToByte(readData);
+ break;
+ case "R_machine_nr":
+ StackerDBItem.R_machine_nr = Convert.ToBoolean(readData);
+ break;
+ case "R_direction":
+ StackerDBItem.R_direction = Convert.ToByte(readData);
+ break;
+ }
+ }
+ }
+ }
+ StackerReadDBItem.StackerReadDBItems.Add(StackerDBItem);
+ }
+ }
+ /// <summary>
+ /// 娣诲姞DB鍦板潃淇℃伅
+ /// </summary>
+ public void AddDB()
+ {
+ VOLContext context = new VOLContext();
+ Idt_plcinfodetailRepository repository = new dt_plcinfodetailRepository(context);
+ List<dt_plcinfodetail> plcinfodetail = new List<dt_plcinfodetail>();
+ for (int i = 1; i <= 1; i++)
+ {
+ dt_plcinfodetail dt_Plcinfodetail1 = new dt_plcinfodetail()
+ {
+ plcdetail_id = Guid.NewGuid(),
+ plcdetail_iotype = "VK5",
+ plcdetail_db = "DB630",
+ plcdetail_value = ((i - 1 + 28 + 10 + 10) * 24).ToString(),
+ plcdetail_valtype = "string",
+ plcdetail_len = 20,
+ plcdetail_name = "R_wheel_SN",
+ plcdetail_opratortype = "wheel",
+ plcdetail_remark = "璇诲彇杞﹁疆SN鍙�",
+ plcdetail_number = "鏈烘鎵�3",
+ };
+ plcinfodetail.Add(dt_Plcinfodetail1);
+ dt_plcinfodetail dt_Plcinfodetail2 = new dt_plcinfodetail()
+ {
+ plcdetail_id = Guid.NewGuid(),
+ plcdetail_iotype = "VK5",
+ plcdetail_db = "DB630",
+ plcdetail_value = (20 + (i - 1 + 28 + 10 + 10) * 24).ToString(),
+ plcdetail_valtype = "int16",
+ plcdetail_name = "R_wheel_type",
+ plcdetail_opratortype = "wheel",
+ plcdetail_remark = "璇诲彇杞﹁疆绫诲瀷",
+ plcdetail_number = "鏈烘鎵�3",
+ };
+ plcinfodetail.Add(dt_Plcinfodetail2);
+ dt_plcinfodetail dt_Plcinfodetail3 = new dt_plcinfodetail()
+ {
+ plcdetail_id = Guid.NewGuid(),
+ plcdetail_iotype = "VK5",
+ plcdetail_db = "DB630",
+ plcdetail_value = (22 + (i - 1 + 28 + 10 + 10) * 24).ToString(),
+ plcdetail_valtype = "byte",
+ plcdetail_name = "R_part_status",
+ plcdetail_opratortype = "wheel",
+ plcdetail_remark = "璇诲彇杞﹁疆鐘舵��",
+ plcdetail_number = "鏈烘鎵�3",
+ };
+ plcinfodetail.Add(dt_Plcinfodetail3);
+ dt_plcinfodetail dt_Plcinfodetail4 = new dt_plcinfodetail()
+ {
+ plcdetail_id = Guid.NewGuid(),
+ plcdetail_iotype = "VK5",
+ plcdetail_db = "DB630",
+ plcdetail_value = (23 + (i - 1 + 28 + 10 + 10) * 24).ToString(),
+ plcdetail_valtype = "byte",
+ plcdetail_name = "R_part_process",
+ plcdetail_opratortype = "wheel",
+ plcdetail_remark = "璇诲彇杞﹁疆宸ヨ壓",
+ plcdetail_number = "鏈烘鎵�3",
+ };
+ plcinfodetail.Add(dt_Plcinfodetail4);
+ }
+ repository.AddRange(plcinfodetail, true);
}
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK4Job.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK4Job.cs"
index 9023d59..e5f1b95 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK4Job.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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,9 @@
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);
- //}
- }
-
+
+ WheelDBItem.VK4WheelDBItem = new List<WheelDBItem>();
+ GetDate.GetWheelDate(client);
}
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK5Job.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK5Job.cs"
new file mode 100644
index 0000000..d41b9b6
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK5Job.cs"
@@ -0,0 +1,43 @@
+锘縰sing Quartz;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm;
+using WIDESEA_WCS.Jobs;
+using WIDESEA_WCS.WCSClient;
+
+namespace WIDESEA_WCS
+{
+ [DisallowConcurrentExecution]
+ public class VK5Job : JobBase, IJob
+ {
+ public Task Execute(IJobExecutionContext context)
+ {
+ try
+ {
+ ExecuteJob(context, DoAction);
+ }
+ catch (Exception ex)
+ {
+
+ }
+ return Task.CompletedTask;
+ }
+
+ private void DoAction(IJobExecutionContext context)
+ {
+ var client = context.JobDetail.JobDataMap.Get("JobParams") as PLCClient;
+ //鑷姩閲嶈繛
+ if (!client.IsConnected)
+ {
+ client.Connect();
+ return;
+ }
+
+ WheelDBItem.VK5WheelDBItem = new List<WheelDBItem>();
+ GetDate.GetWheelDate(client);
+ }
+ }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/WCSClient/Siemens/SiemensPLCClient.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/WCSClient/Siemens/SiemensPLCClient.cs"
index 4b6f78a..51ab901 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/WCSClient/Siemens/SiemensPLCClient.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/WCSClient/Siemens/SiemensPLCClient.cs"
@@ -3,6 +3,7 @@
using System.Net.NetworkInformation;
using WIDESEA_Comm.DataHandle;
using WIDESEA_Comm.LogInfo;
+using static FreeSql.Internal.GlobalFilter;
namespace WIDESEA_WCS.WCSClient
{
@@ -134,8 +135,11 @@
}
else if (typeof(DataType) == typeof(string))//瀛楃涓�
{
- var bytes = (byte[])GetContent(siemensPLCClient.Read(dbAddress, (ushort)len), dbAddress);
- string str = DataParse.GetStr(bytes, 0);
+ //var bytes = (byte[])GetContent(siemensPLCClient.Read(dbAddress, (ushort)len), dbAddress);
+ //string str = DataParse.GetStr(bytes, 0);
+ //return (DataType)(str as object);
+ var str = GetContent(siemensPLCClient.ReadString(dbAddress, (ushort)len), dbAddress).ToString();
+ str = str.Replace("\0", "")?.Replace("\\", "")?.Replace("\u0014", "")?.Replace("?\u0006", "")?.Replace("\n", "")?.Replace("?", "")?.Trim();
return (DataType)(str as object);
}
else
--
Gitblit v1.9.3