NXX пре 2 година
родитељ
комит
c8438472f7
4 измењених фајлова са 406 додато и 357 уклоњено
  1. +168
    -202
      BPASmartClient.MorkBF/Control_MorkBF.cs
  2. +16
    -1
      BPASmartClient.MorkBF/GVL_MorkBF.cs
  3. +44
    -30
      BPASmartClient.MorkBF/VIew/DebugView.xaml
  4. +178
    -124
      BPASmartClient.MorkBF/ViewModel/DebugViewModel.cs

+ 168
- 202
BPASmartClient.MorkBF/Control_MorkBF.cs Прегледај датотеку

@@ -98,37 +98,28 @@ namespace BPASmartClient.MorkBF
/// <exception cref="NotImplementedException"></exception>
private void CommandRegist()
{
#region 炒锅1
ActionManage.GetInstance.Register(FirePot1_SetFireGear, "FirePot1_SetFireGear");//炒锅1设定加热挡位
ActionManage.GetInstance.Register(FirePot1_StartFire, "FirePot1_StartFire");//炒锅1加热启动
ActionManage.GetInstance.Register(FirePot1_StartFire, "FirePot1_StopFire");//炒锅1关闭加热
ActionManage.GetInstance.Register(FirePot1_SetStirGear, "FirePot1_SetStirGear");//炒锅1设定搅拌挡位
ActionManage.GetInstance.Register(FirePot1_StartStir, "FirePot1_StartStir");//炒锅1搅拌启动
ActionManage.GetInstance.Register(FirePot1_StartStir, "FirePot1_StopStir");//炒锅1搅拌停止
ActionManage.GetInstance.Register(FirePot1_SetTurnSpeed, "FirePot1_SetTurnSpeed");//炒锅1翻转频率设定
#endregion
#region 炒锅2
ActionManage.GetInstance.Register(FirePot2_SetFireGear, "FirePot2_SetFireGear");//炒锅2设定加热挡位
ActionManage.GetInstance.Register(FirePot2_StartFire, "FirePot2_StartFire");//炒锅2加热启动
ActionManage.GetInstance.Register(FirePot2_StartFire, "FirePot2_StopFire");//炒锅2关闭加热
ActionManage.GetInstance.Register(FirePot2_SetStirGear, "FirePot2_SetStirGear");//炒锅2设定搅拌挡位
ActionManage.GetInstance.Register(FirePot2_StartStir, "FirePot2_StartStir");//炒锅2搅拌启动
ActionManage.GetInstance.Register(FirePot2_StartStir, "FirePot2_StopStir");//炒锅2搅拌停止
ActionManage.GetInstance.Register(FirePot2_SetTurnSpeed, "FirePot2_SetTurnSpeed");//炒锅2翻转频率设定
#endregion
#region 炒锅通用
#region 炒锅
ActionManage.GetInstance.Register(FirePot_SetFireGear, "FirePot_SetFireGear");//炒锅设定加热挡位
ActionManage.GetInstance.Register(FirePot_StartFire, "FirePot_StartFire");//炒锅加热启动
ActionManage.GetInstance.Register(FirePot_StartFire, "FirePot_StopFire");//炒锅关闭加热
ActionManage.GetInstance.Register(FirePot_SetStirGear, "FirePot_SetStirGear");//炒锅设定搅拌挡位
ActionManage.GetInstance.Register(FirePot_StartStir, "FirePot_StartStir");//炒锅搅拌启动
ActionManage.GetInstance.Register(FirePot_StartStir, "FirePot_StopStir");//炒锅搅拌停止
ActionManage.GetInstance.Register(FirePot_SetTurnSpeed, "FirePot_SetTurnSpeed");//炒锅翻转频率设定
ActionManage.GetInstance.Register(FirePot_SetPotAngle, "FirePot_SetPotAngle");//设定炒锅角度
ActionManage.GetInstance.Register(FirePot_StartPassWay, "FirePot_StartPassWay");//炒锅翻转频率设定

ActionManage.GetInstance.Register(FirePot_Reset, "FirePot_Reset");//复位;
ActionManage.GetInstance.Register(FirePot_PotGotoOrigin, "FirePot_PotGotoOrigin");//炒锅回原点
ActionManage.GetInstance.Register(FirePot_PotGotoP1, "FirePot_PotGotoP1");//炒锅去位置1
ActionManage.GetInstance.Register(FirePot_PotGotoP2, "FirePot_PotGotoP2");//炒锅去位置2
ActionManage.GetInstance.Register(FirePot_PotGotoP3, "FirePot_PotGotoP3");//炒锅去位置3
ActionManage.GetInstance.Register(FirePot_PotGotoP4, "FirePot_PotGotoP4");//炒锅去位置4
//ActionManage.GetInstance.Register(FirePot_PotGotoOutFoodPosition, "FirePot_PotGotoOutFoodPositiong");//炒锅去出餐位置
ActionManage.GetInstance.Register(FirePot_PotGotoInFoodPosition, "FirePot_PotGotoInFoodPosition");//炒锅去投料位置
ActionManage.GetInstance.Register(FirePot_StartOutFood, "FirePot_StartOutFood");//出餐启动
ActionManage.GetInstance.Register(FirePot_Clean, "FirePot_Clean");//清洗
ActionManage.GetInstance.Register(FirePot_StartPumpWater, "FirePot_StartPumpWater");//抽水启动
ActionManage.GetInstance.Register(FirePot_StartPumpOil, "FirePot_StartPumpOil");//抽油启动
ActionManage.GetInstance.Register(FirePot_StartPumpWater, "FirePot_StopPumpWater");//抽水关闭
ActionManage.GetInstance.Register(FirePot_PushReach, "FirePot_PushReach");//推杆伸出
ActionManage.GetInstance.Register(FirePot_PushRetract, "FirePot_PushRetract");//推杆缩回
ActionManage.GetInstance.Register(FirePot_PotForward, "FirePot_PotForward");//翻转正转
ActionManage.GetInstance.Register(FirePot_PotReversal, "FirePot_PotReversal");//翻转反转
#endregion
#region 机器人
ActionManage.GetInstance.Register(RobotStart, "RobotStart");//机器人启动
@@ -238,15 +229,15 @@ namespace BPASmartClient.MorkBF
bool isRobotWork = false;
if(i == 1)//炒锅1
{
FirePot1_SetFireGear(item.FryGear);
//FirePot1_SetFireGear(item.FryGear);
Thread.Sleep(200);
FirePot1_StartFire(true);
//FirePot1_StartFire(true);
isRobotWork = IsRobotNextWork(morkBF.FryPot1_CurrentProcess,item.FryTime);
}
else if(i == 2)//炒锅2
{
FirePot2_SetFireGear(item.FryGear);
FirePot2_StartFire(true);
//FirePot2_SetFireGear(item.FryGear);
//FirePot2_StartFire(true);
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);
}
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料
@@ -263,14 +254,14 @@ namespace BPASmartClient.MorkBF
bool isRobotWork = false;
if (item.FryGear != 0)
{
FirePot1_SetFireGear(item.FryGear);//设定加热挡位
FirePot1_StartFire(true);//开启加热
isRobotWork = IsRobotNextWork(morkBF.FryPot1_CurrentProcess, item.FryTime);
/* FirePot1_SetFireGear(item.FryGear);*///设定加热挡位
//FirePot1_StartFire(true);//开启加热
//isRobotWork = IsRobotNextWork(morkBF.FryPot1_CurrentProcess, item.FryTime);
}
if (item.StirGear != 0)
{
FirePot1_SetStirGear(item.StirGear);//设定搅拌挡位
FirePot1_StartFire(true);//开启搅拌
//FirePot1_SetStirGear(item.StirGear);//设定搅拌挡位
//FirePot1_StartFire(true);//开启搅拌
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);
}
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料
@@ -384,7 +375,7 @@ namespace BPASmartClient.MorkBF
}
else
{
FirePot_Write("M11.6", true);//炒锅去投料位置
//FirePot_Write("M11.6", true);//炒锅去投料位置
while (!morkBF.FirePot1_PotOnIntoFoodPosition)//等待炒锅允许倒料
{
Thread.Sleep(100);
@@ -413,7 +404,7 @@ namespace BPASmartClient.MorkBF
}
else
{
FirePot_Write("M16.7", true);
//FirePot_Write("M16.7", true);
while (!morkBF.FirePot2_PotOnIntoFoodPosition)
{
Thread.Sleep(100);
@@ -603,26 +594,38 @@ namespace BPASmartClient.MorkBF
}

#region 控制
private void FirePot_Write(string address, object value, int i = 0)
private void FirePot1_Write(string address, object value, int i = 0)
{
WriteControlExact(address, value, i);
}
private void FirePot2_Write(string address, object value, int i = 1)
{
WriteControlExact(address, value, i);
}
private void Robot_Write(string address, object value, int i = 1)
private void Robot_Write(string address, object value, int i = 2)
{
WriteControlExact(address, value, i);
}
#region 炒锅1

#region 炒锅

/// <summary>
/// 炒锅1设定加热挡位
/// 炒锅设定加热挡位
/// </summary>
/// <param name="o"></param>
private void FirePot1_SetFireGear(object o)
private void FirePot_SetFireGear(object[] o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int value))
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
FirePot_Write("VW100", (ushort)value);
if(fryNo == 1)
{
FirePot1_Write("VW100", (ushort)value);
}
else if(fryNo == 2)
{
FirePot2_Write("VW100", (ushort)value);
}
}
Thread.Sleep(200);
}
@@ -630,40 +633,59 @@ namespace BPASmartClient.MorkBF
/// 炒锅1加热启停
/// </summary>
/// <param name="b"></param>
private void FirePot1_StartFire(object o)
private void FirePot_StartFire(object[] o)
{
if (o == null) return;
if (bool.TryParse(o.ToString(), out bool value))
if (o.Length == 2 && o[0] is int fryNo && o[1] is bool value)
{
FirePot_Write("M10.0", value);
if (fryNo == 1)
{
FirePot1_Write("M10.0", value);
}
else if (fryNo == 2)
{
FirePot2_Write("M10.0", value);
}
}
Thread.Sleep(200);
FirePot_Write("M10.2", true);
}
/// <summary>
/// 炒锅1设置搅拌挡位
/// </summary>
/// <param name="o"></param>
private void FirePot1_SetStirGear(object o)
private void FirePot_SetStirGear(object[] o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int value))
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
FirePot_Write("VW102", (ushort)value);
if (fryNo == 1)
{
FirePot1_Write("VW102", (ushort)value);
}
else if (fryNo == 2)
{
FirePot2_Write("VW102", (ushort)value);
}
}
Thread.Sleep(200);
FirePot_Write("M10.3", true);
}
/// <summary>
/// 炒锅1搅拌启停
/// </summary>
/// <param name="o"></param>
private void FirePot1_StartStir(object o)
private void FirePot_StartStir(object[] o)
{
if (o == null) return;
if (bool.TryParse(o.ToString(), out bool value))
if (o.Length == 2 && o[0] is int fryNo && o[1] is bool value)
{
FirePot_Write("M10.1", value);
if (fryNo == 1)
{
FirePot1_Write("M10.1", value);
}
else if (fryNo == 2)
{
FirePot2_Write("M10.1", value);
}
}
Thread.Sleep(200);
}
@@ -671,94 +693,70 @@ namespace BPASmartClient.MorkBF
/// 设置炒锅1翻转速度
/// </summary>
/// <param name="o"></param>
private void FirePot1_SetTurnSpeed(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int value))
{
FirePot_Write("VW104", (ushort)value);
}
Thread.Sleep(200);
FirePot_Write("M10.4", true);
Thread.Sleep(200);
}
#endregion

