Browse Source

MorkT

样式分支
NXX 2 years ago
parent
commit
bdd0908974
56 changed files with 4103 additions and 534 deletions
  1. +60
    -57
      BPASmartClient.DRCoffee/CoffeeMachine.cs
  2. +10
    -4
      BPASmartClient.Device/AlarmHelper.cs
  3. +12
    -1
      BPASmartClient.Device/BaseDevice.cs
  4. +28
    -0
      BPASmartClient.Device/HardwareStatusAttribute.cs
  5. +15
    -0
      BPASmartClient.Device/IHardwareStatus.cs
  6. +74
    -70
      BPASmartClient.GSIceCream/IceCreamMachine.cs
  7. +13
    -2
      BPASmartClient.IoT/DataVClient.cs
  8. +107
    -105
      BPASmartClient.KLMCoffee/CoffeeMachine.cs
  9. +8
    -6
      BPASmartClient.Lebai/LebaiRobot.cs
  10. +7
    -1
      BPASmartClient.MORKSM.BK.PLC/PLCMachine.cs
  11. +4
    -0
      BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
  12. +333
    -96
      BPASmartClient.MorkF/Control_MorkF.cs
  13. +78
    -7
      BPASmartClient.MorkF/GVL_MorkF.cs
  14. +45
    -0
      BPASmartClient.MorkF/View/DebugView.xaml
  15. +30
    -0
      BPASmartClient.MorkF/View/DebugView.xaml.cs
  16. +55
    -0
      BPASmartClient.MorkF/ViewModel/DebugViewModel.cs
  17. +207
    -0
      BPASmartClient.MorkM/Alarm.cs
  18. +35
    -0
      BPASmartClient.MorkM/BPASmartClient.MorkM.csproj
  19. +1000
    -0
      BPASmartClient.MorkM/Control_MORKM.cs
  20. +402
    -0
      BPASmartClient.MorkM/GVL_MORKM.cs
  21. +18
    -0
      BPASmartClient.MorkM/HardwareStatus.cs
  22. +16
    -0
      BPASmartClient.MorkM/Model/GeneralConfig.cs
  23. +16
    -0
      BPASmartClient.MorkM/Model/MorksPar.cs
  24. +29
    -0
      BPASmartClient.MorkM/Model/ParSet.cs
  25. +14
    -0
      BPASmartClient.MorkM/Model/WritePar.cs
  26. +32
    -0
      BPASmartClient.MorkM/OrderLocInfo.cs
  27. +154
    -0
      BPASmartClient.MorkM/View/DebugView.xaml
  28. +30
    -0
      BPASmartClient.MorkM/View/DebugView.xaml.cs
  29. +242
    -0
      BPASmartClient.MorkM/View/Monitor.xaml
  30. +28
    -0
      BPASmartClient.MorkM/View/Monitor.xaml.cs
  31. +130
    -0
      BPASmartClient.MorkM/View/ParSet.xaml
  32. +28
    -0
      BPASmartClient.MorkM/View/ParSet.xaml.cs
  33. +206
    -0
      BPASmartClient.MorkM/View/SimOrderConfitView.xaml
  34. +56
    -0
      BPASmartClient.MorkM/View/SimOrderConfitView.xaml.cs
  35. +135
    -0
      BPASmartClient.MorkM/ViewModel/DebugViewModel.cs
  36. +24
    -0
      BPASmartClient.MorkM/ViewModel/MonitorViewModel.cs
  37. +42
    -0
      BPASmartClient.MorkM/ViewModel/ParSetViewModel.cs
  38. +90
    -0
      BPASmartClient.MorkM/ViewModel/SimOrderConfitViewModel.cs
  39. +41
    -38
      BPASmartClient.MorkS/Control_Morks.cs
  40. +7
    -2
      BPASmartClient.MorkS/GVL_MORKS.cs
  41. +9
    -0
      BPASmartClient.MorkT.Lebai.JC/BPASmartClient.MorkTLebaiJC.csproj
  42. +8
    -0
      BPASmartClient.MorkT.Lebai.JC/Class1.cs
  43. +9
    -0
      BPASmartClient.Morkt.JAKA.JC/BPASmartClient.MorkTJAKAJC.csproj
  44. +8
    -0
      BPASmartClient.Morkt.JAKA.JC/Class1.cs
  45. +3
    -1
      BPASmartClient.Peripheral/BasePeripheral.cs
  46. +2
    -0
      BPASmartClient.Peripheral/IPeripheral.cs
  47. +80
    -76
      BPASmartClient.SCChip/ICChipMachine.cs
  48. +4
    -2
      BPASmartClient.ViewModel/MainViewModel.cs
  49. +1
    -55
      BPASmartClient.ViewModel/OrderStatusViewModel.cs
  50. +4
    -4
      BPASmartClient/App.config
  51. +1
    -0
      BPASmartClient/BPASmartClient.csproj
  52. +14
    -0
      BPASmartClient/Control/DataVView.xaml
  53. +12
    -3
      BPASmartClient/Control/DataVView.xaml.cs
  54. +15
    -3
      BPASmartClient/DeviceInfo.xml
  55. +3
    -1
      BPASmartClient/MainWindow.xaml.cs
  56. +69
    -0
      SmartClient.sln

+ 60
- 57
BPASmartClient.DRCoffee/CoffeeMachine.cs View File

@@ -16,7 +16,7 @@ namespace BPASmartClient.DRCoffee
/// <summary>
/// 咖啡机
/// </summary>
public class CoffeeMachine :BasePeripheral
public class CoffeeMachine : BasePeripheral
{
//通讯代理
SerialPortClient commProxy = null;
@@ -95,7 +95,7 @@ namespace BPASmartClient.DRCoffee
commProxy.SendData(cmdAsk);
}
Thread.Sleep(200);
}),"咖啡机询问线程");
}), "咖啡机询问线程");

ThreadManage.GetInstance().StartLong(new Action(() =>
{
@@ -132,7 +132,7 @@ namespace BPASmartClient.DRCoffee
}
}
Thread.Sleep(5);
}),"咖啡机解析线程");
}), "咖啡机解析线程");
}

/// <summary>
@@ -153,17 +153,17 @@ namespace BPASmartClient.DRCoffee
status["CoffeeAppStatus"] = package.ApplicationStatus;
status["CoffeeWarning"] = package.Warning;
status["CoffeeFault"] = package.Fault;
if ((DrCoffeeStatus)status["CoffeeStatus"] == DrCoffeeStatus.Warning
|| (DrCoffeeStatus)status["CoffeeStatus"] == DrCoffeeStatus.Fault
|| (DrCoffeeWarning)status["CoffeeWarning"] != DrCoffeeWarning.无警告
|| (DrCoffeeFault)status["CoffeeFault"] != DrCoffeeFault.无故障
)
{
IsWork = false;
IsWork = false;
}
else
IsWork = true;
IsWork = true;
}

protected override void InitStatus()
@@ -176,68 +176,71 @@ namespace BPASmartClient.DRCoffee

public override void Init()
{
commProxy = new SerialPortClient(communicationPar.SerialPort,(BaudRates)communicationPar.BaudRate);
commProxy = new SerialPortClient(communicationPar.SerialPort, (BaudRates)communicationPar.BaudRate);
commProxy.SetDataStorage(dataStorage);

//咖博士咖啡机制作
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_MakeCoffeeEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
drinksOrder.CommCmd = DrCoffeeCommCmd.饮品制作指令;
drinksOrder.DrinksCode = ((DRCoffee_MakeCoffeeEvent)@event).DrinkCode;
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
drinksOrder.CommCmd = DrCoffeeCommCmd.饮品制作指令;
drinksOrder.DrinksCode = ((DRCoffee_MakeCoffeeEvent)@event).DrinkCode;
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});

//咖博士咖啡机取消制作咖啡
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CancelMakeCoffeeEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
drinksOrder.CommCmd = DrCoffeeCommCmd.取消应用指令;
drinksOrder.DrinksCode = 0;
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CancelMakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
drinksOrder.CommCmd = DrCoffeeCommCmd.取消应用指令;
drinksOrder.DrinksCode = 0;
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});

//咖博士咖啡机模式设置
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeeCommCmdEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
drinksOrder.CommCmd = ((DRCoffee_CoffeeCommCmdEvent)@event).CommCmd;
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeeCommCmdEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
drinksOrder.CommCmd = ((DRCoffee_CoffeeCommCmdEvent)@event).CommCmd;
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
InitStatus();
//测试
Start();
}

public override void WriteData(string address, object value)
{
}
}
}

+ 10
- 4
BPASmartClient.Device/AlarmHelper.cs View File

@@ -15,6 +15,7 @@ namespace BPASmartClient.Device
public List<Alarm> Alarms { get; set; } = new List<Alarm>();
public List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>();
public Action<string> AddAction { get; set; }
public Action<string> RemoveAction { get; set; }
public Action ChangeAction { get; set; }
@@ -25,20 +26,25 @@ namespace BPASmartClient.Device
/// <param name="Trigger">触发变量</param>
/// <param name="text">报警信息</param>
/// <param name="edgeType">触发类型,上升沿 或 下降沿</param>
public void EdgeAlarm(bool Trigger, string text, AlarmLevel alarmLevel = AlarmLevel.一般报警, AlarmTriggerType edgeType = AlarmTriggerType.Rising)
public void EdgeAlarm(bool Trigger, string text, int delay = 2, AlarmLevel alarmLevel = AlarmLevel.一般报警, AlarmTriggerType edgeType = AlarmTriggerType.Rising)
{
if (!flagbit.ContainsKey(text)) flagbit.TryAdd(text, false);
if (edgeType == AlarmTriggerType.Rising ? Trigger : !Trigger)
if (!delays.ContainsKey(text)) delays.TryAdd(text, Delay.GetInstance(text));
//if (edgeType == AlarmTriggerType.Rising ? Trigger : !Trigger)
if (edgeType == AlarmTriggerType.Rising ? delays[text].Start(Trigger, delay) : delays[text].Start(!Trigger, delay))
{
if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] : flagbit[text])
{
AddAlarm(Trigger, text, alarmLevel);
//AddAlarm(Trigger, text, alarmLevel);
AddAlarm(Trigger, text.Substring(0, text.LastIndexOf("-")), alarmLevel);

flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false;
}
}
else
{
RemoveAlarm(text);
//RemoveAlarm(text);
RemoveAlarm(text.Substring(0, text.LastIndexOf("-")));
}
if (edgeType == AlarmTriggerType.Rising ? flagbit[text] : !flagbit[text]) flagbit[text] = Trigger;
}


+ 12
- 1
BPASmartClient.Device/BaseDevice.cs View File

@@ -110,6 +110,17 @@ namespace BPASmartClient.Device

#endregion

public void WriteControl(string address, object value)
{
if (peripherals != null)
{
for (int i = 0; i < peripherals.Count; i++)
{
peripherals.ElementAt(i).WriteData(address, value);
}
}
}

/// <summary>
/// 设备过程日志显示
/// </summary>
@@ -279,7 +290,7 @@ namespace BPASmartClient.Device
if (item.CustomAttributes.Count() > 0 && item.CustomAttributes.ElementAt(0)?.ConstructorArguments.Count() > 0)
{
var info = item.GetCustomAttribute<AlarmAttribute>().AlarmInfo;
if (info != null) alarmHelper.EdgeAlarm(blen, info.ToString());
if (info != null) alarmHelper.EdgeAlarm(blen, $"{info.ToString()}-{DeviceId}");
}
}
}


+ 28
- 0
BPASmartClient.Device/HardwareStatusAttribute.cs View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Device
{
public class HardwareStatusAttribute : Attribute
{
public HardwareStatusAttribute(string describe, string address)
{
Describe = describe;
this.Address = address;
}

/// <summary>
/// 描述
/// </summary>
public string Describe { get; set; }


/// <summary>
/// 地址
/// </summary>
public string Address { get; set; }
}
}

+ 15
- 0
BPASmartClient.Device/IHardwareStatus.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Device
{
/// <summary>
/// 硬件状态接口
/// </summary>
public interface IHardwareStatus
{
}
}

+ 74
- 70
BPASmartClient.GSIceCream/IceCreamMachine.cs View File

@@ -14,8 +14,8 @@ using static BPASmartClient.GSIceCream.MessageDefine;

namespace BPASmartClient.GSIceCream
{
public class IceCreamMachine :BasePeripheral
{
public class IceCreamMachine : BasePeripheral
{
//通讯代理
SerialPortClient commProxy = null;
//是否下发指令,主线程等待
@@ -179,13 +179,13 @@ namespace BPASmartClient.GSIceCream
IsConnected = OnLine;
status["IceCreamIsConnected"] = OnLine;
status["IceCreamCurrentMode"] = heartUpMsg.MS;
status["IceCreamYLWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.YLWD_L,heartUpMsg.YLWD_H },0);
status["IceCreamHQWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HQWD_L,heartUpMsg.HQWD_H },0);
status["IceCreamHJWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HJWD_L,heartUpMsg.HJWD_H },0);
status["IceCreamYLWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.YLWD_L, heartUpMsg.YLWD_H }, 0);
status["IceCreamHQWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HQWD_L, heartUpMsg.HQWD_H }, 0);
status["IceCreamHJWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HJWD_L, heartUpMsg.HJWD_H }, 0);
status["IceCreamDL"] = BitConverter.ToInt16(new byte[] { heartUpMsg.DL_L, heartUpMsg.DL_H }, 0);
status["IceCreamFault"] = (MORKI_FAULT)BitConverter.ToInt16(new byte[] { heartUpMsg.GZ_L,heartUpMsg.GZ_H },0);
status["IceCreamFault"] = (MORKI_FAULT)BitConverter.ToInt16(new byte[] { heartUpMsg.GZ_L, heartUpMsg.GZ_H }, 0);
status["IceCreamCXB"] = heartUpMsg.CXB;
status["IceCreamDLCompleted"] = (heartUpMsg.DLTJ >> 4 & 1) == 1;
status["IceCreamDLCompleted"] = (heartUpMsg.DLTJ >> 4 & 1) == 1;

if (RTrig.GetInstance("打料完成检测").Start((bool)status["IceCreamDLCompleted"]))
{
@@ -201,7 +201,7 @@ namespace BPASmartClient.GSIceCream

private void ProcessModeUp(ICMSG_MODE_UP modeUpMsg)
{
MessageLog.GetInstance.Show(string.Format("模式返回为:{0}",modeUpMsg.Mode));
MessageLog.GetInstance.Show(string.Format("模式返回为:{0}", modeUpMsg.Mode));
}

public void ProcessMsg(byte[] data)
@@ -269,79 +269,83 @@ namespace BPASmartClient.GSIceCream
});

//广深冰淇淋机打料
EventBus.EventBus.GetInstance().Subscribe<GSIceCream_DischargeEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
if ((MORKI_FAULT)status["IceCreamFault"] != MORKI_FAULT.未发生故障)
{
MessageLog.GetInstance.Show(string.Format("当前存在故障[{0}%],不允许制作",(MORKI_FAULT)status["IceCreamFault"]));
new GSIceCream_EndCookEvent() { DeviceId = DeviceId,Status = false }.Publish();
callBack?.Invoke(false);
return;
}
if ((byte)status["IceCreamCXB"] <= 86)
{
MessageLog.GetInstance.Show(string.Format("当前成型比[{0}%],低于86%,不允许制作",(byte)status["IceCreamCXB"]));
new GSIceCream_EndCookEvent() { DeviceId = DeviceId,Status = false }.Publish();
callBack?.Invoke(false );
return;
}
EventBus.EventBus.GetInstance().Subscribe<GSIceCream_DischargeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
if ((MORKI_FAULT)status["IceCreamFault"] != MORKI_FAULT.未发生故障)
{
MessageLog.GetInstance.Show(string.Format("当前存在故障[{0}%],不允许制作", (MORKI_FAULT)status["IceCreamFault"]));
new GSIceCream_EndCookEvent() { DeviceId = DeviceId, Status = false }.Publish();
callBack?.Invoke(false);
return;
}
if ((byte)status["IceCreamCXB"] <= 86)
{
MessageLog.GetInstance.Show(string.Format("当前成型比[{0}%],低于86%,不允许制作", (byte)status["IceCreamCXB"]));
new GSIceCream_EndCookEvent() { DeviceId = DeviceId, Status = false }.Publish();
callBack?.Invoke(false);
return;
}

bool modeRight = (MORKI_MODE)status["IceCreamCurrentMode"] == MORKI_MODE.制冷模式;
bool modeRight = (MORKI_MODE)status["IceCreamCurrentMode"] == MORKI_MODE.制冷模式;

if (!modeRight)
{
free = true;
Thread.Sleep(200);
if (!modeRight)
{
free = true;
Thread.Sleep(200);

var temp = IcPack.StructureToByte(ICMSG_MODE_DW.Build(MORKI_MODE.制冷模式));
commProxy.SendData(temp);
var temp = IcPack.StructureToByte(ICMSG_MODE_DW.Build(MORKI_MODE.制冷模式));
commProxy.SendData(temp);

Thread.Sleep(200);
free = false;
MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]",MORKI_MODE.制冷模式));
Thread.Sleep(200);
free = false;
MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]", MORKI_MODE.制冷模式));

DateTime freeTime = DateTime.Now.AddSeconds(5);
while (DateTime.Now < freeTime)
{
Thread.Sleep(10);
modeRight = (MORKI_MODE)status["IceCreamCurrentMode"] == MORKI_MODE.制冷模式;
if (modeRight)
break;
}
}
DateTime freeTime = DateTime.Now.AddSeconds(5);
while (DateTime.Now < freeTime)
{
Thread.Sleep(10);
modeRight = (MORKI_MODE)status["IceCreamCurrentMode"] == MORKI_MODE.制冷模式;
if (modeRight)
break;
}
}

if (modeRight)
{
free = true;
Thread.Sleep(200);
var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build(MORKI_MODE.打料));
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
new GSIceCream_EndCookEvent() { DeviceId = DeviceId,Status =true}.Publish();
MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]",MORKI_MODE.打料));
callBack?.Invoke(true);
}
else
{
MessageLog.GetInstance.Show(string.Format("出料操作->模式切换失败,当前模式[{0}],不允许出料",(MORKI_MODE)status["IceCreamCurrentMode"]));
new GSIceCream_EndCookEvent() { DeviceId = DeviceId,Status = false }.Publish();
callBack?.Invoke(false);
}
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.GSIceCream 中引发错误,IceCreamMachine 类,描述:[{ex.Message}]");
callBack?.Invoke(false);
}
});
if (modeRight)
{
free = true;
Thread.Sleep(200);
var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build(MORKI_MODE.打料));
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
new GSIceCream_EndCookEvent() { DeviceId = DeviceId, Status = true }.Publish();
MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]", MORKI_MODE.打料));
callBack?.Invoke(true);
}
else
{
MessageLog.GetInstance.Show(string.Format("出料操作->模式切换失败,当前模式[{0}],不允许出料", (MORKI_MODE)status["IceCreamCurrentMode"]));
new GSIceCream_EndCookEvent() { DeviceId = DeviceId, Status = false }.Publish();
callBack?.Invoke(false);
}
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.GSIceCream 中引发错误,IceCreamMachine 类,描述:[{ex.Message}]");
callBack?.Invoke(false);
}
});
InitStatus();
//测试用
Start();
MessageLog.GetInstance.Show("冰淇淋机器初始化完成");
}

