Sfoglia il codice sorgente

变量监控添加

JXJAgvReake
pry 1 anno fa
parent
commit
d3055b8843
4 ha cambiato i file con 251 aggiunte e 3 eliminazioni
  1. +55
    -1
      BPASmartClient.Device/VariableMonitorAttribute.cs
  2. +194
    -0
      BPASmartClient.Tourism/GVL_MorkCL.cs
  3. +1
    -1
      BPASmartClient.Tourism/Model/Control/RobotMainTask.cs
  4. +1
    -1
      BPASmartClient.Tourism/Server/FryingPanServer.cs

+ 55
- 1
BPASmartClient.Device/VariableMonitorAttribute.cs Vedi File

@@ -28,7 +28,12 @@ namespace BPASmartClient.Device
if (address.Length > 0)
{
address = address.Trim();
if (address.ToUpper().Contains("M") && address.Length >= 4)
if (address.ToUpper().Contains("GM") && address.Length >= 3)
{
var res = address.Remove(0, 2);
if (res != null && res.Length > 0) return (int.Parse(res) + 4096).ToString();
}
else if (address.ToUpper().Contains("M") && address.Length >= 4)
{
var res = address.Substring(1).Split('.');
if (res != null && res.Length == 2)
@@ -42,6 +47,19 @@ namespace BPASmartClient.Device
}
}
}
else if (address.ToUpper().Contains("GI") && address.Length >= 3)
{
var res = address.Remove(0, 2);
if (res != null && res.Length > 0) return res;
}
else if (address.ToUpper().Contains("LB") && address.Length >= 3)
{
var res = address.Substring(2);
if (res != null && res.Length > 0)
{
if (int.TryParse(res, out int firstAddress)) return firstAddress.ToString();
}
}
else if ((address.ToUpper().Contains("VW") || address.ToUpper().Contains("VD")) && address.Length >= 3)
{
var res = address.Substring(2);
@@ -50,8 +68,44 @@ namespace BPASmartClient.Device
return ((tempAddress / 2) + 100).ToString();
}
}
else if (address.ToUpper().Contains("LW") && address.Length >= 3)
{
var res = address.Substring(2);
if (res != null && int.TryParse(res, out int LwAddress))
{
return LwAddress.ToString();
}
}
}
return "";
//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 "";
}

/// <summary>


+ 194
- 0
BPASmartClient.Tourism/GVL_MorkCL.cs Vedi File

@@ -11,11 +11,139 @@ namespace BPASmartClient.MorkCL
public ConcurrentQueue<ControlData> cds { get; set; } = new ConcurrentQueue<ControlData>();

#region 炒锅1
/// <summary>
/// 初始化完成
/// </summary>
[VariableMonitor("1号炒锅-初始化完成", "LB100")]
public bool InitComplete1 { get; set; }

/// <summary>
/// 手自动状态模式
/// </summary>
[VariableMonitor("1号炒锅-手自动状态模式", "LB101")]
public bool StatusMode1 { get; set; }

/// <summary>
/// 急停
/// </summary>
[VariableMonitor("1号炒锅-急停", "LB102")]
public bool EStop1 { get; set; }

/// <summary>
/// 炒制位置反馈(1-4)
/// </summary>
[VariableMonitor("1号炒锅-炒制位置反馈(1-4)", "LB103")]
public bool[] StirFryingLocFB1 { get; set; } = new bool[4];

/// <summary>
/// 炒锅在出餐位置反馈
/// </summary>
[VariableMonitor("1号炒锅-炒锅在出餐位置反馈", "LB107")]
public bool DiningOutLocFB1 { get; set; }

/// <summary>
/// 炒锅在投料位置反馈
/// </summary>
[VariableMonitor("1号炒锅-炒锅在投料位置反馈", "LB108")]
public bool FeedingLocFB1 { get; set; }

/// <summary>
/// 炒锅在洗锅位置反馈
/// </summary>
[VariableMonitor("1号炒锅-炒锅在洗锅位置反馈", "LB109")]
public bool WashingPotLocFB1 { get; set; }

/// <summary>
/// 通道出料完成反馈(1-3)
/// </summary>
[VariableMonitor("1号炒锅-通道出料完成反馈(1-3)", "LB110")]
public bool[] ChannelDisCom1 { get; set; } = new bool[3];

/// <summary>
/// 当前锅底温度
/// </summary>
[VariableMonitor("1号炒锅-当前锅底温度", "LW20")]
public float CurrentTemperature1 { get; set; }

/// <summary>
/// 当前炒锅搅拌转速
/// </summary>
[VariableMonitor("1号炒锅-当前炒锅搅拌转速", "LW21")]
public ushort CurrentSpeed1 { get; set; }

/// <summary>
/// 当前加热档位
/// </summary>
[VariableMonitor("1号炒锅-当前加热档位", "LW22")]
public ushort HeatingGear1 { get; set; }
#endregion

#region 炒锅2
/// <summary>
/// 初始化完成
/// </summary>
[VariableMonitor("2号炒锅-初始化完成", "LB100")]
public bool InitComplete2 { get; set; }

/// <summary>
/// 手自动状态模式
/// </summary>
[VariableMonitor("2号炒锅-手自动状态模式", "LB101")]
public bool StatusMode2 { get; set; }