#region 炒锅2
/// <summary>
/// 炒锅2设定加热挡位
/// </summary>
/// <param name="o"></param>
private void FirePot2_SetFireGear(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int value))
{
FirePot_Write("VW130", (ushort)value);
}
Thread.Sleep(200);
FirePot_Write("M15.2", true);
}
/// <summary>
/// 炒锅2加热启停
/// </summary>
/// <param name="b"></param>
private void FirePot2_StartFire(object o)
{
if (o == null) return;
if (o is bool value)
{
FirePot_Write("M15.0", value);
}
Thread.Sleep(200);
}
/// <summary>
/// 炒锅2设置搅拌挡位
/// </summary>
/// <param name="o"></param>
private void FirePot2_SetStirGear(object o)
private void FirePot_SetTurnSpeed(object[] o)
{
if (o == null) return;
if (o is int value)
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
FirePot_Write("VW132", (ushort)value);
if (fryNo == 1)
{
FirePot1_Write("VW104", (ushort)value);
}
else if (fryNo == 2)
{
FirePot2_Write("VW104", (ushort)value);
}
}
Thread.Sleep(200);
FirePot_Write("M15.3", true);
Thread.Sleep(200);
}
/// <summary>
/// 炒锅2搅拌启停
/// 设定炒锅角度
/// </summary>
/// <param name="o"></param>
private void FirePot2_StartStir(object o)
private void FirePot_SetPotAngle(object[] o)
{
if (o == null) return;
if (o is bool value)
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
FirePot_Write("M15.1", value);
if (fryNo == 1)
{
FirePot1_Write("VW106", (ushort)value);
}
else if (fryNo == 2)
{
FirePot2_Write("VW106", (ushort)value);
}
}
Thread.Sleep(200);
}