public override void WriteData(string address, object value)
{
}
}

}

+ 13
- 2
BPASmartClient.IoT/DataVClient.cs View File

@@ -41,7 +41,7 @@ namespace BPASmartClient.IoT
DeviceSecret = System.Configuration.ConfigurationManager.AppSettings["DeviceSecret"].ToString();
StartupMode = System.Configuration.ConfigurationManager.AppSettings["StartupMode"].ToString();
BroadcastPubTopic = InternetInfo.BroadcastPubTopic;

//MaintainTable maintainTable = new MaintainTable();
//maintainTable.Id = Guid.NewGuid().ToString();
@@ -70,6 +70,7 @@ namespace BPASmartClient.IoT
/// 客户端ID
/// </summary>
public string ClientId { set; get; }
public List<int> ListDeviceId { set; get; } = new List<int>();
/// <summary>
/// MQTT上报集合
/// </summary>
@@ -199,7 +200,17 @@ namespace BPASmartClient.IoT
string message = string.Empty;
if (StartupMode == "API")
{
if (DeviceDataV.Initialize(DataVApiAddress, ClientId, "", ref message))
while (ListDeviceId.Count == 0)
{
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.ForEach(device =>
{
if (device != null)
{
ListDeviceId.Add(device.DeviceId);
}
});
}
if (DeviceDataV.Initialize(DataVApiAddress, ClientId, ListDeviceId.Count==0?"": ListDeviceId?.First().ToString(), ref message))
{
ProductKey = DeviceDataV.deviceTable.productkey;
DeviceName = DeviceDataV.deviceTable.devicename;


+ 107
- 105
BPASmartClient.KLMCoffee/CoffeeMachine.cs View File

@@ -19,7 +19,7 @@ namespace BPASmartClient.KLMCoffee
/// <summary>
/// 伽乐美咖啡机
/// </summary>
public class CoffeeMachine :BasePeripheral
public class CoffeeMachine : BasePeripheral
{
//通讯代理
SerialPortClient commProxy = null;
@@ -92,12 +92,12 @@ namespace BPASmartClient.KLMCoffee
commProxy.SendData(cmdAsk);
}
Thread.Sleep(200);
}),"咖啡机询问线程");
}), "咖啡机询问线程");

ThreadManage.GetInstance().StartLong(new Action(() =>
{
ResolveMsg();
}),"咖啡机解析线程");
}), "咖啡机解析线程");
}

private void ResolveMsg()
@@ -117,7 +117,7 @@ namespace BPASmartClient.KLMCoffee
{
temp.Add(dataStorage.GetData());
}
List<byte> vs = new List<byte>() { temp[temp.Count - 4],temp[temp.Count - 3],temp[temp.Count - 2],temp[temp.Count - 1] };
List<byte> vs = new List<byte>() { temp[temp.Count - 4], temp[temp.Count - 3], temp[temp.Count - 2], temp[temp.Count - 1] };

//帧尾
if (Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\\r\\n" || Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\r\n")
@@ -146,9 +146,9 @@ namespace BPASmartClient.KLMCoffee
status["Warning"] = systemStatus.faultMessage.dataFault();
status["Keep"] = systemStatus.upkeepMessage;
if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep())
IsWork=false;
IsWork = false;
else
IsWork=true;
IsWork = true;
}

}
@@ -164,128 +164,130 @@ namespace BPASmartClient.KLMCoffee
status["drinkType"] = DrinkType.意式;
status["AppStatus"] = TaskIndex.无任务;
status["progress"] = 0;
status["Warning"] = new FaultMessage(0x00,0x00).dataFault();
status["Warning"] = new FaultMessage(0x00, 0x00).dataFault();
status["Keep"] = new UpkeepMessage(0x00).dataFault();

}

public override void Init()
{
commProxy = new SerialPortClient(PortName,(BaudRates)Enum.Parse(typeof(BaudRates),BaudRate));
commProxy = new SerialPortClient(PortName, (BaudRates)Enum.Parse(typeof(BaudRates), BaudRate));
commProxy.SetDataStorage(dataStorage);

//伽乐美咖啡机制作
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_MakeCoffeeEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
byte[] data=command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(),new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode));
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode));
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});

//伽乐美咖啡机取消制作咖啡
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CancelMakeCoffeeEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsCancelMake();
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CancelMakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsCancelMake();
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});

//伽乐美咖啡机清洗冲泡器
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_WashCPJEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsWashCPJ();
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_WashCPJEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsWashCPJ();
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});

//伽乐美咖啡机放杯确认
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CupIsOKEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsCupIsOK();
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CupIsOKEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsCupIsOK();
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});


//伽乐美咖啡机清洗奶沫器
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_WashNMJEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsWashNMJ();
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_WashNMJEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsWashNMJ();
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});


//伽乐美咖啡机清洗奶沫器确认
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_WashNMJIsOKEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsWashNMJIsOK();
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_WashNMJIsOKEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsWashNMJIsOK();
commProxy.SendData(data);
Thread.Sleep(200);
free = false;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
InitStatus();
}


public override void WriteData(string address, object value)
{
}
}
}

+ 8
- 6
BPASmartClient.Lebai/LebaiRobot.cs View File

@@ -19,7 +19,7 @@ using BPASmartClient.Model.乐白机器人;

namespace BPASmartClient.Lebai
{
public class LebaiRobot: BasePeripheral
public class LebaiRobot : BasePeripheral
{

/// <summary>
@@ -51,7 +51,7 @@ namespace BPASmartClient.Lebai
if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] =(ELebaiRModel)LebaiHelper.GetInstance().robotData.RobotMode.Mode;
LebaiHelper.GetInstance().GetRobotModeStatus();
Thread.Sleep(10);
},"获取乐白机器人数据");
}, "获取乐白机器人数据");

}

@@ -62,7 +62,7 @@ namespace BPASmartClient.Lebai

public override void Init()
{
EventBus.EventBus.GetInstance().Subscribe<Demo_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack )
EventBus.EventBus.GetInstance().Subscribe<Demo_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{

});
@@ -90,7 +90,7 @@ namespace BPASmartClient.Lebai
if (@event == null) return;
if (@event is LebaiRobot_SetValueEvent SetValueEvent)
{
LebaiHelper.GetInstance().SetValue(SetValueEvent.RobotSetValue);
LebaiHelper.GetInstance().SetValue(SetValueEvent.RobotSetValue);
}
});
//控制机器人
@@ -116,7 +116,7 @@ namespace BPASmartClient.Lebai
default:
break;
}
}
});
//选择机器人场景
@@ -134,6 +134,8 @@ namespace BPASmartClient.Lebai
MessageLog.GetInstance.Show("乐白机器人初始化完成");
}

public override void WriteData(string address, object value)
{
}
}
}

+ 7
- 1
BPASmartClient.MORKSM.BK.PLC/PLCMachine.cs View File

@@ -48,7 +48,7 @@ namespace BPASmartClient.PLC
{
if (@event == null) return;
var par = @event as WriteModel;
//M32.7地址复位
modbusTcp.Write(par?.Address, par?.Value);
});
}
@@ -63,6 +63,12 @@ namespace BPASmartClient.PLC

}

public override void WriteData(string address, object value)
{
if (address != null && value != null)
modbusTcp.Write(address, value);
}

protected override void InitStatus()
{



+ 4
- 0
BPASmartClient.MorkF/BPASmartClient.MorkF.csproj View File

@@ -18,4 +18,8 @@
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Model\" />
</ItemGroup>

</Project>

+ 333
- 96
BPASmartClient.MorkF/Control_MorkF.cs View File

@@ -15,9 +15,11 @@ namespace BPASmartClient.MorkF
public class Control_MorkF : BaseDevice
{
public override DeviceClientType DeviceType => DeviceClientType.MORKSF;

public AutoResetEvent minorReset = new AutoResetEvent(false);
public AutoResetEvent mainReset = new AutoResetEvent(false);
GVL_MorkF morkF = new GVL_MorkF();//全局对象声明
public StirFryBom stirFryBom = new StirFryBom();//创建获取流程的对象

List<int> resultorder = new List<int>();//调试变量
public static readonly object taskLock = new object();
/// <summary>
@@ -28,7 +30,7 @@ namespace BPASmartClient.MorkF
CommandRegist();//调试
ServerInit();
DataParse();//数据解析
MessageLog.GetInstance.Show("MORKF 设备初始化完成");
DeviceProcessLogShow("MORKF 设备初始化完成");
}
#region 调试代码
public void CommandRegist()
@@ -62,19 +64,16 @@ namespace BPASmartClient.MorkF
}
//流程
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T1, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.清洗槽取锅 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T2, PotActions = new List<StirFryPotAction>() { StirFryPotAction.中火持续, StirFryPotAction.加油, StirFryPotAction.搅拌臂下位, StirFryPotAction.低速旋转 }, During = 25 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T3, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止火力, StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });
//stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T5, PotActions = new List<StirFryPotAction>() { StirFryPotAction.搅拌臂下位, StirFryPotAction.大火持续, StirFryPotAction.低速旋转 }, During = 5 });
//stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T6, PotActions = new List<StirFryPotAction>() { StirFryPotAction.快速旋转 }, During = 50 });
//stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T7, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止火力, StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T4, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入A料 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T5, PotActions = new List<StirFryPotAction>() { StirFryPotAction.大火持续, StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 25 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T6, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止火力, StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T7, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入B料 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T5, PotActions = new List<StirFryPotAction>() { StirFryPotAction.大火持续, StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 15 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T6, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止火力, StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T8, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入C料 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T9, PotActions = new List<StirFryPotAction>() { StirFryPotAction.大火持续, StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 55 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T2, PotActions = new List<StirFryPotAction>() { StirFryPotAction.大火持续 }, During = 5 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T3, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入A料 }, PotActions = new List<StirFryPotAction>() { StirFryPotAction.加油, StirFryPotAction.搅拌臂下位, StirFryPotAction.低速旋转 }, During = 6 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T4, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止旋转, StirFryPotAction.停止火力, StirFryPotAction.搅拌臂上位 } });//加A料
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T5, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入B料 }, PotActions = new List<StirFryPotAction>() { StirFryPotAction.中火持续, StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 6 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T6, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止火力, StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });//加B料

stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T7, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入C料 }, PotActions = new List<StirFryPotAction>() { StirFryPotAction.中火持续, StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 9 });

stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T8, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止火力, StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });//加C料
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T9, PotActions = new List<StirFryPotAction>() { StirFryPotAction.中火持续, StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 30 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T10, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止火力, StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T11, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.灶取锅 } });
}
@@ -117,29 +116,28 @@ namespace BPASmartClient.MorkF
}
//流程
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T1, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.清洗槽取锅 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T2, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止火力, StirFryPotAction.搅拌臂下位, StirFryPotAction.低速旋转 }, During = 5 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T2, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入A料 }, PotActions = new List<StirFryPotAction>() { StirFryPotAction.中火持续, StirFryPotAction.搅拌臂下位, StirFryPotAction.低速旋转 }, During = 5 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T3, PotActions = new List<StirFryPotAction>() { StirFryPotAction.加油 }, During = 12 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T4, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T5, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入A料 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T4, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });//加A料
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T6, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入B料 }, PotActions = new List<StirFryPotAction>() { StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 25 });

stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T6, PotActions = new List<StirFryPotAction>() { StirFryPotAction.搅拌臂下位, StirFryPotAction.低速旋转 }, During = 25 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T7, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });//加B料

stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T7, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T8, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入B料 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T9, PotActions = new List<StirFryPotAction>() { StirFryPotAction.搅拌臂下位, StirFryPotAction.低速旋转 }, During = 30 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T9, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入C料 }, PotActions = new List<StirFryPotAction>() { StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 30 });

stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T10, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止火力, StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T10, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止火力, StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });//加C料
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T6, PotActions = new List<StirFryPotAction>() { StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 55 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T11, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.灶取锅 } });
}
public void TakePot()
{
WriteData("M14.0", true);
}

