pengliangyang 2 years ago
parent
commit
466868f801
44 changed files with 3223 additions and 1162 deletions
  1. +11
    -1
      BPASmartClient.Business/LocalMqtt.cs
  2. +11
    -0
      BPASmartClient.Model/乐白机器人/Enum/Lebai_qsqdCode.cs
  3. +16
    -10
      BPASmartClient.Model/大炒/FryPotMessages.cs
  4. +57
    -14
      BPASmartClient.Model/大炒/RobotActionModel.cs
  5. +150
    -306
      BPASmartClient.MorkBF/Control_MorkBF.cs
  6. +6
    -6
      BPASmartClient.MorkBF/Convert/FryActionToVisibilityConverter.cs
  7. +15
    -20
      BPASmartClient.MorkBF/GVL_MorkBF.cs
  8. +17
    -10
      BPASmartClient.MorkBF/VIew/DebugView.xaml
  9. +5
    -3
      BPASmartClient.MorkBF/VIew/FoodManagerView.xaml
  10. +1
    -0
      BPASmartClient.MorkBF/VIew/FoodManagerView.xaml.cs
  11. +48
    -72
      BPASmartClient.MorkBF/ViewModel/DebugViewModel.cs
  12. +12
    -2
      BPASmartClient.MorkBF/ViewModel/FoodManagerViewModel.cs
  13. +406
    -225
      BPASmartClient.MorkF/Control_MorkF.cs
  14. +176
    -2
      BPASmartClient.MorkF/GVL_MorkF.cs
  15. +8
    -2
      BPASmartClient.MorkF/View/DebugView.xaml
  16. +697
    -0
      BPASmartClient.MorkF/View/MaterialCalibration.xaml
  17. +28
    -0
      BPASmartClient.MorkF/View/MaterialCalibration.xaml.cs
  18. +961
    -0
      BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs
  19. +0
    -7
      BPASmartClient.MorkT/BPASmartClient.MorkT.csproj
  20. +42
    -42
      BPASmartClient.MorkT/Control_MorkT.cs
  21. +234
    -157
      BPASmartClient.MorkT/View/DebugView.xaml
  22. +5
    -3
      BPASmartClient.MorkT/View/DebugView.xaml.cs
  23. +92
    -178
      BPASmartClient.MorkT/ViewModel/DebugViewModel.cs
  24. +0
    -1
      BPASmartClient.MorkTM/Control_MorkTM.cs
  25. +1
    -1
      BPASmartClient.ScreenALL/App.config
  26. +68
    -23
      BPASmartClient.ScreenLib/AppMain.cs
  27. +54
    -5
      BPASmartClient.ScreenLib/Helper/Main.cs
  28. +12
    -12
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml
  29. +1
    -1
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs
  30. +12
    -12
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml
  31. +1
    -1
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2ViewModel.cs
  32. +12
    -12
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3.xaml
  33. +1
    -0
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3.xaml.cs
  34. +1
    -1
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3ViewModel.cs
  35. +24
    -5
      BPASmartClient.ScreenLib/总监视大屏/ScreenALLControl.xaml
  36. +13
    -10
      BPASmartClient.ScreenLib/总监视大屏/ScreenALLControlViewModel.cs
  37. +1
    -1
      BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs
  38. +2
    -2
      BPASmartClient.ScreenMaxWok/App.config
  39. +3
    -2
      BPASmartClient.ScreenMinWok/App.config
  40. +2
    -2
      BPASmartClient.ScreenMorks/App.config
  41. +5
    -5
      BPASmartClient.ScreenSplitMeals/App.config
  42. +7
    -1
      BPASmartClient/App.config
  43. +2
    -2
      BPASmartClient/AssemblyInfo.cs
  44. +3
    -3
      WpfTest/MainWindow.xaml.cs

+ 11
- 1
BPASmartClient.Business/LocalMqtt.cs View File

@@ -24,6 +24,11 @@ namespace BPASmartClient.Business

ScreenDeviceType LocDeviceType;

string MQTT_IP;
string MQTT_PORT;
string MQTT_USERNAME;
string MQTT_PASSWORD;

public void Init(ScreenDeviceType DeviceType)
{
MqttPushs.Name = DeviceType;
@@ -33,7 +38,12 @@ namespace BPASmartClient.Business
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(DeviceType)) ;
});
mQTTProxy.Connect("admin", "public", "10.2.1.254", 1883, $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
MQTT_IP = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_IP"].ToString();
MQTT_PORT = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_Port"].ToString();
MQTT_USERNAME = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_User"].ToString();
MQTT_PASSWORD = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_Password"].ToString();

mQTTProxy.Connect(MQTT_USERNAME, MQTT_PASSWORD, MQTT_IP, int.Parse(MQTT_PORT), $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");//"10.2.1.254""admin", "public"
}

public void Start()


+ 11
- 0
BPASmartClient.Model/乐白机器人/Enum/Lebai_qsqdCode.cs View File

@@ -8,6 +8,17 @@ namespace BPASmartClient.Model.乐白机器人.Enum
{
public class Lebai_qsqdCode
{
//取餐口 0 号输入 光电传感器
//Tcp 1号输入 手臂传感器

//落杯器 输出 1号
//落杯器 输入 1号
#region 咖啡流程

#endregion


#region 且时且多设备
public const int SENCE_自嗨 = 10008;
public const int SENCE_取咖啡杯 = 10031;


+ 16
- 10
BPASmartClient.Model/大炒/FryPotMessages.cs View File

@@ -1,4 +1,5 @@
using System;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -11,15 +12,23 @@ namespace BPASmartClient.Model.大炒
public string GoodName { get; set; }
public string GoodKey { get; set; }
public List<FryPotProcess> fryPotProcesses { get; set; } = new List<FryPotProcess>();
public int FryOffStirTime;//关火翻炒时间;
/// <summary>
/// 翻转速度0到800
/// </summary>
public int TurnSpeed { get; set; } = 0;
/// <summary>
/// 关火翻炒时间;
/// </summary>
public int FryOffStirTime;
}

public class FryPotProcess
public class FryPotProcess:ObservableObject
{
/// <summary>
/// 步骤
/// </summary>
public int FryTime { get; set; }
public int FryTime { get { return _fryTime; } set { _fryTime = value; OnPropertyChanged(); } }
private int _fryTime;
/// <summary>
/// 动作
/// </summary>
@@ -36,10 +45,7 @@ namespace BPASmartClient.Model.大炒
/// 搅拌挡位 小炒1-10 大炒1-5
/// </summary>
public int StirGear { get; set; } = 0;
/// <summary>
/// 翻转速度0到800
/// </summary>
public int TurnSpeed { get; set; }= 0;
/// <summary>
/// 炒制位置1到4
/// </summary>
@@ -67,8 +73,8 @@ namespace BPASmartClient.Model.大炒
{
冷锅加热,
热油,
加调料,
加辅料,
机器人加调料,
通道出调料,
炒制菜品,
}


+ 57
- 14
BPASmartClient.Model/大炒/RobotActionModel.cs View File

@@ -9,24 +9,67 @@ namespace BPASmartClient.Model.大炒
public class RobotAction_Pot
{
public int Pot { get; set; }
public RobotActionModel robotActionModel { get; set; }
public MainTask MainTask { get; set; }
public SubTask1 subTask1 { get; set; } = 0;
public SubTask2 subTask2 { get; set; } = 0;
public SubTask3 subTask3 { get; set; } = 0;
public SubTask4 subTask4 { get; set; } = 0;
}

public enum RobotActionModel

public enum MainTask
{
无任务,
机器人炒制任务,
机器人补料任务,
}
public enum SubTask1
{
无任务,
取1号炒锅荤菜盆倒1号炒锅,
取1号炒锅素菜盆1倒1号炒锅,
取1号炒锅素菜盆2倒1号炒锅,
取1号炒锅调料盆倒入1号炒锅,
取1号炒锅辅料盆1倒入1号炒锅,
取1号空盆出餐,
机器人取1号菜盆,
机器人取2号菜盆,
机器人取3号菜盆,
机器人取4号菜盆,
机器人取5号菜盆,
机器人取6号菜盆,
机器人取7号菜盆,
机器人取8号菜盆,
机器人取9号菜盆,
机器人取1号调料,
机器人取2号调料,
机器人取3号调料,
机器人取4号调料,
机器人取5号调料,
机器人取6号调料,
机器人取1号空盆,
机器人取2号空盆,
机器人取3号空盆,
机器人取4号空盆,

取2号炒锅荤菜盆1倒2号炒锅 = 20,
取2号炒锅素菜盆1倒2号炒锅 = 21,
取2号炒锅素菜盆2倒2号炒锅 =22,
取2号炒锅调料盆倒入2号炒锅 =23,
取2号炒锅辅料盆1倒入2号炒锅 =24,
取2号空盆出餐 =25,
}
public enum SubTask2
{
无任务,
倒料至1号锅,
倒料至2号锅,
}

public enum SubTask3
{
无任务,
机器人上料口取料
}
public enum SubTask4
{
无任务,
放盆至1号库位,
放盆至2号库位,
放盆至3号库位,
放盆至4号库位,
放盆至5号库位,
放盆至6号库位,
放盆至7号库位,
放盆至8号库位,
}

}

+ 150
- 306
BPASmartClient.MorkBF/Control_MorkBF.cs View File

@@ -51,6 +51,7 @@ namespace BPASmartClient.MorkBF
DataParse();//数据解析
ScreenDataServer();//大屏数据上报
ActionManage.GetInstance.Send("更新菜单");
//ThreadManage.GetInstance().Start(FirePot1_Process, "炒锅1流程");
DeviceProcessLogShow("MORKF 设备初始化完成");
}

@@ -64,9 +65,7 @@ namespace BPASmartClient.MorkBF
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
DeviceProcessLogShow($"接收到{OrderCount}次订单");
}

});
}

@@ -122,17 +121,8 @@ namespace BPASmartClient.MorkBF
ActionManage.GetInstance.Register(FirePot_PotReversal, "FirePot_PotReversal");//翻转反转
#endregion
#region 机器人
ActionManage.GetInstance.Register(RobotStart, "RobotStart");//机器人启动
ActionManage.GetInstance.Register(RobotStop, "RobotStop");//机器人停止
ActionManage.GetInstance.Register(RobotReset, "RobotReset");//复位
ActionManage.GetInstance.Register(RobotProgramStart, "RobotProgramStart");//程序启动
ActionManage.GetInstance.Register(Robot_Pot1AllowInMaterail, "Robot_Pot1AllowInMaterail");//1号炒锅允许机器人投料
ActionManage.GetInstance.Register(Robot_Pot1OutFoodInSlowDown, "Robot_Pot1OutFoodInSlowDown");//1号炒锅出餐倒料到减速位
ActionManage.GetInstance.Register(Robot_Pot1OutFood, "Robot_Pot1OutFoodInSlowDown");//1号炒锅出餐倒料完成
ActionManage.GetInstance.Register(Robot_Pot2AllowInMaterail, "Robot_Pot2AllowInMaterail");//2号炒锅允许机器人投料
ActionManage.GetInstance.Register(Robot_Pot2OutFoodInSlowDown, "Robot_Pot2OutFoodInSlowDown");//2号炒锅出餐倒料到减速位
ActionManage.GetInstance.Register(Robot_Pot2OutFood, "Robot_Pot2OutFood");//2号炒锅出餐倒料完成
ActionManage.GetInstance.Register(RobotActionStart, "Robot_Pot2OutFood");//2号炒锅出餐倒料完成
ActionManage.GetInstance.Register(RobotAction, "RobotAction");//上使能


#endregion
@@ -141,12 +131,8 @@ namespace BPASmartClient.MorkBF

public override void MainTask()
{
if(morkBF.FirePan1_Order.Count>0&& morkBF.FirePot1_InitCompleted&&morkBF.FirePot2_IsAuto&&!morkBF.FirePan1_Busy)
{
ThreadManage.GetInstance().Start(FirePot1_Process, "炒锅1流程");
}

if(morkBF.RobotActinQueue.Count>0&&! morkBF.Robot_Origin)//机器人在原点为
if(morkBF.RobotActinQueue.Count>0&&! morkBF.Robot_Start)//机器人启动
{
if( morkBF.RobotActinQueue.TryDequeue(out RobotAction_Pot robotAction))
{
@@ -158,44 +144,48 @@ namespace BPASmartClient.MorkBF

private void FirePot1_Process()
{
if(morkBF.FirePan1_Order.TryDequeue(out FryPotMessages result))
if (morkBF.FirePan1_Order.Count > 0 && morkBF.FirePot1_InitCompleted && morkBF.FirePot2_IsAuto && !morkBF.FirePan1_Busy)
{

morkBF.FirePan1_Busy = true;
morkBF.FryPot1_CurrentProcess = result.fryPotProcesses;
foreach (var item in result.fryPotProcesses)
if (morkBF.FirePan1_Order.TryDequeue(out FryPotMessages result))
{
switch (item.fryActions)

morkBF.FirePan1_Busy = true;
morkBF.FryPot1_CurrentProcess = result.fryPotProcesses;
foreach (var item in result.fryPotProcesses)
{
case FryAction.冷锅加热:
FirePot_PotPerHeat(item, 1);
MessageLog.GetInstance.Show("炒锅1---冷锅加热完成");
break;

case FryAction.热油:
FirePot_HeatOil(item,1);
MessageLog.GetInstance.Show("炒锅1---热油完成");
break;
case FryAction.加调料:
FirePot_AddSeasoning(item, 1);
MessageLog.GetInstance.Show("炒锅1---加调料完成");
break;
case FryAction.加辅料:
FirePot_AddAccessories(item,1);
MessageLog.GetInstance.Show("炒锅1---加辅料完成");
break;
case FryAction.炒制菜品:
FirePot_FryFood(item,1);
MessageLog.GetInstance.Show("炒锅1---炒制菜品完成");
break;

default:
break;
switch (item.fryActions)
{
case FryAction.冷锅加热:
FirePot_PotPerHeat(item, 1);
MessageLog.GetInstance.Show("炒锅1---冷锅加热完成");
break;
case FryAction.热油:
FirePot_HeatOil(item, 1);
MessageLog.GetInstance.Show("炒锅1---热油完成");
break;
case FryAction.机器人加调料:
FirePot_RobotGetSeasoning(item, 1);
MessageLog.GetInstance.Show("炒锅1---机器人加调料完成");
break;
case FryAction.通道出调料:
FirePot_PasswayOutSeasoning(item, 1);
MessageLog.GetInstance.Show("炒锅1---通道出调料完成");
break;
case FryAction.炒制菜品:
FirePot_FryFood(item, 1);
MessageLog.GetInstance.Show("炒锅1---炒制菜品完成");
break;
default:
break;
}
}
FirePot_StartFire(new object[] { 1, false });//关火
Thread.Sleep(result.FryOffStirTime*1000);//关火翻炒时间
FirePot_StartStir(new object[] { 1, false });//关闭搅拌
Message.MessageLog.GetInstance.Show($"炒锅1炒制{result.GoodName}完成");

}
}
}
}

private void FirePot2_Process()
@@ -206,13 +196,21 @@ namespace BPASmartClient.MorkBF

#region 炒锅流程功能

private bool IsRobotNextWork(List<FryPotProcess> currentProcess, int currentFryTime)
/// <summary>
/// 判断下个动作是否需要机器人
/// </summary>
/// <param name="i"></param>
/// <param name="currentFryTime"></param>
/// <returns></returns>
private bool IsRobotNextWork(int i, int currentFryTime)
{
bool res = false;
if(currentProcess.Count> currentFryTime)
List<FryPotProcess> currentProcess = new List<FryPotProcess>();
currentProcess = i == 1 ? morkBF.FryPot1_CurrentProcess: morkBF.FryPot2_CurrentProcess;
if (currentProcess.Count> currentFryTime)
{
if (currentProcess[currentFryTime + 1].fryActions == FryAction.加调料 ||
currentProcess[currentFryTime + 1].fryActions == FryAction.加辅料 ||
if (currentProcess[currentFryTime + 1].fryActions == FryAction.机器人加调料 ||
currentProcess[currentFryTime + 1].fryActions == FryAction.炒制菜品)
{
res = true;
@@ -227,19 +225,11 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotPerHeat(FryPotProcess item,int i)
{
bool isRobotWork = false;
if(i == 1)//炒锅1
{
//FirePot1_SetFireGear(item.FryGear);
Thread.Sleep(200);
//FirePot1_StartFire(true);
isRobotWork = IsRobotNextWork(morkBF.FryPot1_CurrentProcess,item.FryTime);
}
else if(i == 2)//炒锅2
{
//FirePot2_SetFireGear(item.FryGear);
//FirePot2_StartFire(true);
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);
}
FirePot_SetFireGear(new object[]{ i, item.FryGear});//设定加热挡位
FirePot_StartFire(new object[] { i, true });
isRobotWork = IsRobotNextWork(i,item.FryTime);//下个流程动作是否需要机器人

if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料
else Thread.Sleep(item.FryDuration * 1000);

@@ -254,91 +244,66 @@ namespace BPASmartClient.MorkBF
bool isRobotWork = false;
if (item.FryGear != 0)
{
/* FirePot1_SetFireGear(item.FryGear);*///设定加热挡位
//FirePot1_StartFire(true);//开启加热
//isRobotWork = IsRobotNextWork(morkBF.FryPot1_CurrentProcess, item.FryTime);
FirePot_SetFireGear(new object[] { i, item.FryGear });//设定加热挡位
FirePot_StartFire(new object[] { i, true });
}
if (item.StirGear != 0)
{
//FirePot1_SetStirGear(item.StirGear);//设定搅拌挡位
//FirePot1_StartFire(true);//开启搅拌
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);
FirePot_SetStirGear(new object[] { i, item.StirGear });//设定搅拌挡位
FirePot_StartStir(new object[] { i, true });
}
isRobotWork = IsRobotNextWork(i, item.FryTime);
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料
else Thread.Sleep(item.FryDuration * 1000);//加热时间;
}

/// <summary>
/// 调料
/// 通道出调料
/// </summary>
private void FirePot_AddSeasoning(FryPotProcess item,int i)
private void FirePot_PasswayOutSeasoning(FryPotProcess item,int i)
{

if(i == 1)
{
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot =1,robotActionModel = RobotActionModel.取1号炒锅调料盆倒入1号炒锅});
Thread.Sleep(item.FryDuration);

}

else if(i == 2)
foreach(var acc in item.accessories)
{
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 2, robotActionModel = RobotActionModel.取2号炒锅调料盆倒入2号炒锅 });
Thread.Sleep(item.FryDuration);
FirePot_StartPassWay(new object[] { i, acc.Loc, acc.Qry });
}
}

/// <summary>
/// 加辅
/// 机器人取调料
/// </summary>
private void FirePot_AddAccessories(FryPotProcess item, int i)
private void FirePot_RobotGetSeasoning(FryPotProcess item, int i)
{
if (i == 1)
{
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 1, robotActionModel = RobotActionModel.取1号炒锅辅料盆1倒入1号炒锅 });
Thread.Sleep(item.FryDuration);

}

else if (i == 2)
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot
{
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 2, robotActionModel = RobotActionModel.取2号炒锅辅料盆1倒入2号炒锅 });
Thread.Sleep(item.FryDuration);
}

Pot = i,
MainTask = BPASmartClient.Model.大炒.MainTask.机器人炒制任务,
subTask1 = (SubTask1)item.accessories[0].Loc + 9,
subTask2 = (SubTask2)i
});
}



