diff --git a/BPASmartClient.Device/VariableMonitorAttribute.cs b/BPASmartClient.Device/VariableMonitorAttribute.cs
index 5fd99243..8d4ba870 100644
--- a/BPASmartClient.Device/VariableMonitorAttribute.cs
+++ b/BPASmartClient.Device/VariableMonitorAttribute.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -17,10 +18,42 @@ namespace BPASmartClient.Device
public VariableMonitorAttribute(string Notes, string PLCAddress = "", string ModbusTcpAddress = "")
{
this.PLCAddress = PLCAddress;
- this.ModbusTcpAddress = ModbusTcpAddress;
+ this.ModbusTcpAddress = GetModbusTcpAdd(PLCAddress);// ModbusTcpAddress;
this.Notes = Notes;
}
+ private string GetModbusTcpAdd(string address)
+ {
+ if (address == null) return "";
+ if (address.Length > 0)
+ {
+ address = address.Trim();
+ if (address.ToUpper().Contains("M") && address.Length >= 4)
+ {
+ var res = address.Substring(1).Split('.');
+ if (res != null && res.Length == 2)
+ {
+ if (int.TryParse(res[0], out int firstAddress) && int.TryParse(res[1], out int ExitAddress))
+ {
+ if (ExitAddress >= 0 && ExitAddress <= 7)
+ {
+ return ((firstAddress * 8) + 320 + ExitAddress).ToString();
+ }
+ }
+ }
+ }
+ else if ((address.ToUpper().Contains("VW") || address.ToUpper().Contains("VD")) && address.Length >= 3)
+ {
+ var res = address.Substring(2);
+ if (res != null && int.TryParse(res, out int tempAddress))
+ {
+ return ((tempAddress / 2) + 100).ToString();
+ }
+ }
+ }
+ return "";
+ }
+
///
/// PLC 地址
///
diff --git a/BPASmartClient.MORKSM.BK.PLC/PLCMachine.cs b/BPASmartClient.MORKSM.BK.PLC/PLCMachine.cs
index 6181cc29..91c238c1 100644
--- a/BPASmartClient.MORKSM.BK.PLC/PLCMachine.cs
+++ b/BPASmartClient.MORKSM.BK.PLC/PLCMachine.cs
@@ -95,17 +95,17 @@ namespace BPASmartClient.PLC
modbusTcp.Write(address, value);
}
- public override void AddVarInfo(string add, int len)
- {
- if (!tempVar.ContainsKey(add) && !string.IsNullOrEmpty(add) && len > 0)
- {
- tempVar.TryAdd(add, new Variable()
- {
- Address = add,
- ReadLeng = len
- });
- }
- }
+ //public override void AddVarInfo(string add, int len)
+ //{
+ // if (!tempVar.ContainsKey(add) && !string.IsNullOrEmpty(add) && len > 0)
+ // {
+ // tempVar.TryAdd(add, new Variable()
+ // {
+ // Address = add,
+ // ReadLeng = len
+ // });
+ // }
+ //}
protected override void InitStatus()
{
diff --git a/BPASmartClient.Model/OrderLocInfo.cs b/BPASmartClient.Model/OrderLocInfo.cs
new file mode 100644
index 00000000..1b199cb1
--- /dev/null
+++ b/BPASmartClient.Model/OrderLocInfo.cs
@@ -0,0 +1,24 @@
+using BPA.Message;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.Model
+{
+ public class OrderLocInfo
+ {
+ public string SuborderId { get; set; }
+ public ushort Loc { get; set; }
+ public ushort RecipeNumber { get; set; }
+ public int BatchingId { get; set; }
+ public string GoodName { get; set; }
+ public int SortNum { get; set; }
+
+ public int RecipeId { get; set; }
+
+ public List Recipes { get; set; }
+
+ }
+}
diff --git a/BPASmartClient.MorkMV1/Alarm.cs b/BPASmartClient.MorkMV1/Alarm.cs
new file mode 100644
index 00000000..1a8c5952
--- /dev/null
+++ b/BPASmartClient.MorkMV1/Alarm.cs
@@ -0,0 +1,74 @@
+using BPASmartClient.Device;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkMV1
+{
+ public class Alarm : IAlarm
+ {
+ ///
+ /// 煮面机温度过低
+ ///
+ [Alarm("煮面机温度过低")]
+ public bool MachineLowTemperature { get; set; }
+
+ ///
+ /// 大碗数量不足
+ ///
+ [Alarm("大碗数量不足")]
+ public bool Supply1_LossBowl { get; set; }
+
+ ///
+ /// 一次性碗数量不足
+ ///
+ [Alarm("一次性碗数量不足")]
+ public bool Supply2_LossBowl { get; set; }
+
+ ///
+ /// 设备未初始化
+ ///
+ [Alarm("设备未初始化")]
+ public bool DeviceNoInit { get; set; }
+
+ ///
+ /// 移碗丝杆未初始化
+ ///
+ [Alarm("移碗丝杆未初始化")]
+ public bool MoveScrewRodNoInit { get; set; }
+
+ ///
+ /// 供碗1未初始化
+ ///
+ [Alarm("供碗1未初始化")]
+ public bool SacrificialVesselNoInit { get; set; }
+
+ ///
+ /// 气缸推杆未初始化
+ ///
+ [Alarm("气缸推杆未初始化")]
+ public bool CylinderNoInit { get; set; }
+
+ ///
+ /// 煮面机初未初始化
+ ///
+ [Alarm("煮面机初未初始化")]
+ public bool NoodleCookerNoInit { get; set; }
+
+ ///
+ /// 机器人未初始化
+ ///
+ [Alarm("机器人未初始化")]
+ public bool RobotNoInit { get; set; }
+
+ ///
+ /// 料仓未初始化
+ ///
+ [Alarm("料仓未初始化")]
+ public bool SiloNoInit { get; set; }
+
+
+ }
+}
diff --git a/BPASmartClient.MorkMV1/BPASmartClient.MorkMV1.csproj b/BPASmartClient.MorkMV1/BPASmartClient.MorkMV1.csproj
new file mode 100644
index 00000000..ed88b17f
--- /dev/null
+++ b/BPASmartClient.MorkMV1/BPASmartClient.MorkMV1.csproj
@@ -0,0 +1,30 @@
+
+
+
+ net6.0-windows
+ enable
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+
+
diff --git a/BPASmartClient.MorkMV1/Control_MorkMV1.cs b/BPASmartClient.MorkMV1/Control_MorkMV1.cs
new file mode 100644
index 00000000..7ba64b20
--- /dev/null
+++ b/BPASmartClient.MorkMV1/Control_MorkMV1.cs
@@ -0,0 +1,896 @@
+using System;
+using System.Collections.Generic;
+using BPA.Message.Enum;
+using BPASmartClient.Device;
+using BPASmartClient.EventBus;
+using BPASmartClient.Model;
+using BPASmartClient.Peripheral;
+using static BPASmartClient.EventBus.EventBus;
+using BPASmartClient.Helper;
+using System.Threading;
+using BPASmartClient.Message;
+using BPA.Message;
+using System.Linq;
+using BPASmartClient.Model.PLC;
+using System.Threading.Tasks;
+using System.Reflection;
+using BPASmartClient.MorkMV1.Model;
+using System.Collections.ObjectModel;
+using BPASmartClient.MorkMV1.ViewModel;
+using BPASmartClient.Business;
+using BPASmartClient.Model.小炒机;
+using BPA.Models;
+using System.Windows.Forms;
+using System.Media;
+using BPASmartClient.CustomResource;
+using Microsoft.EntityFrameworkCore.Metadata.Internal;
+//using BPA.Helper;
+
+namespace BPASmartClient.MorkMV1
+{
+ public class Control_MorkMV1 : BaseDevice
+ {
+ public override DeviceClientType DeviceType => DeviceClientType.MORKM;
+ GVL_MorkMV1 mORKM = new GVL_MorkMV1();
+ Alarm alarm = new Alarm();
+
+ public override void DoMain()
+ {
+ MonitorViewModel.DeviceId = DeviceId;
+ ServerInit();
+ DataParse();
+ Json.Read();
+ Json.Read();
+ if (Json.Data.parSets == null) Json.Data.parSets = new ObservableCollection();
+ if (Json.Data.parSets.Count < 6)
+ {
+ Json.Data.parSets.Clear();
+ for (int i = 0; i < 6; i++)
+ {
+ Json.Data.parSets.Add(new ParSet()
+ {
+ CheckBoxContext = $"煮面口{i + 1}屏蔽",
+ Minute = 1,
+ Second = 0,
+ IsShield = false,
+ TextBlockContext = $"煮面口{i + 1}时间设定"
+ });
+ }
+ }
+
+ ActionManage.GetInstance.Register(new Action