public void TakePotReset()
{
WriteData("M14.0", false);
}
public void TakeOff()
@@ -163,7 +161,7 @@ namespace BPASmartClient.MorkF
}
public void ThreeBlock()
{
// WriteData("M4.0", new bool[] { true, true, false, false, false, false, false, false });//0000 0001
// WriteData("M4.0", new bool[] { true, true, false, false, false, false, false, false });//0000 0001
WriteData("M4.0", new bool[] { false, true, true, false, false, false, false, false });
}
public void OverTurnOff()
@@ -226,6 +224,7 @@ namespace BPASmartClient.MorkF
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId, MaterialLoc = 3 });//C料
morkF.TakePlateQueue.Enqueue(new OrderLocInfo() { SuborderId = subId });
resultorder.AddRange(new int[] { 1, 2, 3 });
morkF.listStirBom.Add(stirFryBom);
}
#endregion

@@ -325,7 +324,7 @@ namespace BPASmartClient.MorkF
// //配方数据地址范围:VW2000 - VW2278
// WriteData("VW2000", recipeBoms.ToArray());
//}
//else { MessageLog.GetInstance.Show("配方数据为空"); }
//else {DeviceProcessLogShow("配方数据为空"); }
}

/// <summary>
@@ -340,7 +339,7 @@ namespace BPASmartClient.MorkF
{
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
MessageLog.GetInstance.Show($"接收到{OrderCount}次订单");
DeviceProcessLogShow($"接收到{OrderCount}次订单");
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
@@ -348,6 +347,7 @@ namespace BPASmartClient.MorkF
{
if (ushort.TryParse(res.BatchingLoc, out ushort loc))
{

//if (morkF.TakeMaterialQueue.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
//将一个商品的ABC料位置存入队列
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId, MaterialLoc = ushort.Parse(res.BatchingLoc) });
@@ -372,7 +372,7 @@ namespace BPASmartClient.MorkF

}
}
//根据ID 查找对应制作流程
//根据ID 查找对应制作流程

}
});
@@ -385,22 +385,146 @@ namespace BPASmartClient.MorkF
{
TakePlatelTask();
TurntableControl();
ProcessExecute();
MainProcessExecute();
MinorProcessExcute();
SingleProcess();
}
//机器人,锅灶流程执行
public void ProcessExecute()
//流程执行
private void MinorProcessExcute()
{
if (!morkF.ProcessExcuteLock)
if (!morkF.MinorProcessExcuteLock)
{
morkF.ProcessExcuteLock = true;
morkF.MinorProcessExcuteLock = true;
Task.Run(() =>
{
if (morkF.MinorProcessFlag && !morkF.RoobotIdle && morkF.TakeMaterialQueue.Count > 0)
{
morkF.MinorProessStatus = true;
morkF.MainProcessStatus = false;
StirFryBom bom = morkF.listStirBom.ElementAt(0);
morkF.listStirBom.RemoveAt(0);
foreach (var res in bom.StirFryActions)
{
DeviceProcessLogShow($"执行流程{res.Time}");
//机器人线程
Task taskRobot = Task.Run(new Action(() =>
{
foreach (var temp in res.RobotActions)
{
switch (temp)
{
case StirFryRobotAction.清洗槽取锅:
TakePotTask();//执行取锅操作
break;
case StirFryRobotAction.加入A料:
TakeBurdenATask();//执行取A料操作
break;
case StirFryRobotAction.加入B料:
TakeBurdenATask();//执行取B料操作
break;
case StirFryRobotAction.加入C料:
TakeBurdenCTask();//执行取C料操作
break;
case StirFryRobotAction.灶取锅:
OutDishTask();//执行出餐操作
CleanPotTask();//洗锅操作
break;
}

}

}));
//炒锅线程操作
Task taskPot = Task.Run(new Action(() =>
{
foreach (var temp in res.PotActions)
{
switch (temp)
{
case StirFryPotAction.NONE:
break;
case StirFryPotAction.大火t1s:
KitchenAdjustGears(3);
Task.Delay(1000).Wait(); //大火加热1s//执行大火锅干操作
break;
case StirFryPotAction.加油:
AddOil();//注油//执行加油操作
break;
case StirFryPotAction.中火t2s:
KitchenAdjustGears(2);
Task.Delay(2000).Wait();//执行操作
break;
case StirFryPotAction.小火持续:
KitchenAdjustGears(1);
break;
case StirFryPotAction.中火持续:
KitchenAdjustGears(5);
break;
case StirFryPotAction.大火持续:
KitchenAdjustGears(7);
break;
case StirFryPotAction.停止火力:
KitchenAdjustGears(0);//关闭灶加热
break;
case StirFryPotAction.搅拌臂上位:
TurnUpStatusDetect();//执行搅拌臂上位操作
break;
case StirFryPotAction.搅拌臂下位:
TurnDownStatusDetect();//执行搅拌臂下位操作
break;
case StirFryPotAction.低速旋转:
TurnMachineGearsControl(1);//执行搅拌臂速度1挡操作
break;
case StirFryPotAction.快速旋转:
TurnMachineGearsControl(2);//执行搅拌臂速度3挡操作
break;
case StirFryPotAction.停止旋转:
TurnMachineGearsControl(0);//执行搅拌臂速度0挡操作
break;
}
}
}));
Task.WhenAll(taskRobot, taskPot).Wait();//等待所有线程结束
Task.Delay(res.During * 1000).Wait();//当前流程延迟
if (morkF.MainProcessWait)
{

KitchenAdjustGears(0);//关闭灶加热
morkF.MinorProessStatus = false;
morkF.MainProcessStatus = true;
//阻塞辅流程
minorReset.WaitOne();
}
morkF.MinorProessStatus = true;
morkF.MainProcessStatus = false;
}
morkF.MinorOutMealComplete = true;
}
else
{
morkF.MinorProcessExcuteLock = false;//解除辅流程自锁
}
});
}
}

//机器人,锅灶主流程执行
public void MainProcessExecute()
{
if (!morkF.MainProcessExcuteLock)
{
morkF.MainProcessExcuteLock = true;
Task.Run(new Action(() =>
{
if (!morkF.RoobotIdle && morkF.InitialComplete && morkF.TakeMaterialQueue.Count > 0)
if (!morkF.RoobotIdle && morkF.InitialComplete && morkF.TakeMaterialQueue.Count > 0 && morkF.MainProcessFlag)
{
foreach (var res in stirFryBom.StirFryActions)//遍历所有流程
morkF.MainProcessStatus = true;
morkF.MinorProessStatus = false;
StirFryBom bom = morkF.listStirBom.ElementAt(0);
morkF.listStirBom.RemoveAt(0);
foreach (var res in bom.StirFryActions)//遍历所有流程
{
MessageLog.GetInstance.Show($"执行流程{res.Time}");
DeviceProcessLogShow($"执行流程{res.Time}");
//机器人线程
Task taskRobot = Task.Run(new Action(() =>
{
@@ -415,12 +539,10 @@ namespace BPASmartClient.MorkF
TakeBurdenATask();//执行取A料操作
break;
case StirFryRobotAction.加入B料:
// TakeBurdenBTask();//执行取B料操作
TakeBurdenATask();//执行取B料操作
break;
case StirFryRobotAction.加入C料:
//TakeBurdenCTask();//执行取C料操作
TakeBurdenATask();//执行取C料操作
TakeBurdenCTask();//执行取C料操作
break;
case StirFryRobotAction.灶取锅:
OutDishTask();//执行出餐操作
@@ -458,7 +580,7 @@ namespace BPASmartClient.MorkF
KitchenAdjustGears(5);
break;
case StirFryPotAction.大火持续:
KitchenAdjustGears(6);
KitchenAdjustGears(7);
break;
case StirFryPotAction.停止火力:
KitchenAdjustGears(0);//关闭灶加热
@@ -481,14 +603,26 @@ namespace BPASmartClient.MorkF
}
}
}));

Task.WhenAll(taskRobot, taskPot).Wait();//等待所有线程结束
Task.Delay(res.During * 1000).Wait();//当前流程延迟
Task.Delay(res.During * 1000).Wait();//当前流程延迟
if (morkF.MinorProcessWait)
{
KitchenAdjustGears(0);//关闭灶加热
morkF.MinorProessStatus = true;
morkF.MainProcessStatus = false;
//阻塞主流程
mainReset.WaitOne();
}
morkF.MinorProessStatus = false;
morkF.MainProcessStatus = true;

}
morkF.OutMealComplete = true;
morkF.MainOutMealComplete = true;
}
else
{
morkF.ProcessExcuteLock = false;//解除流程互锁
morkF.MainProcessExcuteLock = false;//解除流程自
}
}));
}
@@ -501,13 +635,21 @@ namespace BPASmartClient.MorkF
{


//出餐完成,相应变量复位
if (morkF.OutMealComplete)
//主流程出餐完成,相应变量复位
if (morkF.MainOutMealComplete)
{
morkF.TakePlateLock = false;
morkF.TakePotLock = false;
morkF.PotInPlace = false;
morkF.ProcessExcuteLock = false;
morkF.MainProcessExcuteLock = false;
morkF.MainOrderMaterialCom = false;
}
//辅流程出餐完成,相应变量复位
if (morkF.MinorOutMealComplete)
{
morkF.TakePlateLock = false;
morkF.PotInPlace = false;
morkF.MinorProcessExcuteLock = false;
morkF.MinorOrderMaterialCom = false;
}

}
@@ -527,11 +669,11 @@ namespace BPASmartClient.MorkF
// if (ushort.TryParse(result[0].BatchingLoc, out ushort loc))
// {
// TurnMaterialStore(loc);
// MessageLog.GetInstance.Show($"转台转到【{loc}】位置");
// DeviceProcessLogShow($"转台转到【{loc}】位置");
// morkF.TurnTableLock = true; //取料完成后置false
// }
// }
// else MessageLog.GetInstance.Show("未找到可用的物料信息");
// elseDeviceProcessLogShow("未找到可用的物料信息");
//}

//调试代码
@@ -542,12 +684,15 @@ namespace BPASmartClient.MorkF
{

TurnMaterialStore(resultorder[0]);
MessageLog.GetInstance.Show($"转台转到【{resultorder[0]}】位置");
DeviceProcessLogShow($"转台转到【{resultorder[0]}】位置");
resultorder.RemoveAt(0);
morkF.TurnTableLock = true; //取料完成后置false

}
else MessageLog.GetInstance.Show("未找到可用的物料信息");
else
{
DeviceProcessLogShow("未找到可用的物料信息");
}
}

}
@@ -565,11 +710,15 @@ namespace BPASmartClient.MorkF
if (morkF.TakePlateQueue.TryDequeue(out OrderLocInfo order))
{
StartTakePlate();
morkF.CurrentOrderId = order.SuborderId;
if (morkF.MainProcessStatus)
morkF.MainCurrentOrderId = order.SuborderId;
if (morkF.MinorProessStatus)
morkF.MinorCurrentOrderId = order.SuborderId;
morkF.TakePlateLock = true; //订单完成后置false
morkF.OutMealComplete = false;
// OrderChange(morkF.CurrentOrderId, ORDER_STATUS.COOKING);
MessageLog.GetInstance.Show($"订单【{ morkF.CurrentOrderId}】执行取碗控制");
morkF.MainOutMealComplete = false;
morkF.MinorOutMealComplete = false;
// OrderChange(morkF.CurrentOrderId, ORDER_STATUS.COOKING);
DeviceProcessLogShow($"订单【{order.SuborderId}】执行取碗控制");
}
}
}
@@ -580,7 +729,11 @@ namespace BPASmartClient.MorkF
/// <exception cref="NotImplementedException"></exception>
private void TakePotTask()
{
while (!(!morkF.CleanModule && !morkF.KitchenOneStatus && morkF.CleanComplete))//等待清洗1准备就绪
//while (!((!morkF.CleanModule && !morkF.KitchenOneStatus && morkF.CleanComplete) || (!morkF.SecondCleanModule && !morkF.KitchenSecondStatus && morkF.SecondCleanComplete)))
//{
// Task.Delay(5).Wait();
//}
while (!(!morkF.CleanModule || !morkF.SecondCleanModule) && (!morkF.KitchenOneStatus || !morkF.KitchenSecondStatus) && (morkF.CleanComplete || morkF.SecondCleanComplete))//等待取锅条件满足
{
Task.Delay(5).Wait();
}
@@ -590,7 +743,12 @@ namespace BPASmartClient.MorkF
}
TakePotToKitchen();
WriteData("M1.5", false);//清洗模组1完成复位
MessageLog.GetInstance.Show($"订单【{ morkF.CurrentOrderId}】执行取锅到灶台控制");
WriteData("M2.0", false);//清洗模组2完成复位
if (morkF.MainProcessStatus)
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
if (morkF.MinorProessStatus)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");

while (!morkF.PutPotToKitchenComlete)
{
Task.Delay(5).Wait();
@@ -635,20 +793,17 @@ namespace BPASmartClient.MorkF
TakeBurden(loc);
TurnReset(loc);//转台复位

MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料");
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料");
}
//等待取料完成
while (!morkF.TakeMaterialComplete)
{
Task.Delay(5).Wait();
}
morkF.MainOrderMaterialCom = false;
WriteData("M14.1", false);//机器人取料完成复位
morkF.TurnTableLock = false;//转台互锁解除
while (!morkF.FallMaterialComplete)//等待倒料完成
{
Task.Delay(5).Wait();
}
MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,转台{loc}配料倒料完成");


}
/// <summary>
@@ -665,21 +820,21 @@ namespace BPASmartClient.MorkF
int loc = order.MaterialLoc;
TakeBurden(loc);
TurnReset(loc);//转台复位
MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,执行取B料");
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行取B料");
}
//等待取料完成
while (!morkF.TakeMaterialComplete)
{
Task.Delay(5).Wait();
}
morkF.MainOrderMaterialCom = false;
WriteData("M14.1", false);//机器人取料完成复位
morkF.TurnTableLock = false;//转台互锁解除
while (!morkF.FallMaterialComplete)//等待倒料完成
{
Task.Delay(5).Wait();
}
MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,B料倒料完成");
//while (!morkF.FallMaterialComplete)//等待倒料完成
//{
// Task.Delay(5).Wait();
//}
//MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,B料倒料完成");
}
/// <summary>
/// 取调味品C料
@@ -696,21 +851,23 @@ namespace BPASmartClient.MorkF
int loc = order.MaterialLoc;
TakeBurden(loc);
TurnReset(loc);//转台复位
MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,执行取C料");
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行取C料");
}
MessageLog.GetInstance.ShowEx($"剩余配料数量{morkF.TakeMaterialQueue.Count}");
DeviceProcessLogShow($"剩余配料数量{morkF.TakeMaterialQueue.Count}");
//等待取料完成
while (!morkF.TakeMaterialComplete)
{
Task.Delay(5).Wait();
}
morkF.MainOrderMaterialCom = false;
WriteData("M14.1", false);//机器人取料完成复位
morkF.TurnTableLock = false;//转台互锁解除
while (!morkF.FallMaterialComplete)
{
Task.Delay(5).Wait();
}
MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,C料倒料完成");
//while (!morkF.FallMaterialComplete)
//{
// Task.Delay(5).Wait();
//}
//morkF.SingelOrderMaterialCom = true;
//MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,C料倒料完成");
//}
}
/// <summary>
@@ -718,17 +875,25 @@ namespace BPASmartClient.MorkF
/// </summary>
private void OutDishTask()
{
while (morkF.RoobotIdle || morkF.CleanModule || !morkF.ProvidePlateComplete)//等待条件满足
//while (morkF.RoobotIdle || morkF.CleanModule || !morkF.ProvidePlateComplete)//等待条件满足
//{
// Task.Delay(5).Wait();
//}
while (morkF.RoobotIdle || (!morkF.CleanComplete && !morkF.SecondCleanComplete) || !morkF.ProvidePlateComplete)//等待条件满足
{
Task.Delay(5).Wait();
}

if (morkF.TakePlateQueue.Count == 0)
{
WriteData("M0.7", false);//无订单关闭抽风机
}
RobotOutMeal();
WriteData("M1.2", false);//供盘复位
MessageLog.GetInstance.Show($"订单【{morkF.CurrentOrderId}】正在出餐");
if (morkF.MainProcessStatus)
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
if (morkF.MinorProessStatus)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");

}