/// <summary>
/// 炒制菜品
/// </summary>
private void FirePot_FryFood(FryPotProcess item, int i)
{
bool isRobotWork = false;
if (i == 1)
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot
{
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 1, robotActionModel = (RobotActionModel)item.accessories[0].Loc });
while (!morkBF.FirePot1_CompleteSingle[item.accessories[0].Loc])//取菜信号是否完成
{
Thread.Sleep(100);
}
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);

}

else if (i == 2)
Pot = i,
MainTask = BPASmartClient.Model.大炒.MainTask.机器人炒制任务,
subTask1 = (SubTask1)item.accessories[1].Loc,
subTask2 =(SubTask2)i
});
while (!morkBF.FirePot1_CompleteSingle[item.accessories[0].Loc])//取菜信号是否完成
{
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 2, robotActionModel = (RobotActionModel)(item.accessories[0].Loc+19) });//炒制菜品位置
while (!morkBF.FirePot2_CompleteSingle[item.accessories[0].Loc])//取菜信号是否完成
{
Thread.Sleep(100);
}
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);
Thread.Sleep(100);
}
isRobotWork = IsRobotNextWork(i, item.FryTime);
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料
else Thread.Sleep(item.FryDuration * 1000);//加热时间;
}
@@ -350,76 +315,59 @@ namespace BPASmartClient.MorkBF
/// <param name="robotAction"></param>
private void RobotProcess(RobotAction_Pot robotAction)
{
Robot_Write("GI0",(int)robotAction.robotActionModel);
while (morkBF.Robot_ActionCallback != (int)robotAction.robotActionModel)//机器人动作执行完动作反馈
Robot_Write("GI0", (int)robotAction.MainTask);//设定机器人主要任务
while(morkBF.Robot_GI0ActionCallback != (int)robotAction.MainTask)//等待主程序完成反馈
{
Thread.Sleep(100);
Thread.Sleep(300);
}
if(robotAction.Pot == 1)//炒锅1
if((int)robotAction.subTask1>0&& (int)robotAction.subTask1<16)//任务1
{
if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐)
Robot_Write("GI1", (int)robotAction.subTask1);
Thread.Sleep(1000);
while (morkBF.Robot_GI1ActionCallback != (int)robotAction.subTask1)//等待子程序1完成反馈
{
Robot_Write("GM520", true);//机器人去出餐倒料减速位置
while(!morkBF.Robot_ArriveFirePot1)//机器人到位,请求1#炒锅倒菜
{
Thread.Sleep(100);
}
FirePot_StartOutFood(1);//炒锅出餐;
while (!morkBF.FirePot1_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈
{
Thread.Sleep(1000);
}
Thread.Sleep(6 * 1000);//等待6s出餐
Robot_Write("GM521", true);//机器人出餐到料完成
Thread.Sleep(300);
}
}
if((int)robotAction.subTask1>15) //出餐
{

}

if ((int)robotAction.subTask2 > 0)//任务2
{
Robot_Write("GI2", (int)robotAction.subTask2);
Thread.Sleep(1000);
while (morkBF.Robot_GI2ActionCallback != (int)robotAction.subTask2)//等待子程序2完成反馈
{
Thread.Sleep(300);
}
else
while (morkBF.Robot_OutMaterialCompleted)//等待子程序2完成反馈
{
//FirePot_Write("M11.6", true);//炒锅去投料位置
while (!morkBF.FirePot1_PotOnIntoFoodPosition)//等待炒锅允许倒料
{
Thread.Sleep(100);
}
Robot_Write("GM531", true);//机器人投料
Thread.Sleep(300);
}
}
else if (robotAction.Pot == 2)
if ((int)robotAction.subTask3 > 0)//任务3
{
if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐)
{
Robot_Write("GM522", true);//炒锅去出餐倒料减速位置
while (!morkBF.Robot_ArriveFirePot2)//机器人到位,请求1#炒锅倒菜
{
Thread.Sleep(100);
}
FirePot_StartOutFood(2);//炒锅去出餐倒料位置
while (!morkBF.FirePot2_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈
{
Thread.Sleep(1000);
}
Thread.Sleep(6 * 1000);//等待20s出餐
Robot_Write("GM523", true);//机器人出餐倒料完成

}
else
Robot_Write("GI3", (int)robotAction.subTask3);
Thread.Sleep(1000);
while (morkBF.Robot_GI3ActionCallback != (int)robotAction.subTask3)//等待子程序3完成反馈
{
//FirePot_Write("M16.7", true);
while (!morkBF.FirePot2_PotOnIntoFoodPosition)
{
Thread.Sleep(100);
}
Robot_Write("GM531", true);
Thread.Sleep(300);
}
}
while(!morkBF.Robot_Origin)
if ((int)robotAction.subTask4 > 0)//任务4
{
Robot_Write("GI4", (int)robotAction.subTask4);
Thread.Sleep(1000);
while (morkBF.Robot_GI4ActionCallback != (int)robotAction.subTask4)//等待主程序4完成反馈
{
Thread.Sleep(300);
}
}
morkBF.Robot_IsBusy = false;
MessageLog.GetInstance.Show($"机器人完成[{robotAction.robotActionModel.ToString()}]任务");


MessageLog.GetInstance.Show($"机器人完成[{robotAction.MainTask.ToString()}]任务");
}

public override void ReadData()
@@ -501,45 +449,7 @@ namespace BPASmartClient.MorkBF

}
}), 0);
GetStatus("GM500", new Action<object>((o) =>
{
if (o == null) return;
if (o is bool[] values && values.Length == 7)
{

morkBF.FirePot1_CompleteSingle[0] = values[0];
morkBF.FirePot1_CompleteSingle[1] = values[1];
morkBF.FirePot1_CompleteSingle[2] = values[2];
morkBF.Robot_FirePot1OutSeasoning = values[3];
morkBF.Robot_FirePot1OutAccessories = values[4];
morkBF.Robot_ArriveFirePot1 = values[5];
morkBF.Robot_FirePot1OutFoodComplete = values[6];

}
}), 1);
GetStatus("GM510", new Action<object>((o) =>
{
if (o == null) return;
if (o is bool[] values && values.Length == 7)
{
morkBF.FirePot2_CompleteSingle[0] = values[0];
morkBF.FirePot2_CompleteSingle[1] = values[1];
morkBF.FirePot2_CompleteSingle[2] = values[2];
morkBF.Robot_FirePot2OutSeasoning = values[3];
morkBF.Robot_FirePot2OutAccessories = values[4];
morkBF.Robot_ArriveFirePot2 = values[5];
morkBF.Robot_FirePot2OutFoodComplete = values[6];

}
}), 1);
GetStatus("GI5", new Action<object>((o) =>
{
if (o == null) return;
if (o is int[] values && values.Length == 1)
{
morkBF.Robot_ActionCallback = values[0];
}
}), 1);

GetStatus("VW2250", new Action<object>((o) =>
{
@@ -836,7 +746,6 @@ namespace BPASmartClient.MorkBF
{
FirePot2_Write("M10.6", true);
}

}
Thread.Sleep(200);
}
@@ -971,98 +880,33 @@ namespace BPASmartClient.MorkBF
#endregion

#region 机器人
/// <summary>
/// 机器人启动
/// </summary>
private void RobotStart()
{
Robot_Write("GM600",true);
Thread.Sleep(200);
}
/// <summary>
/// 机器人停止
/// </summary>
private void RobotStop()
private void RobotAction(object[] o)
{
Robot_Write("GM601", true);
Thread.Sleep(200);
}
/// <summary>
/// 机器人复位
/// </summary>
private void RobotReset()
{
Robot_Write("GM602", true);
Thread.Sleep(200);
}
/// <summary>
/// 机器人程序重启
/// </summary>
private void RobotProgramStart()
{
Robot_Write("GM603", true);
Thread.Sleep(200);
}
/// <summary>
/// 1号炒锅允许机器人投料(炒锅在投料位给出)
/// </summary>
private void Robot_Pot1AllowInMaterail()
{
Robot_Write("GM531", true);
Thread.Sleep(200);
}
/// <summary>
/// 1号炒锅出餐倒料到减速位
/// </summary>
private void Robot_Pot1OutFoodInSlowDown()
{
Robot_Write("GM620", true);
Thread.Sleep(200);
}
/// <summary>
/// 1号炒锅出餐倒料完成
/// </summary>
private void Robot_Pot1OutFood()
{
Robot_Write("GM521", true);
Thread.Sleep(200);
}
/// <summary>
/// 2号炒锅允许机器人投料(炒锅在投料位给出)
/// </summary>
private void Robot_Pot2AllowInMaterail()
{
Robot_Write("GM530", true);
Thread.Sleep(200);
}
/// <summary>
/// 2号炒锅出餐倒料到减速位。开始倒菜
/// </summary>
private void Robot_Pot2OutFoodInSlowDown()
{
Robot_Write("GM522", true);
Thread.Sleep(200);
}
/// <summary>
/// 2号炒锅出餐倒料完成
/// </summary>
private void Robot_Pot2OutFood()
{
Robot_Write("GM523", true);
Thread.Sleep(200);
}
/// <summary>
///
/// </summary>
private void RobotActionStart(object o)
{
if (o == null) return;
if(int.TryParse(o.ToString(), out int value))
if (o[0] is int value)
{
Robot_Write("GI0",value);
switch (value)
{
case 0:
Robot_Write("GI0", (ushort)(MainTask)o[1]);
break;
case 1:
Robot_Write("GI1", (ushort)(SubTask1)o[1]);
break;
case 2:
Robot_Write("GI2", (ushort)(SubTask2)o[1]);
break;
case 3:
Robot_Write("GI3", (ushort)(SubTask3)o[1]);
break;
case 4:
Robot_Write("GI4", (ushort)(SubTask4)o[1]);
break;
default:
break;
}
}
Thread.Sleep(200);
}

#endregion


@@ -1082,7 +926,7 @@ namespace BPASmartClient.MorkBF
IsRun = IsHealth ? IsRun.运行 : IsRun.停止,
WorkStatus_1 = morkBF.FirePot1_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机,
WorkStatus_2 = morkBF.FirePot2_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机,
RobotStatu = morkBF.Robot_ActionCallback == 0? WorkStatus.待机 : WorkStatus.工作,
RobotStatu = WorkStatus.工作,
Alarm = new List<AlarmModel>(),
FailuresCount = 0,
StatsCount = statsModels,


+ 6
- 6
BPASmartClient.MorkBF/Convert/FryActionToVisibilityConverter.cs View File

@@ -25,10 +25,10 @@ namespace BPASmartClient.MorkBF.Convert
case FryAction.热油:
visibility = Visibility.Visible;
break;
case FryAction.加调料:
case FryAction.机器人加调料:
visibility = Visibility.Collapsed;
break;
case FryAction.加辅料:
case FryAction.通道出调料:
visibility = Visibility.Collapsed;
break;
case FryAction.炒制菜品:
@@ -63,10 +63,10 @@ namespace BPASmartClient.MorkBF.Convert
case FryAction.热油:
visibility = Visibility.Visible;
break;
case FryAction.加调料:
case FryAction.机器人加调料:
visibility = Visibility.Collapsed;
break;
case FryAction.加辅料:
case FryAction.通道出调料:
visibility = Visibility.Collapsed;
break;
case FryAction.炒制菜品:
@@ -101,10 +101,10 @@ namespace BPASmartClient.MorkBF.Convert
case FryAction.热油:
visibility = Visibility.Collapsed;
break;
case FryAction.加调料:
case FryAction.机器人加调料:
visibility = Visibility.Visible;
break;
case FryAction.加辅料:
case FryAction.通道出调料:
visibility = Visibility.Visible;
break;
case FryAction.炒制菜品:


+ 15
- 20
BPASmartClient.MorkBF/GVL_MorkBF.cs View File

@@ -284,22 +284,22 @@ namespace BPASmartClient.MorkBF
/// 机器人上使能
/// </summary>
[VariableMonitor("机器人上使能", "GM600.0", "4596")]
public bool Robot_FirePot1OutMeal { get; set; }
public bool Robot_Enable { get; set; }
/// <summary>
/// 机器人复位
/// </summary>
[VariableMonitor("机器人复位", "GM600.1", "4597")]
public bool Robot_FirePot1OutVegetables1 { get; set; }
public bool Robot_Reset { get; set; }
/// <summary>
/// 机器人启动
/// </summary>
[VariableMonitor("机器人启动", "GM600.2", "4598")]
public bool Robot_FirePot1OutVegetables2 { get; set; }
public bool Robot_Start { get; set; }
/// <summary>
/// 机器人停止
/// </summary>
[VariableMonitor("机器人停止", "GM600.3", "4599")]
public bool Robot_FirePot1OutSeasoning { get; set; }
public bool Robot_Stop { get; set; }
/// <summary>
/// 机器人动作反馈GI0
/// </summary>
@@ -309,22 +309,22 @@ namespace BPASmartClient.MorkBF
/// 机器人动作反馈GI1
/// </summary>
[VariableMonitor("机器人动作反馈GI1", "GI1", "1")]
public int Robot_GI1ActionCallback0 { get; set; }
public int Robot_GI1ActionCallback { get; set; }
/// <summary>
/// 机器人动作反馈GI2
/// </summary>
[VariableMonitor("机器人动作反馈GI2", "GI2", "2")]
public int Robot_GI2ActionCallback0 { get; set; }
public int Robot_GI2ActionCallback { get; set; }
/// <summary>
/// 机器人动作反馈GI3
/// </summary>
[VariableMonitor("机器人动作反馈GI3", "GI3", "3")]
public int Robot_GI3ActionCallback0 { get; set; }
public int Robot_GI3ActionCallback { get; set; }
/// <summary>
/// 机器人动作反馈GI4
/// </summary>
[VariableMonitor("机器人动作反馈GI4", "GI4", "4")]
public int Robot_GI4ActionCallback0 { get; set; }
public int Robot_GI4ActionCallback { get; set; }

#endregion

@@ -336,18 +336,13 @@ namespace BPASmartClient.MorkBF
public GVL_MorkBF()
{
FirePot1_CompleteSingle = new Dictionary<int, bool>
{
{1,Robot_FirePot1OutMeal },
{2,Robot_FirePot1OutVegetables1 },
{3,Robot_FirePot1OutVegetables2 },
};
FirePot2_CompleteSingle = new Dictionary<int, bool>
{
{1,Robot_FirePot2OutMeal },
{2,Robot_FirePot2OutVegetables1 },
{3,Robot_FirePot2OutVegetables2 },
};
//FirePot1_CompleteSingle = new Dictionary<int, bool>
//{
// {1,Robot_FirePot1OutMeal },
// {2,Robot_FirePot1OutVegetables1 },
// {3,Robot_FirePot1OutVegetables2 },
//};

//炒锅1通道完成信号
Fire1_PasswayCompleteSingle = new Dictionary<int, bool>


+ 17
- 10
BPASmartClient.MorkBF/VIew/DebugView.xaml View File

@@ -129,16 +129,23 @@
<Button Content="机器人启动" Width="110" Margin="10,5" Command="{Binding RobotStartCommand}"/>
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding RobotResetCommand}"/>
<Button Content="程序启动" Width="110" Margin="10,5" Command="{Binding RobotProgramStartCommand}"/>
<Button Content="机器人停止" Width="110" Margin="10,5" Command="{Binding RobotStopCommand}"/>
<Button Content="1号炒锅允许机器人投料" Width="160" Margin="10,5" Command="{Binding Robot_Pot1AllowInMaterailCommand}" Cursor="Hand"/>
<Button Content="1号炒锅出餐倒料到减速位" Width="160" Margin="10,5" Command="{Binding Robot_Pot1OutFoodInSlowDownCommand}" Cursor="Hand"/>
<Button Content="1号炒锅出餐倒料完成" Width="160" Margin="10,5" Command="{Binding Robot_Pot1OutFoodCommand}"/>
<Button Content="2号炒锅允许机器人投料" Width="160" Margin="10,5" Command="{Binding Robot_Pot2AllowInMaterailCommand}"/>
<Button Content="2号炒锅出餐倒料到减速位" Width="160" Margin="10,5" Command="{Binding Robot_Pot2OutFoodInSlowDownCommand}"/>
<Button Content="2号炒锅出餐倒料完成" Width="160" Margin="10,5" Command="{Binding Robot_Pot2OutFoodCommand}"/>
<TextBlock Text="机器人取菜出餐动作" Margin="10,5"/>
<ComboBox ItemsSource="{Binding RobotActions}" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding RobotAction}" Height="30" Width="200" Margin="10,0"/>
<Button Content="动作启动" Width="100" Margin="10,5" Command="{Binding RobotActionStartCommand}"/>
<Button Content="机器人上使能" Width="110" Margin="10,5" Command="{Binding RobotEnableCommand}"/>
<TextBlock Text="主程序任务" Margin="10,5"/>
<ComboBox ItemsSource="{Binding RobotMainTask}" SelectedValue="{Binding MainTask}" Height="30" Width="200" Margin="10,0"/>
<Button Content="任务设定" Width="100" Margin="10,5" Command="{Binding RobotActionCommand}" CommandParameter="0"/>
<TextBlock Text="主程序炒制任务1" Margin="30,5,10,0"/>
<ComboBox ItemsSource="{Binding RobotSubTask1}" SelectedValue="{Binding SubTask1}" Height="30" Width="200" Margin="10,0"/>
<Button Content="任务设定" Width="100" Margin="10,5" Command="{Binding RobotActionCommand}" CommandParameter="1"/>
<TextBlock Text="主程序炒制任务2" Margin="30,5,10,0"/>
<ComboBox ItemsSource="{Binding RobotSubTask2}" SelectedValue="{Binding SubTask2}" Height="30" Width="200" Margin="10,0"/>
<Button Content="任务设定" Width="100" Margin="10,5" Command="{Binding RobotActionCommand}" CommandParameter="2"/>
<TextBlock Text="子程序补料任务1" Margin="30,5,10,0"/>
<ComboBox ItemsSource="{Binding RobotSubTask3}" SelectedValue="{Binding SubTask3}" Height="30" Width="200" Margin="10,0"/>
<Button Content="任务设定" Width="100" Margin="10,5" Command="{Binding RobotActionCommand}" CommandParameter="3"/>
<TextBlock Text="子程序补料任务2" Margin="30,5,10,0"/>
<ComboBox ItemsSource="{Binding RobotSubTask4}" SelectedValue="{Binding SubTask4}" Height="30" Width="200" Margin="10,0"/>
<Button Content="任务设定" Width="100" Margin="10,5" Command="{Binding RobotActionCommand}" CommandParameter="4"/>
</WrapPanel>
</GroupBox>
</Grid>


+ 5
- 3
BPASmartClient.MorkBF/VIew/FoodManagerView.xaml View File