/// <summary>
/// 急停
/// </summary>
[VariableMonitor("2号炒锅-急停", "LB102")]
public bool EStop2 { get; set; }

/// <summary>
/// 炒制位置反馈(1-4)
/// </summary>
[VariableMonitor("2号炒锅-炒制位置反馈(1-4)", "LB103")]
public bool[] StirFryingLocFB2 { get; set; } = new bool[4];

/// <summary>
/// 炒锅在出餐位置反馈
/// </summary>
[VariableMonitor("2号炒锅-炒锅在出餐位置反馈", "LB107")]
public bool DiningOutLocFB2 { get; set; }

/// <summary>
/// 炒锅在投料位置反馈
/// </summary>
[VariableMonitor("2号炒锅-炒锅在投料位置反馈", "LB108")]
public bool FeedingLocFB2 { get; set; }

/// <summary>
/// 炒锅在洗锅位置反馈
/// </summary>
[VariableMonitor("2号炒锅-炒锅在洗锅位置反馈", "LB109")]
public bool WashingPotLocFB2 { get; set; }

/// <summary>
/// 通道出料完成反馈(1-3)
/// </summary>
[VariableMonitor("2号炒锅-通道出料完成反馈(1-3)", "LB110")]
public bool[] ChannelDisCom2 { get; set; } = new bool[3];

/// <summary>
/// 当前锅底温度
/// </summary>
[VariableMonitor("2号炒锅-当前锅底温度", "LW20")]
public float CurrentTemperature2 { get; set; }

/// <summary>
/// 当前炒锅搅拌转速
/// </summary>
[VariableMonitor("2号炒锅-当前炒锅搅拌转速", "LW21")]
public ushort CurrentSpeed2 { get; set; }

/// <summary>
/// 当前加热档位
/// </summary>
[VariableMonitor("2号炒锅-当前加热档位", "LW22")]
public ushort HeatingGear2 { get; set; }
#endregion

#region 压力锅
@@ -23,7 +151,73 @@ namespace BPASmartClient.MorkCL
#endregion

#region 机器人
/// <summary>
/// 倒料请求
/// </summary>
[VariableMonitor("机器人-倒料请求-[1:1号炒锅,2:2号炒锅,3:高压锅]", "LW22")]
public bool[] MaterialPouringRequest = new bool[3];

/// <summary>
/// 倒料完成
/// </summary>
[VariableMonitor("机器人-倒料完成-[1:1号炒锅,2:2号炒锅,3:高压锅]", "LW22")]
public bool[] MaterialPouringComplete = new bool[3];

/// <summary>
/// 出餐请求,机器人到位请求炒锅出餐
/// </summary>
[VariableMonitor("机器人-出餐请求-[1:1号炒锅,2:2号炒锅,3:高压锅]", "LW22")]
public bool[] DiningOutRequest { get; set; } = new bool[3];

/// <summary>
/// 入库完成
/// </summary>
[VariableMonitor("机器人-入库完成", "LW22")]
public bool[] WarehousingComplete { get; set; } = new bool[12];

/// <summary>
/// 机器人原点状态
/// </summary>
[VariableMonitor("机器人-机器人原点状态", "LW22")]
public bool Home { get; set; }

/// <summary>
/// 机器人使能状态
/// </summary>
[VariableMonitor("机器人-机器人使能状态", "LW22")]
public bool EnableState { get; set; }

/// <summary>
/// 机器人远程模式
/// </summary>
[VariableMonitor("机器人-机器人远程模式", "LW22")]
public bool RemoteMode { get; set; }

/// <summary>
/// 机器人程序运行中
/// </summary>
[VariableMonitor("机器人-机器人程序运行中", "LW22")]
public bool ProgramRuning { get; set; }

/// <summary>
/// 机器人任务反馈
/// </summary>
[VariableMonitor("机器人-机器人任务反馈", "LW22")]
public RobotMainTask TaskFeedback { get; set; }
#endregion

#region 其它外部设备
/// <summary>
/// 电子秤当前重量
/// </summary>
[VariableMonitor("电子秤当前重量", "0")]
public float CurrentWeight { get; set; }

/// <summary>
/// 空箱子检测
/// </summary>
[VariableMonitor("出餐箱子在位检测", "0")]
public bool[] BoxDetection { get; set; } = new bool[4];
#endregion
}
}

+ 1
- 1
BPASmartClient.Tourism/Model/Control/RobotMainTask.cs Vedi File

@@ -6,7 +6,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.MorkCL.Model.Control
{
internal enum RobotMainTask : ushort
public enum RobotMainTask : ushort
{
无任务 = 0,
库位1取主料 = 1,


+ 1
- 1
BPASmartClient.Tourism/Server/FryingPanServer.cs Vedi File

@@ -38,7 +38,7 @@ namespace BPASmartClient.MorkCL.Server
var LW20 = MyModbus.Read<ushort[]>("LW20".ToModbusAdd(), 3);
if (LW20.IsSuccess)
{
CurrentTemperature = LW20.Content[0];
CurrentTemperature = LW20.Content[0] * 10.0F;
CurrentSpeed = LW20.Content[1];
HeatingGear = LW20.Content[2];
}


Caricamento…
Annulla
Salva