/// <summary>
/// 设置炒锅2翻转速度
/// 通道出料启动
/// </summary>
/// <param name="o"></param>
private void FirePot2_SetTurnSpeed(object o)
private void FirePot_StartPassWay(object[] o)
{
if (o == null) return;
if (o is int value)
if (o.Length == 3 && o[0] is int fryNo && o[1] is int value1&& o[2] is int value2)
{
FirePot_Write("VW134", (ushort)value);
if (fryNo == 1)
{
FirePot1_Write(morkBF.Fire_PasswayValue[value1], (ushort)value2);//写入需求值
Thread.Sleep(200);
FirePot1_Write(morkBF.Fire_PasswayWrite[value1], true);//启动通道哦
}
else if (fryNo == 2)
{
FirePot2_Write(morkBF.Fire_PasswayValue[value1], (ushort)value2);
Thread.Sleep(200);
FirePot2_Write(morkBF.Fire_PasswayWrite[value1], true);
}
}
Thread.Sleep(200);
FirePot_Write("M15.4", true);
Thread.Sleep(200);
}

#endregion

#region 炒锅通用
/// <summary>
/// 炒锅复位
/// </summary>
@@ -787,221 +785,189 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoOrigin(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
{
if (i == 1)
{
FirePot_Write("M10.5", true);
}
else if (i == 2)
{
FirePot_Write("M15.5", true);
}
}
Thread.Sleep(200);
}
/// <summary>
/// 炒锅去位置1
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoP1(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.2", true);
FirePot1_Write("M10.5", true);
}
else if (i == 2)
{
FirePot_Write("M16.2", true);
FirePot2_Write("M10.5", true);
}
}
Thread.Sleep(200);
}
/// <summary>
/// 炒锅去位置2
/// 炒锅去投料位置
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoP2(object o)
private void FirePot_PotGotoInFoodPosition(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.3", true);
FirePot1_Write("M11.2", true);
}
else if (i == 2)
{
FirePot_Write("M16.3", true);
FirePot2_Write("M11.2", true);
}
}
Thread.Sleep(200);
}
/// <summary>
/// 炒锅去位置3
/// 出餐启动
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoP3(object o)
private void FirePot_StartOutFood(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.4", true);
FirePot1_Write("M10.6", true);
}
else if (i == 2)
{
FirePot_Write("M16.4", true);
FirePot2_Write("M10.6", true);
}

}
Thread.Sleep(200);
}
/// <summary>
/// 炒锅去位置4
/// 清洗
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoP4(object o)
private void FirePot_Clean(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.5", true);
FirePot1_Write("M10.7", true);

}
else if (i == 2)
{
FirePot_Write("M16.5", true);
FirePot2_Write("M10.7", true);
}
}
Thread.Sleep(200);
}
///// <summary>
///// 炒锅去出餐位置
///// </summary>
///// <param name="o"></param>
//private void FirePot_PotGotoOutFoodPositiong(object o)
//{
// if (o == null) return;
// if (o is int i)
// {
// if (i == 1)
// {
// FirePot_Write("M11.6", true);
// }
// else if (i == 2)
// {
// FirePot_Write("M16.6", true);
// }
// }
// Thread.Sleep(200);
//}
/// <summary>
/// 炒锅去投料位置
/// 抽水启动
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoInFoodPosition(object o)
private void FirePot_StartPumpWater(object[] o)
{
if (o == null) return;
if (int.TryParse(o.ToString() ,out int i))
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
if (i == 1)
if (fryNo == 1)
{
FirePot_Write("M11.6", true);
FirePot1_Write("M11.0", value);
}
else if (i == 2)
else if (fryNo == 2)
{
FirePot_Write("M16.6", true);
FirePot2_Write("M11.0", value);
}
}
Thread.Sleep(200);
}