@@ -23,7 +23,7 @@
</ResourceDictionary>
</Window.Resources>
<Border CornerRadius="1,60,00,70" Background="#1E1E1E" >
<Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown">
<Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown" Margin="0,-4,0,4">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不规则矩形.png"/>
</Grid.Background>
@@ -40,12 +40,12 @@
<Button Content="退出" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" Width="80" Click="Button_Click"/>
</StackPanel>
<Grid Grid.Row="1">
<ListBox ItemsSource="{Binding FryPotProcesses}" FontSize="15">
<ListBox ItemsSource="{Binding FryPotProcesses}" FontSize="15" x:Name="mylist">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,10">
<TextBlock Text="步骤--" Margin="10,0,2,0" VerticalAlignment="Center"/>
<TextBlock Text="{Binding FryTime}" VerticalAlignment="Center"/>
<TextBlock Text="{Binding FryTime,Mode=TwoWay}" VerticalAlignment="Center"/>
<TextBlock Text="加热时间--" Margin="10,0,2,0" VerticalAlignment="Center"/>
<TextBox Text="{Binding FryDuration}" Margin="10,0" Width="40" VerticalAlignment="Center"/>
<TextBlock Text="动作--" Margin="10,0,2,0" VerticalAlignment="Center"/>
@@ -66,6 +66,8 @@
Visibility="{Binding fryActions,Converter={StaticResource AccessoriesToVisibilityConverter}}"/>
<TextBox Text="{Binding accessories[0].Loc}" VerticalAlignment="Center" Width="50"
Visibility="{Binding fryActions,Converter={StaticResource AccessoriesToVisibilityConverter}}"/>
<Button Content="删除" Margin="10,0" Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}}"
CommandParameter="{Binding DataContext,RelativeSource={RelativeSource AncestorType=ListBoxItem,Mode=FindAncestor}}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>


+ 1
- 0
BPASmartClient.MorkBF/VIew/FoodManagerView.xaml.cs View File

@@ -29,6 +29,7 @@ namespace BPASmartClient.MorkBF.VIew
{
this.Close();
}), "FoodManagerViewClose");
}

private void Button_Click(object sender, RoutedEventArgs e)


+ 48
- 72
BPASmartClient.MorkBF/ViewModel/DebugViewModel.cs View File

@@ -322,25 +322,23 @@ namespace BPASmartClient.MorkBF.ViewModel


#region 机器人
public Dictionary<int,string> RobotActions { get; set; } = new Dictionary<int, string>()
{
{0, "无任务"},
{1, "取1号炒锅荤菜盆倒1号炒锅"},
{2, "取1号炒锅素菜盆1倒1号炒锅"},
{3, "取1号炒锅素菜盆2倒1号炒锅"},
{4, "取1号炒锅调料盆倒入1号炒锅"},
{5, "取1号炒锅辅料盆1倒入1号炒锅"},
{6, "取1号空盆出餐"},
{20, "取2号炒锅荤菜盆1倒1号炒锅"},
{21, "取2号炒锅素菜盆1倒1号炒锅"},
{22, "取2号炒锅素菜盆2倒1号炒锅"},
{23, "取2号炒锅调料盆倒入1号炒锅"},
{24, "取2号炒锅辅料盆1倒入1号炒锅"},
{25, "取2号空盆出餐"},
};
public ObservableCollection<MainTask> RobotMainTask { get; set; } = new ObservableCollection<MainTask>(Enum.GetValues<MainTask>());
public ObservableCollection<SubTask1> RobotSubTask1 { get; set; } = new ObservableCollection<SubTask1>(Enum.GetValues<SubTask1>());
public ObservableCollection<SubTask2> RobotSubTask2 { get; set; } = new ObservableCollection<SubTask2>(Enum.GetValues<SubTask2>());
public ObservableCollection<SubTask3> RobotSubTask3 { get; set; } = new ObservableCollection<SubTask3>(Enum.GetValues<SubTask3>());
public ObservableCollection<SubTask4> RobotSubTask4 { get; set; } = new ObservableCollection<SubTask4>(Enum.GetValues<SubTask4>());

[ObservableProperty]
private int _robotAction;
private MainTask _mainTask;
[ObservableProperty]
private SubTask1 _subTask1;
[ObservableProperty]
private SubTask2 _subTask2;
[ObservableProperty]
private SubTask3 _subTask3;
[ObservableProperty]
private SubTask4 _subTask4;

/// <summary>
/// 机器人启动
/// </summary>
@@ -366,74 +364,52 @@ namespace BPASmartClient.MorkBF.ViewModel
ActionManage.GetInstance.Send("RobotReset");
}
/// <summary>
/// 程序启动
/// </summary>
[RelayCommand]
private void RobotProgramStart()
{
ActionManage.GetInstance.Send("RobotProgramStart");
}
/// <summary>
/// 1号炒锅允许机器人投料
/// 机器人上使能
/// </summary>
[RelayCommand]
private void Robot_Pot1AllowInMaterail()
private void RobotEnable()
{
ActionManage.GetInstance.Send("Robot_Pot1AllowInMaterail");
}
/// <summary>
/// 1号炒锅出餐倒料到减速位
/// </summary>
[RelayCommand]
private void Robot_Pot1OutFoodInSlowDown()
{
ActionManage.GetInstance.Send("Robot_Pot1OutFoodInSlowDown");
}
/// <summary>
/// 1号炒锅出餐倒料完成
/// </summary>
[RelayCommand]
private void Robot_Pot1OutFood()
{
ActionManage.GetInstance.Send("Robot_Pot1OutFood");
}
/// <summary>
/// 2号炒锅允许机器人投料
/// </summary>
[RelayCommand]
private void Robot_Pot2AllowInMaterail()
{
ActionManage.GetInstance.Send("Robot_Pot2AllowInMaterail");
}
/// <summary>
/// 2号炒锅出餐倒料到减速位
/// </summary>
[RelayCommand]
private void Robot_Pot2OutFoodInSlowDown()
{
ActionManage.GetInstance.Send("Robot_Pot2OutFoodInSlowDown");
}
/// <summary>
/// 2号炒锅出餐倒料完成
/// </summary>
[RelayCommand]
private void Robot_Pot2OutFood()
{
ActionManage.GetInstance.Send("Robot_Pot2OutFood");
ActionManage.GetInstance.Send("RobotEnable");
}

/// <summary>
/// 机器人动作启动
/// 机器人动作
/// </summary>
[RelayCommand]
private void RobotActionStart()
private void RobotAction(object o)
{
ActionManage.GetInstance.Send("RobotProgramStart",RobotAction );
if(int.TryParse(o.ToString(), out int value))
{
object item = new object();
switch (value)
{
case 0:
item = MainTask;
break;
case 1:
item = SubTask1;
break;
case 2:
item = SubTask2;
break;
case 3:
item = SubTask3;
break;
case 4:
item = SubTask4;
break;
default:
break;
}
ActionManage.GetInstance.Send("RobotAction", new object[] { value, item });
}
}


#endregion




}
}

+ 12
- 2
BPASmartClient.MorkBF/ViewModel/FoodManagerViewModel.cs View File

@@ -7,6 +7,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.MorkBF.ViewModel
{
@@ -69,10 +70,19 @@ namespace BPASmartClient.MorkBF.ViewModel
if (o == null) return;
if (o is FryPotProcess value)
{

foreach (var item in FryPotProcesses)
{
if (item.FryTime > value.FryTime)
{
Application.Current?.Dispatcher.Invoke(new Action(() =>
{
item.FryTime -= 1;
}));
}
}
FryPotProcesses.Remove(value);
}
ActionManage.GetInstance.Send("更新菜单");

}




+ 406
- 225
BPASmartClient.MorkF/Control_MorkF.cs
File diff suppressed because it is too large
View File


+ 176
- 2
BPASmartClient.MorkF/GVL_MorkF.cs View File

@@ -1,4 +1,5 @@
using BPA.Models;
using BPA.Message;
using BPA.Models;
using BPASmartClient.Device;
using System;
using System.Collections.Concurrent;
@@ -14,7 +15,7 @@ namespace BPASmartClient.MorkF
/// <summary>
/// 小炒队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> StirFryGoodsQuenes = new ConcurrentQueue<OrderLocInfo>();
public ConcurrentQueue<OrderLocInfo> StirFryGoodsQuenes { get; set; } = new ConcurrentQueue<OrderLocInfo>();

public bool IsAuto = true;

@@ -88,6 +89,176 @@ namespace BPASmartClient.MorkF

#endregion

#region 炒锅大屏相关

/// <summary>
/// 异常订单数量统计
/// </summary>
public int orderAbnormalCount { get; set; } = 0;

/// <summary>
/// 订单数量统计
/// </summary>
public int orderCount { get; set; } = 0;

/// <summary>
/// 当前炒制菜品
/// </summary>
public string GoodName { get; set; }

/// <summary>
/// 当前任务
/// </summary>
public string Task { get; set; }

/// <summary>
/// 当前加热档位
/// </summary>
public string FireNow { get; set; }

/// <summary>
/// 搅拌档位
/// </summary>
public string StirNow { get; set; }

/// <summary>
/// 炒锅当前锅底温度
/// </summary>
public string TempNow { get; set; }

/// <summary>
/// 当前炒锅进展
/// </summary>
public List<ProcessModel> processModels { get; set; } = new List<ProcessModel>();

public void UpdateProcess(PotActions potActions)
{
switch (potActions.Actions)
{
case nameof(StirFryPotActionEnum.搅拌臂炒制位):
//设置为开始
SetState(0);
Task = "开始";
break;
case nameof(StirFryPotActionEnum.加热开启):
Task = "热油";
//设置为热油
SetState(1);
break;
///以下为不处理,炒制菜品可能为热油阶段,不处理,取原料可能在开启后立即开始
case nameof(StirFryPotActionEnum.取原料):
case nameof(StirFryPotActionEnum.炒制菜品):
break;
case nameof(StirFryPotActionEnum.设置搅拌挡位1):
StirNow = "1";
break;
case nameof(StirFryPotActionEnum.设置搅拌挡位2):
StirNow = "2";
break;
case nameof(StirFryPotActionEnum.设置搅拌挡位3):
StirNow = "3";
break;
case nameof(StirFryPotActionEnum.关闭搅拌):
StirNow = "0";
break;
case nameof(StirFryPotActionEnum.设置加热挡位1):
TempNow = "60";
FireNow = "1";
break;
case nameof(StirFryPotActionEnum.设置加热挡位2):
TempNow = "100";
FireNow = "2";
break;
case nameof(StirFryPotActionEnum.设置加热挡位3):
TempNow = "120";
FireNow = "3";
break;
case nameof(StirFryPotActionEnum.设置加热挡位4):
TempNow = "150";
FireNow = "4";
break;
case nameof(StirFryPotActionEnum.设置加热挡位5):
TempNow = "200";
FireNow = "5";
break;
case nameof(StirFryPotActionEnum.设置加热挡位6):
TempNow = "250";
FireNow = "6";
break;
case nameof(StirFryPotActionEnum.设置加热挡位7):
TempNow = "300";
FireNow = "7";
break;
case nameof(StirFryPotActionEnum.设置加热挡位8):
TempNow = "350";
FireNow = "8";
break;
case nameof(StirFryPotActionEnum.设置加热挡位9):
TempNow = "400";
FireNow = "9";
break;
case nameof(StirFryPotActionEnum.设置加热挡位10):
TempNow = "500";
FireNow = "10";
break;
///以下为待定
case nameof(StirFryPotActionEnum.停止加热):
break;
case nameof(StirFryPotActionEnum.开启搅拌):
break;
case nameof(StirFryPotActionEnum.道菜启动):
case nameof(StirFryPotActionEnum.加调料):
Task = "炒制";
//设置为炒制
SetState(2);
break;
case nameof(StirFryPotActionEnum.出餐启动):
Task = "出餐";
SetState(3);
break;
///设置为结束
case nameof(StirFryPotActionEnum.搅拌臂原点位):
case nameof(StirFryPotActionEnum.洗锅):
Task = "完成";
SetState(4);
break;
default:
break;

}
}

private void SetState(int c)
{
for (int i = 0; i < processModels.Count; i++)
{
if (i == c)
{
processModels[i].Status = ProcessStatus.正在执行;
}
else if (i < c) processModels[i].Status = ProcessStatus.执行完成;
else if (i > c) processModels[i].Status = ProcessStatus.未执行;
}
}

public void ScreenInit()
{
Task = "准备";
processModels.Clear();
//初始化进度列表
processModels.Add(new ProcessModel() { Id = 1, Name = "开始", Status = ProcessStatus.未执行 });
processModels.Add(new ProcessModel() { Id = 2, Name = "热油", Status = ProcessStatus.未执行 });
processModels.Add(new ProcessModel() { Id = 3, Name = "炒制", Status = ProcessStatus.未执行 });
processModels.Add(new ProcessModel() { Id = 4, Name = "出餐", Status = ProcessStatus.未执行 });
processModels.Add(new ProcessModel() { Id = 5, Name = "完成", Status = ProcessStatus.未执行 });
}
public void ScreenClear()
{
processModels.Clear();
Task = string.Empty;
GoodName = string.Empty;
}
#endregion
#region 调料通道
public bool PassWay1_1Compelete { get; set; }
public bool PassWay1_2Compelete { get; set; }
@@ -122,6 +293,9 @@ namespace BPASmartClient.MorkF
PassWay1_Compelete.Add(12,PassWay1_12Compelete);
PassWay1_Compelete.Add(13,PassWay1_13Compelete);
PassWay1_Compelete.Add(14,PassWay1_14Compelete);

////初始化进度列表
//ScreenInit();
}

/// <summary>


+ 8
- 2
BPASmartClient.MorkF/View/DebugView.xaml View File

@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkF.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkF.ViewModel"
x:Name="调试界面"
mc:Ignorable="d"
d:DesignHeight="900" d:DesignWidth="1300">
<UserControl.DataContext>
@@ -19,6 +20,9 @@
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<ScrollViewer>
<Grid>

<Grid.RowDefinitions>
<RowDefinition Height="81" ></RowDefinition>
<RowDefinition Height="81" ></RowDefinition>
@@ -106,8 +110,8 @@
<Button Content="设置" Margin="10,0,5,0" Command="{Binding SetNowPosition}"/>
</WrapPanel>
<WrapPanel Grid.Row="3" Orientation="Horizontal" >
<Button Content="夹爪正转" Command="{Binding PawTurnFront}" Margin="5,0" Cursor="Hand"/>
<Button Content="夹爪反转" Command="{Binding PawTurnBack}" Margin="5,0" Cursor="Hand"/>
<Button Content="夹爪伸出" Command="{Binding PawTurnFront}" Margin="5,0" Cursor="Hand"/>
<Button Content="夹爪收缩" Command="{Binding PawTurnBack}" Margin="5,0" Cursor="Hand"/>
<RadioButton Content="位置1" Margin="5,0" IsEnabled="True" IsChecked="{Binding PawPositon1}" Command="{Binding PawToPoint1}" GroupName="PawTurn"/>
<RadioButton Content="位置2" Margin="5,0" IsEnabled="True" IsChecked="{Binding PawPositon2}" Command="{Binding PawToPoint2}" GroupName="PawTurn"/>
<RadioButton Content="位置3" Margin="5,0 " IsEnabled="True" IsChecked="{Binding PawPositon3}" Command="{Binding PawToPoint3}" GroupName="PawTurn"/>
@@ -188,5 +192,7 @@

</StackPanel>

</Grid>
</ScrollViewer>
</Grid>
</UserControl>

+ 697
- 0
BPASmartClient.MorkF/View/MaterialCalibration.xaml View File

@@ -0,0 +1,697 @@
<UserControl x:Class="BPASmartClient.MorkF.View.MaterialCalibration"
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"
xmlns:vm="clr-namespace:BPASmartClient.MorkF.ViewModel"
x:Name="菜品库校验"
mc:Ignorable="d"
d:DesignHeight="1000" d:DesignWidth="1300">
<UserControl.DataContext>
<vm:MaterialCalibrationViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>

<!--#region 用户输入框样式-->
<Style x:Key="UserTextBoxStyle" TargetType="TextBox">
<!--<Setter Property="Background" Value="Transparent" />-->
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border
x:Name="border"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="{TemplateBinding FontSize}"
Foreground="#a2c2e8"
Text="数据有效值为1-100"
Visibility="Collapsed" />


<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>

<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="border" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
</Trigger>
<DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</ResourceDictionary>
</UserControl.Resources>

<Grid>
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="150" ></RowDefinition>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="菜品库第一层" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid Height="150">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置1" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionOne}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding OneX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding OneY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置2" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwo}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwoX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwoY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置3" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionThree}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding ThreeX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding ThreeY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>

<WrapPanel Grid.Row="1" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置4" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionFour}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding FourX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding FourY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置5" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionFive}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding FiveX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding FiveY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置6" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionSix}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding SixX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SixY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>
<WrapPanel Grid.Row="2" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置7" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionSeven}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding SevenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SevenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置8" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionEight}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding EightX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding EightY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置9" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionNine}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding NineX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding NineY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>
</Grid>
</GroupBox>

<GroupBox Grid.Row="1" Header="菜品库第二层" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid Height="150">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置10" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置11" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionEleven}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding ElevenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding ElevenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置12" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwelve}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwelveX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwelveY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>

<WrapPanel Grid.Row="1" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置13" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionThirteen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding ThirteenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding ThirteenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置14" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionFourteen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding FourteenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding FourteenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置15" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionFifteen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding FifteenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding FifteenY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>
<WrapPanel Grid.Row="2" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置16" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionSixteen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding SixteenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SixteenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置17" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionSeventeen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding SeventeenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SeventeenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置18" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionEighteen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding EighteenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding EighteenY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>
</Grid>
</GroupBox>

<GroupBox Grid.Row="2" Header="菜品库第三层" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid Height="150">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置19" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionNineteen}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding NineteenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding NineteenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置20" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwenty}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentyX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentyY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置21" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentyOne}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentyOneX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentyOneY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>

<WrapPanel Grid.Row="1" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置22" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentyTwo}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentyTwoX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentyTwoY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置23" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentyThree}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentyThreeX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentyThreeY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置24" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentyFour}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentyFourX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentyFourY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>
<WrapPanel Grid.Row="2" Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置25" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentyFive}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentyFiveX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentyFiveY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置26" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentySix}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentySixX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SeventeenY}" Width="100"/>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="位置27" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionTwentySeven}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding TwentySevenX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding TwentySevenY}" Width="100"/>
</Grid>
</Grid>
</WrapPanel>
</Grid>
</GroupBox>


