Explorar el Código

MiorkT

样式分支
NXX hace 2 años
padre
commit
b14f307cd2
Se han modificado 26 ficheros con 536 adiciones y 239 borrados
  1. +3
    -0
      BPASmartClient.DRCoffee/CoffeeMachine.cs
  2. +2
    -0
      BPASmartClient.Juicer/JuicerMachine.cs
  3. +19
    -13
      BPASmartClient.KLMCoffee/CoffeeMachine.cs
  4. +2
    -2
      BPASmartClient.Lebai/LebaiRobot.cs
  5. +32
    -0
      BPASmartClient.LebaiRobot/LebaiHelper.cs
  6. +1
    -0
      BPASmartClient.Model/乐白机器人/Enum/Lebai_qsqdCode.cs
  7. +2
    -1
      BPASmartClient.Model/乐白机器人/LebaiRobotEvent.cs
  8. +14
    -12
      BPASmartClient.MorkT/Control_MorkT.cs
  9. +10
    -4
      BPASmartClient.MorkT/View/DebugView.xaml
  10. +18
    -3
      BPASmartClient.MorkT/ViewModel/DebugViewModel.cs
  11. +0
    -0
      BPASmartClient.MorkT_HQ/BPASmartClient.MorkTHQ.csproj
  12. +246
    -148
      BPASmartClient.MorkT_HQ/Control_MorkTHQ.cs
  13. +43
    -2
      BPASmartClient.MorkT_HQ/GLV_MorkTHQ.cs
  14. +2
    -2
      BPASmartClient.MorkT_HQ/OrderLocInfo.cs
  15. +5
    -1
      BPASmartClient.MorkT_HQ/PolymerBatching.cs
  16. +41
    -24
      BPASmartClient.MorkT_HQ/View/DebugView.xaml
  17. +1
    -1
      BPASmartClient.MorkT_HQ/View/DebugView.xaml.cs
  18. +3
    -3
      BPASmartClient.MorkT_HQ/View/Monitor.xaml
  19. +1
    -1
      BPASmartClient.MorkT_HQ/View/Monitor.xaml.cs
  20. +2
    -2
      BPASmartClient.MorkT_HQ/View/ParSer.xaml
  21. +1
    -1
      BPASmartClient.MorkT_HQ/View/ParSer.xaml.cs
  22. +80
    -13
      BPASmartClient.MorkT_HQ/ViewModel/DebugViewModel.cs
  23. +1
    -1
      BPASmartClient.MorkT_HQ/ViewModel/MonitorViewModel.cs
  24. +3
    -1
      BPASmartClient.SCChip/CommandHandler.cs
  25. +3
    -3
      BPASmartClient.SCChip/ICChipMachine.cs
  26. +1
    -1
      SmartClient.sln

+ 3
- 0
BPASmartClient.DRCoffee/CoffeeMachine.cs Ver fichero

@@ -191,6 +191,7 @@ namespace BPASmartClient.DRCoffee
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
MessageLog.GetInstance.Show($"咖啡机: 制作咖啡指令");
}
catch (Exception ex)
{
@@ -210,6 +211,7 @@ namespace BPASmartClient.DRCoffee
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
MessageLog.GetInstance.Show($"咖啡机: 咖啡取消指令");
}
catch (Exception ex)
{
@@ -228,6 +230,7 @@ namespace BPASmartClient.DRCoffee
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
MessageLog.GetInstance.Show($"咖啡机: 咖啡模式设置指令");
}
catch (Exception ex)
{


+ 2
- 0
BPASmartClient.Juicer/JuicerMachine.cs Ver fichero

@@ -17,6 +17,7 @@ namespace BPASmartClient.Juicer
ThreadManage.GetInstance().StartLong(new Action(() =>
{
IsConnected = juicerHelper.IsOpen;
status["JuiceIsConnect"] = juicerHelper.IsOpen;
if (!IsConnected) IsWork = false;
while (IsConnected)
{
@@ -24,6 +25,7 @@ namespace BPASmartClient.Juicer
if (status != null)
{
SetStatus("GetDeviceStatus", juicerHelper.GetDeviceStatus());
}
Thread.Sleep(500);
}


+ 19
- 13
BPASmartClient.KLMCoffee/CoffeeMachine.cs Ver fichero

@@ -139,12 +139,18 @@ namespace BPASmartClient.KLMCoffee
SystemStatusModel systemStatus = new K95Command().StateResolution(data);
if (systemStatus != null)
{
status["Status"] = systemStatus.temStatus;
status["drinkType"] = systemStatus.drinkType;
status["AppStatus"] = systemStatus.taskIndex;
status["progress"] = systemStatus.progress;
status["Warning"] = systemStatus.faultMessage.dataFault();
status["Keep"] = systemStatus.upkeepMessage;
status["CoffeeIsconnected"] = OnLine;
if((K95SysTemStatus)status["Status"] == K95SysTemStatus.正在制作咖啡&&systemStatus.temStatus != K95SysTemStatus.正在制作咖啡)
{
status["Status"] = systemStatus.temStatus;
EventBus.EventBus.GetInstance().Publish(new KLMCoffee_CoffeEndCookEvent { DeviceId = DeviceId });
}
else status["CoffeeStatus"] = systemStatus.temStatus;
status["CoffeedrinkType"] = systemStatus.drinkType;
status["CoffeeAppStatus"] = systemStatus.taskIndex;
status["Coffeeprogress"] = systemStatus.progress;
status["CoffeeWarning"] = systemStatus.faultMessage.dataFault();
status["CoffeeKeep"] = systemStatus.upkeepMessage;
if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep())
IsWork = false;
else
@@ -160,18 +166,18 @@ namespace BPASmartClient.KLMCoffee

protected override void InitStatus()
{
status["Status"] = K95SysTemStatus.空闲状态;
status["drinkType"] = DrinkType.意式;
status["AppStatus"] = TaskIndex.无任务;
status["progress"] = 0;
status["Warning"] = new FaultMessage(0x00, 0x00).dataFault();
status["Keep"] = new UpkeepMessage(0x00).dataFault();
status["CoffeeStatus"] = K95SysTemStatus.空闲状态;
status["CoffeedrinkType"] = DrinkType.意式;
status["CoffeeAppStatus"] = TaskIndex.无任务;
status["Coffeeprogress"] = 0;
status["CoffeeWarning"] = new FaultMessage(0x00, 0x00).dataFault();
status["CoffeeKeep"] = new UpkeepMessage(0x00).dataFault();

}

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

//伽乐美咖啡机制作


+ 2
- 2
BPASmartClient.Lebai/LebaiRobot.cs Ver fichero

@@ -136,9 +136,9 @@ namespace BPASmartClient.Lebai
EventBus.EventBus.GetInstance().Subscribe<LebaiRobot_SetOutPutEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
if (@event is LebaiRobot_LebaiSenceEvent lebaiSenceEvent)
if (@event is LebaiRobot_SetOutPutEvent SetOutEvent)
{
LebaiHelper.GetInstance().SetOutput(SetOutEvent.bDO, SetOutEvent.pin);
}
});



+ 32
- 0
BPASmartClient.LebaiRobot/LebaiHelper.cs Ver fichero

@@ -312,5 +312,37 @@ namespace BPASmartClient.LebaiRobot
await client?.RunScene(id);
MessageLog.GetInstance.Show($"调用场景:{id}");
}
/// <summary>
/// 设置输出
/// </summary>
/// <param name="bDO"></param>
/// <param name="pin"></param>
public void SetOutput(bool bDO, int pin = 0)
{
try
{
if (client == null) { return; }
var res = client.SetDIO(new DIO() { Pin = pin, Value = bDO ? 1 : 0 });

}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
}
}