@@ -737,17 +902,27 @@ namespace BPASmartClient.MorkF
/// </summary>
private void CleanPotTask()
{


while (!morkF.PlaceRinseTableComplete || morkF.CleanModule)
{
Task.Delay(5).Wait();
}
MessageLog.GetInstance.Show($"订单【{morkF.CurrentOrderId}】出餐完成");
if (morkF.MainProcessStatus)
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
if (morkF.MinorProessStatus)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");
WriteData("M14.2", false);//机器人出餐完成复位
//OrderChange(morkF.CurrentOrderId, ORDER_STATUS.COMPLETED_COOK);

//OrderChange(morkF.CurrentOrderId, ORDER_STATUS.COMPLETED_COOK);
CleanModuleControl("Start");
if (morkF.MainProcessStatus)//主流程
{
morkF.MainProcessFlag = false;
minorReset.Set();
}
else if (morkF.MinorProessStatus)//辅流程
{
morkF.MinorProcessFlag = false;
mainReset.Set();
}
}
/// <summary>
/// 任务复位重启
@@ -787,8 +962,15 @@ namespace BPASmartClient.MorkF
Task.Delay(5).Wait();
}
WriteData("M8.3", false);//下降完成复位
MessageLog.GetInstance.Show($"翻转机下降完成");

DeviceProcessLogShow($"翻转机下降完成");
//if (morkF.MaterialCount == 3 && morkF.MainProcessStatus)
//{
// morkF.MainProcessWait = true;
//}
//else if (morkF.MaterialCount == 3 && morkF.MinorProessStatus)
//{
// morkF.MinorProcessWait = true;
//}

}
/// <summary>
@@ -806,7 +988,60 @@ namespace BPASmartClient.MorkF
Task.Delay(5).Wait();
}
WriteData("M8.1", false);//上升完成复位
MessageLog.GetInstance.Show("翻转机上升完成");
if (morkF.MainProcessStatus)//代表主流程执行的操作
{
if (!morkF.MainOrderMaterialCom)
{
WriteData("M14.3", true);//倒料
while (!morkF.FallMaterialComplete)//等待倒料完成
{
Task.Delay(5).Wait();
}
morkF.MaterialCount++;
WriteData("M14.3", false);//倒料复位
if (morkF.MaterialCount == 3)
{
//允许执行下一个订单流程
morkF.MaterialCount = 0;
morkF.MinorProcessFlag = true;

}
morkF.MainOrderMaterialCom = true;
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】,配料倒料完成");
}
else //辅程准备阻塞
{
morkF.MainProcessWait = true;
}
}
else if (morkF.MinorProessStatus)//代表辅流程执行的操作
{
if (!morkF.MinorOrderMaterialCom)
{
WriteData("M14.3", true);//倒料
while (!morkF.FallMaterialComplete)//等待倒料完成
{
Task.Delay(5).Wait();
}
morkF.MaterialCount++;
WriteData("M14.3", false);//倒料复位
if (morkF.MaterialCount == 3)
{
//允许执行下一个订单流程
morkF.MaterialCount = 0;
morkF.MainProcessFlag = true;

}
morkF.MinorOrderMaterialCom = true;
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】,配料倒料完成");
}
else //主流程准备阻塞
{
morkF.MinorProcessWait = true;
}
}

DeviceProcessLogShow("翻转机上升完成");

}
private void GetStatus(string key, Action<bool[]> action)
@@ -869,8 +1104,10 @@ namespace BPASmartClient.MorkF
break;

}
MessageLog.GetInstance.Show($"订单【{morkF.CurrentOrderId}】,加热档位调至{number}挡");

if (morkF.MainProcessStatus)
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
if (morkF.MinorProessStatus)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");
}
public void TurnMaterialStore(int loc)
{
@@ -931,13 +1168,13 @@ namespace BPASmartClient.MorkF
}

WriteData("M2.7", true);//加油
WriteData("M0.7",true);//打开抽风机
MessageLog.GetInstance.Show("开始注油");
WriteData("M0.7", true);//打开抽风机
DeviceProcessLogShow("开始注油");
while (!morkF.FallOilComplete)
{
Task.Delay(5).Wait();
}
MessageLog.GetInstance.Show("注油完成");
DeviceProcessLogShow("注油完成");

}
/// <summary>
@@ -952,7 +1189,7 @@ namespace BPASmartClient.MorkF
// case "Middle": WriteData("", 1); break;
case "Down": WriteData("M8.2", true); break;
}
MessageLog.GetInstance.Show($"翻转机执行{orientation}操作");
DeviceProcessLogShow($"翻转机执行{orientation}操作");
}
/// <summary>
/// 翻转机档位控制
@@ -970,7 +1207,7 @@ namespace BPASmartClient.MorkF
case 2: WriteData("M7.2", true); break;//翻炒机2挡
case 3: WriteData("M7.3", true); break;//翻炒机3挡
}
MessageLog.GetInstance.Show($"翻转机档位调至{gear}挡");
DeviceProcessLogShow($"翻转机档位调至{gear}挡");
}
/// <summary>
/// 取A,B,C料
@@ -992,7 +1229,7 @@ namespace BPASmartClient.MorkF
{
WriteData("M1.4", false);
}
MessageLog.GetInstance.Show($"清洗模组执行【{status}】操作");
DeviceProcessLogShow($"清洗模组执行【{status}】操作");
}

public override void Stop()


+ 78
- 7
BPASmartClient.MorkF/GVL_MorkF.cs View File

@@ -1,4 +1,5 @@
using System;
using BPA.Models;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
@@ -25,14 +26,29 @@ namespace BPASmartClient.MorkF
/// 清洗模组1状态 忙碌1 空闲0
/// </summary>
public bool CleanModule { get; set; }

/// <summary>
/// 清洗模组2状态 忙碌1 空闲0
/// </summary>
public bool SecondCleanModule { get; set; }
/// <summary>
/// 清洗模组1完成状态
/// </summary>
public bool CleanComplete { get; set; }

// <summary>
/// 清洗模组2完成状态
/// </summary>
public bool SecondCleanComplete { get; set; }
/// <summary>
/// 锅灶1状态 忙碌1 空闲0
/// </summary>
public bool KitchenOneStatus { get; set; }

/// <summary>
/// 锅灶1状态 忙碌1 空闲0
/// </summary>
public bool KitchenSecondStatus { get; set; }
/// <summary>
/// 注油完成状态
/// </summary>
@@ -75,9 +91,13 @@ namespace BPASmartClient.MorkF
/// </summary>
public ConcurrentQueue<OrderLocInfo> TakePlateQueue = new ConcurrentQueue<OrderLocInfo>();
/// <summary>
/// 存放当前订单唯一ID
/// 存放主流程当前订单唯一ID
/// </summary>
public string CurrentOrderId { get; set; }
public string MainCurrentOrderId { get; set; }
/// <summary>
/// 存放辅流程当前订单唯一ID
/// </summary>
public string MinorCurrentOrderId { get; set; }
/// <summary>
/// PLC上升沿初始化触发信号
/// </summary>
@@ -159,17 +179,68 @@ namespace BPASmartClient.MorkF
/// 转台互锁
/// </summary>
public bool TurnTableLock { get; set; }

public bool ProcessExcuteLock { get; set; }
/// <summary>
/// 主流程自锁
/// </summary>
public bool MainProcessExcuteLock { get; set; }
/// <summary>
/// 辅流程自锁
/// </summary>
public bool MinorProcessExcuteLock { get; set; }
/// <summary>
/// 开始取料标志
/// </summary>
public bool AllowTakeMaterial { get; set; }
/// <summary>
/// 当前订单完成标志
/// 主流程订单完成标志
/// </summary>
public bool MainOutMealComplete { get; set; }
/// <summary>
/// 辅流程订单完成标志
/// </summary>
public bool MinorOutMealComplete { get; set; }
/// <summary>
/// 主流程订单取料结束
/// </summary>
public bool MainOrderMaterialCom { get; set; }
/// <summary>
/// 主流程等待
/// </summary>
public bool MainProcessWait { get; set; }
/// <summary>
/// 辅流程等待
/// </summary>
public bool OutMealComplete { get; set; }
public bool MinorProcessWait { get; set; }
/// <summary>
/// 辅流程订单取料结束
/// </summary>
public bool MinorOrderMaterialCom { get; set; }
/// <summary>
/// 存储订单对应流程对象
/// </summary>
public List<StirFryBom> listStirBom=new List<StirFryBom>();

/// <summary>
/// 下配料次数
/// </summary>
public int MaterialCount { get; set; }
/// <summary>
/// 允许执行辅流程标识
/// </summary>
public bool MinorProcessFlag { get; set; }
/// <summary>
/// 辅流程执行状态
/// </summary>
public bool MinorProessStatus { get; set; }
/// <summary>
/// 允许执行主流程标识
/// </summary>
public bool MainProcessFlag { get; set; } = true;
/// <summary>
/// 主流程执行状态
/// </summary>
public bool MainProcessStatus { get; set; }
}
}


+ 45
- 0
BPASmartClient.MorkF/View/DebugView.xaml View File

@@ -0,0 +1,45 @@
<UserControl x:Class="BPASmartClient.MorkF.View.DebugView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkF.View"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>

<StackPanel Orientation="Horizontal" Grid.Row="0">
<Button Content="初始化" Command="{Binding PlcInite}" Margin="10,0,10,0" Cursor="Hand"></Button>
<Button Content="模拟订单" Command="{Binding SimulateOrder}" Margin="10,0,10,0"></Button>
<Button Content="手撕包菜" Command="{Binding ShreddCabbage}" Margin="10,0,10,0"></Button>
<Button Content="盐煎肉" Command="{Binding FryPork}" Margin="10,0,10,0"></Button>
<Button Content="酱烧杏鲍菇" Command="{Binding XingBaoGu}" Margin="10,0,10,0"></Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1">
<Button Content="取锅" Command="{Binding TakePot}" Margin="10,0,10,0"></Button>
<Button Content="取锅复位" Command="{Binding TakePotReset}" Margin="10,0,10,0"></Button>
<Button Content="加热关闭" Command="{Binding TempTurnOff}" Margin="10,0,10,0"></Button>
<Button Content="加热1挡" Command="{Binding OneBlock}" Margin="10,0,10,0"></Button>
<Button Content="加热2挡" Command="{Binding TwoBlock}" Margin="10,0,10,0"></Button>
<Button Content="加热3挡" Command="{Binding ThreeBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机关闭" Command="{Binding OverTurnOff}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机上升" Command="{Binding OverGoOn}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机下降" Command="{Binding OverGoDown}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机1挡" Command="{Binding OverOneBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机2挡" Command="{Binding OverTwoBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机3挡" Command="{Binding OverThreeBlock}" Margin="10,0,10,0"></Button>
</StackPanel>
</Grid>
</UserControl>

+ 30
- 0
BPASmartClient.MorkF/View/DebugView.xaml.cs View File

@@ -0,0 +1,30 @@
using BPASmartClient.MorkF.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkF.View
{
/// <summary>
/// DebugView.xaml 的交互逻辑
/// </summary>
public partial class DebugView : UserControl
{
public DebugView()
{
InitializeComponent();
this.DataContext = new DebugViewModel();
}
}
}

+ 55
- 0
BPASmartClient.MorkF/ViewModel/DebugViewModel.cs View File

@@ -0,0 +1,55 @@
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkF.ViewModel
{
internal class DebugViewModel : ObservableObject
{

public RelayCommand PlcInite { get; set; }
public RelayCommand SimulateOrder { get; set; }
public RelayCommand TakePot { get; set; }
public RelayCommand TakePotReset { get; set; }
public RelayCommand TempTurnOff { get; set; }
public RelayCommand OneBlock { get; set; }
public RelayCommand TwoBlock { get; set; }
public RelayCommand ThreeBlock { get; set; }

public RelayCommand OverTurnOff { get; set; }
public RelayCommand OverOneBlock { get; set; }
public RelayCommand OverTwoBlock { get; set; }
public RelayCommand OverThreeBlock { get; set; }
public RelayCommand OverGoOn { get; set; }
public RelayCommand OverGoDown { get; set; }
public RelayCommand ShreddCabbage { get; set; }
public RelayCommand FryPork { get; set; }
public RelayCommand XingBaoGu { get; set; }
public DebugViewModel()
{
PlcInite = new RelayCommand(() => { ActionManage.GetInstance.Send("InitCommand"); });
SimulateOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("SimultaorOrder"); });
TakePot = new RelayCommand(() => { ActionManage.GetInstance.Send("TakePot"); });
TakePotReset = new RelayCommand(() => { ActionManage.GetInstance.Send("TakePotReset"); });
TempTurnOff = new RelayCommand(() => { ActionManage.GetInstance.Send("TakeOff"); });
OneBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OneBlock"); });
TwoBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("TwoBlock"); });
ThreeBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("ThreeBlock"); });
OverTurnOff = new RelayCommand(() => { ActionManage.GetInstance.Send("OverTurnOff"); });
OverOneBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverOneBlock"); });
OverTwoBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverTwoBlock"); });
OverThreeBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverThreeBlock"); });
OverGoOn = new RelayCommand(() => { ActionManage.GetInstance.Send("OverGoOn"); });
OverGoDown = new RelayCommand(() => { ActionManage.GetInstance.Send("OverGoDown"); });
ShreddCabbage = new RelayCommand(() => { ActionManage.GetInstance.Send("ShreddCabbage"); });
FryPork = new RelayCommand(() => { ActionManage.GetInstance.Send("FryPork"); });
XingBaoGu = new RelayCommand(() => { ActionManage.GetInstance.Send("XingBaoGu"); });
}

}
}

+ 207
- 0
BPASmartClient.MorkM/Alarm.cs View File