/// <summary>
/// 出餐启动
/// 推杆伸
/// </summary>
/// <param name="o"></param>
private void FirePot_StartOutFood(object o)
private void FirePot_PushReach(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M10.6", true);
FirePot1_Write("M12.3", true);

}
else if (i == 2)
{
FirePot_Write("M15.6", true);
FirePot2_Write("M12.3", true);
}

}
Thread.Sleep(200);
}
/// <summary>
/// 清洗
/// 推杆缩回
/// </summary>
/// <param name="o"></param>
private void FirePot_Clean(object o)
private void FirePot_PushRetract(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
if (o is int i)
{
if (i == 1)
{
if(morkBF.FirePot1_OnOrigin) FirePot_Write("M10.7", true);
FirePot1_Write("M12.4", true);

}
else if (i == 2)
{
if (morkBF.FirePot2_OnOrigin) FirePot_Write("M15.7", true);
FirePot2_Write("M12.4", true);
}
}
Thread.Sleep(200);
}
/// <summary>
/// 抽水启动
/// 翻转正转
/// </summary>
/// <param name="o"></param>
private void FirePot_StartPumpWater(object o)
private void FirePot_PotForward(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.0", true);
FirePot1_Write("M12.5", true);

}
else if (i == 2)
{
FirePot_Write("M16.0", true);
FirePot2_Write("M12.5", true);
}
}
Thread.Sleep(200);
}
/// <summary>
/// 抽油启动
/// 翻转正转
/// </summary>
/// <param name="o"></param>
private void FirePot_StartPumpOil(object o)
private void FirePot_PotReversal(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M16.0", true);
FirePot1_Write("M12.6", true);

}
else if (i == 2)
{
FirePot_Write("M16.1", true);
FirePot2_Write("M12.6", true);
}
}
Thread.Sleep(200);
}


#endregion

#region 机器人


+ 16
- 1
BPASmartClient.MorkBF/GVL_MorkBF.cs Прегледај датотеку

@@ -368,7 +368,7 @@ namespace BPASmartClient.MorkBF
public Dictionary<int, bool> FirePot2_CompleteSingle { get; set; }

public GVL_MorkBF(string FireName)
public GVL_MorkBF()
{
FirePot1_CompleteSingle = new Dictionary<int, bool>
@@ -443,6 +443,21 @@ namespace BPASmartClient.MorkBF
{8,"M12.2"},
};

/// <summary>
/// 炒锅通道出料需求值点位
/// </summary>
public Dictionary<int, string> Fire_PasswayValue { get; set; } = new Dictionary<int, string>
{
{1,"VW108"},
{2,"VW110"},
{3,"VW112"},
{4,"VW114"},
{5,"VW116"},
{6,"VW118"},
{7,"VW120"},
{8,"VW122"},
};


#region 炒锅1
/// <summary>


+ 44
- 30
BPASmartClient.MorkBF/VIew/DebugView.xaml Прегледај датотеку