public void MoveL(double pose)
{
//try
//{
// if (client == null) { return; }
// var res = client.MovePT(new PVATRequest() { })

//}
//catch (Exception ex)
//{
// MessageLog.GetInstance.ShowEx(ex.ToString());
//}
}
}
}

+ 1
- 0
BPASmartClient.Model/乐白机器人/Enum/Lebai_qsqdCode.cs Ver fichero

@@ -29,6 +29,7 @@ namespace BPASmartClient.Model.乐白机器人.Enum
public const int SENCE_冰淇淋杯回原点 = 10049;
public const int SENCE_取咖啡出餐 = 10052;

public const int SENCE_机器人回原点 = 10058;
// 单片机冰淇淋机器场景
public const int SENCE_单片机接冰淇淋 = 10055;
public const int SENCE_单片机放冰淇淋位置 = 10056;


+ 2
- 1
BPASmartClient.Model/乐白机器人/LebaiRobotEvent.cs Ver fichero

@@ -48,7 +48,8 @@ namespace BPASmartClient.Model.乐白机器人

public class LebaiRobot_SetOutPutEvent : BaseEvent
{
public int RobotSetOut { get; set; }
public bool bDO { get; set; } = true;
public int pin { get; set; }
}
}


+ 14
- 12
BPASmartClient.MorkT/Control_MorkT.cs Ver fichero

@@ -432,7 +432,7 @@ namespace BPASmartClient.MorkT
/// </summary>
private void DoCoffeeQC(OrderLocInfo order)
{
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10052 }); //SENCE_取咖啡出餐
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取咖啡出餐 }); //SENCE_取咖啡出餐
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
//订单状态改变:完成
@@ -451,7 +451,7 @@ namespace BPASmartClient.MorkT
{
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 },(o)=>{ });
OrderChange(order.SuborderId, ORDER_STATUS.COOKING);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10031 }); //SENCE_取咖啡杯
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取咖啡杯 }); //SENCE_取咖啡杯

Wait();
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制
@@ -461,7 +461,7 @@ namespace BPASmartClient.MorkT
int count = 1;
bool result = true;
p:
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10033 }); //SENCE_咖啡杯检测
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_咖啡杯检测 }); //SENCE_咖啡杯检测
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent { DeviceId = DeviceId, Pin = 1 }, (o)=>
@@ -478,14 +478,14 @@ namespace BPASmartClient.MorkT
{
//退出循环回到初始位置
DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10050 }); //SENCE_咖啡杯回原点
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_咖啡杯回原点 }); //SENCE_咖啡杯回原点
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
morkT.GetCoffeeCup = false;
return;
}
DeviceProcessLogShow("执行二次取咖啡杯");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10035 }); //SENCE_二次取咖啡杯
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_二次取咖啡杯 }); //SENCE_二次取咖啡杯
Wait();
EventBus.EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
@@ -575,7 +575,7 @@ namespace BPASmartClient.MorkT
{
MessageLog.GetInstance.Show("准备开始制作冰淇淋");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10032 }); //SENCE_取冰淇淋杯
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取冰淇淋杯 }); //SENCE_取冰淇淋杯
Wait();
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制
Thread.Sleep(500);
@@ -592,7 +592,7 @@ namespace BPASmartClient.MorkT
bool result = true;
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
p:
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10034 }); //SENCE_冰淇淋杯检测
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_冰淇淋杯检测 }); //SENCE_冰淇淋杯检测
Wait();
Thread.Sleep(500);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) =>
@@ -627,14 +627,14 @@ namespace BPASmartClient.MorkT
{
//退出循环回到初始位置
DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10049 }); //SENCE_冰淇淋杯回原点
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_冰淇淋杯回原点 }); //SENCE_冰淇淋杯回原点
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 },(o) => { });
morkT.GetIceCreamCup = false;
return;
}
DeviceProcessLogShow($"执行{count}次取冰淇淋杯!");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10036 }); //SENCE_二次取冰淇淋杯
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_二次取冰淇淋杯 }); //SENCE_二次取冰淇淋杯
EventBus.EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
@@ -655,7 +655,7 @@ namespace BPASmartClient.MorkT
//EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent {DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
OrderChange(order.SuborderId, ORDER_STATUS.COOKING);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10055 }); //SENCE_接1号冰淇淋
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_单片机接冰淇淋 }); //SENCE_接1号冰淇淋
Wait();
bool doItResult = true;