@@ -0,0 +1,207 @@
using BPASmartClient.Device;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkM
{
public class Alarm : IAlarm
{

/// <summary>
/// 煮面机左侧低温报警
/// PLC ---> M230.0
/// ModbusTcp --> 1570
/// </summary>
[Alarm("煮面机左侧低温报警")]
public bool MachineLeftLowTemperature { get; set; }

/// <summary>
/// 煮面机左侧低温报警
/// PLC ---> M230.1
/// ModbusTcp --> 1571
/// </summary>
[Alarm("煮面机右侧低温报警")]
public bool MachineRightLowTemperature { get; set; }

/// <summary>
/// 供碗1缺碗
/// PLC ---> 230.2
/// ModbusTcp --> 1572
/// </summary>
[Alarm("供碗1缺碗")]
public bool Supply1_LossBowl { get; set; }

/// <summary>
/// 供碗2缺碗
/// PLC ---> M230.3
/// ModbusTcp --> 1573
/// </summary>
[Alarm("供碗2缺碗")]
public bool Supply2_LossBowl { get; set; }

/// <summary>
/// 供碗1出碗检测异常
/// PLC ---> M230.4
/// ModbusTcp --> 1574
/// </summary>
[Alarm("供碗1出碗检测异常")]
public bool Supply1_ErrorOutBowl { get; set; }

/// <summary>
/// 供碗2出碗检测异常
/// PLC ---> M230.5
/// ModbusTcp --> 1575
/// </summary>
[Alarm("供碗2出碗检测异常")]
public bool Supply2_ErrorOutBowl { get; set; }

/// <summary>
/// 推碗气缸故障
/// PLC ---> M230.6
/// ModbusTcp --> 1576
/// </summary>
[Alarm("推碗气缸故障")]
public bool PushBowlCylinderError { get; set; }

/// <summary>
/// 煮面机通讯异常
/// PLC ---> M230.7
/// ModbusTcp --> 1577
/// </summary>
[Alarm("煮面机通讯异常")]
public bool NoodleMacCommunicateError { get; set; }

/// <summary>
/// 配料机通讯异常
/// PLC ---> M231.0
/// ModbusTcp --> 1580
/// </summary>
[Alarm("配料机通讯异常")]
public bool DosingMacCommunicateError { get; set; }

/// <summary>
/// 机器人通讯异常
/// PLC ---> M231.1
/// ModbusTcp --> 1581
/// </summary>
[Alarm("机器人通讯异常")]
public bool RobotMacCommunicateError { get; set; }

/// <summary>
/// 机器人通讯异常
/// PLC ---> M231.2
/// ModbusTcp --> 1581
/// </summary>
[Alarm("设备急停")]
public bool DeviceEstop { get; set; }

/// <summary>
/// PLC电池电压低
/// PLC ---> M231.3
/// ModbusTcp --> 1583
/// </summary>
[Alarm("PLC电池电压低")]
public bool RobotInitError { get; set; }

/// <summary>
/// 机器人急停
/// PLC ---> M231.4
/// ModbusTcp --> 1584
/// </summary>
[Alarm("机器人急停")]
public bool RobotUrgentStop { get; set; }

/// <summary>
/// 机器人不在远程模式
/// PLC ---> M231.5
/// ModbusTcp --> 1585
/// </summary>
[Alarm("机器人不在远程模式")]
public bool RobotNotInRemoteMode { get; set; }

/// <summary>
/// 机器人伺服未就绪
/// PLC ---> M231.6
/// ModbusTcp --> 1586
/// </summary>
[Alarm("机器人伺服未就绪")]
public bool RobotNotInReady { get; set; }

/// <summary>
/// 机器人本体异常
/// PLC ---> M231.7
/// ModbusTcp --> 1587
/// </summary>
[Alarm("机器人本体异常")]
public bool RobotSelfInException { get; set; }

/// <summary>
/// 煮面机左侧缺水
/// PLC ---> M232.0
/// ModbusTcp --> 1570
/// </summary>
[Alarm("煮面机左侧缺水报警")]
public bool LeftLackWater { get; set; }

/// <summary>
/// 煮面机右侧缺水
/// PLC ---> M232.1
/// ModbusTcp --> 1571
/// </summary>
[Alarm("煮面机右侧缺水报警")]
public bool RightLackWater { get; set; }

/// <summary>
/// 丝杆初始化失败
/// PLC ---> M232.2
/// ModbusTcp --> 1571
/// </summary>
[Alarm("丝杆初始化失败")]
public bool SvrewInitFail { get; set; }

/// <summary>
/// 转盘初始化失败
/// PLC ---> M232.3
/// ModbusTcp --> 1571
/// </summary>
[Alarm("转盘初始化失败")]
public bool TurntableInitFail { get; set; }

/// <summary>
/// 机器人初始化失败
/// PLC ---> M232.4
/// ModbusTcp --> 1571
/// </summary>
[Alarm("机器人初始化失败")]
public bool RobotInitFail { get; set; }

/// <summary>
/// 煮面机初始化失败
/// PLC ---> M232.5
/// ModbusTcp --> 1571
/// </summary>
[Alarm("煮面机初始化失败")]
public bool NoodleCookerInitFail { get; set; }

/// <summary>
/// 推碗1步进推杆初始化失败
/// PLC ---> M232.6
/// ModbusTcp --> 1571
/// </summary>
[Alarm("推碗1步进推杆初始化失败")]
public bool PushBowlInitFail1 { get; set; }

/// <summary>
/// 推碗2步进推杆初始化失败
/// PLC ---> M232.7
/// ModbusTcp --> 1571
/// </summary>
[Alarm("推碗2步进推杆初始化失败")]
public bool PushBowlInitFail2 { get; set; }


}
}

+ 35
- 0
BPASmartClient.MorkM/BPASmartClient.MorkM.csproj View File

@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="View\Monitor.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\ParSet.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>

<ItemGroup>
<Page Update="View\Monitor.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\ParSet.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>

</Project>

+ 1000
- 0
BPASmartClient.MorkM/Control_MORKM.cs
File diff suppressed because it is too large
View File


+ 402
- 0
BPASmartClient.MorkM/GVL_MORKM.cs View File

@@ -0,0 +1,402 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;
using BPA.Message;
using BPASmartClient.Device;
using BPASmartClient.Model;

namespace BPASmartClient.MorkM
{
/// <summary>
/// MORKS 设备数据
/// </summary>
public class GVL_MORKM : IStatus
{
public GVL_MORKM()
{
for (int i = 0; i < 6; i++)
{
CookNodelId.Add(new CookNodleLocAndId() { CookNodelId = "", Loc = -1 });
}
}

/// <summary>
/// 机器人取面
/// PLC -> M0.3
/// ModbusTcp -> 323
/// </summary>
public bool RobotTakeNoodle { get; set; }

/// <summary>
/// 机器人出餐
/// PLC -> M0.4
/// ModbusTcp -> 324
/// </summary>
public bool RobotOutMeal { get; set; }

/// <summary>
/// 移动转台
/// PLC -> M0.5
/// ModbusTcp -> 325
/// </summary>
public bool MoveTurntable { get; set; }


#region 临时变量
/// <summary>
/// 允许运行
/// </summary>
[VariableMonitor("允许运行")]
public bool AllowRun { get; set; }

/// <summary>
/// //机器人任务互锁信号
/// </summary>
[VariableMonitor("机器人任务互锁信号")]
public bool RobotTaskInterlock { get; set; }

/// <summary>
/// 取碗互锁信号
/// </summary>
[VariableMonitor("取碗互锁信号")]
public bool TakeBowlInterlock { get; set; }

/// <summary>
/// 取面互锁信号
/// </summary>
[VariableMonitor("取面互锁信号")]
public bool TakeNoodleInterlock { get; set; }

/// <summary>
/// 出面中
/// </summary>
[VariableMonitor("出面中")]
public bool OutNoodleing { get; set; }

/// <summary>
/// 允许取面
/// </summary>
[VariableMonitor("允许取面")]
public bool AllowTakeNoodle { get; set; }

/// <summary>
/// 转台互锁信号
/// </summary>
[VariableMonitor("转台互锁信号")]
public bool TurntableInterlock { get; set; }

/// <summary>
/// 荤素出餐互锁
/// </summary>
[VariableMonitor("荤素出餐互锁")]
public bool ERLoc { get; set; } = false;

/// <summary>
/// 当前取餐位置
/// </summary>
[VariableMonitor("当前取餐位置")]
public int CurrentTakeMeakLoc { get; set; } = -1;
#endregion


/// <summary>
/// 初始化完成
/// PLC -> M100.0
/// ModbusTcp -> 1120
/// </summary>
[VariableMonitor("初始化完成", "M100.0", "1120")]
public bool InitComplete { get; set; }

/// <summary>
/// 取碗机构空闲,True:忙碌,false:空闲
/// PLC -> M100.1
/// ModbusTcp -> 1121
/// </summary>
[VariableMonitor("取碗机构空闲", "M100.1", "1121")]
public bool TakeBowlIdle { get; set; }

/// <summary>
/// 温度到达,True:表示到达,false:未到达
/// PLC -> M100.2
/// ModbusTcp -> 1122
/// </summary>
[VariableMonitor("温度到达", "M100.2", "1122")]
public bool TemperatureReached { get; set; }

/// <summary>
/// 允许到面,配料完成
/// PLC -> M100.3
/// ModbusTcp -> 1123
/// </summary>
[VariableMonitor("允许到面", "M100.3", "1123")]
public bool AllowFallNoodle { get; set; }

/// <summary>
/// 机器人取面完成
/// PLC -> M100.4
/// ModbusTcp -> 1124
/// </summary>
[VariableMonitor("机器人取面完成", "M100.4", "1124")]
public bool RbTakeNoodleComplete { get; set; }

/// <summary>
/// 机器人倒面完成
/// PLC -> M100.5
/// ModbusTcp -> 1125
/// </summary>
[VariableMonitor("机器人倒面完成", "M100.5", "1125")]
public bool RbFallNoodleComplete { get; set; }

/// <summary>
/// 机器人出餐完成,上报取餐完成
/// PLC -> M100.6
/// ModbusTcp -> 1126
/// </summary>
[VariableMonitor("机器人出餐完成", "M100.6", "1126")]
public bool RbOutMealComplete { get; set; }

/// <summary>
/// 机器人空闲
/// PLC -> M100.7
/// ModbusTcp -> 1127
/// </summary>
[VariableMonitor("机器人空闲", "M100.7", "1127")]
public bool RobotIdle { get; set; }

/// <summary>
/// 取餐口检测
/// PLC -> M101.0
/// ModbusTcp -> 1128
/// </summary>
[VariableMonitor("取餐口检测", "M101.0", "1128")]
public bool TakeMealDetect { get; set; }

/// <summary>
/// 缺碗信号,false:缺碗,true:有碗
/// PLC -> M101.1
/// ModbusTcp -> 1129
/// </summary>
[VariableMonitor("缺碗信号", "M101.1", "1129")]
public bool MissingBowl { get; set; }

/// <summary>
/// 设备初始化中,执行中等于1,2秒后复位
/// PLC -> M101.2
/// ModbusTcp -> 1130
/// </summary>
[VariableMonitor("设备初始化中", "M101.2", "1130")]
public bool DeviceIniting { get; set; }

/// <summary>
/// 转台下限检测
/// PLC -> M101.3
/// ModbusTcp -> 1131
/// </summary>
[VariableMonitor("转台下限检测", "M101.3", "1131")]
public bool TurntableLowerLimit { get; set; }

/// <summary>
/// 缺碗信号 2
/// PLC -> M101.4
/// ModbusTcp -> 1132
/// </summary>
[VariableMonitor("缺碗信号 2", "M101.4", "1132")]
public bool MissingBowlSignal2 { get; set; }

/// <summary>
/// 转台上限检测
/// PLC -> M101.5
/// ModbusTcp -> 1133
/// </summary>
[VariableMonitor("转台上限检测", "M101.5", "1133")]
public bool TurntableUpLimit { get; set; }

/// <summary>
/// 补料完成
/// PLC -> M101.6
/// ModbusTcp -> 1134
/// </summary>
[VariableMonitor("补料完成", "M101.6", "1134")]
public bool FeedComplete { get; set; }

/// <summary>
/// 转台移动到位
/// PLC -> M101.7
/// ModbusTcp -> 1135
/// </summary>
[VariableMonitor("转台移动到位", "M101.7", "1135")]
public bool TurntableMoveInPlace { get; set; }

/// <summary>
/// 煮面炉状态,True:忙碌,false:空闲
/// M102.0 - M102.5
/// 1136 - 1141
/// </summary>
[VariableMonitor("煮面炉状态", "M102.0", "1136")]
public bool[] NoodleCookerStatus { get; set; } = new bool[6] { false, false, false, false, false, false };

/// <summary>
/// 补料中
/// M102.6
/// 1142
/// </summary>
[VariableMonitor("补料中", "M102.6", "1142")]
public bool Feeding { get; set; }

/// <summary>
/// 煮面完成,上升后给信号
/// M103.0 - M103.5
/// 1144 - 1149
/// </summary>
[VariableMonitor("煮面完成", "M103.0", "1144")]
public bool[] CookNoodlesComplete { get; set; } = new bool[6] { false, false, false, false, false, false };

/// <summary>
/// 硬件设备异常
/// PLC -> M235.0
/// True:设备正常,False:设备异常
/// </summary>
[VariableMonitor("硬件设备异常", "M235.0", "")]
public bool Error { get; set; } = false;

/// <summary>
/// 配方编号
/// PLC -> VW0
/// ModbusTcp -> 100
/// </summary>
[VariableMonitor("配方编号", "VW0", "100")]
public ushort RecipeNumber { get; set; }

/// <summary>
/// 转台设置位置
/// PLC -> VW2
/// ModbusTcp -> 101
/// </summary>
[VariableMonitor("转台设置位置", "VW2", "101")]
public ushort TurntableLoc { get; set; }

/// <summary>
/// 到面至煮面炉位置
/// PLC -> VW4
/// ModbusTcp -> 102
/// </summary>
[VariableMonitor("到面至煮面炉位置", "VW4", "102")]
public ushort FallNoodleLoc { get; set; }

/// <summary>
/// 取面位置
/// PLC -> VW6
/// ModbusTcp -> 103
/// </summary>
[VariableMonitor("取面位置", "VW6", "103")]
public ushort TakeNoodleLoc { get; set; }

/// <summary>
/// 转台反馈位置
/// PLC -> VW372
/// ModbusTcp -> 286
/// </summary>
[VariableMonitor("转台反馈位置", "VW372", "286")]
public ushort TurntableFeedbackloc { get; set; }

/// <summary>
/// 机器人取面位置队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> RBTakeNoodleTask { get; set; } = new ConcurrentQueue<OrderLocInfo>();

/// <summary>
/// 出碗队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> TakeBowlTask { get; set; } = new ConcurrentQueue<OrderLocInfo>();

/// <summary>
/// 是否有面条
/// </summary>
public bool IsNoodles { get; set; } = true;

public Dictionary<int, OrderLocInfo> ListOrder { get; set; } = new Dictionary<int, OrderLocInfo>(); //存放当前订单已做好素菜

public Dictionary<int, OrderLocInfo> ListOrderMeat { get; set; } = new Dictionary<int, OrderLocInfo>(); //存放当前订单已做好荤菜

public int DishNumber { set; get; } = 0; //当前订单中配菜的数量

#region 订单ID记录
/// <summary>
/// 取碗订单ID
/// </summary>
public string TakeBowlId = string.Empty;

/// <summary>
/// 配料完成订单ID
/// </summary>
public string IngredientsCompleteId = string.Empty;

/// <summary>
/// 煮面口对应的订单ID
/// </summary>
//public string[] CookNodelId = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, };
public List<CookNodleLocAndId> CookNodelId { get; set; } = new List<CookNodleLocAndId>();


//public string[] CookNodelId = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, };

public OrderLocInfo[] orderLocInfos = new OrderLocInfo[6] { null, null, null, null, null, null };
/// <summary>
/// 出餐订单ID
/// </summary>
public string OutMealId = string.Empty;


/// <summary>
/// 冒菜制作方式,true:加汤,false:不加汤
/// </summary>
public bool OutMealType { get; set; } = false;

/// <summary>
/// 转台位置轮询
/// </summary>
public List<ushort> TurntableLocLists = new List<ushort>();

/// <summary>
/// 转台当前启动位置
/// </summary>
[VariableMonitor("转台当前启动位置")]
public ushort CurrentLoc { get; set; } = 0;

public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>();



public int Num { get; set; } //记录同一个订单是否所有配菜均已出锅

public int Count { get; set; } = 0; //用于素菜的计数

public int CountMeat { get; set; } = 0;//用于荤菜计数

public int Vnum { get; set; } = 0; //单次订单素菜的总数
public int VegtabNum { get; set; } = 0;//记录一个订单中素菜的数量

public int TotalNum { get; set; } = 0; //单次订单的配菜总数

public ConcurrentQueue<Dictionary<string, OrderInformation>> Conqueue = new ConcurrentQueue<Dictionary<string, OrderInformation>>(); //记录订单的ID 以及素菜数量
public bool relock { get; set; } = false; //单次订单互锁

public bool HasVeg { get; set; } //是否有素菜判断


public bool VegNoodlesLock { get; set; } = false; //取面和取餐互锁

public int VegN { get; set; } = 0; //素菜出餐计数
#endregion
}

public class CookNodleLocAndId
{
public string CookNodelId { get; set; }

public int Loc { get; set; }
}
}

+ 18
- 0
BPASmartClient.MorkM/HardwareStatus.cs View File

@@ -0,0 +1,18 @@
using BPASmartClient.Device;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkM
{
public class HardwareStatus : IHardwareStatus
{
[HardwareStatus("输入状态", "I0.0")]
public bool Input1 { get; set; }

[HardwareStatus("输出状态", "Q0.0")]
public bool OutPut1 { get; set; }
}
}