@@ -56,58 +56,72 @@
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="1"/>
<TextBlock Text="加热挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot1_FireGear}" SelectedIndex="0" />
<Button Content="加热档位设定" Width="110" Margin="10,5" Command="{Binding FirePot1_SetFireGearCommand}"/>
<Button Content="加热启动" Width="80" Margin="10,5" Command="{Binding FirePot1_StartFireCommand}"/>
<Button Content="加热停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot1_StopFireCommand}"/>
<Button Content="加热档位设定" Width="110" Margin="10,5" Command="{Binding FirePot_SetFireGearCommand}" CommandParameter="1"/>
<Button Content="加热启动" Width="80" Margin="10,5" Command="{Binding FirePot_StartFireCommand}" CommandParameter="1"/>
<Button Content="加热停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot_StopFireCommand}" CommandParameter="1"/>
<TextBlock Text="搅拌挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding StirGear}" SelectedItem="{Binding FirePot1_StirGear}" Margin="10,5" SelectedIndex="0" />
<Button Content="搅拌档位设定" Width="110" Margin="10,5" Command="{Binding FirePot1_SetStirGearCommand}"/>
<Button Content="搅拌启动" Width="80" Margin="10,5" Command="{Binding FirePot1_StartStirCommand}"/>
<Button Content="搅拌停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot1_StopStirCommand}"/>
<Button Content="搅拌档位设定" Width="110" Margin="10,5" Command="{Binding FirePot_SetStirGearCommand}" CommandParameter="1"/>
<Button Content="搅拌启动" Width="80" Margin="10,5" Command="{Binding FirePot_StartStirCommand}" CommandParameter="1"/>
<Button Content="搅拌停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot_StopStirCommand}" CommandParameter="1"/>
<TextBlock Text="翻转频率" Margin="10,5"/>
<TextBox Width="80" Text="{Binding FirePot1_TurnSpeed}" Margin="10,5"/>
<Button Content="翻转频率设定" Width="110" Margin="10,5" Command="{Binding FirePot1_SetTurnSpeedCommand}"/>
<Button Content="翻转频率设定" Width="110" Margin="10,5" Command="{Binding FirePot_SetTurnSpeedCommand}" CommandParameter="1"/>
<TextBlock Text="炒锅角度" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding PotAngle}" SelectedItem="{Binding FirePot1_PotAngle}" Margin="10,5" SelectedIndex="0"/>
<Button Content="炒锅角度设定" Width="110" Margin="10,5,30,5" Cursor="Hand" Command="{Binding FirePot_SetPotAngleCommand}" CommandParameter="1" />
<TextBlock Text="通道号" Margin="10,5" />
<ComboBox Width="60" ItemsSource="{Binding PassWay}" SelectedItem="{Binding FirePot1_PassWay}" Margin="10,5"/>
<TextBlock Text="需求值" Margin="10,5"/>
<TextBox Text="{Binding FirePot1_PassValue}" Width="60" Margin="10,5"/>
<Button Content="出料启动" Command="{Binding FirePot_StartPassWayCommand}" Margin="10,5,30,5" CommandParameter="1"/>
<Button Content="炒锅回原点" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoOriginCommand}" CommandParameter="1"/>
<Button Content="炒锅去投料位置" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoInFoodPositionCommand}" CommandParameter="1"/>
<Button Content="出餐启动" Width="110" Margin="10,5" Command="{Binding FirePot_StartOutFoodCommand}" CommandParameter="1"/>
<Button Content="单独清洗" Width="110" Margin="10,5" Command="{Binding FirePot_CleanCommand}" CommandParameter="1"/>
<Button Content="抽水启动" Width="110" Margin="10,5" Command="{Binding FirePot_StartPumpWaterCommand}" CommandParameter="1"/>
<Button Content="抽油启动" Width="110" Margin="10,5" Command="{Binding FirePot_StartPumpOilCommand}" CommandParameter="1"/>
<Button Content="炒锅去炒制位置1" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP1Command}" CommandParameter="1"/>
<Button Content="炒锅去炒制位置2" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP2Command}" CommandParameter="1"/>
<Button Content="炒锅去炒制位置3" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP3Command}" CommandParameter="1"/>
<Button Content="炒锅去炒制位置4" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP4Command}" CommandParameter="1"/>
<Button Content="炒锅去出餐倒料位置" Width="140" Margin="10,5" Command="{Binding FirePot_PotGotoOutFoodPositiongCommand}" CommandParameter="1"/>
<Button Content="炒锅去投料位置" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoInFoodPositionCommand}" CommandParameter="1"/>
<Button Content="抽水关闭" Width="110" Margin="10,5" Command="{Binding FirePot_StartPumpWaterCommand}" CommandParameter="1"/>
<Button Content="推杆伸出" Margin="10,5"/>
<Button Content="推杆缩回" Margin="10,5"/>
<Button Content="炒锅翻转正转" Margin="10,5"/>
<Button Content="炒锅翻转反转" Margin="10,5"/>
</WrapPanel>