@@ -663,7 +663,9 @@ namespace BPASmartClient.MorkT
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true });
//Thread.Sleep(500);
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false });
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId=DeviceId,})
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = true ,pin = 1});
Thread.Sleep(500);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = false, pin = 1 });

Thread.Sleep(500);
EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 });//冰淇淋出料
@@ -714,7 +716,7 @@ namespace BPASmartClient.MorkT
Thread.Sleep(500);
}
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10056 }); //SENCE_放冰淇淋位置
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_放冰淇淋位置 }); //SENCE_放冰淇淋位置
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
//订单状态改变:完成


+ 10
- 4
BPASmartClient.MorkT/View/DebugView.xaml Ver fichero

@@ -79,10 +79,16 @@
Command="{Binding Button_RobotControlCommand}"
CommandParameter="机器人急停"/>

<!--<Button Content="机器人回原点"
Margin="20,5" Width="110" Height="60"
Command="{Binding Button_GoToHomeCommand}"
CommandParameter="机器人急停">-->
<!--</Button>-->

</ListBox>
</Grid>
</GroupBox>
<!--<GroupBox Grid.Row="2"
<GroupBox Grid.Row="2"
FontFamily="楷体"
FontSize="20"
Header=" 冰淇淋机器 ">
@@ -172,8 +178,8 @@
</StackPanel>
</StackPanel>
</Grid>
</GroupBox>-->
<GroupBox Grid.Row="2" Grid.Column="0"
</GroupBox>
<!--<GroupBox Grid.Row="2" Grid.Column="0"
FontSize="20" FontFamily="楷体"
Header="单片机冰淇淋" >
<Grid>
@@ -214,7 +220,7 @@

</ListBox>
</Grid>
</GroupBox>
</GroupBox>-->
<GroupBox Grid.Row="2" Grid.Column="1"
FontFamily="楷体"


+ 18
- 3
BPASmartClient.MorkT/ViewModel/DebugViewModel.cs Ver fichero

@@ -8,6 +8,7 @@ using BPASmartClient.LebaiRobot;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.乐白机器人;
using BPASmartClient.Model.乐白机器人.Enum;
using BPASmartClient.Model.冰淇淋.Enum;
using BPASmartClient.Model.单片机;
using BPASmartClient.Model.单片机.Enum;
@@ -47,6 +48,8 @@ namespace BPASmartClient.MorkT.ViewModel
public RelayCommand Button_SetValueCommand { get; set; }

public RelayCommand Button_GoToHomeCommand { get; set; }

private void Button_SetValue()
{
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 });
@@ -56,6 +59,14 @@ namespace BPASmartClient.MorkT.ViewModel
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() });
}

private void Button_GoToHome()
{
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
//MessageLog.GetInstance.Show("开始执行乐白机器人回原点");
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_机器人回原点 });
//MessageLog.GetInstance.Show("开始执行乐白机器人回原点-----");
}

#endregion

#region 冰淇淋机器
@@ -222,10 +233,13 @@ namespace BPASmartClient.MorkT.ViewModel

private void Button_SCChipRefrigeration()
{
EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true });
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true });
//Thread.Sleep(500);
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = true, pin = 1 });
Thread.Sleep(500);
EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = false, pin = 1 });
}

private void Button_SCChipDischarge()
@@ -248,6 +262,7 @@ namespace BPASmartClient.MorkT.ViewModel
{
Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl);
Button_SetValueCommand = new RelayCommand(Button_SetValue);
Button_GoToHomeCommand = new RelayCommand(Button_GoToHome);

Button_MakeIceCreamCommand = new RelayCommand(Button_MakeIceCream);
Button_SetIceCreamModelCommand = new RelayCommand(Button_SetIceCreamModel);


BPASmartClient.MorkT_HQ/BPASmartClient.MorkT_HQ.csproj → BPASmartClient.MorkT_HQ/BPASmartClient.MorkTHQ.csproj Ver fichero


BPASmartClient.MorkT_HQ/Control_MorkT_HQ.cs → BPASmartClient.MorkT_HQ/Control_MorkTHQ.cs Ver fichero

@@ -1,4 +1,5 @@
using BPA.Message.Enum;
using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.DRCoffee;
using BPASmartClient.EventBus;
@@ -22,14 +23,14 @@ using System.Threading;
using System.Threading.Tasks;
using static BPASmartClient.EventBus.EventBus;

namespace BPASmartClient.MorkT_HQ
namespace BPASmartClient.MorkTHQ
{
public class Control_MorkT_HQ : BaseDevice
public class Control_MorkTHQ : BaseDevice
{
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } }

GLV_MorkT_HQ morkT = new GLV_MorkT_HQ();
GLV_MorkTHQ morkT = new GLV_MorkTHQ();
int[] devStatusBy = new int[2] { 0, 0 };

public override void DoMain()
{
@@ -40,7 +41,7 @@ namespace BPASmartClient.MorkT_HQ
IsHealth = true;
ServerInit();
DataParse();
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (morkT.MakeCoffeeOrder != null)
morkT.MakeCoffeeOrder.OrderStatus = 1;
@@ -55,7 +56,7 @@ namespace BPASmartClient.MorkT_HQ
public override void ResetProgram()
{
morkT = null;
morkT = new GLV_MorkT_HQ();
morkT = new GLV_MorkTHQ();
}


@@ -72,34 +73,16 @@ namespace BPASmartClient.MorkT_HQ

public override void MainTask()
{
if (morkT.waitMorkOrder != null)//更新订单取走状态
{
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent() { DeviceId = DeviceId, Pin = 0 }, (o) =>
{
if (o != null && o.Length > 0 && o[0] is bool res)
{
if (!res)
{
OrderChange(morkT.waitMorkOrder.SuborderId, ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow("订单取餐完成");
morkT.waitMorkOrder = null;
}
}
});
}
//制作咖啡
MakeCoffeeProcess();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 },(o)=>
{
if(o != null && o.Length > 0 && o[0] is bool resultValue)
{
if(!resultValue)//取餐口有空余位置
{
MakeIceCreamProcess();
MakeCoffeeComplete();
}
}
});
//制作果汁
MakeJuiceProcess();
//制作冰淇淋
MakeIceCreamProcess();
//制作完取咖啡
MakeCoffeeComplete();


}