+ 16
- 0
BPASmartClient.MorkM/Model/GeneralConfig.cs View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkM.Model
{
internal class GeneralConfig
{
/// <summary>
/// 激活本地模拟订单
/// </summary>
public static bool EnableLocalSimOrder { get; set; }
}
}

+ 16
- 0
BPASmartClient.MorkM/Model/MorksPar.cs View File

@@ -0,0 +1,16 @@
using BPASmartClient.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.MorkM.Model
{
internal class MorksPar
{
public ObservableCollection<ParSet> parSets { get; set; } = new ObservableCollection<ParSet>();
}
}

+ 29
- 0
BPASmartClient.MorkM/Model/ParSet.cs View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkM.Model
{
public class ParSet
{
public ushort Minute { get { return _mMinute; } set { _mMinute = value; } }
private ushort _mMinute;

public ushort Second { get { return _mSecond; } set { _mSecond = value; } }
private ushort _mSecond;


public bool IsShield { get { return _mIsShield; } set { _mIsShield = value; } }
private bool _mIsShield;


public string TextBlockContext { get { return _mTextBlockContext; } set { _mTextBlockContext = value; } }
private string _mTextBlockContext;

public string CheckBoxContext { get { return _mCheckBoxContext; } set { _mCheckBoxContext = value; } }
private string _mCheckBoxContext;

}
}

+ 14
- 0
BPASmartClient.MorkM/Model/WritePar.cs View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkM.Model
{
public class WritePar
{
public string Address { get; set; }
public object Value { get; set; }
}
}

+ 32
- 0
BPASmartClient.MorkM/OrderLocInfo.cs View File

@@ -0,0 +1,32 @@
using BPA.Message;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkM
{
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 bool MakeType { get; set; }
}

/// <summary>
/// 存储订单中素菜荤菜数量
/// </summary>
public class OrderInformation
{
public int VegatableNumber { get; set; }

public int DishNum { get; set; }


// public GoodsMakeType MakeType { get; set; }
}
}

+ 154
- 0
BPASmartClient.MorkM/View/DebugView.xaml View File

@@ -0,0 +1,154 @@
<UserControl x:Class="BPASmartClient.MorkM.View.DebugView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Name="调试界面"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="400" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Grid Grid.Column="0">
<!--<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="40" />
</Grid.RowDefinitions>-->

<StackPanel Orientation="Vertical">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding simOrderConfig}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Foreground="#00c2f4"
Text="{Binding Text}" />

<TextBox
Grid.Column="1"
Margin="10,0"
IsEnabled="{Binding IsEnable}"
Text="{Binding Loc}" />

<CheckBox
Grid.Column="2"
Height="20"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="启用随机数"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding IsSelected}"
/>

<Button
Grid.Column="3"
Margin="10,0,0,0"
Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding Text}"
Content="编辑"
FontSize="14"
/>

<Button
Grid.Column="4"
Margin="5,0,0,0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding Text}"
Content="删除"
FontSize="14"
/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>

<UniformGrid Grid.Row="1" Columns="2">
<Button
Margin="10,10,10,0"
Grid.Column="1"
Command="{Binding SimOrderCommand}"
Content="模拟订单" Cursor="Hand"
/>
<Button
Margin="10,10,10,0"
Command="{Binding AddSimDataCommand}"
Content="新增模拟数据"
/>
</UniformGrid>
</StackPanel>
</Grid>

<Grid Grid.Column="1" Margin="20,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel Orientation="Horizontal">

<!--#region 控制按钮-->
<Button
Margin="10,10,10,0"
Command="{Binding InitCommand}"
Content="初始化" Cursor="Hand"
/>

<Button
Margin="10,10,10,0"
Command="{Binding InitCommand}"
Content="停止"
/>

<Button
x:Name="button_loop"
Margin="10,10,10,0"
Command="{Binding LoopSimOrderCommand}"
Content="{Binding LoopOrderButtonContent}"
/>
<!--#endregion-->

</StackPanel>

<CheckBox
Grid.Row="2"
Height="20"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="启用本地模拟程序"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding EnableLocalSimOrder}"
/>
</Grid>

</Grid>

</UserControl>

+ 30
- 0
BPASmartClient.MorkM/View/DebugView.xaml.cs View File

@@ -0,0 +1,30 @@
using BPASmartClient.MorkM.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkM.View
{
/// <summary>
/// DebugView.xaml 的交互逻辑
/// </summary>
public partial class DebugView : UserControl
{
public DebugView()
{
InitializeComponent();
this.DataContext = new DebugViewModel();
}
}
}

+ 242
- 0
BPASmartClient.MorkM/View/Monitor.xaml View File

@@ -0,0 +1,242 @@
<UserControl
x:Class="BPASmartClient.MorkM.View.Monitor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkM.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.MorkM.ViewModel"
Name="监控画面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:MonitorViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 表格标题栏设置-->
<Grid Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="ID" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="变量名" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="PLC 地址" />


<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="注释" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,0,0"
Cursor="SizeWE" />
</Grid>



<Grid Grid.Column="4">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="Modbus TCP 地址" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="当前值" />

</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding variableMonitors}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding Id}" />

<Grid Grid.Column="1">
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding VarName}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>


<TextBlock
Grid.Column="2"
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding PLCAddress}" />

<Grid Grid.Column="3">
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding Notes}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,0,0" />
</Grid>

<Grid Grid.Column="4">
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding ModbusTcpAddress}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="5"
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding CurrentValue}" />

<Border
Grid.ColumnSpan="8"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<!--#endregion-->


</Grid>

</UserControl>

+ 28
- 0
BPASmartClient.MorkM/View/Monitor.xaml.cs View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkM.View
{
/// <summary>
/// Monitor.xaml 的交互逻辑
/// </summary>
public partial class Monitor : UserControl
{
public Monitor()
{
InitializeComponent();
}
}
}

+ 130
- 0
BPASmartClient.MorkM/View/ParSet.xaml View File

@@ -0,0 +1,130 @@
<UserControl
x:Class="BPASmartClient.MorkM.View.ParSet"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkM.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.MorkM.ViewModel"
Name="参数设置界面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:ParSetViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">

<TextBlock Style="{StaticResource TextBlockStyle}" Text="请点击按钮保存参数:" />

<pry:IcoButton
Grid.Column="5"
Width="140"
HorizontalAlignment="Left"
Command="{Binding SaveInfoCommand}"
Content="保存配置"
FontSize="16"
IcoText="&#xe936;"
Style="{StaticResource NewButtonStyle}">
<pry:IcoButton.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</pry:IcoButton.Foreground>
</pry:IcoButton>


</StackPanel>

<!-- 参数放置面板 -->
<Grid Grid.Row="2">
<ItemsControl ItemsSource="{Binding parSets}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle}" Text="{Binding TextBlockContext}" />
<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Minute}" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="(分)" />
<TextBox
Width="100"
Margin="0,10"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Second}" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="(秒)" />

<CheckBox
Height="20"
Margin="10"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="{Binding CheckBoxContext}"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding IsShield}"
Template="{StaticResource CbTemplate}" />

</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

</Grid>

</Grid>


</UserControl>

+ 28
- 0
BPASmartClient.MorkM/View/ParSet.xaml.cs View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkM.View
{
/// <summary>
/// ParSet.xaml 的交互逻辑
/// </summary>
public partial class ParSet : UserControl
{
public ParSet()
{
InitializeComponent();
}
}
}

+ 206
- 0
BPASmartClient.MorkM/View/SimOrderConfitView.xaml View File

@@ -0,0 +1,206 @@
<Window x:Class="BPASmartClient.MorkM.View.SimOrderConfitView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BPASmartClient.MorkM.View"
mc:Ignorable="d"
Title="SimOrderConfitView" Height="450" Width="800"
WindowStyle="None"
WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<Style x:Key="buttonStyle" TargetType="Button">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="Width" Value="100" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="Aqua" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="gr">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
<Polygon
x:Name="poly"
Points="0 0,80 0,100 30,20 30"
Stroke="#FF34F7F7"
StrokeThickness="2" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="poly" Property="Fill" Value="#2234F7F7" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>

<Grid Background="#103153">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="79*"/>
<ColumnDefinition Width="321*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 标题栏设置-->
<Border
x:Name="MoveBorder"
Height="35"
VerticalAlignment="Center"
Background="#0C2349"
BorderBrush="#55ffffff"
BorderThickness="0,0,0,1" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal">
<Image Margin="15,5,0,5" Source="/BPASmartClient.CustomResource;component/Image/hbl.ico" />
<TextBlock
Name="tbTitle"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="18"
Foreground="White"
Text="模拟设备参数配置" />
</StackPanel>
</Border>

<UniformGrid
Width="150"
Height="30"
HorizontalAlignment="Left"
Columns="3" Grid.Column="1" Margin="492,2,0,3">
<Button
Name="ButMin"
Content="&#xe664;"
Style="{StaticResource TitleBarStyle}"
Visibility="Hidden" />
<Button
Name="ButMax"
Content="&#xe65d;"
Style="{StaticResource TitleBarStyle}"
Visibility="Hidden" />
<Button
Name="ButClose"
Content="&#xe639;"
FontSize="30"
Style="{StaticResource TitleBarStyle}" />
</UniformGrid>
<!--#endregion-->

<!--#region 内容显示区-->
<Grid KeyDown="Grid_KeyDown" Grid.Row="1" Margin="10,10,10,10" Grid.ColumnSpan="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="260"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontFamily="楷体"
FontSize="18"
Foreground="#FF34F7F7"
Text="请输入模拟数据名称:" />
<TextBox
Grid.Column="1"
Margin="0,10"
Width="400"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
TabIndex="0"
Text="{Binding Name}" />

<TextBlock
Grid.Row="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontFamily="楷体"
FontSize="20"
Foreground="#FF34F7F7"
Text="模拟位置最小值:" />
<TextBox
Grid.Row="1"
Grid.Column="1"
Margin="0,10"
Width="400"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
TabIndex="1"
Text="{Binding Min}" />

<TextBlock
Grid.Row="2"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontFamily="楷体"
FontSize="20"
Foreground="#FF34F7F7"
Text="模拟位置最大值:" />
<TextBox
Grid.Row="2"
Grid.Column="1"
Margin="0,10"
Width="400"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
TabIndex="2"
Text="{Binding Max}" />


<Button
Grid.Row="3"
Margin="20,10"
Command="{Binding CancelCommand}"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Content="取消"
Style="{StaticResource buttonStyle}" />
<Button
Grid.Row="3"
Grid.Column="1"
Margin="20,10,120,10"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Command="{Binding ConfirmCommand}"
Content="确认"
Style="{StaticResource buttonStyle}" />

</Grid>
<!--#endregion-->

</Grid>
</Window>

+ 56
- 0
BPASmartClient.MorkM/View/SimOrderConfitView.xaml.cs View File

@@ -0,0 +1,56 @@
using BPASmartClient.Helper;
using BPASmartClient.MorkM.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace BPASmartClient.MorkM.View
{
/// <summary>
/// SimOrderConfitView.xaml 的交互逻辑
/// </summary>
public partial class SimOrderConfitView : Window
{
public SimOrderConfitView()
{
InitializeComponent();
this.DataContext = new SimOrderConfitViewModel();
this.MoveBorder.MouseLeftButtonDown += (o, e) => { this.DragMove(); };
this.ButMin.Click += (o, e) => { this.WindowState = WindowState.Minimized; };
this.ButMax.Click += (o, e) => { this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; };
this.ButClose.Click += (o, e) => { this.Close(); ActionManage.GetInstance.CancelRegister("SendSimData"); };
this.MaxWidth = SystemParameters.WorkArea.Width;
this.MaxHeight = SystemParameters.WorkArea.Height;

ActionManage.GetInstance.Register(new Action(() =>
{
this.Close();
ActionManage.GetInstance.CancelRegister("SimOrderConfitViewModelExit");
ActionManage.GetInstance.CancelRegister("SendSimData");
}), "SimOrderConfitViewModelExit");
}

private void Grid_KeyDown(object sender, KeyEventArgs e)
{
var uie = e.OriginalSource as TextBox;
if (uie != null)
{
if (e.Key == Key.Enter)
{
uie.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
e.Handled = true;
}
}
}
}
}

+ 135
- 0
BPASmartClient.MorkM/ViewModel/DebugViewModel.cs View File

@@ -0,0 +1,135 @@
using BPASmartClient.Helper;
using BPASmartClient.Model;
using BPASmartClient.MorkM.Model;
using BPASmartClient.MorkM.View;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkM.ViewModel
{
internal class DebugViewModel : ObservableObject
{
public DebugViewModel()
{


AddSimDataCommand = new RelayCommand(() =>
{
SimOrderConfitView simOrderConfitView = new SimOrderConfitView();
simOrderConfitView.Show();
});

SimOrderCommand = new RelayCommand(() =>
{
List<ushort> locs = new List<ushort>();
foreach (var item in simOrderConfig)
{
if (item.IsSelected)
locs.Add((ushort)(new Random().Next(item.MinValue, item.MaxValue + 1)));
else
locs.Add(item.Loc);
}
if (locs.Count == 0)
{
locs.Add((ushort)(new Random().Next(1, 5)));
locs.Add(10);
}

ActionManage.GetInstance.Send("SimOrder", locs);
//下发模拟订单
Trace.WriteLine("下发模拟订单。。。");
});

InitCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("InitDevice");
//初始化按钮
Trace.WriteLine("已点击初始化按钮。。。");
});

LoopSimOrderCommand = new RelayCommand(() =>
{
if (LoopOrderButtonContent == "循环跑单") ActionManage.GetInstance.Send("EnableForOrder");
if (LoopOrderButtonContent == "停止跑单") ActionManage.GetInstance.Send("StopForOrder");
LoopOrderButtonContent = LoopOrderButtonContent == "循环跑单" ? "停止跑单" : "循环跑单";

});


EditCommand = new RelayCommand<object>((o) =>
{
if (o != null)
{
var res = Json<KeepDataBase>.Data.simOrderConfig.FirstOrDefault(p => p.Text == o.ToString());
if (res != null)
{
SimOrderConfitView simOrderConfitView = new SimOrderConfitView();
simOrderConfitView.Show();
ActionManage.GetInstance.Send("SendSimData", res);
}
}

});

RemoveCommand = new RelayCommand<object>((o) =>
{
if (o != null)
{
var res = Json<KeepDataBase>.Data.simOrderConfig.FirstOrDefault(p => p.Text == o.ToString());
if (res != null) Json<KeepDataBase>.Data.simOrderConfig.Remove(res);
}
});
}

public static bool EnableLocalSimOrder { get { return GeneralConfig.EnableLocalSimOrder; } set { GeneralConfig.EnableLocalSimOrder = value; OnStaticPropertyChanged(); } }

public ObservableCollection<SimOrderVisibleData> simOrderConfig
{
get
{
return Json<KeepDataBase>.Data.simOrderConfig;
}
set
{
Json<KeepDataBase>.Data.simOrderConfig = value;
}
}

public RelayCommand AddSimDataCommand { get; set; }

public RelayCommand SimOrderCommand { get; set; }

public RelayCommand InitCommand { get; set; }

public RelayCommand LoopSimOrderCommand { get; set; }

public RelayCommand<object> EditCommand { get; set; }

public RelayCommand<object> RemoveCommand { get; set; }


public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
{
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName));
}

public static string LoopOrderButtonContent { get { return _mLoopOrderButtonContent; } set { _mLoopOrderButtonContent = value; OnStaticPropertyChanged(); } }
private static string _mLoopOrderButtonContent = "循环跑单";





}
}


+ 24
- 0
BPASmartClient.MorkM/ViewModel/MonitorViewModel.cs View File