</GroupBox>
<GroupBox Grid.Row="1" Header="炒锅2" FontSize="22">
<WrapPanel Grid.Row="1" Orientation="Horizontal">
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="1"/>
<WrapPanel Orientation="Horizontal">
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="2"/>
<TextBlock Text="加热挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot2_FireGear}" SelectedIndex="0" />
<Button Content="加热档位设定" Width="110" Margin="10,5" Command="{Binding FirePot2_SetFireGearCommand}"/>
<Button Content="加热启动" Width="80" Margin="10,5" Command="{Binding FirePot2_StartFireCommand}"/>
<Button Content="加热停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot2_StopFireCommand}"/>
<Button Content="加热档位设定" Width="110" Margin="10,5" Command="{Binding FirePot_SetFireGearCommand}" CommandParameter="2"/>
<Button Content="加热启动" Width="80" Margin="10,5" Command="{Binding FirePot_StartFireCommand}" CommandParameter="2"/>
<Button Content="加热停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot_StopFireCommand}" CommandParameter="2"/>
<TextBlock Text="搅拌挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding StirGear}" SelectedItem="{Binding FirePot2_StirGear}" Margin="10,5" SelectedIndex="0" />
<Button Content="搅拌档位设定" Width="110" Margin="10,5" Command="{Binding FirePot2_SetStirGearCommand}"/>
<Button Content="搅拌启动" Width="80" Margin="10,5" Command="{Binding FirePot2_StartStirCommand}"/>
<Button Content="搅拌停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot2_StopStirCommand}"/>
<Button Content="搅拌档位设定" Width="110" Margin="10,5" Command="{Binding FirePot_SetStirGearCommand}" CommandParameter="2"/>
<Button Content="搅拌启动" Width="80" Margin="10,5" Command="{Binding FirePot_StartStirCommand}" CommandParameter="2"/>
<Button Content="搅拌停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot_StopStirCommand}" CommandParameter="2"/>
<TextBlock Text="翻转频率" Margin="10,5"/>
<TextBox Width="80" Text="{Binding FirePot2_TurnSpeed}" Margin="10,5"/>
<Button Content="翻转频率设定" Width="110" Margin="10,5" Command="{Binding FirePot2_SetTurnSpeedCommand}"/>
<Button Content="翻转频率设定" Width="110" Margin="10,5" Command="{Binding FirePot_SetTurnSpeedCommand}" CommandParameter="2"/>
<TextBlock Text="炒锅角度" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding PotAngle}" SelectedItem="{Binding FirePot2_PotAngle}" Margin="10,5" SelectedIndex="0"/>
<Button Content="炒锅角度设定" Width="110" Margin="10,5,30,5" Cursor="Hand" Command="{Binding FirePot_SetPotAngleCommand}" CommandParameter="2" />
<TextBlock Text="通道号" Margin="10,5" />
<ComboBox Width="60" ItemsSource="{Binding PassWay}" SelectedItem="{Binding FirePot2_PassWay}" Margin="10,5"/>
<TextBlock Text="需求值" Margin="10,5"/>
<TextBox Text="{Binding FirePot2_PassValue}" Width="60" Margin="10,5"/>
<Button Content="出料启动" Command="{Binding FirePot_StartPassWayCommand}" Margin="10,5,30,5" CommandParameter="2"/>
<Button Content="炒锅回原点" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoOriginCommand}" CommandParameter="2"/>
<Button Content="炒锅去投料位置" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoInFoodPositionCommand}" CommandParameter="2"/>
<Button Content="出餐启动" Width="110" Margin="10,5" Command="{Binding FirePot_StartOutFoodCommand}" CommandParameter="2"/>
<Button Content="单独清洗" Width="110" Margin="10,5" Command="{Binding FirePot_CleanCommand}" CommandParameter="2"/>
<Button Content="抽水启动" Width="110" Margin="10,5" Command="{Binding FirePot_StartPumpWaterCommand}" CommandParameter="2"/>
<Button Content="抽油启动" Width="110" Margin="10,5" Command="{Binding FirePot_StartPumpOilCommand}" CommandParameter="2"/>
<Button Content="炒锅去炒制位置1" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP1Command}" CommandParameter="2"/>
<Button Content="炒锅去炒制位置2" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP2Command}" CommandParameter="2"/>
<Button Content="炒锅去炒制位置3" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP3Command}" CommandParameter="2"/>
<Button Content="炒锅去炒制位置4" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP4Command}" CommandParameter="2"/>
<Button Content="炒锅去出餐倒料位置" Width="140" Margin="10,5" Command="{Binding FirePot_PotGotoOutFoodPositiongCommand}" CommandParameter="2"/>
<Button Content="炒锅去投料位置" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoInFoodPositionCommand}" CommandParameter="2"/>
<Button Content="抽水关闭" Width="110" Margin="10,5" Command="{Binding FirePot_StartPumpWaterCommand}" CommandParameter="2"/>
<Button Content="推杆伸出" Margin="10,5"/>
<Button Content="推杆缩回" Margin="10,5"/>
<Button Content="炒锅翻转正转" Margin="10,5"/>
<Button Content="炒锅翻转反转" Margin="10,5"/>
</WrapPanel>
</GroupBox>
<GroupBox Grid.Row="2" Header="机器人" FontSize="22">


+ 178
- 124
BPASmartClient.MorkBF/ViewModel/DebugViewModel.cs Прегледај датотеку