@@ -232,6 +215,14 @@ namespace BPASmartClient.MorkT_HQ
morkT.CaffeeFault = coffeeFault;
}
}));
GetStatus("Coffeeprogress", new Action<object>((o) =>
{
if (o is int coffeeFault)
{
morkT.Coffeeprogress = coffeeFault;
}
}));

GetStatus("SCChipIsConnect", new Action<object>((o) =>
{
if (o is bool b)
@@ -239,6 +230,13 @@ namespace BPASmartClient.MorkT_HQ
morkT.SCChipIsConnect = b;
}
}));
GetStatus("JuiceIsConnect", new Action<object>((o) =>
{
if (o is bool b)
{
morkT.JuiceIsConnect = b;
}
}));
}


@@ -333,6 +331,20 @@ namespace BPASmartClient.MorkT_HQ
});
}
break;
case GOODS_TYPE.JUICE:
if(morkT.morkOrderPushesIceCream.FirstOrDefault(p=>p.SuborderId == order?.MorkOrder.SuborderId) == null)
{
morkT.GuMake = order.MorkOrder.MakeID == "2";
morkT.morkOrderPushesJuice.Enqueue(new OrderLocInfo()
{
SuborderId = order.MorkOrder.SuborderId,
BatchingId = res.BatchingId,
Loc = loc_Goods,
GoodsName = order.MorkOrder.GoodsName,
SortNum = order.MorkOrder.SortNum
});
}
break;
case GOODS_TYPE.NEITHER:
DeviceProcessLogShow("未知的商品类型");
break;
@@ -371,6 +383,7 @@ namespace BPASmartClient.MorkT_HQ
}
}

#region 咖啡
/// <summary>
/// 是否可以开始制作咖啡
/// </summary>
@@ -397,7 +410,7 @@ namespace BPASmartClient.MorkT_HQ
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10051}); //接咖啡后回原点
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() {DeviceId = DeviceId, DrinkCode = (Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) });//接咖啡控制
EventBus.EventBus.GetInstance().Publish(new KLMCoffee_MakeCoffeeEvent() {DeviceId = DeviceId, DrinkCode = (Model.咖啡机.Enum.DrinkType)int.Parse(orderLoc.Loc) });//接咖啡控制
DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!");
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc;
}
@@ -450,50 +463,16 @@ namespace BPASmartClient.MorkT_HQ
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 },(o)=>{ });
OrderChange(order.SuborderId, ORDER_STATUS.COOKING);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10031 }); //SENCE_取咖啡杯

Wait();
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId= DeviceId ,Cup = IC_CUP.CUP_COFFEE});//落碗控制
Thread.Sleep(500);
DeviceProcessLogShow("尝试取咖啡杯!");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
int count = 1;
bool result = true;
p:
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10033 }); //SENCE_咖啡杯检测
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent { DeviceId = DeviceId, Pin = 1 }, (o)=>
{
if(o != null && o.Length > 0 && o[0] is bool resultValue)
{
result = resultValue;
}
});

if (!result)
{
if (count >= 3)
{
//退出循环回到初始位置
DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10050 }); //SENCE_咖啡杯回原点
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
morkT.GetCoffeeCup = false;
return;
}
DeviceProcessLogShow("执行二次取咖啡杯");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10035 }); //SENCE_二次取咖啡杯
Wait();
EventBus.EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
count++;
goto p;
}
morkT.GetCoffeeCup = true;
DeviceProcessLogShow("取咖啡杯完成");
}
#endregion

#region 冰淇淋
/// <summary>
/// 冰淇淋是否可以开始制作
/// </summary>
@@ -509,45 +488,40 @@ namespace BPASmartClient.MorkT_HQ
/// </summary>
private void MakeIceCreamProcess()
{
//if (IceCreamCanMake())
//{
if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order))
{
DoIceCream(order);
}
//if(peripheralStatus.ContainsKey("IceCreamCurrentMode"))
//{
// if ((MORKI_MODE)peripheralStatus["IceCreamCurrentMode"] != MORKI_MODE.制冷模式) EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
//}

//if(peripheralStatus.ContainsKey("IceCreamCXB"))
//{
// if ((byte)peripheralStatus["IceCreamCXB"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作
// {
// bool result = true;
// EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) =>
// {
// if (res[0] is bool resultValue)
// {
// result = resultValue;
// }
// });
// if (result)
// {
// if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡");
// morkT.IceIsOK = false;
// }
// else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order))
// {
// morkT.IceIsOK = true;
// DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]");
// DoIceCream(order);
// }
// }
//}
if (IceCreamCanMake())
{
if (peripheralStatus.ContainsKey("IceCreamCurrentMode"))
{
if ((MORKI_MODE)peripheralStatus["IceCreamCurrentMode"] != MORKI_MODE.制冷模式) EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
}

//}
if (peripheralStatus.ContainsKey("IceCreamCXB"))
{
if ((byte)peripheralStatus["IceCreamCXB"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作
{
bool result = true;
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) =>
{
if (res[0] is bool resultValue)
{
result = resultValue;
}
});
if (result)
{
if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡");
morkT.IceIsOK = false;
}
else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order))
{
morkT.IceIsOK = true;
DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]");
DoIceCream(order);
}
}
}

}
}