@@ -0,0 +1,24 @@
using BPASmartClient.Business;
using BPASmartClient.Device;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkM.ViewModel
{
internal class MonitorViewModel : ObservableObject
{
public MonitorViewModel()
{

}

public static int DeviceId { get; set; }

public ObservableCollection<VariableMonitor> variableMonitors { get; set; } = Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;
}
}

+ 42
- 0
BPASmartClient.MorkM/ViewModel/ParSetViewModel.cs View File

@@ -0,0 +1,42 @@
using BPASmartClient.Helper;
using BPASmartClient.MorkM.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkM.ViewModel
{
internal class ParSetViewModel: ObservableObject
{
public ParSetViewModel()
{
SaveInfoCommand = new Action(() =>
{
List<ushort> values = new List<ushort>();
values.Clear();

List<bool> bools = new List<bool>();
bools.Clear();

for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++)
{
values.Clear();
values.Add(Json<MorksPar>.Data.parSets[i].Minute);
values.Add(Json<MorksPar>.Data.parSets[i].Second);
bools.Add(Json<MorksPar>.Data.parSets[i].IsShield);
ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = $"VW{116 + (i * 6)}", Value = values.ToArray() });
}
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M260.0", Value = bools.ToArray() });
Json<MorksPar>.Save();
});
}

public Action SaveInfoCommand { get; set; }

public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets;
}
}

+ 90
- 0
BPASmartClient.MorkM/ViewModel/SimOrderConfitViewModel.cs View File

@@ -0,0 +1,90 @@
using BPASmartClient.Helper;
using BPASmartClient.Model;
using BPASmartClient.MorkM.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkM.ViewModel
{
internal class SimOrderConfitViewModel: ObservableObject
{
bool IsEdit = false;
SimOrderVisibleData simOrderVisibleData;
string DeviceType = string.Empty;
public SimOrderConfitViewModel()
{
// DeviceType = GeneralConfig.StartDevice;
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null)
{
if (o is SimOrderVisibleData sim)
{
Name = sim.Text;
Max = sim.MaxValue;
Min = sim.MinValue;
IsEdit = true;
simOrderVisibleData = sim;
}
}
}), "SendSimData");

ConfirmCommand = new RelayCommand(() =>
{
//if (!Json<KeepDataBase>.Data.simOrderConfig.ContainsKey(DeviceType))
//{
// Json<KeepDataBase>.Data.simOrderConfig.TryAdd(DeviceType, new ObservableCollection<SimOrderVisibleData>());
//}

if (!IsEdit)
{
Json<KeepDataBase>.Data.simOrderConfig.Add(new SimOrderVisibleData()
{
IsEnable = true,
IsSelected = true,
Text = Name,
Loc = Min,
MaxValue = Max,
MinValue = Min,
});
}
else
{
int index = Array.FindIndex(Json<KeepDataBase>.Data.simOrderConfig.ToArray(), p => p.Text == simOrderVisibleData.Text);
if (index >= 0 && index < Json<KeepDataBase>.Data.simOrderConfig.Count())
{
Json<KeepDataBase>.Data.simOrderConfig.ElementAt(index).Text = Name;
Json<KeepDataBase>.Data.simOrderConfig.ElementAt(index).MinValue = Min;
Json<KeepDataBase>.Data.simOrderConfig.ElementAt(index).MaxValue = Max;
Json<KeepDataBase>.Data.simOrderConfig.ElementAt(index).IsEnable = simOrderVisibleData.IsEnable;
Json<KeepDataBase>.Data.simOrderConfig.ElementAt(index).IsSelected = simOrderVisibleData.IsSelected;
}
}
ActionManage.GetInstance.Send("SimOrderConfitViewModelExit");
});
CancelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("SimOrderConfitViewModelExit"); });
}


public RelayCommand ConfirmCommand { get; set; }

public RelayCommand CancelCommand { get; set; }

public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged();; } }
private string _mName;

public ushort Min { get { return _mMin; } set { _mMin = value; OnPropertyChanged(); } }
private ushort _mMin;

public ushort Max { get { return _mMax; } set { _mMax = value; OnPropertyChanged(); } }
private ushort _mMax;


}
}


+ 41
- 38
BPASmartClient.MorkS/Control_Morks.cs View File

@@ -17,6 +17,7 @@ using System.Reflection;
using BPASmartClient.MorkS.Model;
using System.Collections.ObjectModel;
using BPASmartClient.MorkS.ViewModel;
using BPASmartClient.Business;

namespace BPASmartClient.MorkS
{
@@ -279,7 +280,6 @@ namespace BPASmartClient.MorkS
});
}


public override void MainTask()
{
mORKS.AllowRun = mORKS.InitComplete;
@@ -288,8 +288,6 @@ namespace BPASmartClient.MorkS
else
IsHealth = true;

//if (mORKS.AllowRun)
//{
TakeBowlTask();

TakeNoodleTask();
@@ -299,7 +297,15 @@ namespace BPASmartClient.MorkS
SingleDetect();

TurntableControl();
//}

var data = new List<bool>();
for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++)
{
data.Add(Json<MorksPar>.Data.parSets.ElementAt(i).IsShield);
}

WriteControl("M260.0", data.ToArray());

}

private void BowlControl(OrderLocInfo orderLocInfo)
@@ -322,8 +328,6 @@ namespace BPASmartClient.MorkS
{
if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.TakeBowlIdle && !mORKS.TakeBowlInterlock)
{
//if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo))
//{
ushort BowLoc = 0;
var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList();
if (res == null || res?.Count == 0)
@@ -355,27 +359,6 @@ namespace BPASmartClient.MorkS
BowlControl(orderLocInfo);
}
}

//if (BowLoc >= 10 && BowLoc <= 11)
//{
// mORKS.TakeBowlInterlock = true;
// mORKS.TakeBowlId = orderLocInfo.SuborderId;
// TakeBowlControl(BowLoc);
// SetRecipeNumber(orderLocInfo.RecipeNumber);
// OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
// DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
//}


//之前版本
//mORKS.TakeBowlId = orderLocInfo.SuborderId;
//TakeBowlControl(orderLocInfo.Loc);
//SetRecipeNumber(orderLocInfo.RecipeNumber);
//OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
//DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
//mORKS.TakeBowlInterlock = true;
//}

}
}

@@ -424,6 +407,11 @@ namespace BPASmartClient.MorkS
{
if (mORKS.TurntableFeedbackloc != loc && !mORKS.TurntableLocLists.Contains(loc))
{
if (!mORKS.TurntableLowerLimit)
{
WriteData("M32.7", false);
DeviceProcessLogShow($"执行了转台启动互锁信号复位");
}
TurntableStart(loc);
DeviceProcessLogShow($"没有物料检测的启动转台控制,转台位置:[{loc}]");
break;
@@ -438,6 +426,15 @@ namespace BPASmartClient.MorkS
}
}

//if (DelayRTrig.GetInstance("互锁信号复位").Start(!mORKS.TurntableLowerLimit && mORKS.TurntableMoveInPlace, 2))
//{
// if (!mORKS.TurntableLowerLimit)
// {
// WriteData("M32.7", false);
// DeviceProcessLogShow($"执行了转台启动互锁信号复位");
// }
//}

//补料中检测
if (RTrig.GetInstance("mORKS.Feeding").Start(mORKS.Feeding))
{
@@ -493,7 +490,6 @@ namespace BPASmartClient.MorkS
mORKS.TakeNoodleInterlock = true;
}
}

}
}

@@ -513,6 +509,17 @@ namespace BPASmartClient.MorkS
RobotOutMeal();
CookNoodleStatusReset((ushort)(loc + 1));
ResetAllowFallNoodle();


//新增,待测试
//if (mORKS.RbOutMealComplete)
//{
// ResetCookComplete();
// mORKS.CookCompleteFlatBit = false;
// DeviceProcessLogShow("取餐过程中复位出餐完成信号");
//}


mORKS.OutMealId = mORKS.IngredientsCompleteId;
mORKS.IngredientsCompleteId = string.Empty;
mORKS.CookNodelId[loc] = string.Empty;
@@ -547,15 +554,7 @@ namespace BPASmartClient.MorkS
}

//取餐完成逻辑处理
//if (DelayRTrig.GetInstance("CompleteChange1").Start(mORKS.RbOutMealComplete && !mORKS.TakeMealDetect, 2))
//{
// OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
// DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
// ResetCookComplete();
// mORKS.OutMealId = string.Empty;
//}

if (DelayRTrig.GetInstance("CompleteChange1").Start(mORKS.CookCompleteFlatBit && !mORKS.TakeMealDetect, 2))
if (Delay.GetInstance("CompleteChange1").Start(mORKS.CookCompleteFlatBit && !mORKS.TakeMealDetect, 1))
{
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
@@ -576,7 +575,11 @@ namespace BPASmartClient.MorkS

int OutMealRequstCount = mORKS.CookNoodlesComplete.Where(p => p == true).ToList().Count;
int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count;
mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowFallNoodle && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0);

mORKS.PriorityJudgment = Delay.GetInstance("取餐优先级判断").Start(mORKS.TurntableLocLists.Count > 0 && !mORKS.TurntableLowerLimit, 4);
mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowFallNoodle && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment);


}




+ 7
- 2
BPASmartClient.MorkS/GVL_MORKS.cs View File

@@ -42,7 +42,13 @@ namespace BPASmartClient.MorkS
public bool AllowRun { get; set; }

/// <summary>
/// //机器人任务互锁信号
/// 优先级判断
/// </summary>
[VariableMonitor("优先级判断条件")]
public bool PriorityJudgment { get; set; }

/// <summary>
/// 机器人任务互锁信号,false:取面,true:出餐
/// </summary>
//[Circuit(new string[] { "机器人取面", "出面控制" }, "机器人互锁", new bool[] { true, false })]
[VariableMonitor("机器人任务互锁信号")]
@@ -83,7 +89,6 @@ namespace BPASmartClient.MorkS
public bool TurntableInterlock { get; set; }
#endregion


/// <summary>
/// 初始化完成
/// PLC -> M100.0


+ 9
- 0
BPASmartClient.MorkT.Lebai.JC/BPASmartClient.MorkTLebaiJC.csproj View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

</Project>

+ 8
- 0
BPASmartClient.MorkT.Lebai.JC/Class1.cs View File

@@ -0,0 +1,8 @@
using System;

namespace BPASmartClient.MorkTLebaiJC
{
public class Class1
{
}
}

+ 9
- 0
BPASmartClient.Morkt.JAKA.JC/BPASmartClient.MorkTJAKAJC.csproj View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

</Project>

+ 8
- 0
BPASmartClient.Morkt.JAKA.JC/Class1.cs View File

@@ -0,0 +1,8 @@
using System;

namespace BPASmartClient.MorktJAKAJC
{
public class Class1
{
}
}

+ 3
- 1
BPASmartClient.Peripheral/BasePeripheral.cs View File

@@ -47,16 +47,18 @@ namespace BPASmartClient.Peripheral
return null;
}


public abstract void Start();

public abstract void Stop();

public abstract void Init();

public abstract void WriteData(string address, object value);

public ConcurrentDictionary<string, object> GetAllStatus()
{
return status;
}

}
}

+ 2
- 0
BPASmartClient.Peripheral/IPeripheral.cs View File

@@ -53,6 +53,8 @@ namespace BPASmartClient.Peripheral
/// </summary>
ConcurrentDictionary<string, object> status { get; set; }

void WriteData(string address, object value);

/// <summary>
/// 初始化
/// </summary>


+ 80
- 76
BPASmartClient.SCChip/ICChipMachine.cs View File

@@ -14,7 +14,7 @@ using static BPASmartClient.EventBus.EventBus;

namespace BPASmartClient.SCChip
{
public class ICChipMachine :BasePeripheral
public class ICChipMachine : BasePeripheral
{
//通讯代理
SerialPortClient commProxy = null;
@@ -117,7 +117,7 @@ namespace BPASmartClient.SCChip
ThreadManage.GetInstance().StartLong(new Action(() =>
{
ResolveMsg();
}),"单片机解析线程");
}), "单片机解析线程");
}

private void ResolveMsg()
@@ -157,8 +157,8 @@ namespace BPASmartClient.SCChip
IntPtr allocIntPtr = Marshal.AllocHGlobal(size);
try
{
Marshal.Copy(dataBuffer,0,allocIntPtr,size);
structure = (ICChipPackage)Marshal.PtrToStructure(allocIntPtr,typeof(ICChipPackage));
Marshal.Copy(dataBuffer, 0, allocIntPtr, size);
structure = (ICChipPackage)Marshal.PtrToStructure(allocIntPtr, typeof(ICChipPackage));
}
finally
{
@@ -178,8 +178,8 @@ namespace BPASmartClient.SCChip
IntPtr bufferIntPtr = Marshal.AllocHGlobal(size);
try
{
Marshal.StructureToPtr(structure,bufferIntPtr,true);
Marshal.Copy(bufferIntPtr,buffer,0,size);
Marshal.StructureToPtr(structure, bufferIntPtr, true);
Marshal.Copy(bufferIntPtr, buffer, 0, size);
}
finally
{
@@ -238,8 +238,8 @@ namespace BPASmartClient.SCChip
}
break;
}
if(!OnLine) IsWork = false;
else IsWork = true;
if (!OnLine) IsWork = false;
else IsWork = true;
}
catch (Exception ex)
{
@@ -261,52 +261,52 @@ namespace BPASmartClient.SCChip

public override void Init()
{
commProxy = new SerialPortClient(communicationPar.SerialPort,(BaudRates)communicationPar.BaudRate);
commProxy = new SerialPortClient(communicationPar.SerialPort, (BaudRates)communicationPar.BaudRate);
commProxy.SetDataStorage(dataStorage);

//STM32F103RCT6单片机下杯
EventBus.EventBus.GetInstance().Subscribe<SCChip_TakeCupEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
switch ((@event as SCChip_TakeCupEvent).Cup)
{
case IC_CUP.CUP_ICECREAM:
status["CompletedTake_CPU_CUP_ICECREAM"] = false;
break;
case IC_CUP.CUP_COFFEE:
status["CompletedTake_CPU_CUP_COFFEE"] = false;
break;
}
package.Cmd = IC_CMD.TAKE_CUP;
package.Value = (byte)(@event as SCChip_TakeCupEvent).Cup;
commProxy.SendData(StructureToByte(package));
EventBus.EventBus.GetInstance().Subscribe<SCChip_TakeCupEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
switch ((@event as SCChip_TakeCupEvent).Cup)
{
case IC_CUP.CUP_ICECREAM:
status["CompletedTake_CPU_CUP_ICECREAM"] = false;
break;
case IC_CUP.CUP_COFFEE:
status["CompletedTake_CPU_CUP_COFFEE"] = false;
break;
}
package.Cmd = IC_CMD.TAKE_CUP;
package.Value = (byte)(@event as SCChip_TakeCupEvent).Cup;
commProxy.SendData(StructureToByte(package));

bool wait = true;
var waitTimeout = DateTime.Now.AddSeconds(3);
while (wait)
{
wait = DateTime.Now < waitTimeout;
if (wait)
{
switch ((@event as SCChip_TakeCupEvent).Cup)
{
case IC_CUP.CUP_ICECREAM:
wait = !(bool)status["CompletedTake_CPU_CUP_ICECREAM"];
break;
case IC_CUP.CUP_COFFEE:
wait = !(bool)status["CompletedTake_CPU_CUP_COFFEE"];
break;
}
}
Thread.Sleep(10);
}
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.SCChip 中引发错误,ICChipMachine 类,描述:[{ex.Message}]");
}
});
bool wait = true;
var waitTimeout = DateTime.Now.AddSeconds(3);
while (wait)
{
wait = DateTime.Now < waitTimeout;
if (wait)
{
switch ((@event as SCChip_TakeCupEvent).Cup)
{
case IC_CUP.CUP_ICECREAM:
wait = !(bool)status["CompletedTake_CPU_CUP_ICECREAM"];
break;
case IC_CUP.CUP_COFFEE:
wait = !(bool)status["CompletedTake_CPU_CUP_COFFEE"];
break;
}
}
Thread.Sleep(10);
}
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.SCChip 中引发错误,ICChipMachine 类,描述:[{ex.Message}]");
}
});

