From 9d7f402fe2f147b8108833a64e6182f52ea160c4 Mon Sep 17 00:00:00 2001
From: hwh <332078369@qq.com>
Date: 星期五, 13 九月 2024 09:49:27 +0800
Subject: [PATCH] 默认分页20行
---
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
index a7eff8f..2c5e526 100644
--- a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
+++ b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
@@ -13,6 +13,8 @@
public static bool boOffline = false;
//鑷埛鏂�
public static bool boRefresh = false;
+ //婕旂ず妯″紡
+ public static bool boDemo = false;
public static List<PlcPositionInfo> listPositionInfo = new List<PlcPositionInfo>();
@@ -23,7 +25,7 @@
private static List<WcsPlc> listPlc = new List<WcsPlc>();
private static List<WcsDevice> listPlcDevice = new List<WcsDevice>();
- private static List<WcsPosition> listPlcStation = new List<WcsPosition>();
+ private static List<WcsPosition> listPlcPosition = new List<WcsPosition>();
private static List<WcsAlarmInfo> listAlarmInfo = new List<WcsAlarmInfo>();
private static List<PLCUtil> listPlcUtil = new List<PLCUtil>();
@@ -33,6 +35,15 @@
{
get { return listPlcUtil; }
}
+ // 浜や簰鐐归泦鍚�
+ public static List<WcsDevice> plcDevices
+ {
+ get { return listPlcDevice; }
+ }
+ public static List<WcsPosition> plcPositions
+ {
+ get { return listPlcPosition; }
+ }
public static event EventHandler DeviceValueChangeEvent;
static PLCTaskAction()
{
@@ -41,6 +52,7 @@
boRunningState = _sysConfigService.GetConfigValue<bool>("sys_RunningState").Result;
boOffline = _sysConfigService.GetConfigValue<bool>("sys_Offline").Result;
boRefresh = _sysConfigService.GetConfigValue<bool>("sys_Refresh").Result;
+ boDemo = _sysConfigService.GetConfigValue<bool>("sys_demo").Result;
}
/// <summary>
/// 鍒濆鍖朠LC杩炴帴
@@ -50,7 +62,7 @@
cts.Cancel();
listPlc = _db.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine || s.Type == PLCTypeEnum.BoxConveyorLine).ToList();
listPlcDevice = _db.Queryable<WcsDevice>().ToList();
- listPlcStation = _db.Queryable<WcsPosition>().ToList();
+ listPlcPosition = _db.Queryable<WcsPosition>().ToList();
listAlarmInfo = _db.Queryable<WcsAlarmInfo>().ToList();
//绛夊緟鍑犵閽燂紝鎶婂凡鏈夌嚎绋嬪彇娑堟帀鍐嶈繛鎺�
//Thread.Sleep(5000);
@@ -142,10 +154,10 @@
dto.Value = value;
dto.Type = _modplc.Type;
dto.PLCUtil = modPlcUtil;
- dto.listStation = listPlcStation.Where(s => s.DeviceId == modDevice.Id).ToList();
+ dto.listStation = listPlcPosition.Where(s => s.DeviceId == modDevice.Id).ToList();
dto.listDevice = listDevice.Where(s => s.StationNum == modDevice.StationNum && s.Level == DeviceLevelEnum.Station).ToList();
//杩欓噷瑙﹀彂鍊煎彉鏇翠簨浠�
- //DeviceValueChangeEvent?.Invoke(dto, EventArgs.Empty);
+ DeviceValueChangeEvent?.Invoke(dto, EventArgs.Empty);
}
else if (!modPlcUtil.Connected)
{
@@ -270,15 +282,15 @@
{
//鎶ヨ鐐逛綅
var listAlarm = listAlarmInfo.Where(s => s.PlcIP == modUtil.PlcIP.ToString()).ToList();
- Console.WriteLine("鎶ヨ鐐逛綅鏁帮細" + listAlarm.Count);
+ //Console.WriteLine("鎶ヨ鐐逛綅鏁帮細" + listAlarm.Count);
var listaddress = new Dictionary<string, PLCDataTypeEnum>();
foreach (var modAlarm in listAlarm)
{
listaddress.Add(modAlarm.AlarmCode, PLCDataTypeEnum.Bit);
}
- Console.WriteLine($"璇诲彇鐐逛綅{listaddress.Count}涓�");
+ //Console.WriteLine($"璇诲彇鐐逛綅{listaddress.Count}涓�");
var result = modUtil.GetPlcBatchDBValue(listaddress);
- Console.WriteLine("err" + result.Err);
+ //Console.WriteLine("err" + result.Err);
var listPulish = new List<WcsAlarmInfo>();
//娴嬭瘯鎶ヨ
//foreach (var modAlarm in listAlarm)
@@ -288,7 +300,7 @@
foreach (var item in result.Value)
{
var value = Convert.ToBoolean(item.Value);
- Console.WriteLine(item.Key + "+" + value);
+ //Console.WriteLine(item.Key + "+" + value);
var modAlarm = listAlarm.FirstOrDefault(s => s.AlarmCode == item.Key);
if (value && modAlarm.Status == YesNoEnum.N)
{
--
Gitblit v1.8.0