@@ -557,12 +531,9 @@ namespace BPASmartClient.MorkT_HQ
private void DoIceCream(OrderLocInfo order)
{
GetIceCreamCup();
CheckICeCreaCup();
if(morkT.GetIceCreamCup)
{
GetIceCream(order);
PutIceCream(order);
}
//CheckICeCreaCup();
GetIceCream(order);
PutIceCream(order);
}

@@ -575,7 +546,6 @@ namespace BPASmartClient.MorkT_HQ
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10032 }); //SENCE_取冰淇淋杯
Wait();
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制
Thread.Sleep(500);
DeviceProcessLogShow("尝试取冰淇淋杯!");

@@ -657,37 +627,37 @@ namespace BPASmartClient.MorkT_HQ
Wait();
bool doItResult = true;

//出料
EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true });
Thread.Sleep(500);
EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false });
Thread.Sleep(500);
EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 });//冰淇淋出料
DeviceProcessLogShow("开始等待6s");
Thread.Sleep(5000);
////出料
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true });
//Thread.Sleep(500);
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false });
//Thread.Sleep(500);
//EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 });//冰淇淋出料
//DeviceProcessLogShow("开始等待6s");
//Thread.Sleep(5000);

// 出料
EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId }, (o) =>
{
doItResult = (bool)o[0];
});
if (doItResult)
{
IceCreamCookCheck();
}
else
{
int count_1 = 0;

//出料
//EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId },(o)=>
//{
// doItResult = (bool)o[0];
//});
//if (doItResult)
//{
// IceCreamCookCheck();
//}
//else
//{
// int count_1 = 0;

// while ((byte)peripheralStatus["IceCreamCXB"] <= 86)
// {
// Thread.Sleep(5);
// count_1++;
// if (count_1 >= 2000)
// break;
// }
// IceCreamCookCheck();
//}
while ((byte)peripheralStatus["IceCreamCXB"] <= 86)
{
Thread.Sleep(5);
count_1++;
if (count_1 >= 2000)
break;
}
IceCreamCookCheck();
}
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
}

@@ -757,10 +727,138 @@ namespace BPASmartClient.MorkT_HQ
Thread.Sleep(5000);

}
#endregion

#region 果汁
/// <summary>
/// 制作果汁流程
/// </summary>
private void MakeJuiceProcess()
{
if(morkT.morkOrderPushesJuice.TryDequeue(out OrderLocInfo order))
{
OrderChange(order.SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 11111 });//SENCE_取果汁杯位置
int JuicerNum1 = int.Parse(order.Loc);
switch (JuicerNum1)
{
case 52:
if (morkT.GuMake)
{
morkT.JuicerNum = 0x00;
}
else
{
morkT.JuicerNum = 0x01;
}
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 });
Wait();

EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接1号果汁位置 });
Wait();
break;
case 53:
if (morkT.GuMake)
{
morkT.JuicerNum = 0x02;
}
else
{
morkT.JuicerNum = 0x03;
}
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 });
Wait();

EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接2号果汁位置 });
Wait();
break;
case 54:
if (morkT.GuMake)
{
morkT.JuicerNum = 0x04;
}
else
{
morkT.JuicerNum = 0x05;
}
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 });
Wait();

EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接3号果汁位置 });
Wait();
break;
case 55:
if (morkT.GuMake)
{
morkT.JuicerNum = 0x06;
}
else
{
morkT.JuicerNum = 0x07;
}
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 });
Wait();

EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接4号果汁位置 });
Wait();
break;
default:
morkT.JuicerNum = 0x00;
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 });
Wait();

EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接1号果汁位置 });
Wait();
break;
}
var devStatus = GetDeviceStatus<int[]>("GetDeviceStatus");
var devStatus1 = Convert.ToString(devStatus[0], 2);
var devStatus2 = devStatus[1];

if (devStatus1.IndexOf("0") == 1 && devStatus2 == 0)
{
EventBus.EventBus.GetInstance().Publish(new WriteJuicer() { Value = morkT.JuicerNum });
Thread.Sleep(100);
devStatusBy = GetDeviceStatus<int[]>("GetDeviceStatus");
while (!(devStatusBy[1] == 0))
{
Thread.Sleep(100);
devStatusBy = GetDeviceStatus<int[]>("GetDeviceStatus");
while (devStatusBy.Length != 2)
{
Thread.Sleep(100);
devStatusBy = GetDeviceStatus<int[]>("GetDeviceStatus");
}
}
devStatusBy = GetDeviceStatus<int[]>("GetDeviceStatus");
Thread.Sleep(5000);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_放果汁杯位置后回原点 });
Wait();

OrderChange(order.SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
MessageLog.GetInstance.Show("果汁制作完成");
}
}

}

private T GetDeviceStatus<T>(string key)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
return (T)(peripheralStatus[key]);
}
}
return default;
}
#endregion
public override void SimOrder()
{
throw new NotImplementedException();
}
}
}

BPASmartClient.MorkT_HQ/GLV_MorkT_HQ.cs → BPASmartClient.MorkT_HQ/GLV_MorkTHQ.cs Ver fichero