<GroupBox Grid.Row="3" Header="操作" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<WrapPanel>
<Button Content="菜品库初始化" Margin="10,0,5,0" Command="{Binding FoodLibInit}"/>
<Button Content="电磁阀启动" Margin="10,0,5,0" Command="{Binding StartElectromagnetism}"/>
<Button Content="电磁阀停止" Margin="10,0,5,0" Command="{Binding StopElectromagnetism}"/>
<Button Content="夹爪伸出" Command="{Binding PawTurnFront}" Margin="5,0" Cursor="Hand"/>
<Button Content="夹爪收缩" Command="{Binding PawTurnBack}" Margin="5,0" Cursor="Hand"/>
<RadioButton Content="位置1" Margin="5,0" IsEnabled="True" IsChecked="{Binding PawPositon1}" Command="{Binding PawToPoint1}" GroupName="PawTurn"/>
<RadioButton Content="位置2" Margin="5,0" IsEnabled="True" IsChecked="{Binding PawPositon2}" Command="{Binding PawToPoint2}" GroupName="PawTurn"/>
<RadioButton Content="位置3" Margin="5,0 " IsEnabled="True" IsChecked="{Binding PawPositon3}" Command="{Binding PawToPoint3}" GroupName="PawTurn"/>
</WrapPanel>
<WrapPanel Grid.Row="1">
<TextBlock Text="移动系数:"></TextBlock>
<TextBox
Style="{DynamicResource UserTextBoxStyle}"
Foreground="#a2c2e8" Text="{Binding Str}"/>
<TextBlock Text="移动方式:" Margin="50,0,0,0"></TextBlock>
<RadioButton Content="上" Margin="5,0" IsChecked="{Binding Up}" GroupName="ArmRun"/>
<RadioButton Content="下" Margin="5,0" IsChecked="{Binding Down}" GroupName="ArmRun"/>
<RadioButton Content="左" Margin="5,0 " IsChecked="{Binding Left}" GroupName="ArmRun"/>
<RadioButton Content="右" Margin="5,0 " IsChecked="{Binding Right}" GroupName="ArmRun"/>
<RadioButton Content="定点" Margin="5,0 " IsChecked="{Binding Point}" GroupName="ArmRun"/>
<Button Content="移动" Command="{Binding SetNowPosition}"/>
</WrapPanel>
<WrapPanel Grid.Row="2" Cursor="">
<Button Content="自动计算" Margin="20,0,50,0" Command="{Binding AutoCalculation}"/>
<Button Content="保存" Margin="20,0,50,0" Command="{Binding SaveCoordinate}"/>
<Button Content="读取" Command="{Binding ReadCoordinate}"/>
</WrapPanel>
</Grid>
</GroupBox>
</Grid>
</ScrollViewer>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.MorkF/View/MaterialCalibration.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.MorkF.View
{
/// <summary>
/// MaterialCalibration.xaml 的交互逻辑
/// </summary>
public partial class MaterialCalibration : UserControl
{
public MaterialCalibration()
{
InitializeComponent();
}
}
}

+ 961
- 0
BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs View File

@@ -0,0 +1,961 @@
using BPASmartClient.Helper;
using BPASmartClient.MorkF.Model;
using Google.Protobuf.WellKnownTypes;
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;
using System.Windows;

namespace BPASmartClient.MorkF.ViewModel
{
internal class MaterialCalibrationViewModel : ObservableObject
{
#region 菜品库控制
#region 点位1
public bool PositionOne { get { return _PositionOne; } set { _PositionOne = value; OnPropertyChanged(); } }
private bool _PositionOne;
public int OneX { get { return _OneX; } set { _OneX = value; OnPropertyChanged(); } }
private int _OneX;
public int OneY { get { return _OneY; } set { _OneY = value; OnPropertyChanged(); } }
private int _OneY;
#endregion
#region 点位2
public bool PositionTwo { get { return _PositionTwo; } set { _PositionTwo = value; OnPropertyChanged(); } }
private bool _PositionTwo;
public int TwoX { get { return _TwoX; } set { _TwoX = value; OnPropertyChanged(); } }
private int _TwoX;
public int TwoY { get { return _TwoY; } set { _TwoY = value; OnPropertyChanged(); } }
private int _TwoY;
#endregion
#region 点位3
public bool PositionThree { get { return _PositionThree; } set { _PositionThree = value; OnPropertyChanged(); } }
private bool _PositionThree;
public int ThreeX { get { return _ThreeX; } set { _ThreeX = value; OnPropertyChanged(); } }
private int _ThreeX;
public int ThreeY { get { return _ThreeY; } set { _ThreeY = value; OnPropertyChanged(); } }
private int _ThreeY;
#endregion
#region 点位4
public bool PositionFour { get { return _PositionFour; } set { _PositionFour = value; OnPropertyChanged(); } }
private bool _PositionFour;
public int FourX { get { return _FourX; } set { _FourX = value; OnPropertyChanged(); } }
private int _FourX;
public int FourY { get { return _FourY; } set { _FourY = value; OnPropertyChanged(); } }
private int _FourY;
#endregion
#region 点位5
public bool PositionFive { get { return _PositionFive; } set { _PositionFive = value; OnPropertyChanged(); } }
private bool _PositionFive;
public int FiveX { get { return _FiveX; } set { _FiveX = value; OnPropertyChanged(); } }
private int _FiveX;
public int FiveY { get { return _FiveY; } set { _FiveY = value; OnPropertyChanged(); } }
private int _FiveY;
#endregion
#region 点位6
public bool PositionSix { get { return _PositionSix; } set { _PositionSix = value; OnPropertyChanged(); } }
private bool _PositionSix;
public int SixX { get { return _SixX; } set { _SixX = value; OnPropertyChanged(); } }
private int _SixX;
public int SixY { get { return _SixY; } set { _SixY = value; OnPropertyChanged(); } }
private int _SixY;
#endregion
#region 点位7
public bool PositionSeven { get { return _PositionSeven; } set { _PositionSeven = value; OnPropertyChanged(); } }
private bool _PositionSeven;
public int SevenX { get { return _SevenX; } set { _SevenX = value; OnPropertyChanged(); } }
private int _SevenX;
public int SevenY { get { return _SevenY; } set { _SevenY = value; OnPropertyChanged(); } }
private int _SevenY;
#endregion
#region 点位8
public bool PositionEight { get { return _PositionEight; } set { _PositionEight = value; OnPropertyChanged(); } }
private bool _PositionEight;
public int EightX { get { return _EightX; } set { _EightX = value; OnPropertyChanged(); } }
private int _EightX;
public int EightY { get { return _EightY; } set { _EightY = value; OnPropertyChanged(); } }
private int _EightY;
#endregion
#region 点位9
public bool PositionNine { get { return _PositionNine; } set { _PositionNine = value; OnPropertyChanged(); } }
private bool _PositionNine;
public int NineX { get { return _NineX; } set { _NineX = value; OnPropertyChanged(); } }
private int _NineX;
public int NineY { get { return _NineY; } set { _NineY = value; OnPropertyChanged(); } }
private int _NineY;
#endregion
#region 点位10
public bool PositionTen { get { return _PositionTen; } set { _PositionTen = value; OnPropertyChanged(); } }
private bool _PositionTen;
public int TenX { get { return _TenX; } set { _TenX = value; OnPropertyChanged(); } }
private int _TenX;
public int TenY { get { return _TenY; } set { _TenY = value; OnPropertyChanged(); } }
private int _TenY;
#endregion
#region 点位11
public bool PositionEleven { get { return _PositionEleven; } set { _PositionEleven = value; OnPropertyChanged(); } }
private bool _PositionEleven;
public int ElevenX { get { return _ElevenX; } set { _ElevenX = value; OnPropertyChanged(); } }
private int _ElevenX;
public int ElevenY { get { return _ElevenY; } set { _ElevenY = value; OnPropertyChanged(); } }
private int _ElevenY;
#endregion
#region 点位12
public bool PositionTwelve { get { return _PositionTwelve; } set { _PositionTwelve = value; OnPropertyChanged(); } }
private bool _PositionTwelve;
public int TwelveX { get { return _TwelveX; } set { _TwelveX = value; OnPropertyChanged(); } }
private int _TwelveX;
public int TwelveY { get { return _TwelveY; } set { _TwelveY = value; OnPropertyChanged(); } }
private int _TwelveY;
#endregion
#region 点位13
public bool PositionThirteen { get { return _PositionThirteen; } set { _PositionThirteen = value; OnPropertyChanged(); } }
private bool _PositionThirteen;
public int ThirteenX { get { return _ThirteenX; } set { _ThirteenX = value; OnPropertyChanged(); } }
private int _ThirteenX;
public int ThirteenY { get { return _ThirteenY; } set { _ThirteenY = value; OnPropertyChanged(); } }
private int _ThirteenY;
#endregion
#region 点位14
public bool PositionFourteen { get { return _PositionFourteen; } set { _PositionFourteen = value; OnPropertyChanged(); } }
private bool _PositionFourteen;
public int FourteenX { get { return _FourteenX; } set { _FourteenX = value; OnPropertyChanged(); } }
private int _FourteenX;
public int FourteenY { get { return _FourteenY; } set { _FourteenY = value; OnPropertyChanged(); } }
private int _FourteenY;
#endregion
#region 点位15
public bool PositionFifteen { get { return _PositionFifteen; } set { _PositionFifteen = value; OnPropertyChanged(); } }
private bool _PositionFifteen;
public int FifteenX { get { return _FifteenX; } set { _FifteenX = value; OnPropertyChanged(); } }
private int _FifteenX;
public int FifteenY { get { return _FifteenY; } set { _FifteenY = value; OnPropertyChanged(); } }
private int _FifteenY;
#endregion
#region 点位16
public bool PositionSixteen { get { return _PositionSixteen; } set { _PositionSixteen = value; OnPropertyChanged(); } }
private bool _PositionSixteen;
public int SixteenX { get { return _SixteenX; } set { _SixteenX = value; OnPropertyChanged(); } }
private int _SixteenX;
public int SixteenY { get { return _SixteenY; } set { _SixteenY = value; OnPropertyChanged(); } }
private int _SixteenY;
#endregion
#region 点位17
public bool PositionSeventeen { get { return _PositionSeventeen; } set { _PositionSeventeen = value; OnPropertyChanged(); } }
private bool _PositionSeventeen;
public int SeventeenX { get { return _SeventeenX; } set { _SeventeenX = value; OnPropertyChanged(); } }
private int _SeventeenX;
public int SeventeenY { get { return _SeventeenY; } set { _SeventeenY = value; OnPropertyChanged(); } }
private int _SeventeenY;
#endregion
#region 点位18
public bool PositionEighteen { get { return _PositionEighteen; } set { _PositionEighteen = value; OnPropertyChanged(); } }
private bool _PositionEighteen;
public int EighteenX { get { return _EighteenX; } set { _EighteenX = value; OnPropertyChanged(); } }
private int _EighteenX;
public int EighteenY { get { return _EighteenY; } set { _EighteenY = value; OnPropertyChanged(); } }
private int _EighteenY;
#endregion
#region 点位19
public bool PositionNineteen { get { return _PositionNineteen; } set { _PositionNineteen = value; OnPropertyChanged(); } }
private bool _PositionNineteen;
public int NineteenX { get { return _NineteenX; } set { _NineteenX = value; OnPropertyChanged(); } }
private int _NineteenX;
public int NineteenY { get { return _NineteenY; } set { _NineteenY = value; OnPropertyChanged(); } }
private int _NineteenY;
#endregion
#region 点位20
public bool PositionTwenty { get { return _PositionTwenty; } set { _PositionTwenty = value; OnPropertyChanged(); } }
private bool _PositionTwenty;
public int TwentyX { get { return _TwentyX; } set { _TwentyX = value; OnPropertyChanged(); } }
private int _TwentyX;
public int TwentyY { get { return _TwentyY; } set { _TwentyY = value; OnPropertyChanged(); } }
private int _TwentyY;
#endregion
#region 点位21
public bool PositionTwentyOne { get { return _PositionTwentyOne; } set { _PositionTwentyOne = value; OnPropertyChanged(); } }
private bool _PositionTwentyOne;
public int TwentyOneX { get { return _TwentyOneX; } set { _TwentyOneX = value; OnPropertyChanged(); } }
private int _TwentyOneX;
public int TwentyOneY { get { return _TwentyOneY; } set { _TwentyOneY = value; OnPropertyChanged(); } }
private int _TwentyOneY;
#endregion
#region 点位22
public bool PositionTwentyTwo { get { return _PositionTwentyTwo; } set { _PositionTwentyTwo = value; OnPropertyChanged(); } }
private bool _PositionTwentyTwo;
public int TwentyTwoX { get { return _TwentyTwoX; } set { _TwentyTwoX = value; OnPropertyChanged(); } }
private int _TwentyTwoX;
public int TwentyTwoY { get { return _TwentyTwoY; } set { _TwentyTwoY = value; OnPropertyChanged(); } }
private int _TwentyTwoY;
#endregion
#region 点位23
public bool PositionTwentyThree { get { return _PositionTwentyThree; } set { _PositionTwentyThree = value; OnPropertyChanged(); } }
private bool _PositionTwentyThree;
public int TwentyThreeX { get { return _TwentyThreeX; } set { _TwentyThreeX = value; OnPropertyChanged(); } }
private int _TwentyThreeX;
public int TwentyThreeY { get { return _TwentyThreeY; } set { _TwentyThreeY = value; OnPropertyChanged(); } }
private int _TwentyThreeY;
#endregion
#region 点位24
public bool PositionTwentyFour { get { return _PositionTwentyFour; } set { _PositionTwentyFour = value; OnPropertyChanged(); } }
private bool _PositionTwentyFour;
public int TwentyFourX { get { return _TwentyFourX; } set { _TwentyFourX = value; OnPropertyChanged(); } }
private int _TwentyFourX;
public int TwentyFourY { get { return _TwentyFourY; } set { _TwentyFourY = value; OnPropertyChanged(); } }
private int _TwentyFourY;
#endregion
#region 点位25
public bool PositionTwentyFive { get { return _PositionTwentyFive; } set { _PositionTwentyFive = value; OnPropertyChanged(); } }
private bool _PositionTwentyFive;
public int TwentyFiveX { get { return _TwentyFiveX; } set { _TwentyFiveX = value; OnPropertyChanged(); } }
private int _TwentyFiveX;
public int TwentyFiveY { get { return _TwentyFiveY; } set { _TwentyFiveY = value; OnPropertyChanged(); } }
private int _TwentyFiveY;
#endregion
#region 点位26
public bool PositionTwentySix { get { return _PositionTwentySix; } set { _PositionTwentySix = value; OnPropertyChanged(); } }
private bool _PositionTwentySix;
public int TwentySixX { get { return _TwentySixX; } set { _TwentySixX = value; OnPropertyChanged(); } }
private int _TwentySixX;
public int TwentySixY { get { return _TwentySixY; } set { _TwentySixY = value; OnPropertyChanged(); } }
private int _TwentySixY;
#endregion
#region 点位27
public bool PositionTwentySeven { get { return _PositionTwentySeven; } set { _PositionTwentySeven = value; OnPropertyChanged(); } }
private bool _PositionTwentySeven;
public int TwentySevenX { get { return _TwentySevenX; } set { _TwentySevenX = value; OnPropertyChanged(); } }
private int _TwentySevenX;
public int TwentySevenY { get { return _TwentySevenY; } set { _TwentySevenY = value; OnPropertyChanged(); } }
private int _TwentySevenY;
#endregion

public bool Up { get { return _Up; } set { _Up = value; OnPropertyChanged(); } }
private bool _Up;

public bool Down { get { return _Down; } set { _Down = value; OnPropertyChanged(); } }
private bool _Down;

public bool Left { get { return _Left; } set { _Left = value; OnPropertyChanged(); } }
private bool _Left;

public bool Right { get { return _Right; } set { _Right = value; OnPropertyChanged(); } }
private bool _Right;

public bool Point { get { return _Point; } set { _Point = value; OnPropertyChanged(); } }
private bool _Point;

public string Str { get { return _str; }set { _str = value;OnPropertyChanged(); } }

private string _str;

public RelayCommand FoodLibInit { get; set; }//初始化
public RelayCommand StartElectromagnetism { get; set; }//电磁阀启动
public RelayCommand StopElectromagnetism { get; set; }
public RelayCommand PawTurnFront { get; set; }//夹爪正转
public RelayCommand PawTurnBack { get; set; }//夹爪反转
public RelayCommand PawToPoint1 { get; set; }//感应测距1
public RelayCommand PawToPoint2 { get; set; }//感应测距2
public RelayCommand PawToPoint3 { get; set; }//感应测距3
/// <summary>
/// 操作时,x轴移动的距离
/// </summary>
public int OperationX { get; set; } = 0;

/// <summary>
/// 操作时,y轴移动的距离
/// </summary>
public int OperationY { get; set; } = 0;

/// <summary>
/// Y轴大菜品库的间隙
/// </summary>
private const int bigMaterialClearanceY = 54000;

/// <summary>
/// Y轴小菜品库的间隙
/// </summary>
private const int smartMaterialClearanceY = 28000;

/// <summary>
/// X轴菜品库的间隙
/// </summary>
private const int materialClearanceX1 = 78000;

/// <summary>
/// X轴菜品库的间隙
/// </summary>
private const int materialClearanceX2 = 88000;

/// <summary>
/// 移动系数
/// </summary>
public int Factor = 1;

/// <summary>
/// 移动基础点位
/// </summary>
private int BasicPosition { get; set; } = 100;

public RelayCommand SetNowPosition { get; set; }//设置机械臂当前坐标

public RelayCommand SaveCoordinate { get; set; }//设置机械臂基于当前坐标往左移动

public RelayCommand ReadCoordinate { get; set; }//设置机械臂基于当前坐标往右移动

public RelayCommand AutoCalculation { get; set; }//设置机械臂基于当前坐标往上移动

public RelayCommand SetNowDownPosition { get; set; }//设置机械臂基于当前坐标往下移动

private static object saveMaterialCoordinateLock = new object();
/// <summary>
/// 保存当前的坐标系
/// </summary>
public void SaveMaterialCoordinate()
{
MaterialCoordinate materialCoordinate = new MaterialCoordinate();

foreach(var dicNoMaterialCoordinate in materialCoordinate.dicNoMaterialCoordinate)
{
switch(dicNoMaterialCoordinate.Key)
{
case "1":
dicNoMaterialCoordinate.Value.X = OneX;
dicNoMaterialCoordinate.Value.Y = OneY;
break;
case "2":
dicNoMaterialCoordinate.Value.X = TwoX;
dicNoMaterialCoordinate.Value.Y = TwoY;
break;
case "3":
dicNoMaterialCoordinate.Value.X = ThreeX;
dicNoMaterialCoordinate.Value.Y = ThreeY;
break;
case "4":
dicNoMaterialCoordinate.Value.X = FourX;
dicNoMaterialCoordinate.Value.Y = FourY;
break;
case "5":
dicNoMaterialCoordinate.Value.X = FiveX;
dicNoMaterialCoordinate.Value.Y = FiveY;
break;
case "6":
dicNoMaterialCoordinate.Value.X = SixX;
dicNoMaterialCoordinate.Value.Y = SixY;
break;
case "7":
dicNoMaterialCoordinate.Value.X = SevenX;
dicNoMaterialCoordinate.Value.Y = SevenY;
break;
case "8":
dicNoMaterialCoordinate.Value.X = EightX;
dicNoMaterialCoordinate.Value.Y = EightY;
break;
case "9":
dicNoMaterialCoordinate.Value.X = NineX;
dicNoMaterialCoordinate.Value.Y = NineY;
break;
case "10":
dicNoMaterialCoordinate.Value.X = TenX;
dicNoMaterialCoordinate.Value.Y = TenY;
break;
case "11":
dicNoMaterialCoordinate.Value.X = ElevenX;
dicNoMaterialCoordinate.Value.Y = ElevenY;
break;
case "12":
dicNoMaterialCoordinate.Value.X = TwelveX;
dicNoMaterialCoordinate.Value.Y = TwelveY;
break;
case "13":
dicNoMaterialCoordinate.Value.X = ThirteenX;
dicNoMaterialCoordinate.Value.Y = ThirteenY;
break;
case "14":
dicNoMaterialCoordinate.Value.X = FourteenX;
dicNoMaterialCoordinate.Value.Y = FourteenY;
break;
case "15":
dicNoMaterialCoordinate.Value.X = FifteenX;
dicNoMaterialCoordinate.Value.Y = FifteenY;
break;
case "16":
dicNoMaterialCoordinate.Value.X = SixteenX;
dicNoMaterialCoordinate.Value.Y = SixteenY;
break;
case "17":
dicNoMaterialCoordinate.Value.X = SeventeenX;
dicNoMaterialCoordinate.Value.Y = SeventeenY;
break;
case "18":
dicNoMaterialCoordinate.Value.X = EighteenX;
dicNoMaterialCoordinate.Value.Y = EighteenY;
break;
case "19":
dicNoMaterialCoordinate.Value.X = NineteenX;
dicNoMaterialCoordinate.Value.Y = NineteenY;
break;
case "20":
dicNoMaterialCoordinate.Value.X = TwentyX;
dicNoMaterialCoordinate.Value.Y = TwentyY;
break;
case "21":
dicNoMaterialCoordinate.Value.X = TwentyOneX;
dicNoMaterialCoordinate.Value.Y = TwentyOneY;
break;
case "22":
dicNoMaterialCoordinate.Value.X = TwentyTwoX;
dicNoMaterialCoordinate.Value.Y = TwentyTwoY;
break;
case "23":
dicNoMaterialCoordinate.Value.X = TwentyThreeX;
dicNoMaterialCoordinate.Value.Y = TwentyThreeX;
break;
case "24":
dicNoMaterialCoordinate.Value.X = TwentyFourX;
dicNoMaterialCoordinate.Value.Y = TwentyFourY;
break;
case "25":
dicNoMaterialCoordinate.Value.X = TwentyFiveX;
dicNoMaterialCoordinate.Value.Y = TwentyFiveY;
break;
case "26":
dicNoMaterialCoordinate.Value.X = TwentySixX;
dicNoMaterialCoordinate.Value.Y = TwentySixY;
break;
case "27":
dicNoMaterialCoordinate.Value.X = TwentySevenX;
dicNoMaterialCoordinate.Value.Y = TwentySevenY;
break;
default:
break;
}
}

Json<MaterialCoordinate>.Data = materialCoordinate;
Json<MaterialCoordinate>.Save();
}

/// <summary>
/// 读取坐标系
/// </summary>
/// <returns></returns>
private MaterialCoordinate ReadMaterialCoordinate()
{
try
{
Json<MaterialCoordinate>.Read();
MaterialCoordinate materialCoordinate = Json<MaterialCoordinate>.Data;
return materialCoordinate;
}
catch (Exception ex)
{
return null;
}
}

/// <summary>
/// 从json文件中读取菜品库坐标系数据
/// </summary>
private void PhysicalMaterialCoordinate()
{
MaterialCoordinate materialCoordinate = ReadMaterialCoordinate();

if (materialCoordinate.dicNoMaterialCoordinate.Count == 27)
{
foreach (var dicNoMaterialCoordinate in materialCoordinate.dicNoMaterialCoordinate)
{
switch (dicNoMaterialCoordinate.Key)
{
case "1":
OneX = dicNoMaterialCoordinate.Value.X;
OneY = dicNoMaterialCoordinate.Value.Y;
break;
case "2":
TwoX = dicNoMaterialCoordinate.Value.X;
TwoY = dicNoMaterialCoordinate.Value.Y;
break;
case "3":
ThreeX = dicNoMaterialCoordinate.Value.X;
ThreeY = dicNoMaterialCoordinate.Value.Y;
break;
case "4":
FourX = dicNoMaterialCoordinate.Value.X;
FourY = dicNoMaterialCoordinate.Value.Y;
break;
case "5":
FiveX = dicNoMaterialCoordinate.Value.X;
FiveY = dicNoMaterialCoordinate.Value.Y;
break;
case "6":
SixX = dicNoMaterialCoordinate.Value.X;
SixY = dicNoMaterialCoordinate.Value.Y;
break;
case "7":
SevenX = dicNoMaterialCoordinate.Value.X;
SevenY = dicNoMaterialCoordinate.Value.Y;
break;
case "8":
EightX = dicNoMaterialCoordinate.Value.X;
EightY = dicNoMaterialCoordinate.Value.Y;
break;
case "9":
NineX = dicNoMaterialCoordinate.Value.X;
NineY = dicNoMaterialCoordinate.Value.Y;
break;
case "10":
TenX = dicNoMaterialCoordinate.Value.X;
TenY = dicNoMaterialCoordinate.Value.Y;
break;
case "11":
ElevenX = dicNoMaterialCoordinate.Value.X;
ElevenY = dicNoMaterialCoordinate.Value.Y;
break;
case "12":
TwelveX = dicNoMaterialCoordinate.Value.X;
TwelveY = dicNoMaterialCoordinate.Value.Y;
break;
case "13":
ThirteenX = dicNoMaterialCoordinate.Value.X;
ThirteenY = dicNoMaterialCoordinate.Value.Y;
break;
case "14":
FourteenX = dicNoMaterialCoordinate.Value.X;
FourteenY = dicNoMaterialCoordinate.Value.Y;
break;
case "15":
FifteenX = dicNoMaterialCoordinate.Value.X;
FifteenY = dicNoMaterialCoordinate.Value.Y;
break;
case "16":
SixteenX = dicNoMaterialCoordinate.Value.X;
SixteenY = dicNoMaterialCoordinate.Value.Y;
break;
case "17":
SeventeenX = dicNoMaterialCoordinate.Value.X;
SeventeenY = dicNoMaterialCoordinate.Value.Y;
break;
case "18":
EighteenX = dicNoMaterialCoordinate.Value.X;
EighteenY = dicNoMaterialCoordinate.Value.Y;
break;
case "19":
NineteenX = dicNoMaterialCoordinate.Value.X;
NineteenY = dicNoMaterialCoordinate.Value.Y;
break;
case "20":
TwentyX = dicNoMaterialCoordinate.Value.X;
TwentyY = dicNoMaterialCoordinate.Value.Y;
break;
case "21":
TwentyOneX = dicNoMaterialCoordinate.Value.X;
TwentyOneY = dicNoMaterialCoordinate.Value.Y;
break;
case "22":
TwentyTwoX = dicNoMaterialCoordinate.Value.X;
TwentyTwoY = dicNoMaterialCoordinate.Value.Y;
break;
case "23":
TwentyThreeX = dicNoMaterialCoordinate.Value.X;
TwentyThreeY = dicNoMaterialCoordinate.Value.Y;
break;
case "24":
TwentyFourX = dicNoMaterialCoordinate.Value.X;
TwentyFourY = dicNoMaterialCoordinate.Value.Y;
break;
case "25":
TwentyFiveX = dicNoMaterialCoordinate.Value.X;
TwentyFiveY = dicNoMaterialCoordinate.Value.Y;
break;
case "26":
TwentySixX = dicNoMaterialCoordinate.Value.X;
TwentySixY = dicNoMaterialCoordinate.Value.Y;
break;
case "27":
TwentySevenX = dicNoMaterialCoordinate.Value.X;
TwentySevenY = dicNoMaterialCoordinate.Value.Y;
break;
default:
break;
}
}
}

}

/// <summary>
///
/// </summary>
/// <param name="Num"></param>
private void Calibration(string Num)
{
switch (Num)
{
case "1":
OneX = OneX + OperationX;
OneY = OneY + OperationX;
break;
case "2":
TwoX = TwoX + OperationX;
TwoY = TwoY + OperationY;
break;
case "3":
ThreeX = ThreeX + OperationX;
ThreeY = ThreeY + OperationY;
break;
case "4":
FourX = FourX + OperationX;
FourY = FourY + OperationY;
break;
case "5":
FiveX = FiveX + OperationX;
FiveY = FiveY + OperationY;
break;
case "6":
SixX = SixX + OperationX;
SixY = SixY + OperationY;
break;
case "7":
SevenX = SevenX + OperationX;
SevenY = SevenY + OperationY;
break;
case "8":
EightX = EightX + OperationX;
EightY = EightY + OperationY;
break;
case "9":
NineX = NineX + OperationX;
NineY = NineY + OperationY;
break;
case "10":
TenX = TenX + OperationX;
TenY = TenY + OperationY;
break;
case "11":
ElevenX = ElevenX + OperationX;
ElevenY = ElevenY + OperationY;
break;
case "12":
TwelveX = TwelveX + OperationX;
TwelveY = TwelveY + OperationY;
break;
case "13":
ThirteenX = ThirteenX + OperationX;
ThirteenY = ThirteenY + OperationY;
break;
case "14":
FourteenX = FourteenX + OperationX;
FourteenY = FourteenY + OperationY;
break;
case "15":
FifteenX = FifteenX + OperationX;
FifteenY = FifteenY + OperationY;
break;
case "16":
SixteenX = SixteenX + OperationX;
SixteenY = SixteenY + OperationY;
break;
case "17":
SeventeenX = SeventeenX + OperationX;
SeventeenY = SeventeenY + OperationY;
break;
case "18":
EighteenX = EighteenX + OperationX;
EighteenY = EighteenY + OperationY;
break;
case "19":
NineteenX = NineteenX + OperationX;
NineteenY = NineteenY + OperationY;
break;
case "20":
TwentyX = TwentyX + OperationX;
TwentyY = TwentyY + OperationY;
break;
case "21":
TwentyOneX = TwentyOneX + OperationX;
TwentyOneY = TwentyOneY + OperationY;
break;
case "22":
TwentyTwoX = TwentyTwoX + OperationX;
TwentyTwoY = TwentyTwoY + OperationY;
break;
case "23":
TwentyThreeX = TwentyThreeX + OperationX;
TwentyThreeY = TwentyThreeY + OperationY;
break;
case "24":
TwentyFourX = TwentyFourX + OperationX;
TwentyFourY = TwentyFourY + OperationY;
break;
case "25":
TwentyFiveX = TwentyFiveX + OperationX;
TwentyFiveY = TwentyFiveY + OperationY;
break;
case "26":
TwentySixX = TwentySixX + OperationX;
TwentySixY = TwentySixY + OperationY;
break;
case "27":
TwentySevenX = TwentySevenX + OperationX;
TwentySevenY = TwentySevenY + OperationY;
break;
default:
break;
}
OperationX = 0;
OperationY = 0;
}

private void SetPosition()
{
//判断是否有选择下发的设备
if (!PositionOne && !PositionTwo && !PositionThree && !PositionFour && !PositionFive && !PositionSix && !PositionSeven && !PositionEight && !PositionNine
&& !PositionTen && !PositionEleven && !PositionTwelve && !PositionThirteen && !PositionFourteen && !PositionFifteen && !PositionSixteen && !PositionSeventeen && !PositionEighteen
&& !PositionNineteen && !PositionTwenty && !PositionTwentyOne && !PositionTwentyTwo && !PositionTwentyThree && !PositionTwentyFour && !PositionTwentyFive && !PositionTwentySix && !PositionTwentySeven)
{
MessageBox.Show("未选择点位");
return;
}

if (PositionOne)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> {"1", OneX + OperationX, OneY + OperationY });//设定机械臂当前位置
}
if (PositionTwo)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "2", TwoX + OperationX, TwoY + OperationY });//设定机械臂当前位置
}
if (PositionThree)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "3", ThreeX + OperationX, ThreeY + OperationY });//设定机械臂当前位置
}
if (PositionFour)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "4", FourX + OperationX, FourY + OperationY });//设定机械臂当前位置
}
if (PositionFive)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "5", FiveX + OperationX, FiveY + OperationY });//设定机械臂当前位置
}
if (PositionSix)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "6", SixX + OperationX, SixY + OperationY });//设定机械臂当前位置
}
if (PositionSeven)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "7", SevenX + OperationX, SevenY + OperationY });//设定机械臂当前位置
}
if (PositionEight)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "8", EightX + OperationX, EightY + OperationY });//设定机械臂当前位置
}
if (PositionNine)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "9", NineX + OperationX, NineY + OperationY });//设定机械臂当前位置
}
if (PositionTen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "10", TenX + OperationX, TenY + OperationY });//设定机械臂当前位置
}
if (PositionEleven)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "11", ElevenX + OperationX, ElevenY + OperationY });//设定机械臂当前位置
}
if (PositionTwelve)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "12", TwelveX + OperationX, TwelveY + OperationY });//设定机械臂当前位置
}
if (PositionThirteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "13", ThirteenX + OperationX, ThirteenY + OperationY });//设定机械臂当前位置
}
if (PositionFourteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "14", FourteenX + OperationX, FourteenY + OperationY });//设定机械臂当前位置
}
if (PositionFifteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "15", FifteenX + OperationX, FifteenY + OperationY });//设定机械臂当前位置
}
if (PositionSixteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "16", SixteenX + OperationX, SixteenY + OperationY });//设定机械臂当前位置
}
if (PositionSeventeen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "17", SeventeenX + OperationX, SeventeenY + OperationY });//设定机械臂当前位置
}
if (PositionEighteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "18", EighteenX + OperationX, EighteenY + OperationY });//设定机械臂当前位置
}
if (PositionNineteen)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "19", NineteenX + OperationX, NineteenY + OperationY });//设定机械臂当前位置
}
if (PositionTwenty)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "20", TwentyX + OperationX, TwentyY + OperationY });//设定机械臂当前位置
}
if (PositionTwentyOne)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "21", TwentyOneX + OperationX, TwentyOneY + OperationY });//设定机械臂当前位置
}
if (PositionTwentyTwo)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "22", TwentyTwoX + OperationX, TwentyTwoY + OperationY });//设定机械臂当前位置
}
if (PositionTwentyThree)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "23", TwentyThreeX + OperationX, TwentyThreeY + OperationY });//设定机械臂当前位置
}
if (PositionTwentyFour)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "24", TwentyFourX + OperationX, TwentyFourY + OperationY });//设定机械臂当前位置
}
if (PositionTwentyFive)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "25", TwentyFiveX + OperationX, TwentyFiveY + OperationY });//设定机械臂当前位置
}
if (PositionTwentySix)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "26", TwentySixX + OperationX, TwentySixY + OperationY });//设定机械臂当前位置
}
if (PositionTwentySeven)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "27", TwentySevenX + OperationX, TwentySevenY + OperationY });//设定机械臂当前位置
}
}

