|
|
@@ -73,116 +73,145 @@ namespace BPASmartClient.MorkS |
|
|
|
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); |
|
|
|
} |
|
|
|
|
|
|
|
private void ReadData(string address, ushort len = 1, Action<bool[]> action = null) |
|
|
|
{ |
|
|
|
EventBus.EventBus.GetInstance().Publish(new ReadModel() { DeviceId = DeviceId, Address = address, Length = len }, (o) => |
|
|
|
{ |
|
|
|
if (o != null && o.Length > 0 && o[0] is bool[] bools) |
|
|
|
{ |
|
|
|
action(bools); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private void GetStatus(string key, Action<bool[]> action) |
|
|
|
//private void ReadData(string address, ushort len = 1, Action<bool[]> action = null) |
|
|
|
//{ |
|
|
|
// EventBus.EventBus.GetInstance().Publish(new ReadModel() { DeviceId = DeviceId, Address = address, Length = len }, (o) => |
|
|
|
// { |
|
|
|
// if (o != null && o.Length > 0 && o[0] is bool[] bools) |
|
|
|
// { |
|
|
|
// action(bools); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
//} |
|
|
|
|
|
|
|
private void GetStatus(string key, Action<object> action) |
|
|
|
{ |
|
|
|
if (peripheralStatus.ContainsKey(key)) |
|
|
|
{ |
|
|
|
if (peripheralStatus[key] is bool[] bools) |
|
|
|
if (peripheralStatus[key] != null) |
|
|
|
{ |
|
|
|
action?.Invoke(bools); |
|
|
|
action?.Invoke(peripheralStatus[key]); |
|
|
|
} |
|
|
|
//action((bool[])peripheralStatus[key]); |
|
|
|
//if (peripheralStatus[key] is bool[] bools) |
|
|
|
//{ |
|
|
|
// action?.Invoke(bools); |
|
|
|
//} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public override void ReadData() |
|
|
|
{ |
|
|
|
GetStatus("M230.0", new Action<bool[]>((bools) => |
|
|
|
GetStatus("M230.0", new Action<object>((obj) => |
|
|
|
{ |
|
|
|
alarm.MachineLeftLowTemperature = bools[0]; |
|
|
|
alarm.MachineRightLowTemperature = bools[1]; |
|
|
|
alarm.Supply1_LossBowl = bools[2]; |
|
|
|
alarm.Supply2_LossBowl = bools[3]; |
|
|
|
alarm.Supply1_ErrorOutBowl = bools[4]; |
|
|
|
alarm.Supply2_ErrorOutBowl = bools[5]; |
|
|
|
alarm.PushBowlCylinderError = bools[6]; |
|
|
|
alarm.NoodleMacCommunicateError = bools[7]; |
|
|
|
alarm.DosingMacCommunicateError = bools[8]; |
|
|
|
alarm.RobotMacCommunicateError = bools[9]; |
|
|
|
alarm.DeviceEstop = bools[10]; |
|
|
|
alarm.RobotInitError = bools[11]; |
|
|
|
alarm.RobotUrgentStop = bools[12]; |
|
|
|
alarm.RobotNotInRemoteMode = bools[13]; |
|
|
|
alarm.RobotNotInReady = bools[14]; |
|
|
|
alarm.RobotSelfInException = bools[15]; |
|
|
|
alarm.LeftLackWater = bools[16]; |
|
|
|
alarm.RightLackWater = bools[17]; |
|
|
|
alarm.SvrewInitFail = bools[18]; |
|
|
|
alarm.TurntableInitFail = bools[19]; |
|
|
|
alarm.RobotInitFail = bools[20]; |
|
|
|
alarm.NoodleCookerInitFail = bools[21]; |
|
|
|
alarm.PushBowlInitFail1 = bools[22]; |
|
|
|
alarm.PushBowlInitFail2 = bools[23]; |
|
|
|
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 24) |
|
|
|
{ |
|
|
|
alarm.MachineLeftLowTemperature = bools[0]; |
|
|
|
alarm.MachineRightLowTemperature = bools[1]; |
|
|
|
alarm.Supply1_LossBowl = bools[2]; |
|
|
|
alarm.Supply2_LossBowl = bools[3]; |
|
|
|
alarm.Supply1_ErrorOutBowl = bools[4]; |
|
|
|
alarm.Supply2_ErrorOutBowl = bools[5]; |
|
|
|
alarm.PushBowlCylinderError = bools[6]; |
|
|
|
alarm.NoodleMacCommunicateError = bools[7]; |
|
|
|
alarm.DosingMacCommunicateError = bools[8]; |
|
|
|
alarm.RobotMacCommunicateError = bools[9]; |
|
|
|
alarm.DeviceEstop = bools[10]; |
|
|
|
alarm.RobotInitError = bools[11]; |
|
|
|
alarm.RobotUrgentStop = bools[12]; |
|
|
|
alarm.RobotNotInRemoteMode = bools[13]; |
|
|
|
alarm.RobotNotInReady = bools[14]; |
|
|
|
alarm.RobotSelfInException = bools[15]; |
|
|
|
alarm.LeftLackWater = bools[16]; |
|
|
|
alarm.RightLackWater = bools[17]; |
|
|
|
alarm.SvrewInitFail = bools[18]; |
|
|
|
alarm.TurntableInitFail = bools[19]; |
|
|
|
alarm.RobotInitFail = bools[20]; |
|
|
|
alarm.NoodleCookerInitFail = bools[21]; |
|
|
|
alarm.PushBowlInitFail1 = bools[22]; |
|
|
|
alarm.PushBowlInitFail2 = bools[23]; |
|
|
|
} |
|
|
|
})); |
|
|
|
|
|
|
|
GetStatus("M0.3", new Action<bool[]>((bools) => |
|
|
|
GetStatus("M0.3", new Action<object>((obj) => |
|
|
|
{ |
|
|
|
mORKS.RobotTakeNoodle = bools[0]; |
|
|
|
mORKS.RobotOutMeal = bools[1]; |
|
|
|
mORKS.MoveTurntable = bools[2]; |
|
|
|
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 3) |
|
|
|
{ |
|
|
|
mORKS.RobotTakeNoodle = bools[0]; |
|
|
|
mORKS.RobotOutMeal = bools[1]; |
|
|
|
mORKS.MoveTurntable = bools[2]; |
|
|
|
} |
|
|
|
})); |
|
|
|
|
|
|
|
GetStatus("M100.0", new Action<bool[]>((bools) => |
|
|
|
GetStatus("M100.0", new Action<object>((obj) => |
|
|
|
{ |
|
|
|
mORKS.InitComplete = bools[0]; |
|
|
|
mORKS.TakeBowlIdle = bools[1]; |
|
|
|
mORKS.TemperatureReached = bools[2]; |
|
|
|
mORKS.AllowFallNoodle = bools[3]; |
|
|
|
mORKS.RbTakeNoodleComplete = bools[4]; |
|
|
|
mORKS.RbFallNoodleComplete = bools[5]; |
|
|
|
mORKS.RbOutMealComplete = bools[6]; |
|
|
|
mORKS.RobotIdle = bools[7]; |
|
|
|
mORKS.TakeMealDetect = bools[8]; |
|
|
|
mORKS.MissingBowl = bools[9]; |
|
|
|
Initing = bools[10]; |
|
|
|
mORKS.TurntableLowerLimit = bools[11]; |
|
|
|
mORKS.MissingBowlSignal2 = bools[12]; |
|
|
|
mORKS.TurntableUpLimit = bools[13]; |
|
|
|
mORKS.FeedComplete = bools[14]; |
|
|
|
mORKS.TurntableMoveInPlace = bools[15]; |
|
|
|
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 16) |
|
|
|
{ |
|
|
|
mORKS.InitComplete = bools[0]; |
|
|
|
mORKS.TakeBowlIdle = bools[1]; |
|
|
|
mORKS.TemperatureReached = bools[2]; |
|
|
|
mORKS.AllowFallNoodle = bools[3]; |
|
|
|
mORKS.RbTakeNoodleComplete = bools[4]; |
|
|
|
mORKS.RbFallNoodleComplete = bools[5]; |
|
|
|
mORKS.RbOutMealComplete = bools[6]; |
|
|
|
mORKS.RobotIdle = bools[7]; |
|
|
|
mORKS.TakeMealDetect = bools[8]; |
|
|
|
mORKS.MissingBowl = bools[9]; |
|
|
|
Initing = bools[10]; |
|
|
|
mORKS.TurntableLowerLimit = bools[11]; |
|
|
|
mORKS.MissingBowlSignal2 = bools[12]; |
|
|
|
mORKS.TurntableUpLimit = bools[13]; |
|
|
|
mORKS.FeedComplete = bools[14]; |
|
|
|
mORKS.TurntableMoveInPlace = bools[15]; |
|
|
|
} |
|
|
|
|
|
|
|
})); |
|
|
|
|
|
|
|
GetStatus("M235.0", new Action<bool[]>((bools) => |
|
|
|
GetStatus("M235.0", new Action<object>((obj) => |
|
|
|
{ |
|
|
|
mORKS.Error = bools[0]; |
|
|
|
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) |
|
|
|
{ |
|
|
|
mORKS.Error = bools[0]; |
|
|
|
} |
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
GetStatus("M102.0", new Action<bool[]>((bools) => |
|
|
|
GetStatus("M102.0", new Action<object>((obj) => |
|
|
|
{ |
|
|
|
for (int i = 0; i < 6; i++) |
|
|
|
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7) |
|
|
|
{ |
|
|
|
mORKS.NoodleCookerStatus[i] = bools[i]; |
|
|
|
for (int i = 0; i < 6; i++) |
|
|
|
{ |
|
|
|
mORKS.NoodleCookerStatus[i] = bools[i]; |
|
|
|
} |
|
|
|
mORKS.Feeding = bools[6]; |
|
|
|
} |
|
|
|
mORKS.Feeding = bools[6]; |
|
|
|
})); |
|
|
|
|
|
|
|
GetStatus("M103.0", new Action<bool[]>((bools) => |
|
|
|
GetStatus("M103.0", new Action<object>((obj) => |
|
|
|
{ |
|
|
|
for (int i = 0; i < 6; i++) |
|
|
|
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 6) |
|
|
|
{ |
|
|
|
mORKS.CookNoodlesComplete[i] = bools[i]; |
|
|
|
for (int i = 0; i < 6; i++) |
|
|
|
{ |
|
|
|
mORKS.CookNoodlesComplete[i] = bools[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
})); |
|
|
|
|
|
|
|
EventBus.EventBus.GetInstance().Publish(new ReadModel() { DeviceId = DeviceId, Address = "VW372", Length = 1 }, (o) => |
|
|
|
GetStatus("VW372", new Action<object>((obj) => |
|
|
|
{ |
|
|
|
if (o != null && o.Length > 0 && o[0] is ushort value) |
|
|
|
{ |
|
|
|
mORKS.TurntableFeedbackloc = value; |
|
|
|
} |
|
|
|
}); |
|
|
|
if (obj is ushort[] UshortValue && UshortValue.Length > 0 && UshortValue.Length <= 1) |
|
|
|
mORKS.TurntableFeedbackloc = UshortValue[0]; |
|
|
|
})); |
|
|
|
|
|
|
|
//EventBus.EventBus.GetInstance().Publish(new ReadModel() { DeviceId = DeviceId, Address = "VW372", Length = 1 }, (o) => |
|
|
|
//{ |
|
|
|
// if (o != null && o.Length > 0 && o[0] is ushort value) |
|
|
|
// { |
|
|
|
// mORKS.TurntableFeedbackloc = value; |
|
|
|
// } |
|
|
|
//}); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|