@@ -11,9 +11,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkT_HQ
namespace BPASmartClient.MorkTHQ
{
public class GLV_MorkT_HQ:IStatus
public class GLV_MorkTHQ:IStatus
{
/// <summary>
/// 咖啡订单队列
@@ -25,6 +25,10 @@ namespace BPASmartClient.MorkT_HQ
/// </summary>
public ConcurrentQueue<OrderLocInfo> morkOrderPushesIceCream = new ConcurrentQueue<OrderLocInfo>();
/// <summary>
/// 果汁订单队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> morkOrderPushesJuice = new ConcurrentQueue<OrderLocInfo>();
/// <summary>
/// 等待取餐订单
/// </summary>
public OrderLocInfo waitMorkOrder = null;
@@ -57,6 +61,16 @@ namespace BPASmartClient.MorkT_HQ
/// </summary>
public bool GetIceCreamCup;

/// <summary>
/// 果汁机做法,true:热饮,false:冷饮
/// </summary>
public bool GuMake = false;

/// <summary>
/// 果汁机控制信号
/// </summary>
public byte JuicerNum;

#region

[VariableMonitor("机器人连接状态")]
@@ -110,9 +124,36 @@ namespace BPASmartClient.MorkT_HQ
[VariableMonitor("咖啡机故障")]
public DrCoffeeFault CaffeeFault { get; set; }

[VariableMonitor("咖啡机制作进度")]
public int Coffeeprogress { get; set; }

[VariableMonitor("单片机连接状态")]
public bool SCChipIsConnect { get; set; }


[VariableMonitor("果汁机连接状态")]
public bool JuiceIsConnect { get; set; }
#endregion
}

public class Lebai_HQ
{
#region 环球设备
public const int SENCE_取咖啡杯 = 10001;
public const int SENCE_取冰淇淋杯 = 10002;
public const int SENCE_接咖啡后回原点 = 10003;
public const int SENCE_取咖啡出餐 = 10004;
public const int SENCE_接1号冰淇淋 = 10005;
public const int SENCE_放冰淇淋位置 = 10006;
public const int SENCE_取果汁杯位置 = 10007;
public const int SENCE_接果汁公共位置 = 10008;
public const int SENCE_接1号果汁位置 = 10009;
public const int SENCE_接2号果汁位置 = 10010;
public const int SENCE_接3号果汁位置 = 10011;
public const int SENCE_接4号果汁位置 = 10012;
public const int SENCE_放果汁杯位置后回原点 = 10013;


#endregion
}
}