public MaterialCalibrationViewModel()
{
StartElectromagnetism = new RelayCommand(() => { ActionManage.GetInstance.Send("Electromagnetism", new List<bool> { false }); });//电磁阀启动
StopElectromagnetism = new RelayCommand(() => { ActionManage.GetInstance.Send("Electromagnetism", new List<bool> { true }); });//电磁阀关闭

FoodLibInit = new RelayCommand(() => { ActionManage.GetInstance.Send("FoodLibInit"); });//菜品库初始化
PawToPoint1 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint1"); });//爪子去1号位
PawToPoint2 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint2"); });//爪子去2号位
PawToPoint3 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint3"); });//爪子去3号位
PawTurnFront = new RelayCommand(() => { ActionManage.GetInstance.Send("PawTurnFront"); });//夹爪正转
PawTurnBack = new RelayCommand(() => { ActionManage.GetInstance.Send("PawTurnBack"); });//夹爪反转

PhysicalMaterialCoordinate();
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
ThreadManage.GetInstance().Start(new Action(() =>
{
if(o is List<string> nums)
{
Calibration(nums[0]);
}
}), "CalibrationCallBack");
}), "CalibrationCallBack");
SetNowPosition = new RelayCommand(() =>
{
if(!Point && !Left && !Right && !Down && !Up)
{
MessageBox.Show("请选择需要移动的方式");
return;
}

if (!Point)
{
if (!int.TryParse(Str, out Factor))
{
Factor = 1;
}
if(Factor > 100 || Factor<0)
{
MessageBox.Show("请输入有效系数");
return;
}
}

if(Left)
{
OperationX = -1 * BasicPosition * Factor;
}
else if(Right)
{
OperationX = BasicPosition * Factor;
}
else if(Down)
{
OperationY = BasicPosition * Factor;
}
else if(Up)
{
OperationY = -1 * BasicPosition * Factor;
}
else
{
OperationX = 0;
OperationY = 0;
}
SetPosition();
});
SaveCoordinate = new RelayCommand(() =>
{
SaveMaterialCoordinate();
});
ReadCoordinate = new RelayCommand(() =>
{
PhysicalMaterialCoordinate();
});
AutoCalculation = new RelayCommand(() =>
{
AutoCalculationCoordination();
});
}

/// <summary>
/// 自动计算坐标
/// </summary>
private void AutoCalculationCoordination()
{
#region 菜品库一层计算
//X轴改变
TwoX = ThreeX = FourX = FiveX = SixX = SevenX = EightX = NineX = OneX;
TwoY = OneY + 1000;
ThreeY = OneY + 1000+smartMaterialClearanceY;
FourY = OneY + 1000 + smartMaterialClearanceY + bigMaterialClearanceY;
FiveY = OneY + 1000 + 2 * smartMaterialClearanceY + bigMaterialClearanceY;
SixY = OneY + 3 * smartMaterialClearanceY + bigMaterialClearanceY;
SevenY = OneY + 3 * smartMaterialClearanceY + 2*bigMaterialClearanceY;
EightY = OneY + 4 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
NineY = OneY + 5 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
#endregion
#region 菜品库二层计算
//X轴改变
TenX = ElevenX = TwelveX = ThirteenX = FourteenX = FifteenX = SixteenX = SeventeenX = EighteenX = (OneX + materialClearanceX1);
TenY = OneY;
ElevenY = OneY + 1000;
TwelveY = OneY + smartMaterialClearanceY;
ThirteenY = OneY + smartMaterialClearanceY + bigMaterialClearanceY;
FourteenY = OneY + 2 * smartMaterialClearanceY + bigMaterialClearanceY;
FifteenY = OneY + 3 * smartMaterialClearanceY + bigMaterialClearanceY;
SixteenY = OneY + 3 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
SeventeenY = OneY + 4 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
EighteenY = OneY + 5 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
#endregion
#region 菜品库三层计算
//X轴改变
NineteenX = TwentyX = TwentyOneX = TwentyTwoX = TwentyThreeX = TwentyFourX = TwentyFiveX = TwentySixX = TwentySevenX = (OneX + 2 * materialClearanceX2);
NineteenY = OneY;
TwentyY = OneY + 1000;
TwentyOneY = OneY + smartMaterialClearanceY;
TwentyTwoY = OneY + smartMaterialClearanceY + bigMaterialClearanceY;
TwentyThreeY = OneY + 2 * smartMaterialClearanceY + bigMaterialClearanceY;
TwentyFourY = OneY + 3 * smartMaterialClearanceY + bigMaterialClearanceY;
TwentyFiveY = OneY + 3 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
TwentySixY = OneY + 4 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
TwentySevenY = OneY + 5 * smartMaterialClearanceY + 2 * bigMaterialClearanceY;
#endregion
}

#endregion

}
}

+ 0
- 7
BPASmartClient.MorkT/BPASmartClient.MorkT.csproj View File

@@ -17,16 +17,9 @@
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
</ItemGroup>

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

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



+ 42
- 42
BPASmartClient.MorkT/Control_MorkT.cs View File

@@ -34,7 +34,6 @@ namespace BPASmartClient.MorkT

DateTime morkTime = DateTime.Now;


public override void DoMain()
{
if (Json<KeepDataBase>.Data.IsVerify)
@@ -52,7 +51,6 @@ namespace BPASmartClient.MorkT
int i = 0;
EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
PreventSleep.SleepControl(true);//防止电脑休眠

MessageLog.GetInstance.Show("MORKT 设备初始化完成");
}

@@ -62,7 +60,6 @@ namespace BPASmartClient.MorkT
morkT = new GLV_MorkT();
}