@@ -16,12 +16,6 @@ namespace BPASmartClient.MorkBF.ViewModel
[INotifyPropertyChanged]
partial class DebugViewModel
{





/// <summary>
/// 加热挡位
/// </summary>
@@ -30,148 +24,214 @@ namespace BPASmartClient.MorkBF.ViewModel
/// 搅拌挡位
/// </summary>
public ObservableCollection<int> StirGear { get; set; } = new ObservableCollection<int>() { 1, 2, 3, 4, 5 };
/// <summary>
/// 炒锅角度
/// </summary>
public ObservableCollection<int> PotAngle { get; set; } = new ObservableCollection<int>() { 1, 2, 3, 4, };
/// <summary>
/// 通道号
/// </summary>
public ObservableCollection<int> PassWay { get; set; } = new ObservableCollection<int>() { 1, 2, 3, 4,5,6,7,8 };

[ObservableProperty]
private int _firePot1_FireGear = 1;
private int _firePot1_FireGear = 1;//加热挡位
[ObservableProperty]
private int _firePot2_FireGear = 1;
[ObservableProperty]
private int _firePot1_StirGear = 1;
private int _firePot1_StirGear = 1;//搅拌挡位
[ObservableProperty]
private int _firePot2_StirGear = 1;
[ObservableProperty]
private int _firePot1_TurnSpeed;
private int _firePot1_TurnSpeed;//翻转速度
[ObservableProperty]
private int _firePot2_TurnSpeed;
#region 炒锅1
[ObservableProperty]
private int _firePot1_PotAngle = 1;//炒锅角度
[ObservableProperty]
private int _firePot2_PotAngle = 1;
[ObservableProperty]
private int _firePot1_PassWay = 1;//通道号
[ObservableProperty]
private int _firePot2_PassWay = 1;
[ObservableProperty]
private int _firePot1_PassValue = 0;//通道需求值
[ObservableProperty]
private int _firePot2_PassValue = 0;



#region 炒锅
/// <summary>
/// 设定加热挡位
/// </summary>
[RelayCommand]
private void FirePot1_SetFireGear()
private void FirePot_SetFireGear(object o)
{
ActionManage.GetInstance.Send("FirePot1_SetFireGear", FirePot1_FireGear);
if(o == null) return;
if(int.TryParse(o.ToString(),out int i))
{
int value = 0;
if(i == 1)
{
value = FirePot1_FireGear;
}
else if(i == 2)
{
value = FirePot2_FireGear;
}
ActionManage.GetInstance.Send("FirePot_SetFireGear", new object[] { i, value});
}
}
/// <summary>
/// 加热启动
/// </summary>
[RelayCommand]
private void FirePot1_StartFire()
private void FirePot_StartFire(object o)
{
ActionManage.GetInstance.Send("FirePot1_StartFire",true);
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
{
ActionManage.GetInstance.Send("FirePot_StartFire", new object[] { i, true });
}
}
/// <summary>
/// 关闭加热
/// </summary>
[RelayCommand]
private void FirePot1_StopFire()
private void FirePot_StopFire(object o)
{
ActionManage.GetInstance.Send("FirePot1_StopFire",false);
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
{
ActionManage.GetInstance.Send("FirePot_StopFire", new object[] { i, false });
}
}

/// <summary>
/// 设定搅拌挡位
/// </summary>
[RelayCommand]
private void FirePot1_SetStirGear()
private void FirePot_SetStirGear(object o)
{
ActionManage.GetInstance.Send("FirePot1_SetStirGear", FirePot1_StirGear);
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
{
int value = 0;
if (i == 1)
{
value = FirePot1_StirGear;
}
else if (i == 2)
{
value = FirePot2_StirGear;
}
ActionManage.GetInstance.Send("FirePot_SetStirGear",new object[] { i, value });
}
}
/// <summary>
/// 搅拌启动
/// </summary>
[RelayCommand]
private void FirePot1_StartStir()
private void FirePot_StartStir(object o)
{
ActionManage.GetInstance.Send("FirePot1_StartStir",true);

if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
{
ActionManage.GetInstance.Send("FirePot_StartStir", new object[] { i, true });
}
}
/// <summary>
/// 搅拌停止
/// </summary>
[RelayCommand]
private void FirePot1_StopStir()
{
ActionManage.GetInstance.Send("FirePot1_StopStir",false);
}
/// <summary>
/// 翻转频率设定
/// </summary>
[RelayCommand]
private void FirePot1_SetTurnSpeed()
private void FirePot_StopStir(object o)
{
if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800;
ActionManage.GetInstance.Send("FirePot1_SetTurnSpeed", FirePot1_TurnSpeed);
}
#endregion

#region 炒锅2
/// <summary>
/// 设定加热挡位
/// </summary>
[RelayCommand]
private void FirePot2_SetFireGear()
{
ActionManage.GetInstance.Send("FirePot2_SetFireGear", FirePot2_FireGear );
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
{
ActionManage.GetInstance.Send("FirePot_StopStir", new object[] { i, false });
}
}
/// <summary>
/// 加热启动
/// </summary>
[RelayCommand]
private void FirePot2_StartFire()
{
ActionManage.GetInstance.Send("FirePot2_StartFire", true);
}
/// <summary>
/// 关闭加热
/// </summary>
[RelayCommand]
private void FirePot2_StopFire()
{
ActionManage.GetInstance.Send("FirePot2_StopFire", false);
}
/// <summary>
/// 设定搅拌挡位
/// </summary>
[RelayCommand]
private void FirePot2_SetStirGear()
{
ActionManage.GetInstance.Send("FirePot2_SetStirGear", FirePot2_StirGear);
}
/// <summary>
/// 搅拌启动
/// </summary>
[RelayCommand]
private void FirePot2_StartStir()
{
ActionManage.GetInstance.Send("FirePot2_StartStir", true);
}
/// <summary>
/// 搅拌停止
/// 翻转频率设定
/// </summary>
[RelayCommand]
private void FirePot2_StopStir()
{
ActionManage.GetInstance.Send("FirePot2_StopStir", false);
private void FirePot_SetTurnSpeed(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
{
int value = 0;
if (i == 1)
{
value = FirePot1_TurnSpeed;
}
else if (i == 2)
{
value = FirePot2_TurnSpeed;
}
if (value > 800) value = 800;
ActionManage.GetInstance.Send("FirePot_SetTurnSpeed", new object[] { i, value });
}
}
/// <summary>
/// 设定炒锅角度
/// </summary>
[RelayCommand]
private void FirePot_SetPotAngle(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
{
int value = 0;
if (i == 1)
{
value = FirePot1_PotAngle;
}
else if (i == 2)
{
value = FirePot2_PotAngle;
}
ActionManage.GetInstance.Send("FirePot_SetPotAngle", new object[] { i, value });
}
}
/// <summary>
/// 翻转频率设定
/// </summary>
[RelayCommand]
private void FirePot2_SetTurnSpeed()
{
if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800;
ActionManage.GetInstance.Send("FirePot2_SetTurnSpeed", FirePot2_TurnSpeed );
/// 通道出料启动
/// </summary>
[RelayCommand]
private void FirePot_StartPassWay(object o)
{
if (o == null) return;
if (int.TryParse(o.ToString(), out int i))
{
int value1 = 0;
int value2 = 0;
if (i == 1)
{
value1 = FirePot1_PassWay;
value2 = FirePot1_PassValue;
}
else if (i == 2)
{
value1 = FirePot2_PassWay;
value2 = FirePot2_PassValue;
}
ActionManage.GetInstance.Send("FirePot_StartPassWay", new object[] { i, value1,value2 });
}
}
#endregion

#region 炒锅通用
/// <summary>
/// 复位
/// </summary>
[RelayCommand]
private void FirePot_Reset(object o)
{
ActionManage.GetInstance.Send("FirePot1_Reset", o);
//ActionManage.GetInstance.Send("FirePot1_Reset", o);
}
/// <summary>
/// 炒锅回原点
@@ -179,91 +239,85 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand]
private void FirePot_PotGotoOrigin(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoOrigin", o);
}
/// <summary>
/// 炒锅去位置1
/// </summary>
[RelayCommand]
private void FirePot_PotGotoP1(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoP1", o);
ActionManage.GetInstance.Send("FirePot_PotGotoOrigin", int.Parse(o.ToString()));
}

/// <summary>
///炒锅去位置2
/// 炒锅去投料位置
/// </summary>
[RelayCommand]
private void FirePot_PotGotoP2(object o)
private void FirePot_PotGotoInFoodPosition(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoP2", o);
ActionManage.GetInstance.Send("FirePot_PotGotoInFoodPosition", int.Parse(o.ToString()));
}
/// <summary>
/// 炒锅去位置3
/// 出餐启动
/// </summary>
[RelayCommand]
private void FirePot_PotGotoP3(object o)
private void FirePot_StartOutFood(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoP3", o);
ActionManage.GetInstance.Send("FirePot_StartOutFood", int.Parse(o.ToString()));
}
/// <summary>
/// 炒锅去位置4
/// 清洗
/// </summary>
[RelayCommand]
private void FirePot_PotGotoP4(object o)
private void FirePot_Clean(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoP4", o);
ActionManage.GetInstance.Send("FirePot_Clean", int.Parse(o.ToString()));
}
/// <summary>
/// 炒锅去出餐位置
/// 抽水启动
/// </summary>
[RelayCommand]
private void FirePot_PotGotoOutFoodPositiong(object o)
private void FirePot_StartPumpWater(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoOutFoodPositiong", o);
ActionManage.GetInstance.Send("FirePot_StartPumpWater", new object[] { int.Parse(o.ToString()), true });
}
/// <summary>
/// 炒锅去投料位置
/// 抽水关闭
/// </summary>
[RelayCommand]
private void FirePot_PotGotoInFoodPosition(object o)
private void FirePot_StopPumpWater(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoInFoodPosition", o);
ActionManage.GetInstance.Send("FirePot_StopPumpWater", new object[] { int.Parse(o.ToString()), false });
}
/// <summary>
/// 出餐启动
/// 推杆伸
/// </summary>
[RelayCommand]
private void FirePot_StartOutFood(object o)
private void FirePot_PushReach(object o)
{
ActionManage.GetInstance.Send("FirePot_StartOutFood", o);
ActionManage.GetInstance.Send("FirePot_PushReach", int.Parse(o.ToString()) );
}
/// <summary>
/// 清洗
/// 推杆缩回
/// </summary>
[RelayCommand]
private void FirePot_Clean(object o)
private void FirePot_PushRetract(object o)
{
ActionManage.GetInstance.Send("FirePot_Clean",o);
ActionManage.GetInstance.Send("FirePot_PushRetract", int.Parse(o.ToString()));
}
/// <summary>
/// 抽水启动
/// 翻转正转
/// </summary>
[RelayCommand]
private void FirePot_StartPumpWater(object o)
private void FirePot_PotForward(object o)
{
ActionManage.GetInstance.Send("FirePot_StartPumpWater", o);
ActionManage.GetInstance.Send("FirePot_PotForward", int.Parse(o.ToString()));
}
/// <summary>
/// 抽油启动
/// 翻转反转
/// </summary>
[RelayCommand]
private void FirePot_StartPumpOil(object o)
private void FirePot_PotReversal(object o)
{
ActionManage.GetInstance.Send("FirePot_StartPumpOil", o);
ActionManage.GetInstance.Send("FirePot_PotReversal", int.Parse(o.ToString()) );
}



#endregion




Loading…
Откажи
Сачувај