+ 2
- 2
BPASmartClient.MorkT_HQ/OrderLocInfo.cs Ver fichero

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkT_HQ
namespace BPASmartClient.MorkTHQ
{
public class OrderLocInfo
{
@@ -16,7 +16,7 @@ namespace BPASmartClient.MorkT_HQ

public int OrderStatus { get; set; }

public string MakeID { get; set; }
public OrderLocInfo()
{
OrderStatus = 0;


+ 5
- 1
BPASmartClient.MorkT_HQ/PolymerBatching.cs Ver fichero

@@ -8,7 +8,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkT_HQ
namespace BPASmartClient.MorkTHQ
{
public enum GOODS_TYPE
{
@@ -29,6 +29,10 @@ namespace BPASmartClient.MorkT_HQ
internal const string ICE_MAIN_BATCHIN1_LOC = "52";
internal const string ICE_MAIN_BATCHIN2_LOC = "53";
internal const string ICE_MAIN_BATCHIN3_LOC = "54";
//internal const string Juicer_MAIN_BATCHIN1_LOC = "52";
//internal const string Juicer_MAIN_BATCHIN2_LOC = "53";
//internal const string Juicer_MAIN_BATCHIN3_LOC = "54";
//internal const string Juicer_MAIN_BATCHIN4_LOC = "55";
internal const string COFFEE_HOLDER_LOC = "30";
internal const string ICE_HOLDER_LOC = "51";
public static Dictionary<string, GOODS_TYPE> GOODS_TYPES = new Dictionary<string, GOODS_TYPE>() {


+ 41
- 24
BPASmartClient.MorkT_HQ/View/DebugView.xaml Ver fichero

@@ -1,9 +1,9 @@
<UserControl x:Class="BPASmartClient.MorkT_HQ.View.DebugView"
<UserControl x:Class="BPASmartClient.MorkTHQ.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:vm ="clr-namespace:BPASmartClient.MorkT_HQ.ViewModel"
xmlns:vm ="clr-namespace:BPASmartClient.MorkTHQ.ViewModel"
mc:Ignorable="d"
Name="调试界面"
d:DesignHeight="500" d:DesignWidth="1000" Unloaded="Dubug_Unloaded">
@@ -25,7 +25,7 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="14*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="20*"/>
</Grid.RowDefinitions>

@@ -198,6 +198,7 @@
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="99" />
@@ -209,20 +210,23 @@
<TextBlock FontSize="18"
Grid.Column="1"
Text="{Binding CoffeeStatus}" Height="23" />
<TextBlock Grid.Column="2" Height="23" Width="80" FontSize="18">应用状态</TextBlock>
<TextBlock Grid.Column="2" Height="23" Width="80" FontSize="18">制作任务</TextBlock>
<TextBlock FontSize="18"
Grid.Column="3"
Text="{Binding AppStatus}" Height="23"/>
Text="{Binding CoffeeAppStatus}" Height="23"/>
<TextBlock Grid.Row="1" Grid.Column="0" Height="22" Width="80" FontSize="18">告警信息</TextBlock>
<TextBlock FontSize="15"
Grid.Row="1"
Grid.Column="1"
Text="{Binding Warning}" />
<TextBlock Grid.Row="1" Grid.Column="2" Height="22" Width="80" FontSize="18">故障信息</TextBlock>
Text="{Binding CoffeeWarning}" />
<TextBlock Grid.Row="1" Grid.Column="2" Height="22" Width="80" FontSize="18">保养信息</TextBlock>
<TextBlock FontSize="18"
Grid.Row="1"
Grid.Column="3"
Text="{Binding CaffeeFault}" Height="22" Width="60" />
Text="{Binding CoffeeFault}" Height="22" Width="60" />
<TextBlock Text="制作进度" Grid.Row="2"/>
<TextBlock Grid.Row="2" Grid.Column="1"
Text="{Binding Coffeeprogress}"/>
</Grid>
<StackPanel Grid.Row="2" Orientation="Vertical">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
@@ -238,28 +242,41 @@
Command="{}"
Content="停止制作"/>
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>模式</TextBlock>
<ComboBox Margin="10,0"
Width="100"
ItemsSource="{Binding CoffeeCmds}"
SelectedItem="{Binding SelectedCoffeeCmd}"/>
<Button Margin="10,0"
Command="{}"
Content="设置" Cursor="Hand"/>
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"/>
</StackPanel>
</Grid>
</GroupBox>
<GroupBox Header="单片机控制"
<GroupBox Header="果汁机" Margin="10"
FontSize="18"
Grid.Row="1" Grid.ColumnSpan="2"
Margin="0,0,0,10" HorizontalAlignment="Right" Width="1000">
<StackPanel Orientation="Horizontal"
VerticalAlignment="Center" >
HorizontalAlignment="Left" >
<Grid>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="连接状态" />
<TextBlock Text="{Binding JuiceIsConnect}"
Margin="120,0,0,0"/>
<StackPanel Orientation="Horizontal" Grid.Column="1">
<TextBlock Text="果汁:" Margin="10"/>
<TextBlock Text="{Binding JuiceIsConnect}"/>
<ComboBox Margin="10,0"
Width="100" FontSize="16"
ItemsSource="{Binding Juice}"
SelectedItem="{Binding SelectedJuice}"
IsReadOnly="True"/>
<ComboBox Margin="10,0"
Width="49" FontSize="16"
ItemsSource="{Binding Temperature}"
SelectedItem="{Binding SelectedTemperature}"
IsReadOnly="True"/>
<Button Margin="10,0"
Command="{Binding MakeJuiceCommand}"
Content="制作"/>

</StackPanel>
</StackPanel>
</Grid>
</GroupBox>

</Grid>


+ 1
- 1
BPASmartClient.MorkT_HQ/View/DebugView.xaml.cs Ver fichero

@@ -14,7 +14,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkT_HQ.View
namespace BPASmartClient.MorkTHQ.View
{
/// <summary>
/// MorkT_DebugView.xaml 的交互逻辑


+ 3
- 3
BPASmartClient.MorkT_HQ/View/Monitor.xaml Ver fichero

@@ -1,10 +1,10 @@
<UserControl x:Class="BPASmartClient.MorkT_HQ.View.Monitor"
<UserControl x:Class="BPASmartClient.MorkTHQ.View.Monitor"
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.MorkT_HQ.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkT_HQ.ViewModel"
xmlns:local="clr-namespace:BPASmartClient.MorkTHQ.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkTHQ.ViewModel"
mc:Ignorable="d"
Name="监控画面"
d:DesignHeight="450" d:DesignWidth="800" Unloaded="Monitor_Unloaded">


+ 1
- 1
BPASmartClient.MorkT_HQ/View/Monitor.xaml.cs Ver fichero

@@ -14,7 +14,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkT_HQ.View
namespace BPASmartClient.MorkTHQ.View
{
/// <summary>
/// Monitor.xaml 的交互逻辑


+ 2
- 2
BPASmartClient.MorkT_HQ/View/ParSer.xaml Ver fichero

@@ -1,9 +1,9 @@
<UserControl x:Class="BPASmartClient.MorkT_HQ.View.ParSer"
<UserControl x:Class="BPASmartClient.MorkTHQ.View.ParSer"
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.MorkT_HQ.View"
xmlns:local="clr-namespace:BPASmartClient.MorkTHQ.View"
mc:Ignorable="d"
Name="参数设置界面"
d:DesignHeight="450" d:DesignWidth="800">


+ 1
- 1
BPASmartClient.MorkT_HQ/View/ParSer.xaml.cs Ver fichero

@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkT_HQ.View
namespace BPASmartClient.MorkTHQ.View
{
/// <summary>
/// ParSer.xaml 的交互逻辑


+ 80
- 13
BPASmartClient.MorkT_HQ/ViewModel/DebugViewModel.cs Ver fichero

@@ -20,7 +20,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;

namespace BPASmartClient.MorkT_HQ.ViewModel
namespace BPASmartClient.MorkTHQ.ViewModel
{
public class DebugViewModel : ObservableObject
{
@@ -124,7 +124,7 @@ namespace BPASmartClient.MorkT_HQ.ViewModel

private void Button_MakeIceCream()
{
EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId });
}
private void Button_SetIceCreamModel()
{
@@ -147,19 +147,21 @@ namespace BPASmartClient.MorkT_HQ.ViewModel
/// <summary>
/// 应用状态
/// </summary>
public string AppStatus { get { return _appStatus; } set { _appStatus = value; OnPropertyChanged(); } }
private string _appStatus { get; set; }
public string CoffeeAppStatus { get { return _coffeAappStatus; } set { _coffeAappStatus = value; OnPropertyChanged(); } }
private string _coffeAappStatus { get; set; }
/// <summary>
/// 告警
/// </summary>
public string Warning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } }
public string _warning { get; set; }
public string CoffeeWarning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } }
private string _warning { get; set; }
/// <summary>
/// 故障信息
/// </summary>
public string CaffeeFault { get { return _caffeeFault; } set { _caffeeFault = value; OnPropertyChanged(); } }
public string _caffeeFault { get; set; }
public string CoffeeFault { get { return _coffeeFault; } set { _coffeeFault = value; OnPropertyChanged(); } }
private string _coffeeFault { get; set; }

public string Coffeeprogress { get { return _coffeeprogress; } set { _coffeeprogress = value; OnPropertyChanged(); } }
private string _coffeeprogress { get; set; }
public List<string> Coffees { get; set; } = new List<string>();
public string SelectedCoffee { get; set; }

@@ -235,6 +237,65 @@ namespace BPASmartClient.MorkT_HQ.ViewModel

#endregion

#region 果汁机
/// <summary>
/// 果汁机连接状态
/// </summary>
public string JuiceIsConnect { get { return _juiceIsConnect; } set { _juiceIsConnect = value; OnPropertyChanged(); } }
private string _juiceIsConnect { get; set; }

public List<string> Juice { get; set; } = new List<string>() { "果汁1", "果汁2", "果汁3", "果汁4" };
public string SelectedJuice { get; set; } = "果汁1";

public List<string> Temperature { get; set; } = new List<string>() { "冷", "热" };

public string SelectedTemperature { get; set; } = "冷";

public RelayCommand MakeJuiceCommand { get; set; }

private void MakeJuice()
{
switch (SelectedJuice)
{
case "果汁1":
if (SelectedTemperature == "冷")
{
MakeJuiceEvent(0x01);
}
else MakeJuiceEvent(0x00);
break;
case "果汁2":
if (SelectedTemperature == "冷")
{
MakeJuiceEvent(0x03);
}
else MakeJuiceEvent(0x02);
break;
case "果汁3":
if (SelectedTemperature == "冷")
{
MakeJuiceEvent(0x05);
}
else MakeJuiceEvent(0x04);
break;
case "果汁4":
if (SelectedTemperature == "冷")
{
MakeJuiceEvent(0x07);
}
else MakeJuiceEvent(0x06);
break;
default:
MakeJuiceEvent(0x00);
break;
}
}
private void MakeJuiceEvent(byte b)
{
EventBus.EventBus.GetInstance().Publish(new WriteJuicer { DeviceId = DeviceId, Value = b });
}
#endregion

/// <summary>
/// 设备ID
/// </summary>
@@ -266,7 +327,9 @@ namespace BPASmartClient.MorkT_HQ.ViewModel
Button_SCChipDischarge();
});

foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode)))
MakeJuiceCommand = new RelayCommand(MakeJuice);

foreach (DrinkType code in Enum.GetValues(typeof(DrinkType)))
{
Coffees.Add(code.ToString());
}
@@ -283,9 +346,11 @@ namespace BPASmartClient.MorkT_HQ.ViewModel
}
SelecteIceCreamdMode = IceCreamModes[0];


Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device =>
{
if (device.Name == "MorkT") DeviceId = device.DeviceId
if (device.Name == "MorkTHQ") DeviceId = device.DeviceId
;
});
ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -299,13 +364,15 @@ namespace BPASmartClient.MorkT_HQ.ViewModel
IceCreamConnected = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋连接状态").CurrentValue == "True" ? "已连接" : "未连接";
CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
SCChipIsConnect = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
JuiceIsConnect = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接";