private void GetStatus(string key, Action<object> action)
{
if (peripheralStatus.ContainsKey(key))
@@ -88,39 +85,37 @@ namespace BPASmartClient.MorkT
// EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
// Thread.Sleep(50);
// }

//}
//else if (morkTime.AddMinutes(Global.TimeInterval) < DateTime.Now) morkTime = DateTime.Now;
#region morkt流程
//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();
// }
// }
// });

#endregion
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();
}
}
});
#endregion
}

public override void ReadData()
@@ -269,13 +264,10 @@ namespace BPASmartClient.MorkT
}));
}



public override void Stop()
{
}


private void ServerInit()
{
//物料信息
@@ -384,9 +376,11 @@ namespace BPASmartClient.MorkT
return GOODS_TYPE.NEITHER;
}




/// <summary>
/// 订单状态改变
/// </summary>
/// <param name="subid"></param>
/// <param name="oRDER_STATUS"></param>
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
@@ -453,7 +447,6 @@ namespace BPASmartClient.MorkT
}
}


/// <summary>
/// 将咖啡杯从咖啡机 取走到 取餐口
/// </summary>
@@ -481,7 +474,15 @@ namespace BPASmartClient.MorkT
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 });//落碗控制
// EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Value = true, Pin = 1 });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 1 }, (o) =>
{
//if (o != null && o.Length > 0 && o[0] is bool resultValue)
//{
// result = resultValue;
//}
});
Thread.Sleep(500);
DeviceProcessLogShow("尝试取咖啡杯!");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
@@ -579,7 +580,6 @@ namespace BPASmartClient.MorkT
}
}


/// <summary>
/// 做冰淇淋
/// </summary>


+ 234
- 157
BPASmartClient.MorkT/View/DebugView.xaml View File

@@ -3,7 +3,7 @@
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.ViewModel"
xmlns:vm="clr-namespace:BPASmartClient.MorkT.ViewModel"
mc:Ignorable="d"
Name="调试界面"
d:DesignHeight="500" d:DesignWidth="1000" Unloaded="Dubug_Unloaded">
@@ -24,12 +24,12 @@
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="384*"/>
<RowDefinition Height="111*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="20*"/>
</Grid.RowDefinitions>

<GroupBox Grid.ColumnSpan="2" Visibility="Collapsed"
<GroupBox Grid.ColumnSpan="2"
FontFamily="楷体"
FontSize="20"
Header=" 乐白机器人 ">
@@ -46,17 +46,12 @@
<TextBlock Text="机器人模式:"/>
<TextBlock Text="{Binding RobotMode}"
Margin="40,0"/>
<TextBlock Text="机器人自嗨时间间隔:"/>
<TextBox Text="{Binding TimeInterval}" Width="40" Margin="10,0,5,0"/>
<TextBlock Text="分"/>
</StackPanel>
<TextBlock Text="连接状态" />
<TextBlock Text="{Binding RobotConnected}"
Margin="120,0,0,0"/>
<TextBlock Text="乐白机器人控制"
Grid.Row="1"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
<ListBox Grid.Row="2" Background="Transparent">
<ListBox Grid.Row="2" Background="Transparent" Margin="0,0,0,-9">
<ListBox.Template>
<ControlTemplate TargetType="{x:Type ListBox}">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
@@ -65,167 +60,128 @@
</ControlTemplate>
</ListBox.Template>
<Button Content="机器人启动"
Margin="20,5" Width="150" Height="60"
Margin="20,5" Width="80" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="机器人启动" Cursor="Hand">
CommandParameter="机器人启动">
</Button>
<Button Content="启动示教"
Margin="20,5" Width="150" Height="60"
Margin="20,5" Width="80" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="启动示教"/>
<Button Content="停止示教"
Margin="20,5" Width="150" Height="60"
Margin="20,5" Width="80" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="停止示教"/>
<Button Content="机器人急停"
Margin="20,5" Width="110" Height="60"
Margin="20,5" Width="80" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="机器人急停"/>

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

<Button Content="暂停"
Margin="10,5" Width="40" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="暂停"/>
<Button Content="恢复"
Margin="10,5" Width="40" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="恢复"/>
</ListBox>
<Grid Margin="629,-24,19,0" Grid.RowSpan="3">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<TextBlock>DI</TextBlock>
<CheckBox Margin="50,0,0,0" IsEnabled="false" Name="Robot_DI0">DI0</CheckBox>
<CheckBox Margin="120,0,0,0" IsEnabled="false" Name="Robot_DI1">DI1</CheckBox>
<CheckBox Margin="190,0,0,0" IsEnabled="false" Name="Robot_DI2">DI2</CheckBox>
<CheckBox Margin="260,0,0,0" IsEnabled="false" Name="Robot_DI3">DI3</CheckBox>
</Grid>
<Grid Grid.Row="1">
<TextBlock Width="50">DO</TextBlock>
<ComboBox Width="70" Margin="50,12,268,10" SelectedIndex="{Binding Lebai_DO_CH}">
<ComboBoxItem IsSelected="true">DO0</ComboBoxItem>
<ComboBoxItem>DO1</ComboBoxItem>
<ComboBoxItem>DO2</ComboBoxItem>
<ComboBoxItem>DO3</ComboBoxItem>
</ComboBox>
<ComboBox Margin="142,12,108,10" Width="70" SelectedIndex="{Binding Lebai_DO_Value}">
<ComboBoxItem IsSelected="true">true</ComboBoxItem>
<ComboBoxItem>false</ComboBoxItem>
</ComboBox>
<Button Width="50" Margin="260,12,10,10" Command="{Binding Button_LebaiDOuputCommand}" >输出</Button>
</Grid>
</Grid>
</Grid>
</GroupBox>
<GroupBox Grid.Row="0"
<GroupBox Grid.Row="2"
FontFamily="楷体"
FontSize="20"
Header=" 冰淇淋机器 ">
Header=" 果汁机 ">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="10*" />
<RowDefinition Height="10*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<TextBlock Text="连接状态" />
<TextBlock Text="{Binding IceCreamConnected}"
<TextBlock Text="{Binding JuicerConnected}"
Margin="120,0,0,0"/>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="120"/>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="设备状态" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Name="Heating" HorizontalAlignment="Center">制热</TextBlock>
<TextBlock Grid.Column="1" Name="cooling" HorizontalAlignment="Center">制冷</TextBlock>
<TextBlock Grid.Column="2" Name="LackOfWater" HorizontalAlignment="Center">缺水</TextBlock>
<TextBlock Grid.Column="3" Name="ChildLocks" HorizontalAlignment="Center">童锁</TextBlock>
<TextBlock Grid.Column="4" Name="Use" HorizontalAlignment="Center">使用</TextBlock>
</Grid>

<TextBlock Grid.Row="0" Grid.Column="0">预冷温度</TextBlock>
<TextBlock
Grid.Row="0"
Grid.Column="1"
Text="{Binding YLWD}" />
<TextBlock Grid.Row="0" Grid.Column="2">回气温度</TextBlock>
<TextBlock
Grid.Row="0"
Grid.Column="3"
Text="{Binding HQWD}" />
</Grid>

<TextBlock Grid.Row="1" Grid.Column="0">环境温度</TextBlock>
<TextBlock
Grid.Row="1"
Grid.Column="1"
Text="{Binding HJWD}" />
<TextBlock Grid.Row="1" Grid.Column="2">当前模式</TextBlock>
<TextBlock
Grid.Row="1"
Grid.Column="3"
Text="{Binding CurrentMode}" />

<TextBlock Grid.Row="2" Grid.Column="0">电流</TextBlock>
<TextBlock
Grid.Row="2"
Grid.Column="1"
Text="{Binding DL}" />
<TextBlock Grid.Row="2" Grid.Column="2">电压</TextBlock>
<TextBlock
Grid.Row="2"
Grid.Column="3"
Text="{Binding DY}" />

<TextBlock Grid.Row="3" Grid.Column="0">成型比</TextBlock>
<TextBlock
Grid.Row="3"
Grid.Column="1"
Text="{Binding CXB}" />
<TextBlock Grid.Row="3" Grid.Column="2">故障</TextBlock>
<TextBlock
Grid.Row="3"
Grid.Column="3"
Text="{Binding IceCreamFault}" />
</Grid>
<StackPanel Grid.Row="2" Orientation="Vertical">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>冰淇淋</TextBlock>
<TextBlock>果汁</TextBlock>
<ComboBox Margin="100,0,0,0"
Width="100" >
<ComboBoxItem IsSelected="true">饮品1</ComboBoxItem>
<ComboBoxItem>饮品2</ComboBoxItem>
<ComboBoxItem>饮品3</ComboBoxItem>
<ComboBoxItem>饮品4</ComboBoxItem>
</ComboBox>
<ComboBox Margin="20,0,0,0" Width="100">
<ComboBoxItem IsSelected="true">冷饮</ComboBoxItem>
<ComboBoxItem>热饮</ComboBoxItem>
</ComboBox>
<Button Command="{Binding Button_MakeIceCreamCommand}"
Margin="40,5" Height="50" Width="170"
Margin="20,0"
Content="制作" />
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="70">
<TextBlock >模式</TextBlock>
<ComboBox Width="100" Height="40" FontSize="22"
Margin="20,0"
ItemsSource="{Binding IceCreamModes}"
SelectedItem="{Binding SelecteIceCreamdMode}" />
<Button Command="{Binding Button_SetIceCreamModelCommand}"
Margin="20,0" Height="50" Width="150"
Content="设置" />
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">

</StackPanel>
</StackPanel>
</Grid>
</GroupBox>
<!--<GroupBox Grid.Row="2" Grid.Column="0"
FontSize="20" FontFamily="楷体"
Header="单片机冰淇淋" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<TextBlock Text="连接状态" />
<TextBlock Text="{Binding SCChipIsConnect}"
Margin="120,0,0,0"/>
<TextBlock Grid.Row="1" Text="单片机控制" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<ListBox Grid.Row="2" Background="Transparent">
<ListBox.Template>
<ControlTemplate TargetType="{x:Type ListBox}">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<WrapPanel Orientation="Horizontal" IsItemsHost="True" ScrollViewer.CanContentScroll="True"/>
</ScrollViewer>
</ControlTemplate>
</ListBox.Template>
<Button Content="咖啡杯落杯" Height="40" Width="120"
Command="{Binding Button_CupControlCommand}"
CommandParameter="CUP_COFFEE"
Margin="10,10,50,10" Cursor="Hand"/>
<Button Content="冰淇淋杯落杯" Height="40" Width="120"
Command="{Binding Button_CupControlCommand}"
CommandParameter="CUP_ICECREAM" Margin="10,10,50,10"
/>
<Button Content="单片机冰淇淋制冷" Height="40" Width="120"
Command="{Binding Button_SCChipRefrigerationCommand}" Cursor="Hand"
Margin="10,10,50,10"
/>
<Button Content="单片机冰淇淋打料" Height="40" Width="120" Margin="10,10,50,10"
Command="{Binding Button_SCChipDischargeCommand}" Cursor="Hand" />
<Button Content="单片机冰淇淋模拟" Height="40" Width="120"
Command="{Binding Button_SCChipTestCommand}" Cursor="Hand"
Margin="10,10,50,10"/>

</ListBox>
</Grid>
</GroupBox>-->

<GroupBox Grid.Row="0" Grid.Column="1"
<GroupBox Grid.Row="2" Grid.Column="1"
FontFamily="楷体"
FontSize="20"
Header=" 咖啡机">
@@ -275,25 +231,26 @@
Text="{Binding CaffeeFault}" Height="22" Width="60" />
</Grid>
<StackPanel Grid.Row="2" Orientation="Vertical">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="60">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>饮品</TextBlock>
<ComboBox Margin="10,0" Height="40" FontSize="20"
Width="120"
<ComboBox Margin="10,0"
Width="100"
ItemsSource="{Binding Coffees}"
SelectedItem="{Binding SelectedCoffee}" />
<Button Margin="10,0" Height="40" Width="120"
<Button Margin="10,0"
Command="{}"
Content="制作"/>
<Button Margin="10,0" Height="40" Width="120"
<Button Margin="10,0"
Command="{}"
Content="停止制作" Cursor="Hand"/>
Content="停止制作"/>
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="60">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>模式</TextBlock>
<ComboBox Margin="10,0" Height="40" Width="120" FontSize="20"
<ComboBox Margin="10,0"
Width="100"
ItemsSource="{Binding CoffeeCmds}"
SelectedItem="{Binding SelectedCoffeeCmd}"/>
<Button Margin="10,0" Height="40" Width="120"
<Button Margin="10,0"
Command="{}"
Content="设置" Cursor="Hand"/>
</StackPanel>
@@ -303,20 +260,140 @@
<GroupBox Header="单片机控制"
FontSize="18"
Grid.Row="1" Grid.ColumnSpan="2"
Margin="0,0,0,10" HorizontalAlignment="Left" Width="1000">
<StackPanel Orientation="Horizontal"
VerticalAlignment="Center" >
<Button Content="咖啡杯落杯" Height="40" Width="170"
Command="{Binding Button_CupControlCommand}"
CommandParameter="CUP_COFFEE"
Margin="10,10,50,10" Cursor="Hand"/>
<Button Content="冰淇淋杯落杯" Height="40" Width="170"
Command="{Binding Button_CupControlCommand}"
CommandParameter="CUP_ICECREAM" Margin="10,10,50,10"
/>
Margin="0,0,0,10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="13*"/>
<ColumnDefinition Width="7*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" >
<TextBlock FontSize="12">连接状态</TextBlock>
<TextBlock Text="{Binding MCUConnected}"
Margin="70,0,0,0"/>
<TextBlock FontSize="12"></TextBlock>
</Grid>
<Grid Grid.Column="1" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.Column="0" >
<TextBlock FontSize="12" HorizontalAlignment="Center">舵机控制</TextBlock>

</StackPanel>
</GroupBox>
</Grid>
<Grid Grid.Row="0" Grid.Column="1">
<ComboBox Margin="0,0,0,0" FontSize="12" Width="60" SelectedIndex="{Binding MCU_PWM_CH}">
<ComboBoxItem IsSelected="true">舵机1</ComboBoxItem>
<ComboBoxItem>舵机2</ComboBoxItem>
<ComboBoxItem>舵机3</ComboBoxItem>
<ComboBoxItem>舵机4</ComboBoxItem>
</ComboBox>
</Grid>
<Grid Grid.Row="1" Grid.Column="0">
<Button FontSize="15" HorizontalAlignment="Center" Command="{Binding Button_MCUOuputCommand}">输出</Button>
</Grid>
<Grid Grid.Row="1" Grid.Column="1" Width="60" >
<TextBox Text="{Binding PWMInputNumber}"></TextBox>
</Grid>
</Grid>
</Grid>
<Grid Grid.Column="2" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.Column="0" >
<TextBlock FontSize="12" HorizontalAlignment="Center">DI输入</TextBlock>
</Grid>
<Grid Grid.Row="1" Grid.Column="0" Width="400">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<CheckBox FontSize="12" IsEnabled="false" IsChecked="{Binding CH0}">DI0</CheckBox>
</Grid>
<Grid Grid.Column="1">
<CheckBox FontSize="12" IsEnabled="false" Name="CH1">DI1</CheckBox>
</Grid>
<Grid Grid.Column="2">
<CheckBox FontSize="12" IsEnabled="false" Name="CH2">DI2</CheckBox>
</Grid>
<Grid Grid.Column="3">
<CheckBox FontSize="12" IsEnabled="false" Name="CH3">DI3</CheckBox>
</Grid>
<Grid Grid.Column="4">
<CheckBox FontSize="12" IsEnabled="false" Name="CH4">DI4</CheckBox>
</Grid>
<Grid Grid.Column="5">
<CheckBox FontSize="12" IsEnabled="false" Name="CH5">DI5</CheckBox>
</Grid>
<Grid Grid.Column="6">
<CheckBox FontSize="12" IsEnabled="false" Name="CH6">DI6</CheckBox>
</Grid>
<Grid Grid.Column="7">
<CheckBox FontSize="12" IsEnabled="false" Name="CH7">DI7</CheckBox>
</Grid>
</Grid>

</Grid>
</Grid>
</Grid>

<Grid Grid.Column="3" >
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock FontSize="12" HorizontalAlignment="Center">DO输出</TextBlock>
</Grid>
<Grid Grid.Column="1" Grid.Row="0">
<ComboBox Width="50" FontSize="12" HorizontalAlignment="Center" SelectedIndex="{Binding MCU_DO_CH}">
<ComboBoxItem IsSelected="true">DO0</ComboBoxItem>
<ComboBoxItem>DO1</ComboBoxItem>
<ComboBoxItem>DO2</ComboBoxItem>
<ComboBoxItem>DO3</ComboBoxItem>
<ComboBoxItem>DO4</ComboBoxItem>
<ComboBoxItem>DO5</ComboBoxItem>
<ComboBoxItem>DO6</ComboBoxItem>
<ComboBoxItem>DO7</ComboBoxItem>
</ComboBox>
</Grid>
<Grid Grid.Column="0" Grid.Row="1">
<Button Width="50" Command="{Binding Button_MCUDOuputCommand}">输出</Button>
</Grid>
<Grid Grid.Column="1" Grid.Row="1">
<RadioButton FontSize="12" IsChecked="{Binding MCU_DO_Value}">True</RadioButton>
<RadioButton Margin="50,0,0,0" FontSize="12">false</RadioButton>
</Grid>
</Grid>
</Grid>
</GroupBox>
</Grid>
</UserControl>

+ 5
- 3
BPASmartClient.MorkT/View/DebugView.xaml.cs View File

@@ -17,7 +17,7 @@ using System.Windows.Shapes;
namespace BPASmartClient.MorkT.View
{
/// <summary>
/// MorkT_DebugView.xaml 的交互逻辑
/// DebugView.xaml 的交互逻辑
/// </summary>
public partial class DebugView : UserControl
{
@@ -28,8 +28,10 @@ namespace BPASmartClient.MorkT.View

private void Dubug_Unloaded(object sender, RoutedEventArgs e)
{
//ThreadManage.GetInstance().StopTask("MorkT-状态刷新");
//ThreadManage.GetInstance().StopTask("MorkT-传感器监视");
ThreadManage.GetInstance().StopTask("MorkT-状态刷新");
ThreadManage.GetInstance().StopTask("MorkT-传感器监视");

}
}

}

+ 92
- 178
BPASmartClient.MorkT/ViewModel/DebugViewModel.cs View File

@@ -8,12 +8,10 @@ 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;
using BPASmartClient.Model.咖啡机.Enum;
using BPASmartClient.MorkT.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
@@ -21,9 +19,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;

