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.MorkMV1/Control_MorkMV1.cs b/BPASmartClient.MorkMV1/Control_MorkMV1.cs
index 733dc452..ddbf8687 100644
--- a/BPASmartClient.MorkMV1/Control_MorkMV1.cs
+++ b/BPASmartClient.MorkMV1/Control_MorkMV1.cs
@@ -23,6 +23,7 @@ using BPA.Models;
using System.Windows.Forms;
using System.Media;
using BPASmartClient.CustomResource;
+using Microsoft.EntityFrameworkCore.Metadata.Internal;
//using BPA.Helper;
namespace BPASmartClient.MorkMV1
@@ -69,10 +70,10 @@ namespace BPASmartClient.MorkMV1
string guid = new Guid().ToString();
- mORKM.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid });
+ mORKM.RBTakeNoodleTask.Enqueue(new MOrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】");
- mORKM.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid });
+ mORKM.TakeBowlTask.Enqueue(new MOrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】");
Thread.Sleep(60000);
}), "ForOrder");
@@ -255,11 +256,12 @@ namespace BPASmartClient.MorkMV1
}
}));
- GetStatus("M16.7", new Action