RobotMode = variableMonitors.FirstOrDefault(p => p.Notes == "机器人状态").CurrentValue;

CoffeeStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机状态").CurrentValue;
AppStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机应用状态").CurrentValue;
Warning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue;
CaffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue;
CoffeeAppStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机应用状态").CurrentValue;
CoffeeWarning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue;
CoffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue;
Coffeeprogress = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机制作进度").CurrentValue;

YLWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器预冷温度").CurrentValue;
HQWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器回气温度").CurrentValue;


+ 1
- 1
BPASmartClient.MorkT_HQ/ViewModel/MonitorViewModel.cs Ver fichero

@@ -12,7 +12,7 @@ using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace BPASmartClient.MorkT_HQ.ViewModel
namespace BPASmartClient.MorkTHQ.ViewModel
{

public class MonitorViewModel: ObservableObject


+ 3
- 1
BPASmartClient.SCChip/CommandHandler.cs Ver fichero

@@ -1,5 +1,6 @@

using BPASmartClient.EventBus;
using BPASmartClient.Message;
using BPASmartClient.Model.单片机;
using BPASmartClient.Model.单片机.Enum;
using BPASmartClient.SCChip;
@@ -148,6 +149,7 @@ namespace BPASmartClient.SCChip
package.Cmd = IC_CMD.TAKE_CUP;
package.Value = (byte)(@event as SCChip_TakeCupEvent).Cup;
commProxy.SendData(StructureToByte(package));
MessageLog.GetInstance.Show($"发送落杯指令--{(@event as SCChip_TakeCupEvent).Cup}");

bool wait = true;
var waitTimeout = DateTime.Now.AddSeconds(3);
@@ -166,7 +168,7 @@ namespace BPASmartClient.SCChip
break;
}
}
Thread.Sleep(10);
Thread.Sleep(50);
}
}



+ 3
- 3
BPASmartClient.SCChip/ICChipMachine.cs Ver fichero

@@ -144,7 +144,7 @@ namespace BPASmartClient.SCChip
}
continue;
}
Thread.Sleep(5);
Thread.Sleep(10);
}

/// <summary>
@@ -281,7 +281,7 @@ namespace BPASmartClient.SCChip
package.Cmd = IC_CMD.TAKE_CUP;
package.Value = (byte)(@event as SCChip_TakeCupEvent).Cup;
commProxy.SendData(StructureToByte(package));
MessageLog.GetInstance.Show($"发送落杯指令--{(@event as SCChip_TakeCupEvent).Cup}");
bool wait = true;
var waitTimeout = DateTime.Now.AddSeconds(3);
while (wait)
@@ -351,7 +351,7 @@ namespace BPASmartClient.SCChip
}
Thread.Sleep(10);
}
Thread.Sleep(1700);
Thread.Sleep(1800);
switch ((IC_SE)(@event as SCChip_MakeIceCreamEvent).SteeringEngine)
{
case IC_SE.SE_1:


+ 1
- 1
SmartClient.sln Ver fichero

@@ -92,7 +92,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.JAKA", "BPAS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Juicer", "BPASmartClient.Juicer\BPASmartClient.Juicer.csproj", "{C28A88B1-E449-484C-AC67-B5038FF2CA79}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkT_HQ", "BPASmartClient.MorkT_HQ\BPASmartClient.MorkT_HQ.csproj", "{00C17D87-A323-4A97-BC21-7039E55614DE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTHQ", "BPASmartClient.MorkT_HQ\BPASmartClient.MorkTHQ.csproj", "{00C17D87-A323-4A97-BC21-7039E55614DE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution


Cargando…
Cancelar
Guardar