namespace BPASmartClient.MorkT.ViewModel
{
namespace BPASmartClient.MorkT.ViewModel;
public class DebugViewModel : ObservableObject
{
@@ -38,12 +34,6 @@ namespace BPASmartClient.MorkT.ViewModel
/// </summary>
public string RobotMode { get { return _robotMode; } set { _robotMode = value; OnPropertyChanged(); } }
private string _robotMode { get; set; }
/// <summary>
/// 乐白机器人自嗨时间间隔
/// </summary>
public int TimeInterval { get { return Global.TimeInterval; } set { Global.TimeInterval = value; OnPropertyChanged(); } }
//private int _timeInterval { get; set; } = Global.TimeInterval;

/// <summary>
/// 机器人控制指令
/// </summary>
@@ -52,110 +42,32 @@ namespace BPASmartClient.MorkT.ViewModel
/// 机器人控制
/// </summary>
/// <param name="o"></param>
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 });
}
private void Button_RobotControl(object o)
{
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 冰淇淋机器
/// <summary>
/// 制作冰淇淋
/// </summary>
public RelayCommand Button_MakeIceCreamCommand { get; set; }
/// <summary>
/// 选择冰淇淋模式
/// </summary>
public RelayCommand Button_SetIceCreamModelCommand { get; set; }

#region 果汁机
/// <summary>
/// 冰淇淋连接状态
/// 果汁机的连接状态
/// </summary>
public string IceCreamConnected { get { return _iceCreamConnected; } set { _iceCreamConnected = value; OnPropertyChanged(); } }
private string _iceCreamConnected { get; set; }
/// <summary>
/// 预冷温度
/// </summary>
public string YLWD { get { return _yLWD; } set { _yLWD = value; OnPropertyChanged(); } }
private string _yLWD { get; set; }
/// <summary>
/// 回气温度
/// </summary>
public string HQWD { get { return _hQWD; } set { _hQWD = value; OnPropertyChanged(); } }
private string _hQWD { get; set; }
/// <summary>
/// 环境温度
/// </summary>
public string HJWD { get { return _hJWD; } set { _hJWD = value; OnPropertyChanged(); } }
private string _hJWD { get; set; }
/// <summary>
/// 电流
/// </summary>
public string DL { get { return _DL; } set { _DL = value; OnPropertyChanged(); } }
private string _DL { get; set; }
/// <summary>
/// 电压
/// </summary>
public string DY { get { return _dy; } set { _dy = value; OnPropertyChanged(); } }
private string _dy { get; set; }
/// <summary>
/// 当前模式
/// </summary>
public string CurrentMode { get { return _CurrentMode; } set { _CurrentMode = value; OnPropertyChanged(); } }
private string _CurrentMode;
/// <summary>
/// 故障
/// </summary>
public string IceCreamFault { get { return _IceCreamFault; } set { _IceCreamFault = value; OnPropertyChanged(); } }
private string _IceCreamFault { get; set; }
/// <summary>
/// 成型比
/// </summary>
public string CXB { get { return _cXB; } set { _cXB = value; OnPropertyChanged(); } }
private string _cXB { get; set; }
public string JuicerConnected { get { return _JuicerConnected; } set { _JuicerConnected = value; OnPropertyChanged(); } }
private string _JuicerConnected { get; set; }
/// <summary>
/// 打料完成状态
/// 果汁机的状态
/// </summary>
public string DLCompleted { get { return _dLCompleted; } set { _dLCompleted = value; OnPropertyChanged(); } }
private string _dLCompleted { get; set; }

public List<string> IceCreamModes { get; set; } = new List<string>();
public string SelecteIceCreamdMode { get; set; }

private void Button_MakeIceCream()
{
EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId });
}
private void Button_SetIceCreamModel()
{
MORKI_MODE mORKI_MODE = (MORKI_MODE)Enum.Parse(typeof(MORKI_MODE), SelecteIceCreamdMode);
EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = mORKI_MODE });
}
public string JuicerState { get { return _JuicerState; } set { _JuicerState = value; OnPropertyChanged(); } }
private string _JuicerState { get; set; }
#endregion

#region 咖啡机
/// <summary>
/// 咖啡机连接状态
/// </summary>
/// </summary>
public string CoffeeConnected { get { return _coffeeConnected; } set { _coffeeConnected = value; OnPropertyChanged(); } }
private string _coffeeConnected { get; set; }
/// <summary>
@@ -212,55 +124,81 @@ namespace BPASmartClient.MorkT.ViewModel
#endregion

#region 单片机
/// <summary>
/// 单片机连接状态
/// </summary>
public string SCChipIsConnect { get { return _sCChipIsConnect; } set { _sCChipIsConnect = value; OnPropertyChanged(); } }
private string _sCChipIsConnect { get; set; }
/// <summary>
/// 咖啡杯或冰淇淋杯落杯
/// </summary>
public RelayCommand<object> Button_CupControlCommand { get; set; }
/// <summary>
/// 单片机冰淇淋机器制冷
/// </summary>
public RelayCommand Button_SCChipRefrigerationCommand { get; set; }
/// <summary>
/// 单片机冰淇淋机器打料
/// </summary>
public RelayCommand Button_SCChipDischargeCommand { get; set; }
/// <summary>
/// 模拟测试
/// </summary>
public RelayCommand Button_SCChipTestCommand { get; set; }

private void Button_CupControl(object CupType)
public string MCUConnected { get { return _mcuConnected; } set { _mcuConnected = value; OnPropertyChanged(); } }
private string _mcuConnected { get; set; }

public RelayCommand Button_MCUOuputCommand { get; set; }
public RelayCommand Button_MCUDOuputCommand { get; set; }
public RelayCommand Button_LebaiDOuputCommand { get; set; }
public int PWMInputNumber { get { return _pwmInputNumber; } set { _pwmInputNumber = value; OnPropertyChanged(); } }
private int _pwmInputNumber = 1;

public int MCU_PWM_CH { get { return _choosePWM; } set { _choosePWM = value; OnPropertyChanged(); } }
private int _choosePWM = 1;

public int MCU_DO_CH { get { return _mcuDO_CH; } set { _mcuDO_CH = value; OnPropertyChanged(); } }
private int _mcuDO_CH = 1;

public int Lebai_DO_CH { get { return _lebaiDO_CH; } set { _lebaiDO_CH = value; OnPropertyChanged(); } }
private int _lebaiDO_CH = 1;

public int Lebai_DO_Value { get { return _lebaiDO_Value; } set { _lebaiDO_Value = value; OnPropertyChanged(); } }
private int _lebaiDO_Value = 1;

private int[] DICH { get { return _diCH; } set { _diCH = value; OnPropertyChanged(); } }
private int[] _diCH = new int[8];

public bool MCU_DO_Value { get { return _mcu_DO_Valuer; } set { _mcu_DO_Valuer = value; OnPropertyChanged(); } }
private bool _mcu_DO_Valuer = true;

public bool MCU_DI0 { get { return _mcu_DI0; }set { _mcu_DI0 = value;OnPropertyChanged(); } }
private bool _mcu_DI0 = true;
public bool MCU_DI1 { get { return _mcu_DI1; } set { _mcu_DI1 = value; OnPropertyChanged(); } }
private bool _mcu_DI1 = true;
public bool MCU_DI2 { get { return _mcu_DI2; } set { _mcu_DI2 = value; OnPropertyChanged(); } }
private bool _mcu_DI2 = true;
public bool MCU_DI3 { get { return _mcu_DI3; } set { _mcu_DI3 = value; OnPropertyChanged(); } }
private bool _mcu_DI3 = true;
public bool MCU_DI4 { get { return _mcu_DI4; } set { _mcu_DI4 = value; OnPropertyChanged(); } }
private bool _mcu_DI4 = true;
public bool MCU_DI5 { get { return _mcu_DI5; } set { _mcu_DI5 = value; OnPropertyChanged(); } }
private bool _mcu_DI5 = true;
public bool MCU_DI6 { get { return _mcu_DI6; } set { _mcu_DI6 = value; OnPropertyChanged(); } }
private bool _mcu_DI6 = true;
public bool MCU_DI7 { get { return _mcu_DI7; } set { _mcu_DI7 = value; OnPropertyChanged(); } }
private bool _mcu_DI7 = true;
/// <summary>
/// 单片机舵机输出
/// </summary>
private void Button_McuOutput()
{
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent() { DeviceId = DeviceId, Cup = (IC_CUP)Enum.Parse(typeof(IC_CUP), CupType.ToString()) });
string sChoosePWM =Convert.ToString(MCU_PWM_CH+1);
new WriteMcu() { TagName = "ServoControl", Address = sChoosePWM, Value = PWMInputNumber }.Publish();
}

private void Button_SCChipRefrigeration()
/// <summary>
/// 单片机DO输出
/// </summary>
private void Button_McuDOutput()
{
//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, Value = true, Pin = 1 });
Thread.Sleep(500);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Value = false, Pin = 1 });

string sChooseDO = Convert.ToString(MCU_DO_CH + 1);
new WriteMcu() { TagName = "OutputControl", Address = sChooseDO, Value = MCU_DO_Value }.Publish();
}

private void Button_SCChipDischarge()
/// <summary>
/// 乐白的DO输出
/// </summary>
private void Button_LebaiDOutput()
{
EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 });
int sChooseDO = Convert.ToInt16(Lebai_DO_CH);
bool lebai_DO_Value = Convert.ToInt16(Lebai_DO_Value) == 0;
new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Pin = sChooseDO, Value = lebai_DO_Value }.Publish();
}
#endregion

#endregion

/// <summary>
/// 设备ID
/// </summary>
public int DeviceId { get; set; }
/// <summary>
/// 设备ID
/// </summary>
public int DeviceId { get; set; }
/// <summary>
/// 设备数据
/// </summary>
@@ -269,27 +207,14 @@ namespace BPASmartClient.MorkT.ViewModel
public DebugViewModel()
{
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);

Button_MakeCoffeeCommand = new RelayCommand(Button_MakeCoffee);
Button_StopMakeCoffeCommand = new RelayCommand(Button_StopMakeCoffe);
Button_CoffeeModeSetCommand = new RelayCommand(Button_CoffeeModeSet);

Button_CupControlCommand = new RelayCommand<object>(Button_CupControl);
Button_SCChipRefrigerationCommand = new RelayCommand(Button_SCChipRefrigeration);
Button_SCChipDischargeCommand = new RelayCommand(Button_SCChipDischarge);
Button_SCChipTestCommand = new RelayCommand(() =>
{
Button_SCChipRefrigeration();
Thread.Sleep(50);
Button_SCChipDischarge();
});

foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode)))
Button_MCUOuputCommand = new RelayCommand(Button_McuOutput);
Button_MCUDOuputCommand = new RelayCommand(Button_McuDOutput);
Button_LebaiDOuputCommand = new RelayCommand(Button_LebaiDOutput);
foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode)))
{
Coffees.Add(code.ToString());
}
@@ -300,17 +225,14 @@ namespace BPASmartClient.MorkT.ViewModel
}
SelectedCoffeeCmd = CoffeeCmds[0];

foreach (MORKI_MODE code in Enum.GetValues(typeof(MORKI_MODE)))
{
IceCreamModes.Add(code.ToString());
}
SelecteIceCreamdMode = IceCreamModes[0];

Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device =>
{
if (device.Name == "MorkT") DeviceId = device.DeviceId
;
});


ThreadManage.GetInstance().StartLong(new Action(() =>
{

@@ -318,10 +240,10 @@ namespace BPASmartClient.MorkT.ViewModel

if (variableMonitors != null && variableMonitors.Count > 0)
{
RobotConnected = variableMonitors.FirstOrDefault(p=>p.Notes == "机器人连接状态").CurrentValue == "True" ? "已连接" : "未连接";
IceCreamConnected = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋连接状态").CurrentValue == "True" ? "已连接" : "未连接";
RobotConnected = variableMonitors.FirstOrDefault(p=>p.Notes == "机器人连接状态").CurrentValue == "True" ? "已连接" : "未连接";
CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
SCChipIsConnect = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
JuicerConnected = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
MCUConnected = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接";

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

@@ -330,19 +252,11 @@ namespace BPASmartClient.MorkT.ViewModel
Warning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue;
CaffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue;

YLWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器预冷温度").CurrentValue;
HQWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器回气温度").CurrentValue;
HJWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器环境温度").CurrentValue;
DL = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器电流").CurrentValue;
DY = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器电压").CurrentValue;
CurrentMode = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器模式").CurrentValue;
IceCreamFault = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器异常").CurrentValue;
CXB = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器成型比").CurrentValue;
DLCompleted = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器打料完成")?.CurrentValue == "True" ? "打料完成" : "打料中";

}
Thread.Sleep(500);
}), "MorkT-状态刷新");
}

}
}
}


+ 0
- 1
BPASmartClient.MorkTM/Control_MorkTM.cs View File

@@ -435,7 +435,6 @@ namespace BPASmartClient.MorkTM
}
}
}

public override void SimOrder()
{


+ 1
- 1
BPASmartClient.ScreenALL/App.config View File

@@ -2,7 +2,7 @@
<configuration>
<appSettings>
<!--MQTT配置-->
<add key="MQTTConnection" value="10.2.1.254,1883,admin,public"/>
<add key="MQTTConnection" value="171.221.208.23,11883,admin,public1"/>
<!--订阅主题设置:大炒,小炒,分餐机,煮面机-->
<add key="DeviceMC" value="大炒,小炒,分餐机,煮面机"/>
<add key="GgAdder" value="https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4"/>


+ 68
- 23
BPASmartClient.ScreenLib/AppMain.cs View File

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


namespace BPASmartClient.ScreenLib
{
public partial class AppMain
@@ -17,6 +18,7 @@ namespace BPASmartClient.ScreenLib
Main.GetInstance.Start();
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
FSystemHelper.GetInstance.CreateDesktopShortcut();
// FSystemHelper.GetInstance.AutoStart(true);
WindowLargeScreen windowLarge = new WindowLargeScreen();
#region 设置显示页面与标题
string TitleName = $"{type.Assembly.ManifestModule.Name.Replace(".dll", "")}";
@@ -44,56 +46,99 @@ namespace BPASmartClient.ScreenLib
windowLarge2.Init("二号" + TitleName, new ScreenSplitMealsControl2());
WindowLargeScreen windowLarge3 = new WindowLargeScreen();
windowLarge3.Init("三号" + TitleName, new ScreenSplitMealsControl3());

int i = 0;
foreach (System.Windows.Forms.Screen scr in System.Windows.Forms.Screen.AllScreens)
for (int i = 0; i < 3; i++)
{
if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["一号屏"].ToString())
if (i==0)
{
windowLarge.WindowStartupLocation = WindowStartupLocation.Manual;
windowLarge.Left = scr.WorkingArea.Left;
windowLarge.Top = scr.WorkingArea.Top;
windowLarge.Width = scr.Bounds.Width;
windowLarge.Height = scr.Bounds.Height;
windowLarge.Left = i * 1920;
windowLarge.Top = 0;
windowLarge.Height = 1080;
windowLarge.Width = 1920;
windowLarge.WindowState = WindowState.Maximized;
windowLarge.ResizeMode = ResizeMode.NoResize;
windowLarge.WindowStyle = WindowStyle.None;
windowLarge.WindowState = WindowState.Normal;
windowLarge.ShowInTaskbar = false;
windowLarge.Topmost = true;
}
else if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["二号屏"].ToString())
else if (i == 1)
{
windowLarge2.WindowStartupLocation = WindowStartupLocation.Manual;
windowLarge2.Left = scr.WorkingArea.Left;
windowLarge2.Top = scr.WorkingArea.Top;
windowLarge2.Width = scr.Bounds.Width;
windowLarge2.Height = scr.Bounds.Height;
windowLarge2.Left = i * 1920;
windowLarge2.Top = 0;
windowLarge2.Height = 1080;
windowLarge2.Width = 1920;
windowLarge2.WindowState = WindowState.Maximized;
windowLarge2.ResizeMode = ResizeMode.NoResize;
windowLarge2.WindowStyle = WindowStyle.None;
windowLarge2.WindowState = WindowState.Normal;
windowLarge2.ShowInTaskbar = false;
windowLarge2.Topmost = true;
}
else if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["三号屏"].ToString())
else if (i == 2)
{
windowLarge3.WindowStartupLocation = WindowStartupLocation.Manual;
windowLarge3.Left = scr.WorkingArea.Left;
windowLarge3.Top = scr.WorkingArea.Top;
windowLarge3.Width = scr.Bounds.Width;
windowLarge3.Height = scr.Bounds.Height;
windowLarge3.Left = i * 1920;
windowLarge3.Top = 0;
windowLarge3.Height = 1080;
windowLarge3.Width = 1920;
windowLarge3.WindowState = WindowState.Maximized;
windowLarge3.ResizeMode = ResizeMode.NoResize;
windowLarge3.WindowStyle = WindowStyle.None;
windowLarge3.WindowState = WindowState.Normal;
windowLarge3.ShowInTaskbar = false;
windowLarge3.Topmost = true;

}
i++;
}
windowLarge.Show(); windowLarge2.Show(); windowLarge3.Show();
#region 不需要代码
//foreach (System.Windows.Forms.Screen scr in System.Windows.Forms.Screen.AllScreens)
//{
// if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["一号屏"].ToString())
// {
// windowLarge.WindowStartupLocation = WindowStartupLocation.Manual;
// windowLarge.Left = scr.WorkingArea.Left;
// windowLarge.Top = scr.WorkingArea.Top;
// windowLarge.Width = scr.Bounds.Width;
// windowLarge.Height = scr.Bounds.Height;
// windowLarge.WindowState = WindowState.Maximized;
// windowLarge.ResizeMode = ResizeMode.NoResize;
// windowLarge.WindowStyle = WindowStyle.None;
// windowLarge.WindowState = WindowState.Normal;
// windowLarge.ShowInTaskbar = false;
// windowLarge.Topmost = true;
// }
// else if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["二号屏"].ToString())
// {
// windowLarge2.WindowStartupLocation = WindowStartupLocation.Manual;
// windowLarge2.Left = scr.WorkingArea.Left;
// windowLarge2.Top = scr.WorkingArea.Top;
// windowLarge2.Width = scr.Bounds.Width;
// windowLarge2.Height = scr.Bounds.Height;
// windowLarge2.WindowState = WindowState.Maximized;
// windowLarge2.ResizeMode = ResizeMode.NoResize;
// windowLarge2.WindowStyle = WindowStyle.None;
// windowLarge2.WindowState = WindowState.Normal;
// windowLarge2.ShowInTaskbar = false;
// windowLarge2.Topmost = true;
// }
// else if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["三号屏"].ToString())
// {
// windowLarge3.WindowStartupLocation = WindowStartupLocation.Manual;
// windowLarge3.Left = scr.WorkingArea.Left;
// windowLarge3.Top = scr.WorkingArea.Top;
// windowLarge3.Width = scr.Bounds.Width;
// windowLarge3.Height = scr.Bounds.Height;
// windowLarge3.WindowState = WindowState.Maximized;
// windowLarge3.ResizeMode = ResizeMode.NoResize;
// windowLarge3.WindowStyle = WindowStyle.None;
// windowLarge3.WindowState = WindowState.Normal;
// windowLarge3.ShowInTaskbar = false;
// windowLarge3.Topmost = true;

// }
// i++;
//}
#endregion
windowLarge.Show();windowLarge2.Show(); windowLarge3.Show();
break;
}
#endregion


+ 54
- 5
BPASmartClient.ScreenLib/Helper/Main.cs View File

@@ -1,16 +1,22 @@
using BPA.Communication;
using BPA.Helper;
using BPA.Message;
using IWshRuntimeLibrary;
using Microsoft.Web.WebView2.Wpf;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Shapes;
using System.Xml;