//STM32F103RCT6单片机舵机打料
EventBus.EventBus.GetInstance().Subscribe<SCChip_MakeIceCreamEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
@@ -398,38 +398,42 @@ namespace BPASmartClient.SCChip
});

//STM32F103RCT6单片机舵机打开或者关闭
EventBus.EventBus.GetInstance().Subscribe<SCChip_SESwitchCreamEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
package.Cmd = (@event as SCChip_SESwitchCreamEvent).IsOpen ? IC_CMD.OPEN_SE : IC_CMD.CLOSE_SE;
package.Value = (byte)(@event as SCChip_SESwitchCreamEvent).SteeringEngine;
commProxy.SendData(StructureToByte(package));
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.SCChip 中引发错误,ICChipMachine 类,描述:[{ex.Message}]");
}
});
EventBus.EventBus.GetInstance().Subscribe<SCChip_SESwitchCreamEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
package.Cmd = (@event as SCChip_SESwitchCreamEvent).IsOpen ? IC_CMD.OPEN_SE : IC_CMD.CLOSE_SE;
package.Value = (byte)(@event as SCChip_SESwitchCreamEvent).SteeringEngine;
commProxy.SendData(StructureToByte(package));
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.SCChip 中引发错误,ICChipMachine 类,描述:[{ex.Message}]");
}
});

//STM32F103RCT6单片机控制冰淇淋机器转
EventBus.EventBus.GetInstance().Subscribe<SCChip_RotorSwitchEvent>(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
{
try
{
package.Cmd = IC_CMD.ROTOR;
package.Value = (@event as SCChip_RotorSwitchEvent).TurnOn ? (byte)IC_ROTOR.OPEN_ROTOR : (byte)IC_ROTOR.CLOSE_ROTOR;
commProxy.SendData(StructureToByte(package));
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.SCChip 中引发错误,ICChipMachine 类,描述:[{ex.Message}]");
}
});
EventBus.EventBus.GetInstance().Subscribe<SCChip_RotorSwitchEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
package.Cmd = IC_CMD.ROTOR;
package.Value = (@event as SCChip_RotorSwitchEvent).TurnOn ? (byte)IC_ROTOR.OPEN_ROTOR : (byte)IC_ROTOR.CLOSE_ROTOR;
commProxy.SendData(StructureToByte(package));
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.SCChip 中引发错误,ICChipMachine 类,描述:[{ex.Message}]");
}
});
InitStatus();
//测试
Start();
}

public override void WriteData(string address, object value)
{
}
}

}

+ 4
- 2
BPASmartClient.ViewModel/MainViewModel.cs View File

@@ -71,15 +71,17 @@ namespace BPASmartClient.ViewModel
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
{
NetworkConnectState = UniversalHelper.GetInstance().GetNetworkState();
CurrentOrderCount = Json<KeepDataBase>.Data.orderLists.Count;
}));
};
dispatcherTimer.Interval = TimeSpan.FromSeconds(1);
dispatcherTimer.Start();


}

public int CurrentOrderCount { get { return Json<KeepDataBase>.Data.orderLists.Count; } set { OnPropertyChanged(); } }

public int CurrentOrderCount { get { return _mCurrentOrderCount; } set { _mCurrentOrderCount = value; OnPropertyChanged(); } }
private int _mCurrentOrderCount;

public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } }



+ 1
- 55
BPASmartClient.ViewModel/OrderStatusViewModel.cs View File

@@ -96,60 +96,6 @@ namespace BPASmartClient.ViewModel
}), "AddOrder");

EventBus.EventBus.GetInstance().Subscribe<OrderStatusChangedEvent>(0, OrderStatusChangedHandle);

//ActionManage.GetInstance.Register(new Action<object>((o) =>
//{
// if (o is OrderStatusChangedEvent orderStatusChange)
// {
// int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
// switch (orderStatusChange.Status)
// {
// case ORDER_STATUS.COOKING:
// if (index >= 0 && index < orderStatusLists.Count)
// orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
// break;
// case ORDER_STATUS.COMPLETED_COOK:
// if (index >= 0 && index < orderStatusLists.Count)
// {
// Application.Current.Dispatcher.BeginInvoke((Action)delegate
// {
// orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
// orderStatusLists.ElementAt(index).EndDate = DateTime.Now.ToString("HH:mm:ss");
// TimeSpan timeSpan = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDate));
// orderStatusLists.ElementAt(index).CompleteDate = $"{timeSpan.TotalSeconds.ToString("0.00")} S";

// //压力测试时注释,正常使用需要取消注释
// if (!BPASmartClient.Business.InternetInfo.IsEnableTest)
// {
// WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index));
// orderStatusLists.RemoveAt(index);
// }

// });
// }

// break;
// case ORDER_STATUS.COMPLETED_TAKE:
// if (BPASmartClient.Business.InternetInfo.IsEnableTest)
// orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;

// //压力测试时注释,正常使用需要取消注释
// var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
// if (re != null)
// {
// Application.Current.Dispatcher.BeginInvoke((Action)delegate
// {
// WaitTakeMeal.Remove(re);
// var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null);
// if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj);
// });
// }
// break;
// default:
// break;
// }
// }
//}), "OrderStatusChange");
}

private static void OrderStatusChangedHandle(IEvent @event, EventBus.EventBus.EventCallBackHandle callBack)
@@ -184,7 +130,7 @@ namespace BPASmartClient.ViewModel

break;
case ORDER_STATUS.COMPLETED_TAKE:
if (BPASmartClient.Business.InternetInfo.IsEnableTest)
if (BPASmartClient.Business.InternetInfo.IsEnableTest && index >= 0 && index < orderStatusLists.Count)
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;

//压力测试时注释,正常使用需要取消注释


+ 4
- 4
BPASmartClient/App.config View File

@@ -7,14 +7,14 @@
<add key="IsEnableTest" value="false"/>

<!--开发环境-->
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/>
<add key="apollouri" value="http://10.2.1.21:28080/"/>
<add key="AppId" value="dev1_common"/>
<add key ="Namespaces" value="DEV.Config"/>-->
<add key ="Namespaces" value="DEV.Config"/>

<!--正式环境-->
<add key="apollouri" value="http://47.108.65.220:28080/"/>
<!--<add key="apollouri" value="http://47.108.65.220:28080/"/>
<add key="AppId" value="order"/>
<add key ="Namespaces" value="TEST1.Config"/>
<add key ="Namespaces" value="TEST1.Config"/>-->

<!--阿里云上报启动方式:API 或者 LOCAL-->
<!--API :通过客户端ID,调用接口查询“设备连接信息”-->


+ 1
- 0
BPASmartClient/BPASmartClient.csproj View File

@@ -31,6 +31,7 @@
<ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkD\BPASmartClient.MorkD.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkF\BPASmartClient.MorkF.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkM\BPASmartClient.MorkM.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkS\BPASmartClient.MorkS.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT\BPASmartClient.MorkT.csproj" />
<ProjectReference Include="..\BPASmartClient.SCChip\BPASmartClient.SCChip.csproj" />


+ 14
- 0
BPASmartClient/Control/DataVView.xaml View File

@@ -33,12 +33,19 @@
<TextBox x:Name="chen" Margin="10,0,0,0" Width="200" >1</TextBox>
<Button Tag="Inquire" Margin="10,0,0,0" Click="Button_Click" Style="{DynamicResource CommonBtn_返回}" Width="45">查询</Button>
</StackPanel>

<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock Width="80" HorizontalAlignment="Right" FontSize="12">客户端ID:</TextBlock>
<TextBox x:Name="clientId" Margin="10,0,0,0" Width="200" Text="{Binding device.ClientId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
</StackPanel>

<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock Width="80" HorizontalAlignment="Right" FontSize="12">设备ID:</TextBlock>
<TextBox x:Name="sbId" Margin="10,0,0,0" Width="200" Text="{Binding device.DeviceId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
</StackPanel>

<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock Width="80" FontSize="12">devicename:</TextBlock>
<TextBox x:Name="devicename" Margin="10,0,0,0" Width="200" Text="{Binding device.devicename, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
@@ -100,6 +107,13 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="设备ID" Width="2*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Center" Text="{Binding DeviceId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="云名称" Width="5*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>


+ 12
- 3
BPASmartClient/Control/DataVView.xaml.cs View File

@@ -60,7 +60,10 @@ namespace BPASmartClient.Control
{
case "Add":
istrue = DataVViewModel.GetInstance().Add();
if (istrue) NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, MainViewModel.GetInstance().window, "提示", $"增加成功!");
if (istrue) {
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, MainViewModel.GetInstance().window, "提示", $"增加成功!");
DataVClient.GetInstance().RefreshTheListOfStores();
}
else NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, MainViewModel.GetInstance().window, "提示", $"增加失败!");
break;
case "Update":
@@ -70,7 +73,10 @@ namespace BPASmartClient.Control
return;
}
istrue = DataVViewModel.GetInstance().Update();
if (istrue) NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, MainViewModel.GetInstance().window, "提示", $"修改成功!");
if (istrue) {
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, MainViewModel.GetInstance().window, "提示", $"修改成功!");
DataVClient.GetInstance().RefreshTheListOfStores();
}
else NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, MainViewModel.GetInstance().window, "提示", $"修改失败!");
break;
case "Delete":
@@ -80,7 +86,10 @@ namespace BPASmartClient.Control
return;
}
istrue = DataVViewModel.GetInstance().Delete();
if (istrue) NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, MainViewModel.GetInstance().window, "提示", $"删除成功!");
if (istrue) {
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, MainViewModel.GetInstance().window, "提示", $"删除成功!");
DataVClient.GetInstance().RefreshTheListOfStores();
}
else NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, MainViewModel.GetInstance().window, "提示", $"删除失败!");
break;
case "SetUrl":


+ 15
- 3
BPASmartClient/DeviceInfo.xml View File

@@ -73,17 +73,29 @@
</Peripherals>
</Device>-->

<Device Name="Morks" Module="BPASmartClient.MorkS.Control_Morks" DeviceId="100">
<!--<Device Name="Morks" Module="BPASmartClient.MorkS.Control_Morks" DeviceId="100">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
<IpAddress>127.0.0.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M230.0,24;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>
<!--<PLCReadAddress>M,M230.0,24</PLCReadAddress>-->
--><!--<PLCReadAddress>M,M230.0,24</PLCReadAddress>--><!--
</Parameters>
</Peripheral>
</Peripherals>
</Device>
</Device>-->-->-->
<Device Name="MorkM" Module="BPASmartClient.MorkM.Control_MorkM" DeviceId="100">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
<IpAddress>127.0.0.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M230.0,24;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>
<PLCReadAddress>M,M230.0,24</PLCReadAddress>
</Parameters>
</Peripheral>
</Peripherals>
</Device>-->-->

</BPADevices>

+ 3
- 1
BPASmartClient/MainWindow.xaml.cs View File

@@ -251,7 +251,9 @@ namespace BPASmartClient
{
if (sender is MenuItem)
{
Type type = Assembly.Load("BPASmartClient.MorkT").GetType("BPASmartClient.MorkT.View.DebugView");
// Type type = Assembly.Load("BPASmartClient.MorkT").GetType("BPASmartClient.MorkT.View.DebugView");
// Type type = Assembly.Load("BPASmartClient.MorkF").GetType("BPASmartClient.MorkF.View.DebugView");
Type type = Assembly.Load("BPASmartClient.MorkM").GetType("BPASmartClient.MorkM.View.DebugView");
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
contentRegion.Content = (FrameworkElement)cti.Invoke(null);
Title.Text = (sender as MenuItem).Header?.ToString() + "界面";


+ 69
- 0
SmartClient.sln View File

@@ -78,6 +78,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkF", "BPA
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.LebaiRobot", "BPASmartClient.LebaiRobot\BPASmartClient.LebaiRobot.csproj", "{D40C3CC7-C07C-4882-93D3-7F9ABCD3B5F0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkM", "BPASmartClient.MorkM\BPASmartClient.MorkM.csproj", "{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkTLebaiJC", "BPASmartClient.MorkT.Lebai.JC\BPASmartClient.MorkTLebaiJC.csproj", "{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkTJAKAJC", "BPASmartClient.Morkt.JAKA.JC\BPASmartClient.MorkTJAKAJC.csproj", "{6B0FD858-A60D-41B9-A923-358B0CE2A254}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -672,6 +678,66 @@ Global
{D40C3CC7-C07C-4882-93D3-7F9ABCD3B5F0}.Release|x64.Build.0 = Release|Any CPU
{D40C3CC7-C07C-4882-93D3-7F9ABCD3B5F0}.Release|x86.ActiveCfg = Release|Any CPU
{D40C3CC7-C07C-4882-93D3-7F9ABCD3B5F0}.Release|x86.Build.0 = Release|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Debug|ARM.ActiveCfg = Debug|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Debug|ARM.Build.0 = Debug|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Debug|ARM64.Build.0 = Debug|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Debug|x64.ActiveCfg = Debug|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Debug|x64.Build.0 = Debug|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Debug|x86.ActiveCfg = Debug|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Debug|x86.Build.0 = Debug|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Release|Any CPU.Build.0 = Release|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Release|ARM.ActiveCfg = Release|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Release|ARM.Build.0 = Release|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Release|ARM64.ActiveCfg = Release|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Release|ARM64.Build.0 = Release|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Release|x64.ActiveCfg = Release|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Release|x64.Build.0 = Release|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Release|x86.ActiveCfg = Release|Any CPU
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9}.Release|x86.Build.0 = Release|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Debug|ARM.ActiveCfg = Debug|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Debug|ARM.Build.0 = Debug|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Debug|ARM64.Build.0 = Debug|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Debug|x64.ActiveCfg = Debug|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Debug|x64.Build.0 = Debug|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Debug|x86.ActiveCfg = Debug|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Debug|x86.Build.0 = Debug|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Release|Any CPU.Build.0 = Release|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Release|ARM.ActiveCfg = Release|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Release|ARM.Build.0 = Release|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Release|ARM64.ActiveCfg = Release|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Release|ARM64.Build.0 = Release|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Release|x64.ActiveCfg = Release|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Release|x64.Build.0 = Release|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Release|x86.ActiveCfg = Release|Any CPU
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D}.Release|x86.Build.0 = Release|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Debug|ARM.ActiveCfg = Debug|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Debug|ARM.Build.0 = Debug|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Debug|ARM64.Build.0 = Debug|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Debug|x64.ActiveCfg = Debug|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Debug|x64.Build.0 = Debug|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Debug|x86.ActiveCfg = Debug|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Debug|x86.Build.0 = Debug|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|Any CPU.Build.0 = Release|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|ARM.ActiveCfg = Release|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|ARM.Build.0 = Release|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|ARM64.ActiveCfg = Release|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|ARM64.Build.0 = Release|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|x64.ActiveCfg = Release|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|x64.Build.0 = Release|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|x86.ActiveCfg = Release|Any CPU
{6B0FD858-A60D-41B9-A923-358B0CE2A254}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -706,6 +772,9 @@ Global
{7F04A788-38B5-42CB-B601-70C657C953B8} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{15FD3FF1-80F1-4274-945A-BA5EBA35999E} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{D40C3CC7-C07C-4882-93D3-7F9ABCD3B5F0} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{74DB1F85-9B73-4113-8FE4-A63754BC7DF9} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{0A06C9E5-5C42-4BCE-B6E6-D8054C72255D} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{6B0FD858-A60D-41B9-A923-358B0CE2A254} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


Loading…
Cancel
Save