namespace BPASmartClient.ScreenLib
{
@@ -72,6 +78,11 @@ namespace BPASmartClient.ScreenLib
MQTTConnection = PZdic["MQTTConnection"];
if (PZdic.ContainsKey("DeviceMC"))
Name = PZdic["DeviceMC"];
mqttDatasDic[ScreenDeviceType.大炒] = new ScreenModelMaxWok();
mqttDatasDic[ScreenDeviceType.小炒] = new ScreenModelMinWok();
mqttDatasDic[ScreenDeviceType.分餐机] = new ScreenModelSplitMeals();
mqttDatasDic[ScreenDeviceType.煮面机] = new ScreenModelMorkS();

}
/// <summary>
/// 设备数据
@@ -223,7 +234,7 @@ namespace BPASmartClient.ScreenLib
/// </summary>
/// <param name="input"></param>
/// <param name="view2"></param>
public async void InitView2(string input, WebView2 view2, GroupBox group)
public async void InitView2(string input, WebView2 view2, System.Windows.Controls.GroupBox group)
{
var height = 540;
var width = 940;
@@ -231,10 +242,48 @@ namespace BPASmartClient.ScreenLib
StringBuilder sb = new StringBuilder();
sb.Append("<html><style>body {width: " + width + "px;height: " + height + "px;margin: 0;padding:0;}body p {width: " + width + "px;height: " + height + "px;}body p img {width: 100%;height: 100%;}</style><script>function Set(width, height) { var body = document.getElementsByTagName('body')[0]; body.style.width = width + 'px';body.style.height = height + 'px';var p = document.getElementsByTagName('p')[0]; p.style.width = width + 'px';p.style.height = height + 'px';}</script><body>" + input + "</body></html>");
var html = sb.ToString();
await view2.EnsureCoreWebView2Async(null);
view2.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false;
view2.CoreWebView2.Settings.AreDevToolsEnabled = false;
view2.CoreWebView2.NavigateToString(html);

string name = $"{Application.StartupPath}\\Html\\{Name}.html";
if (!System.IO.Directory.Exists($"{Application.StartupPath}\\Html"))
{
System.IO.Directory.CreateDirectory($"{Application.StartupPath}\\Html");//不存在就创建文件夹 }
}
if (!System.IO.File.Exists(name))
{
//----------生成htm文件------------------――
try
{
using (StreamWriter sw = new StreamWriter(name, false, System.Text.Encoding.GetEncoding("UTF-8"))) //保存地址
{
sw.WriteLine(html);
sw.Flush();
sw.Close();
}
}
catch
{
}
}
else
{
string text = System.IO.File.ReadAllText(name);
if (text.Replace("\r\n", "") != html)
{
try
{
using (StreamWriter sw = new StreamWriter(name, false, System.Text.Encoding.GetEncoding("UTF-8"))) //保存地址
{
sw.WriteLine(html);
sw.Flush();
sw.Close();
}
}
catch
{
}
}
}
view2.Source = new Uri(name);
}
/// <summary>
/// 读取配置


+ 12
- 12
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml View File

@@ -23,7 +23,7 @@
</Grid.ColumnDefinitions>
<StackPanel Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="2 号档口" Style="{DynamicResource from}" Tag="Start">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="1 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
@@ -33,7 +33,7 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -48,7 +48,7 @@
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
@@ -60,11 +60,11 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock>
</StackPanel>
</Grid>
@@ -72,7 +72,7 @@
</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
@@ -122,7 +122,7 @@
</StackPanel>
<StackPanel Grid.Column="2" Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="1 号档口" Style="{DynamicResource from}" Tag="Start">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="2 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
@@ -132,7 +132,7 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -147,7 +147,7 @@
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
@@ -159,11 +159,11 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock>
</StackPanel>
</Grid>
@@ -171,7 +171,7 @@
</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>


+ 1
- 1
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs View File

@@ -69,7 +69,7 @@ namespace BPASmartClient.ScreenLib
OrderCount = modelMaxWok.SplitMeals_CreditCardCount_1 + modelMaxWok.SplitMeals_CreditCardCount_2;
}
}));
Thread.Sleep(1000);
Thread.Sleep(100);
}), $"{DateTime.Now}_1,线程服务");
}
}


+ 12
- 12
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml View File

@@ -23,7 +23,7 @@
</Grid.ColumnDefinitions>
<StackPanel Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="4 号档口" Style="{DynamicResource from}" Tag="Start">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="3 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
@@ -33,7 +33,7 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -48,7 +48,7 @@
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
@@ -60,11 +60,11 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock>
</StackPanel>
</Grid>
@@ -72,7 +72,7 @@
</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
@@ -122,7 +122,7 @@
</StackPanel>
<StackPanel Grid.Column="2" Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="3 号档口" Style="{DynamicResource from}" Tag="Start">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="4 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
@@ -132,7 +132,7 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -147,7 +147,7 @@
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
@@ -159,11 +159,11 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock>
</StackPanel>
</Grid>
@@ -171,7 +171,7 @@
</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>


+ 1
- 1
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2ViewModel.cs View File

@@ -69,7 +69,7 @@ namespace BPASmartClient.ScreenLib

}
}));
Thread.Sleep(1000);
Thread.Sleep(100);
}), $"{DateTime.Now}_2,线程服务");
}
}


+ 12
- 12
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3.xaml View File

@@ -23,7 +23,7 @@
</Grid.ColumnDefinitions>
<StackPanel Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="2 号档口" Style="{DynamicResource from}" Tag="Start">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="5 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
@@ -33,7 +33,7 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -48,7 +48,7 @@
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
@@ -60,11 +60,11 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock>
</StackPanel>
</Grid>
@@ -72,7 +72,7 @@
</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
@@ -122,7 +122,7 @@
</StackPanel>
<StackPanel Grid.Column="2" Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="5 号档口" Style="{DynamicResource from}" Tag="Start">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="6 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
@@ -132,7 +132,7 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -147,7 +147,7 @@
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
@@ -159,11 +159,11 @@
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock>
</StackPanel>
</Grid>
@@ -171,7 +171,7 @@
</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>


+ 1
- 0
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3.xaml.cs View File

@@ -23,6 +23,7 @@ namespace BPASmartClient.ScreenLib
public ScreenSplitMealsControl3()
{
InitializeComponent();
this.DataContext = new ScreenSplitMealsControl3ViewModel();

if (int.Parse(System.Configuration.ConfigurationManager.AppSettings["ShowForm"].ToString()) == 0)
{


+ 1
- 1
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3ViewModel.cs View File

@@ -68,7 +68,7 @@ namespace BPASmartClient.ScreenLib
OrderCount = modelMaxWok.SplitMeals_CreditCardCount_5 + modelMaxWok.SplitMeals_CreditCardCount_6;
}
}));
Thread.Sleep(1000);
Thread.Sleep(100);
}), $"{DateTime.Now}_3,线程服务");
}
}


+ 24
- 5
BPASmartClient.ScreenLib/总监视大屏/ScreenALLControl.xaml View File

@@ -204,6 +204,9 @@
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
@@ -222,6 +225,9 @@
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
@@ -283,6 +289,9 @@
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
@@ -301,6 +310,9 @@
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
@@ -310,7 +322,7 @@
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="0" Margin="10,10,10,0" Height="310" Width="450" Header="煮面设备 MorkS" Style="{DynamicResource from}" Tag="Start">
<GroupBox Grid.Row="0" Margin="10,10,10,0" Height="320" Width="450" Header="煮面设备 MorkS" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备信息" Margin="20,0,0,0"/>
<Grid Height="80" >
@@ -346,6 +358,9 @@
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
@@ -372,8 +387,9 @@
</StackPanel>
</GroupBox>
</StackPanel>
<Grid Grid.Column="1" >
<Grid> <Grid VerticalAlignment="Top" Margin="0,-30,0,0"> <Image Style="{DynamicResource imagezhu}"></Image> <Image Style="{DynamicResource image中1}" Margin="0,400,0,0"></Image> <GroupBox Margin="600,100,0,500" Header="{Binding GZallCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="累计故障数" Content="次" Width="100"/> <GroupBox Margin="600,400,0,0" Header="{Binding SplitMealsCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="食堂累计刷卡次数" Content="次" Width="160"/> <GroupBox Margin="-500,100,0,0" Header="{Binding UserCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="日总接待人数" Content="人" Width="160"/> </Grid> <GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="信息通知区域" VerticalAlignment="Bottom" Style="{DynamicResource from}">
<Grid> <Grid VerticalAlignment="Top" Margin="0,-30,0,0"> <Image Style="{DynamicResource imagezhu}"></Image> <Image Style="{DynamicResource image中1}" Margin="0,400,0,0"></Image> <GroupBox Margin="600,100,0,500" Header="{Binding GZallCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="累计故障数" Content="次" Width="100"/> <GroupBox Margin="600,400,0,0" Header="{Binding SplitMealsCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="食堂累计刷卡次数" Content="次" Width="160"/> <GroupBox Margin="-500,100,0,0" Header="{Binding UserCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="日总接待人数" Content="人" Width="160"/> </Grid> <GroupBox Margin="0,0,0,0" Height="320" Width="950" Header="信息通知区域" VerticalAlignment="Bottom" Style="{DynamicResource from}">
<!--<ListBox Margin="10,-10,10,10" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemsSource="{Binding AlarmAll,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
@@ -457,6 +473,9 @@
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
@@ -483,21 +502,21 @@
</StackPanel>
</GroupBox>
<GroupBox Margin="10,10,10,0" Height="640" Width="450" Header="今日商品热销统计" Style="{DynamicResource from}">
<GroupBox Margin="10,10,10,0" Height="650" Width="450" Header="今日商品热销统计" Style="{DynamicResource from}">
<ListBox
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding StatsCountAll,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel x:Name="mainPanel1" Margin="15,5,0,0" >
<StackPanel x:Name="mainPanel1" Margin="15,0,0,0" >
<StackPanel Orientation="Horizontal">
<TextBlock HorizontalAlignment="Left" Style="{DynamicResource textms}" Margin="10,5,0,0" FontSize="20" Text="{Binding Name}"/>
<TextBlock HorizontalAlignment="Left" Style="{DynamicResource textms}" Margin="10,5,0,0" FontSize="20" Text="/"/>
<TextBlock HorizontalAlignment="Left" Style="{DynamicResource textms}" Margin="10,5,0,0" FontSize="20" Text="{Binding Count, StringFormat={}{0} 单}"/>
</StackPanel>
<Grid HorizontalAlignment="Left" Margin="0,5,0,0">
<ProgressBar Style="{DynamicResource bfb}" Value="{Binding bfb,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="360" Height="24" Margin="10,0,0,0"></ProgressBar>
<ProgressBar Style="{DynamicResource bfb}" Value="{Binding bfb,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="360" Height="19" Margin="10,0,0,0"></ProgressBar>
</Grid>
</StackPanel>


+ 13
- 10
BPASmartClient.ScreenLib/总监视大屏/ScreenALLControlViewModel.cs View File

@@ -152,8 +152,12 @@ namespace BPASmartClient.ScreenLib
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
{
ViewData = Main.GetInstance.mqttDatasDic;

//所有告警
List<AlarmModel> alarms = new List<AlarmModel>();
//所有统计
List<StatsModel> Stats = new List<StatsModel>();

foreach (var item in Main.GetInstance.mqttDatasDic)
{
if (item.Value != null)
@@ -184,7 +188,6 @@ namespace BPASmartClient.ScreenLib
ScreenModelMaxWok min = ViewData[ScreenDeviceType.大炒] as ScreenModelMaxWok;
MaxCout = min.MaxWok_OrderCount_1 + min.MaxWok_OrderCount_2;
gz += min.FailuresCount;

}

if (ViewData.ContainsKey(ScreenDeviceType.分餐机))
@@ -194,7 +197,6 @@ namespace BPASmartClient.ScreenLib
+ min.SplitMeals_CreditCardCount_3 + min.SplitMeals_CreditCardCount_4
+ min.SplitMeals_CreditCardCount_5 + min.SplitMeals_CreditCardCount_6;
gz += min.FailuresCount;

}

int zmj_count = 0;
@@ -203,23 +205,24 @@ namespace BPASmartClient.ScreenLib
ScreenModelMorkS morks = ViewData[ScreenDeviceType.煮面机] as ScreenModelMorkS;
zmj_count = morks.MorkS_OrderCount;
gz += morks.FailuresCount;

}

UserCout = SplitMealsCout + MaxCout + MinCout + zmj_count;

GZallCout = gz;


if (Stats != null && Stats.Count > 0)
{
Dictionary<string, int> _Stats = new Dictionary<string, int>();
foreach (StatsModel item in Stats)
{
if(!_Stats.ContainsKey(item.Name))
_Stats[item.Name]= item.Count;
else
_Stats[item.Name] += item.Count;
if (!string.IsNullOrEmpty(item.Name))
{
if (!_Stats.ContainsKey(item.Name))
_Stats[item.Name] = item.Count;
else
_Stats[item.Name] += item.Count;
}
}
List<StatsAllModel> _Statsall = new List<StatsAllModel>();
_Stats?.ToList().ForEach(par => {
@@ -234,7 +237,7 @@ namespace BPASmartClient.ScreenLib
StatsCountAll= JsonConvert.DeserializeObject<ObservableCollection<StatsAllModel>>(str);
}
}));
Thread.Sleep(2000);
Thread.Sleep(1000);
}), $"{DateTime.Now},线程服务");
}
}


+ 1
- 1
BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs View File

@@ -85,7 +85,7 @@ namespace BPASmartClient.ScreenLib
OrderMakeListOver = JsonConvert.DeserializeObject<ObservableCollection<OrderMakeFormModel>>(JsonConvert.SerializeObject(ViewData.MakeOrderOver));
}
}));
Thread.Sleep(1000);
Thread.Sleep(100);
}), $"{DateTime.Now},线程服务");
}
}


+ 2
- 2
BPASmartClient.ScreenMaxWok/App.config View File

@@ -2,9 +2,9 @@
<configuration>
<appSettings>
<!--MQTT配置-->
<add key="MQTTConnection" value="10.2.1.254,1883,admin,public"/>
<add key="MQTTConnection" value="171.221.208.23,11883,admin,public1"/>
<!--订阅主题设置:大炒,小炒,分餐机,煮面机-->
<add key="DeviceMC" value="大炒,小炒,分餐机,煮面机"/>
<add key="DeviceMC" value="大炒"/>
<add key="GgAdder" value="https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4"/>
<add key="SaasRoute" value="https://witt.black-pa.com/kitchen/api/StoreHelper/GeBasisGateList?StoreId=0c32b2e2-0dc9-4941-b73d-3dc91f7268ab"/>
<!--显示窗体:0 广告 1 地球-->


+ 3
- 2
BPASmartClient.ScreenMinWok/App.config View File

@@ -2,9 +2,10 @@
<configuration>
<appSettings>
<!--MQTT配置-->
<add key="MQTTConnection" value="10.2.1.254,1883,admin,public"/>
<!--<add key="MQTTConnection" value="10.2.1.254,1883,admin,public"/>-->
<add key="MQTTConnection" value="171.221.208.23,11883,admin,public1"/>
<!--订阅主题设置:大炒,小炒,分餐机,煮面机-->
<add key="DeviceMC" value="大炒,小炒,分餐机,煮面机"/>
<add key="DeviceMC" value="小炒"/>
<add key="GgAdder" value="https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4"/>
<add key="SaasRoute" value="https://witt.black-pa.com/kitchen/api/StoreHelper/GeBasisGateList?StoreId=0c32b2e2-0dc9-4941-b73d-3dc91f7268ab"/>
<!--显示窗体:0 广告 1 地球-->


+ 2
- 2
BPASmartClient.ScreenMorks/App.config View File

@@ -2,9 +2,9 @@
<configuration>
<appSettings>
<!--MQTT配置-->
<add key="MQTTConnection" value="10.2.1.254,1883,admin,public"/>
<add key="MQTTConnection" value="171.221.208.23,11883,admin,public1"/>
<!--订阅主题设置:大炒,小炒,分餐机,煮面机-->
<add key="DeviceMC" value="大炒,小炒,分餐机,煮面机"/>
<add key="DeviceMC" value="煮面机"/>
<add key="GgAdder" value="https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4"/>
<add key="SaasRoute" value="https://witt.black-pa.com/kitchen/api/StoreHelper/GeBasisGateList?StoreId=0c32b2e2-0dc9-4941-b73d-3dc91f7268ab"/>
<!--显示窗体:0 广告 1 地球-->


+ 5
- 5
BPASmartClient.ScreenSplitMeals/App.config View File

@@ -2,15 +2,15 @@
<configuration>
<appSettings>
<!--MQTT配置-->
<add key="MQTTConnection" value="10.2.1.254,1883,admin,public"/>
<add key="MQTTConnection" value="171.221.208.23,11883,admin,public1"/>
<!--订阅主题设置:大炒,小炒,分餐机,煮面机-->
<add key="DeviceMC" value="大炒,小炒,分餐机,煮面机"/>
<add key="DeviceMC" value="分餐机"/>
<add key="GgAdder" value="https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4"/>
<add key="SaasRoute" value="https://witt.black-pa.com/kitchen/api/StoreHelper/GeBasisGateList?StoreId=0c32b2e2-0dc9-4941-b73d-3dc91f7268ab"/>
<!--显示窗体:0 广告 1 地球-->
<add key="ShowForm" value="1"/>
<add key="一号屏" value="0"/>
<add key="ShowForm" value="0"/>
<!--<add key="一号屏" value="0"/>
<add key="二号屏" value="1"/>
<add key="三号屏" value="0"/>
<add key="三号屏" value="2"/>-->
</appSettings>
</configuration>

+ 7
- 1
BPASmartClient/App.config View File

@@ -29,7 +29,7 @@
<add key="DeviceName" value="qsqdzklb"/>
<add key="DeviceSecret" value="e2b300892c3e21469c8dc6c7c5c4430d"/>
<add key="PasswordBox" value="6WrKhYmTIhLV7g24jIH/lg=="/>

<!--外设配置-->
<add key="COM_Coffee" value="COM3"/>
@@ -39,6 +39,12 @@
<add key="IceCream_CXB_Threshold" value="90"/>
<add key="COM_ICChip" value="COM6"/>
<add key="BAUD_IChip" value="9600"/>
<!--大屏MQTT-->
<add key="MQTT_DevieScreem_IP" value="171.221.208.23"/>
<add key="MQTT_DevieScreem_Port" value="11883"/>
<add key="MQTT_DevieScreem_User" value="admin"/>
<add key="MQTT_DevieScreem_Password" value="public1"/>


</appSettings>

+ 2
- 2
BPASmartClient/AssemblyInfo.cs View File

@@ -2,9 +2,9 @@ using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
//(used if Factor resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
//(used if Factor resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 3
- 3
WpfTest/MainWindow.xaml.cs View File

@@ -29,7 +29,7 @@ namespace WpfTest
/// <summary>
/// MQTT连接信息
/// </summary>
public string MQTTConnection { get; set; } = "10.2.1.254,1883,admin,public";
public string MQTTConnection { get; set; } = "171.221.208.23,11883,admin,public1";

/// <summary>
/// Mqtt是否运行
@@ -56,13 +56,13 @@ namespace WpfTest
if (IsRunningMqtt)
{
Send(ScreenDeviceType.大炒);
Thread.Sleep(1000);
Send(ScreenDeviceType.小炒); Thread.Sleep(1000);

Send(ScreenDeviceType.煮面机); Thread.Sleep(1000);

Send(ScreenDeviceType.分餐机); Thread.Sleep(1000);
Thread.Sleep(3000);
}
}
catch (Exception ex)


Loading…
Cancel
Save