From 1e8d0aee3dc476bdee863019726d41ae15bc69de Mon Sep 17 00:00:00 2001
From: NXX <447201003@qq>
Date: Wed, 11 Jan 2023 09:35:02 +0800
Subject: [PATCH 01/96] =?UTF-8?q?=E5=B0=8F=E7=82=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BPASmartClient.MorkF/Control_MorkF.cs | 138 ++++++++++++++----
BPASmartClient.MorkF/ML_MorkF.cs | 9 ++
BPASmartClient.MorkF/View/LocalMenu.xaml | 76 +++++-----
.../View/MaterialCalibration.xaml | 103 +++++++++----
.../ViewModel/MaterialCalibrationViewModel.cs | 91 ++++++++----
BPASmartClient/MainWindow.xaml.cs | 1 +
6 files changed, 300 insertions(+), 118 deletions(-)
diff --git a/BPASmartClient.MorkF/Control_MorkF.cs b/BPASmartClient.MorkF/Control_MorkF.cs
index 2d687cdf..cf742f12 100644
--- a/BPASmartClient.MorkF/Control_MorkF.cs
+++ b/BPASmartClient.MorkF/Control_MorkF.cs
@@ -35,7 +35,7 @@ namespace BPASmartClient.MorkF
///
/// 菜品库while循环最大sleep次数
///
- private const int materialSleepCount = 900;
+ private const int materialSleepCount = 600;
///
/// 菜品库while循环每次sleep时间
@@ -61,7 +61,7 @@ namespace BPASmartClient.MorkF
///
/// 菜品盒坐标系高度
///
- private const int materialBoxHeight = 9500;
+ private const int materialBoxHeight = 9700;
//传感器1到菜品库的高度(厘米)
private const int materialLaserHighCM_1 = 22;
@@ -346,7 +346,15 @@ namespace BPASmartClient.MorkF
ml_morkf.PawArrivePortThree = bools[2];
}
}), 2);
-
+ //获取爪子伸出退回到位
+ GetStatus("M10.6", new Action
/// 电磁阀启停:true:启动。false:停止。
- public void PawExtend()
+ public bool PawExtend()
{
if (!ml_morkf.InitialComplete)
{
MessageLog.GetInstance.ShowEx("爪子伸出错误,菜品库未初始化");
- return;
+ return false;
}
-
+ Thread.Sleep(500);
MaterailLibrary_Write("M0.6", true);
- //等待爪子伸出延时4s
- Thread.Sleep(6000);
+ for (int i = 0; i < materialSleepCount && !ml_morkf.PawOutComplete; i++)//潘华小炒没有夹爪到位功能
+ {
+ Thread.Sleep(materialSleepTime);
+ if (i >= materialSleepCount - 1)
+ {
+ MessageLog.GetInstance.ShowEx("爪子伸出超时");
+ return false;
+ }
+ }
+ return true;
+ ////等待爪子伸出延时4s
+ //Thread.Sleep(6000);
}
///
/// 爪子收缩
///
/// 电磁阀启停:true:启动。false:停止。
- public void PawShrink()
+ public bool PawShrink()
{
if (!ml_morkf.InitialComplete)
{
MessageLog.GetInstance.ShowEx("爪子伸出错误,菜品库未初始化");
- return;
+ return false;
}
MaterailLibrary_Write("M0.7", true);
+ Thread.Sleep(500);
+ for (int i = 0; i < materialSleepCount && !ml_morkf.PawInComplete; i++)//潘华小炒没有夹爪到位功能
+ {
+ Thread.Sleep(materialSleepTime);
+ if (i >= materialSleepCount - 1)
+ {
+ MessageLog.GetInstance.ShowEx("爪子伸出超时");
+ return false;
+ }
+ }
+ return true;
//等待爪子收缩延时4s
- Thread.Sleep(6000);
+ //Thread.Sleep(6000);
}
///
/// 电磁阀启停
@@ -1033,6 +1075,10 @@ namespace BPASmartClient.MorkF
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
+ if (i == 10)
+ {
+ MaterailLibrary_Write("M1.0", true);
+ }
MessageLog.GetInstance.ShowEx("爪子去到1号位超时");
return false;
}
@@ -1063,6 +1109,10 @@ namespace BPASmartClient.MorkF
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
+ if (i == 10)
+ {
+ MaterailLibrary_Write("M1.1", true);
+ }
MessageLog.GetInstance.ShowEx("爪子去到2号位超时");
return false;
}
@@ -1090,10 +1140,14 @@ namespace BPASmartClient.MorkF
for (int i = 0; i < materialSleepCount && !ml_morkf.PawArrivePortThree; i++)
{
Thread.Sleep(materialSleepTime);
+ if(i == 30)
+ {
+ MaterailLibrary_Write("M1.2", true);
+ }
if (i >= materialSleepCount - 1)
{
MessageLog.GetInstance.ShowEx("爪子去到3号位超时");
- return false;
+
}
}
if (!ml_morkf.PawPositon_3)
@@ -1243,6 +1297,12 @@ namespace BPASmartClient.MorkF
return false;
}
+ if (x>212000|| y >240000)
+ {
+ MessageLog.GetInstance.ShowEx("机械臂移动超出范围");
+ return false;
+ }
+
//取反
x = 0 - Math.Abs(x);
y = 0 - Math.Abs(y);
@@ -1374,9 +1434,9 @@ namespace BPASmartClient.MorkF
Thread.Sleep(1000);
//获取传感器的距离,转换成坐标系的点
- //int laserHigh = ml_morkf.LaserDistance;
+ int laserHigh = ml_morkf.LaserDistance;
- int laserHigh = 400;
+
//秦工要求读取后置0
WriteDistance(0);
@@ -1396,7 +1456,7 @@ namespace BPASmartClient.MorkF
}
//设置到传感器感应的距离处
- if (!SetArmPosition(x, y))
+ if (!SetArmPosition(x - moveX, y))
{
return false;
}
@@ -1414,7 +1474,11 @@ namespace BPASmartClient.MorkF
}
//伸出爪子
- PawExtend();
+ if (!PawExtend())
+ {
+ return false;
+ }
+
//移动前开启电磁阀
Electromagnetism(new List { false });
@@ -1467,10 +1531,12 @@ namespace BPASmartClient.MorkF
// //收缩爪子
// PawShrink();
//}), "GetMaterialPawShrink");
- PawShrink();
+
+ //收缩爪子
+ if (!PawShrink()) return false;
//判断炒锅是否可以放盒
- for (int i = 0; materialSleepCount > i && !morkFs[fryIndex].FryPot1_HOBTPut; i++)
+ for (int i = 0; materialSleepCount > i && !morkFs[fryNum].FryPot1_HOBTPut; i++)
{
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
@@ -1520,8 +1586,12 @@ namespace BPASmartClient.MorkF
return false;
}
+
//伸出爪子
- PawExtend();
+ if (!PawExtend())
+ {
+ return false;
+ }
Thread.Sleep(300);
@@ -1530,7 +1600,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(300);
//收缩爪子
- PawShrink();
+ if (!PawShrink()) return false;
//设置到炒锅i出菜处
if (!SetArmPosition(x + materialToFryDistance, y))
@@ -1578,10 +1648,13 @@ namespace BPASmartClient.MorkF
Electromagnetism(new List { true });
//爪子收回
- PawShrink();
+ if (!PawShrink())
+ {
+ return false;
+ }
//爪子去2号点位
- if(!PawToPoint2())
+ if (!PawToPoint2())
{
return false;
}
@@ -1670,8 +1743,10 @@ namespace BPASmartClient.MorkF
Laser2CoordinateState laser2CoordinateState = LaserDistance2MaterialCount(distance, x, out boxCount);
if (laser2CoordinateState == Laser2CoordinateState.MaterialNormal)
{
+ int compensateHeight = boxCount > 1 ? 500 : 0;//补偿高度,超过1层盒子增加补偿
+
//盒子高度计算除去起始位置的那个盒子
- x_high = (boxCount - 1) * materialBoxHeight;
+ x_high = (boxCount - 1) * materialBoxHeight + compensateHeight;
}
return laser2CoordinateState;
@@ -1722,6 +1797,7 @@ namespace BPASmartClient.MorkF
if(heightDifferent < 0)
{
MessageLog.GetInstance.ShowEx($"菜品库检测{x}处的菜品量时,传感器获取的高度差为负数,请校准该层高度");
+ return Laser2CoordinateState.MaterialEmpty; ;
}
//盒子高度为45,但是需要考虑到误差,不足35,则认为为空
@@ -2542,7 +2618,7 @@ namespace BPASmartClient.MorkF
//更新
morkFs[i].UpdateProcess(potActions);
-
+
switch (potActions.Actions)
{
case nameof(StirFryPotActionEnum.加热开启):
@@ -2608,6 +2684,16 @@ namespace BPASmartClient.MorkF
MessageLog.GetInstance.Show(potActions.Actions);
break;
case nameof(StirFryPotActionEnum.取原料):
+ if(potActions.SeasoningLists[0].Loc == 1 ||
+ potActions.SeasoningLists[0].Loc == 9 ||
+ potActions.SeasoningLists[0].Loc == 10 ||
+ potActions.SeasoningLists[0].Loc == 18 ||
+ potActions.SeasoningLists[0].Loc == 19 ||
+ potActions.SeasoningLists[0].Loc == 27 )
+ {
+ MessageLog.GetInstance.ShowEx("该取料位置禁止使用");
+ return;
+ }
//炒锅取菜状态置为未取到
morkFs[i].GetMaterialComplete = false;
diff --git a/BPASmartClient.MorkF/ML_MorkF.cs b/BPASmartClient.MorkF/ML_MorkF.cs
index 993de6c1..4ce879a3 100644
--- a/BPASmartClient.MorkF/ML_MorkF.cs
+++ b/BPASmartClient.MorkF/ML_MorkF.cs
@@ -35,6 +35,15 @@ namespace BPASmartClient.MorkF
///
public bool InitialComplete { get; set; }
+ ///
+ /// 爪子伸出到位
+ ///
+ public bool PawOutComplete { get; set; }
+ ///
+ /// 爪子缩回到位
+ ///
+ public bool PawInComplete { get; set; }
+
private bool _ArriveComplete = false;
///
/// 定位到达,上升沿捕获需要特殊处理
diff --git a/BPASmartClient.MorkF/View/LocalMenu.xaml b/BPASmartClient.MorkF/View/LocalMenu.xaml
index a950c91c..b217bd3d 100644
--- a/BPASmartClient.MorkF/View/LocalMenu.xaml
+++ b/BPASmartClient.MorkF/View/LocalMenu.xaml
@@ -7,50 +7,61 @@
xmlns:local="clr-namespace:BPASmartClient.MorkF.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkF.ViewModel"
mc:Ignorable="d"
- Title="LocalMenu" Height="800" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True" MouseLeftButtonDown="Window_MouseLeftButtonDown">
+ Title="LocalMenu" Height="800" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True" MouseLeftButtonDown="Window_MouseLeftButtonDown" Background="Gray"
+ >
-
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
+
-
-
+
+
@@ -79,7 +90,6 @@
diff --git a/BPASmartClient.MorkF/View/MaterialCalibration.xaml b/BPASmartClient.MorkF/View/MaterialCalibration.xaml
index 2cf13469..0212c0f6 100644
--- a/BPASmartClient.MorkF/View/MaterialCalibration.xaml
+++ b/BPASmartClient.MorkF/View/MaterialCalibration.xaml
@@ -82,6 +82,10 @@
+
+
+
+
@@ -627,7 +631,7 @@
-
+
@@ -657,6 +661,8 @@
+
+
@@ -725,6 +731,7 @@
+
@@ -740,6 +747,7 @@
+
@@ -749,56 +757,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+ Style="{DynamicResource UserTextBoxStyle}"
+ Foreground="#a2c2e8" Text="{Binding Str}"/>
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
diff --git a/BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs b/BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs
index 49fe6251..ab0449ea 100644
--- a/BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs
+++ b/BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs
@@ -280,6 +280,30 @@ namespace BPASmartClient.MorkF.ViewModel
private int _Distance_2;
public int Distance_3 { get { return _Distance_3; } set { _Distance_3 = value; OnPropertyChanged(); } }
private int _Distance_3;
+ #endregion
+
+ #region 控制
+ public int SettingX { get { return _settingX; } set { _settingX = value; OnPropertyChanged(); } }
+ private int _settingX = 0;
+ public int SettingY { get { return _settingY; } set { _settingY = value; OnPropertyChanged(); } }
+ private int _settingY = 0;
+ public int MoveSpeed { get { return _moveSpeed; } set { _moveSpeed = value; OnPropertyChanged(); } }
+ private int _moveSpeed;
+
+ public int SensingDistance_1 { get { return _sensingDistance_1; } set { _sensingDistance_1 = value; OnPropertyChanged(); } }
+ private int _sensingDistance_1;
+ public int SensingDistance_2 { get { return _sensingDistance_2; } set { _sensingDistance_2 = value; OnPropertyChanged(); } }
+ private int _sensingDistance_2;
+ public int SensingDistance_3 { get { return _sensingDistance_3; } set { _sensingDistance_3 = value; OnPropertyChanged(); } }
+ private int _sensingDistance_3;
+
+ public RelayCommand SetSpeed { get; set; }//速度设定
+ public RelayCommand SetArmPosition { get; set; }//机器臂位置设定
+
+ public RelayCommand GetTestDistance_1 { get; set; }//获取感应器距离1
+ public RelayCommand GetTestDistance_2 { get; set; }//获取感应器距离2
+ public RelayCommand GetTestDistance_3 { get; set; }//获取感应器距离3
+
#endregion
public bool Up { get { return _Up; } set { _Up = value; OnPropertyChanged(); } }
private bool _Up;
@@ -355,9 +379,9 @@ namespace BPASmartClient.MorkF.ViewModel
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
+ public RelayCommand PawToPoint1 { get; set; }//夹爪位置1
+ public RelayCommand PawToPoint2 { get; set; }//夹爪位置2
+ public RelayCommand PawToPoint3 { get; set; }//夹爪位置3
public RelayCommand GetDistance_1 { get; set; }//感应测距1
public RelayCommand GetDistance_2 { get; set; }//感应测距2
public RelayCommand GetDistance_3 { get; set; }//感应测距3
@@ -844,10 +868,10 @@ namespace BPASmartClient.MorkF.ViewModel
return;
}
- if (PositionOne)
- {
- ActionManage.GetInstance.Send("CalibrationCoordination", new List {"1", OneX + OperationX, OneY + OperationY });//设定机械臂当前位置
- }
+ //if (PositionOne)
+ //{
+ // ActionManage.GetInstance.Send("CalibrationCoordination", new List {"1", OneX + OperationX, OneY + OperationY });//设定机械臂当前位置
+ //}
if (PositionTwo)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List { "2", TwoX + OperationX, TwoY + OperationY });//设定机械臂当前位置
@@ -876,14 +900,14 @@ namespace BPASmartClient.MorkF.ViewModel
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List { "8", EightX + OperationX, EightY + OperationY });//设定机械臂当前位置
}
- if (PositionNine)
- {
- ActionManage.GetInstance.Send("CalibrationCoordination", new List { "9", NineX + OperationX, NineY + OperationY });//设定机械臂当前位置
- }
- if (PositionTen)
- {
- ActionManage.GetInstance.Send("CalibrationCoordination", new List { "10", TenX + OperationX, TenY + OperationY });//设定机械臂当前位置
- }
+ //if (PositionNine)
+ //{
+ // ActionManage.GetInstance.Send("CalibrationCoordination", new List { "9", NineX + OperationX, NineY + OperationY });//设定机械臂当前位置
+ //}
+ //if (PositionTen)
+ //{
+ // ActionManage.GetInstance.Send("CalibrationCoordination", new List { "10", TenX + OperationX, TenY + OperationY });//设定机械臂当前位置
+ //}
if (PositionEleven)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List { "11", ElevenX + OperationX, ElevenY + OperationY });//设定机械臂当前位置
@@ -912,14 +936,14 @@ namespace BPASmartClient.MorkF.ViewModel
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List { "17", SeventeenX + OperationX, SeventeenY + OperationY });//设定机械臂当前位置
}
- if (PositionEighteen)
- {
- ActionManage.GetInstance.Send("CalibrationCoordination", new List { "18", EighteenX + OperationX, EighteenY + OperationY });//设定机械臂当前位置
- }
- if (PositionNineteen)
- {
- ActionManage.GetInstance.Send("CalibrationCoordination", new List { "19", NineteenX + OperationX, NineteenY + OperationY });//设定机械臂当前位置
- }
+ //if (PositionEighteen)
+ //{
+ // ActionManage.GetInstance.Send("CalibrationCoordination", new List { "18", EighteenX + OperationX, EighteenY + OperationY });//设定机械臂当前位置
+ //}
+ //if (PositionNineteen)
+ //{
+ // ActionManage.GetInstance.Send("CalibrationCoordination", new List { "19", NineteenX + OperationX, NineteenY + OperationY });//设定机械臂当前位置
+ //}
if (PositionTwenty)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List { "20", TwentyX + OperationX, TwentyY + OperationY });//设定机械臂当前位置
@@ -948,10 +972,10 @@ namespace BPASmartClient.MorkF.ViewModel
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List { "26", TwentySixX + OperationX, TwentySixY + OperationY });//设定机械臂当前位置
}
- if (PositionTwentySeven)
- {
- ActionManage.GetInstance.Send("CalibrationCoordination", new List { "27", TwentySevenX + OperationX, TwentySevenY + OperationY });//设定机械臂当前位置
- }
+ //if (PositionTwentySeven)
+ //{
+ // ActionManage.GetInstance.Send("CalibrationCoordination", new List { "27", TwentySevenX + OperationX, TwentySevenY + OperationY });//设定机械臂当前位置
+ //}
if (PositionMaterialHeight)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List { "MaterialHeight", MaterialHeightX + OperationX, MaterialHeightY + OperationY });//设定机械臂当前位置
@@ -987,12 +1011,21 @@ namespace BPASmartClient.MorkF.ViewModel
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"); });//夹爪反转
+ PawTurnFront = new RelayCommand(() => {
+ ActionManage.GetInstance.Send("PawTurnFront");
+ });//夹爪伸出
+ PawTurnBack = new RelayCommand(() => {
+ ActionManage.GetInstance.Send("PawTurnBack");
+ });//夹爪收缩
GetDistance_1 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_1"); });//感应距离1
GetDistance_2 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_2"); });//感应距离2
GetDistance_3 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_3"); });//感应距离3
+ SetSpeed = new RelayCommand(() => { ActionManage.GetInstance.Send("SetSpeed", new List { MoveSpeed }); });//速度设定
+ SetArmPosition = new RelayCommand(() => {
+ ActionManage.GetInstance.Send("SetArmPosition", new List { SettingX, SettingY });
+ });//设定移动位置
+
PhysicalMaterialCoordinate();
ActionManage.GetInstance.Register(new Action((o) =>
{
diff --git a/BPASmartClient/MainWindow.xaml.cs b/BPASmartClient/MainWindow.xaml.cs
index f9bd5683..88a9d024 100644
--- a/BPASmartClient/MainWindow.xaml.cs
+++ b/BPASmartClient/MainWindow.xaml.cs
@@ -66,6 +66,7 @@ namespace BPASmartClient
if(res == MessageBoxResult.OK)
{
this.Close();
+ Application.Current.Shutdown();
}
};
From edef6d6bedf137ee4270fe360fd865f1bb4178c0 Mon Sep 17 00:00:00 2001
From: NXX <447201003@qq>
Date: Thu, 12 Jan 2023 11:26:02 +0800
Subject: [PATCH 02/96] =?UTF-8?q?=E5=B0=8F=E7=82=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BPASmartClient.Model/GlobalFoodMenu.cs | 14 --
.../小炒机/MaterialAndFryingTime.cs | 15 +++
.../BPASmartClient.MorkBF.csproj | 1 +
BPASmartClient.MorkBF/Control_MorkBF.cs | 25 ++--
.../BPASmartClient.MorkF.csproj | 1 +
BPASmartClient.MorkF/Control_MorkF.cs | 123 +++++++++---------
BPASmartClient.MorkF/View/DebugView.xaml | 12 +-
BPASmartClient.MorkF/View/LocalMenu.xaml | 22 ++--
BPASmartClient.MorkF/View/LocalMenu.xaml.cs | 2 +-
.../ViewModel/DebugViewModel.cs | 3 +-
.../ViewModel/LocalMenuViewModel.cs | 77 ++++++-----
BPASmartClient.ViewModel/FoodMenuViewModel.cs | 11 +-
BPASmartClient/Control/FoodMenuView.xaml | 10 +-
BPASmartClient/Control/FoodMenuView.xaml.cs | 4 +-
14 files changed, 174 insertions(+), 146 deletions(-)
delete mode 100644 BPASmartClient.Model/GlobalFoodMenu.cs
create mode 100644 BPASmartClient.Model/小炒机/MaterialAndFryingTime.cs
diff --git a/BPASmartClient.Model/GlobalFoodMenu.cs b/BPASmartClient.Model/GlobalFoodMenu.cs
deleted file mode 100644
index 73bdd544..00000000
--- a/BPASmartClient.Model/GlobalFoodMenu.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BPASmartClient.Model
-{
- public class GlobalFoodMenu
- {
- public static ObservableCollection LocalFoodMenus = new ObservableCollection();
- }
-}
diff --git a/BPASmartClient.Model/小炒机/MaterialAndFryingTime.cs b/BPASmartClient.Model/小炒机/MaterialAndFryingTime.cs
new file mode 100644
index 00000000..dba43182
--- /dev/null
+++ b/BPASmartClient.Model/小炒机/MaterialAndFryingTime.cs
@@ -0,0 +1,15 @@
+using BPA.Models;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.Model.小炒机
+{
+ public class MaterialAndFryingTime
+ {
+ public Dictionary> materials { get; set; } = new Dictionary>();
+ }
+}
diff --git a/BPASmartClient.MorkBF/BPASmartClient.MorkBF.csproj b/BPASmartClient.MorkBF/BPASmartClient.MorkBF.csproj
index 14337820..163b8885 100644
--- a/BPASmartClient.MorkBF/BPASmartClient.MorkBF.csproj
+++ b/BPASmartClient.MorkBF/BPASmartClient.MorkBF.csproj
@@ -13,6 +13,7 @@
+
diff --git a/BPASmartClient.MorkBF/Control_MorkBF.cs b/BPASmartClient.MorkBF/Control_MorkBF.cs
index 3f586713..0bd4ab2f 100644
--- a/BPASmartClient.MorkBF/Control_MorkBF.cs
+++ b/BPASmartClient.MorkBF/Control_MorkBF.cs
@@ -9,6 +9,7 @@ using BPASmartClient.Model;
using BPASmartClient.Model.大炒;
using BPASmartClient.MorkBF.Model;
using BPASmartClient.MorkBF.ViewModel;
+using BPASmartClient.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -34,18 +35,18 @@ namespace BPASmartClient.MorkBF
IsHealth = true;
BPASmartClient.Helper.Json.Read();
MonitorViewModel.DeviceId = DeviceId;
- ActionManage.GetInstance.Register(new Action(() =>
- {
- GlobalFoodMenu.LocalFoodMenus.Clear();
- if(BPASmartClient.Helper.Json.Data.FryPotMessage.Count>0)
- {
- foreach (var item in BPASmartClient.Helper.Json.Data.FryPotMessage)
- {
- GlobalFoodMenu.LocalFoodMenus.Add(new FoodMenuModel { GoodKey = item.GoodKey, GoodName = item.GoodName });
- }
- }
+ //ActionManage.GetInstance.Register(new Action(() =>
+ //{
+ // FoodMenuViewModel.GetInstance().FoodMenus.Clear();
+ // if(BPASmartClient.Helper.Json.Data.FryPotMessage.Count>0)
+ // {
+ // foreach (var item in BPASmartClient.Helper.Json.Data.FryPotMessage)
+ // {
+ // FoodMenuViewModel.GetInstance().FoodMenus.Add(new FoodMenuModel { GoodKey = item.GoodKey, GoodName = item.GoodName });
+ // }
+ // }
- }), "更新菜单");
+ //}), "更新菜单");
CommandRegist();//调试
ServerInit();
DataParse();//数据解析
@@ -927,7 +928,7 @@ namespace BPASmartClient.MorkBF
WorkStatus_1 = morkBF.FirePot1_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机,
WorkStatus_2 = morkBF.FirePot2_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机,
RobotStatu = WorkStatus.工作,
- Alarm = new List(),
+ Alarm = new List(),
FailuresCount = 0,
StatsCount = statsModels,
MaxWok_Dishes_1 = "满汉全席",
diff --git a/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj b/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
index e7ac07e7..5b3cc3dc 100644
--- a/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
+++ b/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
@@ -18,6 +18,7 @@
+
diff --git a/BPASmartClient.MorkF/Control_MorkF.cs b/BPASmartClient.MorkF/Control_MorkF.cs
index cf742f12..0d1ee202 100644
--- a/BPASmartClient.MorkF/Control_MorkF.cs
+++ b/BPASmartClient.MorkF/Control_MorkF.cs
@@ -16,6 +16,8 @@ using System.Windows.Documents;
using BPASmartClient.Business;
using Microsoft.CodeAnalysis;
using BPASmartClient.MorkF.ViewModel;
+using BPASmartClient.ViewModel;
+using System.Windows;
namespace BPASmartClient.MorkF
{
@@ -50,13 +52,13 @@ namespace BPASmartClient.MorkF
///
/// 菜品盒下移高度,相对于坐标系
///
- private const int materialBoxHigh = 4080;
+ //private const int materialBoxHigh = 4080;
- //菜品库出餐高度
- private const int materialHigh = 33000;
+ ////菜品库出餐高度
+ //private const int materialHigh = 33000;
- //传感器到菜品库的高度(坐标系)
- private const int materialLaserHigh = 34500;
+ ////传感器到菜品库的高度(坐标系)
+ //private const int materialLaserHigh = 34500;
///
/// 菜品盒坐标系高度
@@ -64,26 +66,26 @@ namespace BPASmartClient.MorkF
private const int materialBoxHeight = 9700;
//传感器1到菜品库的高度(厘米)
- private const int materialLaserHighCM_1 = 22;
+ //private const int materialLaserHighCM_1 = 22;
- //传感器2到菜品库的高度(厘米)
- private const int materialLaserHighCM_2 = 27;
+ ////传感器2到菜品库的高度(厘米)
+ //private const int materialLaserHighCM_2 = 27;
- //传感器3到菜品库的高度(厘米)
- private const int materialLaserHighCM_3 = 31;
+ ////传感器3到菜品库的高度(厘米)
+ //private const int materialLaserHighCM_3 = 31;
///
/// 传感器到隔板的距离(坐标系)
///
private const int clapboardLaserHigh = 10000;
- //炒锅1倒菜的xy坐标
- private const int materialPutPositionXFry1 = 70000;
- private const int materialPutPositionYFry1 = 40000;
+ ////炒锅1倒菜的xy坐标
+ //private const int materialPutPositionXFry1 = 70000;
+ //private const int materialPutPositionYFry1 = 40000;
- //炒锅2倒菜的xy坐标
- private const int materialPutPositionXFry2 = 70000;
- private const int materialPutPositionYFry2 = 40000;
+ ////炒锅2倒菜的xy坐标
+ //private const int materialPutPositionXFry2 = 70000;
+ //private const int materialPutPositionYFry2 = 40000;
//菜品库机械爪放置菜品距离
private const int materialToFryDistance = 10000;
@@ -146,7 +148,7 @@ namespace BPASmartClient.MorkF
///
/// 告警列表
///
- private List alarmModel = new List();
+ private List alarmModel = new List();
///
///
@@ -201,7 +203,7 @@ namespace BPASmartClient.MorkF
MaterialCoordinate.GetInstance().frying2 = materialCoordinate.frying2;
MaterialCoordinate.GetInstance().materialHeight = materialCoordinate.materialHeight;
MaterialCoordinate.GetInstance().MaterialOneX = materialCoordinate.MaterialOneX;
- MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX;
+ MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX;
MaterialCoordinate.GetInstance().MaterialThreeX = materialCoordinate.MaterialThreeX;
}
////菜品库编号与坐标系对象存储
@@ -404,7 +406,6 @@ namespace BPASmartClient.MorkF
ActionManage.GetInstance.Register(PLCInite, "InitCommand");
ActionManage.GetInstance.Register(StartOrder, "StartOrder");
ActionManage.GetInstance.Register(StartOrderMain, "开始下单");
- ActionManage.GetInstance.Register(StartLocalOrder, "StartLocalOrder");
ActionManage.GetInstance.Register(StopLocalOrder, "StopLocalOrder");
ActionManage.GetInstance.Register(new Action((o) =>
{
@@ -725,7 +726,7 @@ namespace BPASmartClient.MorkF
}
///
- /// 本地菜单下单
+ /// 根据菜品ID下单
///
private void StartOrder(object o)
{
@@ -749,44 +750,42 @@ namespace BPASmartClient.MorkF
}
///
- /// 本地菜单下单
+ /// 主界面本地菜单下单
///
private void StartOrderMain(object o)
{
if (o == null) return;
- if (o is string goodId)
+ if (o is FoodMenuModel good)
{
- var res = LocalstirFryGoods?.FirstOrDefault(p => p.GoodsKey.ToString() == goodId);//匹配订单对应制作流程
- if (res != null)
- {
- /* morkF.listStirBom.Add(res.StirFryBomInfo);*///添加订单制作流程
- if (StirFryGoodsQuenes.Count > 0) return;
- StirFryGoodsQuenes.Enqueue(new OrderLocInfo()
- {
- SuborderId = Guid.NewGuid().ToString(),
- StirPotActions = res.StirPotActions,
- GoodName = "本地菜品"
- });
- MessageLog.GetInstance.Show($"添加本地订单{res.GoodsKey}");
- }
+ NewStartLocalOrder(good.GoodName);
}
- }
- private void StartLocalOrder()
- {
- if (StirFryGoodsQuenes.Count > 0) return;//只能一个一个做
- if (Json.Data.LocalstirFryGoods.StirPotActions.Count > 0)
- {
- StirFryGoodsQuenes.Enqueue(new OrderLocInfo()
- {
- SuborderId = Guid.NewGuid().ToString(),
- StirPotActions = Json.Data.LocalstirFryGoods.StirPotActions,
- GoodName = "本地菜品"
- });
- MessageLog.GetInstance.Show($"添加本地模拟的订单{Json.Data.LocalstirFryGoods.GoodsKey}");
- }
+
+ //if (o == null) return;
+ //if (o is string goodId)
+ //{
+ // var res = LocalstirFryGoods?.FirstOrDefault(p => p.GoodsKey.ToString() == goodId);//匹配订单对应制作流程
+ // if (res != null)
+ // {
+ // /* morkF.listStirBom.Add(res.StirFryBomInfo);*///添加订单制作流程
+ // if (StirFryGoodsQuenes.Count > 0) return;
+ // StirFryGoodsQuenes.Enqueue(new OrderLocInfo()
+ // {
+ // SuborderId = Guid.NewGuid().ToString(),
+ // StirPotActions = res.StirPotActions,
+ // GoodName = "本地菜品"
+ // });
+ // MessageLog.GetInstance.Show($"添加本地订单{res.GoodsKey}");
+ // }
+ //}
}
+
+
+ ///
+ /// 本地配置的订单
+ ///
+ ///
private void NewStartLocalOrder(string materialName)
{
//if (StirFryGoodsQuenes.Count > 0) return;//只能一个一个做
@@ -821,6 +820,7 @@ namespace BPASmartClient.MorkF
GoodName = materialName
});
MessageLog.GetInstance.Show($"添加本地模拟的订单{Json.Data.LocalstirFryGoods.GoodsKey}");
+ MessageBox.Show("下单成功");
}
}
@@ -1525,7 +1525,7 @@ namespace BPASmartClient.MorkF
return false;
}
- WriteSpeed(50000);
+ WriteSpeed(50000);//移动速度
//ThreadManage.GetInstance().Start(new Action(() =>
//{
// //收缩爪子
@@ -2292,11 +2292,7 @@ namespace BPASmartClient.MorkF
GoodsKey = item.GoodsKey,
StirPotActions = OrderSort(item.StirPotActions),
});
- GlobalFoodMenu.LocalFoodMenus.Add(new FoodMenuModel
- {
- GoodKey = item.GoodsKey.ToString(),
- GoodName = "",
- });
+
}
}
@@ -2433,9 +2429,9 @@ namespace BPASmartClient.MorkF
///
///
///
- private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
+ private void OrderChange(string Id , string goodName, ORDER_STATUS oRDER_STATUS,int deviceId)
{
- EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid });
+ EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, GoodName = goodName,DeviceId = deviceId, SubOrderId =Id });
}
///
@@ -2563,13 +2559,14 @@ namespace BPASmartClient.MorkF
if (morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete && ml_morkf.InitialComplete &&
!morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&菜品库初始化&&是否在炒菜中
{
- Thread.Sleep(5000);
+ Thread.Sleep(4000);
lock(lock_MainProcessExcute)
{
//待炒小炒队列出队列
if (StirFryGoodsQuenes.TryDequeue(out var res))
{
+ OrderChange(res.SuborderId, res.GoodName, ORDER_STATUS.WAIT, DeviceId = i);
//设置当前炒制菜品
nowStirFryGood[i] = res;
//炒锅工作状态置为正在工作中
@@ -2595,7 +2592,7 @@ namespace BPASmartClient.MorkF
bool ret = true;
MessageLog.GetInstance.Show($"炒锅{i}开始炒制菜品{res.GoodName}");
-
+ OrderChange(res.SuborderId, res.GoodName, ORDER_STATUS.COOKING, DeviceId = i);
morkFs[i].GoodName = res.GoodName;
Coordinate myCoordinate = new Coordinate();
@@ -2764,7 +2761,7 @@ namespace BPASmartClient.MorkF
ret = OutFood(i, out error, true);
if(ret == false)
{
- alarmModel.Add(new AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error });
+ alarmModel.Add(new BPA.Message.AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error });
}
break;
case nameof(StirFryPotActionEnum.炒制菜品):
@@ -2782,7 +2779,7 @@ namespace BPASmartClient.MorkF
}
if (ret == false)
{
- alarmModel.Add(new AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error });
+ alarmModel.Add(new BPA.Message.AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error });
}
MessageLog.GetInstance.Show(potActions.Actions);
break;
@@ -2799,9 +2796,9 @@ namespace BPASmartClient.MorkF
Thread.Sleep(3000);
//回原点位
StirArmGoOrigin(i);
-
+ OrderChange(res.SuborderId, res.GoodName, ORDER_STATUS.COMPLETED_COOK, DeviceId = i);
//同时只能允许有一个出餐
- lock(lock_OutMeal)
+ lock (lock_OutMeal)
{
//出餐启动
OutMeal(i);
diff --git a/BPASmartClient.MorkF/View/DebugView.xaml b/BPASmartClient.MorkF/View/DebugView.xaml
index 186c5233..e6baed2a 100644
--- a/BPASmartClient.MorkF/View/DebugView.xaml
+++ b/BPASmartClient.MorkF/View/DebugView.xaml
@@ -55,16 +55,16 @@
-
-
-
+
+
+
-
+
-
+
diff --git a/BPASmartClient.MorkF/View/LocalMenu.xaml b/BPASmartClient.MorkF/View/LocalMenu.xaml
index b217bd3d..1731d793 100644
--- a/BPASmartClient.MorkF/View/LocalMenu.xaml
+++ b/BPASmartClient.MorkF/View/LocalMenu.xaml
@@ -7,7 +7,7 @@
xmlns:local="clr-namespace:BPASmartClient.MorkF.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkF.ViewModel"
mc:Ignorable="d"
- Title="LocalMenu" Height="800" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True" MouseLeftButtonDown="Window_MouseLeftButtonDown" Background="Gray"
+ Title="LocalMenu" Height="900" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True" MouseLeftButtonDown="Window_MouseLeftButtonDown" Background="Gray"
>
@@ -22,7 +22,7 @@
-
+
@@ -56,23 +56,29 @@
+
-
+
-
-
+
+
+
+
+
+
+
-
+
@@ -88,7 +94,7 @@
-
diff --git a/BPASmartClient.MorkF/View/LocalMenu.xaml.cs b/BPASmartClient.MorkF/View/LocalMenu.xaml.cs
index e5d001f4..d3c98d16 100644
--- a/BPASmartClient.MorkF/View/LocalMenu.xaml.cs
+++ b/BPASmartClient.MorkF/View/LocalMenu.xaml.cs
@@ -233,7 +233,7 @@ namespace BPASmartClient.MorkF.View
private void Materials_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- string str = Materials.SelectedValue.ToString();
+ string str = Materials.SelectedValue?.ToString();
if(str != string.Empty)
{
ActionManage.GetInstance.Send("LoacMenuSelectMaterial", str);
diff --git a/BPASmartClient.MorkF/ViewModel/DebugViewModel.cs b/BPASmartClient.MorkF/ViewModel/DebugViewModel.cs
index c2caa4fa..4c093fa1 100644
--- a/BPASmartClient.MorkF/ViewModel/DebugViewModel.cs
+++ b/BPASmartClient.MorkF/ViewModel/DebugViewModel.cs
@@ -33,7 +33,7 @@ namespace BPASmartClient.MorkF.ViewModel
public RelayCommand FoodPlcInite { get; set; }
public RelayCommand Plc1Reset { get; set; }
public RelayCommand StartOrder { get; set; }
- public RelayCommand StartLocalOrder { get; set; }
+
public RelayCommand StopLocalOrder { get; set; }
public RelayCommand ModeChange { get; set; }
@@ -205,7 +205,6 @@ namespace BPASmartClient.MorkF.ViewModel
PlcInite = new RelayCommand(() => { ActionManage.GetInstance.Send("InitCommand"); });
Plc1Reset = new RelayCommand(() => { ActionManage.GetInstance.Send("Plc1Reset"); });
StartOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StartOrder", FoodMenuID); });
- StartLocalOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StartLocalOrder"); });
StopLocalOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StopLocalOrder"); });
ModeChange = new RelayCommand(() => {
ActionManage.GetInstance.Send("ModeChange");
diff --git a/BPASmartClient.MorkF/ViewModel/LocalMenuViewModel.cs b/BPASmartClient.MorkF/ViewModel/LocalMenuViewModel.cs
index 39ec33cd..67d12347 100644
--- a/BPASmartClient.MorkF/ViewModel/LocalMenuViewModel.cs
+++ b/BPASmartClient.MorkF/ViewModel/LocalMenuViewModel.cs
@@ -1,6 +1,9 @@
using BPA.Models;
using BPASmartClient.Helper;
+using BPASmartClient.Model;
+using BPASmartClient.Model.小炒机;
using BPASmartClient.MorkF.Model;
+using BPASmartClient.ViewModel;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
@@ -17,20 +20,33 @@ namespace BPASmartClient.MorkF.ViewModel
partial class LocalMenuViewModel:ObservableObject
{
+ ///
+ /// 单个菜品流程
+ ///
public ObservableCollection PotActionStep { get { return _PotActionStep; }
set { _PotActionStep = value; OnPropertyChanged(); } }
private ObservableCollection _PotActionStep = new ObservableCollection();
+
public string MaterialName { get; set; }
-
- public string SelectMaterialName { get; set; }
-
+ ///
+ /// 选中的菜品
+ ///
+ public string SelectMaterialName { get { return _selectMaterialName; } set { _selectMaterialName = value; OnPropertyChanged(); } }
+ private string _selectMaterialName;
+ ///
+ /// 菜品combox集合
+ ///
public ObservableCollection MaterialNames { get; set; } = new ObservableCollection();
-
+ ///
+ /// 动作名称combox集合
+ ///
public ObservableCollection strPotActions { get; set; } = new ObservableCollection();
-
- public MaterialAndFryingTime materialAndFryingTime { get; set; } = new MaterialAndFryingTime();
+ ///
+ /// 全部菜品流程集合
+ ///
+ public MaterialAndFryingTime materialAndFryingTime { get; set; } = Json.Data;
public RelayCommand Delete { get; set; }
public RelayCommand AddFryTime { get; set; }
@@ -106,34 +122,33 @@ namespace BPASmartClient.MorkF.ViewModel
else
{
MaterialNames.Add(MaterialName);
+ SelectMaterialName = MaterialName;
}
});
DeleteMaterial = new RelayCommand(() =>
{
- //尝试是否能找到
- if (MaterialNames.FirstOrDefault(o => o == SelectMaterialName) == SelectMaterialName)
+ if (materialAndFryingTime.materials.ContainsKey(SelectMaterialName))
{
- MaterialNames.Remove(SelectMaterialName);
- if(materialAndFryingTime.materials.ContainsKey(SelectMaterialName))
- {
- materialAndFryingTime.materials.Remove(SelectMaterialName);
- }
- }
- });
- RenameMaterial = new RelayCommand(() =>
- {
- //尝试是否能找到
- if (MaterialNames.FirstOrDefault(o => o == SelectMaterialName) == SelectMaterialName)
- {
- MaterialNames.Remove(SelectMaterialName);
- MaterialNames.Add(MaterialName);
- if (materialAndFryingTime.materials.ContainsKey(SelectMaterialName))
- {
- materialAndFryingTime.materials.Add(MaterialName, materialAndFryingTime.materials[SelectMaterialName]);
- materialAndFryingTime.materials.Remove(SelectMaterialName);
- }
+ materialAndFryingTime.materials.Remove(SelectMaterialName);
}
+ MaterialNames.Remove(SelectMaterialName);
+ PotActionStep.Clear();
});
+ //RenameMaterial = new RelayCommand(() =>
+ //{
+ // //尝试是否能找到
+ // if (MaterialNames.FirstOrDefault(o => o == SelectMaterialName) == SelectMaterialName)
+ // {
+ // MaterialNames.Remove(SelectMaterialName);
+ // MaterialNames.Add(MaterialName);
+ // if (materialAndFryingTime.materials.ContainsKey(SelectMaterialName))
+ // {
+ // materialAndFryingTime.materials.Add(MaterialName, materialAndFryingTime.materials[SelectMaterialName]);
+ // materialAndFryingTime.materials.Remove(SelectMaterialName);
+
+ // }
+ // }
+ //});
Save = new RelayCommand(new Action(() =>
{
if(PotActionStep.Count > 0)
@@ -155,8 +170,9 @@ namespace BPASmartClient.MorkF.ViewModel
//Json.Data.LocalstirFryGoods.GoodsKey = 11;
//Json.Data.LocalstirFryGoods.StirPotActions = new List(PotActionStep);
//Json.Save();
- Json.Data.materials = materialAndFryingTime.materials;
+ //Json.Data.materials = materialAndFryingTime.materials;
Json.Save();
+
//ActionManage.GetInstance.Send("LocalMenuClose");
}));
@@ -209,8 +225,5 @@ namespace BPASmartClient.MorkF.ViewModel
}
}
- partial class MaterialAndFryingTime
- {
- public Dictionary> materials { get; set; } = new Dictionary>();
- }
+
}
diff --git a/BPASmartClient.ViewModel/FoodMenuViewModel.cs b/BPASmartClient.ViewModel/FoodMenuViewModel.cs
index 4de85018..68efee72 100644
--- a/BPASmartClient.ViewModel/FoodMenuViewModel.cs
+++ b/BPASmartClient.ViewModel/FoodMenuViewModel.cs
@@ -1,5 +1,6 @@
using BPASmartClient.Helper;
using BPASmartClient.Model;
+using BPASmartClient.Model.小炒机;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
@@ -13,17 +14,23 @@ namespace BPASmartClient.ViewModel
{
public class FoodMenuViewModel: ObservableObject
{
- public ObservableCollection FoodMenus { get; set; } = GlobalFoodMenu.LocalFoodMenus;
+ ///
+ /// 菜单
+ ///
+ public ObservableCollection FoodMenus { get; set; } = new ObservableCollection();
public RelayCommand StartOrder { get; set; }
public FoodMenuViewModel()
{
-
+ Json.Data.materials?.Keys?.ToList().ForEach(key => FoodMenus.Add(new FoodMenuModel { GoodName = key }));
+
StartOrder = new RelayCommand((o) =>
{
ActionManage.GetInstance.Send("开始下单", o);
});
}
+
+
}
}
diff --git a/BPASmartClient/Control/FoodMenuView.xaml b/BPASmartClient/Control/FoodMenuView.xaml
index 7e2efe5b..f7b0fd57 100644
--- a/BPASmartClient/Control/FoodMenuView.xaml
+++ b/BPASmartClient/Control/FoodMenuView.xaml
@@ -6,10 +6,8 @@
xmlns:local="clr-namespace:Control"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="800">
-
-
-
+ d:DesignHeight="850" d:DesignWidth="800">
+
@@ -23,6 +21,7 @@
+
@@ -47,11 +46,12 @@
+ CommandParameter="{Binding .}"/>
+
diff --git a/BPASmartClient/Control/FoodMenuView.xaml.cs b/BPASmartClient/Control/FoodMenuView.xaml.cs
index 6cc782da..33bd5be3 100644
--- a/BPASmartClient/Control/FoodMenuView.xaml.cs
+++ b/BPASmartClient/Control/FoodMenuView.xaml.cs
@@ -1,4 +1,5 @@
-using System;
+using BPASmartClient.ViewModel;
+using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
@@ -21,6 +22,7 @@ namespace BPASmartClient.Control
public FoodMenuView()
{
InitializeComponent();
+ this.DataContext = new FoodMenuViewModel();
}
}
}
From 9954d53082550eeab901ccb5b7b4f56c289925f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com>
Date: Mon, 13 Feb 2023 09:44:09 +0800
Subject: [PATCH 03/96] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../分餐机/ScreenSplitMealsControl1.xaml | 382 +++++++++---------
BPASmartClient/App.config | 10 +-
2 files changed, 199 insertions(+), 193 deletions(-)
diff --git a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml
index 5340572e..3afb1f26 100644
--- a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml
+++ b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml
@@ -1,189 +1,195 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 设备工作状态
-
-
-
- 今日刷卡数
-
-
-
-
-
-
-
-
-
-
-
- 前一位刷卡人
-
-
-
- 当前刷卡人
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 设备工作状态
-
-
-
- 今日刷卡数
-
-
-
-
-
-
-
-
-
-
-
- 前一位刷卡人
-
-
-
- 当前刷卡人
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 设备工作状态
+
+
+
+ 今日刷卡数
+
+
+
+
+
+
+
+
+
+
+
+ 前一位刷卡人
+
+
+
+ 当前刷卡人
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 设备工作状态
+
+
+
+ 今日刷卡数
+
+
+
+
+
+
+
+
+
+
+
+ 前一位刷卡人
+
+
+
+ 当前刷卡人
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BPASmartClient/App.config b/BPASmartClient/App.config
index 0f73c836..04f363c3 100644
--- a/BPASmartClient/App.config
+++ b/BPASmartClient/App.config
@@ -4,12 +4,12 @@
-
+
-
+
-
+
From c79f7b12f5954178e9767bc7b5f83a73a4903f2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com>
Date: Mon, 13 Feb 2023 16:56:04 +0800
Subject: [PATCH 04/96] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=89=88MORKS?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../BPASmartClient.Business.csproj | 2 +-
.../BPASmartClient.CustomResource.csproj | 2 +-
.../BPASmartClient.Device.csproj | 2 +-
.../BPASmartClient.DosingSystemSingle.csproj | 2 +-
.../BPASmartClient.JXJFoodSmallStation.csproj | 2 +-
.../BPASmartClient.Model.csproj | 2 +-
.../BPASmartClient.MorkF.csproj | 2 +-
.../BPASmartClient.MorkMW.csproj | 2 +-
.../BPASmartClient.MorkS.csproj | 2 +-
BPASmartClient.MorkSUpgradedVer/Alarm.cs | 74 ++
.../BPASmartClient.MorkSUpgradedVer.csproj | 35 +
.../Control_MorkSUpgradedVer.cs | 755 ++++++++++++++++++
BPASmartClient.MorkSUpgradedVer/DataServer.cs | 51 ++
BPASmartClient.MorkSUpgradedVer/DeviceData.cs | 193 +++++
.../GVL_MorkSUpgradedVer.cs | 322 ++++++++
.../GlobalUsing.cs | 26 +
.../Model/Global.cs | 13 +
.../Model/MorksPar.cs | 16 +
.../Model/ParSet.cs | 29 +
.../Model/WritePar.cs | 14 +
.../OrderLocInfo.cs | 23 +
.../View/Debug.xaml | 117 +++
.../View/Debug.xaml.cs | 30 +
.../View/Monitor.xaml | 242 ++++++
.../View/Monitor.xaml.cs | 28 +
.../View/ParSet.xaml | 130 +++
.../View/ParSet.xaml.cs | 28 +
.../ViewModel/DebugViewModel.cs | 79 ++
.../ViewModel/MonitorViewModel.cs | 25 +
.../ViewModel/ParSetViewModel.cs | 49 ++
BPASmartClient/BPASmartClient.csproj | 3 +-
.../BPASmartClient.DosingSystem.csproj | 2 +-
SmartClient.sln | 25 +-
33 files changed, 2315 insertions(+), 12 deletions(-)
create mode 100644 BPASmartClient.MorkSUpgradedVer/Alarm.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/BPASmartClient.MorkSUpgradedVer.csproj
create mode 100644 BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/DataServer.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/DeviceData.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/GlobalUsing.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/Model/Global.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/Model/MorksPar.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/Model/ParSet.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/Model/WritePar.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/OrderLocInfo.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/View/Debug.xaml
create mode 100644 BPASmartClient.MorkSUpgradedVer/View/Debug.xaml.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml
create mode 100644 BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml
create mode 100644 BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/ViewModel/DebugViewModel.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/ViewModel/MonitorViewModel.cs
create mode 100644 BPASmartClient.MorkSUpgradedVer/ViewModel/ParSetViewModel.cs
diff --git a/BPASmartClient.Business/BPASmartClient.Business.csproj b/BPASmartClient.Business/BPASmartClient.Business.csproj
index 87d1b161..25dfbd1c 100644
--- a/BPASmartClient.Business/BPASmartClient.Business.csproj
+++ b/BPASmartClient.Business/BPASmartClient.Business.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
index b728b8dd..609d0a2a 100644
--- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
+++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
@@ -410,7 +410,7 @@
-
+
diff --git a/BPASmartClient.Device/BPASmartClient.Device.csproj b/BPASmartClient.Device/BPASmartClient.Device.csproj
index 91f97e5b..2cc1541a 100644
--- a/BPASmartClient.Device/BPASmartClient.Device.csproj
+++ b/BPASmartClient.Device/BPASmartClient.Device.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj b/BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj
index 86b5d8c8..46d83b78 100644
--- a/BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj
+++ b/BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj b/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
index 113ea061..6753d0ad 100644
--- a/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
+++ b/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/BPASmartClient.Model/BPASmartClient.Model.csproj b/BPASmartClient.Model/BPASmartClient.Model.csproj
index 660a436c..1c8949a9 100644
--- a/BPASmartClient.Model/BPASmartClient.Model.csproj
+++ b/BPASmartClient.Model/BPASmartClient.Model.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj b/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
index e7ac07e7..d4750439 100644
--- a/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
+++ b/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/BPASmartClient.MorkMW/BPASmartClient.MorkMW.csproj b/BPASmartClient.MorkMW/BPASmartClient.MorkMW.csproj
index 8d76ab31..2397e6bc 100644
--- a/BPASmartClient.MorkMW/BPASmartClient.MorkMW.csproj
+++ b/BPASmartClient.MorkMW/BPASmartClient.MorkMW.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj b/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
index 59a477af..7b7a7d77 100644
--- a/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
+++ b/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/BPASmartClient.MorkSUpgradedVer/Alarm.cs b/BPASmartClient.MorkSUpgradedVer/Alarm.cs
new file mode 100644
index 00000000..0f786f85
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/Alarm.cs
@@ -0,0 +1,74 @@
+using BPASmartClient.Device;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkSUpgradedVer
+{
+ public class Alarm : IAlarm
+ {
+ ///
+ /// 煮面机温度过低
+ ///
+ [Alarm("煮面机温度过低")]
+ public bool MachineLowTemperature { get; set; }
+
+ ///
+ /// 大碗数量不足
+ ///
+ [Alarm("大碗数量不足")]
+ public bool Supply1_LossBowl { get; set; }
+
+ ///
+ /// 一次性碗数量不足
+ ///
+ [Alarm("一次性碗数量不足")]
+ public bool Supply2_LossBowl { get; set; }
+
+ ///
+ /// 设备未初始化
+ ///
+ [Alarm("设备未初始化")]
+ public bool DeviceNoInit { get; set; }
+
+ ///
+ /// 移碗丝杆未初始化
+ ///
+ [Alarm("移碗丝杆未初始化")]
+ public bool MoveScrewRodNoInit { get; set; }
+
+ ///
+ /// 供碗1未初始化
+ ///
+ [Alarm("供碗1未初始化")]
+ public bool SacrificialVesselNoInit { get; set; }
+
+ ///
+ /// 气缸推杆未初始化
+ ///
+ [Alarm("气缸推杆未初始化")]
+ public bool CylinderNoInit { get; set; }
+
+ ///
+ /// 煮面机初未初始化
+ ///
+ [Alarm("煮面机初未初始化")]
+ public bool NoodleCookerNoInit { get; set; }
+
+ ///
+ /// 机器人未初始化
+ ///
+ [Alarm("机器人未初始化")]
+ public bool RobotNoInit { get; set; }
+
+ ///
+ /// 料仓未初始化
+ ///
+ [Alarm("料仓未初始化")]
+ public bool SiloNoInit { get; set; }
+
+
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/BPASmartClient.MorkSUpgradedVer.csproj b/BPASmartClient.MorkSUpgradedVer/BPASmartClient.MorkSUpgradedVer.csproj
new file mode 100644
index 00000000..3b7fef9c
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/BPASmartClient.MorkSUpgradedVer.csproj
@@ -0,0 +1,35 @@
+
+
+
+ net6.0-windows
+ enable
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+
+
diff --git a/BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs b/BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs
new file mode 100644
index 00000000..f20d6c65
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs
@@ -0,0 +1,755 @@
+using System;
+using System.Collections.Generic;
+using BPA.Message.Enum;
+using BPASmartClient.Device;
+using BPASmartClient.EventBus;
+using BPASmartClient.Model;
+using BPASmartClient.Peripheral;
+using static BPASmartClient.EventBus.EventBus;
+using BPASmartClient.Helper;
+using System.Threading;
+using BPASmartClient.Message;
+using BPA.Message;
+using System.Linq;
+using BPASmartClient.Model.PLC;
+using System.Threading.Tasks;
+using System.Reflection;
+using BPASmartClient.MorkSUpgradedVer.Model;
+using System.Collections.ObjectModel;
+using BPASmartClient.MorkSUpgradedVer.ViewModel;
+using BPASmartClient.Business;
+using BPASmartClient.Model.小炒机;
+using BPA.Models;
+using System.Windows.Forms;
+using System.Media;
+
+namespace BPASmartClient.MorkSUpgradedVer
+{
+ public class Control_MorkSUpgradedVer : BaseDevice
+ {
+ public override DeviceClientType DeviceType => DeviceClientType.MORKS;
+ GVL_MorkSUpgradedVer mORKS = new GVL_MorkSUpgradedVer();
+ Alarm alarm = new Alarm();
+
+ public override void DoMain()
+ {
+ MonitorViewModel.DeviceId = DeviceId;
+ ServerInit();
+ DataParse();
+ Json.Read();
+ Json.Read();
+ if (Json.Data.parSets == null) Json.Data.parSets = new ObservableCollection();
+ if (Json.Data.parSets.Count < 6)
+ {
+ Json.Data.parSets.Clear();
+ for (int i = 0; i < 6; i++)
+ {
+ Json.Data.parSets.Add(new ParSet()
+ {
+ CheckBoxContext = $"煮面口{i + 1}屏蔽",
+ Minute = 1,
+ Second = 0,
+ IsShield = false,
+ TextBlockContext = $"煮面口{i + 1}时间设定"
+ });
+ }
+ }
+
+ ActionManage.GetInstance.Register(new Action((o) =>
+ {
+ if (o.Length > 0)
+ {
+ Random rd = new Random();
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ int NoodleLoc = (int)o[0] == 0 ? rd.Next(1, 6) : (int)o[0];
+ int BowlLoc = (int)o[1] == 0 ? rd.Next(10, 12) : (int)o[1];
+
+ string guid = new Guid().ToString();
+
+ mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid });
+ MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】");
+
+ mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid });
+ MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】");
+ Thread.Sleep(60000);
+ }), "ForOrder");
+ }
+ }), "EnableForOrder");
+
+ ActionManage.GetInstance.Register(new Action((o) =>
+ {
+ if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
+ }), "WriteVW");
+ ActionManage.GetInstance.Register(new Action((o) =>
+ {
+ if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
+ }), "WriteBools");
+ ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice");
+ }
+
+ public override void ResetProgram()
+ {
+ mORKS = null;
+ mORKS = new GVL_MorkSUpgradedVer();
+ }
+
+ public override void Stop()
+ {
+
+ }
+
+ private void ServerInit()
+ {
+ //物料信息
+ EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
+ {
+ if (@event == null) return;
+ if (@event is MaterialDeliveryEvent material)
+ {
+ orderMaterialDelivery = material.orderMaterialDelivery;
+ }
+ });
+
+ //配方数据信息
+ EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
+ {
+ if (@event == null) return;
+ if (@event is RecipeBomEvent recipe)
+ {
+ recipeBoms = recipe.recipeBoms;
+ }
+ });
+
+
+ }
+
+ private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
+ {
+ var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
+ string goodName = string.Empty;
+ string SortNum = string.Empty;
+ if (res != null)
+ {
+ goodName = res.MorkOrder.GoodsName;
+ SortNum = res.MorkOrder.SortNum.ToString();
+ }
+
+ EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
+
+ var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum);
+ if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count)
+ {
+ if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK)
+ {
+ DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index);
+ DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel()
+ {
+ Status = oRDER_STATUS,
+ GoodName = goodName,
+ SortNum = SortNum,
+ StopTime = DateTime.Now.ToString("HH:mm:ss")
+ });
+ }
+ else if (oRDER_STATUS == ORDER_STATUS.COMPLETED_TAKE)
+ {
+ var temp = DataServer.GetInstance.morkS.MakeOrderOver.FirstOrDefault(p => p.SortNum == SortNum);
+ if (temp != null) DataServer.GetInstance.morkS.MakeOrderOver.Remove(temp);
+ }
+ else
+ {
+ DataServer.GetInstance.morkS.MakeOrder.ElementAt(index).Status = oRDER_STATUS;
+ }
+ }
+ else
+ {
+ DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel()
+ {
+ Status = oRDER_STATUS,
+ GoodName = goodName,
+ SortNum = SortNum,
+ StartTime = DateTime.Now.ToString("HH:mm:ss")
+ });
+ }
+ }
+
+ private void GetStatus(string key, Action action)
+ {
+ if (peripheralStatus.ContainsKey(key))
+ {
+ if (peripheralStatus[key] != null)
+ {
+ action?.Invoke(peripheralStatus[key]);
+ }
+ }
+ }
+
+ public override void ReadData()
+ {
+ DataServer.GetInstance.morkS.Alarm.Clear();
+ alarms.ForEach(item =>
+ {
+ DataServer.GetInstance.morkS.Alarm.Add(new AlarmModel()
+ {
+ AlarmTime = $"{item.Date} {item.Time}",
+ AlarmMs = item.Info
+ });
+ });
+
+ GetStatus("M0.1", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7)
+ {
+ mORKS.InitComplete = bools[0];
+ mORKS.MoveScrewRodInitCom = bools[1];
+ mORKS.SacrificialVesselInitCom = bools[2];
+ mORKS.CylinderInitCom = bools[3];
+ mORKS.NoodleCookerInitCom = bools[4];
+ mORKS.RobotInitCom = bools[5];
+ mORKS.SiloInitCom = bools[6];
+
+ alarm.DeviceNoInit = mORKS.InitComplete;
+ alarm.MoveScrewRodNoInit = mORKS.MoveScrewRodInitCom;
+ alarm.SacrificialVesselNoInit = mORKS.SacrificialVesselInitCom;
+ alarm.CylinderNoInit = mORKS.CylinderInitCom;
+ alarm.NoodleCookerNoInit = mORKS.NoodleCookerInitCom;
+ alarm.RobotNoInit = mORKS.RobotInitCom;
+ alarm.SiloNoInit = mORKS.SiloInitCom;
+ }
+ }));
+
+ GetStatus("M10.0", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 2)
+ {
+ mORKS.AllowInvertedFace = bools[0];
+ mORKS.DiningComplete = bools[1];
+ }
+ }));
+
+ GetStatus("M10.4", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1)
+ {
+ mORKS.DropBowlMechanismStatus = bools[0];
+ }
+ }));
+
+ GetStatus("M12.2", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1)
+ {
+ mORKS.FixedFlag = bools[0];
+ }
+ }));
+
+ GetStatus("M13.5", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1)
+ {
+ mORKS.SiloInPlace = bools[0];
+ }
+ }));
+
+ GetStatus("M16.7", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1)
+ {
+ mORKS.RobotTakeNoodleCom = bools[0];
+ }
+ }));
+
+ GetStatus("M17.4", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1)
+ {
+ mORKS.RobotStatus = bools[0];
+ }
+ }));
+
+ GetStatus("M18.0", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 5)
+ {
+ mORKS.SmallBowlYesOrNoCheck = bools[0];
+ mORKS.LargeBowYesOrNoCheck = bools[1];
+ mORKS.TurntableLowPosition = bools[2];
+ mORKS.TurntableHighPosition = bools[3];
+ alarm.Supply2_LossBowl = !mORKS.SmallBowlYesOrNoCheck;
+ alarm.Supply1_LossBowl = !mORKS.LargeBowYesOrNoCheck;
+ }
+ }));
+
+ GetStatus("VW17", new Action((obj) =>
+ {
+ if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1)
+ {
+ mORKS.CookNoodleCom[0] = ushorts[0].GetBitValue(1);
+ mORKS.CookNoodleCom[1] = ushorts[0].GetBitValue(2);
+ mORKS.CookNoodleCom[2] = ushorts[0].GetBitValue(3);
+ mORKS.CookNoodleCom[3] = ushorts[0].GetBitValue(4);
+ mORKS.CookNoodleCom[4] = ushorts[0].GetBitValue(5);
+ mORKS.CookNoodleCom[5] = ushorts[0].GetBitValue(6);
+ mORKS.Heating = ushorts[0].GetBitValue(15);
+ mORKS.TemperatureReaches = ushorts[0].GetBitValue(16);
+
+ alarm.MachineLowTemperature = !mORKS.TemperatureReaches;
+ }
+
+ }));
+
+ GetStatus("VW770", new Action((obj) =>
+ {
+ if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1)
+ {
+ mORKS.CurrentFeedbackLoc = ushorts[0];
+ }
+
+ }));
+ }
+
+ ///
+ /// 数据解析
+ ///
+ private void DataParse()
+ {
+ EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
+ {
+ if (@event == null) return;
+ if (@event is DoOrderEvent order)
+ {
+ mORKS.doOrderEvents.Add(order);
+ if (order.MorkOrder.GoodBatchings == null) return;
+ if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return;
+ OrderCount++;
+ if (DateTime.Now.Subtract(Json.Data.StatisticsTime).Days != 0)
+ Json.Data.Count = 0;
+ Json.Data.StatisticsTime = DateTime.Now;
+ Json.Data.Count++;
+ Json.Save();
+ OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
+ DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}");
+ mORKS.HistorySuborderId.Add(order.MorkOrder.SuborderId);
+ foreach (var item in order.MorkOrder.GoodBatchings)
+ {
+ var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
+ if (res != null)
+ {
+ if (ushort.TryParse(res.BatchingLoc, out ushort loc))
+ {
+ if (loc >= 1 && loc <= 5)
+ {
+ if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
+ mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { GoodName = order.MorkOrder.GoodsName, Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId });
+ }
+ else if (loc >= 10 && loc <= 11)
+ {
+ int index = 0;
+ if (recipeBoms != null)
+ {
+ index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId);
+ index++;
+ }
+ if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
+ mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
+ {
+ BatchingId = res.BatchingId,
+ GoodName = order.MorkOrder.GoodsName,
+ Loc = ushort.Parse(res.BatchingLoc),
+ SuborderId = order.MorkOrder.SuborderId,
+ RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0
+ });
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+
+ public override void MainTask()
+ {
+ mORKS.AllowRun = mORKS.InitComplete;
+ if (Json.Data.IsVerify)
+ IsHealth = mORKS.InitComplete;
+ else
+ IsHealth = true;
+
+ TakeBowlTask();
+
+ TakeNoodleTask();
+
+ OutNoodleTask();
+
+ SingleDetect();
+
+ TurntableControl();
+ }
+
+ private void BowlControl(OrderLocInfo orderLocInfo)
+ {
+ if (orderLocInfo.Loc >= 10 && orderLocInfo.Loc <= 11)
+ {
+ mORKS.TakeBowlId = orderLocInfo.SuborderId;
+ mORKS.TakeBowName = orderLocInfo.GoodName;
+ TakeBowlControl(orderLocInfo.Loc);
+ OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
+ DeviceProcessLogShow($"订单【{mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
+ mORKS.TakeBowlInterlock = true;
+ }
+ }
+
+ ///
+ /// 取碗控制
+ ///
+ private void TakeBowlTask()
+ {
+ if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.DropBowlMechanismStatus && !mORKS.TakeBowlInterlock)
+ {
+ DeviceProcessLogShow("开始取碗流程");
+ ushort BowLoc = 0;
+ var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList();
+ if (res == null || res?.Count == 0)
+ {
+ if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) BowlControl(orderLocInfo);
+ }
+ else
+ {
+ foreach (var item in res)
+ {
+ if (ushort.TryParse(item.BatchingLoc, out ushort loc))
+ {
+ if (loc == 10 && !mORKS.SmallBowlYesOrNoCheck)
+ {
+ BowLoc = loc;
+ break;
+ }
+ else if (loc == 11 && !mORKS.LargeBowYesOrNoCheck)
+ {
+ BowLoc = loc;
+ break;
+ }
+ }
+ }
+
+ if (BowLoc >= 10 && BowLoc <= 11)
+ {
+ if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo))
+ {
+ orderLocInfo.Loc = BowLoc;
+ BowlControl(orderLocInfo);
+ }
+ }
+ }
+ }
+ }
+
+ ///
+ /// 转台控制
+ ///
+ private void TurntableControl()
+ {
+ if (Global.EnableLocalSimOrder)
+ {
+ //不做轮询,直接取面,模拟订单使用
+ if (mORKS.SiloInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
+ {
+ if (mORKS.TurntableLowPosition)
+ {
+ TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc);
+ mORKS.TurntableLocLists.Clear();
+ mORKS.AllowTakeNoodle = true;
+ DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面");
+ }
+ }
+ }
+ else
+ {
+ //正常轮询
+ if (mORKS.SiloInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
+ {
+ var result = orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList();
+ if (result != null)
+ {
+ var res = result.FirstOrDefault(P => P.BatchingLoc == mORKS.CurrentFeedbackLoc.ToString());
+ if (mORKS.TurntableLowPosition && res != null)
+ {
+ TurntableStart(mORKS.CurrentFeedbackLoc);
+ mORKS.TurntableLocLists.Clear();
+ mORKS.AllowTakeNoodle = true;
+ DeviceProcessLogShow($"控制机器人去转台【{mORKS.CurrentFeedbackLoc}】号位置取面");
+ }
+ else
+ {
+ if (!mORKS.TurntableInterlock)
+ {
+ foreach (var item in result)
+ {
+ if (ushort.TryParse(item.BatchingLoc, out ushort loc))
+ {
+ if (mORKS.CurrentFeedbackLoc != loc && !mORKS.TurntableLocLists.Contains(loc))
+ {
+ if (!mORKS.TurntableLowPosition)
+ {
+ //WriteData("M32.7", false);
+ DeviceProcessLogShow($"执行了转台启动互锁信号复位");
+ }
+ TurntableStart(loc);
+ DeviceProcessLogShow($"没有物料检测的启动转台控制,转台位置:[{loc}]");
+ break;
+ }
+ else if (mORKS.CurrentFeedbackLoc == loc && !mORKS.TurntableLocLists.Contains(loc)) mORKS.TurntableLocLists.Add(loc);
+ }
+ }
+ }
+ }
+ }
+ else DeviceProcessLogShow("未找到可用的物料信息");
+ }
+ }
+
+ //补料中检测
+ if (RTrig.GetInstance("mORKS.Feeding").Start(mORKS.Feeding))
+ {
+ mORKS.AllowTakeNoodle = false;
+ mORKS.TakeNoodleInterlock = false;
+ }
+
+ //转台到位检测
+ if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.SiloInPlace && mORKS.CurrentLoc == mORKS.CurrentFeedbackLoc))
+ {
+ mORKS.CurrentLoc = 0;
+ mORKS.TurntableInterlock = false;
+ DeviceProcessLogShow("转台到位检测");
+ }
+
+ //补料完成检测
+ if (RTrig.GetInstance("FeedComplete").Start(mORKS.FeedComplete))
+ {
+ if (!mORKS.AllowTakeNoodle && mORKS.TurntableLocLists.Count > 0)
+ {
+ mORKS.TurntableLocLists.Clear();
+ mORKS.TurntableInterlock = false;
+ DeviceProcessLogShow("补料完成检测");
+ }
+ }
+
+ }
+
+ ///
+ /// 取面任务
+ ///
+ private void TakeNoodleTask()
+ {
+ //取面控制
+ if (mORKS.AllowRun && mORKS.RobotStatus && !mORKS.Feeding && !mORKS.RobotTaskInterlock && mORKS.AllowTakeNoodle && mORKS.SiloInPlace && !mORKS.TakeNoodleInterlock && mORKS.RBTakeNoodleTask.Count > 0)
+ {
+ int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置
+ if (loc >= 0 && loc <= 5)
+ {
+ if (!Json.Data.parSets.ElementAt(loc).IsShield)//检查该煮面篮是否被屏蔽
+ {
+ if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo))
+ {
+ mORKS.CookNodelId[loc] = orderLocInfo.SuborderId;
+ mORKS.NoodleCookerStatus[loc] = true;
+ SetFallNoodleLoc((ushort)(loc + 1));
+ //机器人开始取面
+ OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);
+ DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏");
+ //写入煮面时间
+ List values = new List();
+ values.Add(Json.Data.parSets.ElementAt(loc).Minute);
+ values.Add(Json.Data.parSets.ElementAt(loc).Second);
+ WriteData($"VW{320 + (loc * 4)}", values.ToArray());
+ mORKS.TakeNoodleInterlock = true;
+ }
+ }
+ }
+ }
+ }
+
+ ///
+ /// 出餐控制
+ ///
+ private void OutNoodleTask()
+ {
+ if (mORKS.AllowInvertedFace && mORKS.RobotTaskInterlock && !mORKS.TakeNoodleInterlock && mORKS.RobotStatus)
+ {
+ int loc = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0);
+ if (loc >= 0 && loc <= 5)
+ {
+ if (mORKS.CookNoodleCom[loc])
+ {
+ SetTakeNoodleLoc((ushort)(loc + 1));
+ mORKS.NoodleCookerStatus[loc] = false;
+ WriteData($"VW260", 0);//设置出汤时间
+ OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK);
+ DeviceProcessLogShow($"订单【{mORKS.OutMealId}】制作完成");
+ mORKS.CookCompleteFlatBit = true;
+ mORKS.OutMealId = mORKS.IngredientsCompleteId;
+ mORKS.OutMealName = mORKS.IngredientsCompleteName;
+ mORKS.IngredientsCompleteId = string.Empty;
+ mORKS.CookNodelId[loc] = string.Empty;
+ DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKS.OutMealId}");
+ }
+ }
+ }
+ }
+
+ ///
+ /// 信号检测
+ ///
+ private void SingleDetect()
+ {
+ //允许倒面信号检测
+ if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowInvertedFace))
+ {
+ mORKS.IngredientsCompleteId = mORKS.TakeBowlId;
+ mORKS.IngredientsCompleteName = mORKS.TakeBowName;
+ mORKS.TakeBowlId = string.Empty;
+ mORKS.TakeBowName = string.Empty;
+ DeviceProcessLogShow($"碗到位,允许到面,{mORKS.IngredientsCompleteId}");
+ mORKS.TakeBowlInterlock = false;
+ }
+
+ //取餐完成逻辑处理
+ if (Delay.GetInstance("CompleteChange1").Start(!mORKS.DiningComplete, 1) && mORKS.CookCompleteFlatBit == true)
+ {
+ OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
+ DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
+ mORKS.CookCompleteFlatBit = false;
+ mORKS.OutMealId = string.Empty;
+ mORKS.OutMealName = string.Empty;
+ }
+
+ //机器人取面完成信号检测
+ if (RTrig.GetInstance("TakeNoodleComplete").Start(mORKS.RobotTakeNoodleCom))
+ {
+ mORKS.TakeNoodleInterlock = false;
+ mORKS.AllowTakeNoodle = false;
+ mORKS.TurntableInterlock = false;
+ DeviceProcessLogShow("机器人取面完成信号检测");
+ }
+
+ int OutMealRequstCount = mORKS.CookNoodleCom.Where(p => p == true).ToList().Count;
+ int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count;
+ int index = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId);
+
+ bool isok = index >= 0 && index < mORKS.CookNoodleCom.Length && mORKS.CookNoodleCom[index];
+
+ mORKS.PriorityJudgment = Delay.GetInstance("取餐优先级判断").Start(mORKS.TurntableLocLists.Count > 0 && !mORKS.TurntableLowPosition, 4);
+ //mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowInvertedFace && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment);
+ mORKS.RobotTaskInterlock = isok && mORKS.AllowInvertedFace && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment);
+
+
+ }
+ ///
+ /// 语音提醒取餐
+ ///
+ ///
+ private void WaitMeaLSpeak(string meal)
+ {
+ //VoiceAPI.m_SystemPlayWav(@"Vioce\电子提示音.wav");
+ //Thread.Sleep(1000);
+ //if (meal != null) mORKS.speech.Speak(meal);
+ //VoiceAPI.m_SystemPlayWav(@"Vioce\取餐通知.wav");
+ }
+
+ #region PLC 控制函数
+
+ private void WriteData(string address, object value)
+ {
+ EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value });
+ }
+
+ ///
+ /// 设备初始化
+ ///
+ public async void DeviceInit()
+ {
+ WriteData("M0.0", true);
+ await Task.Delay(1000);
+ WriteData("M0.0", false);
+ }
+
+ ///
+ /// 取碗控制
+ ///
+ ///
+ private void TakeBowlControl(ushort loc)
+ {
+ if (loc == 10)//一次性碗
+ {
+ WriteData("M9.1", true);
+ }
+ else if (loc == 11)//大碗
+ {
+ WriteData("M9.0", true);
+ }
+ }
+
+ ///
+ /// 启动转台
+ ///
+ ///
+ private void TurntableStart(ushort loc)
+ {
+ if (loc >= 1 && loc <= 5)
+ {
+ mORKS.CurrentLoc = loc;
+ mORKS.TurntableInterlock = true;
+ mORKS.TurntableLocLists.Add(loc);
+ WriteData($"M13.{loc - 1}", true);
+ }
+ }
+
+ ///
+ /// 设置倒面位置
+ ///
+ ///
+ private void SetFallNoodleLoc(ushort loc)
+ {
+ if (loc >= 1 && loc <= 6)
+ WriteData($"M14.{loc - 1}", true);
+ }
+
+ ///
+ /// 设置取面位置
+ ///
+ ///
+ private void SetTakeNoodleLoc(ushort loc)
+ {
+ if (loc >= 1 && loc <= 6)
+ WriteData($"M16.{loc - 1}", true);
+ }
+
+
+
+ public override void SimOrder()
+ {
+ EventBus.EventBus.GetInstance().Subscribe(0, delegate (IEvent @event, EventCallBackHandle callBackHandle)
+ {
+ if (@event != null && @event is MorksSimorderModel msm)
+ {
+ string guid = Guid.NewGuid().ToString();
+ if (msm.NoodleLoc >= 1 && msm.NoodleLoc <= 5)
+ {
+ mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.NoodleLoc, SuborderId = guid });
+ MessageLog.GetInstance.Show($"添加订单:面条位置【{(ushort)msm.NoodleLoc}】");
+ }
+
+ if (msm.Bowloc >= 10 && msm.Bowloc <= 11)
+ {
+ mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid });
+ MessageLog.GetInstance.Show($"添加订单:碗位置【{(ushort)msm.Bowloc}】");
+ }
+
+ }
+ });
+ }
+ #endregion
+
+
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/DataServer.cs b/BPASmartClient.MorkSUpgradedVer/DataServer.cs
new file mode 100644
index 00000000..2e8a97a7
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/DataServer.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using BPASmartClient.MQTT;
+using BPA.Message;
+using BPASmartClient.Model;
+
+namespace BPASmartClient.MorkSUpgradedVer
+{
+ public class DataServer
+ {
+
+ private volatile static DataServer _Instance;
+ public static DataServer GetInstance => _Instance ?? (_Instance = new DataServer());
+ private DataServer() { }
+
+ public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS();
+
+ MQTTProxy mQTTProxy = new MQTTProxy();
+ public void Init()
+ {
+ mQTTProxy.Connected = new Action(() =>
+ {
+ mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ morkS.MorkS_OrderCount = Json.Data.Count;
+ SendScreenDataModel sendScreenDataModel = new SendScreenDataModel();
+ sendScreenDataModel.Name = ScreenDeviceType.煮面机;
+ sendScreenDataModel.Value = morkS.ToJSON();
+ mQTTProxy.Publish(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机), sendScreenDataModel.ToJSON());
+ Thread.Sleep(100);
+ }), "海科食堂大屏监听");
+ });
+ mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
+ }
+
+ //订单信息(正在制作,等待制作,制作完成)
+ //煮面炉上下状态(6个煮面炉上或下)
+ //温度状态(煮面炉温度是否到达)
+ //料仓位置(当前料仓在几号位置)
+ //料仓上下物料检测
+ //落碗机构缺碗检测
+ //机器人状态
+ //当日订单总量
+ //报警信息
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/DeviceData.cs b/BPASmartClient.MorkSUpgradedVer/DeviceData.cs
new file mode 100644
index 00000000..e2c2888c
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/DeviceData.cs
@@ -0,0 +1,193 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace BPASmartClient.MorkSUpgradedVer
+{
+ public class DeviceData : IStatus
+ {
+ ///
+ /// 初始化启动
+ ///
+ [VariableMonitor("初始化启动", "M0.0", "320")]
+ public bool InitStart { get; set; }
+
+ ///
+ /// 初始化完成
+ ///
+ [VariableMonitor("初始化完成", "M0.1", "321")]
+ public bool InitComplete { get; set; }
+
+ ///
+ /// 移碗丝杆初始化完成
+ ///
+ [VariableMonitor("移碗丝杆初始化完成", "M0.2", "322")]
+ public bool MoveScrewRodInitCom { get; set; }
+
+ ///
+ /// 供碗1初始化完成
+ ///
+ [VariableMonitor("供碗1初始化完成", "M0.3", "323")]
+ public bool SacrificialVesselInitCom { get; set; }
+
+ ///
+ /// 气缸推杆初始化完成
+ ///
+ [VariableMonitor("气缸推杆初始化完成", "M0.4", "324")]
+ public bool CylinderInitCom { get; set; }
+
+ ///
+ /// 煮面机初始化完成
+ ///
+ [VariableMonitor("煮面机初始化完成", "M0.5", "325")]
+ public bool NoodleCookerInitCom { get; set; }
+
+ ///
+ /// 机器人初始化完成
+ ///
+ [VariableMonitor("机器人初始化完成", "M0.6", "326")]
+ public bool RobotInitCom { get; set; }
+
+ ///
+ /// 料仓初始化完成
+ ///
+ [VariableMonitor("料仓初始化完成", "M0.7", "327")]
+ public bool SiloInitCom { get; set; }
+
+ ///
+ /// 故障复位/停止
+ ///
+ [VariableMonitor("故障复位/停止", "M1.0", "328")]
+ public bool FaultResetOrStop { get; set; }
+
+ ///
+ /// 落碗1,大碗
+ ///
+ [VariableMonitor("落碗1,大碗", "M9.0", "392")]
+ public bool DropBowlOne { get; set; }
+
+ ///
+ /// 落碗2,一次性碗
+ ///
+ [VariableMonitor("落碗2,一次性碗", "M9.1", "393")]
+ public bool DropBowlTow { get; set; }
+
+ ///
+ /// 允许倒面
+ ///
+ [VariableMonitor("允许倒面", "M10.0", "400")]
+ public bool AllowInvertedFace { get; set; }
+
+ ///
+ /// 出餐完成
+ ///
+ [VariableMonitor("出餐完成", "M10.1", "401")]
+ public bool DiningComplete { get; set; }
+
+ ///
+ /// 落碗机构状态,1:忙碌 0:空闲
+ ///
+ [VariableMonitor("落碗机构状态,1:忙碌 0:空闲", "M10.4", "404")]
+ public bool DropBowlMechanismStatus { get; set; }
+
+ ///
+ /// 定位标志,1:忙碌 0:空闲
+ ///
+ [VariableMonitor("定位标志,1:忙碌 0:空闲", "M12.2", "418")]
+ public bool FixedFlag { get; set; }
+
+ ///
+ /// 定位启动
+ ///
+ [VariableMonitor("定位启动", "M12.3", "419")]
+ public bool FixedStart { get; set; }
+
+ ///
+ /// 料仓到位
+ ///
+ [VariableMonitor("料仓到位", "M13.5", "429")]
+ public bool SiloInPlace { get; set; }
+
+ ///
+ /// 机器人料仓取面完成
+ ///
+ [VariableMonitor("机器人去料仓取面完成", "M16.7", "455")]
+ public bool RobotTakeNoodleCom { get; set; }
+
+ ///
+ /// 机器人状态
+ ///
+ [VariableMonitor("机器人状态", "M17.4", "460")]
+ public bool RobotStatus { get; set; }
+
+ ///
+ /// 一次性碗有无检测
+ ///
+ [VariableMonitor("一次性碗有无检测", "M18.0", "464")]
+ public bool SmallBowlYesOrNoCheck { get; set; }
+
+ ///
+ /// 大碗有无检测
+ ///
+ [VariableMonitor("大碗有无检测", "M18.1", "465")]
+ public bool LargeBowYesOrNoCheck { get; set; }
+
+ ///
+ /// 转台高位
+ ///
+ [VariableMonitor("转台高位", "M18.2", "466")]
+ public bool TurntableHighPosition { get; set; }
+
+ ///
+ /// 转台低位
+ ///
+ [VariableMonitor("转台低位", "M18.3", "467")]
+ public bool TurntableLowPosition { get; set; }
+
+ ///
+ /// 煮面完成
+ ///
+ [VariableMonitor("煮面完成", "V17.0")]
+ public bool[] CookNoodleCom { get; set; } = new bool[6];
+
+ ///
+ /// 本地/远程
+ ///
+ [VariableMonitor("本地/远程", "V18.0")]
+ public bool LocalOrRemote { get; set; }
+
+ ///
+ /// 温度到达
+ ///
+ [VariableMonitor("温度到达", "V18.7")]
+ public bool TemperatureReaches { get; set; }
+
+ ///
+ /// 加热中
+ ///
+ [VariableMonitor("加热中", "V18.6")]
+ public bool Heating { get; set; }
+
+ ///
+ /// 转台当前位置
+ ///
+ [VariableMonitor("转台当前位置", "VW770")]
+ public ushort CurrentLoc { get; set; }
+
+ ///
+ /// 补料完成
+ ///
+ [VariableMonitor("补料完成", "M101.6", "1134")]
+ public bool FeedComplete { get; set; }
+
+ ///
+ /// 补料中
+ ///
+ [VariableMonitor("补料中", "M102.6", "1142")]
+ public bool Feeding { get; set; }
+
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs b/BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs
new file mode 100644
index 00000000..0957bda6
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs
@@ -0,0 +1,322 @@
+using BPASmartClient.Device;
+using BPASmartClient.Model;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkSUpgradedVer
+{
+ public class GVL_MorkSUpgradedVer : IStatus
+ {
+ #region 临时变量
+ ///
+ /// 允许运行
+ ///
+ [VariableMonitor("允许运行")]
+ public bool AllowRun { get; set; }
+
+ ///
+ /// 优先级判断
+ ///
+ [VariableMonitor("优先级判断条件")]
+ public bool PriorityJudgment { get; set; }
+
+ ///
+ /// 机器人任务互锁信号,false:取面,true:出餐
+ ///
+ [VariableMonitor("机器人任务互锁信号")]
+ public bool RobotTaskInterlock { get; set; }
+
+ ///
+ /// 取碗互锁信号
+ ///
+ [VariableMonitor("取碗互锁信号")]
+ public bool TakeBowlInterlock { get; set; }
+
+ ///
+ /// 取面互锁信号
+ ///
+ [VariableMonitor("取面互锁信号")]
+ public bool TakeNoodleInterlock { get; set; }
+
+ ///
+ /// 出面中
+ ///
+ [VariableMonitor("出面中")]
+ public bool OutNoodleing { get; set; }
+
+ ///
+ /// 允许取面
+ ///
+ [VariableMonitor("允许取面")]
+ public bool AllowTakeNoodle { get; set; }
+
+ ///
+ /// 转台互锁信号
+ ///
+ [VariableMonitor("转台互锁信号")]
+ public bool TurntableInterlock { get; set; }
+
+
+ ///
+ /// 煮面炉状态,True:忙碌,false:空闲
+ ///
+ [VariableMonitor("煮面炉状态")]
+ public bool[] NoodleCookerStatus { get; set; } = new bool[6];
+
+ ///
+ /// 转台当前启动位置
+ ///
+ [VariableMonitor("转台当前启动位置")]
+ public ushort CurrentLoc { get; set; } = 0;
+
+ ///
+ /// 制作完成标志
+ ///
+ [VariableMonitor("制作完成标志")]
+ public bool CookCompleteFlatBit { get; set; }
+ #endregion
+
+ #region 列表数据
+ ///
+ /// 机器人取面位置队列
+ ///
+ public ConcurrentQueue RBTakeNoodleTask { get; set; } = new ConcurrentQueue();
+
+ ///
+ /// 出碗队列
+ ///
+ public ConcurrentQueue TakeBowlTask { get; set; } = new ConcurrentQueue();
+
+
+ public List doOrderEvents { get; set; } = new List();
+
+ public List HistorySuborderId { get; set; } = new List();
+ #endregion
+
+ #region 订单ID记录
+ ///
+ /// 取碗订单ID
+ ///
+ public string TakeBowlId { get; set; } = string.Empty;
+ ///
+ /// 取碗订单名称
+ ///
+ public string TakeBowName { get; set; } = string.Empty;
+
+ ///
+ /// 配料完成订单ID
+ ///
+ public string IngredientsCompleteId { get; set; } = string.Empty;
+ ///
+ /// 配料完成订单名称
+ ///
+ public string IngredientsCompleteName { get; set; } = string.Empty;
+
+ ///
+ /// 煮面口对应的订单ID
+ ///
+ public string[] CookNodelId { get; set; } = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, };
+
+ ///
+ /// 出餐订单ID
+ ///
+ public string OutMealId { get; set; } = string.Empty;
+ ///
+ /// 出餐订单名称
+ ///
+ public string OutMealName { get; set; } = string.Empty;
+
+ ///
+ /// 转台位置轮询
+ ///
+ public List TurntableLocLists { get; set; } = new List();
+
+ #endregion
+
+ #region device Data
+ ///
+ /// 初始化启动
+ ///
+ [VariableMonitor("初始化启动", "M0.0", "320")]
+ public bool InitStart { get; set; }
+
+ ///
+ /// 初始化完成
+ ///
+ [VariableMonitor("初始化完成", "M0.1", "321")]
+ public bool InitComplete { get; set; }
+
+ ///
+ /// 移碗丝杆初始化完成
+ ///
+ [VariableMonitor("移碗丝杆初始化完成", "M0.2", "322")]
+ public bool MoveScrewRodInitCom { get; set; }
+
+ ///
+ /// 供碗1初始化完成
+ ///
+ [VariableMonitor("供碗1初始化完成", "M0.3", "323")]
+ public bool SacrificialVesselInitCom { get; set; }
+
+ ///
+ /// 气缸推杆初始化完成
+ ///
+ [VariableMonitor("气缸推杆初始化完成", "M0.4", "324")]
+ public bool CylinderInitCom { get; set; }
+
+ ///
+ /// 煮面机初始化完成
+ ///
+ [VariableMonitor("煮面机初始化完成", "M0.5", "325")]
+ public bool NoodleCookerInitCom { get; set; }
+
+ ///
+ /// 机器人初始化完成
+ ///
+ [VariableMonitor("机器人初始化完成", "M0.6", "326")]
+ public bool RobotInitCom { get; set; }
+
+ ///
+ /// 料仓初始化完成
+ ///
+ [VariableMonitor("料仓初始化完成", "M0.7", "327")]
+ public bool SiloInitCom { get; set; }
+
+ ///
+ /// 故障复位/停止
+ ///
+ [VariableMonitor("故障复位/停止", "M1.0", "328")]
+ public bool FaultResetOrStop { get; set; }
+
+ ///
+ /// 落碗1,大碗
+ ///
+ [VariableMonitor("落碗1,大碗", "M9.0", "392")]
+ public bool DropBowlOne { get; set; }
+
+ ///
+ /// 落碗2,一次性碗
+ ///
+ [VariableMonitor("落碗2,一次性碗", "M9.1", "393")]
+ public bool DropBowlTow { get; set; }
+
+ ///
+ /// 允许倒面
+ ///
+ [VariableMonitor("允许倒面", "M10.0", "400")]
+ public bool AllowInvertedFace { get; set; }
+
+ ///
+ /// 出餐完成
+ ///
+ [VariableMonitor("出餐完成", "M10.1", "401")]
+ public bool DiningComplete { get; set; }
+
+ ///
+ /// 落碗机构状态,1:忙碌 0:空闲
+ ///
+ [VariableMonitor("落碗机构状态,1:忙碌 0:空闲", "M10.4", "404")]
+ public bool DropBowlMechanismStatus { get; set; }
+
+ ///
+ /// 定位标志,1:忙碌 0:空闲
+ ///
+ [VariableMonitor("定位标志,1:忙碌 0:空闲", "M12.2", "418")]
+ public bool FixedFlag { get; set; }
+
+ ///
+ /// 定位启动
+ ///
+ [VariableMonitor("定位启动", "M12.3", "419")]
+ public bool FixedStart { get; set; }
+
+ ///
+ /// 料仓到位
+ ///
+ [VariableMonitor("料仓到位", "M13.5", "429")]
+ public bool SiloInPlace { get; set; }
+
+ ///
+ /// 机器人料仓取面完成
+ ///
+ [VariableMonitor("机器人去料仓取面完成", "M16.7", "455")]
+ public bool RobotTakeNoodleCom { get; set; }
+
+ ///
+ /// 机器人状态
+ ///
+ [VariableMonitor("机器人状态", "M17.4", "460")]
+ public bool RobotStatus { get; set; }
+
+ ///
+ /// 一次性碗有无检测
+ ///
+ [VariableMonitor("一次性碗有无检测", "M18.0", "464")]
+ public bool SmallBowlYesOrNoCheck { get; set; }
+
+ ///
+ /// 大碗有无检测
+ ///
+ [VariableMonitor("大碗有无检测", "M18.1", "465")]
+ public bool LargeBowYesOrNoCheck { get; set; }
+
+ ///
+ /// 转台高位
+ ///
+ [VariableMonitor("转台高位", "M18.2", "466")]
+ public bool TurntableHighPosition { get; set; }
+
+ ///
+ /// 转台低位
+ ///
+ [VariableMonitor("转台低位", "M18.3", "467")]
+ public bool TurntableLowPosition { get; set; }
+
+ ///
+ /// 煮面完成
+ ///
+ [VariableMonitor("煮面完成")]
+ public bool[] CookNoodleCom { get; set; } = new bool[6];
+
+ ///
+ /// 本地/远程
+ ///
+ [VariableMonitor("本地/远程")]
+ public bool LocalOrRemote { get; set; }
+
+ ///
+ /// 温度到达
+ ///
+ [VariableMonitor("温度到达")]
+ public bool TemperatureReaches { get; set; }
+
+ ///
+ /// 加热中
+ ///
+ [VariableMonitor("加热中")]
+ public bool Heating { get; set; }
+
+ ///
+ /// 转台当前位置
+ ///
+ [VariableMonitor("转台当前位置", "VW770", "870")]
+ public ushort CurrentFeedbackLoc { get; set; }
+
+ ///
+ /// 补料完成
+ ///
+ [VariableMonitor("补料完成", "M101.6", "1134")]
+ public bool FeedComplete { get; set; }
+
+ ///
+ /// 补料中
+ ///
+ [VariableMonitor("补料中", "M102.6", "1142")]
+ public bool Feeding { get; set; }
+ #endregion
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/GlobalUsing.cs b/BPASmartClient.MorkSUpgradedVer/GlobalUsing.cs
new file mode 100644
index 00000000..bb45abd5
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/GlobalUsing.cs
@@ -0,0 +1,26 @@
+global using System;
+global using System.Collections.Generic;
+global using BPA.Message.Enum;
+global using BPASmartClient.Device;
+global using BPASmartClient.EventBus;
+global using BPASmartClient.Model;
+global using BPASmartClient.Peripheral;
+global using static BPASmartClient.EventBus.EventBus;
+global using BPASmartClient.Helper;
+global using System.Threading;
+global using BPASmartClient.Message;
+global using BPA.Message;
+global using System.Linq;
+global using BPASmartClient.Model.PLC;
+global using System.Threading.Tasks;
+global using System.Reflection;
+global using BPASmartClient.MorkSUpgradedVer.Model;
+global using System.Collections.ObjectModel;
+global using BPASmartClient.MorkSUpgradedVer.ViewModel;
+global using BPASmartClient.Business;
+global using BPASmartClient.Model.小炒机;
+global using BPA.Models;
+global using System.Windows.Forms;
+global using System.Media;
+
+
diff --git a/BPASmartClient.MorkSUpgradedVer/Model/Global.cs b/BPASmartClient.MorkSUpgradedVer/Model/Global.cs
new file mode 100644
index 00000000..60fcc290
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/Model/Global.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkSUpgradedVer.Model
+{
+ public class Global
+ {
+ public static bool EnableLocalSimOrder { get; set; }
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/Model/MorksPar.cs b/BPASmartClient.MorkSUpgradedVer/Model/MorksPar.cs
new file mode 100644
index 00000000..ef2c0cb5
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/Model/MorksPar.cs
@@ -0,0 +1,16 @@
+using BPASmartClient.Model;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+
+namespace BPASmartClient.MorkSUpgradedVer.Model
+{
+ internal class MorksPar
+ {
+ public ObservableCollection parSets { get; set; } = new ObservableCollection();
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/Model/ParSet.cs b/BPASmartClient.MorkSUpgradedVer/Model/ParSet.cs
new file mode 100644
index 00000000..03261db1
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/Model/ParSet.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.Model
+{
+ public class ParSet
+ {
+ public ushort Minute { get { return _mMinute; } set { _mMinute = value; } }
+ private ushort _mMinute;
+
+ public ushort Second { get { return _mSecond; } set { _mSecond = value; } }
+ private ushort _mSecond;
+
+
+ public bool IsShield { get { return _mIsShield; } set { _mIsShield = value; } }
+ private bool _mIsShield;
+
+
+ public string TextBlockContext { get { return _mTextBlockContext; } set { _mTextBlockContext = value; } }
+ private string _mTextBlockContext;
+
+ public string CheckBoxContext { get { return _mCheckBoxContext; } set { _mCheckBoxContext = value; } }
+ private string _mCheckBoxContext;
+
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/Model/WritePar.cs b/BPASmartClient.MorkSUpgradedVer/Model/WritePar.cs
new file mode 100644
index 00000000..320f399a
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/Model/WritePar.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkSUpgradedVer.Model
+{
+ public class WritePar
+ {
+ public string Address { get; set; }
+ public object Value { get; set; }
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/OrderLocInfo.cs b/BPASmartClient.MorkSUpgradedVer/OrderLocInfo.cs
new file mode 100644
index 00000000..823c6985
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/OrderLocInfo.cs
@@ -0,0 +1,23 @@
+using BPA.Message;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkSUpgradedVer
+{
+ public class OrderLocInfo
+ {
+ public string SuborderId { get; set; }
+ public ushort Loc { get; set; }
+ public ushort RecipeNumber { get; set; }
+ public int BatchingId { get; set; }
+ public string GoodName { get; set; }
+
+ public int RecipeId { get; set; }
+
+ public List Recipes { get; set; }
+
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/View/Debug.xaml b/BPASmartClient.MorkSUpgradedVer/View/Debug.xaml
new file mode 100644
index 00000000..971e808f
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/View/Debug.xaml
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.MorkSUpgradedVer/View/Debug.xaml.cs b/BPASmartClient.MorkSUpgradedVer/View/Debug.xaml.cs
new file mode 100644
index 00000000..1cd819ad
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/View/Debug.xaml.cs
@@ -0,0 +1,30 @@
+using BPASmartClient.MorkSUpgradedVer.Model;
+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.MorkSUpgradedVer.View
+{
+ ///
+ /// Debug.xaml 的交互逻辑
+ ///
+ public partial class Debug : System.Windows.Controls.UserControl
+ {
+ public Debug()
+ {
+ InitializeComponent();
+ }
+
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml b/BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml
new file mode 100644
index 00000000..03b96940
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml
@@ -0,0 +1,242 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml.cs b/BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml.cs
new file mode 100644
index 00000000..85719274
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml.cs
@@ -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.MorkSUpgradedVer.View
+{
+ ///
+ /// Monitor.xaml 的交互逻辑
+ ///
+ public partial class Monitor : System.Windows.Controls.UserControl
+ {
+ public Monitor()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml b/BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml
new file mode 100644
index 00000000..eb833a3a
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml.cs b/BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml.cs
new file mode 100644
index 00000000..c3b5620b
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml.cs
@@ -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.MorkSUpgradedVer.View
+{
+ ///
+ /// ParSet.xaml 的交互逻辑
+ ///
+ public partial class ParSet : System.Windows.Controls.UserControl
+ {
+ public ParSet()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/ViewModel/DebugViewModel.cs b/BPASmartClient.MorkSUpgradedVer/ViewModel/DebugViewModel.cs
new file mode 100644
index 00000000..3316d1d9
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/ViewModel/DebugViewModel.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BPASmartClient.Helper;
+using BPASmartClient.Model;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using BPASmartClient.EventBus;
+using BPASmartClient.MorkSUpgradedVer.Model;
+using System.Windows;
+using BPASmartClient.Message;
+
+namespace BPASmartClient.MorkSUpgradedVer.ViewModel
+{
+ public class DebugViewModel : ObservableObject
+ {
+ public DebugViewModel()
+ {
+ InitCommand = new RelayCommand(() => {
+ ActionManage.GetInstance.Send("InitDevice");
+ ActionManage.GetInstance.Send("初始化设定煮面时间");
+ });
+ SimOrderCommand = new RelayCommand(() =>
+ {
+ new MorksSimorderModel() { Bowloc = this.BowlLoc, NoodleLoc = this.NoodleLoc }.Publish();
+
+ });
+ SimOrderRandomCommand = new RelayCommand(() =>
+ {
+ int NoodPosition = 0;
+ int BowPosion = 0;
+ NoodPosition = IsNoodPositon == true ? 0 : NoodleLoc;
+ BowPosion = IsBowPositon == true ? 0 : BowlLoc;
+ ActionManage.GetInstance.Send("EnableForOrder", new object[] { NoodPosition, BowPosion });
+ });
+ SimOrderRandomCloseCommand = new RelayCommand(() =>
+ {
+ ThreadManage.GetInstance().StopTask("ForOrder");
+ MessageLog.GetInstance.Show("停止模拟随机订单");
+ });
+ EnableLacalSimOrder = new RelayCommand(() =>
+ {
+ Global.EnableLocalSimOrder = LocalSimOrder;
+ VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed;
+ });
+ VisibilitySimOrder = LocalSimOrder == true? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ public RelayCommand InitCommand { get; set; }
+
+ public RelayCommand SimOrderCommand { get; set; }
+
+ public RelayCommand SimOrderRandomCommand { get; set; }
+
+ public RelayCommand SimOrderRandomCloseCommand { get; set; }
+
+ public RelayCommand EnableLacalSimOrder { get; set; }
+ public int NoodleLoc { get { return _mNoodleLoc; } set { _mNoodleLoc = value; OnPropertyChanged(); } }
+ private int _mNoodleLoc = 1;
+
+
+ public int BowlLoc { get { return _mBowlLoc; } set { _mBowlLoc = value; OnPropertyChanged(); } }
+ private int _mBowlLoc = 10;
+
+ public bool IsNoodPositon { get { return _isNoodPositon; } set { _isNoodPositon = value; OnPropertyChanged(); } }
+ private bool _isNoodPositon = false;
+
+ public bool IsBowPositon { get { return _isBowPositon; } set { _isBowPositon = value; OnPropertyChanged(); } }
+ private bool _isBowPositon = false;
+
+ public bool LocalSimOrder { get { return _localSimOrder; } set { _localSimOrder = value; OnPropertyChanged(); } }
+ private bool _localSimOrder = Global.EnableLocalSimOrder;
+
+ public Visibility VisibilitySimOrder { get { return _visibilitySimOrder; } set { _visibilitySimOrder = value; OnPropertyChanged(); } }
+ private Visibility _visibilitySimOrder;
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/ViewModel/MonitorViewModel.cs b/BPASmartClient.MorkSUpgradedVer/ViewModel/MonitorViewModel.cs
new file mode 100644
index 00000000..365ee581
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/ViewModel/MonitorViewModel.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BPASmartClient.Business;
+using BPASmartClient.Device;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System.Collections.ObjectModel;
+
+namespace BPASmartClient.MorkSUpgradedVer.ViewModel
+{
+ public class MonitorViewModel : ObservableObject
+ {
+ public MonitorViewModel()
+ {
+
+ }
+
+ public static int DeviceId { get; set; }
+
+ public ObservableCollection variableMonitors { get; set; } = Plugin.GetInstance()?.GetPlugin()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;
+
+ }
+}
diff --git a/BPASmartClient.MorkSUpgradedVer/ViewModel/ParSetViewModel.cs b/BPASmartClient.MorkSUpgradedVer/ViewModel/ParSetViewModel.cs
new file mode 100644
index 00000000..0aa320c6
--- /dev/null
+++ b/BPASmartClient.MorkSUpgradedVer/ViewModel/ParSetViewModel.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BPASmartClient.Helper;
+using BPASmartClient.Model;
+using BPASmartClient.MorkSUpgradedVer.Model;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+
+namespace BPASmartClient.MorkSUpgradedVer.ViewModel
+{
+ public class ParSetViewModel : ObservableObject
+ {
+ public ParSetViewModel()
+ {
+ SaveInfoCommand = new RelayCommand(SaveSettingData);
+
+ ActionManage.GetInstance.Register(SaveSettingData, "初始化设定煮面时间");
+
+ }
+
+ public RelayCommand SaveInfoCommand { get; set; }
+
+ public ObservableCollection parSets { get; set; } = Json.Data.parSets;
+
+ private void SaveSettingData()
+ {
+ List values = new List();
+ values.Clear();
+
+ List bools = new List();
+ bools.Clear();
+
+ for (int i = 0; i < Json.Data.parSets.Count; i++)
+ {
+ values.Clear();
+ values.Add(Json.Data.parSets[i].Minute);
+ values.Add(Json.Data.parSets[i].Second);
+ bools.Add(Json.Data.parSets[i].IsShield);
+ ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = $"VW{116 + (i * 6)}", Value = values.ToArray() });
+ }
+ ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M260.0", Value = bools.ToArray() });
+ Json.Save();
+ }
+ }
+}
diff --git a/BPASmartClient/BPASmartClient.csproj b/BPASmartClient/BPASmartClient.csproj
index f1d75a84..b1233974 100644
--- a/BPASmartClient/BPASmartClient.csproj
+++ b/BPASmartClient/BPASmartClient.csproj
@@ -15,7 +15,7 @@
-
+
@@ -35,6 +35,7 @@
+
diff --git a/DosingSystem/BPASmartClient.DosingSystem.csproj b/DosingSystem/BPASmartClient.DosingSystem.csproj
index 79ca5779..9616088a 100644
--- a/DosingSystem/BPASmartClient.DosingSystem.csproj
+++ b/DosingSystem/BPASmartClient.DosingSystem.csproj
@@ -22,7 +22,7 @@
-
+
diff --git a/SmartClient.sln b/SmartClient.sln
index 2dd4ef5d..7546aa88 100644
--- a/SmartClient.sln
+++ b/SmartClient.sln
@@ -202,7 +202,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DosingSystem
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "设备监控", "设备监控", "{106E84C1-CAC5-4F14-9E31-201D3202C9FD}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MaxWokControl", "BPASmartClient.MaxWokControl\BPASmartClient.MaxWokControl.csproj", "{888382C0-6750-4E81-BED3-0F38775DCCCB}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MaxWokControl", "BPASmartClient.MaxWokControl\BPASmartClient.MaxWokControl.csproj", "{888382C0-6750-4E81-BED3-0F38775DCCCB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkSUpgradedVer", "BPASmartClient.MorkSUpgradedVer\BPASmartClient.MorkSUpgradedVer.csproj", "{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -1898,6 +1900,26 @@ Global
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x64.Build.0 = Release|Any CPU
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x86.ActiveCfg = Release|Any CPU
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x86.Build.0 = Release|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|ARM.Build.0 = Debug|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|x64.Build.0 = Debug|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|x86.Build.0 = Debug|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|ARM.ActiveCfg = Release|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|ARM.Build.0 = Release|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|ARM64.Build.0 = Release|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|x64.ActiveCfg = Release|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|x64.Build.0 = Release|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|x86.ActiveCfg = Release|Any CPU
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1992,6 +2014,7 @@ Global
{B79914B9-3A81-426B-88FF-8ABAF5C92AB5} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{106E84C1-CAC5-4F14-9E31-201D3202C9FD} = {7BE13E55-D8B1-4232-AE63-8BF122633297}
{888382C0-6750-4E81-BED3-0F38775DCCCB} = {106E84C1-CAC5-4F14-9E31-201D3202C9FD}
+ {C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}
From cae9181627c17d9a94294ae7bc495dfb5013b910 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com>
Date: Wed, 15 Feb 2023 17:29:20 +0800
Subject: [PATCH 05/96] =?UTF-8?q?=E7=85=AE=E9=9D=A2=E6=9C=BA=E6=B5=81?=
=?UTF-8?q?=E7=A8=8B=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Control_MorkSUpgradedVer.cs | 102 +++++++++++-------
.../GVL_MorkSUpgradedVer.cs | 14 ++-
BPASmartClient/App.config | 24 ++---
3 files changed, 88 insertions(+), 52 deletions(-)
diff --git a/BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs b/BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs
index f20d6c65..1cc13130 100644
--- a/BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs
+++ b/BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs
@@ -22,6 +22,7 @@ using BPASmartClient.Model.小炒机;
using BPA.Models;
using System.Windows.Forms;
using System.Media;
+//using BPA.Helper;
namespace BPASmartClient.MorkSUpgradedVer
{
@@ -200,6 +201,7 @@ namespace BPASmartClient.MorkSUpgradedVer
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7)
{
+ Initing = !bools[0];
mORKS.InitComplete = bools[0];
mORKS.MoveScrewRodInitCom = bools[1];
mORKS.SacrificialVesselInitCom = bools[2];
@@ -208,13 +210,13 @@ namespace BPASmartClient.MorkSUpgradedVer
mORKS.RobotInitCom = bools[5];
mORKS.SiloInitCom = bools[6];
- alarm.DeviceNoInit = mORKS.InitComplete;
- alarm.MoveScrewRodNoInit = mORKS.MoveScrewRodInitCom;
- alarm.SacrificialVesselNoInit = mORKS.SacrificialVesselInitCom;
- alarm.CylinderNoInit = mORKS.CylinderInitCom;
- alarm.NoodleCookerNoInit = mORKS.NoodleCookerInitCom;
- alarm.RobotNoInit = mORKS.RobotInitCom;
- alarm.SiloNoInit = mORKS.SiloInitCom;
+ alarm.DeviceNoInit = !mORKS.InitComplete;
+ alarm.MoveScrewRodNoInit = !mORKS.MoveScrewRodInitCom;
+ alarm.SacrificialVesselNoInit = !mORKS.SacrificialVesselInitCom;
+ alarm.CylinderNoInit = !mORKS.CylinderInitCom;
+ alarm.NoodleCookerNoInit = !mORKS.NoodleCookerInitCom;
+ alarm.RobotNoInit = !mORKS.RobotInitCom;
+ alarm.SiloNoInit = !mORKS.SiloInitCom;
}
}));
@@ -284,12 +286,23 @@ namespace BPASmartClient.MorkSUpgradedVer
{
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1)
{
- mORKS.CookNoodleCom[0] = ushorts[0].GetBitValue(1);
- mORKS.CookNoodleCom[1] = ushorts[0].GetBitValue(2);
- mORKS.CookNoodleCom[2] = ushorts[0].GetBitValue(3);
- mORKS.CookNoodleCom[3] = ushorts[0].GetBitValue(4);
- mORKS.CookNoodleCom[4] = ushorts[0].GetBitValue(5);
- mORKS.CookNoodleCom[5] = ushorts[0].GetBitValue(6);
+ var tt = ushorts.UshortsToBytes(true).BytesToUshorts();
+
+ for (byte i = 0; i < 6; i++)
+ {
+ if (RTrig.GetInstance($"CookNoodleCom{i + 1}").Start(tt[0].GetBitValue((byte)(i + 1))))
+ {
+ if (!string.IsNullOrEmpty(mORKS.CookNodelId[i]))
+ mORKS.CookNoodleCom[i] = true;
+ }
+ }
+
+ //mORKS.CookNoodleCom[0] = tt[0].GetBitValue(1);
+ //mORKS.CookNoodleCom[1] = tt[0].GetBitValue(2);
+ //mORKS.CookNoodleCom[2] = tt[0].GetBitValue(3);
+ //mORKS.CookNoodleCom[3] = tt[0].GetBitValue(4);
+ //mORKS.CookNoodleCom[4] = tt[0].GetBitValue(5);
+ //mORKS.CookNoodleCom[5] = tt[0].GetBitValue(6);
mORKS.Heating = ushorts[0].GetBitValue(15);
mORKS.TemperatureReaches = ushorts[0].GetBitValue(16);
@@ -306,6 +319,10 @@ namespace BPASmartClient.MorkSUpgradedVer
}
}));
+
+ mORKS.TakeBowlTaskCount = mORKS.TakeBowlTask.Count;
+ mORKS.RBTakeNoodleTaskCount = mORKS.RBTakeNoodleTask.Count;
+
}
///
@@ -406,7 +423,6 @@ namespace BPASmartClient.MorkSUpgradedVer
{
if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.DropBowlMechanismStatus && !mORKS.TakeBowlInterlock)
{
- DeviceProcessLogShow("开始取碗流程");
ushort BowLoc = 0;
var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList();
if (res == null || res?.Count == 0)
@@ -419,12 +435,12 @@ namespace BPASmartClient.MorkSUpgradedVer
{
if (ushort.TryParse(item.BatchingLoc, out ushort loc))
{
- if (loc == 10 && !mORKS.SmallBowlYesOrNoCheck)
+ if (loc == 10 && mORKS.SmallBowlYesOrNoCheck)
{
BowLoc = loc;
break;
}
- else if (loc == 11 && !mORKS.LargeBowYesOrNoCheck)
+ else if (loc == 11 && mORKS.LargeBowYesOrNoCheck)
{
BowLoc = loc;
break;
@@ -491,7 +507,7 @@ namespace BPASmartClient.MorkSUpgradedVer
{
if (!mORKS.TurntableLowPosition)
{
- //WriteData("M32.7", false);
+ //WriteData("M32.7", false); 定位完成复位
DeviceProcessLogShow($"执行了转台启动互锁信号复位");
}
TurntableStart(loc);
@@ -518,7 +534,7 @@ namespace BPASmartClient.MorkSUpgradedVer
//转台到位检测
if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.SiloInPlace && mORKS.CurrentLoc == mORKS.CurrentFeedbackLoc))
{
- mORKS.CurrentLoc = 0;
+
mORKS.TurntableInterlock = false;
DeviceProcessLogShow("转台到位检测");
}
@@ -544,25 +560,31 @@ namespace BPASmartClient.MorkSUpgradedVer
//取面控制
if (mORKS.AllowRun && mORKS.RobotStatus && !mORKS.Feeding && !mORKS.RobotTaskInterlock && mORKS.AllowTakeNoodle && mORKS.SiloInPlace && !mORKS.TakeNoodleInterlock && mORKS.RBTakeNoodleTask.Count > 0)
{
- int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置
- if (loc >= 0 && loc <= 5)
+ if (mORKS.CurrentLoc == mORKS.CurrentFeedbackLoc)
{
- if (!Json.Data.parSets.ElementAt(loc).IsShield)//检查该煮面篮是否被屏蔽
+ int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置
+ if (loc >= 0 && loc <= 5)
{
- if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo))
+ if (!Json.Data.parSets.ElementAt(loc).IsShield)//检查该煮面篮是否被屏蔽
{
- mORKS.CookNodelId[loc] = orderLocInfo.SuborderId;
- mORKS.NoodleCookerStatus[loc] = true;
- SetFallNoodleLoc((ushort)(loc + 1));
- //机器人开始取面
- OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);
- DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏");
- //写入煮面时间
- List values = new List();
- values.Add(Json.Data.parSets.ElementAt(loc).Minute);
- values.Add(Json.Data.parSets.ElementAt(loc).Second);
- WriteData($"VW{320 + (loc * 4)}", values.ToArray());
- mORKS.TakeNoodleInterlock = true;
+ if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo))
+ {
+ //写入煮面时间
+ List values = new List();
+ values.Add(Json.Data.parSets.ElementAt(loc).Minute);
+ values.Add(Json.Data.parSets.ElementAt(loc).Second);
+ WriteData($"VW{324 + (loc * 4)}", values.ToArray());
+
+ mORKS.CurrentLoc = 0;
+ mORKS.CookNodelId[loc] = orderLocInfo.SuborderId;
+ mORKS.NoodleCookerStatus[loc] = true;
+ SetFallNoodleLoc((ushort)(loc + 1));
+ //机器人开始取面
+ OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);
+ DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏");
+
+ mORKS.TakeNoodleInterlock = true;
+ }
}
}
}
@@ -583,15 +605,16 @@ namespace BPASmartClient.MorkSUpgradedVer
{
SetTakeNoodleLoc((ushort)(loc + 1));
mORKS.NoodleCookerStatus[loc] = false;
- WriteData($"VW260", 0);//设置出汤时间
- OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK);
- DeviceProcessLogShow($"订单【{mORKS.OutMealId}】制作完成");
+ WriteData($"VW260", (ushort)0);//设置出汤时间
+ OrderChange(mORKS.IngredientsCompleteId, ORDER_STATUS.COMPLETED_COOK);
+ DeviceProcessLogShow($"订单【{mORKS.IngredientsCompleteId}】制作完成");
mORKS.CookCompleteFlatBit = true;
mORKS.OutMealId = mORKS.IngredientsCompleteId;
mORKS.OutMealName = mORKS.IngredientsCompleteName;
mORKS.IngredientsCompleteId = string.Empty;
mORKS.CookNodelId[loc] = string.Empty;
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKS.OutMealId}");
+ mORKS.CookNoodleCom[loc] = false;
}
}
}
@@ -614,10 +637,11 @@ namespace BPASmartClient.MorkSUpgradedVer
}
//取餐完成逻辑处理
- if (Delay.GetInstance("CompleteChange1").Start(!mORKS.DiningComplete, 1) && mORKS.CookCompleteFlatBit == true)
+ if (RTrig.GetInstance("CompleteChange1").Start(mORKS.DiningComplete) && mORKS.CookCompleteFlatBit == true)
{
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
+ WriteData("M10.1", false);
mORKS.CookCompleteFlatBit = false;
mORKS.OutMealId = string.Empty;
mORKS.OutMealName = string.Empty;
@@ -721,7 +745,7 @@ namespace BPASmartClient.MorkSUpgradedVer
private void SetTakeNoodleLoc(ushort loc)
{
if (loc >= 1 && loc <= 6)
- WriteData($"M16.{loc - 1}", true);
+ WriteData($"M15.{loc - 1}", true);
}
diff --git a/BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs b/BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs
index 0957bda6..159574ed 100644
--- a/BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs
+++ b/BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs
@@ -78,6 +78,18 @@ namespace BPASmartClient.MorkSUpgradedVer
///
[VariableMonitor("制作完成标志")]
public bool CookCompleteFlatBit { get; set; }
+
+ ///
+ /// 取碗任务数量
+ ///
+ [VariableMonitor("取碗任务数量")]
+ public int TakeBowlTaskCount { get; set; }
+
+ ///
+ /// 取面任务数量
+ ///
+ [VariableMonitor("取面任务数量")]
+ public int RBTakeNoodleTaskCount { get; set; }
#endregion
#region 列表数据
@@ -108,7 +120,7 @@ namespace BPASmartClient.MorkSUpgradedVer
public string TakeBowName { get; set; } = string.Empty;
///
- /// 配料完成订单ID
+ /// 允许倒面位置ID
///
public string IngredientsCompleteId { get; set; } = string.Empty;
///
diff --git a/BPASmartClient/App.config b/BPASmartClient/App.config
index 04f363c3..9c45fe12 100644
--- a/BPASmartClient/App.config
+++ b/BPASmartClient/App.config
@@ -4,12 +4,12 @@
-
+
-
+
-
+
@@ -29,7 +29,7 @@
-
+
@@ -39,12 +39,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
From 24a7495fb68da6017ae417ac0b2aa26886e34380 Mon Sep 17 00:00:00 2001
From: pengliangyang <1406009520@qq.com>
Date: Wed, 15 Feb 2023 19:35:20 +0800
Subject: [PATCH 06/96] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BPASmartClient.JAKA/JakaMachine.cs | 20 +-
.../Model/GVL_BigStation.cs | 2 +
.../Model/HK_PLC/HKDeviceStatus.cs | 1 +
.../Model/ProcessControl.cs | 340 +++++--
.../Model/RawMaterial/RecipeData.cs | 10 +
.../View/RecipeInfosView.xaml | 2 +-
.../View/RecipeReceiveView.xaml | 114 ++-
.../View/RecipeSendDownView.xaml | 127 ++-
.../View/SiemensRecipeSendDownView.xaml | 4 +-
.../View/StockBinRawMaterialView.xaml | 1 -
.../ViewModel/ManualFlowViewModel.cs | 1 +
.../ViewModel/RecipeInfosViewModel.cs | 31 +-
.../SiemensRecipeSendDownViewModel.cs | 1 -
.../ViewModel/StockBinRawMaterialViewModel.cs | 4 +
.../App.xaml.cs | 8 +-
.../BPASmartClient.JXJFoodSmallStation.csproj | 7 +
.../Model/GVL_SmallStation.cs | 4 +
.../Model/HK_PLC/PlcReadAddressDB3.cs | 15 +
.../Model/ProcessControl.cs | 90 +-
.../Model/RawMaterial/DevicePar.cs | 2 +
.../Model/RawMaterial/RawMaterialStockBin.cs | 29 +
.../View/ManualFlowView.xaml | 44 +-
.../View/StockBinRawMaterialView.xaml | 138 +++
.../View/StockBinRawMaterialView.xaml.cs | 28 +
.../ViewModel/ManualFlowViewModel.cs | 53 ++
.../ViewModel/StockBinRawMaterialViewModel.cs | 55 ++
.../BPASmartClient.JakaRobot.csproj | 1 +
BPASmartClient.JakaRobot/JaKaHelper.cs | 69 +-
.../BPASmartClient.MilkTeaCube.csproj | 14 +
.../MilkTeaCubeMachine.cs | 90 ++
.../BPASmartClient.MilkTeaCubeHelper.csproj | 9 +
BPASmartClient.MilkTeaCubeHelper/Class1.cs | 8 +
.../奶茶味魔方/MilkTeaCubeEvent.cs | 13 +
.../电夹爪/GripperEvent.cs | 10 +
.../电夹爪/WriteGripper.cs | 14 +
.../节卡机器人/JakaModel.cs | 107 ++-
BPASmartClient.MorkBF/Control_MorkBF.cs | 433 +++++----
BPASmartClient.MorkBF/GVL_MorkBF.cs | 8 +-
BPASmartClient.MorkS3/Alarm.cs | 204 ++++
.../BPASmartClient.MorkS3.csproj | 28 +
BPASmartClient.MorkS3/Control_Morks.cs | 891 ++++++++++++++++++
BPASmartClient.MorkS3/DataServer.cs | 52 +
BPASmartClient.MorkS3/GVL_MORKS.cs | 376 ++++++++
.../Model/Global.cs | 6 +-
BPASmartClient.MorkS3/Model/MorksPar.cs | 16 +
BPASmartClient.MorkS3/Model/ParSet.cs | 29 +
BPASmartClient.MorkS3/Model/WritePar.cs | 14 +
BPASmartClient.MorkS3/OrderLocInfo.cs | 23 +
BPASmartClient.MorkS3/View/Debug.xaml | 117 +++
BPASmartClient.MorkS3/View/Debug.xaml.cs | 30 +
BPASmartClient.MorkS3/View/Monitor.xaml | 242 +++++
BPASmartClient.MorkS3/View/Monitor.xaml.cs | 28 +
BPASmartClient.MorkS3/View/ParSet.xaml | 130 +++
BPASmartClient.MorkS3/View/ParSet.xaml.cs | 28 +
.../ViewModel/DebugViewModel.cs | 79 ++
.../ViewModel/MonitorViewModel.cs | 25 +
.../ViewModel/ParSetViewModel.cs | 49 +
BPASmartClient.MorkS3/VoiceAPI.cs | 42 +
.../BPASmartClient.MorkT_BarCounter.csproj | 5 +
.../Control_MorkT_BarCounter.cs | 862 ++++++-----------
BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs | 26 +-
.../PolymerBatching.cs | 25 +-
.../View/DebugView.xaml | 506 ++--------
.../View/TestView.xaml | 439 +++++++++
.../View/TestView.xaml.cs | 37 +
.../ViewModel/DebugViewModel.cs | 404 ++------
.../ViewModel/TestViewModel.cs | 386 ++++++++
.../Control_MorkT_Container.cs | 2 +-
.../Control_MORKJC.cs | 16 +-
.../BPASmartClient.RobotGripper.csproj | 15 +
.../RobotGripperMachine.cs | 50 +
.../ScreenSplitMealsControl1ViewModel.cs | 2 +-
.../ScreenALLControlViewModel.cs | 1 +
.../RobotGripperHelper.cs | 77 ++
DosingSystem/App.xaml.cs | 4 +-
DosingSystem/Model/DeviceInquire.cs | 17 +-
.../Model/par/{LocaPar.cs => LocalRecipe.cs} | 2 +-
DosingSystem/View/NewRecipeView.xaml.cs | 2 +-
DosingSystem/View/RecipeSettingsView.xaml.cs | 2 +-
.../ViewModel/ChangeDeviceNameViewModel.cs | 6 +-
DosingSystem/ViewModel/NewRecipeViewModel.cs | 24 +-
.../ViewModel/RecipeControlViewModel.cs | 12 +-
.../ViewModel/RecipeSettingsViewModel.cs | 12 +-
SmartClient.sln | 71 +-
84 files changed, 5536 insertions(+), 1785 deletions(-)
create mode 100644 BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcReadAddressDB3.cs
create mode 100644 BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RawMaterialStockBin.cs
create mode 100644 BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml
create mode 100644 BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml.cs
create mode 100644 BPASmartClient.JXJFoodSmallStation/ViewModel/StockBinRawMaterialViewModel.cs
create mode 100644 BPASmartClient.MilkTeaCube/BPASmartClient.MilkTeaCube.csproj
create mode 100644 BPASmartClient.MilkTeaCube/MilkTeaCubeMachine.cs
create mode 100644 BPASmartClient.MilkTeaCubeHelper/BPASmartClient.MilkTeaCubeHelper.csproj
create mode 100644 BPASmartClient.MilkTeaCubeHelper/Class1.cs
create mode 100644 BPASmartClient.Model/奶茶味魔方/MilkTeaCubeEvent.cs
create mode 100644 BPASmartClient.Model/电夹爪/GripperEvent.cs
create mode 100644 BPASmartClient.Model/电夹爪/WriteGripper.cs
create mode 100644 BPASmartClient.MorkS3/Alarm.cs
create mode 100644 BPASmartClient.MorkS3/BPASmartClient.MorkS3.csproj
create mode 100644 BPASmartClient.MorkS3/Control_Morks.cs
create mode 100644 BPASmartClient.MorkS3/DataServer.cs
create mode 100644 BPASmartClient.MorkS3/GVL_MORKS.cs
rename BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcWriteAddressDB7.cs => BPASmartClient.MorkS3/Model/Global.cs (52%)
create mode 100644 BPASmartClient.MorkS3/Model/MorksPar.cs
create mode 100644 BPASmartClient.MorkS3/Model/ParSet.cs
create mode 100644 BPASmartClient.MorkS3/Model/WritePar.cs
create mode 100644 BPASmartClient.MorkS3/OrderLocInfo.cs
create mode 100644 BPASmartClient.MorkS3/View/Debug.xaml
create mode 100644 BPASmartClient.MorkS3/View/Debug.xaml.cs
create mode 100644 BPASmartClient.MorkS3/View/Monitor.xaml
create mode 100644 BPASmartClient.MorkS3/View/Monitor.xaml.cs
create mode 100644 BPASmartClient.MorkS3/View/ParSet.xaml
create mode 100644 BPASmartClient.MorkS3/View/ParSet.xaml.cs
create mode 100644 BPASmartClient.MorkS3/ViewModel/DebugViewModel.cs
create mode 100644 BPASmartClient.MorkS3/ViewModel/MonitorViewModel.cs
create mode 100644 BPASmartClient.MorkS3/ViewModel/ParSetViewModel.cs
create mode 100644 BPASmartClient.MorkS3/VoiceAPI.cs
create mode 100644 BPASmartClient.MorkT_BarCounter/View/TestView.xaml
create mode 100644 BPASmartClient.MorkT_BarCounter/View/TestView.xaml.cs
create mode 100644 BPASmartClient.MorkT_BarCounter/ViewModel/TestViewModel.cs
create mode 100644 BPASmartClient.RobotGripper/BPASmartClient.RobotGripper.csproj
create mode 100644 BPASmartClient.RobotGripper/RobotGripperMachine.cs
create mode 100644 BPASmartClient.SerialPort/RobotGripperHelper.cs
rename DosingSystem/Model/par/{LocaPar.cs => LocalRecipe.cs} (93%)
diff --git a/BPASmartClient.JAKA/JakaMachine.cs b/BPASmartClient.JAKA/JakaMachine.cs
index a93c39cb..e45b477d 100644
--- a/BPASmartClient.JAKA/JakaMachine.cs
+++ b/BPASmartClient.JAKA/JakaMachine.cs
@@ -17,18 +17,22 @@ namespace BPASmartClient.JAKA
ThreadManage.GetInstance().StartLong(new Action(() =>
{
IsConnected = jaKaHelper.IsConnected;
- if (!IsConnected) IsWork = false;
- while (IsConnected)
+ if (!IsConnected)
+ {
+ IsWork = false;
+ }
+ if (IsConnected)
{
IsWork = true;
if (status != null)
{
- SetStatus("GetProgramStatus", (int)jaKaHelper.GetProgramStatus());
- SetStatus("Get_RobotAO1", jaKaHelper.Get_RobotAO1());
- SetStatus("Get_RobotDI0", jaKaHelper.Get_RobotDI(0));
- SetStatus("Get_RobotDI1", jaKaHelper.Get_RobotDI(1));
- SetStatus("Get_RobotDI2", jaKaHelper.Get_RobotDI(2));
- SetStatus("Get_RobotDI3", jaKaHelper.Get_RobotDI(3));
+ SetStatus("Get_JakaRobotProgramStatus", (int)jaKaHelper.GetProgramStatus());
+ SetStatus("Get_JakaRobotAO1", Convert.ToInt32(jaKaHelper.Get_RobotAO1()));
+ SetStatus("Get_JakaRobotDI0", jaKaHelper.Get_RobotDI(0));
+ SetStatus("Get_JakaRobotDI1", jaKaHelper.Get_RobotDI(1));
+ SetStatus("Get_JakaRobotDI2", jaKaHelper.Get_RobotDI(2));
+ SetStatus("Get_JakaRobotDI3", jaKaHelper.Get_RobotDI(3));
+ SetStatus("Get_JakaRobotDI5", jaKaHelper.Get_RobotDI(5));
}
Thread.Sleep(500);
}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs b/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
index 6e2d1570..476ffcf6 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
@@ -47,6 +47,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// 是否处于手动下发配方
///
public static bool IsUseLocalRecipe { get; set; } = false;
+
+ public static bool BarrelWasherSign { get; set; }
///
/// 订单请求
///
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
index 74f34914..aa60f2d7 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
@@ -64,6 +64,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
HK_PLC_S7.Write("DB99.DBW2.0",Convert.ToInt16(recipe.TrayCode));
HK_PLC_S7.Write("DB99.DBW4.0", Convert.ToInt16(recipe.TrayCode));
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号DB99.DBW2.0:{recipe.TrayCode},下发完成");
for (int barrel = 1; barrel < 6; barrel++)
{
if (barrel != 3)//桶的编号不为3 只为1,2,4,5号桶
diff --git a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
index 843db9cb..52566728 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
@@ -261,28 +261,28 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
foreach (var data in LocalRecipes)
{
- if (LocalRecipeQueue1.Count == 0 && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode))
+ if (LocalRecipeQueue1.Count == 0 && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe1)
{
if (!(LocalRecipeQueue1.Contains(data.RecipeCode)))
{
LocalRecipeQueue1.Enqueue(data.RecipeCode);
}
}
- else if (LocalRecipeQueue2.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode))
+ else if (LocalRecipeQueue2.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe2)
{
if (!(LocalRecipeQueue2.Contains(data.RecipeCode)))
{
LocalRecipeQueue2.Enqueue(data.RecipeCode);
}
}
- else if (LocalRecipeQueue3.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode))
+ else if (LocalRecipeQueue3.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe3)
{
if (!(LocalRecipeQueue3.Contains(data.RecipeCode)))
{
LocalRecipeQueue3.Enqueue(data.RecipeCode);
}
}
- else if (LocalRecipeQueue4.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode))
+ else if (LocalRecipeQueue4.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe4)
{
if (!(LocalRecipeQueue4.Contains(data.RecipeCode)))
{
@@ -297,6 +297,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
LocalRecipeQueue2.Clear();
LocalRecipeQueue3.Clear();
LocalRecipeQueue4.Clear();
+ GVL_BigStation.BarrelWasherSign = false;
GVL_BigStation.Recipe1DosingStatus = 0;
GVL_BigStation.Recipe2DosingStatus = 0;
GVL_BigStation.Recipe3DosingStatus = 0;
@@ -340,20 +341,43 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0 && Inplace)//配方1是否允许下发配发
{
- HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
- HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
- GVL_BigStation.Recipe1DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ if (LocalRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ if (!GVL_BigStation.BarrelWasherSign)
+ {
+ GVL_BigStation.BarrelWasherSign = true;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+
+ HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
+ GVL_BigStation.Recipe1DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ }
+ }
+ else
+ {
+ HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
+ GVL_BigStation.Recipe1DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ }
}
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1)
{
- GVL_BigStation.Recipe1DosingStatus = 2;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", false);
StockBinParReset();
+ GVL_BigStation.Recipe1DosingStatus = 2;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
}
if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish)
{
+ if (LocalRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ GVL_BigStation.BarrelWasherSign = false;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶复位
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶信号复位");
+ }
GVL_BigStation.Recipe1DosingStatus = 3;
switch (trayCode)
{
@@ -480,10 +504,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 &&Inplace)//配方2是否允许下发配发
{
- HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
- HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
- GVL_BigStation.Recipe2DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
+ if (LocalRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ if (!GVL_BigStation.BarrelWasherSign)
+ {
+ GVL_BigStation.BarrelWasherSign = true;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+
+ HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
+ GVL_BigStation.Recipe2DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
+ }
+ }
+ else
+ {
+ HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
+ GVL_BigStation.Recipe2DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
+ }
}
if (HKDevice.PlcRead.ReceiveFinishRecipe2 && GVL_BigStation.Recipe2DosingStatus == 1)
{
@@ -494,6 +535,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish)
{
+ if (LocalRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ GVL_BigStation.BarrelWasherSign = false;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶复位
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶信号复位");
+ }
switch (trayCode)
{
case 1:
@@ -620,10 +667,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0 && Inplace)//配方3是否允许下发配发
{
- HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
- HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
- GVL_BigStation.Recipe3DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
+ if (LocalRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ if (!GVL_BigStation.BarrelWasherSign)
+ {
+ GVL_BigStation.BarrelWasherSign = true;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+
+ HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
+ GVL_BigStation.Recipe3DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
+ }
+ }
+ else
+ {
+ HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
+ GVL_BigStation.Recipe3DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
+ }
}
if (HKDevice.PlcRead.ReceiveFinishRecipe3 && GVL_BigStation.Recipe3DosingStatus == 1)
{
@@ -634,6 +698,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2)
{
+ if (LocalRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ GVL_BigStation.BarrelWasherSign = false;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶复位
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶信号复位");
+ }
switch (trayCode)
{
case 1:
@@ -761,10 +831,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0 && Inplace)//配方4是否允许下发配发
{
- HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
- HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
- GVL_BigStation.Recipe4DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
+ if (LocalRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ if (!GVL_BigStation.BarrelWasherSign)
+ {
+ GVL_BigStation.BarrelWasherSign = true;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+
+ HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
+ GVL_BigStation.Recipe4DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
+ }
+ }
+ else
+ {
+ HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
+ GVL_BigStation.Recipe4DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
+ }
}
if (HKDevice.PlcRead.ReceiveFinishRecipe4 && GVL_BigStation.Recipe4DosingStatus == 1)
{
@@ -775,6 +862,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish)
{
+ if (LocalRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ GVL_BigStation.BarrelWasherSign = false;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶复位
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶信号复位");
+ }
switch (trayCode)
{
case 1:
@@ -875,7 +968,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
foreach (var data in SiemensRecipes)
{
- if (SiemensRecipeQueue1.Count == 0 && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode))
+ if (SiemensRecipeQueue1.Count == 0 && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe1)
{
if (!(SiemensRecipeQueue1.Contains(data.RecipeCode)))
{
@@ -910,7 +1003,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
}
- else if (SiemensRecipeQueue2.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode))
+ else if (SiemensRecipeQueue2.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe2)
{
if (!(SiemensRecipeQueue2.Contains(data.RecipeCode)))
{
@@ -945,7 +1038,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
}
- else if (SiemensRecipeQueue3.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode))
+ else if (SiemensRecipeQueue3.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe3)
{
if (!(SiemensRecipeQueue3.Contains(data.RecipeCode)))
{
@@ -980,7 +1073,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
}
- else if (SiemensRecipeQueue4.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode))
+ else if (SiemensRecipeQueue4.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe4)
{
if (!(SiemensRecipeQueue4.Contains(data.RecipeCode)))
{
@@ -1023,6 +1116,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
SiemensRecipeQueue2.Clear();
SiemensRecipeQueue3.Clear();
SiemensRecipeQueue4.Clear();
+ GVL_BigStation.BarrelWasherSign = false;
GVL_BigStation.Recipe1DosingStatus = 0;
GVL_BigStation.Recipe2DosingStatus = 0;
GVL_BigStation.Recipe3DosingStatus = 0;
@@ -1057,14 +1151,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
GVL_BigStation.Recipe1DosingStatus = 0;
- SiemensRecipeQueue1.TryDequeue(out code);
- SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
- MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
+ while (SiemensDevice.Siemens_PLC_S7.Read("DB2301.DBX320.2") == false )
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
+ SiemensRecipeQueue1.TryDequeue(out code);
+ MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
+ }
}
if (SiemensRecipeQueue2.Contains(code))
{
- GVL_BigStation.Recipe2DosingStatus = 0;
App.Current.Dispatcher.Invoke(() =>
{
Json.Data.Recipes.RemoveAt(index);
@@ -1080,10 +1176,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
GVL_BigStation.Recipe2DosingStatus = 0;
- SiemensRecipeQueue2.TryDequeue(out code);
- SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
- MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}");
+ while (SiemensDevice.Siemens_PLC_S7.Read("DB2301.DBX320.2") == false)
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
+ SiemensRecipeQueue2.TryDequeue(out code);
+ MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}");
+ }
}
if (SiemensRecipeQueue3.Contains(code))
{
@@ -1102,11 +1201,14 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
- GVL_BigStation.Recipe3DosingStatus = 0;
- SiemensRecipeQueue3.TryDequeue(out code);
- SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false);
+ GVL_BigStation.Recipe3DosingStatus = 0;
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
- MessageNotify.GetInstance.ShowRunLog($"队列3,西门子取消订单完成,订单号:{code}");
+ while (SiemensDevice.Siemens_PLC_S7.Read("DB2301.DBX320.2") == false)
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
+ SiemensRecipeQueue3.TryDequeue(out code);
+ MessageNotify.GetInstance.ShowRunLog($"队列3,西门子取消订单完成,订单号:{code}");
+ }
}
if (SiemensRecipeQueue4.Contains(code))
{
@@ -1126,10 +1228,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
GVL_BigStation.Recipe4DosingStatus = 0;
- SiemensRecipeQueue4.TryDequeue(out code);
- SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
- MessageNotify.GetInstance.ShowRunLog($"队列4,西门子取消订单完成,订单号:{code}");
+ while (SiemensDevice.Siemens_PLC_S7.Read("DB2301.DBX320.2") == false)
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
+ SiemensRecipeQueue4.TryDequeue(out code);
+ MessageNotify.GetInstance.ShowRunLog($"队列4,西门子取消订单完成,订单号:{code}");
+ }
}
GVL_BigStation.Order_Cancel = false;
GVL_BigStation.Order_CancelRecipeCode = "";
@@ -1149,19 +1254,24 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
MessageNotify.GetInstance.ShowRunLog($"订单取消异常,订单号:{GVL_BigStation.Order_CancelRecipeCode}");
}
-
GVL_BigStation.Order_Cancel = false;
GVL_BigStation.Order_CancelRecipeCode = "";
- SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
+ while (SiemensDevice.Siemens_PLC_S7.Read("DB2301.DBX320.2") == false)
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
+ }
}
}
else
{
GVL_BigStation.Order_Cancel = false;
GVL_BigStation.Order_CancelRecipeCode = "";
- SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
+ while (SiemensDevice.Siemens_PLC_S7.Read("DB2301.DBX320.2") == false)
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
+ }
MessageNotify.GetInstance.ShowRunLog($"西门子取消订单,但未找到订单:{GVL_BigStation.Order_CancelRecipeCode}");
}
}
@@ -1180,7 +1290,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
switch (trayCode)
{
case 1:
- Inplace = HKDevice.PlcRead.Tray1InPlace;
+ Inplace = HKDevice.PlcRead.Tray1InPlace;//上位机给plc发送AGV到位信号,plc固定托盘后反馈托盘是否到位
break;
case 2:
Inplace = HKDevice.PlcRead.Tray2InPlace;
@@ -1199,16 +1309,31 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0 && Inplace)//配方1是否允许下发配发
{
- GVL_BigStation.DosingRecipe1Time = DateTime.Now;
- HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
- if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
+
+ if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
- HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+ if (!GVL_BigStation.BarrelWasherSign)
+ {
+ GVL_BigStation.BarrelWasherSign = true;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+
+ GVL_BigStation.DosingRecipe1Time = DateTime.Now;
+ HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
+ GVL_BigStation.Recipe1DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ }
+ }
+ else
+ {
+ GVL_BigStation.DosingRecipe1Time = DateTime.Now;
+ HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
+ GVL_BigStation.Recipe1DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
- HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
- GVL_BigStation.Recipe1DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+
}
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1)
{
@@ -1219,6 +1344,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish)
{
+ if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ GVL_BigStation.BarrelWasherSign = false;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
+ }
GVL_BigStation.Recipe1DosingFinish = true;
GVL_BigStation.Recipe1DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
@@ -1350,28 +1481,47 @@ namespace BPASmartClient.JXJFoodBigStation.Model
default:
break;
}
- if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 && Inplace)//配方2是否允许下发配发
+ if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 && Inplace )//配方2是否允许下发配发
{
- GVL_BigStation.DosingRecipe2Time = DateTime.Now;
- HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
- HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+ if (!GVL_BigStation.BarrelWasherSign)
+ {
+ GVL_BigStation.BarrelWasherSign = true;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+
+ GVL_BigStation.DosingRecipe2Time = DateTime.Now;
+ HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
+ GVL_BigStation.Recipe2DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ }
+ }
+ else
+ {
+ GVL_BigStation.DosingRecipe2Time = DateTime.Now;
+ HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
+ GVL_BigStation.Recipe2DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
- HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
- GVL_BigStation.Recipe2DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe2 && GVL_BigStation.Recipe2DosingStatus == 1)
{
- GVL_BigStation.Recipe2DosingStatus = 2;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", false);
StockBinParReset();
+ GVL_BigStation.Recipe2DosingStatus = 2;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
}
if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish)
{
+ if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ GVL_BigStation.BarrelWasherSign = false;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
+ }
GVL_BigStation.Recipe2DosingFinish = true;
GVL_BigStation.Recipe2DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
@@ -1505,26 +1655,44 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0 && Inplace)//配方3是否允许下发配发
{
- GVL_BigStation.DosingRecipe3Time = DateTime.Now;
- HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
- HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+ if (!GVL_BigStation.BarrelWasherSign)//其他配方在洗桶时,等待其他配方洗完,在发送数据
+ {
+ GVL_BigStation.BarrelWasherSign = true;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+ GVL_BigStation.DosingRecipe3Time = DateTime.Now;
+ HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
+ GVL_BigStation.Recipe3DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ }
+ }
+ else
+ {
+ GVL_BigStation.DosingRecipe3Time = DateTime.Now;
+ HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
+ GVL_BigStation.Recipe3DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
- HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
- GVL_BigStation.Recipe3DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe3 && GVL_BigStation.Recipe3DosingStatus == 1)
{
- GVL_BigStation.Recipe3DosingStatus = 2;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", false);
StockBinParReset();
+ GVL_BigStation.Recipe3DosingStatus = 2;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
}
if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2)
{
+ if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ GVL_BigStation.BarrelWasherSign = false;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
+ }
GVL_BigStation.Recipe3DosingFinish = true;
GVL_BigStation.Recipe3DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
@@ -1658,16 +1826,28 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0 && Inplace)//配方4是否允许下发配发
{
- GVL_BigStation.DosingRecipe4Time = DateTime.Now;
- HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
- HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+ if (!GVL_BigStation.BarrelWasherSign)//其他配方在洗桶时,等待其他配方洗完,在发送数据
+ {
+ GVL_BigStation.BarrelWasherSign = true;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+ GVL_BigStation.DosingRecipe4Time = DateTime.Now;
+ HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
+ GVL_BigStation.Recipe4DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ }
+ }
+ else
+ {
+ GVL_BigStation.DosingRecipe4Time = DateTime.Now;
+ HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
+ GVL_BigStation.Recipe4DosingStatus = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
- HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
- GVL_BigStation.Recipe4DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe4 && GVL_BigStation.Recipe4DosingStatus == 1)
{
@@ -1678,6 +1858,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish)
{
+ if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ GVL_BigStation.BarrelWasherSign = false;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
+ }
GVL_BigStation.Recipe1DosingFinish = true;
GVL_BigStation.Recipe4DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
@@ -1803,8 +1989,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0005", RawMaterialLocation = 3 });//榨菜丁
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0018", RawMaterialLocation = 4 });//炸豌豆
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0019", RawMaterialLocation = 5 });//高水分糍粑海椒
- RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0033", RawMaterialLocation = 6 });//辣豆瓣*/
- /*RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0030", RawMaterialLocation = 11 });//备用生姜
+ RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0033", RawMaterialLocation = 6 });//辣豆瓣
+ RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0030", RawMaterialLocation = 11 });//备用生姜
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0012", RawMaterialLocation = 12 });//豆豉细粒*/
foreach (var material in RawMaterialsInfo)
{
diff --git a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs
index 873e398e..dc05bc4f 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs
@@ -28,8 +28,18 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } }
private int _mTrayCode;
+ ///
+ /// 配方类型是否为洗桶
+ ///
+ public string OrderType { get { return _mOrderType; } set { _mOrderType = value; OnPropertyChanged(); } }
+ private string _mOrderType;
+
+ ///
+ /// 配方类型是否为洗桶
+ ///
public bool IsWashingBarrel { get { return _mIsWashingBarrel; } set { _mIsWashingBarrel = value; OnPropertyChanged(); } }
private bool _mIsWashingBarrel;
+
///
/// 原料数据
///
diff --git a/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml b/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml
index 63e35bc1..0d22968d 100644
--- a/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml
+++ b/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml
@@ -289,8 +289,8 @@
+
-
diff --git a/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml b/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
index ef78e4b8..1c3603c8 100644
--- a/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
+++ b/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
@@ -226,36 +226,116 @@
Margin="5">
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+ Text="配方编号:" />
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+ Grid.RowSpan="8"
+ Grid.ColumnSpan="2"
+ Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png"
+ Stretch="Fill" />
+ Grid.Row="0"
+ Grid.ColumnSpan="2"
+ FontSize="14"
+ Margin="5,0,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Foreground="#FF2AB2E7"
+ Text="配方信息" />
+ Grid.Row="1"
+ Grid.Column="0"
+ Margin="2,5,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ FontSize="12"
+ Foreground="#FF2AB2E7"
+ Text="配方名称:" />
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
{
Json.Data.Recipes.Clear();
+ GVL_BigStation.SiemensSendRecipeStatus = 0;
});
ThreadManage.GetInstance().StartLong(new Action(() =>
{
diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
index 34da58d1..9c1ecc13 100644
--- a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
+++ b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
@@ -11,6 +11,8 @@ using BPASmartClient.JXJFoodBigStation.Model;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.JXJFoodBigStation.Model.Siemens;
using System.Windows.Forms;
+using BPASmartClient.CustomResource.UserControls;
+using BPASmartClient.CustomResource.UserControls.MessageShow;
namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
@@ -29,7 +31,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
RecipeName = rm.RecipeName;
RecipeCode = rm.RecipeCode;
TrayCode = rm.TrayCode;
-
+ IsWashingBarrel = rm.IsWashingBarrel;
foreach (var item in rm.RawMaterial)
{
item.RawMaterialCount = (short)Array.FindIndex(ProcessControl.GetInstance.RawMaterialsInfo.ToArray(), p => p.RawMaterialName == item.RawMaterialName);
@@ -65,8 +67,18 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
if (res == null)
{
- Json.Data.Recipes.Add(new RecipeData { RecipeCode = recipeCode, RawMaterial= RawMaterialsInfo,RecipeName=RecipeName,TrayCode=TrayCode});
+ if (IsWashingBarrel)
+ {
+ Json.Data.Recipes.Add(new RecipeData { RecipeCode = recipeCode,RecipeName = RecipeName, TrayCode = TrayCode, IsWashingBarrel = IsWashingBarrel });
+ if (RawMaterialsInfo.Count > 0)
+ NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, App.MainWindow, "提示", $"订单类型为洗桶,不保存原料信息");
+ }
+ else
+ {
+ Json.Data.Recipes.Add(new RecipeData { RecipeCode = recipeCode, RawMaterial = RawMaterialsInfo, RecipeName = RecipeName, TrayCode = TrayCode, IsWashingBarrel = IsWashingBarrel });
+ }
Json.Save();
+ NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"配方保存完成");
}
else
{
@@ -88,15 +100,16 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
}
bom.RecipeName = RecipeName;
bom.TrayCode = TrayCode;
+ bom.IsWashingBarrel = IsWashingBarrel;
+ if (IsWashingBarrel)
+ {
+ bom.RawMaterial.Clear();
+ }
Json.Save();
ActionManage.GetInstance.Send("CloseRecipeInfosView");
}
});
- ClearRawMaterial = new RelayCommand(() => {
- RawMaterialsInfo.Clear();
- });
-
RemoveRecipe = new RelayCommand((index) => {
var res = RawMaterialsInfo.FirstOrDefault(p => p.RawMaterialCount == index);
if (res != null)
@@ -114,16 +127,16 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
public int SelectIndex { get { return _mSelectIndex; } set { _mSelectIndex = value; OnPropertyChanged(); } }
private int _mSelectIndex;
-
+ public bool IsWashingBarrel { get { return _mIsWashingBarrel; } set { _mIsWashingBarrel = value; OnPropertyChanged(); } }
+ private bool _mIsWashingBarrel;
+
public RelayCommand ReturnPage { get; set; }
public RelayCommand AddRecipe { get; set; }
public RelayCommand Comfirm { get; set; }
- public RelayCommand ClearRawMaterial { get; set; }
-
public RelayCommand RemoveRecipe { get; set; }
public ObservableCollection RawMaterialsInfo { get; set; } = new ObservableCollection() ;
diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/SiemensRecipeSendDownViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/SiemensRecipeSendDownViewModel.cs
index bb7da1f3..fd2f38f0 100644
--- a/BPASmartClient.JXJFoodBigStation/ViewModel/SiemensRecipeSendDownViewModel.cs
+++ b/BPASmartClient.JXJFoodBigStation/ViewModel/SiemensRecipeSendDownViewModel.cs
@@ -17,7 +17,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
public ObservableCollection Recipes { get; set; } = Json.Data.Recipes;
public SiemensRecipeSendDownViewModel()
{
-
}
}
}
diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs
index ba4fdc95..f5ade366 100644
--- a/BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs
+++ b/BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs
@@ -34,6 +34,10 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
SaveRawMaterialPara = new RelayCommand(() =>
{
Json.Save();
+ foreach (var item in Json.Data.RawMaterial)
+ {
+ MessageNotify.GetInstance.ShowUserLog($"料仓位置:"+ item.RawMaterialLocation+ ",物料编码:" + item.RawMaterialName);
+ }
MessageNotify.GetInstance.ShowUserLog($"原料与料仓对应关系保存成功");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
});
diff --git a/BPASmartClient.JXJFoodSmallStation/App.xaml.cs b/BPASmartClient.JXJFoodSmallStation/App.xaml.cs
index 1015cbd3..191917d2 100644
--- a/BPASmartClient.JXJFoodSmallStation/App.xaml.cs
+++ b/BPASmartClient.JXJFoodSmallStation/App.xaml.cs
@@ -138,7 +138,13 @@ namespace BPASmartClient.JXJFoodSmallStation
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.SystemParView"
});
-
+ ParSet.Add(new SubMenumodel()
+ {
+ SubMenuName = "原料与料仓对应设置",
+ SubMenuPermission = new Permission[] { Permission.管理员 },
+ AssemblyName = "BPASmartClient.JXJFoodSmallStation",
+ ToggleWindowPath = "View.StockBinRawMaterialView"
+ });
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "",
diff --git a/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj b/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
index 113ea061..17229774 100644
--- a/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
+++ b/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
@@ -32,6 +32,9 @@
Code
+
+ Code
+
@@ -57,6 +60,10 @@
$(DefaultXamlRuntime)
Designer
+
+ $(DefaultXamlRuntime)
+ Designer
+
$(DefaultXamlRuntime)
Designer
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs b/BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
index 5625b98f..6e50873a 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
+++ b/BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
@@ -142,6 +142,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// 系统运行状态
///
public static bool SystemRunStatus { get; set; } = false;
+ ///
+ /// 系统运行状态
+ ///
+ public static int Time { get; set; } = 1000;
#endregion
}
}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcReadAddressDB3.cs b/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcReadAddressDB3.cs
new file mode 100644
index 00000000..ec42c683
--- /dev/null
+++ b/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcReadAddressDB3.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
+{
+ public class PlcReadAddressDB3
+ {
+ public bool[] VarBool { get; set; } =new bool[17];
+ public Single[] BarrelPos { get; set; } = new Single[8];
+ public bool[] IsAllowDosing { get; set; } = new bool[8];
+ }
+}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
index ae9b499f..bf45b196 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
+++ b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
@@ -1,6 +1,7 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
+using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial;
using BPASmartClient.JXJFoodSmallStation.Model.Siemens;
using BPASmartClient.JXJFoodSmallStation.Model.WindSend;
using BPASmartClient.Modbus;
@@ -30,6 +31,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// 原料的名称和料仓的位置对应
///
public Dictionary RawMaterialsNamePos = new Dictionary();
+ public ObservableCollection RawMaterialsInfo => Json.Data.rawMaterialStockBin;
///
/// 配方队列
///
@@ -51,7 +53,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public void Init()
{
testData();
- for (int i = 0; i < 16; i++)
+ /*for (int i = 0; i < 16; i++)
{
if (DeviceInquire.GetInstance.GetDevice(i).DeviceName != null)
{
@@ -60,7 +62,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
RawMaterialsNamePos.Add(DeviceInquire.GetInstance.GetDevice(i).DeviceName, (short)DeviceInquire.GetInstance.GetDevice(i).deviceStatus.DeviceNum);
}
}
- }
+ }*/
ActionManage.GetInstance.CancelRegister("SiemensRecipeRecive");
ActionManage.GetInstance.Register(new Action((res) =>
{
@@ -88,6 +90,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else
{
+ MessageNotify.GetInstance.ShowRunLog($"原料:{recipe.Material[i].Material_Name},不在配料表");
//MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合");
}
}
@@ -170,6 +173,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
Json.Data.Recipes.Clear();
GVL_SmallStation.SiemensSendRecipeStatus = 0;
+
MessageNotify.GetInstance.ShowRunLog("系统流程复位,等待西门子重新下发订单");
}), "BPASystemReset",true);
@@ -347,7 +351,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}), "西门子配发下发流程处理", true);
ThreadManage.GetInstance().StartLong(new Action(() =>
{
- if (!HKDevice.IsConnected)
+ if (HKDevice.IsConnected)
{
ManualOpen();
ManualClose();
@@ -380,6 +384,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
string address = "DB5.DBX" + (index / 8) + "." + (index % 8 - 1);
if (index == 8) address = "DB5.DBX0.7";
HKDevice.HK_PLC_S7.Write(address, true);
+ MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:{address},值:true");
}
}
else if (o.ToString().Contains("阻挡气缸"))
@@ -409,18 +414,22 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
else if (o.ToString().Contains("进料桶顶升气缸"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", false);//默认顶升
+ MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX3.6,值:false");
}
else if (o.ToString().Contains("出料桶顶升气缸1"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX3.7", true);
+ MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX3.7,值:true");
}
else if (o.ToString().Contains("出料桶顶升气缸2"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.0", true);
+ MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.0,值:true");
}
else if (o.ToString().Contains("出料桶顶升气缸3"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.1", true);
+ MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.1,值:true");
}
else if (o.ToString().Contains("托盘气缸1_1"))
{
@@ -455,6 +464,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
string address = "DB5.DBX" + (index / 8) + "." + (index % 8 - 1);
if (index == 8) address = "DB5.DBX0.7";
HKDevice.HK_PLC_S7.Write(address, false);
+ MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:{address},值:false");
}
}
else if (o.ToString().Contains("阻挡气缸"))
@@ -484,18 +494,22 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
else if (o.ToString().Contains("进料桶顶升气缸"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", true);
+ MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX3.6,值:true");
}
else if (o.ToString().Contains("出料桶顶升气缸1"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX3.7", false);
+ MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX3.7,值:false");
}
else if (o.ToString().Contains("出料桶顶升气缸2"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.0", false);
+ MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.0,值:false");
}
else if (o.ToString().Contains("出料桶顶升气缸3"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.1", false);
+ MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.1,值:false");
}
else if (o.ToString().Contains("托盘气缸1_1"))
{
@@ -524,11 +538,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (HKDevice.IsConnected)
{
GVL_SmallStation.Station1HaveTray = HKDevice.HK_PLC_S7.Read("DB3.DBX0.7");//工站1 有货架
- GVL_SmallStation.Station2HaveTray = HKDevice.HK_PLC_S7.Read("DB3.DBX1.0");//工站1 有货架
- if (RTrig.GetInstance("WindSendDosingCompleToHKPLC").Start(GVL_SmallStation.WindSendDosingComple))
+ GVL_SmallStation.Station2HaveTray = HKDevice.HK_PLC_S7.Read("DB3.DBX1.0");//工站2 有货架
+ if (GVL_SmallStation.WindSendDosingComple)
{
- GVL_SmallStation.WindSendDosingComple = false;
HKDevice.HK_PLC_S7.Write("DB4.DBX1.7", true);
+ GVL_SmallStation.WindSendDosingComple = false;
MessageNotify.GetInstance.ShowRunLog("风送配料完成信号,发给产线plc信号");
}
if (HKDevice.HK_PLC_S7.Read("DB3.DBX1.1"))
@@ -787,10 +801,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
GVL_SmallStation.GetInstance.RecipeStatusID = 0;
- RecipeQueueTray1.TryDequeue(out code);
- SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX440.1", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
- MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
+ while (SiemensDevice.Siemens_PLC_S7.Read("DB2301.DBX440.1") == false)
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
+ RecipeQueueTray1.TryDequeue(out code);
+ MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
+ }
}
else if (RecipeQueueTray2.Contains(code))
{
@@ -817,10 +834,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
GVL_SmallStation.GetInstance.RecipeStatusID = 0;
- RecipeQueueTray2.TryDequeue(out code);
- SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX440.1", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
- MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}");
+ while (SiemensDevice.Siemens_PLC_S7.Read("DB2301.DBX440.1") == false)
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
+ RecipeQueueTray2.TryDequeue(out code);
+ MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}");
+ }
}
GVL_SmallStation.Order_Cancel = false;
GVL_SmallStation.Order_CancelRecipeCode = "";
@@ -843,16 +863,22 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
GVL_SmallStation.Order_Cancel = false;
GVL_SmallStation.Order_CancelRecipeCode = "";
- SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX440.1", false);
- SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
+ SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
+ while (SiemensDevice.Siemens_PLC_S7.Read("DB2201.DBX440.1") == false)
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
+ }
}
}
else
{
GVL_SmallStation.Order_Cancel = false;
GVL_SmallStation.Order_CancelRecipeCode = "";
- SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX440.1", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
+ while (SiemensDevice.Siemens_PLC_S7.Read("DB2201.DBX440.1") == false)
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
+ }
MessageNotify.GetInstance.ShowRunLog($"西门子取消订单,但未找到订单:{code}");
}
}
@@ -1003,6 +1029,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
int i = GVL_SmallStation.GetInstance.DosingTray1Loc;
if (DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3)
{
+ Thread.Sleep(GVL_SmallStation.Time);
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成");
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.NowWeightFeedback;
@@ -1186,6 +1213,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
if (GVL_SmallStation.GetInstance.DosingTray2 == true && GVL_SmallStation.GetInstance.DosingTray1 == false && GVL_SmallStation.GetInstance.DosingTray2Loc > 0 && GVL_SmallStation.GetInstance.DosingTray2Loc < 16)
{
+ Thread.Sleep(GVL_SmallStation.Time);
int i = GVL_SmallStation.GetInstance.DosingTray2Loc;
if (RTrig.GetInstance("Tray2StatusDevice" + i).Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3))
{
@@ -1274,19 +1302,29 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
}
- private void testData()
+ public void testData()
{
- RawMaterialsNamePos.Add("0051", 3);
- RawMaterialsNamePos.Add("0052", 4);
- RawMaterialsNamePos.Add("0054", 5);
- RawMaterialsNamePos.Add("0057", 6);
- RawMaterialsNamePos.Add("0050", 8);
- RawMaterialsNamePos.Add("0048", 13);
-
- RawMaterialsNamePos.Add("0036", 13);//I+G
- RawMaterialsNamePos.Add("0037", 13);//味精
- RawMaterialsNamePos.Add("0038", 13);//白糖
+ //RawMaterialsNamePos.Add("0051", 3);
+ //RawMaterialsNamePos.Add("0052", 4);
+ //RawMaterialsNamePos.Add("0054", 5);
+ //RawMaterialsNamePos.Add("0057", 6);
+ //RawMaterialsNamePos.Add("0050", 8);
+ //RawMaterialsNamePos.Add("0048", 13);
+ //RawMaterialsNamePos.Add("0036", 13);//I+G
+ //RawMaterialsNamePos.Add("0037", 13);//味精
+ //RawMaterialsNamePos.Add("0038", 13);//白糖
+ RawMaterialsNamePos.Clear();
+ foreach (var material in RawMaterialsInfo)
+ {
+ if (!string.IsNullOrEmpty(material.RawMaterialName))
+ {
+ if (!RawMaterialsNamePos.ContainsKey(material.RawMaterialName))
+ {
+ RawMaterialsNamePos.Add(material.RawMaterialName, (short)material.RawMaterialLocation);
+ }
+ }
+ }
}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs
index 3e686249..bf29ce35 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs
+++ b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using BPASmartClient.JXJFoodSmallStation.Model.Par;
+using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial;
namespace BPASmartClient.JXJFoodSmallStation.Model
{
@@ -14,5 +15,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public ObservableCollection deviceParModels { get; set; } = new ObservableCollection();
public ConnectParMode deviceConnectPar { get { return _mdeviceConnectPar; } set { _mdeviceConnectPar = value; OnPropertyChanged(); } }
private ConnectParMode _mdeviceConnectPar = new ConnectParMode();
+ public ObservableCollection rawMaterialStockBin { get; set; } = new ObservableCollection();
}
}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RawMaterialStockBin.cs b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RawMaterialStockBin.cs
new file mode 100644
index 00000000..1cd90b17
--- /dev/null
+++ b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RawMaterialStockBin.cs
@@ -0,0 +1,29 @@
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodSmallStation.Model.RawMaterial
+{
+ public class RawMaterialStockBin : ObservableObject
+ {
+
+ public short RawMaterialCount { get { return _mRawMaterialCount; } set { _mRawMaterialCount = value; OnPropertyChanged(); } }
+ private short _mRawMaterialCount;
+
+ ///
+ /// 原料名称
+ ///
+ public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }
+ private string _mRawMaterialName;
+
+
+ ///
+ /// 原料对应料仓的位置
+ ///
+ public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } }
+ private int _mRawMaterialLocation;
+ }
+}
diff --git a/BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml b/BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml
index 16f0baa0..7c145c99 100644
--- a/BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml
+++ b/BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml
@@ -94,7 +94,7 @@
Height="40"
Margin="5,0,5,0"
Command="{Binding SystemReset}"
- Content="系统复位"
+ Content="PLC系统复位"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}">
@@ -112,10 +112,44 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml b/BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml
new file mode 100644
index 00000000..87c2680a
--- /dev/null
+++ b/BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml.cs b/BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml.cs
new file mode 100644
index 00000000..fe3e6909
--- /dev/null
+++ b/BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml.cs
@@ -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.JXJFoodSmallStation.View
+{
+ ///
+ /// HKPlcCommMonitor.xaml 的交互逻辑
+ ///
+ public partial class StockBinRawMaterialView : UserControl
+ {
+ public StockBinRawMaterialView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs b/BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs
index fa79e115..9322b444 100644
--- a/BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs
+++ b/BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs
@@ -16,6 +16,7 @@ using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
using System.Threading;
using System.ComponentModel;
using System.Runtime.CompilerServices;
+using BPASmartClient.CustomResource.Pages.Model;
namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
@@ -23,47 +24,93 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public ManualFlowViewModel()
{
+ time = GVL_SmallStation.Time;
Test1Command = new RelayCommand(() =>
{
GVL_SmallStation.AGV_PutTray1Finish = true;
+ MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV送托盘完成");
});
Test2Command = new RelayCommand(() =>
{
GVL_SmallStation.WindSendDosingComple = true;
+ MessageNotify.GetInstance.ShowUserLog("手动点击按钮,粉料仓配料完成");
});
Test3Command = new RelayCommand(() =>
{
GVL_SmallStation.AGV_GetTray1Finish = true;
+ MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV取托盘完成");
});
Test4Command = new RelayCommand(() =>
{
GVL_SmallStation.CylinderReset = true;
+ MessageNotify.GetInstance.ShowUserLog("手动点击按钮,气缸收紧错位复位");
});
Test5Command = new RelayCommand(() =>
{
GVL_SmallStation.WindSendAllowAGVPutGet = true;
+ MessageNotify.GetInstance.ShowUserLog("手动点击按钮,粉料仓提升到位");
});
Test6Command = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("AGVPutTrayFinish");
+ MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV放货架流程完成");
});
CLearRecipeInfo = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("CLearRecipeInfo");
+ MessageNotify.GetInstance.ShowUserLog("手动点击按钮,配方清零");
});
SystemReset = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("ManualSystemReset");
+ MessageNotify.GetInstance.ShowUserLog("手动点击按钮,PLC系统复位");
});
BPAResetCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("BPASystemReset");
+ MessageNotify.GetInstance.ShowUserLog("手动点击按钮,上位机初始化");
});
ThreadManage.GetInstance().StartLong(new Action(() =>
{
Heartbeat = GVL_SmallStation.GetInstance.HeartBeatFromPlc;
+ switch (GVL_SmallStation.SiemensSendRecipeStatus)
+ {
+ case 0:
+ OrderStatus = "初始状态";
+ break;
+ case 1:
+ OrderStatus = "向西门子请求配方";
+ break;
+ case 2:
+ OrderStatus = "上位机接收到配方";
+ break;
+ case 3:
+ OrderStatus = "西门子确认上位机接收到配方";
+ break;
+ case 4:
+ OrderStatus = "上位机向西门子请求配料";
+ break;
+ case 5:
+ OrderStatus = "西门子确认配料";
+ break;
+ case 6:
+ OrderStatus = "上位机将配方进行配料";
+ break;
+ case 7:
+ OrderStatus = "配料完成";
+ break;
+ default:
+ OrderStatus = "无意义";
+ break;
+ }
Thread.Sleep(100);
}), "流程手动设备状态读取",true);
+ TimeSet = new RelayCommand(() =>
+ {
+ GVL_SmallStation.Time = time;
+ MessageNotify.GetInstance.ShowUserLog($"设置柔性味魔方复位时间:{time}s");
+ NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{time.ToString()}:设置成功!");
+ });
}
public RelayCommand Test1Command { get; set; }
public RelayCommand Test2Command { get; set; }
@@ -71,9 +118,15 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public RelayCommand Test4Command { get; set; }
public RelayCommand Test5Command { get; set; }
public RelayCommand Test6Command { get; set; }
+ public RelayCommand TimeSet { get; set; }
public static bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnStaticPropertyChanged(); } }
private static bool _mHeartbeat;
+ public int time { get { return _mtime; } set { _mtime = value; OnStaticPropertyChanged(); } }
+ private int _mtime;
+ public static string OrderStatus { get { return _mOrderStatus; } set { _mOrderStatus = value; OnStaticPropertyChanged(); } }
+ private static string _mOrderStatus = "无意义";
+
public static event EventHandler StaticPropertyChanged;
public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
{
diff --git a/BPASmartClient.JXJFoodSmallStation/ViewModel/StockBinRawMaterialViewModel.cs b/BPASmartClient.JXJFoodSmallStation/ViewModel/StockBinRawMaterialViewModel.cs
new file mode 100644
index 00000000..c7ecea4d
--- /dev/null
+++ b/BPASmartClient.JXJFoodSmallStation/ViewModel/StockBinRawMaterialViewModel.cs
@@ -0,0 +1,55 @@
+using BPASmartClient.CustomResource.Pages.Model;
+using BPASmartClient.CustomResource.UserControls;
+using BPASmartClient.CustomResource.UserControls.MessageShow;
+using BPASmartClient.Helper;
+using BPASmartClient.JXJFoodSmallStation.Model;
+using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodSmallStation.ViewModel
+{
+ public class StockBinRawMaterialViewModel : ObservableObject
+ {
+ public StockBinRawMaterialViewModel()
+ {
+ RawMaterialInfo = Json.Data.rawMaterialStockBin;
+ RemoveCommand = new RelayCommand((loc) =>
+ {
+ if (loc is int pos)
+ {
+ var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == pos);
+ if (res != null) RawMaterialInfo.Remove(res);
+ }
+ });
+ SaveRawMaterialPara = new RelayCommand(() =>
+ {
+ Json.Save();
+ ProcessControl.GetInstance.testData();
+ foreach (var item in Json.Data.rawMaterialStockBin)
+ {
+ MessageNotify.GetInstance.ShowUserLog($"料仓位置:"+ item.RawMaterialLocation+ ",物料编码:" + item.RawMaterialName);
+ }
+ MessageNotify.GetInstance.ShowUserLog($"原料与料仓对应关系保存成功");
+ NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
+ });
+ UpdateRawMaterial = new RelayCommand(() =>
+ {
+ RawMaterialInfo.Add(new RawMaterialStockBin() { RawMaterialCount = (short)(RawMaterialInfo.Count + 1)});
+ });
+ }
+ public ObservableCollection RawMaterialInfo { get; set; } = new ObservableCollection();
+ public RelayCommand RemoveCommand { get; set; }
+ public RelayCommand SaveRawMaterialPara { get; set; }
+ public RelayCommand UpdateRawMaterial { get; set; }
+ }
+}
diff --git a/BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj b/BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj
index ef6914fa..a21a359c 100644
--- a/BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj
+++ b/BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj
@@ -7,6 +7,7 @@
+
diff --git a/BPASmartClient.JakaRobot/JaKaHelper.cs b/BPASmartClient.JakaRobot/JaKaHelper.cs
index b6f259c4..1402fff6 100644
--- a/BPASmartClient.JakaRobot/JaKaHelper.cs
+++ b/BPASmartClient.JakaRobot/JaKaHelper.cs
@@ -1,4 +1,5 @@
-using BPASmartClient.Message;
+using BPASmartClient.Helper;
+using BPASmartClient.Message;
using System.Text;
namespace BPASmartClient.JakaRobot
@@ -72,44 +73,50 @@ namespace BPASmartClient.JakaRobot
//private JaKaHelper() { }
public bool IsIdle { get; set; } = false;
public bool IsConnected { get { return login; } }
+ public bool IsDeviceFirstInit { get; set; }
public void Connect(string ip)
{
bool ErrorFlag = false;
- while (rshd == -1 || login == false)
+ ThreadManage.GetInstance().StartLong(new Action(() =>
{
- try
+ if (rshd == -1 || login == false)
{
- jakaAPI.create_handler(ip.ToCharArray(), ref rshd);
-
- login = true;
+ try
+ {
+ jakaAPI.create_handler(ip.ToCharArray(), ref rshd);
+ login = true;
- }
- catch (Exception ex)
- {
- if (!ErrorFlag)
+ }
+ catch (Exception ex)
{
- MessageLog.GetInstance.ShowEx(ex.ToString());
- ErrorFlag = true;
- login = false;
+ if (!ErrorFlag)
+ {
+ MessageLog.GetInstance.ShowEx(ex.ToString());
+ ErrorFlag = true;
+ login = false;
+ }
+ Thread.Sleep(3000);
}
- Thread.Sleep(3000);
- }
- }
- if (login)
- {
- try
- {
- Power_On();//打开机器人电源
- Thread.Sleep(1000);
- Enable_robot();//机器人上使能
- MessageLog.GetInstance.Show("机器人已上电使能");
- }
- catch (Exception ex)
+ }
+ if (login && IsDeviceFirstInit==false)
{
- MessageLog.GetInstance.ShowEx("机器人未完成上电和使能");
+ try
+ {
+ Power_On();//打开机器人电源
+ Thread.Sleep(1000);
+ Enable_robot();//机器人上使能
+ IsDeviceFirstInit = true;
+ MessageLog.GetInstance.Show("机器人已上电使能");
+ }
+ catch (Exception ex)
+ {
+ MessageLog.GetInstance.ShowEx("机器人未完成上电和使能");
+ }
}
- }
+ Thread.Sleep(5000);
+ }), $"节卡机器人连接", true);
+
}
public void Power_On()
{
@@ -319,13 +326,14 @@ namespace BPASmartClient.JakaRobot
try
{
//加载
- file = Programname.ToCharArray();
+ p: file = Programname.ToCharArray();
MessageLog.GetInstance.Show($"调用文件名:{Programname}");
status = new JKTYPE.ProgramState();
jakaAPI.get_program_state(ref rshd, ref status);
if (status != JKTYPE.ProgramState.PROGRAM_IDLE)
{
MessageLog.GetInstance.Show($"程序运行中,无法加载程序!!!");
+ goto p;
}
else
{
@@ -336,11 +344,13 @@ namespace BPASmartClient.JakaRobot
else
{
MessageLog.GetInstance.Show($"加载程序失败!!!");
+ goto p;
}
}
if (status == JKTYPE.ProgramState.PROGRAM_RUNNING)
{
MessageLog.GetInstance.Show($"程序处于已处于启动状态!!!");
+ goto p;
}
else if (status == JKTYPE.ProgramState.PROGRAM_IDLE)
{
@@ -349,6 +359,7 @@ namespace BPASmartClient.JakaRobot
if (jakafile.Length == 0)
{
MessageLog.GetInstance.Show($"未加载程序,无法运行!!!");
+ goto p;
}
else
{
diff --git a/BPASmartClient.MilkTeaCube/BPASmartClient.MilkTeaCube.csproj b/BPASmartClient.MilkTeaCube/BPASmartClient.MilkTeaCube.csproj
new file mode 100644
index 00000000..fda73f31
--- /dev/null
+++ b/BPASmartClient.MilkTeaCube/BPASmartClient.MilkTeaCube.csproj
@@ -0,0 +1,14 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.MilkTeaCube/MilkTeaCubeMachine.cs b/BPASmartClient.MilkTeaCube/MilkTeaCubeMachine.cs
new file mode 100644
index 00000000..33c678a4
--- /dev/null
+++ b/BPASmartClient.MilkTeaCube/MilkTeaCubeMachine.cs
@@ -0,0 +1,90 @@
+using BPASmartClient.Peripheral;
+using System;
+using BPASmartClient.Modbus;
+using BPASmartClient.Helper;
+using System.Threading;
+using BPASmartClient.Model.̲ζħ;
+using BPASmartClient.EventBus;
+using static BPASmartClient.EventBus.EventBus;
+
+namespace BPASmartClient.MilkTeaCube
+{
+ public class MilkTeaCubeMachine: BasePeripheral
+ {
+ public ModbusTcp modbus =new ModbusTcp();
+ public override void Init()
+ {
+ modbus.ModbusTcpConnect(communicationPar.IPAddress);
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ IsConnected = modbus.Connected;
+ if (!IsConnected) IsWork = false;
+ if (IsConnected)
+ {
+ IsWork = true;
+ if (status != null)
+ {
+ var a = modbus.Read("LB0");
+ var b = modbus.Read("LB13");
+ if (a is bool[] a1 && b is bool[] b1)
+ {
+ SetStatus("Get_MilkTeaCubeStatus", a1[0]);
+ SetStatus("Get_MilkTeaCubeDosingStatus", b1[0]);
+ }
+ }
+ Thread.Sleep(500);
+ }
+ Thread.Sleep(1000);
+ }), $"̲ζħ豸", true);
+ EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
+ {
+ if (@event == null) return;
+ var par = @event as MilkTea_MakeMilkTeaEvent;
+ switch (par?.TagName)
+ {
+ case "Start":
+ modbus.Write("LB14",true);
+ break;
+ case "ParameterSet":
+ modbus.Write("LB14", false);
+ Thread.Sleep(500);
+ modbus.Write("LW1002", par.MilkTeaKind[0]);
+ modbus.Write("LW1006", par.MilkTeaKind[1]);
+ modbus.Write("LW1008", par.MilkTeaKind[2]);
+ modbus.Write("LW1010", par.MilkTeaKind[3]);
+ modbus.Write("LW1012", par.MilkTeaKind[4]);
+ modbus.Write("LW1014", par.MilkTeaKind[5]);
+ modbus.Write("LW1016", par.MilkTeaKind[6]);
+ modbus.Write("LW1018", par.MilkTeaKind[7]);
+ modbus.Write("LW1020", par.MilkTeaKind[8]);
+ modbus.Write("LW1022", par.MilkTeaKind[9]);
+ modbus.Write("LW1024", par.MilkTeaKind[10]);
+ modbus.Write("LW1026", par.MilkTeaKind[11]);
+
+ break;
+ case "StartSignReset":
+ modbus.Write("LB14", false);
+ break;
+ default:
+ break;
+ }
+ });
+ }
+ public override void Start()
+ {
+ }
+
+ public override void Stop()
+ {
+ }
+
+ public override void WriteData(string address, object value)
+ {
+
+ }
+
+ protected override void InitStatus()
+ {
+ }
+ }
+}
diff --git a/BPASmartClient.MilkTeaCubeHelper/BPASmartClient.MilkTeaCubeHelper.csproj b/BPASmartClient.MilkTeaCubeHelper/BPASmartClient.MilkTeaCubeHelper.csproj
new file mode 100644
index 00000000..9a7c06f1
--- /dev/null
+++ b/BPASmartClient.MilkTeaCubeHelper/BPASmartClient.MilkTeaCubeHelper.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net6.0-windows
+ enable
+ true
+
+
+
diff --git a/BPASmartClient.MilkTeaCubeHelper/Class1.cs b/BPASmartClient.MilkTeaCubeHelper/Class1.cs
new file mode 100644
index 00000000..360d0ef4
--- /dev/null
+++ b/BPASmartClient.MilkTeaCubeHelper/Class1.cs
@@ -0,0 +1,8 @@
+using System;
+
+namespace BPASmartClient.MilkTeaCubeHelper
+{
+ public class Class1
+ {
+ }
+}
diff --git a/BPASmartClient.Model/奶茶味魔方/MilkTeaCubeEvent.cs b/BPASmartClient.Model/奶茶味魔方/MilkTeaCubeEvent.cs
new file mode 100644
index 00000000..bdf075a3
--- /dev/null
+++ b/BPASmartClient.Model/奶茶味魔方/MilkTeaCubeEvent.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.Model.奶茶味魔方
+{
+ public class MilkTea_MakeMilkTeaEvent : BaseEvent
+ {
+ public ushort[] MilkTeaKind { get; set; } = new ushort[12];
+ }
+}
diff --git a/BPASmartClient.Model/电夹爪/GripperEvent.cs b/BPASmartClient.Model/电夹爪/GripperEvent.cs
new file mode 100644
index 00000000..bbe03d78
--- /dev/null
+++ b/BPASmartClient.Model/电夹爪/GripperEvent.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.Model.电夹爪
+{
+ public class Wrtie : WriteGripper { }
+}
diff --git a/BPASmartClient.Model/电夹爪/WriteGripper.cs b/BPASmartClient.Model/电夹爪/WriteGripper.cs
new file mode 100644
index 00000000..18c12702
--- /dev/null
+++ b/BPASmartClient.Model/电夹爪/WriteGripper.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.Model.电夹爪
+{
+ public class WriteGripper:BaseEvent
+ {
+ public string CH_Number { get; set; }
+ public string PWMOutput { get; set; }
+ }
+}
diff --git a/BPASmartClient.Model/节卡机器人/JakaModel.cs b/BPASmartClient.Model/节卡机器人/JakaModel.cs
index 00d4702f..5ac5aace 100644
--- a/BPASmartClient.Model/节卡机器人/JakaModel.cs
+++ b/BPASmartClient.Model/节卡机器人/JakaModel.cs
@@ -8,31 +8,82 @@ namespace BPASmartClient.Model
{
public class JakaModel
{
- public const string SENCE_取杯 = "10000";
- public const string SENCE_放杯位检测 = "10100";
- public const string SENCE_取杯检测 = "11000";
-
- public const string SENCE_接咖啡 = "12000";
- public const string SENCE_接果汁1 = "12001";
- public const string SENCE_接果汁2 = "12002";
- public const string SENCE_接果汁3 = "12003";
- public const string SENCE_接果汁4 = "12004";
- public const string SENCE_接茶 = "12005";
- public const string SENCE_接水 = "12006";
- public const string SENCE_接茶_接水 = "12007";
-
- public const string SENCE_放咖啡杯 = "13000";//接饮料位---放饮料过渡位
- public const string SENCE_放果汁杯1 = "13001";
- public const string SENCE_放果汁杯2 = "13002";
- public const string SENCE_放果汁杯3 = "13003";
- public const string SENCE_放果汁杯4 = "13004";
- public const string SENCE_放茶水杯 = "13005";
-
- public const string SENCE_放杯 = "14000";//放杯过渡位到-放杯
-
- public const string SENCE_放杯检测 = "15000";
-
- public const string SENCE_初始位 = "20000";
+ public const string SENCE_初始位 = "1000";
+
+ public const string SENCE_初始位_取杯位 = "1010";
+
+ public const string SENCE_取杯位_取杯放杯检测位 = "1011";
+
+ public const string SENCE_取杯放杯检测位_取杯位 = "1012";
+
+ public const string SENCE_取杯位_接咖啡位 = "1020";
+
+ public const string SENCE_取杯位_接奶茶位 = "1021";
+
+ public const string SENCE_等奶茶_接奶茶位 = "1022";
+
+ public const string SENCE_接咖啡位_放咖啡位 = "1030";
+
+ public const string SENCE_接奶茶位_放奶茶位 = "1031";
+
+ public const string SENCE_落杯 = "1100";
+
+ public const string SENCE_初始位_取杯位检测 = "1200";
+
+ public const string SENCE_取杯位检测_取杯位 = "1300";
+
+ public const string SENCE_取杯位_接咖啡 = "1400";
+
+ public const string SENCE_取杯位_接奶茶 = "1500";
+
+ public const string SENCE_初始位_放杯位检测 = "1600";
+
+ public const string SENCE_放杯位检测_接咖啡 = "1610";
+
+ public const string SENCE_放杯位检测_接奶茶 = "1620";
+
+ public const string SENCE_接咖啡_放杯位 = "1700";
+
+ public const string SENCE_接奶茶_放杯位 = "1800";
+
+ public const string SENCE_异常回初始位 = "1900";
+
+ public const string SENCE_接咖啡_初始位 = "1910";
+
+ public const string SENCE_接奶茶_初始位 = "1920";
+
+ public const string SENCE_放杯位_初始位 = "2000";
+
+
+
+ public const string SENCE_初始位_落杯位 = "100";
+
+ public const string SENCE_落杯位_接咖啡位 = "110";
+
+ public const string SENCE_接咖啡位_初始位 = "120";
+
+ public const string SENCE_落杯位_接奶茶等待位 = "150";
+
+ public const string SENCE_接奶茶等待位_初始位 = "160";
+
+
+ public const string SENCE_接咖啡_放咖啡杯 = "";
+ public const string SENCE_接水 = "";
+ public const string SENCE_放茶水杯 = "";
+ public const string SENCE_接茶_接水 = "";
+ public const string SENCE_接果汁1 = "";
+ public const string SENCE_接果汁2 = "";
+ public const string SENCE_接果汁3 = "";
+ public const string SENCE_接果汁4 = "";
+ public const string SENCE_放果汁杯1 = "";
+ public const string SENCE_放果汁杯2 = "";
+ public const string SENCE_放果汁杯3 = "";
+ public const string SENCE_放果汁杯4 = "";
+ public const string SENCE_取杯检测 = "";
+ public const string SENCE_放杯 = "";
+ public const string SENCE_放杯检测 = "";
+ public const string SENCE_接茶 = "";
+
}
public class WriteJaka : BaseEvent
@@ -48,6 +99,10 @@ namespace BPASmartClient.Model
public ushort Length { get; set; }
public object ReadPar { get; set; }
}
-
+ public enum Kind:int
+ {
+ 咖啡 = 1,
+ 奶茶 = 2
+ }
}
diff --git a/BPASmartClient.MorkBF/Control_MorkBF.cs b/BPASmartClient.MorkBF/Control_MorkBF.cs
index 91fef0bb..d720c09a 100644
--- a/BPASmartClient.MorkBF/Control_MorkBF.cs
+++ b/BPASmartClient.MorkBF/Control_MorkBF.cs
@@ -37,7 +37,7 @@ namespace BPASmartClient.MorkBF
ActionManage.GetInstance.Register(new Action(() =>
{
GlobalFoodMenu.LocalFoodMenus.Clear();
- if(BPASmartClient.Helper.Json.Data.FryPotMessage.Count>0)
+ if (BPASmartClient.Helper.Json.Data.FryPotMessage.Count > 0)
{
foreach (var item in BPASmartClient.Helper.Json.Data.FryPotMessage)
{
@@ -50,7 +50,8 @@ namespace BPASmartClient.MorkBF
DataParse();//数据解析
ScreenDataServer();//大屏数据上报
ActionManage.GetInstance.Send("更新菜单");
- //ThreadManage.GetInstance().Start(FirePot1_Process, "炒锅1流程");
+ ThreadManage.GetInstance().Start(FirePot1_Process, "炒锅1流程");
+ ThreadManage.GetInstance().Start(FirePot2_Process, "炒锅2流程");
DeviceProcessLogShow("MORKF 设备初始化完成");
}
@@ -97,23 +98,26 @@ namespace BPASmartClient.MorkBF
private void CommandRegist()
{
#region 炒锅
- ActionManage.GetInstance.Register(FirePot_SetFireGear, "FirePot_SetFireGear");//炒锅设定加热挡位
+ ActionManage.GetInstance.Register(FirePot_SetFireGear, "FirePot_SetFireGear");//炒锅设定加热挡位1-5
+ ActionManage.GetInstance.Register(FirePot_SetStirGear, "FirePot_SetStirGear");//炒锅设定搅拌挡位1-5
+ ActionManage.GetInstance.Register(FirePot_SetTurnSpeed, "FirePot_SetTurnSpeed");//炒锅翻转速度0-800
+ ActionManage.GetInstance.Register(FirePot_SetPotAngle, "FirePot_SetPotAngle");//设定炒锅角度挡位1-4
+ ActionManage.GetInstance.Register(FirePot_StartPassWay, "FirePot_StartPassWay");//通道出料需求值+启动
+
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_PotGotoInFoodPosition, "FirePot_PotGotoInFoodPosition");//炒锅去投料位置
ActionManage.GetInstance.Register(FirePot_StartOutFood, "FirePot_StartOutFood");//出餐启动
ActionManage.GetInstance.Register(FirePot_Clean, "FirePot_Clean");//清洗
+
+ ActionManage.GetInstance.Register(FirePot_Reset, "FirePot_Reset");//复位;
ActionManage.GetInstance.Register(FirePot_StartPumpWater, "FirePot_StartPumpWater");//抽水启动
ActionManage.GetInstance.Register(FirePot_StartPumpWater, "FirePot_StopPumpWater");//抽水关闭
+ ActionManage.GetInstance.Register(FirePot_PotGotoInFoodPosition, "FirePot_PotGotoInFoodPosition");//炒锅去投料位置
+
ActionManage.GetInstance.Register(FirePot_PushReach, "FirePot_PushReach");//推杆伸出
ActionManage.GetInstance.Register(FirePot_PushRetract, "FirePot_PushRetract");//推杆缩回
ActionManage.GetInstance.Register(FirePot_PotForward, "FirePot_PotForward");//翻转正转
@@ -129,12 +133,11 @@ namespace BPASmartClient.MorkBF
public override void MainTask()
{
-
if(morkBF.RobotActinQueue.Count>0&&! morkBF.Robot_Start)//机器人启动
{
if( morkBF.RobotActinQueue.TryDequeue(out RobotAction_Pot robotAction))
{
- morkBF.Robot_IsBusy =true;
+ morkBF.Robot_IsBusy = true;
RobotProcess(robotAction);
}
}
@@ -142,11 +145,10 @@ namespace BPASmartClient.MorkBF
private void FirePot1_Process()
{
- if (morkBF.FirePan1_Order.Count > 0 && morkBF.FirePot1_InitCompleted && morkBF.FirePot2_IsAuto && !morkBF.FirePan1_Busy)
+ if (morkBF.FirePan1_Order.Count > 0 && morkBF.FryPan1_InitComplete && morkBF.FryPan1_ManualOrAutoMode && !morkBF.FirePan1_Busy)
{
if (morkBF.FirePan1_Order.TryDequeue(out FryPotMessages result))
{
-
morkBF.FirePan1_Busy = true;
morkBF.FryPot1_CurrentProcess = result.fryPotProcesses;
foreach (var item in result.fryPotProcesses)
@@ -178,17 +180,56 @@ namespace BPASmartClient.MorkBF
}
}
FirePot_StartFire(new object[] { 1, false });//关火
- Thread.Sleep(result.FryOffStirTime*1000);//关火翻炒时间
+ Thread.Sleep(result.FryOffStirTime * 1000);//关火翻炒时间
FirePot_StartStir(new object[] { 1, false });//关闭搅拌
Message.MessageLog.GetInstance.Show($"炒锅1炒制{result.GoodName}完成");
}
}
}
-
private void FirePot2_Process()
{
-
+ if (morkBF.FirePan2_Order.Count > 0 && morkBF.FryPan2_InitComplete && morkBF.FryPan2_ManualOrAutoMode && !morkBF.FirePan2_Busy)
+ {
+ if (morkBF.FirePan2_Order.TryDequeue(out FryPotMessages result))
+ {
+ morkBF.FirePan2_Busy = true;
+ morkBF.FryPot2_CurrentProcess = result.fryPotProcesses;
+ foreach (var item in result.fryPotProcesses)
+ {
+ switch (item.fryActions)
+ {
+ case FryAction.冷锅加热:
+ FirePot_PotPerHeat(item, 2);
+ MessageLog.GetInstance.Show("炒锅2---冷锅加热完成");
+ break;
+ case FryAction.热油:
+ FirePot_HeatOil(item, 2);
+ MessageLog.GetInstance.Show("炒锅2---热油完成");
+ break;
+ case FryAction.机器人加调料:
+ FirePot_RobotGetSeasoning(item, 2);
+ MessageLog.GetInstance.Show("炒锅2---机器人加调料完成");
+ break;
+ case FryAction.通道出调料:
+ FirePot_PasswayOutSeasoning(item, 2);
+ MessageLog.GetInstance.Show("炒锅2---通道出调料完成");
+ break;
+ case FryAction.炒制菜品:
+ FirePot_FryFood(item, 2);
+ MessageLog.GetInstance.Show("炒锅2---炒制菜品完成");
+ 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}完成");
+
+ }
+ }
}
@@ -223,7 +264,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotPerHeat(FryPotProcess item,int i)
{
bool isRobotWork = false;
-
+
FirePot_SetFireGear(new object[]{ i, item.FryGear});//设定加热挡位
FirePot_StartFire(new object[] { i, true });
isRobotWork = IsRobotNextWork(i,item.FryTime);//下个流程动作是否需要机器人
@@ -318,7 +359,7 @@ namespace BPASmartClient.MorkBF
{
Thread.Sleep(300);
}
- if((int)robotAction.subTask1>0&& (int)robotAction.subTask1<16)//任务1
+ if ((int)robotAction.subTask1 > 0 && (int)robotAction.subTask1 < 16)//任务1
{
Robot_Write("GI1", (int)robotAction.subTask1);
Thread.Sleep(1000);
@@ -327,7 +368,7 @@ namespace BPASmartClient.MorkBF
Thread.Sleep(300);
}
}
- if((int)robotAction.subTask1>15) //出餐
+ if ((int)robotAction.subTask1 > 15) //出餐
{
}
@@ -368,104 +409,85 @@ namespace BPASmartClient.MorkBF
MessageLog.GetInstance.Show($"机器人完成[{robotAction.MainTask.ToString()}]任务");
}
+ ///
+ /// PLC——>上位机(PLC反馈的数据)
+ ///
public override void ReadData()
{
- GetStatus("M20.0",new Action((o)=>
+ GetStatus("M40.0",new Action((o)=>
{
if (o == null) return;
- if(o is bool[] values&&values.Length == 19)
- {
- morkBF.FirePot1_InitCompleted = values[0];
- morkBF.FirePot1_IsAuto = values[1];
- morkBF.FirePot1_Emergencystop = values[2];
- morkBF.FirePot1_MealTubExist = values[3];
- morkBF.FirePot1_VegetablesTub1Exist = values[4];
- morkBF.FirePot1_VegetablesTub2Exist = values[5];
- morkBF.FirePot1_Seasoning1Exist = values[6];
- morkBF.FirePot1_Seasoning2Exist = values[7];
- morkBF.FirePot1_Accessories1Exist = values[8];
- morkBF.FirePot1_Accessories2Exist = values[9];
- morkBF.FirePot1_OutFoodTubExist = values[10];
- morkBF.FirePot1_OnOrigin = values[11];
- morkBF.FirePot1_FirePosition1 = values[12];
- morkBF.FirePot1_FirePosition2 = values[13];
- morkBF.FirePot1_FirePosition3 = values[14];
- morkBF.FirePot1_FirePosition4 = values[15];
- morkBF.FirePot1_PotOnOutFoodPosition = values[16];
- morkBF.FirePot1_PotOnIntoFoodPosition = values[17];
- morkBF.FirePot1_PotOnCleanPosition = values[18];
-
- }
- }),0);
-
- GetStatus("VW120", new Action((o) =>
- {
- if (o == null) return;
- if (o is int[] values&&values.Length == 2)
+ if(o is bool[] values&&values.Length == 18)
{
- morkBF.FirePot1_Temperature = values[0];
- morkBF.FirePot1_Pulse = values[1];
-
+ morkBF.FryPan1_InitComplete = values[0];
+ morkBF.FryPan1_ManualOrAutoMode = values[1];
+ morkBF.FryPan1_EStop = values[2];
+ morkBF.FryPan1_InPosition1 = values[3];
+ morkBF.FryPan1_InPosition2 = values[4];
+ morkBF.FryPan1_InPosition3 = values[5];
+ morkBF.FryPan1_InPosition4 = values[6];
+ morkBF.FryPan1_InPositionUnload = values[7];
+ morkBF.FryPan1_InPositionload = values[8];
+ morkBF.FryPan1_InPositionWashPot = values[9];
+ morkBF.FryPan1_UnloadFinishCH1 = values[10];
+ morkBF.FryPan1_UnloadFinishCH2 = values[11];
+ morkBF.FryPan1_UnloadFinishCH3 = values[12];
+ morkBF.FryPan1_UnloadFinishCH4 = values[13];
+ morkBF.FryPan1_UnloadFinishCH5 = values[14];
+ morkBF.FryPan1_UnloadFinishCH6 = values[15];
+ morkBF.FryPan1_UnloadFinishCH7 = values[16];
+ morkBF.FryPan1_UnloadFinishCH8 = values[17];
}
- }), 0);
-
- GetStatus("M25.0", new Action((o) =>
- {
- if (o == null) return;
- if (o is bool[] values&& values.Length == 19)
- {
- morkBF.FirePot2_InitCompleted = values[0];
- morkBF.FirePot2_IsAuto = values[1];
- morkBF.FirePot2_Emergencystop = values[2];
- morkBF.FirePot2_MealTubExist = values[3];
- morkBF.FirePot2_VegetablesTub1Exist = values[4];
- morkBF.FirePot2_VegetablesTub2Exist = values[5];
- morkBF.FirePot2_Seasoning1Exist = values[6];
- morkBF.FirePot2_Seasoning2Exist = values[7];
- morkBF.FirePot2_Accessories1Exist = values[8];
- morkBF.FirePot2_Accessories2Exist = values[9];
- morkBF.FirePot2_OutFoodTubExist = values[10];
- morkBF.FirePot2_OnOrigin = values[11];
- morkBF.FirePot2_FirePosition1 = values[12];
- morkBF.FirePot2_FirePosition2 = values[13];
- morkBF.FirePot2_FirePosition3 = values[14];
- morkBF.FirePot2_FirePosition4 = values[15];
- morkBF.FirePot2_PotOnOutFoodPosition = values[16];
- morkBF.FirePot2_PotOnIntoFoodPosition = values[17];
- morkBF.FirePot2_PotOnCleanPosition = values[18];
-
- }
- }), 0);
+ }),0);
- GetStatus("VW150", new Action((o) =>
+ GetStatus("VW200", new Action((o) =>
{
if (o == null) return;
- if (o is int[] values&& values.Length == 2)
+ if (o is short[] values&&values.Length == 4)
{
- morkBF.FirePot2_Temperature = values[0];
- morkBF.FirePot2_Pulse = values[1];
-
+ morkBF.FryPan1_TemperatureNow = values[0];
+ morkBF.FryPan1_MixingSpeedNow = values[1];
+ morkBF.FryPan1_FryAngle = values[2];
+ morkBF.FryPan1_HeatingGearNow = values[3];
}
}), 0);
-
-
- GetStatus("VW2250", new Action((o) =>
+ GetStatus("M40.0", new Action((o) =>
{
if (o == null) return;
- if (o is int[] values && values.Length == 1)
+ if (o is bool[] values && values.Length == 18)
{
- dataReport.FirePot1_PotState = values[0];
+ morkBF.FryPan2_InitComplete = values[0];
+ morkBF.FryPan2_ManualOrAutoMode = values[1];
+ morkBF.FryPan2_EStop = values[2];
+ morkBF.FryPan2_InPosition1 = values[3];
+ morkBF.FryPan2_InPosition2 = values[4];
+ morkBF.FryPan2_InPosition3 = values[5];
+ morkBF.FryPan2_InPosition4 = values[6];
+ morkBF.FryPan2_InPositionUnload = values[7];
+ morkBF.FryPan2_InPositionload = values[8];
+ morkBF.FryPan2_InPositionWashPot = values[9];
+ morkBF.FryPan2_UnloadFinishCH1 = values[10];
+ morkBF.FryPan2_UnloadFinishCH2 = values[11];
+ morkBF.FryPan2_UnloadFinishCH3 = values[12];
+ morkBF.FryPan2_UnloadFinishCH4 = values[13];
+ morkBF.FryPan2_UnloadFinishCH5 = values[14];
+ morkBF.FryPan2_UnloadFinishCH6 = values[15];
+ morkBF.FryPan2_UnloadFinishCH7 = values[16];
+ morkBF.FryPan2_UnloadFinishCH8 = values[17];
}
}), 1);
- GetStatus("VW2350", new Action((o) =>
+
+ GetStatus("VW200", new Action((o) =>
{
if (o == null) return;
- if (o is int[] values && values.Length == 1)
+ if (o is short[] values && values.Length == 4)
{
- dataReport.FirePot2_PotState = values[0];
+ morkBF.FryPan2_TemperatureNow = values[0];
+ morkBF.FryPan2_MixingSpeedNow = values[1];
+ morkBF.FryPan2_FryAngle = values[2];
+ morkBF.FryPan2_HeatingGearNow = values[3];
}
}), 1);
-
}
public override void ResetProgram()
@@ -538,133 +560,130 @@ namespace BPASmartClient.MorkBF
Thread.Sleep(200);
}
///
- /// 炒锅1加热启停
+ /// 炒锅1设置搅拌挡位
///
- ///
- private void FirePot_StartFire(object[] o)
+ ///
+ private void FirePot_SetStirGear(object[] o)
{
if (o == null) return;
- if (o.Length == 2 && o[0] is int fryNo && o[1] is bool value)
+ if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
if (fryNo == 1)
{
- FirePot1_Write("M10.0", value);
+ FirePot1_Write("VW102", (ushort)value);
}
else if (fryNo == 2)
{
- FirePot2_Write("M10.0", value);
+ FirePot2_Write("VW102", (ushort)value);
}
}
Thread.Sleep(200);
- }
+ }
///
- /// 炒锅1设置搅拌挡位
+ /// 设置炒锅翻转速度
///
///
- private void FirePot_SetStirGear(object[] o)
+ private void FirePot_SetTurnSpeed(object[] o)
{
if (o == null) return;
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
if (fryNo == 1)
{
- FirePot1_Write("VW102", (ushort)value);
+ FirePot1_Write("VW104", (ushort)value);
}
else if (fryNo == 2)
{
- FirePot2_Write("VW102", (ushort)value);
+ FirePot2_Write("VW104", (ushort)value);
}
}
Thread.Sleep(200);
}
///
- /// 炒锅1搅拌启停
+ /// 设定炒锅角度
///
///
- private void FirePot_StartStir(object[] o)
+ private void FirePot_SetPotAngle(object[] o)
{
if (o == null) return;
- if (o.Length == 2 && o[0] is int fryNo && o[1] is bool value)
+ if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
if (fryNo == 1)
{
- FirePot1_Write("M10.1", value);
+ FirePot1_Write("VW106", (ushort)value);
}
else if (fryNo == 2)
{
- FirePot2_Write("M10.1", value);
+ FirePot2_Write("VW106", (ushort)value);
}
}
Thread.Sleep(200);
}
///
- /// 设置炒锅1翻转速度
+ /// 通道出料启动
///
///
- private void FirePot_SetTurnSpeed(object[] o)
+ private void FirePot_StartPassWay(object[] o)
{
if (o == null) return;
- if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
+ if (o.Length == 3 && o[0] is int fryNo && o[1] is int value1 && o[2] is int value2)
{
if (fryNo == 1)
{
- FirePot1_Write("VW104", (ushort)value);
+ FirePot1_Write(morkBF.Fire_PasswayValue[value1], (ushort)value2);//写入需求值
+ Thread.Sleep(200);
+ FirePot1_Write(morkBF.Fire_PasswayWrite[value1], true);//启动通道
}
else if (fryNo == 2)
{
- FirePot2_Write("VW104", (ushort)value);
+ FirePot2_Write(morkBF.Fire_PasswayValue[value1], (ushort)value2);
+ Thread.Sleep(200);
+ FirePot2_Write(morkBF.Fire_PasswayWrite[value1], true);
}
}
Thread.Sleep(200);
}
///
- /// 设定炒锅角度
+ /// 炒锅1加热启停
///
- ///
- private void FirePot_SetPotAngle(object[] o)
+ ///
+ private void FirePot_StartFire(object[] o)
{
if (o == null) return;
- if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
+ if (o.Length == 2 && o[0] is int fryNo && o[1] is bool value)
{
if (fryNo == 1)
{
- FirePot1_Write("VW106", (ushort)value);
+ FirePot1_Write("M10.0", value);
}
else if (fryNo == 2)
{
- FirePot2_Write("VW106", (ushort)value);
+ FirePot2_Write("M10.0", value);
}
}
Thread.Sleep(200);
- }
-
+ }
+
///
- /// 通道出料启动
+ /// 炒锅搅拌启停
///
///
- private void FirePot_StartPassWay(object[] o)
+ private void FirePot_StartStir(object[] o)
{
if (o == null) return;
- if (o.Length == 3 && o[0] is int fryNo && o[1] is int value1&& o[2] is int value2)
+ if (o.Length == 2 && o[0] is int fryNo && o[1] is bool value)
{
if (fryNo == 1)
{
- FirePot1_Write(morkBF.Fire_PasswayValue[value1], (ushort)value2);//写入需求值
- Thread.Sleep(200);
- FirePot1_Write(morkBF.Fire_PasswayWrite[value1], true);//启动通道哦
+ FirePot1_Write("M10.1", value);
}
else if (fryNo == 2)
{
- FirePot2_Write(morkBF.Fire_PasswayValue[value1], (ushort)value2);
- Thread.Sleep(200);
- FirePot2_Write(morkBF.Fire_PasswayWrite[value1], true);
+ FirePot2_Write("M10.1", value);
}
}
Thread.Sleep(200);
}
-
-
-
///
/// 炒锅复位
///
@@ -683,46 +702,103 @@ namespace BPASmartClient.MorkBF
}
}
-
-
}
///
- /// 炒锅回原点
+ /// 炒锅设定加热挡位 锁定
///
///
- private void FirePot_PotGotoOrigin(object o)
+ private void FirePot_SetFireGearLock(object[] o)
{
if (o == null) return;
- if (o is int i)
+ if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
- if (i == 1)
+ if (fryNo == 1)
{
- FirePot1_Write("M10.5", true);
+ FirePot1_Write("M10.2", value);
}
- else if (i == 2)
+ else if (fryNo == 2)
{
- FirePot2_Write("M10.5", true);
+ FirePot2_Write("M10.2", value);
}
}
Thread.Sleep(200);
}
-
///
- /// 炒锅去投料位置
+ /// 炒锅1设置搅拌挡位锁定
///
///
- private void FirePot_PotGotoInFoodPosition(object o)
+ private void FirePot_SetStirGearLock(object[] o)
+ {
+ if (o == null) return;
+ if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
+ {
+ if (fryNo == 1)
+ {
+ FirePot1_Write("M10.3", value);
+ }
+ else if (fryNo == 2)
+ {
+ FirePot1_Write("M10.3", value);
+ }
+ }
+ Thread.Sleep(200);
+ }
+ ///
+ /// 设置炒锅翻转速度锁定
+ ///
+ ///
+ private void FirePot_SetTurnSpeedLock(object[] o)
+ {
+ if (o == null) return;
+ if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
+ {
+ if (fryNo == 1)
+ {
+ FirePot1_Write("M10.4", value);
+ }
+ else if (fryNo == 2)
+ {
+ FirePot1_Write("M10.4", value);
+ }
+ }
+ Thread.Sleep(200);
+ }
+ ///
+ /// 设定炒锅角度值锁定
+ ///
+ ///
+ private void FirePot_SetPotAngleLock(object[] o)
+ {
+ if (o == null) return;
+ if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
+ {
+ if (fryNo == 1)
+ {
+ FirePot1_Write("M11.1", value);
+ }
+ else if (fryNo == 2)
+ {
+ FirePot1_Write("M11.1", value);
+ }
+ }
+ Thread.Sleep(200);
+ }
+ ///
+ /// 炒锅回原点
+ ///
+ ///
+ private void FirePot_PotGotoOrigin(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
- FirePot1_Write("M11.2", true);
+ FirePot1_Write("M10.5", true);
}
else if (i == 2)
{
- FirePot2_Write("M11.2", true);
+ FirePot2_Write("M10.5", true);
}
}
Thread.Sleep(200);
@@ -758,7 +834,7 @@ namespace BPASmartClient.MorkBF
{
if (i == 1)
{
- FirePot1_Write("M10.7", true);
+ FirePot1_Write("M10.7", true);
}
else if (i == 2)
@@ -768,8 +844,9 @@ namespace BPASmartClient.MorkBF
}
Thread.Sleep(200);
}
+
///
- /// 抽水启动
+ /// 抽洗锅水启动
///
///
private void FirePot_StartPumpWater(object[] o)
@@ -788,6 +865,26 @@ namespace BPASmartClient.MorkBF
}
Thread.Sleep(200);
}
+ ///
+ /// 炒锅去投料位置
+ ///
+ ///
+ private void FirePot_PotGotoInFoodPosition(object o)
+ {
+ if (o == null) return;
+ if (o is int i)
+ {
+ if (i == 1)
+ {
+ FirePot1_Write("M11.2", true);
+ }
+ else if (i == 2)
+ {
+ FirePot2_Write("M11.2", true);
+ }
+ }
+ Thread.Sleep(200);
+ }
///
/// 推杆伸出
@@ -922,8 +1019,8 @@ namespace BPASmartClient.MorkBF
ScreenModelMaxWok maxWok = new ScreenModelMaxWok
{
IsRun = IsHealth ? IsRun.运行 : IsRun.停止,
- WorkStatus_1 = morkBF.FirePot1_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机,
- WorkStatus_2 = morkBF.FirePot2_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机,
+ WorkStatus_1 = morkBF.FryPan1_TemperatureNow > 0 ? WorkStatus.工作 : WorkStatus.待机,
+ WorkStatus_2 = morkBF.FryPan2_TemperatureNow > 0 ? WorkStatus.工作 : WorkStatus.待机,
RobotStatu = WorkStatus.工作,
Alarm = new List(),
FailuresCount = 0,
@@ -934,12 +1031,12 @@ namespace BPASmartClient.MorkBF
MaxWok_Task_2 = ((PotState)dataReport.FirePot2_PotState).ToString(),
MaxWok_Process_1 = SetFirePotPorcess(new Random().Next(0,11)),
MaxWok_Process_2 = SetFirePotPorcess(new Random().Next(0, 11)),
- MaxWok_HeatGear_1 = morkBF.FirePot1_FireGear.ToString(),
- MaxWok_HeatGear_2 = morkBF.FirePot2_FireGear.ToString(),
- MaxWok_StirGear_1 = morkBF.FirePot1_StirGear.ToString(),
- MaxWok_StirGear_2 = morkBF.FirePot2_StirGear.ToString(),
- MaxWok_FlipSpeed_1 = morkBF.FirePot1_FlipSpeed.ToString(),
- MaxWok_FlipSpeed_2 = morkBF.FirePot2_FlipSpeed.ToString(),
+ MaxWok_HeatGear_1 = morkBF.FryPan1_HeatingGearNow.ToString(),
+ MaxWok_HeatGear_2 = morkBF.FryPan2_HeatingGearNow.ToString(),
+ MaxWok_StirGear_1 = morkBF.FryPan1_FryAngle.ToString(),
+ MaxWok_StirGear_2 = morkBF.FryPan2_FryAngle.ToString(),
+ MaxWok_FlipSpeed_1 = morkBF.FryPan1_MixingSpeedNow.ToString(),
+ MaxWok_FlipSpeed_2 = morkBF.FryPan2_MixingSpeedNow.ToString(),
MaxWok_Temp_1 = new Random().Next(250, 450).ToString(),
MaxWok_Temp_2 = new Random().Next(250, 450).ToString(),
MaxWok_OrderCount_1 = 2,
@@ -959,17 +1056,17 @@ namespace BPASmartClient.MorkBF
{
if (potState > 0)
{
- if(potState <=3)
+ if (potState <= 3)
{
SetState(2);
}
- else if(potState>3&&potState < 9) SetState(3);
- else if(potState == 9) SetState(4);
+ else if (potState > 3 && potState < 9) SetState(3);
+ else if (potState == 9) SetState(4);
else if (potState == 10) SetState(5);
}
- else
- {
- foreach(var item in dataReport.processModels)
+ else
+ {
+ foreach (var item in dataReport.processModels)
{
item.Status = ProcessStatus.未执行;
}
@@ -987,8 +1084,8 @@ namespace BPASmartClient.MorkBF
{
dataReport.processModels[i].Status = ProcessStatus.正在执行;
}
- else if( i c ) dataReport.processModels[i].Status = ProcessStatus.未执行;
+ else if (i < c) dataReport.processModels[i].Status = ProcessStatus.执行完成;
+ else if (i > c) dataReport.processModels[i].Status = ProcessStatus.未执行;
}
}
}
diff --git a/BPASmartClient.MorkBF/GVL_MorkBF.cs b/BPASmartClient.MorkBF/GVL_MorkBF.cs
index 0fd64e11..33ce20b4 100644
--- a/BPASmartClient.MorkBF/GVL_MorkBF.cs
+++ b/BPASmartClient.MorkBF/GVL_MorkBF.cs
@@ -41,8 +41,8 @@ namespace BPASmartClient.MorkBF
///
public List FryPot2_CurrentProcess;
-
- #region 炒锅1读取数据
+ #region 旧数据
+ /*#region 炒锅1读取数据
///
/// 炒锅1锅低温度
///
@@ -155,7 +155,6 @@ namespace BPASmartClient.MorkBF
public int FirePot1_FlipSpeed { get; set; } = 0;
#endregion
-
#region 炒锅2读取数据
///
/// 炒锅2锅低温度
@@ -325,6 +324,7 @@ namespace BPASmartClient.MorkBF
//[VariableMonitor("机器人动作反馈GI4", "GI4", "4")]
//public int Robot_GI4ActionCallback { get; set; }
+ #endregion*/
#endregion
//新版大炒的通讯协议 2023/01/15
#region 炒锅1读取数据
@@ -480,7 +480,7 @@ namespace BPASmartClient.MorkBF
public Dictionary FirePot2_CompleteSingle { get; set; }
-
+
public GVL_MorkBF()
{
diff --git a/BPASmartClient.MorkS3/Alarm.cs b/BPASmartClient.MorkS3/Alarm.cs
new file mode 100644
index 00000000..895427e0
--- /dev/null
+++ b/BPASmartClient.MorkS3/Alarm.cs
@@ -0,0 +1,204 @@
+using BPASmartClient.Device;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkS3
+{
+ public class Alarm : IAlarm
+ {
+ ///
+ /// 煮面机左侧低温报警
+ /// PLC ---> M230.0
+ /// ModbusTcp --> 1570
+ ///
+ [Alarm("煮面机左侧低温报警")]
+ public bool MachineLeftLowTemperature { get; set; }
+
+ ///
+ /// 煮面机左侧低温报警
+ /// PLC ---> M230.1
+ /// ModbusTcp --> 1571
+ ///
+ [Alarm("煮面机右侧低温报警")]
+ public bool MachineRightLowTemperature { get; set; }
+
+ ///
+ /// 供碗1缺碗
+ /// PLC ---> 230.2
+ /// ModbusTcp --> 1572
+ ///
+ [Alarm("供碗1缺碗")]
+ public bool Supply1_LossBowl { get; set; }
+
+ ///
+ /// 供碗2缺碗
+ /// PLC ---> M230.3
+ /// ModbusTcp --> 1573
+ ///
+ [Alarm("供碗2缺碗")]
+ public bool Supply2_LossBowl { get; set; }
+
+ ///
+ /// 供碗1出碗检测异常
+ /// PLC ---> M230.4
+ /// ModbusTcp --> 1574
+ ///
+ [Alarm("供碗1出碗检测异常")]
+ public bool Supply1_ErrorOutBowl { get; set; }
+
+ ///
+ /// 供碗2出碗检测异常
+ /// PLC ---> M230.5
+ /// ModbusTcp --> 1575
+ ///
+ [Alarm("供碗2出碗检测异常")]
+ public bool Supply2_ErrorOutBowl { get; set; }
+
+ ///
+ /// 推碗气缸故障
+ /// PLC ---> M230.6
+ /// ModbusTcp --> 1576
+ ///
+ [Alarm("推碗气缸故障")]
+ public bool PushBowlCylinderError { get; set; }
+
+ ///
+ /// 煮面机通讯异常
+ /// PLC ---> M230.7
+ /// ModbusTcp --> 1577
+ ///
+ [Alarm("煮面机通讯异常")]
+ public bool NoodleMacCommunicateError { get; set; }
+
+ ///
+ /// 配料机通讯异常
+ /// PLC ---> M231.0
+ /// ModbusTcp --> 1580
+ ///
+ [Alarm("配料机通讯异常")]
+ public bool DosingMacCommunicateError { get; set; }
+
+ ///
+ /// 机器人通讯异常
+ /// PLC ---> M231.1
+ /// ModbusTcp --> 1581
+ ///
+ [Alarm("机器人通讯异常")]
+ public bool RobotMacCommunicateError { get; set; }
+
+ ///
+ /// 机器人通讯异常
+ /// PLC ---> M231.2
+ /// ModbusTcp --> 1581
+ ///
+ [Alarm("设备急停")]
+ public bool DeviceEstop { get; set; }
+
+ ///
+ /// PLC电池电压低
+ /// PLC ---> M231.3
+ /// ModbusTcp --> 1583
+ ///
+ [Alarm("PLC电池电压低")]
+ public bool RobotInitError { get; set; }
+
+ ///
+ /// 机器人急停
+ /// PLC ---> M231.4
+ /// ModbusTcp --> 1584
+ ///
+ [Alarm("机器人急停")]
+ public bool RobotUrgentStop { get; set; }
+
+ ///
+ /// 机器人不在远程模式
+ /// PLC ---> M231.5
+ /// ModbusTcp --> 1585
+ ///
+ [Alarm("机器人不在远程模式")]
+ public bool RobotNotInRemoteMode { get; set; }
+
+ ///
+ /// 机器人伺服未就绪
+ /// PLC ---> M231.6
+ /// ModbusTcp --> 1586
+ ///
+ [Alarm("机器人伺服未就绪")]
+ public bool RobotNotInReady { get; set; }
+
+ ///
+ /// 机器人本体异常
+ /// PLC ---> M231.7
+ /// ModbusTcp --> 1587
+ ///
+ [Alarm("机器人本体异常")]
+ public bool RobotSelfInException { get; set; }
+
+ ///
+ /// 煮面机左侧缺水
+ /// PLC ---> M232.0
+ /// ModbusTcp --> 1570
+ ///
+ [Alarm("煮面机左侧缺水报警")]
+ public bool LeftLackWater { get; set; }
+
+ ///
+ /// 煮面机右侧缺水
+ /// PLC ---> M232.1
+ /// ModbusTcp --> 1571
+ ///
+ [Alarm("煮面机右侧缺水报警")]
+ public bool RightLackWater { get; set; }
+
+ ///
+ /// 丝杆初始化失败
+ /// PLC ---> M232.2
+ /// ModbusTcp --> 1571
+ ///
+ [Alarm("丝杆初始化失败")]
+ public bool SvrewInitFail { get; set; }
+
+ ///
+ /// 转盘初始化失败
+ /// PLC ---> M232.3
+ /// ModbusTcp --> 1571
+ ///
+ [Alarm("转盘初始化失败")]
+ public bool TurntableInitFail { get; set; }
+
+ ///
+ /// 机器人初始化失败
+ /// PLC ---> M232.4
+ /// ModbusTcp --> 1571
+ ///
+ [Alarm("机器人初始化失败")]
+ public bool RobotInitFail { get; set; }
+
+ ///
+ /// 煮面机初始化失败
+ /// PLC ---> M232.5
+ /// ModbusTcp --> 1571
+ ///
+ [Alarm("煮面机初始化失败")]
+ public bool NoodleCookerInitFail { get; set; }
+
+ ///
+ /// 推碗1步进推杆初始化失败
+ /// PLC ---> M232.6
+ /// ModbusTcp --> 1571
+ ///
+ [Alarm("推碗1步进推杆初始化失败")]
+ public bool PushBowlInitFail1 { get; set; }
+
+ ///
+ /// 推碗2步进推杆初始化失败
+ /// PLC ---> M232.7
+ /// ModbusTcp --> 1571
+ ///
+ [Alarm("推碗2步进推杆初始化失败")]
+ public bool PushBowlInitFail2 { get; set; }
+ }
+}
diff --git a/BPASmartClient.MorkS3/BPASmartClient.MorkS3.csproj b/BPASmartClient.MorkS3/BPASmartClient.MorkS3.csproj
new file mode 100644
index 00000000..c781b773
--- /dev/null
+++ b/BPASmartClient.MorkS3/BPASmartClient.MorkS3.csproj
@@ -0,0 +1,28 @@
+
+
+
+ net6.0-windows
+ enable
+ true
+ bin\
+ portable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.MorkS3/Control_Morks.cs b/BPASmartClient.MorkS3/Control_Morks.cs
new file mode 100644
index 00000000..3ca33215
--- /dev/null
+++ b/BPASmartClient.MorkS3/Control_Morks.cs
@@ -0,0 +1,891 @@
+using System;
+using System.Collections.Generic;
+using BPA.Message.Enum;
+using BPASmartClient.Device;
+using BPASmartClient.EventBus;
+using BPASmartClient.Model;
+using BPASmartClient.Peripheral;
+using static BPASmartClient.EventBus.EventBus;
+using BPASmartClient.Helper;
+using System.Threading;
+using BPASmartClient.Message;
+using BPA.Message;
+using System.Linq;
+using BPASmartClient.Model.PLC;
+using System.Threading.Tasks;
+using System.Reflection;
+using BPASmartClient.MorkS3.Model;
+using System.Collections.ObjectModel;
+using BPASmartClient.MorkS3.ViewModel;
+using BPASmartClient.Business;
+using BPASmartClient.Model.小炒机;
+using BPA.Models;
+using System.Speech.Synthesis;
+using System.Windows.Forms;
+using System.Media;
+
+namespace BPASmartClient.MorkS3
+{
+ public class Control_Morks : BaseDevice
+ {
+ public override DeviceClientType DeviceType => DeviceClientType.MORKS;
+ GVL_MORKS mORKS = new GVL_MORKS();
+ Alarm alarm = new Alarm();
+
+ public override void DoMain()
+ {
+ MonitorViewModel.DeviceId = DeviceId;
+ ServerInit();
+ DataParse();
+ Json.Read();
+ Json.Read();
+ if (Json.Data.parSets == null) Json.Data.parSets = new ObservableCollection();
+ if (Json.Data.parSets.Count < 6)
+ {
+ Json.Data.parSets.Clear();
+ for (int i = 0; i < 6; i++)
+ {
+ Json.Data.parSets.Add(new ParSet()
+ {
+ CheckBoxContext = $"煮面口{i + 1}屏蔽",
+ Minute = 1,
+ Second = 0,
+ IsShield = false,
+ TextBlockContext = $"煮面口{i + 1}时间设定"
+ });
+ }
+ }
+
+ ActionManage.GetInstance.Register(new Action((o) =>
+ {
+ if (o.Length > 0)
+ {
+ Random rd = new Random();
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ int NoodleLoc = (int)o[0] == 0 ? rd.Next(1, 6) : (int)o[0];
+ int BowlLoc = (int)o[1] == 0 ? rd.Next(10, 12) : (int)o[1];
+
+ string guid = new Guid().ToString();
+
+ mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid });
+ MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】");
+
+ mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid });
+ MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】");
+ Thread.Sleep(60000);
+ }), "ForOrder");
+ }
+ }), "EnableForOrder");
+
+ ActionManage.GetInstance.Register(new Action((o) =>
+ {
+ if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
+ }), "WriteVW");
+ ActionManage.GetInstance.Register(new Action((o) =>
+ {
+ if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
+ }), "WriteBools");
+ ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice");
+ }
+
+ public override void ResetProgram()
+ {
+ mORKS = null;
+ mORKS = new GVL_MORKS();
+ }
+
+ public override void Stop()
+ {
+
+ }
+
+ private void ServerInit()
+ {
+ //物料信息
+ EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
+ {
+ if (@event == null) return;
+ if (@event is MaterialDeliveryEvent material)
+ {
+ orderMaterialDelivery = material.orderMaterialDelivery;
+ }
+ });
+
+ //配方数据信息
+ EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
+ {
+ if (@event == null) return;
+ if (@event is RecipeBomEvent recipe)
+ {
+ recipeBoms = recipe.recipeBoms;
+ WriteRecipeBoms();
+ }
+ });
+
+
+ }
+
+ private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
+ {
+ var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
+ string goodName = string.Empty;
+ string SortNum = string.Empty;
+ if (res != null)
+ {
+ goodName = res.MorkOrder.GoodsName;
+ SortNum = res.MorkOrder.SortNum.ToString();
+ }
+
+ EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
+
+ var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum);
+ if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count)
+ {
+ if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK)
+ {
+ DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index);
+ DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel()
+ {
+ Status = oRDER_STATUS,
+ GoodName = goodName,
+ SortNum = SortNum,
+ StopTime = DateTime.Now.ToString("HH:mm:ss")
+ });
+ }
+ else if (oRDER_STATUS == ORDER_STATUS.COMPLETED_TAKE)
+ {
+ var temp = DataServer.GetInstance.morkS.MakeOrderOver.FirstOrDefault(p => p.SortNum == SortNum);
+ if (temp != null) DataServer.GetInstance.morkS.MakeOrderOver.Remove(temp);
+ }
+ else
+ {
+ DataServer.GetInstance.morkS.MakeOrder.ElementAt(index).Status = oRDER_STATUS;
+ }
+ }
+ else
+ {
+ DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel()
+ {
+ Status = oRDER_STATUS,
+ GoodName = goodName,
+ SortNum = SortNum,
+ StartTime = DateTime.Now.ToString("HH:mm:ss")
+ });
+ }
+ }
+
+ private void GetStatus(string key, Action action)
+ {
+ if (peripheralStatus.ContainsKey(key))
+ {
+ if (peripheralStatus[key] != null)
+ {
+ action?.Invoke(peripheralStatus[key]);
+ }
+ }
+ }
+
+ public override void ReadData()
+ {
+ DataServer.GetInstance.morkS.Alarm.Clear();
+ alarms.ForEach(item =>
+ {
+ DataServer.GetInstance.morkS.Alarm.Add(new AlarmModel()
+ {
+ AlarmTime = $"{item.Date} {item.Time}",
+ AlarmMs = item.Info
+ });
+ });
+
+ GetStatus("M230.0", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 24)
+ {
+ alarm.MachineLeftLowTemperature = bools[0];
+ alarm.MachineRightLowTemperature = bools[1];
+ alarm.Supply1_LossBowl = bools[2];
+ alarm.Supply2_LossBowl = bools[3];
+ alarm.Supply1_ErrorOutBowl = bools[4];
+ alarm.Supply2_ErrorOutBowl = bools[5];
+ alarm.PushBowlCylinderError = bools[6];
+ alarm.NoodleMacCommunicateError = bools[7];
+ alarm.DosingMacCommunicateError = bools[8];
+ alarm.RobotMacCommunicateError = bools[9];
+ alarm.DeviceEstop = bools[10];
+ alarm.RobotInitError = bools[11];
+ alarm.RobotUrgentStop = bools[12];
+ alarm.RobotNotInRemoteMode = bools[13];
+ alarm.RobotNotInReady = bools[14];
+ alarm.RobotSelfInException = bools[15];
+ alarm.LeftLackWater = bools[16];
+ alarm.RightLackWater = bools[17];
+ alarm.SvrewInitFail = bools[18];
+ alarm.TurntableInitFail = bools[19];
+ alarm.RobotInitFail = bools[20];
+ alarm.NoodleCookerInitFail = bools[21];
+ alarm.PushBowlInitFail1 = bools[22];
+ alarm.PushBowlInitFail2 = bools[23];
+ }
+ }));
+
+ GetStatus("M0.3", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 3)
+ {
+ mORKS.RobotTakeNoodle = bools[0];
+ mORKS.RobotOutMeal = bools[1];
+ mORKS.MoveTurntable = bools[2];
+ }
+ }));
+
+ GetStatus("M100.0", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 16)
+ {
+ mORKS.InitComplete = bools[0];
+ mORKS.TakeBowlIdle = bools[1];
+ mORKS.TemperatureReached = bools[2];
+ mORKS.AllowFallNoodle = bools[3];
+ mORKS.RbTakeNoodleComplete = bools[4];
+ mORKS.RbFallNoodleComplete = bools[5];
+ mORKS.RbOutMealComplete = bools[6];
+ mORKS.RobotIdle = bools[7];
+ mORKS.TakeMealDetect = bools[8];
+ mORKS.MissingBowl = bools[9];
+ Initing = bools[10];
+ mORKS.TurntableLowerLimit = bools[11];
+ mORKS.MissingBowlSignal2 = bools[12];
+ mORKS.TurntableUpLimit = bools[13];
+ mORKS.FeedComplete = bools[14];
+ mORKS.TurntableMoveInPlace = bools[15];
+ DataServer.GetInstance.morkS.MorkS_Temp = mORKS.TemperatureReached;
+ DataServer.GetInstance.morkS.Morks_SiloMeasUp = mORKS.TurntableUpLimit;
+ DataServer.GetInstance.morkS.Morks_SiloMeasDown = mORKS.TurntableLowerLimit;
+ DataServer.GetInstance.morkS.MorkS_NoBowMeas1 = mORKS.MissingBowl;
+ DataServer.GetInstance.morkS.MorkS_NoBowMeas2 = mORKS.MissingBowlSignal2;
+ }
+
+ }));
+
+ GetStatus("M235.0", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1)
+ {
+ mORKS.Error = bools[0];
+ }
+ }));
+
+
+ GetStatus("M102.0", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7)
+ {
+ for (int i = 0; i < 6; i++)
+ {
+ mORKS.NoodleCookerStatus[i] = bools[i];
+ }
+ mORKS.Feeding = bools[6];
+ }
+ }));
+
+ GetStatus("M103.0", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 6)
+ {
+ for (int i = 0; i < 6; i++)
+ {
+ mORKS.CookNoodlesComplete[i] = bools[i];
+ DataServer.GetInstance.morkS.Morks_NoodleUpOrDown[i] = bools[i];
+ }
+ }
+
+ }));
+
+ GetStatus("VW372", new Action((obj) =>
+ {
+ if (obj is ushort[] UshortValue && UshortValue.Length > 0 && UshortValue.Length <= 1)
+ mORKS.TurntableFeedbackloc = UshortValue[0];
+ DataServer.GetInstance.morkS.MorkS_BinLocation = mORKS.TurntableFeedbackloc;
+ }));
+
+ GetStatus("M0.1", new Action((obj) =>
+ {
+ if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8)
+ {
+ for (int i = 0; i < 8; i++)
+ {
+ mORKS.InitComplete = bools[0];
+ }
+ }
+
+ }));
+ }
+
+ ///
+ /// 数据解析
+ ///
+ private void DataParse()
+ {
+ EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
+ {
+ if (@event == null) return;
+ if (@event is DoOrderEvent order)
+ {
+ mORKS.doOrderEvents.Add(order);
+ if (order.MorkOrder.GoodBatchings == null) return;
+ if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return;
+ OrderCount++;
+ if (DateTime.Now.Subtract(Json.Data.StatisticsTime).Days != 0)
+ Json.Data.Count = 0;
+ Json.Data.StatisticsTime = DateTime.Now;
+ Json.Data.Count++;
+ Json.Save();
+ OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
+ DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}");
+ mORKS.HistorySuborderId.Add(order.MorkOrder.SuborderId);
+ foreach (var item in order.MorkOrder.GoodBatchings)
+ {
+ var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
+ if (res != null)
+ {
+ if (ushort.TryParse(res.BatchingLoc, out ushort loc))
+ {
+ if (loc >= 1 && loc <= 5)
+ {
+ if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
+ mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { GoodName = order.MorkOrder.GoodsName, Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId });
+ }
+ else if (loc >= 10 && loc <= 11)
+ {
+ int index = 0;
+ if (recipeBoms != null)
+ {
+ index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId);
+ index++;
+ }
+ if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
+ mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
+ {
+ BatchingId = res.BatchingId,
+ GoodName = order.MorkOrder.GoodsName,
+ Loc = ushort.Parse(res.BatchingLoc),
+ SuborderId = order.MorkOrder.SuborderId,
+ RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0
+ });
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+
+ public override void MainTask()
+ {
+ mORKS.AllowRun = mORKS.InitComplete;
+ if (Json.Data.IsVerify)
+ IsHealth = mORKS.Error && mORKS.InitComplete;
+ else
+ IsHealth = true;
+
+ TakeBowlTask();
+
+ TakeNoodleTask();
+
+ OutNoodleTask();
+
+ SingleDetect();
+
+ TurntableControl();
+
+ var data = new List();
+ for (int i = 0; i < Json.Data.parSets.Count; i++)
+ {
+ data.Add(Json.Data.parSets.ElementAt(i).IsShield);
+ }
+
+ WriteControl("M260.0", data.ToArray());
+
+ }
+
+ private void BowlControl(OrderLocInfo orderLocInfo)
+ {
+ if (orderLocInfo.Loc >= 10 && orderLocInfo.Loc <= 11)
+ {
+ mORKS.TakeBowlId = orderLocInfo.SuborderId;
+ mORKS.TakeBowName = orderLocInfo.GoodName;
+ TakeBowlControl(orderLocInfo.Loc);
+ SetRecipeNumber(orderLocInfo.RecipeNumber);
+ OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
+ DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
+ mORKS.TakeBowlInterlock = true;
+ }
+ }
+
+ ///
+ /// 取碗控制
+ ///
+ private void TakeBowlTask()
+ {
+ if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.TakeBowlIdle && !mORKS.TakeBowlInterlock)
+ {
+ DeviceProcessLogShow("开始取碗流程");
+ ushort BowLoc = 0;
+ var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList();
+ if (res == null || res?.Count == 0)
+ {
+ if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) BowlControl(orderLocInfo);
+ }
+ else
+ {
+ foreach (var item in res)
+ {
+ if (ushort.TryParse(item.BatchingLoc, out ushort loc))
+ {
+ //DeviceProcessLogShow($"位置:={loc},检测开关1:{alarm.Supply1_LossBowl},检测开关1:{alarm.Supply2_LossBowl}");
+ if (loc == 10 && !alarm.Supply1_LossBowl)
+ {
+ BowLoc = loc;
+ break;
+ }
+ else if (loc == 11 && !alarm.Supply2_LossBowl)
+ {
+ BowLoc = loc;
+ break;
+ }
+ }
+ }
+
+ if (BowLoc >= 10 && BowLoc <= 11)
+ {
+ if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo))
+ {
+ orderLocInfo.Loc = BowLoc;
+ BowlControl(orderLocInfo);
+ }
+ }
+ }
+ }
+ }
+
+ ///
+ /// 转台控制
+ ///
+ private void TurntableControl()
+ {
+ if (Global.EnableLocalSimOrder)
+ {
+ //不做轮询,直接取面,模拟订单使用
+ if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
+ {
+ if (mORKS.TurntableLowerLimit)
+ {
+ TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc);
+ mORKS.TurntableLocLists.Clear();
+ mORKS.AllowTakeNoodle = true;
+ DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面");
+ }
+ }
+ }
+ else
+ {
+ //正常轮询
+ if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
+ {
+ var result = orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList();
+ if (result != null)
+ {
+ var res = result.FirstOrDefault(P => P.BatchingLoc == mORKS.TurntableFeedbackloc.ToString());
+ if (mORKS.TurntableLowerLimit && res != null)
+ {
+ TurntableStart(mORKS.TurntableFeedbackloc);
+ mORKS.TurntableLocLists.Clear();
+ mORKS.AllowTakeNoodle = true;
+ DeviceProcessLogShow($"控制机器人去转台【{mORKS.TurntableFeedbackloc}】号位置取面");
+ }
+ else
+ {
+ if (!mORKS.TurntableInterlock)
+ {
+ foreach (var item in result)
+ {
+ if (ushort.TryParse(item.BatchingLoc, out ushort loc))
+ {
+ if (mORKS.TurntableFeedbackloc != loc && !mORKS.TurntableLocLists.Contains(loc))
+ {
+ if (!mORKS.TurntableLowerLimit)
+ {
+ WriteData("M32.7", false);
+ DeviceProcessLogShow($"执行了转台启动互锁信号复位");
+ }
+ TurntableStart(loc);
+ DeviceProcessLogShow($"没有物料检测的启动转台控制,转台位置:[{loc}]");
+ break;
+ }
+ else if (mORKS.TurntableFeedbackloc == loc && !mORKS.TurntableLocLists.Contains(loc)) mORKS.TurntableLocLists.Add(loc);
+ }
+ }
+ }
+ }
+ }
+ else DeviceProcessLogShow("未找到可用的物料信息");
+ }
+ }
+
+ //if (DelayRTrig.GetInstance("互锁信号复位").Start(!mORKS.TurntableLowerLimit && mORKS.TurntableMoveInPlace, 2))
+ //{
+ // if (!mORKS.TurntableLowerLimit)
+ // {
+ // WriteData("M32.7", false);
+ // DeviceProcessLogShow($"执行了转台启动互锁信号复位");
+ // }
+ //}
+
+ //补料中检测
+ if (RTrig.GetInstance("mORKS.Feeding").Start(mORKS.Feeding))
+ {
+ mORKS.AllowTakeNoodle = false;
+ mORKS.TakeNoodleInterlock = false;
+ }
+
+ //转台到位检测
+ if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.TurntableMoveInPlace && mORKS.CurrentLoc == mORKS.TurntableFeedbackloc))
+ {
+ mORKS.CurrentLoc = 0;
+ mORKS.TurntableInterlock = false;
+ DeviceProcessLogShow("转台到位检测");
+ }
+
+ //补料完成检测
+ if (RTrig.GetInstance("FeedComplete").Start(mORKS.FeedComplete))
+ {
+ if (!mORKS.AllowTakeNoodle && mORKS.TurntableLocLists.Count > 0)
+ {
+ mORKS.TurntableLocLists.Clear();
+ mORKS.TurntableInterlock = false;
+ DeviceProcessLogShow("补料完成检测");
+ }
+ }
+
+ }
+
+ ///
+ /// 取面任务
+ ///
+ private void TakeNoodleTask()
+ {
+ //取面控制
+ if (mORKS.AllowRun && mORKS.RobotIdle && !mORKS.Feeding && !mORKS.RobotTaskInterlock && mORKS.AllowTakeNoodle && mORKS.TurntableMoveInPlace && !mORKS.TakeNoodleInterlock && !mORKS.OutNoodleing && mORKS.RBTakeNoodleTask.Count > 0)
+ {
+ int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置
+ if (loc >= 0 && loc <= 5)
+ {
+ if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo))
+ {
+ mORKS.CookNodelId[loc] = orderLocInfo.SuborderId;
+ SetFallNoodleLoc((ushort)(loc + 1));
+ //机器人开始取面
+ RobotTakeNoodle();
+ OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);
+ DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏");
+ //写入煮面时间
+ List values = new List();
+ values.Add(Json.Data.parSets.ElementAt(loc).Minute);
+ values.Add(Json.Data.parSets.ElementAt(loc).Second);
+ WriteData($"VW{116 + (loc * 6)}", values.ToArray());
+ mORKS.TakeNoodleInterlock = true;
+ }
+ }
+ }
+ }
+
+ ///
+ /// 出餐控制
+ ///
+ private void OutNoodleTask()
+ {
+ if (mORKS.AllowFallNoodle && mORKS.RobotTaskInterlock && !mORKS.TakeNoodleInterlock && mORKS.RobotIdle && !mORKS.TakeMealDetect)
+ {
+ int loc = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0);
+ if (loc >= 0 && loc <= 5)
+ {
+ if (mORKS.CookNoodlesComplete[loc])
+ {
+ SetTakeNoodleLoc((ushort)(loc + 1));
+ RobotOutMeal();
+ CookNoodleStatusReset((ushort)(loc + 1));
+ ResetAllowFallNoodle();
+
+
+ //新增,待测试
+ if (mORKS.RbOutMealComplete)
+ {
+ ResetCookComplete();
+ mORKS.CookCompleteFlatBit = false;
+ DeviceProcessLogShow("取餐过程中复位出餐完成信号");
+ }
+
+ if (!string.IsNullOrEmpty(mORKS.OutMealId)) OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
+ mORKS.OutMealId = mORKS.IngredientsCompleteId;
+ mORKS.OutMealName = mORKS.IngredientsCompleteName;
+ mORKS.IngredientsCompleteId = string.Empty;
+ mORKS.CookNodelId[loc] = string.Empty;
+ DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{ mORKS.OutMealId}");
+
+ mORKS.OutNoodleing = true;
+ }
+ }
+ }
+ }
+
+ ///
+ /// 信号检测
+ ///
+ private void SingleDetect()
+ {
+ //允许倒面信号检测
+ if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowFallNoodle))
+ {
+ mORKS.IngredientsCompleteId = mORKS.TakeBowlId;
+ mORKS.IngredientsCompleteName = mORKS.TakeBowName;
+ mORKS.TakeBowlId = string.Empty;
+ mORKS.TakeBowName = string.Empty;
+ DeviceProcessLogShow($"碗到位,允许到面,{mORKS.IngredientsCompleteId}");
+ mORKS.TakeBowlInterlock = false;
+ }
+
+ //出餐完成信号检测
+ if (RTrig.GetInstance("CompleteChange").Start(mORKS.RbOutMealComplete))
+ {
+ OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK);
+ DeviceProcessLogShow($"订单【{mORKS.OutMealId}】制作完成");
+ mORKS.CookCompleteFlatBit = true;
+ mORKS.OutNoodleing = false;
+ WaitMeaLSpeak(mORKS.OutMealName);
+ }
+
+ //取餐完成逻辑处理
+ if (Delay.GetInstance("CompleteChange1").Start(!mORKS.TakeMealDetect, 1) && mORKS.CookCompleteFlatBit == true)
+ {
+ OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
+ DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
+ ResetCookComplete();
+ mORKS.CookCompleteFlatBit = false;
+ mORKS.OutMealId = string.Empty;
+ mORKS.OutMealName = string.Empty;
+ }
+
+ //机器人取面完成信号检测
+ if (RTrig.GetInstance("TakeNoodleComplete").Start(mORKS.RbTakeNoodleComplete))
+ {
+ mORKS.TakeNoodleInterlock = false;
+ mORKS.AllowTakeNoodle = false;
+ mORKS.TurntableInterlock = false;
+ DeviceProcessLogShow("机器人取面完成信号检测");
+ TakeNoodleCompleteReset();
+ }
+
+ int OutMealRequstCount = mORKS.CookNoodlesComplete.Where(p => p == true).ToList().Count;
+ int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count;
+ int index = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId);
+
+ bool isok = index >= 0 && index < mORKS.CookNoodlesComplete.Length && mORKS.CookNoodlesComplete[index];
+
+ mORKS.PriorityJudgment = Delay.GetInstance("取餐优先级判断").Start(mORKS.TurntableLocLists.Count > 0 && !mORKS.TurntableLowerLimit, 4);
+ //mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowFallNoodle && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment);
+ mORKS.RobotTaskInterlock = isok && mORKS.AllowFallNoodle && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment);
+
+
+ }
+ ///
+ /// 语音提醒取餐
+ ///
+ ///
+ private void WaitMeaLSpeak(string meal)
+ {
+ VoiceAPI.m_SystemPlayWav(@"Vioce\电子提示音.wav");
+ Thread.Sleep(1000);
+ if (meal != null) mORKS.speech.Speak(meal);
+ VoiceAPI.m_SystemPlayWav(@"Vioce\取餐通知.wav");
+ }
+
+ #region PLC 控制函数
+
+ private void WriteData(string address, object value)
+ {
+ EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value });
+ }
+
+ ///
+ /// 写入配方数据到 PLC
+ ///
+ private void WriteRecipeBoms()
+ {
+ List recipeBoms = new List();
+ if (this.recipeBoms == null) return;
+ foreach (var item in this.recipeBoms.RecipeIds)
+ {
+ foreach (var rec in item.Recipes)
+ {
+ recipeBoms.Add((ushort)rec);
+ }
+ }
+ if (recipeBoms.Count > 0)
+ {
+ //配方数据地址范围:VW2000 - VW2278
+ WriteData("VW2000", recipeBoms.ToArray());
+ DeviceProcessLogShow("写配方成功");
+ }
+ else { DeviceProcessLogShow("配方数据为空"); }
+ }
+
+
+ ///
+ /// 取面完成复位
+ ///
+ private void TakeNoodleCompleteReset()
+ {
+ WriteData("M100.4", false);
+
+ }
+
+ ///
+ /// 指定煮面口状态复位
+ ///
+ ///
+ private void CookNoodleStatusReset(int num)
+ {
+ if (num >= 1 && num <= 6)
+ {
+ WriteData($"102.{num - 1}", false);
+ DeviceProcessLogShow($"{num}号煮面口占用复位");
+ }
+
+ }
+
+ ///
+ /// 写配方编号
+ ///
+ ///
+ private void SetRecipeNumber(ushort num)
+ {
+ WriteData("VW0", num);
+ }
+
+ ///
+ /// 启动转台
+ ///
+ ///
+ private void TurntableStart(ushort loc)
+ {
+ mORKS.CurrentLoc = loc;
+ mORKS.TurntableInterlock = true;
+ mORKS.TurntableLocLists.Add(loc);
+ WriteData("VW2", loc);
+ WriteData("M0.5", true);
+ }
+
+ ///
+ /// 设置倒面位置
+ ///
+ ///
+ private void SetFallNoodleLoc(ushort loc)
+ {
+ WriteData("VW4", loc);
+ }
+
+ ///
+ /// 设置取面位置
+ ///
+ ///
+ private void SetTakeNoodleLoc(ushort loc)
+ {
+ WriteData("VW6", loc);
+ }
+
+ ///
+ /// 取碗控制
+ ///
+ ///
+ private void TakeBowlControl(ushort loc)
+ {
+ if (loc == 10)//小碗
+ {
+ WriteData("M0.1", true);
+ }
+ else if (loc == 11)//大碗
+ {
+ WriteData("M0.2", true);
+ }
+ }
+
+ ///
+ /// 机器人取面
+ ///
+ private void RobotTakeNoodle()
+ {
+ WriteData("M0.3", true);
+ }
+
+ ///
+ /// 机器人取餐
+ ///
+ private void RobotOutMeal()
+ {
+ WriteData("M0.4", true);
+ }
+
+ ///
+ /// 制作完成信号复位
+ ///
+ private void ResetCookComplete()
+ {
+ WriteData("M100.6", false);
+ }
+
+ ///
+ /// 复位允许取面信号
+ ///
+ private void ResetAllowFallNoodle()
+ {
+ WriteData("M100.3", false);
+ }
+
+ ///
+ /// 设备初始化
+ ///
+ public async void DeviceInit()
+ {
+ WriteData("M0.0", true);
+ await Task.Delay(1000);
+ WriteData("M0.0", false);
+ }
+
+ public override void SimOrder()
+ {
+ EventBus.EventBus.GetInstance().Subscribe(0, delegate (IEvent @event, EventCallBackHandle callBackHandle)
+ {
+ if (@event != null && @event is MorksSimorderModel msm)
+ {
+ string guid = Guid.NewGuid().ToString();
+ if (msm.NoodleLoc >= 1 && msm.NoodleLoc <= 5)
+ {
+ mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.NoodleLoc, SuborderId = guid });
+ MessageLog.GetInstance.Show($"添加订单:面条位置【{(ushort)msm.NoodleLoc}】");
+ }
+
+ if (msm.Bowloc >= 10 && msm.Bowloc <= 11)
+ {
+ mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid });
+ MessageLog.GetInstance.Show($"添加订单:碗位置【{(ushort)msm.Bowloc}】");
+ }
+
+ }
+ });
+ }
+ #endregion
+
+
+ }
+}
diff --git a/BPASmartClient.MorkS3/DataServer.cs b/BPASmartClient.MorkS3/DataServer.cs
new file mode 100644
index 00000000..22062658
--- /dev/null
+++ b/BPASmartClient.MorkS3/DataServer.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using BPA.Helper;
+using BPASmartClient.MQTT;
+using BPA.Message;
+using BPASmartClient.Model;
+
+namespace BPASmartClient.MorkS3
+{
+ public class DataServer
+ {
+
+ private volatile static DataServer _Instance;
+ public static DataServer GetInstance => _Instance ?? (_Instance = new DataServer());
+ private DataServer() { }
+
+ public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS();
+
+ MQTTProxy mQTTProxy = new MQTTProxy();
+ public void Init()
+ {
+ mQTTProxy.Connected = new Action(() =>
+ {
+ mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ morkS.MorkS_OrderCount = Json.Data.Count;
+ SendScreenDataModel sendScreenDataModel = new SendScreenDataModel();
+ sendScreenDataModel.Name = ScreenDeviceType.煮面机;
+ sendScreenDataModel.Value = morkS.ToJSON();
+ mQTTProxy.Publish(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机), sendScreenDataModel.ToJSON());
+ Thread.Sleep(100);
+ }), "海科食堂大屏监听");
+ });
+ mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
+ }
+
+ //订单信息(正在制作,等待制作,制作完成)
+ //煮面炉上下状态(6个煮面炉上或下)
+ //温度状态(煮面炉温度是否到达)
+ //料仓位置(当前料仓在几号位置)
+ //料仓上下物料检测
+ //落碗机构缺碗检测
+ //机器人状态
+ //当日订单总量
+ //报警信息
+ }
+}
diff --git a/BPASmartClient.MorkS3/GVL_MORKS.cs b/BPASmartClient.MorkS3/GVL_MORKS.cs
new file mode 100644
index 00000000..9176e7be
--- /dev/null
+++ b/BPASmartClient.MorkS3/GVL_MORKS.cs
@@ -0,0 +1,376 @@
+using BPASmartClient.Device;
+using BPASmartClient.Model;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Speech.Synthesis;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkS3
+{
+ public class GVL_MORKS : IStatus
+ {
+ public List HistorySuborderId { get; set; } = new List();
+ ///
+ /// 机器人取面
+ /// PLC -> M0.3
+ /// ModbusTcp -> 323
+ ///
+ public bool RobotTakeNoodle { get; set; }
+
+ ///
+ /// 机器人出餐
+ /// PLC -> M0.4
+ /// ModbusTcp -> 324
+ ///
+ public bool RobotOutMeal { get; set; }
+
+ ///
+ /// 移动转台
+ /// PLC -> M0.5
+ /// ModbusTcp -> 325
+ ///
+ public bool MoveTurntable { get; set; }
+
+
+ #region 临时变量
+ ///
+ /// 允许运行
+ ///
+ //[Circuit(new string[] { "机器人取面", "取碗控制" }, "允许运行")]
+ [VariableMonitor("允许运行")]
+ public bool AllowRun { get; set; }
+
+ ///
+ /// 优先级判断
+ ///
+ [VariableMonitor("优先级判断条件")]
+ public bool PriorityJudgment { get; set; }
+
+ ///
+ /// 机器人任务互锁信号,false:取面,true:出餐
+ ///
+ //[Circuit(new string[] { "机器人取面", "出面控制" }, "机器人互锁", new bool[] { true, false })]
+ [VariableMonitor("机器人任务互锁信号")]
+ public bool RobotTaskInterlock { get; set; }
+
+ ///
+ /// 取碗互锁信号
+ ///
+ //[Circuit("取碗控制", "取碗互锁", true)]
+ [VariableMonitor("取碗互锁信号")]
+ public bool TakeBowlInterlock { get; set; }
+
+ ///
+ /// 取面互锁信号
+ ///
+ //[Circuit(new string[] { "机器人取面", "出面控制" }, "取面互锁信号", new bool[] { true, true })]
+ [VariableMonitor("取面互锁信号")]
+ public bool TakeNoodleInterlock { get; set; }
+
+ ///
+ /// 出面中
+ ///
+ //[Circuit("机器人取面", "出面中", true)]
+ [VariableMonitor("出面中")]
+ public bool OutNoodleing { get; set; }
+
+ ///
+ /// 允许取面
+ ///
+ //[Circuit(new string[] { "转台控制", "机器人取面" }, "允许取面", new bool[] { true, false })]
+ [VariableMonitor("允许取面")]
+ public bool AllowTakeNoodle { get; set; }
+
+ ///
+ /// 转台互锁信号
+ ///
+ [VariableMonitor("转台互锁信号")]
+ public bool TurntableInterlock { get; set; }
+ #endregion
+
+ ///
+ /// 初始化完成
+ /// PLC -> M100.0
+ /// ModbusTcp -> 1120
+ ///
+ //[Circuit(new string[] { "允许运行", "转台控制", "转台控制" }, "初始化完成")]
+ [VariableMonitor("初始化完成", "M100.0", "1120")]
+ public bool InitComplete { get; set; }
+
+ ///
+ /// 取碗机构空闲,True:忙碌,false:空闲
+ /// PLC -> M100.1
+ /// ModbusTcp -> 1121
+ ///
+ //[Circuit("取碗控制", "取碗机构空闲", true)]
+ [VariableMonitor("取碗机构空闲", "M100.1", "1121")]
+ public bool TakeBowlIdle { get; set; }
+
+ ///
+ /// 温度到达,True:表示到达,false:未到达
+ /// PLC -> M100.2
+ /// ModbusTcp -> 1122
+ ///
+ //[Circuit("允许运行", "温度到达")]
+ [VariableMonitor("温度到达", "M100.2", "1122")]
+ public bool TemperatureReached { get; set; }
+
+ ///
+ /// 允许到面,配料完成
+ /// PLC -> M100.3
+ /// ModbusTcp -> 1123
+ ///
+ //[Circuit("出面控制", "允许到面")]
+ [VariableMonitor("允许到面", "M100.3", "1123")]
+ public bool AllowFallNoodle { get; set; }
+
+ ///
+ /// 机器人取面完成
+ /// PLC -> M100.4
+ /// ModbusTcp -> 1124
+ ///
+ [VariableMonitor("机器人取面完成", "M100.4", "1124")]
+ public bool RbTakeNoodleComplete { get; set; }
+
+ ///
+ /// 机器人倒面完成
+ /// PLC -> M100.5
+ /// ModbusTcp -> 1125
+ ///
+ [VariableMonitor("机器人倒面完成", "M100.5", "1125")]
+ public bool RbFallNoodleComplete { get; set; }
+
+ ///
+ /// 机器人出餐完成,上报取餐完成
+ /// PLC -> M100.6
+ /// ModbusTcp -> 1126
+ ///
+ [VariableMonitor("机器人出餐完成", "M100.6", "1126")]
+ public bool RbOutMealComplete { get; set; }
+
+ ///
+ /// 机器人空闲
+ /// PLC -> M100.7
+ /// ModbusTcp -> 1127
+ ///
+ //[Circuit(new string[] { "机器人取面", "出面控制" }, "机器人空闲")]
+ [VariableMonitor("机器人空闲", "M100.7", "1127")]
+ public bool RobotIdle { get; set; }
+
+ ///
+ /// 取餐口检测
+ /// PLC -> M101.0
+ /// ModbusTcp -> 1128
+ ///
+ //[Circuit("出面控制", "取餐口检测", true)]
+ [VariableMonitor("取餐口检测", "M101.0", "1128")]
+ public bool TakeMealDetect { get; set; }
+
+ ///
+ /// 缺碗信号,false:缺碗,true:有碗
+ /// PLC -> M101.1
+ /// ModbusTcp -> 1129
+ ///
+ [VariableMonitor("缺碗信号", "M101.1", "1129")]
+ public bool MissingBowl { get; set; }
+
+ ///
+ /// 设备初始化中,执行中等于1,2秒后复位
+ /// PLC -> M101.2
+ /// ModbusTcp -> 1130
+ ///
+ [VariableMonitor("设备初始化中", "M101.2", "1130")]
+ public bool DeviceIniting { get; set; }
+
+ ///
+ /// 转台下限检测
+ /// PLC -> M101.3
+ /// ModbusTcp -> 1131
+ ///
+ //[Circuit("转台控制", "转台下限检测有物料")]
+ [VariableMonitor("转台下限检测", "M101.3", "1131")]
+ public bool TurntableLowerLimit { get; set; }
+
+ ///
+ /// 缺碗信号 2
+ /// PLC -> M101.4
+ /// ModbusTcp -> 1132
+ ///
+ [VariableMonitor("缺碗信号 2", "M101.4", "1132")]
+ public bool MissingBowlSignal2 { get; set; }
+
+ ///
+ /// 转台上限检测
+ /// PLC -> M101.5
+ /// ModbusTcp -> 1133
+ ///
+ [VariableMonitor("转台上限检测", "M101.5", "1133")]
+ public bool TurntableUpLimit { get; set; }
+
+ ///
+ /// 补料完成
+ /// PLC -> M101.6
+ /// ModbusTcp -> 1134
+ ///
+ [VariableMonitor("补料完成", "M101.6", "1134")]
+ public bool FeedComplete { get; set; }
+
+ ///
+ /// 转台移动到位
+ /// PLC -> M101.7
+ /// ModbusTcp -> 1135
+ ///
+ //[Circuit(new string[] { "转台控制", "机器人取面" }, "转台移动到位")]
+ [VariableMonitor("转台移动到位", "M101.7", "1135")]
+ public bool TurntableMoveInPlace { get; set; }
+
+ ///
+ /// 煮面炉状态,True:忙碌,false:空闲
+ /// M102.0 - M102.5
+ /// 1136 - 1141
+ ///
+ [VariableMonitor("煮面炉状态", "M102.0", "1136")]
+ public bool[] NoodleCookerStatus { get; set; } = new bool[6] { false, false, false, false, false, false };
+
+ ///
+ /// 补料中
+ /// M102.6
+ /// 1142
+ ///
+ [VariableMonitor("补料中", "M102.6", "1142")]
+ public bool Feeding { get; set; }
+
+ ///
+ /// 煮面完成,上升后给信号
+ /// M103.0 - M103.5
+ /// 1144 - 1149
+ ///
+ [VariableMonitor("煮面完成", "M103.0", "1144")]
+ public bool[] CookNoodlesComplete { get; set; } = new bool[6] { false, false, false, false, false, false };
+
+ ///
+ /// 硬件设备异常
+ /// PLC -> M235.0
+ /// True:设备正常,False:设备异常
+ ///
+ [VariableMonitor("硬件设备异常", "M235.0", "")]
+ public bool Error { get; set; } = false;
+
+ ///
+ /// 配方编号
+ /// PLC -> VW0
+ /// ModbusTcp -> 100
+ ///
+ [VariableMonitor("配方编号", "VW0", "100")]
+ public ushort RecipeNumber { get; set; }
+
+ ///
+ /// 转台设置位置
+ /// PLC -> VW2
+ /// ModbusTcp -> 101
+ ///
+ [VariableMonitor("转台设置位置", "VW2", "101")]
+ public ushort TurntableLoc { get; set; }
+
+ ///
+ /// 到面至煮面炉位置
+ /// PLC -> VW4
+ /// ModbusTcp -> 102
+ ///
+ [VariableMonitor("到面至煮面炉位置", "VW4", "102")]
+ public ushort FallNoodleLoc { get; set; }
+
+ ///
+ /// 取面位置
+ /// PLC -> VW6
+ /// ModbusTcp -> 103
+ ///
+ [VariableMonitor("取面位置", "VW6", "103")]
+ public ushort TakeNoodleLoc { get; set; }
+
+ ///
+ /// 转台反馈位置
+ /// PLC -> VW372
+ /// ModbusTcp -> 286
+ ///
+ [VariableMonitor("转台反馈位置", "VW372", "286")]
+ public ushort TurntableFeedbackloc { get; set; }
+
+ ///
+ /// 机器人取面位置队列
+ ///
+ //[Circuit(new string[] { "转台控制", "机器人取面" }, "有机器人取面队列")]
+ public ConcurrentQueue RBTakeNoodleTask { get; set; } = new ConcurrentQueue();
+
+ ///
+ /// 出碗队列
+ ///
+ //[Circuit("取碗控制", "有取碗队列数量")]
+ public ConcurrentQueue TakeBowlTask { get; set; } = new ConcurrentQueue();
+
+ public List doOrderEvents { get; set; } = new List();
+
+ ///
+ /// 是否有面条
+ ///
+ public bool IsNoodles { get; set; } = true;
+
+ ///
+ /// 制作完成标志
+ ///
+ [VariableMonitor("制作完成标志")]
+ public bool CookCompleteFlatBit { get; set; }
+
+
+ #region 订单ID记录
+ ///
+ /// 取碗订单ID
+ ///
+ public string TakeBowlId = string.Empty;
+ ///
+ /// 取碗订单名称
+ ///
+ public string TakeBowName = string.Empty;
+
+ ///
+ /// 配料完成订单ID
+ ///
+ public string IngredientsCompleteId = string.Empty;
+ ///
+ /// 配料完成订单名称
+ ///
+ public string IngredientsCompleteName = string.Empty;
+
+ ///
+ /// 煮面口对应的订单ID
+ ///
+ public string[] CookNodelId = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, };
+
+ ///
+ /// 出餐订单ID
+ ///
+ public string OutMealId = string.Empty;
+ ///
+ /// 出餐订单名称
+ ///
+ public string OutMealName = string.Empty;
+
+ ///
+ /// 转台位置轮询
+ ///
+ public List TurntableLocLists = new List();
+
+ ///
+ /// 转台当前启动位置
+ ///
+ [VariableMonitor("转台当前启动位置")]
+ public ushort CurrentLoc { get; set; } = 0;
+
+ public SpeechSynthesizer speech = new SpeechSynthesizer();
+
+ #endregion
+ }
+}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcWriteAddressDB7.cs b/BPASmartClient.MorkS3/Model/Global.cs
similarity index 52%
rename from BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcWriteAddressDB7.cs
rename to BPASmartClient.MorkS3/Model/Global.cs
index e083e60c..35819695 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcWriteAddressDB7.cs
+++ b/BPASmartClient.MorkS3/Model/Global.cs
@@ -4,10 +4,10 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
+namespace BPASmartClient.MorkS3.Model
{
- public class PlcWriteAddressDB7
+ public class Global
{
-
+ public static bool EnableLocalSimOrder { get; set; }
}
}
diff --git a/BPASmartClient.MorkS3/Model/MorksPar.cs b/BPASmartClient.MorkS3/Model/MorksPar.cs
new file mode 100644
index 00000000..5d499d39
--- /dev/null
+++ b/BPASmartClient.MorkS3/Model/MorksPar.cs
@@ -0,0 +1,16 @@
+using BPASmartClient.Model;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+
+namespace BPASmartClient.MorkS3.Model
+{
+ internal class MorksPar
+ {
+ public ObservableCollection parSets { get; set; } = new ObservableCollection();
+ }
+}
diff --git a/BPASmartClient.MorkS3/Model/ParSet.cs b/BPASmartClient.MorkS3/Model/ParSet.cs
new file mode 100644
index 00000000..03261db1
--- /dev/null
+++ b/BPASmartClient.MorkS3/Model/ParSet.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.Model
+{
+ public class ParSet
+ {
+ public ushort Minute { get { return _mMinute; } set { _mMinute = value; } }
+ private ushort _mMinute;
+
+ public ushort Second { get { return _mSecond; } set { _mSecond = value; } }
+ private ushort _mSecond;
+
+
+ public bool IsShield { get { return _mIsShield; } set { _mIsShield = value; } }
+ private bool _mIsShield;
+
+
+ public string TextBlockContext { get { return _mTextBlockContext; } set { _mTextBlockContext = value; } }
+ private string _mTextBlockContext;
+
+ public string CheckBoxContext { get { return _mCheckBoxContext; } set { _mCheckBoxContext = value; } }
+ private string _mCheckBoxContext;
+
+ }
+}
diff --git a/BPASmartClient.MorkS3/Model/WritePar.cs b/BPASmartClient.MorkS3/Model/WritePar.cs
new file mode 100644
index 00000000..24210bd8
--- /dev/null
+++ b/BPASmartClient.MorkS3/Model/WritePar.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkS3.Model
+{
+ public class WritePar
+ {
+ public string Address { get; set; }
+ public object Value { get; set; }
+ }
+}
diff --git a/BPASmartClient.MorkS3/OrderLocInfo.cs b/BPASmartClient.MorkS3/OrderLocInfo.cs
new file mode 100644
index 00000000..da71841a
--- /dev/null
+++ b/BPASmartClient.MorkS3/OrderLocInfo.cs
@@ -0,0 +1,23 @@
+using BPA.Message;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkS3
+{
+ public class OrderLocInfo
+ {
+ public string SuborderId { get; set; }
+ public ushort Loc { get; set; }
+ public ushort RecipeNumber { get; set; }
+ public int BatchingId { get; set; }
+ public string GoodName { get; set; }
+
+ public int RecipeId { get; set; }
+
+ public List Recipes { get; set; }
+
+ }
+}
diff --git a/BPASmartClient.MorkS3/View/Debug.xaml b/BPASmartClient.MorkS3/View/Debug.xaml
new file mode 100644
index 00000000..2f29c0ab
--- /dev/null
+++ b/BPASmartClient.MorkS3/View/Debug.xaml
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.MorkS3/View/Debug.xaml.cs b/BPASmartClient.MorkS3/View/Debug.xaml.cs
new file mode 100644
index 00000000..21616f44
--- /dev/null
+++ b/BPASmartClient.MorkS3/View/Debug.xaml.cs
@@ -0,0 +1,30 @@
+using BPASmartClient.MorkS3.Model;
+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.MorkS3.View
+{
+ ///
+ /// Debug.xaml 的交互逻辑
+ ///
+ public partial class Debug : UserControl
+ {
+ public Debug()
+ {
+ InitializeComponent();
+ }
+
+ }
+}
diff --git a/BPASmartClient.MorkS3/View/Monitor.xaml b/BPASmartClient.MorkS3/View/Monitor.xaml
new file mode 100644
index 00000000..8fcca0b4
--- /dev/null
+++ b/BPASmartClient.MorkS3/View/Monitor.xaml
@@ -0,0 +1,242 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.MorkS3/View/Monitor.xaml.cs b/BPASmartClient.MorkS3/View/Monitor.xaml.cs
new file mode 100644
index 00000000..7939c35a
--- /dev/null
+++ b/BPASmartClient.MorkS3/View/Monitor.xaml.cs
@@ -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.MorkS3.View
+{
+ ///
+ /// Monitor.xaml 的交互逻辑
+ ///
+ public partial class Monitor : UserControl
+ {
+ public Monitor()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BPASmartClient.MorkS3/View/ParSet.xaml b/BPASmartClient.MorkS3/View/ParSet.xaml
new file mode 100644
index 00000000..e4ef886e
--- /dev/null
+++ b/BPASmartClient.MorkS3/View/ParSet.xaml
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.MorkS3/View/ParSet.xaml.cs b/BPASmartClient.MorkS3/View/ParSet.xaml.cs
new file mode 100644
index 00000000..e2f93b94
--- /dev/null
+++ b/BPASmartClient.MorkS3/View/ParSet.xaml.cs
@@ -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.MorkS3.View
+{
+ ///
+ /// ParSet.xaml 的交互逻辑
+ ///
+ public partial class ParSet : UserControl
+ {
+ public ParSet()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BPASmartClient.MorkS3/ViewModel/DebugViewModel.cs b/BPASmartClient.MorkS3/ViewModel/DebugViewModel.cs
new file mode 100644
index 00000000..c51de0b1
--- /dev/null
+++ b/BPASmartClient.MorkS3/ViewModel/DebugViewModel.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BPASmartClient.Helper;
+using BPASmartClient.Model;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using BPASmartClient.EventBus;
+using BPASmartClient.MorkS3.Model;
+using System.Windows;
+using BPASmartClient.Message;
+
+namespace BPASmartClient.MorkS3.ViewModel
+{
+ public class DebugViewModel : ObservableObject
+ {
+ public DebugViewModel()
+ {
+ InitCommand = new RelayCommand(() => {
+ ActionManage.GetInstance.Send("InitDevice");
+ ActionManage.GetInstance.Send("初始化设定煮面时间");
+ });
+ SimOrderCommand = new RelayCommand(() =>
+ {
+ new MorksSimorderModel() { Bowloc = this.BowlLoc, NoodleLoc = this.NoodleLoc }.Publish();
+
+ });
+ SimOrderRandomCommand = new RelayCommand(() =>
+ {
+ int NoodPosition = 0;
+ int BowPosion = 0;
+ NoodPosition = IsNoodPositon == true ? 0 : NoodleLoc;
+ BowPosion = IsBowPositon == true ? 0 : BowlLoc;
+ ActionManage.GetInstance.Send("EnableForOrder", new object[] { NoodPosition, BowPosion });
+ });
+ SimOrderRandomCloseCommand = new RelayCommand(() =>
+ {
+ ThreadManage.GetInstance().StopTask("ForOrder");
+ MessageLog.GetInstance.Show("停止模拟随机订单");
+ });
+ EnableLacalSimOrder = new RelayCommand(() =>
+ {
+ Global.EnableLocalSimOrder = LocalSimOrder;
+ VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed;
+ });
+ VisibilitySimOrder = LocalSimOrder == true? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ public RelayCommand InitCommand { get; set; }
+
+ public RelayCommand SimOrderCommand { get; set; }
+
+ public RelayCommand SimOrderRandomCommand { get; set; }
+
+ public RelayCommand SimOrderRandomCloseCommand { get; set; }
+
+ public RelayCommand EnableLacalSimOrder { get; set; }
+ public int NoodleLoc { get { return _mNoodleLoc; } set { _mNoodleLoc = value; OnPropertyChanged(); } }
+ private int _mNoodleLoc = 1;
+
+
+ public int BowlLoc { get { return _mBowlLoc; } set { _mBowlLoc = value; OnPropertyChanged(); } }
+ private int _mBowlLoc = 10;
+
+ public bool IsNoodPositon { get { return _isNoodPositon; } set { _isNoodPositon = value; OnPropertyChanged(); } }
+ private bool _isNoodPositon = false;
+
+ public bool IsBowPositon { get { return _isBowPositon; } set { _isBowPositon = value; OnPropertyChanged(); } }
+ private bool _isBowPositon = false;
+
+ public bool LocalSimOrder { get { return _localSimOrder; } set { _localSimOrder = value; OnPropertyChanged(); } }
+ private bool _localSimOrder = Global.EnableLocalSimOrder;
+
+ public Visibility VisibilitySimOrder { get { return _visibilitySimOrder; } set { _visibilitySimOrder = value; OnPropertyChanged(); } }
+ private Visibility _visibilitySimOrder;
+ }
+}
diff --git a/BPASmartClient.MorkS3/ViewModel/MonitorViewModel.cs b/BPASmartClient.MorkS3/ViewModel/MonitorViewModel.cs
new file mode 100644
index 00000000..b129dec0
--- /dev/null
+++ b/BPASmartClient.MorkS3/ViewModel/MonitorViewModel.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BPASmartClient.Business;
+using BPASmartClient.Device;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System.Collections.ObjectModel;
+
+namespace BPASmartClient.MorkS3.ViewModel
+{
+ public class MonitorViewModel : ObservableObject
+ {
+ public MonitorViewModel()
+ {
+
+ }
+
+ public static int DeviceId { get; set; }
+
+ public ObservableCollection variableMonitors { get; set; } = Plugin.GetInstance()?.GetPlugin()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;
+
+ }
+}
diff --git a/BPASmartClient.MorkS3/ViewModel/ParSetViewModel.cs b/BPASmartClient.MorkS3/ViewModel/ParSetViewModel.cs
new file mode 100644
index 00000000..42ffe812
--- /dev/null
+++ b/BPASmartClient.MorkS3/ViewModel/ParSetViewModel.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BPASmartClient.Helper;
+using BPASmartClient.Model;
+using BPASmartClient.MorkS3.Model;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+
+namespace BPASmartClient.MorkS3.ViewModel
+{
+ public class ParSetViewModel : ObservableObject
+ {
+ public ParSetViewModel()
+ {
+ SaveInfoCommand = new RelayCommand(SaveSettingData);
+
+ ActionManage.GetInstance.Register(SaveSettingData, "初始化设定煮面时间");
+
+ }
+
+ public RelayCommand SaveInfoCommand { get; set; }
+
+ public ObservableCollection parSets { get; set; } = Json.Data.parSets;
+
+ private void SaveSettingData()
+ {
+ List values = new List();
+ values.Clear();
+
+ List bools = new List();
+ bools.Clear();
+
+ for (int i = 0; i < Json.Data.parSets.Count; i++)
+ {
+ values.Clear();
+ values.Add(Json.Data.parSets[i].Minute);
+ values.Add(Json.Data.parSets[i].Second);
+ bools.Add(Json.Data.parSets[i].IsShield);
+ ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = $"VW{116 + (i * 6)}", Value = values.ToArray() });
+ }
+ ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M260.0", Value = bools.ToArray() });
+ Json.Save();
+ }
+ }
+}
diff --git a/BPASmartClient.MorkS3/VoiceAPI.cs b/BPASmartClient.MorkS3/VoiceAPI.cs
new file mode 100644
index 00000000..6b4e057c
--- /dev/null
+++ b/BPASmartClient.MorkS3/VoiceAPI.cs
@@ -0,0 +1,42 @@
+using BPASmartClient.Message;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.MorkS3
+{
+ public class VoiceAPI
+ {
+ public VoiceAPI()
+ {
+ }
+
+ [DllImport("winmm.dll")]
+ public static extern bool PlaySound(string pszSound, int hmod, int fdwSound);
+
+
+ // 系统播放wav格式的文件
+ public static void m_SystemPlayWav(string strPlayFile)
+ {
+ try
+ {
+ if (strPlayFile.Trim() == "")
+ { return; }//为空不放
+
+ string strPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
+ strPath = strPath + strPlayFile;
+
+ int SND_FILENAME = 0x00020000;
+ int SND_ASYNC = 0x0001;
+ PlaySound(strPath, 0, SND_ASYNC | SND_FILENAME);//播放音乐
+ }
+ catch (Exception ex)
+ {
+ MessageLog.GetInstance.ShowEx(ex.Message);
+ }
+ }
+ }
+}
diff --git a/BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj b/BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj
index 4eaa9d28..35fcbfec 100644
--- a/BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj
+++ b/BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj
@@ -16,12 +16,17 @@
+
+
$(DefaultXamlRuntime)
+
+ $(DefaultXamlRuntime)
+
diff --git a/BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs b/BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs
index 70cf8a2f..10b33a97 100644
--- a/BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs
+++ b/BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs
@@ -20,6 +20,9 @@ using BPASmartClient.Model.单片机;
using BPASmartClient.Model.PLC;
using BPASmartClient.DRCoffee;
using BPASmartClient.LebaiRobot;
+using BPASmartClient.RobotGripper;
+using BPASmartClient.Model.电夹爪;
+using BPASmartClient.Model.奶茶味魔方;
namespace BPASmartClient.MorkT_BarCounter
{
@@ -42,7 +45,7 @@ namespace BPASmartClient.MorkT_BarCounter
private string mainMaterialLoc;
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } }
- GVL_MorkT morkTLebaiJC =new GVL_MorkT();
+ GVL_MorkT morkT =new GVL_MorkT();
///
/// 果汁机做法,true:热饮,false:冷饮
///
@@ -113,47 +116,49 @@ namespace BPASmartClient.MorkT_BarCounter
{
case GOODS_TYPE.COFFEE:
- if (morkTLebaiJC.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
+ if (morkT.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
{
- morkTLebaiJC.morkOrderPushesCoffee.Enqueue(new OrderLocInfo()
+ morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo()
{
SuborderId = order.MorkOrder.SuborderId,
BatchingId = res.BatchingId,
Loc = ushort.Parse( mainMaterialLoc),
GoodName = order.MorkOrder.GoodsName,
});
- }
- break;
- case GOODS_TYPE.JUICE:
-
- if (morkTLebaiJC.morkOrderPushesJuicer.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
- {
- morkTLebaiJC.morkOrderPushesJuicer.Enqueue(new OrderLocInfo()
+ morkT.morkOrderPushesAll.Enqueue(new OrderLocInfo()
{
SuborderId = order.MorkOrder.SuborderId,
BatchingId = res.BatchingId,
Loc = ushort.Parse(mainMaterialLoc),
GoodName = order.MorkOrder.GoodsName,
- makeID = order.MorkOrder.MakeID,
});
+
}
break;
- case GOODS_TYPE.TEA:
- if (morkTLebaiJC.morkOrderPushesTea.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
+ //case GOODS_TYPE.JUICE:
+ // if (morkTLebaiJC.morkOrderPushesJuicer.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
+ // {
+ // morkTLebaiJC.morkOrderPushesJuicer.Enqueue(new OrderLocInfo()
+ // {
+ // SuborderId = order.MorkOrder.SuborderId,
+ // BatchingId = res.BatchingId,
+ // Loc = ushort.Parse(mainMaterialLoc),
+ // GoodName = order.MorkOrder.GoodsName,
+ // makeID = order.MorkOrder.MakeID,
+ // });
+ // }
+ // break;
+ case GOODS_TYPE.MilkTea:
+ if (morkT.morkOrderPushesMilkTea.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
{
- morkTLebaiJC.morkOrderPushesTea.Enqueue(new OrderLocInfo()
+ morkT.morkOrderPushesMilkTea.Enqueue(new OrderLocInfo()
{
SuborderId = order.MorkOrder.SuborderId,
BatchingId = res.BatchingId,
Loc = ushort.Parse(mainMaterialLoc),
GoodName = order.MorkOrder.GoodsName,
});
- }
- break;
- case GOODS_TYPE.WATER:
- if (morkTLebaiJC.morkOrderPushesWater.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
- {
- morkTLebaiJC.morkOrderPushesWater.Enqueue(new OrderLocInfo()
+ morkT.morkOrderPushesAll.Enqueue(new OrderLocInfo()
{
SuborderId = order.MorkOrder.SuborderId,
BatchingId = res.BatchingId,
@@ -162,6 +167,18 @@ namespace BPASmartClient.MorkT_BarCounter
});
}
break;
+ //case GOODS_TYPE.WATER:
+ // if (morkTLebaiJC.morkOrderPushesWater.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
+ // {
+ // morkTLebaiJC.morkOrderPushesWater.Enqueue(new OrderLocInfo()
+ // {
+ // SuborderId = order.MorkOrder.SuborderId,
+ // BatchingId = res.BatchingId,
+ // Loc = ushort.Parse(mainMaterialLoc),
+ // GoodName = order.MorkOrder.GoodsName,
+ // });
+ // }
+ // break;
case GOODS_TYPE.NEITHER:
DeviceProcessLogShow("未知的商品类型");
break;
@@ -174,88 +191,63 @@ namespace BPASmartClient.MorkT_BarCounter
///
/// 将空杯放好到接饮料的地方的标志位
///
- private bool bFirstTrig_TeaWater = false;
+ private bool bFirstTrig_MilkTea = false;
private bool bFirstTrig_Coffee = false;
- private bool bFirstTrig_Juice = false;
///
/// 延迟的超时时间
///
- DateTime delayTimeOut_Water;
DateTime delayTimeOut_Coffee;
- DateTime delayTimeOut_Juice;
+ DateTime delayTimeOut_MilkTea;
public override void MainTask()
{
EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
- if (morkTLebaiJC.IsHaveCoffeeCup && morkTLebaiJC.MakeCoffeeEnd != true)
- morkTLebaiJC.MakeCoffeeEnd = true;
+ if (morkT.IsHaveCoffeeCup && morkT.MakeCoffeeEnd != true)
+ morkT.MakeCoffeeEnd = true;
+ bFirstTrig_Coffee = false;
});
- if (morkTLebaiJC.IsHaveCoffeeCup && morkTLebaiJC.MakeCoffeeEnd != true)
+ if (morkT.IsHaveCoffeeCup && morkT.MakeCoffeeEnd != true)
{
if (!bFirstTrig_Coffee)
{
bFirstTrig_Coffee = true;
delayTimeOut_Coffee = DateTime.Now;
}
- else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 18 && bFirstTrig_Coffee == true)
+ else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 180 && bFirstTrig_Coffee == true)
{
DeviceProcessLogShow("接咖啡超时,接咖啡结束,等待取咖啡");
bFirstTrig_Coffee = false;
- if (morkTLebaiJC.IsHaveCoffeeCup)
- morkTLebaiJC.MakeCoffeeEnd = true;
+ if (morkT.IsHaveCoffeeCup)
+ morkT.MakeCoffeeEnd = true;
}
}
-
- if (morkTLebaiJC.IsHaveJuiceCup && morkTLebaiJC.MakeJuiceEnd != true)
+ if (morkT.IsHaveTeaMilkTeaCup && morkT.MakeMilkTeaEnd != true)
{
- var Juicestate = GetStatus("GetDeviceStatus");
- if (Juicestate != null)
- {
- if (Juicestate.Length > 0)
- {
- var Juicestate1 = Convert.ToString(Juicestate[0], 2);
- var Juicestate2 = Juicestate[1];
- if (Juicestate1.IndexOf("0") == 1 && Juicestate2 == 0)
- {
- morkTLebaiJC.MakeJuiceEnd = true;
- bFirstTrig_Juice = false;
- }
- }
- }
- if (!morkTLebaiJC.MakeJuiceEnd)
+ if (!bFirstTrig_MilkTea)
{
- //若无状态返回 则加延迟
- if (!bFirstTrig_Juice)
- {
- bFirstTrig_Juice = true;
- delayTimeOut_Juice = DateTime.Now;
- }
- else if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 3 && bFirstTrig_Juice == true)
- {
- DeviceProcessLogShow("接果汁超时,接果汁结束,等待取果汁");
- bFirstTrig_Juice = false;
- morkTLebaiJC.MakeJuiceEnd = true;
- }
+ bFirstTrig_MilkTea = true;
+ delayTimeOut_MilkTea = DateTime.Now;//开启接水信号后,记录当前时间
}
- }
- if (morkTLebaiJC.IsHaveTeaWaterCup && morkTLebaiJC.MakeTeaEnd != true)
- {
- if (!bFirstTrig_TeaWater)
+ else if (DateTime.Now.Subtract(delayTimeOut_MilkTea).TotalSeconds >= 180 && bFirstTrig_MilkTea == true)//接水超过50s后,启动接水完成标志,开启接水程序
{
- bFirstTrig_TeaWater = true;
- delayTimeOut_Water = DateTime.Now;//开启接水信号后,记录当前时间
+ DeviceProcessLogShow("接茶或水延迟时间结束");
+ morkT.MakeMilkTeaEnd = true;
}
- else if (DateTime.Now.Subtract(delayTimeOut_Water).TotalSeconds >= 5 && bFirstTrig_TeaWater == true)//接水超过50s后,启动接水完成标志,开启接水程序
+ if ( GetStatus("Get_MilkTeaCubeStatus") == true)
{
- DeviceProcessLogShow("接茶或水延迟时间结束");
- bFirstTrig_TeaWater = false;
- morkTLebaiJC.MakeTeaEnd = true;
+ while(GetStatus("Get_MilkTeaCubeDosingStatus") == true)
+ {
+ if (morkT.IsHaveTeaMilkTeaCup && morkT.MakeMilkTeaEnd != true)
+ {
+ morkT.MakeMilkTeaEnd = true;
+ bFirstTrig_MilkTea = false;
+ new MilkTea_MakeMilkTeaEvent() { DeviceId = DeviceId, TagName = "StartSignReset" }.Publish();
+ }
+ }
}
}
DoCoffee();
- DoJuice();
- DoBoiledTea();
- DoBoiledWater();
+ DoMilkTea();
}
///
@@ -278,18 +270,6 @@ namespace BPASmartClient.MorkT_BarCounter
return GOODS_TYPE.NEITHER;
}
///
- /// 乐白的场景结束等待
- ///
- ///
- private void Wait(int value = 101)
- {
- while (!((bool)peripheralStatus["RobotOK"] && (int)peripheralStatus["RobotValue"] == value))
- {
- Thread.Sleep(5);
- }
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- }
- ///
/// 乐白的场景
///
///
@@ -318,7 +298,6 @@ namespace BPASmartClient.MorkT_BarCounter
return default;
}
int[] devStatusBy = new int[2] { 0, 0 };
- bool outCupCheck = false;//放纸杯位置有无判断
///
/// 传感器的输入信号 0:无意义 1:有信号 2:无信号 3:信号不正确
///
@@ -330,7 +309,7 @@ namespace BPASmartClient.MorkT_BarCounter
///
private bool IsMakeCoffee()
{
- bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesCoffee.Count > 0 && !morkTLebaiJC.IsHaveCoffeeCup) ? true : false;
+ bool bMake = (IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && !morkT.IsHaveCoffeeCup && morkT.morkOrderPushesAll.ElementAt(0).SuborderId == morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId) ? true : false;
return bMake;
}
///
@@ -339,16 +318,16 @@ namespace BPASmartClient.MorkT_BarCounter
///
private bool IsMakeJuice()
{
- bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesJuicer.Count > 0 && !morkTLebaiJC.IsHaveJuiceCup) ? true : false;
+ bool bMake = (IsHealth && morkT.morkOrderPushesJuicer.Count > 0 && !morkT.IsHaveJuiceCup && morkT.morkOrderPushesAll.ElementAt(0).SuborderId == morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId) ? true : false;
return bMake;
}
///
/// 判断是否有茶订单
///
///
- private bool IsMakeTeaWater()
+ private bool IsMakeMilkTea()
{
- bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesTea.Count > 0 && !morkTLebaiJC.IsHaveTeaWaterCup) ? true : false;
+ bool bMake = (IsHealth && morkT.morkOrderPushesMilkTea.Count > 0 && !morkT.IsHaveTeaMilkTeaCup && morkT.morkOrderPushesAll.ElementAt(0).SuborderId == morkT.morkOrderPushesMilkTea.ElementAt(0).SuborderId) ? true : false;
return bMake;
}
///
@@ -357,7 +336,7 @@ namespace BPASmartClient.MorkT_BarCounter
///
private bool IsMakeWater()
{
- bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesWater.Count > 0 && !morkTLebaiJC.IsHaveTeaWaterCup) ? true : false;
+ bool bMake = (IsHealth && morkT.morkOrderPushesWater.Count > 0 && !morkT.IsHaveTeaMilkTeaCup) ? true : false;
return bMake;
}
///
@@ -367,83 +346,19 @@ namespace BPASmartClient.MorkT_BarCounter
{
if (IsMakeCoffee())
{
- PickUpCoffee();//接咖啡
- morkTLebaiJC.IsHaveCoffeeCup = true;
- }
- else if(morkTLebaiJC.MakeCoffeeEnd)
- {
- try
- {
- PutCoffeeCup();
- morkTLebaiJC.MakeCoffeeEnd = false;
- morkTLebaiJC.IsHaveCoffeeCup = false;
- morkTLebaiJC.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc);
- }
- catch (Exception ex)
- {
- MessageLog.GetInstance.ShowEx(ex.ToString());
- }
- }
- }
- private void DoJuice()
- {
- if (IsMakeJuice())
- {
- switch (morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).makeID)
- {
- case "1":
- GuMake = true;
- IsAddIce = false;
- break;
- case "2":
- GuMake = false;
- IsAddIce = false;
- break;
- case "3":
- GuMake = false;
- IsAddIce = true;
- break;
- default:
- break;
- }
- PickUpJuicer();
- morkTLebaiJC.IsHaveJuiceCup = true;
- }
- else if (morkTLebaiJC.MakeJuiceEnd)
- {
- try
- {
- Thread.Sleep(5000);//延迟五秒,防止饮料口滴饮料
- putJuice();
- morkTLebaiJC.IsHaveJuiceCup = false;
- morkTLebaiJC.MakeJuiceEnd = false;
- morkTLebaiJC.morkOrderPushesJuicer.TryDequeue(out OrderLocInfo orderLoc);
- }
- catch (Exception ex)
- {
- MessageLog.GetInstance.ShowEx(ex.ToString());
- }
- }
- }
- public bool DoTeaOrWater;
- private void DoBoiledTea()
- {
- if (IsMakeTeaWater())
- {
- PickUpTea();
- morkTLebaiJC.IsHaveTeaWaterCup = true;
- DoTeaOrWater = true;
+ Discharge_Control(Kind.咖啡);//接咖啡
+ morkT.IsHaveCoffeeCup = true;
}
- else if (morkTLebaiJC.MakeTeaEnd && morkTLebaiJC.morkOrderPushesTea.Count > 0 && DoTeaOrWater)
+ else if(morkT.MakeCoffeeEnd)
{
try
{
- PutWaterCup();
- OrderChange(morkTLebaiJC.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
- DeviceProcessLogShow("-------------茶 制作完成------------");
- morkTLebaiJC.IsHaveTeaWaterCup = false;
- morkTLebaiJC.MakeTeaEnd = false;
- morkTLebaiJC.morkOrderPushesTea.TryDequeue(out OrderLocInfo orderLoc);
+ PutCup(Kind.咖啡);
+ DeviceProcessLogShow("-------------咖啡制作完成------------");
+ morkT.MakeCoffeeEnd = false;
+ morkT.IsHaveCoffeeCup = false;
+ morkT.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc);
+ morkT.morkOrderPushesAll.TryDequeue(out OrderLocInfo orderLoc1);
}
catch (Exception ex)
{
@@ -451,24 +366,23 @@ namespace BPASmartClient.MorkT_BarCounter
}
}
}
- private void DoBoiledWater()
+ private void DoMilkTea()
{
- if (IsMakeWater())
+ if (IsMakeMilkTea())
{
- PickUpWater();
- morkTLebaiJC.IsHaveTeaWaterCup = true;
- DoTeaOrWater = false;
+ Discharge_Control(Kind.奶茶);//接咖啡
+ morkT.IsHaveTeaMilkTeaCup = true;
}
- else if (morkTLebaiJC.MakeTeaEnd && morkTLebaiJC.morkOrderPushesWater.Count > 0 && DoTeaOrWater == false)
+ else if (morkT.MakeMilkTeaEnd && morkT.morkOrderPushesMilkTea.Count > 0)
{
try
{
- PutWaterCup();
- OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
- DeviceProcessLogShow("-------------开水 制作完成------------");
- morkTLebaiJC.IsHaveTeaWaterCup = false;
- morkTLebaiJC.MakeTeaEnd = false;
- morkTLebaiJC.morkOrderPushesWater.TryDequeue(out OrderLocInfo orderLoc);
+ PutCup(Kind.奶茶);
+ DeviceProcessLogShow("-------------奶茶制作完成------------");
+ morkT.IsHaveTeaMilkTeaCup = false;
+ morkT.MakeMilkTeaEnd = false;
+ morkT.morkOrderPushesMilkTea.TryDequeue(out OrderLocInfo orderLoc);
+ morkT.morkOrderPushesAll.TryDequeue(out OrderLocInfo orderLoc1);
}
catch (Exception ex)
{
@@ -477,326 +391,140 @@ namespace BPASmartClient.MorkT_BarCounter
}
}
-
#region 做咖啡流程
///
- /// 接咖啡
+ /// 出料控制
///
- private void PickUpCoffee()
+ private void Discharge_Control(Kind kind)
{
- if (!morkTLebaiJC.IsHaveCoffeeCup)
+ if (!morkT.IsHaveCoffeeCup)
{
- outCupCheck = false;
- OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
- int resultTakeCup = takeCup();
- if (resultTakeCup == 1)
+ if (kind == Kind.咖啡)
{
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.机器人安全位);
- //Wait();
-
- WritePLCData("",2);//将轴移动到接咖啡的位置
- DeviceProcessLogShow("伺服电机移动到接咖啡的位置");
-
- DeviceProcessLogShow("咖啡杯取杯完成");
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.接咖啡);
- //Wait();
- new DRCoffee_MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).Loc)}.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
+ OrderChange(morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
}
else
{
- /*DeviceProcessLogShow("取杯失败 回到初始位,请及时处理!!");
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.机器人初始位);
- //Wait();*/
+ OrderChange(morkT.morkOrderPushesMilkTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
}
- }
- }
- ///
- /// 咖啡杯接好,放咖啡杯
- ///
- private void PutCoffeeCup()
- {
- while (GetStatus("RobotValue1"))//判断放杯位置是否有物品
- {
- if (!outCupCheck)
- DeviceProcessLogShow("成品处有纸杯存在,请取走!!");
- outCupCheck = true;
- }
- outCupCheck = false;
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.机器人安全位);
- //Wait();
-
- WritePLCData("", 2);//将轴移动到接咖啡的位置
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.放咖啡杯);
- //Wait();
- OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
- DeviceProcessLogShow($"-------------{morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).GoodName}制作完成------------");
- }
- #endregion
- #region 做开水流程
- ///
- /// 接开水
- ///
- private void PickUpWater()
- {
- #region 接水流程
- if (!morkTLebaiJC.IsHaveTeaWaterCup)
- {
- OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
int resultTakeCup = takeCup();
if (resultTakeCup == 1)
{
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.接开水);
- //Wait();
- Output(false, 1);
- Output(false, 0);
- Thread.Sleep(100);
- Output(true, 0);
- Thread.Sleep(3000);
- Output(false, 0);
- Thread.Sleep(100);
+ if (kind == Kind.咖啡)
+ {
+ new WriteJaka() { DeviceId =DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位_接咖啡位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_取杯位_接咖啡位));
+
+ new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)(morkT.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //控制咖啡出料
+
+ //new WriteGripper() { TagName = "PWMControl", CH_Number = "0", PWMOutput = "500" }.Publish();//夹爪的幅度控制
+
+ //new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接咖啡_初始位 }.Publish();
+ //Wait(int.Parse(JakaModel.SENCE_接咖啡_初始位));
- Output(false, 1);
- Thread.Sleep(100);
- Output(true, 1);
- Thread.Sleep(500);
- Output(false, 1);
+ //DeviceProcessLogShow("接咖啡杯动作完成");
+ }
+ else
+ {
+ new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位_接奶茶位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_取杯位_接奶茶位));
+ while (GetStatus("Get_MilkTeaCubeStatus") == false)
+ {
+ new MilkTea_MakeMilkTeaEvent() { DeviceId = DeviceId, TagName = "ParameterSet", MilkTeaKind = GVL_MorkT.MilkTeaCHValue }.Publish(); //写入奶茶参数
+ new MilkTea_MakeMilkTeaEvent() { DeviceId = DeviceId, TagName = "Start" }.Publish();
+ break;
+ }
+ //new WriteGripper() { TagName = "PWMControl", CH_Number = "0", PWMOutput = "500" }.Publish();//夹爪的幅度控制
+
+ //new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接奶茶_初始位 }.Publish();
+ //Wait(int.Parse(JakaModel.SENCE_接奶茶_初始位));
+
+ //DeviceProcessLogShow("接奶茶杯动作完成");
+ }
}
else
{
- return;
+ DeviceProcessLogShow("取杯失败 回到初始位,请及时处理!!");
+ new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_异常回初始位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_异常回初始位));
}
}
- #endregion
}
- #endregion
- #region 做茶流程
- ///
- /// 做茶
- ///
- private void PickUpTea()
+ public bool outCupCheck;
+ private void PutCup(Kind res)
{
- #region 接茶流程
- if (!morkTLebaiJC.IsHaveTeaWaterCup)
+ //new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish();
+ //Wait(int.Parse(JakaModel.SENCE_初始位));
+
+ //new WriteGripper() { TagName = "PWMControl", CH_Number = "0", PWMOutput = "500" }.Publish();//夹爪的幅度控制
+
+ //new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish();
+ //Wait(int.Parse(JakaModel.SENCE_初始位_放杯位检测));
+
+ //while (GetStatus("Get_JakaRobotDI0"))//判断放杯位置是否有物品
+ //{
+ // if (!outCupCheck)
+ // DeviceProcessLogShow("成品处有纸杯存在,请取走!!");
+ // outCupCheck = true;
+ //}
+ //outCupCheck = false;
+ if (res == Kind.咖啡)
{
- OrderChange(morkTLebaiJC.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
- int resultTakeCup = takeCup();
- if (resultTakeCup == 1)
- {
- DeviceProcessLogShow("取茶杯完成");
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.接茶叶);
- //Wait();
+ //new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放杯位检测_接咖啡 }.Publish();
+ //Wait(int.Parse(JakaModel.SENCE_放杯位检测_接咖啡));
- new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish();
- Thread.Sleep(1000);
- new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 150 }.Publish();
- Thread.Sleep(1000);
- new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish();
+ //new WriteGripper() { TagName = "PWMControl", CH_Number = "0", PWMOutput = "1300" }.Publish();//夹爪的幅度控制
- Thread.Sleep(3000);
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.接茶水);
- //Wait();
- Output(false, 1);
- Output(false, 0);
- Thread.Sleep(100);
- Output(true, 0);
- Thread.Sleep(3000);
- Output(false, 0);
- Thread.Sleep(100);
+ //new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放杯位检测_接咖啡 }.Publish();
+ //Wait(int.Parse(JakaModel.SENCE_接咖啡_放杯位));
+
+ //new WriteGripper() { TagName = "PWMControl", CH_Number = "0", PWMOutput = "500" }.Publish();//夹爪的幅度控制
+ new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_接咖啡位_放咖啡位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_接咖啡位_放咖啡位));
+
+ //new WriteGripper() { DeviceId = DeviceId, TagName = "PWMControl", CH_Number = "0", PWMOutput = "0500" }.Publish();//夹爪的幅度控制
+ //new WriteJaka() { DeviceId = DeviceId, TagName = "JakaDOutput", Value = true, DO_Index = 1 }.Publish();
- Output(false, 1);
- Thread.Sleep(100);
- Output(true, 1);
- Thread.Sleep(500);
- Output(false, 1);
- morkTLebaiJC.IsHaveTeaWaterCup = true;
- }
- else
- {
- return;
- }
}
- #endregion
- }
- ///
- /// 放水杯流程
- ///
- private void PutWaterCup()
- {
- while (GetStatus("RobotValue1"))//判断放杯位置是否有物品
+ else
{
- if (!outCupCheck)
- DeviceProcessLogShow("成品处有纸杯存在,请取走!!");
- outCupCheck = true;
- }
- outCupCheck = false;
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.放水杯);
- }
+ //new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放杯位检测_接咖啡 }.Publish();
+ //Wait(int.Parse(JakaModel.SENCE_放杯位检测_接奶茶));
- #endregion
- #region 做果汁流程
- ///
- /// 果汁机控制信号
- ///
- private byte JuicerNum;
+ //new WriteGripper() { TagName = "PWMControl", CH_Number = "0", PWMOutput = "1300" }.Publish();//夹爪的幅度控制
- private void getIce()
- {
- IsAddIceNow = IsAddIce;
- if (IsAddIce)
- {
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.取杯位_机器人安全位);
- //Wait();
+ //new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放杯位检测_接咖啡 }.Publish();
+ //Wait(int.Parse(JakaModel.SENCE_接奶茶_放杯位));
- WritePLCData("",3);//将模组移动到接冰的位置
+ //new WriteGripper() { TagName = "PWMControl", CH_Number = "0", PWMOutput = "500" }.Publish();//夹爪的幅度控制
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.接冰块);
- //Wait();
- if (Math.Pow(1, GetStatus("GetMakeIceDeviceStatus")) == 0)//制冰机在待机状态才可以制作冰
- {
- new StartMakeIce() { }.Publish();
- }
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.接冰_机器人安全位);
- //Wait();
+ new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_等奶茶_接奶茶位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_等奶茶_接奶茶位));
+
+ new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_接奶茶位_放奶茶位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_接奶茶位_放奶茶位));
+
+ //new WriteGripper() { DeviceId = DeviceId, TagName = "PWMControl", CH_Number = "0", PWMOutput = "500" }.Publish();//夹爪的幅度控制
+ //new WriteJaka() { DeviceId = DeviceId, TagName = "JakaDOutput", Value = true, DO_Index = 1 }.Publish();
}
- }
- ///
- /// 当前订单是否加冰
- ///
- private bool IsAddIceNow = false;
- private int JuiceCH;
- ///
- /// 接果汁
- ///
- private void PickUpJuicer()
- {
- #region 接果汁流程
- if (!morkTLebaiJC.IsHaveJuiceCup)
+ new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_放杯位_初始位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_放杯位_初始位));
+ if (GetStatus("Get_JakaRobotDI5"))
{
- OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
- int resultTakeCup = takeCup();
- JuiceCH = morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).Loc;
- if (resultTakeCup == 1)
- {
- getIce();
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.机器人安全位);
- //Wait();
- WritePLCData("", 3);//将模组移动到接冰的位置
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.接果汁过渡位);
- //Wait();
- switch (JuiceCH)
- {
- case 52:
- if (GuMake)
- JuicerNum = 0x00;
- else
- JuicerNum = 0x01;
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.接果汁1);
- //Wait();
- break;
- case 53:
- if (GuMake)
- JuicerNum = 0x02;
- else
- JuicerNum = 0x03;
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.接果汁2);
- //Wait();
- break;
- case 54:
- if (GuMake)
- JuicerNum = 0x04;
- else
- JuicerNum = 0x05;
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.接果汁3);
- //Wait();
- break;
- case 55:
- if (GuMake)
- JuicerNum = 0x06;
- else
- JuicerNum = 0x07;
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.接果汁4);
- //Wait();
- break;
- default:
- JuicerNum = 0x00;
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.接果汁1);
- //Wait();
- break;
- }
- new WriteJuicer() { Value = JuicerNum }.Publish();
- morkTLebaiJC.IsHaveJuiceCup = true;
- }
- else
- {
- return;
- }
+ DeviceProcessLogShow("放杯完成,杯子感应器但仍有信号");
}
- #endregion
- }
- ///
- /// 取接好果汁杯
- ///
- private void putJuice()
- {
- while (GetStatus("RobotValue1"))//判断放杯位置是否有物品
+ if (res == Kind.咖啡)
{
- if (!outCupCheck)
- DeviceProcessLogShow("成品处有纸杯存在,请取走!!");
- outCupCheck = true;
+ OrderChange(morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
+ DeviceProcessLogShow($"-------------{morkT.morkOrderPushesCoffee.ElementAt(0).GoodName}制作完成------------");
}
- outCupCheck = false;
- switch (JuiceCH)
+ else
{
- case 52:
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.放果汁杯1);
- //Wait();
- break;
- case 53:
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.放果汁杯2);
- //Wait();
- break;
- case 54:
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.放果汁杯3);
- //Wait();
- break;
- case 55:
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.放果汁杯4);
- //Wait();
- break;
- default:
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.放果汁杯1);
- //Wait();
- break;
+ OrderChange(morkT.morkOrderPushesMilkTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
+ DeviceProcessLogShow($"-------------{morkT.morkOrderPushesMilkTea.ElementAt(0).GoodName}制作完成------------");
}
- OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
- DeviceProcessLogShow($"-------------{morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).GoodName}果汁 制作完成------------");
}
#endregion
-
///
/// 取杯的次数
///
@@ -809,96 +537,124 @@ namespace BPASmartClient.MorkT_BarCounter
{
try
{
- nCnt = 0;
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.机器人初始位);
- //Wait();
+ // new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish();
+ // Wait(int.Parse(JakaModel.SENCE_初始位));
+
+ // new WriteGripper() { TagName = "PWMControl", CH_Number = "0", PWMOutput = "500" }.Publish();//夹爪的幅度控制
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.机器人安全位);
- //Wait();
+ //p: new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_落杯 }.Publish();
+ // Wait(int.Parse(JakaModel.SENCE_落杯));
- WritePLCData("", 1);
+ // new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位检测_取杯位 }.Publish();
+ // Wait(int.Parse(JakaModel.SENCE_初始位_取杯位检测));
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.取纸杯);
- //Wait();
+ // if (!GetStatus("Get_JakaRobotDI0"))
+ // goto p;
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.取纸杯检测);
- //Wait();
- nCnt++;
- Thread.Sleep(2000);
- while (!GetStatus("GetInput")) //读取传感器的值
+ // new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位检测_取杯位 }.Publish();
+ // Wait(int.Parse(JakaModel.SENCE_取杯位检测_取杯位));
+
+ // new WriteGripper() { TagName = "PWMControl", CH_Number = "0", PWMOutput = "1300" }.Publish();//夹爪的幅度控制
+ // Thread.Sleep(2000);
+ // while (!GetStatus("Get_JakaRobotDI0")) //读取传感器的值
+ // {
+ // new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_异常回初始位 }.Publish();
+ // Wait(int.Parse(JakaModel.SENCE_异常回初始位));
+ // return 2;
+ // }
+ bool test1 = false;
+ if (test1)
{
- if (nCnt > 3)
- {
- nCnt = 0;
- DeviceProcessLogShow("三次取杯失败,回原点");
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.机器人安全位);
- //Wait();
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.机器人初始位);
- //Wait();
- return 2;
- }
- else
+ #region 第一种取杯方式
+ new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_初始位));
+
+ new WriteGripper() { DeviceId = DeviceId, TagName = "PWMControl", CH_Number = "0", PWMOutput = "1350" }.Publish();//夹爪的幅度控制
+
+ new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位_取杯位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_初始位_取杯位));
+
+ int cnt = 0;
+ new WriteGripper() { DeviceId = DeviceId, TagName = "PWMControl", CH_Number = "0", PWMOutput = "1350" }.Publish();//夹爪的幅度控制
+
+ p: new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_落杯 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_落杯));
+ cnt = cnt + 1;
+ if (!GetStatus("Get_JakaRobotDI6"))
{
- nCnt++;
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.二次取杯);
- //Wait();
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.取纸杯检测);
- //Wait();
+ if (cnt < 3)
+ goto p;
+ else
+ {
+ return 2;
+ }
}
- Thread.Sleep(1000);
- }
- new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
- Sence(GVL_MorkT.取杯位_机器人安全位);
- //Wait();
- return 1;
- }
- catch (Exception ex)
- {
- DeviceProcessLogShow(ex.ToString());
- }
- return 2;
- }
- ///
- /// 放杯
- ///
- /// 0:无意义 1:放杯成功 2:执行失败(传感器还有信号) 3:放杯异常
- private int putCup()
- {
- try
- {
- if (GetStatus("GetInput2")) return 2;
- Sence(GVL_MorkT.JUICE_放杯);
- //Wait();
- new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish();
- Sence(GVL_MorkT.JUICE_放杯检测);
- //Wait();
- new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish();
- if (GetStatus("GetInput2"))
- {
return 1;
+ #endregion
}
else
{
- return 3;
+ #region 第二种取杯方式
+ new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_初始位));
+
+ //new WriteJaka() { DeviceId = DeviceId, TagName = "JakaDOutput", Value = false, DO_Index = 1 }.Publish();
+
+ //new WriteGripper() { DeviceId = DeviceId, TagName = "PWMControl", CH_Number = "0", PWMOutput = "1350" }.Publish();//夹爪的幅度控制
+
+ new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位_取杯位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_初始位_取杯位));
+
+ int cnt = 0;
+ p: new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_落杯 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_落杯));
+ cnt = cnt + 1;
+ if (!GetStatus("Get_JakaRobotDI5"))
+ {
+ if (cnt < 3)
+ goto p;
+ else
+ {
+ return 2;
+ }
+ }
+ Thread.Sleep(2000);
+ new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位_取杯放杯检测位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_取杯位_取杯放杯检测位));
+
+ //new WriteJaka() { DeviceId = DeviceId, TagName = "JakaDOutput", Value = true, DO_Index = 1 }.Publish();
+ //Thread.Sleep(2000);
+ //new WriteJaka() { DeviceId = DeviceId, TagName = "JakaDOutput", Value = false, DO_Index = 1 }.Publish();
+ //new WriteGripper() { DeviceId = DeviceId, TagName = "PWMControl", CH_Number = "0", PWMOutput = "1200" }.Publish();//夹爪的幅度控制
+ //Thread.Sleep(2000);
+ //new WriteGripper() { DeviceId = DeviceId, TagName = "PWMControl", CH_Number = "0", PWMOutput = "1350" }.Publish();//夹爪的幅度控制
+
+ new WriteJaka() { DeviceId = DeviceId, TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯放杯检测位_取杯位 }.Publish();
+ JakaWait(int.Parse(JakaModel.SENCE_取杯放杯检测位_取杯位));
+
+ return 1;
+
+ #endregion
}
}
catch (Exception ex)
{
DeviceProcessLogShow(ex.ToString());
- return 0;
}
+ return 2;
}
public void SimOrder(T simOrder)
{
+ }
+ private void JakaWait(int value)
+ {
+ while (!((GetStatus("Get_JakaRobotAO1") == value) && GetStatus("Get_JakaRobotProgramStatus") == 0))//判断文件是否已经执行结束 且 文件末端变量值==文件名
+ {
+ int a = GetStatus("Get_JakaRobotAO1");
+ int b = GetStatus("Get_JakaRobotProgramStatus");
+ Thread.Sleep(5);
+ }
}
#region PLC 控制函数
@@ -924,49 +680,49 @@ namespace BPASmartClient.MorkT_BarCounter
{
if (o is bool b)
{
- morkTLebaiJC.RobotIsConnected = b;
+ morkT.RobotIsConnected = b;
}
}));
GetStatus("RobotMode", new Action((o) =>
{
if (o is ELebaiRModel eLebaiRModel)
{
- morkTLebaiJC.RobotMode = eLebaiRModel;
+ morkT.RobotMode = eLebaiRModel;
}
}));
GetStatus("LeibaiGetTcpInput", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.RobotGetTcpInput = b;
+ morkT.RobotGetTcpInput = b;
}
}));
GetStatus("LeibaiGetInput1", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.RobotGetInput0 = b;
+ morkT.RobotGetInput0 = b;
}
}));
GetStatus("LeibaiGetInput2", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.RobotGetInput1 = b;
+ morkT.RobotGetInput1 = b;
}
}));
GetStatus("LeibaiGetInput3", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.RobotGetInput2 = b;
+ morkT.RobotGetInput2 = b;
}
}));
GetStatus("LeibaiGetInput4", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.RobotGetInput3 = b;
+ morkT.RobotGetInput3 = b;
}
}));
@@ -976,14 +732,14 @@ namespace BPASmartClient.MorkT_BarCounter
{
if (o is bool bt)
{
- morkTLebaiJC.IceMakerConnect = bt;
+ morkT.IceMakerConnect = bt;
}
}));
GetStatus("MakeIceDeviceStatus", new Action((o) =>
{
if (o is byte bt)
{
- morkTLebaiJC.IceMakerState = bt;
+ morkT.IceMakerState = bt;
}
}));
#endregion
@@ -992,7 +748,7 @@ namespace BPASmartClient.MorkT_BarCounter
{
if (o is bool b)
{
- morkTLebaiJC.CoffeeIsConnected = b;
+ morkT.CoffeeIsConnected = b;
}
}));
@@ -1000,7 +756,7 @@ namespace BPASmartClient.MorkT_BarCounter
{
if (o is DrCoffeeStatus coffeeStatus)
{
- morkTLebaiJC.DrCoffeeStatus = coffeeStatus;
+ morkT.DrCoffeeStatus = coffeeStatus;
}
}));
@@ -1008,7 +764,7 @@ namespace BPASmartClient.MorkT_BarCounter
{
if (o is DrCoffeeAppStatus appStatus)
{
- morkTLebaiJC.CoffeeAppStatus = appStatus;
+ morkT.CoffeeAppStatus = appStatus;
}
}));
@@ -1016,14 +772,14 @@ namespace BPASmartClient.MorkT_BarCounter
{
if (o is DrCoffeeWarning coffeeWarning)
{
- morkTLebaiJC.CoffeeWarning = coffeeWarning;
+ morkT.CoffeeWarning = coffeeWarning;
}
}));
GetStatus("CoffeeFault", new Action((o) =>
{
if (o is DrCoffeeFault coffeeFault)
{
- morkTLebaiJC.CaffeeFault = coffeeFault;
+ morkT.CaffeeFault = coffeeFault;
}
}));
#endregion
@@ -1040,63 +796,63 @@ namespace BPASmartClient.MorkT_BarCounter
{
if (o is bool b)
{
- morkTLebaiJC.SCChipIsConnect = b;
+ morkT.SCChipIsConnect = b;
}
}));
GetStatus("SCChipGetInput0", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.SCChipInput0 = b;
+ morkT.SCChipInput0 = b;
}
}));
GetStatus("SCChipGetInput1", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.SCChipInput1 = b;
+ morkT.SCChipInput1 = b;
}
}));
GetStatus("SCChipGetInput2", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.SCChipInput2 = b;
+ morkT.SCChipInput2 = b;
}
}));
GetStatus("SCChipGetInput3", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.SCChipInput3 = b;
+ morkT.SCChipInput3 = b;
}
}));
GetStatus("SCChipGetInput4", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.SCChipInput4 = b;
+ morkT.SCChipInput4 = b;
}
}));
GetStatus("SCChipGetInput5", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.SCChipInput5 = b;
+ morkT.SCChipInput5 = b;
}
}));
GetStatus("SCChipGetInput6", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.SCChipInput6 = b;
+ morkT.SCChipInput6 = b;
}
}));
GetStatus("SCChipGetInput7", new Action((o) =>
{
if (o is bool b)
{
- morkTLebaiJC.SCChipInput7 = b;
+ morkT.SCChipInput7 = b;
}
}));
@@ -1106,14 +862,14 @@ namespace BPASmartClient.MorkT_BarCounter
{
if (o is bool b)
{
- morkTLebaiJC.JuicerConnected = b;
+ morkT.JuicerConnected = b;
}
}));
GetStatus("GetJuicerDeviceStatus", new Action((o) =>
{
if (o is int[] b)
{
- morkTLebaiJC.JuicerState = b;
+ morkT.JuicerState = b;
}
}));
#endregion
@@ -1139,19 +895,19 @@ namespace BPASmartClient.MorkT_BarCounter
DeviceProcessLogShow("----开始模拟订单----");
if (msm.OrderNum == 1)
{
- morkTLebaiJC.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() { Loc =(ushort)msm.DrinkCode, SuborderId = guid, GoodName="模拟咖啡订单" });
+ morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() { Loc =(ushort)msm.DrinkCode, SuborderId = guid, GoodName="模拟咖啡订单" });
}
else if (msm.OrderNum == 2)
{
- morkTLebaiJC.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() { Loc = (ushort) (msm.JuiceList + 51), makeID = msm.JuiceMakeID, SuborderId = guid, GoodName = "模拟果汁订单" });
+ morkT.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() { Loc = (ushort) (msm.JuiceList + 51), makeID = msm.JuiceMakeID, SuborderId = guid, GoodName = "模拟果汁订单" });
}
else if (msm.OrderNum == 3)
{
- morkTLebaiJC.morkOrderPushesTea.Enqueue(new OrderLocInfo() { SuborderId = guid, GoodName = "模拟茶水订单" });
+ morkT.morkOrderPushesMilkTea.Enqueue(new OrderLocInfo() { SuborderId = guid, GoodName = "模拟茶水订单" });
}
else if (msm.OrderNum == 4)
{
- morkTLebaiJC.morkOrderPushesWater.Enqueue(new OrderLocInfo() { SuborderId = guid, GoodName = "模拟开水订单" });
+ morkT.morkOrderPushesWater.Enqueue(new OrderLocInfo() { SuborderId = guid, GoodName = "模拟开水订单" });
}
}
});
diff --git a/BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs b/BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs
index f531c404..af1ebad6 100644
--- a/BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs
+++ b/BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs
@@ -71,6 +71,13 @@ namespace BPASmartClient.MorkT_BarCounter
public const int JUICE_放杯 = 20120;
public const int JUICE_放杯检测 = 20120;
#endregion
+
+
+ ///
+ ///
+ /// 咖啡订单队列
+ ///
+ public ConcurrentQueue morkOrderPushesAll = new ConcurrentQueue();
///
///
/// 咖啡订单队列
@@ -99,18 +106,25 @@ namespace BPASmartClient.MorkT_BarCounter
public bool MakeJuiceEnd = false;
///
- /// 做茶订单队列
+ /// 出果汁完成,是否去取果汁
///
- public ConcurrentQueue morkOrderPushesTea = new ConcurrentQueue();
+ public static ushort[] MilkTeaCHValue = new ushort[12] {200,200,200,200,200,200,200,200,200,200,200,200 };
///
- /// 接水口是否有茶水杯
+ /// 做茶订单队列
///
- public bool IsHaveTeaWaterCup = false;
+ public ConcurrentQueue morkOrderPushesMilkTea = new ConcurrentQueue();
///
- /// 水已经接完,是否去取水杯
+ /// 接奶茶口是否有奶茶杯
///
- public bool MakeTeaEnd = false;
+ public bool IsHaveTeaMilkTeaCup = false;
+ ///
+ /// 奶茶做完成
+ ///
+ public bool MakeMilkTeaEnd = false;
+ public static bool DI0 = false;
+ public static bool DI1 = false;
+ public static bool DI2 = false;
///
/// 做开水订单队列
///
diff --git a/BPASmartClient.MorkT_BarCounter/PolymerBatching.cs b/BPASmartClient.MorkT_BarCounter/PolymerBatching.cs
index bf1d9f48..8c918a32 100644
--- a/BPASmartClient.MorkT_BarCounter/PolymerBatching.cs
+++ b/BPASmartClient.MorkT_BarCounter/PolymerBatching.cs
@@ -19,15 +19,15 @@ namespace BPASmartClient.MorkT_BarCounter
///
/// 果汁
///
- JUICE,
+ //JUICE,
///
/// 茶水
///
- TEA,
+ MilkTea,
///
/// 水
///
- WATER,
+ //WATER,
///
/// 杯子
///
@@ -42,10 +42,10 @@ namespace BPASmartClient.MorkT_BarCounter
internal class PolymerBatching
{
- internal const string Juicer_MAIN_BATCHIN1_LOC = "52";
- internal const string Juicer_MAIN_BATCHIN2_LOC = "53";
- internal const string Juicer_MAIN_BATCHIN3_LOC = "54";
- internal const string Juicer_MAIN_BATCHIN4_LOC = "55";
+ //internal const string Juicer_MAIN_BATCHIN1_LOC = "52";
+ //internal const string Juicer_MAIN_BATCHIN2_LOC = "53";
+ //internal const string Juicer_MAIN_BATCHIN3_LOC = "54";
+ //internal const string Juicer_MAIN_BATCHIN4_LOC = "55";
//internal const string Juicer_MAIN_BATCHIN5_LOC = "56";
//internal const string Juicer_MAIN_BATCHIN6_LOC = "57";
//internal const string Juicer_MAIN_BATCHIN7_LOC = "58";
@@ -80,12 +80,11 @@ namespace BPASmartClient.MorkT_BarCounter
{"24",GOODS_TYPE.COFFEE},
{"25",GOODS_TYPE.COFFEE},
{ COFFEE_HOLDER_LOC,GOODS_TYPE.CUP},
- {"56",GOODS_TYPE.TEA },
- {"61",GOODS_TYPE.WATER },
- {Juicer_MAIN_BATCHIN1_LOC,GOODS_TYPE.JUICE},
- {Juicer_MAIN_BATCHIN2_LOC,GOODS_TYPE.JUICE},
- {Juicer_MAIN_BATCHIN3_LOC,GOODS_TYPE.JUICE},
- {Juicer_MAIN_BATCHIN4_LOC,GOODS_TYPE.JUICE},
+ {"60",GOODS_TYPE.MilkTea },
+ //{Juicer_MAIN_BATCHIN1_LOC,GOODS_TYPE.JUICE},
+ //{Juicer_MAIN_BATCHIN2_LOC,GOODS_TYPE.JUICE},
+ //{Juicer_MAIN_BATCHIN3_LOC,GOODS_TYPE.JUICE},
+ //{Juicer_MAIN_BATCHIN4_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN5_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN6_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN7_LOC,GOODS_TYPE.JUICE},
diff --git a/BPASmartClient.MorkT_BarCounter/View/DebugView.xaml b/BPASmartClient.MorkT_BarCounter/View/DebugView.xaml
index 673ac70c..618a5389 100644
--- a/BPASmartClient.MorkT_BarCounter/View/DebugView.xaml
+++ b/BPASmartClient.MorkT_BarCounter/View/DebugView.xaml
@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:BPASmartClient.MorkT_BarCounter.ViewModel"
mc:Ignorable="d"
- Name="调试界面"
+ Name="测试界面"
d:DesignHeight="500" d:DesignWidth="1000" Unloaded="Dubug_Unloaded">
@@ -18,422 +18,100 @@
-
+
-
-
+
+
+
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TCP DI:
- DI0
-
-
-
-
- DI:
- DI0
- DI1
- DI2
- DI3
-
-
-
-
- DO:
-
- DO0
- DO1
- DO2
- DO3
-
-
- true
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 连接状态:
-
-
-
-
-
- DI:
- DI0
- DI1
- DI2
- DI3
- DI4
- DI5
- DI6
- DI7
-
-
-
-
-
-
-
-
-
- DO输出
-
- DO0
- DO1
- DO2
- DO3
- DO4
- DO5
- DO6
- DO7
-
-
- True
- False
-
-
-
-
-
-
- 舵机控制
-
- 舵机1
- 舵机2
- 舵机3
- 舵机4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 果汁:
-
-
-
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 咖啡:
-
-
-
-
-
-
- 果汁:
-
- 饮品1
- 饮品2
- 饮品3
- 饮品4
-
-
- 热饮
- 常温
- 冷饮
-
-
-
-
-
-
- 开水:
-
-
-
-
-
- 茶水:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 连接状态:
-
-
-
-
-
-
-
-
-
-
-
-
- 设备状态:
-
-
-
-
-
-
-
-
-
- 控制:
-
-
-
-
-
-
- 出冰时间:
-
- s
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 咖啡机状态
-
- 应用状态
-
- 告警信息
-
- 故障信息
-
-
-
-
- 饮品
-
-
-
-
-
-
-
- 模式
-
-
-
-
-
-
+
+ 机器人执行程序:
+
+
+
+
+ 咖啡机执行程序:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 通道1的值:
+
+
+
+ 通道2的值:
+
+
+
+ 通道3的值:
+
+
+
+ 通道4的值:
+
+
+
+ 通道5的值:
+
+
+
+ 通道6的值:
+
+
+
+ 通道7的值:
+
+
+
+ 通道8的值:
+
+
+
+ 通道9的值:
+
+
+
+ 通道10的值:
+
+
+
+ 通道11的值:
+
+
+
+ 通道12的值:
+
+
+
+ 味魔方执行程序:
+
+
+
+
+
+
+
+ 电爪执行程序:
+
+
+
diff --git a/BPASmartClient.MorkT_BarCounter/View/TestView.xaml b/BPASmartClient.MorkT_BarCounter/View/TestView.xaml
new file mode 100644
index 00000000..2d68b53a
--- /dev/null
+++ b/BPASmartClient.MorkT_BarCounter/View/TestView.xaml
@@ -0,0 +1,439 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TCP DI:
+ DI0
+
+
+
+
+ DI:
+ DI0
+ DI1
+ DI2
+ DI3
+
+
+
+
+ DO:
+
+ DO0
+ DO1
+ DO2
+ DO3
+
+
+ true
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 连接状态:
+
+
+
+
+
+ DI:
+ DI0
+ DI1
+ DI2
+ DI3
+ DI4
+ DI5
+ DI6
+ DI7
+
+
+
+
+
+
+
+
+
+ DO输出
+
+ DO0
+ DO1
+ DO2
+ DO3
+ DO4
+ DO5
+ DO6
+ DO7
+
+
+ True
+ False
+
+
+
+
+
+
+ 舵机控制
+
+ 舵机1
+ 舵机2
+ 舵机3
+ 舵机4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 果汁:
+
+
+
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 咖啡:
+
+
+
+
+
+
+ 果汁:
+
+ 饮品1
+ 饮品2
+ 饮品3
+ 饮品4
+
+
+ 热饮
+ 常温
+ 冷饮
+
+
+
+
+
+
+ 开水:
+
+
+
+
+
+ 茶水:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 连接状态:
+
+
+
+
+
+
+
+
+
+
+
+
+ 设备状态:
+
+
+
+
+
+
+
+
+
+ 控制:
+
+
+
+
+
+
+ 出冰时间:
+
+ s
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 咖啡机状态
+
+ 应用状态
+
+ 告警信息
+
+ 故障信息
+
+
+
+
+ 饮品
+
+
+
+
+
+
+
+ 模式
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.MorkT_BarCounter/View/TestView.xaml.cs b/BPASmartClient.MorkT_BarCounter/View/TestView.xaml.cs
new file mode 100644
index 00000000..c2b2314c
--- /dev/null
+++ b/BPASmartClient.MorkT_BarCounter/View/TestView.xaml.cs
@@ -0,0 +1,37 @@
+using BPASmartClient.Helper;
+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.MorkT_BarCounter.View
+{
+ ///
+ /// DebugView.xaml 的交互逻辑
+ ///
+ public partial class TestView : UserControl
+ {
+ public TestView()
+ {
+ InitializeComponent();
+ }
+
+ private void Dubug_Unloaded(object sender, RoutedEventArgs e)
+ {
+ ThreadManage.GetInstance().StopTask("MorkT-状态刷新");
+ ThreadManage.GetInstance().StopTask("MorkT-传感器监视");
+
+ }
+ }
+
+}
diff --git a/BPASmartClient.MorkT_BarCounter/ViewModel/DebugViewModel.cs b/BPASmartClient.MorkT_BarCounter/ViewModel/DebugViewModel.cs
index 8cc3f0d7..c49d316d 100644
--- a/BPASmartClient.MorkT_BarCounter/ViewModel/DebugViewModel.cs
+++ b/BPASmartClient.MorkT_BarCounter/ViewModel/DebugViewModel.cs
@@ -11,6 +11,8 @@ using BPASmartClient.Model.冰淇淋.Enum;
using BPASmartClient.Model.单片机;
using BPASmartClient.Model.单片机.Enum;
using BPASmartClient.Model.咖啡机.Enum;
+using BPASmartClient.Model.奶茶味魔方;
+using BPASmartClient.Model.电夹爪;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
@@ -19,368 +21,70 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
namespace BPASmartClient.MorkT_BarCounter.ViewModel;
- public class DebugViewModel : ObservableObject
+public class DebugViewModel : ObservableObject
+{
+ public DebugViewModel()
{
-
- #region 乐白机器人
- ///
- /// 乐白机器人连接状态
- ///
- public string RobotConnected { get { return _robotConnected; } set { _robotConnected = value; OnPropertyChanged(); } }
- private string _robotConnected { get; set; }
- ///
- /// 乐白机器人的模式状态
- ///
- public string RobotMode { get { return _robotMode; } set { _robotMode = value; OnPropertyChanged(); } }
- private string _robotMode { get; set; }
- ///
- /// 机器人控制指令
- ///
- public RelayCommand Button_RobotControlCommand { get; set; }
-
- public RelayCommand Robot_DOutput { get; set; }
- ///
- /// 机器人控制
- ///
- ///
- private void Button_RobotControl(object o)
- {
- EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() });
- }
- private void Button_RobotDoutput()
+ RobotControlCommand = new RelayCommand(() =>
{
- bool DO_Value =int.Parse(Robot_DOutput_Value) == 0;
- EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { Pin = int.Parse(Robot_DOutput_Pin), Value = DO_Value });
- }
- public string Robot_TCPDI0 { get { return _robot_TCPDI0; } set { _robot_TCPDI0 = value;OnPropertyChanged(); } }
- private string _robot_TCPDI0;
-
- public string Robot_DI0 { get { return _robot_DI0; } set { _robot_DI0 = value; OnPropertyChanged(); } }
- private string _robot_DI0;
- public string Robot_DI1 { get { return _robot_DI1; } set { _robot_DI1 = value; OnPropertyChanged(); } }
- private string _robot_DI1;
- public string Robot_DI2 { get { return _robot_DI2; } set { _robot_DI2 = value; OnPropertyChanged(); } }
- private string _robot_DI2;
- public string Robot_DI3 { get { return _robot_DI3; } set { _robot_DI3 = value; OnPropertyChanged(); } }
- private string _robot_DI3;
-
-
- public string Robot_DOutput_Pin { get { return _robot_DOutput_Pin; } set { _robot_DOutput_Pin = value; OnPropertyChanged(); } }
- private string _robot_DOutput_Pin { get; set; }
- public string Robot_DOutput_Value { get { return _robot_DOutput_Valuet; } set { _robot_DOutput_Valuet = value; OnPropertyChanged(); } }
- private string _robot_DOutput_Valuet { get; set; }
- #endregion
- #region 单片机
- public string MCUConnected { get { return _mcuConnected; } set { _mcuConnected = value; OnPropertyChanged(); } }
- private string _mcuConnected { get; set; }
-
- public string MCUDI0 { get { return _mCUDI0; } set { _mCUDI0 = value; OnPropertyChanged(); } }
- private string _mCUDI0 { get; set; }
- public string MCUDI1 { get { return _mCUDI1; } set { _mCUDI1 = value; OnPropertyChanged(); } }
- private string _mCUDI1 { get; set; }
- public string MCUDI2 { get { return _mCUDI2; } set { _mCUDI2 = value; OnPropertyChanged(); } }
- private string _mCUDI2 { get; set; }
- public string MCUDI3 { get { return _mCUDI3; } set { _mCUDI3 = value; OnPropertyChanged(); } }
- private string _mCUDI3 { get; set; }
- public string MCUDI4 { get { return _mCUDI4; } set { _mCUDI4 = value; OnPropertyChanged(); } }
- private string _mCUDI4 { get; set; }
- public string MCUDI5 { get { return _mCUDI5; } set { _mCUDI5 = value; OnPropertyChanged(); } }
- private string _mCUDI5 { get; set; }
- public string MCUDI6 { get { return _mCUDI6; } set { _mCUDI6 = value; OnPropertyChanged(); } }
- private string _mCUDI6 { get; set; }
- public string MCUDI7 { get { return _mCUDI7; } set { _mCUDI7 = value; OnPropertyChanged(); } }
- private string _mCUDI7 { get; set; }
-
- public RelayCommand Button_MCUOuputCommand { get; set; }
- public RelayCommand Button_MCUDOuputCommand { get; set; }
-
- public int MCU_PWM_CH { get { return _choosePWM; } set { _choosePWM = value; OnPropertyChanged(); } }
- private int _choosePWM = 1;
- public int PWMInputNumber { get { return _pwmInputNumber; } set { _pwmInputNumber = value; OnPropertyChanged(); } }
- private int _pwmInputNumber = 1;
+ new WriteJaka() { DeviceId = 126, TagName = "JaKaProgramName", Value = JakaRobotProgram }.Publish();
- private int[] DICH { get { return _diCH; } set { _diCH = value; OnPropertyChanged(); } }
- private int[] _diCH = new int[8];
-
- public int MCU_DO_CH { get { return _mcuDO_CH; } set { _mcuDO_CH = value; OnPropertyChanged(); } }
- private int _mcuDO_CH = 1;
- public bool MCU_DO_Value { get { return _mcu_DO_Valuer; } set { _mcu_DO_Valuer = value; OnPropertyChanged(); } }
- private bool _mcu_DO_Valuer = true;
-
- private void Button_McuPWMOutput()
+ });
+ CoffeeControlCommand = new RelayCommand(() =>
{
- string sChoosePWM = Convert.ToString(MCU_PWM_CH + 1);
- new WriteMcu() { TagName = "ServoControl", Address = sChoosePWM, Value = PWMInputNumber }.Publish();
- }
- private void Button_McuDOutput()
+ new DRCoffee_MakeCoffeeEvent() { DeviceId = 126, DrinkCode = (DrCoffeeDrinksCode)(CoffeeKind) }.Publish();
+ });
+ MikeTeaCupControlCommand = new RelayCommand(() =>
{
- string sChooseDO = Convert.ToString(MCU_DO_CH + 1);
- new WriteMcu() { TagName = "OutputControl", Address = sChooseDO, Value = MCU_DO_Value }.Publish();
- }
- #endregion
- #region 果汁机
- ///
- /// 果汁机的连接状态
- ///
- public string JuicerConnected { get { return _JuicerConnected; } set { _JuicerConnected = value; OnPropertyChanged(); } }
- private string _JuicerConnected { get; set; }
-
- public string JuiceState_Heating { get { return _juiceState_Heating; } set { _juiceState_Heating = value;OnPropertyChanged(); } }
- public string _juiceState_Heating { get; set; }
- public string JuiceState_Cooling { get { return _juiceState_Cooling; } set { _juiceState_Cooling = value; OnPropertyChanged(); } }
- public string _juiceState_Cooling { get; set; }
- public string JuiceState_LackOfWater { get { return _juiceState_LackOfWater; } set { _juiceState_LackOfWater = value; OnPropertyChanged(); } }
- public string _juiceState_LackOfWater { get; set; }
- public string JuiceState_ChildLocks { get { return _juiceState_ChildLocks; } set { _juiceState_ChildLocks = value; OnPropertyChanged(); } }
- public string _juiceState_ChildLocks { get; set; }
- public string JuiceState_Using { get { return _juiceState_Using; } set { _juiceState_Using = value; OnPropertyChanged(); } }
- public string _juiceState_Using { get; set; }
-
- public string MakeJuice_Index { get { return _makeJuice_Index; } set { _makeJuice_Index = value; OnPropertyChanged(); } }
- public string _makeJuice_Index { get; set; }
-
- public RelayCommand Button_MakeJuiceCommand { get; set; }
-
- public void Button_MakeJuice()
+ new MilkTea_MakeMilkTeaEvent() { DeviceId = 126, TagName = "ParameterSet", MilkTeaKind = GVL_MorkT.MilkTeaCHValue }.Publish(); //写入奶茶参数
+ new MilkTea_MakeMilkTeaEvent() { DeviceId = 126, TagName = "Start" }.Publish();
+ });
+ GripperControlCommand = new RelayCommand(() =>
{
- new WriteJuicer() { Value = MakeJuice_Index }.Publish();
- }
- #endregion
- #region 制冰机
- public string IceMakerConnect { get { return _iceMakerConnect; } set { _iceMakerConnect = value;OnPropertyChanged(); } }
- private string _iceMakerConnect { get; set; }
- public string IceMakerState { get { return _iceMakerState; } set { _iceMakerState = value; OnPropertyChanged(); } }
- private string _iceMakerState { get; set; }
- public int IceMaker_IceTime { get { return _iceMaker_IceTime; } set { _iceMaker_IceTime = value; OnPropertyChanged(); } }
- private int _iceMaker_IceTime = 3;
-
- #region 订单模拟
- public RelayCommand SimOrderMakeCoffee { get; set; }
- public RelayCommand SimOrderMakeJuice { get; set; }
- public RelayCommand SimOrderMakeTea { get; set; }
- public RelayCommand SimOrderMakeWater { get; set; }
-
- public int SimOrder_JuiceList { get { return _simOrder_JuiceList; } set { _simOrder_JuiceList = value; OnPropertyChanged(); } }
- public int _simOrder_JuiceList { get; set; }
- public string SimOrder_JuiceMakeID { get { return _simOrder_JuiceMakeID; } set { _simOrder_JuiceMakeID = value; OnPropertyChanged(); } }
- public string _simOrder_JuiceMakeID { get; set; }
- #endregion
-
- public RelayCommand IceMaker_BtnPowerOn { get; set; }
- public RelayCommand IceMaker_BtnStandby { get; set;}
- public RelayCommand IceMaker_BtnPump { get; set;}
-
- public RelayCommand IceMaker_BtnStart { get; set; }
- public RelayCommand IceMaker_BtnEnd { get; set; }
- public RelayCommand IceMaker_BtnSetIceTime { get; set; }
-
- private void IceMaker_BtnPowerOnCommand()
- {
- new PowerOnMakeIce().Publish();
- }
- private void IceMaker_BtnStandbyCommand()
- {
- new StandbyMakeIce().Publish();
- }
- private void IceMaker_BtnPumpCommand()
- {
- new PumpMakeIce().Publish();
- }
- private void IceMaker_BtnStartCommand()
- {
- new StartMakeIce().Publish();
- }
- private void IceMaker_BtnEndCommand()
- {
- new StopMakeIce().Publish();
- }
- private void IceMaker_BtnSetIceTimeCommand()
- {
- new SetIceNumber{ Value= IceMaker_IceTime }.Publish();
- }
- #endregion
- #region 咖啡机
- ///
- /// 咖啡机连接状态
- ///
- public string CoffeeConnected { get { return _coffeeConnected; } set { _coffeeConnected = value; OnPropertyChanged(); } }
- private string _coffeeConnected { get; set; }
- ///
- /// 咖啡机状态
- ///
- public string CoffeeStatus { get { return _coffeeStatus; } set { _coffeeStatus = value; OnPropertyChanged(); } }
- private string _coffeeStatus { get; set; }
- ///
- /// 应用状态
- ///
- public string AppStatus { get { return _appStatus; } set { _appStatus = value; OnPropertyChanged(); } }
- private string _appStatus { get; set; }
- ///
- /// 告警
- ///
- public string Warning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } }
- public string _warning { get; set; }
- ///
- /// 故障信息
- ///
- public string CaffeeFault { get { return _caffeeFault; } set { _caffeeFault = value; OnPropertyChanged(); } }
- public string _caffeeFault { get; set; }
-
- public List Coffees { get; set; } = new List();
- public string SelectedCoffee { get { return _selectedCoffee; } set { _selectedCoffee = value; OnPropertyChanged(); } }
- public string _selectedCoffee { get; set; }
-
- public List CoffeeCmds { get; set; } = new List();
- public string SelectedCoffeeCmd { get; set; }
-
-
- public string SimOrderCoffeeList { get { return _simOrderCoffeeList; } set { _simOrderCoffeeList = value; OnPropertyChanged(); } }
- public string _simOrderCoffeeList { get; set; }
-
- ///
- /// 制作咖啡
- ///
- public RelayCommand Button_MakeCoffeeCommand { get; set; }
- ///
- /// 停止制作咖啡
- ///
- public RelayCommand Button_StopMakeCoffeCommand { get; set; }
- ///
- /// 咖啡模式设置
- ///
- public RelayCommand Button_CoffeeModeSetCommand { get; set; }
-
- private void Button_MakeCoffee()
- {
- EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SelectedCoffee) });
- }
- private void Button_StopMakeCoffe()
- {
- EventBus.EventBus.GetInstance().Publish(new DRCoffee_CancelMakeCoffeeEvent() { DeviceId = DeviceId });
- }
- private void Button_CoffeeModeSet()
- {
- EventBus.EventBus.GetInstance().Publish(new DRCoffee_CoffeeCommCmdEvent() { DeviceId = DeviceId, CommCmd = (DrCoffeeCommCmd)Enum.Parse(typeof(DrCoffeeCommCmd), SelectedCoffeeCmd) });
- }
-
- #endregion
- ///
- /// 设备ID
- ///
- public int DeviceId { get; set; }
- ///
- /// 设备数据
- ///
- public ObservableCollection variableMonitors { get; set; }
-
- public DebugViewModel()
- {
- SimOrderMakeCoffee = new RelayCommand(() =>
- {
- new MorkTSimOrder() { OrderNum = 1, DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SimOrderCoffeeList) }.Publish();
- });
- SimOrderMakeJuice = new RelayCommand(() =>
- {
- new MorkTSimOrder() { OrderNum = 2, JuiceList = SimOrder_JuiceList, JuiceMakeID = SimOrder_JuiceMakeID }.Publish();
- });
- SimOrderMakeTea = new RelayCommand(() =>
+ string value = GripperProgam + "";
+ if (value.Length == 1)
{
- new MorkTSimOrder() { OrderNum = 3 }.Publish();
- });
- SimOrderMakeWater = new RelayCommand(() =>
- {
- new MorkTSimOrder() { OrderNum = 4 }.Publish();
- });
- Button_RobotControlCommand = new RelayCommand(Button_RobotControl);
- Robot_DOutput = new RelayCommand(Button_RobotDoutput);
-
- Button_MakeCoffeeCommand = new RelayCommand(Button_MakeCoffee);
- Button_StopMakeCoffeCommand = new RelayCommand(Button_StopMakeCoffe);
- Button_CoffeeModeSetCommand = new RelayCommand(Button_CoffeeModeSet);
-
- Button_MCUOuputCommand = new RelayCommand(Button_McuPWMOutput);
- Button_MCUDOuputCommand = new RelayCommand(Button_McuDOutput);
-
- Button_MakeJuiceCommand = new RelayCommand(Button_MakeJuice);
-
- IceMaker_BtnPowerOn = new RelayCommand(IceMaker_BtnPowerOnCommand);
- IceMaker_BtnStandby = new RelayCommand(IceMaker_BtnStandbyCommand);
- IceMaker_BtnPump = new RelayCommand(IceMaker_BtnPumpCommand);
- IceMaker_BtnStart = new RelayCommand(IceMaker_BtnStartCommand);
- IceMaker_BtnEnd = new RelayCommand(IceMaker_BtnEndCommand);
- IceMaker_BtnSetIceTime = new RelayCommand(IceMaker_BtnSetIceTimeCommand);
-
- foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode)))
+ value = "000" + value;
+ }
+ else if (value.Length == 2)
{
- Coffees.Add(code.ToString());
+ value = "00" + value;
}
- SelectedCoffee = Coffees[0];
- SimOrderCoffeeList = Coffees[0];
- foreach (DrCoffeeCommCmd code in Enum.GetValues(typeof(DrCoffeeCommCmd)))
+ else if (value.Length == 3)
{
- CoffeeCmds.Add(code.ToString());
+ value = "0" + value;
}
- SelectedCoffeeCmd = CoffeeCmds[0];
-
- Plugin.GetInstance()?.GetPlugin()?.GetDevices().ForEach(device =>
+ else
{
- if (device.Name == "MorkT") DeviceId = device.DeviceId
- ;
- });
- ThreadManage.GetInstance().StartLong(new Action(() =>
+ value = "1350";
+ }
+ new WriteGripper() { DeviceId = 126, TagName = "PWMControl", CH_Number = "0", PWMOutput = value }.Publish();//夹爪的幅度控制
+ });
+ MikeTeaCupSetParCommand = new RelayCommand(() =>
+ {
+ for (int i = 0; i < 12; i++)
{
- variableMonitors = Plugin.GetInstance()?.GetPlugin()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;
- if (variableMonitors != null && variableMonitors.Count > 0)
- {
- #region 机器人
- RobotConnected = variableMonitors.FirstOrDefault(p => p.Notes == "机器人连接状态").CurrentValue == "True" ? "已连接" : "未连接";
- RobotMode = variableMonitors.FirstOrDefault(p => p.Notes == "机器人状态").CurrentValue;
- Robot_TCPDI0 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人TCP输入状态").CurrentValue;
- Robot_DI0 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入0状态").CurrentValue;
- Robot_DI1 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入1状态").CurrentValue;
- Robot_DI2 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入2状态").CurrentValue;
- Robot_DI3 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入3状态").CurrentValue;
-
- #endregion
-
- #region 咖啡机
- CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
- CoffeeStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机状态").CurrentValue;
- AppStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机应用状态").CurrentValue;
- Warning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue;
- CaffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue;
- #endregion
-
- #region 单片机
- MCUConnected = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
- MCUDI0 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入0状态").CurrentValue;
- MCUDI1 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入1状态").CurrentValue;
- MCUDI2 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入2状态").CurrentValue;
- MCUDI3 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入3状态").CurrentValue;
- MCUDI4 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入4状态").CurrentValue;
- MCUDI5 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入5状态").CurrentValue;
- MCUDI6 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入6状态").CurrentValue;
- MCUDI7 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入7状态").CurrentValue;
- #endregion
-
- #region 制冰机
- IceMakerConnect = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
- IceMakerState = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机设备状态").CurrentValue;
- #endregion
-
-
- #region 果汁机
- JuicerConnected = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
- JuiceState_Heating = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制热").CurrentValue;
- JuiceState_Cooling = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制冷").CurrentValue;
- JuiceState_LackOfWater = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机缺水").CurrentValue;
- JuiceState_ChildLocks = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机童锁").CurrentValue;
- JuiceState_Using = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机使用").CurrentValue;
-
- #endregion
- }
- Thread.Sleep(500);
- }), "MorkT-状态刷新");
- }
+ GVL_MorkT.MilkTeaCHValue[i] = (ushort)CH_Value[i];
+ }
+ });
}
+ public int JakaRobotProgram { get { return _JakaRobotProgram; } set { _JakaRobotProgram = value; OnPropertyChanged(); } }
+ private int _JakaRobotProgram { get; set; }
+ public RelayCommand RobotControlCommand { get; set; }
+ public RelayCommand MikeTeaCupSetParCommand { get; set; }
+ public int CoffeeKind { get { return _CoffeeKind; } set { _CoffeeKind = value; OnPropertyChanged(); } }
+ private int _CoffeeKind { get; set; }
+ public RelayCommand CoffeeControlCommand { get; set; }
+
+ public int MilkTeaCub { get { return _MilkTeaCub; } set { _MilkTeaCub = value; OnPropertyChanged(); } }
+ private int _MilkTeaCub { get; set; }
+ public RelayCommand MikeTeaCupControlCommand { get; set; }
+ public int GripperProgam { get { return _GripperProgam; } set { _GripperProgam = value; OnPropertyChanged(); } }
+ private int _GripperProgam { get; set; }
+
+ public int[] CH_Value { get { return _CH_Value; } set { _CH_Value = value; OnPropertyChanged(); } }
+ private int[] _CH_Value { get; set; } = new int[12] {200,200,200,200,200,200,200,200,200,200,200,200 };
+
+ public RelayCommand GripperControlCommand { get; set; }
+}
diff --git a/BPASmartClient.MorkT_BarCounter/ViewModel/TestViewModel.cs b/BPASmartClient.MorkT_BarCounter/ViewModel/TestViewModel.cs
new file mode 100644
index 00000000..194eb312
--- /dev/null
+++ b/BPASmartClient.MorkT_BarCounter/ViewModel/TestViewModel.cs
@@ -0,0 +1,386 @@
+using BPASmartClient.Business;
+using BPASmartClient.Device;
+using BPASmartClient.DRCoffee;
+using BPASmartClient.EventBus;
+using BPASmartClient.Helper;
+using BPASmartClient.LebaiRobot;
+using BPASmartClient.Message;
+using BPASmartClient.Model;
+using BPASmartClient.Model.乐白机器人;
+using BPASmartClient.Model.冰淇淋.Enum;
+using BPASmartClient.Model.单片机;
+using BPASmartClient.Model.单片机.Enum;
+using BPASmartClient.Model.咖啡机.Enum;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading;
+namespace BPASmartClient.MorkT_BarCounter.ViewModel;
+ public class TestViewModel : ObservableObject
+ {
+
+ #region 乐白机器人
+ ///
+ /// 乐白机器人连接状态
+ ///
+ public string RobotConnected { get { return _robotConnected; } set { _robotConnected = value; OnPropertyChanged(); } }
+ private string _robotConnected { get; set; }
+ ///
+ /// 乐白机器人的模式状态
+ ///
+ public string RobotMode { get { return _robotMode; } set { _robotMode = value; OnPropertyChanged(); } }
+ private string _robotMode { get; set; }
+ ///
+ /// 机器人控制指令
+ ///
+ public RelayCommand Button_RobotControlCommand { get; set; }
+
+ public RelayCommand Robot_DOutput { get; set; }
+ ///
+ /// 机器人控制
+ ///
+ ///
+ private void Button_RobotControl(object o)
+ {
+ EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() });
+ }
+ private void Button_RobotDoutput()
+ {
+ bool DO_Value =int.Parse(Robot_DOutput_Value) == 0;
+ EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { Pin = int.Parse(Robot_DOutput_Pin), Value = DO_Value });
+ }
+ public string Robot_TCPDI0 { get { return _robot_TCPDI0; } set { _robot_TCPDI0 = value;OnPropertyChanged(); } }
+ private string _robot_TCPDI0;
+
+ public string Robot_DI0 { get { return _robot_DI0; } set { _robot_DI0 = value; OnPropertyChanged(); } }
+ private string _robot_DI0;
+ public string Robot_DI1 { get { return _robot_DI1; } set { _robot_DI1 = value; OnPropertyChanged(); } }
+ private string _robot_DI1;
+ public string Robot_DI2 { get { return _robot_DI2; } set { _robot_DI2 = value; OnPropertyChanged(); } }
+ private string _robot_DI2;
+ public string Robot_DI3 { get { return _robot_DI3; } set { _robot_DI3 = value; OnPropertyChanged(); } }
+ private string _robot_DI3;
+
+
+ public string Robot_DOutput_Pin { get { return _robot_DOutput_Pin; } set { _robot_DOutput_Pin = value; OnPropertyChanged(); } }
+ private string _robot_DOutput_Pin { get; set; }
+ public string Robot_DOutput_Value { get { return _robot_DOutput_Valuet; } set { _robot_DOutput_Valuet = value; OnPropertyChanged(); } }
+ private string _robot_DOutput_Valuet { get; set; }
+ #endregion
+ #region 单片机
+ public string MCUConnected { get { return _mcuConnected; } set { _mcuConnected = value; OnPropertyChanged(); } }
+ private string _mcuConnected { get; set; }
+
+ public string MCUDI0 { get { return _mCUDI0; } set { _mCUDI0 = value; OnPropertyChanged(); } }
+ private string _mCUDI0 { get; set; }
+ public string MCUDI1 { get { return _mCUDI1; } set { _mCUDI1 = value; OnPropertyChanged(); } }
+ private string _mCUDI1 { get; set; }
+ public string MCUDI2 { get { return _mCUDI2; } set { _mCUDI2 = value; OnPropertyChanged(); } }
+ private string _mCUDI2 { get; set; }
+ public string MCUDI3 { get { return _mCUDI3; } set { _mCUDI3 = value; OnPropertyChanged(); } }
+ private string _mCUDI3 { get; set; }
+ public string MCUDI4 { get { return _mCUDI4; } set { _mCUDI4 = value; OnPropertyChanged(); } }
+ private string _mCUDI4 { get; set; }
+ public string MCUDI5 { get { return _mCUDI5; } set { _mCUDI5 = value; OnPropertyChanged(); } }
+ private string _mCUDI5 { get; set; }
+ public string MCUDI6 { get { return _mCUDI6; } set { _mCUDI6 = value; OnPropertyChanged(); } }
+ private string _mCUDI6 { get; set; }
+ public string MCUDI7 { get { return _mCUDI7; } set { _mCUDI7 = value; OnPropertyChanged(); } }
+ private string _mCUDI7 { get; set; }
+
+ public RelayCommand Button_MCUOuputCommand { get; set; }
+ public RelayCommand Button_MCUDOuputCommand { get; set; }
+
+ public int MCU_PWM_CH { get { return _choosePWM; } set { _choosePWM = value; OnPropertyChanged(); } }
+ private int _choosePWM = 1;
+ public int PWMInputNumber { get { return _pwmInputNumber; } set { _pwmInputNumber = value; OnPropertyChanged(); } }
+ private int _pwmInputNumber = 1;
+
+ private int[] DICH { get { return _diCH; } set { _diCH = value; OnPropertyChanged(); } }
+ private int[] _diCH = new int[8];
+
+ public int MCU_DO_CH { get { return _mcuDO_CH; } set { _mcuDO_CH = value; OnPropertyChanged(); } }
+ private int _mcuDO_CH = 1;
+ public bool MCU_DO_Value { get { return _mcu_DO_Valuer; } set { _mcu_DO_Valuer = value; OnPropertyChanged(); } }
+ private bool _mcu_DO_Valuer = true;
+
+ private void Button_McuPWMOutput()
+ {
+ string sChoosePWM = Convert.ToString(MCU_PWM_CH + 1);
+ new WriteMcu() { TagName = "ServoControl", Address = sChoosePWM, Value = PWMInputNumber }.Publish();
+ }
+ private void Button_McuDOutput()
+ {
+ string sChooseDO = Convert.ToString(MCU_DO_CH + 1);
+ new WriteMcu() { TagName = "OutputControl", Address = sChooseDO, Value = MCU_DO_Value }.Publish();
+ }
+ #endregion
+ #region 果汁机
+ ///
+ /// 果汁机的连接状态
+ ///
+ public string JuicerConnected { get { return _JuicerConnected; } set { _JuicerConnected = value; OnPropertyChanged(); } }
+ private string _JuicerConnected { get; set; }
+
+ public string JuiceState_Heating { get { return _juiceState_Heating; } set { _juiceState_Heating = value;OnPropertyChanged(); } }
+ public string _juiceState_Heating { get; set; }
+ public string JuiceState_Cooling { get { return _juiceState_Cooling; } set { _juiceState_Cooling = value; OnPropertyChanged(); } }
+ public string _juiceState_Cooling { get; set; }
+ public string JuiceState_LackOfWater { get { return _juiceState_LackOfWater; } set { _juiceState_LackOfWater = value; OnPropertyChanged(); } }
+ public string _juiceState_LackOfWater { get; set; }
+ public string JuiceState_ChildLocks { get { return _juiceState_ChildLocks; } set { _juiceState_ChildLocks = value; OnPropertyChanged(); } }
+ public string _juiceState_ChildLocks { get; set; }
+ public string JuiceState_Using { get { return _juiceState_Using; } set { _juiceState_Using = value; OnPropertyChanged(); } }
+ public string _juiceState_Using { get; set; }
+
+ public string MakeJuice_Index { get { return _makeJuice_Index; } set { _makeJuice_Index = value; OnPropertyChanged(); } }
+ public string _makeJuice_Index { get; set; }
+
+ public RelayCommand Button_MakeJuiceCommand { get; set; }
+
+ public void Button_MakeJuice()
+ {
+ new WriteJuicer() { Value = MakeJuice_Index }.Publish();
+ }
+ #endregion
+ #region 制冰机
+ public string IceMakerConnect { get { return _iceMakerConnect; } set { _iceMakerConnect = value;OnPropertyChanged(); } }
+ private string _iceMakerConnect { get; set; }
+ public string IceMakerState { get { return _iceMakerState; } set { _iceMakerState = value; OnPropertyChanged(); } }
+ private string _iceMakerState { get; set; }
+ public int IceMaker_IceTime { get { return _iceMaker_IceTime; } set { _iceMaker_IceTime = value; OnPropertyChanged(); } }
+ private int _iceMaker_IceTime = 3;
+
+ #region 订单模拟
+ public RelayCommand SimOrderMakeCoffee { get; set; }
+ public RelayCommand SimOrderMakeJuice { get; set; }
+ public RelayCommand SimOrderMakeTea { get; set; }
+ public RelayCommand SimOrderMakeWater { get; set; }
+
+ public int SimOrder_JuiceList { get { return _simOrder_JuiceList; } set { _simOrder_JuiceList = value; OnPropertyChanged(); } }
+ public int _simOrder_JuiceList { get; set; }
+ public string SimOrder_JuiceMakeID { get { return _simOrder_JuiceMakeID; } set { _simOrder_JuiceMakeID = value; OnPropertyChanged(); } }
+ public string _simOrder_JuiceMakeID { get; set; }
+ #endregion
+
+ public RelayCommand IceMaker_BtnPowerOn { get; set; }
+ public RelayCommand IceMaker_BtnStandby { get; set;}
+ public RelayCommand IceMaker_BtnPump { get; set;}
+
+ public RelayCommand IceMaker_BtnStart { get; set; }
+ public RelayCommand IceMaker_BtnEnd { get; set; }
+ public RelayCommand IceMaker_BtnSetIceTime { get; set; }
+
+ private void IceMaker_BtnPowerOnCommand()
+ {
+ new PowerOnMakeIce().Publish();
+ }
+ private void IceMaker_BtnStandbyCommand()
+ {
+ new StandbyMakeIce().Publish();
+ }
+ private void IceMaker_BtnPumpCommand()
+ {
+ new PumpMakeIce().Publish();
+ }
+ private void IceMaker_BtnStartCommand()
+ {
+ new StartMakeIce().Publish();
+ }
+ private void IceMaker_BtnEndCommand()
+ {
+ new StopMakeIce().Publish();
+ }
+ private void IceMaker_BtnSetIceTimeCommand()
+ {
+ new SetIceNumber{ Value= IceMaker_IceTime }.Publish();
+ }
+ #endregion
+ #region 咖啡机
+ ///
+ /// 咖啡机连接状态
+ ///
+ public string CoffeeConnected { get { return _coffeeConnected; } set { _coffeeConnected = value; OnPropertyChanged(); } }
+ private string _coffeeConnected { get; set; }
+ ///
+ /// 咖啡机状态
+ ///
+ public string CoffeeStatus { get { return _coffeeStatus; } set { _coffeeStatus = value; OnPropertyChanged(); } }
+ private string _coffeeStatus { get; set; }
+ ///
+ /// 应用状态
+ ///
+ public string AppStatus { get { return _appStatus; } set { _appStatus = value; OnPropertyChanged(); } }
+ private string _appStatus { get; set; }
+ ///
+ /// 告警
+ ///
+ public string Warning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } }
+ public string _warning { get; set; }
+ ///
+ /// 故障信息
+ ///
+ public string CaffeeFault { get { return _caffeeFault; } set { _caffeeFault = value; OnPropertyChanged(); } }
+ public string _caffeeFault { get; set; }
+
+ public List Coffees { get; set; } = new List();
+ public string SelectedCoffee { get { return _selectedCoffee; } set { _selectedCoffee = value; OnPropertyChanged(); } }
+ public string _selectedCoffee { get; set; }
+
+ public List CoffeeCmds { get; set; } = new List();
+ public string SelectedCoffeeCmd { get; set; }
+
+
+ public string SimOrderCoffeeList { get { return _simOrderCoffeeList; } set { _simOrderCoffeeList = value; OnPropertyChanged(); } }
+ public string _simOrderCoffeeList { get; set; }
+
+ ///
+ /// 制作咖啡
+ ///
+ public RelayCommand Button_MakeCoffeeCommand { get; set; }
+ ///
+ /// 停止制作咖啡
+ ///
+ public RelayCommand Button_StopMakeCoffeCommand { get; set; }
+ ///
+ /// 咖啡模式设置
+ ///
+ public RelayCommand Button_CoffeeModeSetCommand { get; set; }
+
+ private void Button_MakeCoffee()
+ {
+ EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SelectedCoffee) });
+ }
+ private void Button_StopMakeCoffe()
+ {
+ EventBus.EventBus.GetInstance().Publish(new DRCoffee_CancelMakeCoffeeEvent() { DeviceId = DeviceId });
+ }
+ private void Button_CoffeeModeSet()
+ {
+ EventBus.EventBus.GetInstance().Publish(new DRCoffee_CoffeeCommCmdEvent() { DeviceId = DeviceId, CommCmd = (DrCoffeeCommCmd)Enum.Parse(typeof(DrCoffeeCommCmd), SelectedCoffeeCmd) });
+ }
+
+ #endregion
+ ///
+ /// 设备ID
+ ///
+ public int DeviceId { get; set; }
+ ///
+ /// 设备数据
+ ///
+ public ObservableCollection variableMonitors { get; set; }
+
+ public TestViewModel()
+ {
+ SimOrderMakeCoffee = new RelayCommand(() =>
+ {
+ new MorkTSimOrder() { OrderNum = 1, DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SimOrderCoffeeList) }.Publish();
+ });
+ SimOrderMakeJuice = new RelayCommand(() =>
+ {
+ new MorkTSimOrder() { OrderNum = 2, JuiceList = SimOrder_JuiceList, JuiceMakeID = SimOrder_JuiceMakeID }.Publish();
+ });
+ SimOrderMakeTea = new RelayCommand(() =>
+ {
+ new MorkTSimOrder() { OrderNum = 3 }.Publish();
+ });
+ SimOrderMakeWater = new RelayCommand(() =>
+ {
+ new MorkTSimOrder() { OrderNum = 4 }.Publish();
+ });
+ Button_RobotControlCommand = new RelayCommand(Button_RobotControl);
+ Robot_DOutput = new RelayCommand(Button_RobotDoutput);
+
+ Button_MakeCoffeeCommand = new RelayCommand(Button_MakeCoffee);
+ Button_StopMakeCoffeCommand = new RelayCommand(Button_StopMakeCoffe);
+ Button_CoffeeModeSetCommand = new RelayCommand(Button_CoffeeModeSet);
+
+ Button_MCUOuputCommand = new RelayCommand(Button_McuPWMOutput);
+ Button_MCUDOuputCommand = new RelayCommand(Button_McuDOutput);
+
+ Button_MakeJuiceCommand = new RelayCommand(Button_MakeJuice);
+
+ IceMaker_BtnPowerOn = new RelayCommand(IceMaker_BtnPowerOnCommand);
+ IceMaker_BtnStandby = new RelayCommand(IceMaker_BtnStandbyCommand);
+ IceMaker_BtnPump = new RelayCommand(IceMaker_BtnPumpCommand);
+ IceMaker_BtnStart = new RelayCommand(IceMaker_BtnStartCommand);
+ IceMaker_BtnEnd = new RelayCommand(IceMaker_BtnEndCommand);
+ IceMaker_BtnSetIceTime = new RelayCommand(IceMaker_BtnSetIceTimeCommand);
+
+ foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode)))
+ {
+ Coffees.Add(code.ToString());
+ }
+ SelectedCoffee = Coffees[0];
+ SimOrderCoffeeList = Coffees[0];
+ foreach (DrCoffeeCommCmd code in Enum.GetValues(typeof(DrCoffeeCommCmd)))
+ {
+ CoffeeCmds.Add(code.ToString());
+ }
+ SelectedCoffeeCmd = CoffeeCmds[0];
+
+ Plugin.GetInstance()?.GetPlugin()?.GetDevices().ForEach(device =>
+ {
+ if (device.Name == "MorkT") DeviceId = device.DeviceId
+ ;
+ });
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ variableMonitors = Plugin.GetInstance()?.GetPlugin()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;
+ if (variableMonitors != null && variableMonitors.Count > 0)
+ {
+ #region 机器人
+ RobotConnected = variableMonitors.FirstOrDefault(p => p.Notes == "机器人连接状态").CurrentValue == "True" ? "已连接" : "未连接";
+ RobotMode = variableMonitors.FirstOrDefault(p => p.Notes == "机器人状态").CurrentValue;
+ Robot_TCPDI0 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人TCP输入状态").CurrentValue;
+ Robot_DI0 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入0状态").CurrentValue;
+ Robot_DI1 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入1状态").CurrentValue;
+ Robot_DI2 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入2状态").CurrentValue;
+ Robot_DI3 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入3状态").CurrentValue;
+
+ #endregion
+
+ #region 咖啡机
+ CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
+ CoffeeStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机状态").CurrentValue;
+ AppStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机应用状态").CurrentValue;
+ Warning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue;
+ CaffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue;
+ #endregion
+
+ #region 单片机
+ MCUConnected = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
+ MCUDI0 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入0状态").CurrentValue;
+ MCUDI1 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入1状态").CurrentValue;
+ MCUDI2 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入2状态").CurrentValue;
+ MCUDI3 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入3状态").CurrentValue;
+ MCUDI4 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入4状态").CurrentValue;
+ MCUDI5 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入5状态").CurrentValue;
+ MCUDI6 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入6状态").CurrentValue;
+ MCUDI7 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入7状态").CurrentValue;
+ #endregion
+
+ #region 制冰机
+ IceMakerConnect = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
+ IceMakerState = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机设备状态").CurrentValue;
+ #endregion
+
+
+ #region 果汁机
+ JuicerConnected = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
+ JuiceState_Heating = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制热").CurrentValue;
+ JuiceState_Cooling = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制冷").CurrentValue;
+ JuiceState_LackOfWater = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机缺水").CurrentValue;
+ JuiceState_ChildLocks = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机童锁").CurrentValue;
+ JuiceState_Using = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机使用").CurrentValue;
+
+ #endregion
+ }
+ Thread.Sleep(500);
+ }), "MorkT-状态刷新");
+ }
+ }
+
diff --git a/BPASmartClient.MorkT_Container/Control_MorkT_Container.cs b/BPASmartClient.MorkT_Container/Control_MorkT_Container.cs
index a34ebd62..b51c2cfb 100644
--- a/BPASmartClient.MorkT_Container/Control_MorkT_Container.cs
+++ b/BPASmartClient.MorkT_Container/Control_MorkT_Container.cs
@@ -284,7 +284,7 @@ namespace BPASmartClient.MorkT_Container
Sence(GVL_MorkT.攀华_放杯);
Wait();
- while (!morkTLebaiJC.RobotGetInput0)
+ if (!morkTLebaiJC.RobotGetInput0)
{
DeviceProcessLogShow("咖啡杯未安全放置在放杯位");
}
diff --git a/BPASmartClient.Morkt.JAKA.JC/Control_MORKJC.cs b/BPASmartClient.Morkt.JAKA.JC/Control_MORKJC.cs
index 0bb1e825..d5ec18bd 100644
--- a/BPASmartClient.Morkt.JAKA.JC/Control_MORKJC.cs
+++ b/BPASmartClient.Morkt.JAKA.JC/Control_MORKJC.cs
@@ -386,8 +386,8 @@ namespace BPASmartClient.MorktJAKAJC
if (resultTakeCup == 1)
{
DeviceProcessLogShow("咖啡杯取杯完成");
- new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接咖啡 }.Publish();
- Wait(int.Parse(JakaModel.SENCE_接咖啡));
+ new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位_接咖啡 }.Publish();
+ Wait(int.Parse(JakaModel.SENCE_取杯位_接咖啡));
new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
are.WaitOne(1000 * 180);
@@ -401,8 +401,8 @@ namespace BPASmartClient.MorktJAKAJC
}
private void PutCoffeeCup()
{
- new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放咖啡杯 }.Publish();
- Wait(int.Parse(JakaModel.SENCE_放咖啡杯));
+ new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接咖啡_放咖啡杯 }.Publish();
+ Wait(int.Parse(JakaModel.SENCE_接咖啡_放咖啡杯));
int resultputCup = putCup();
if (resultputCup == 1)
{
@@ -735,8 +735,8 @@ namespace BPASmartClient.MorktJAKAJC
Thread.Sleep(100);
new WriteJaka() { TagName = "Set_RobotAO1", Value = 0 }.Publish();
Wait(0);
- new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯 }.Publish();
- Wait(int.Parse(JakaModel.SENCE_取杯));
+ new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位检测_取杯位 }.Publish();
+ Wait(int.Parse(JakaModel.SENCE_取杯位检测_取杯位));
//取杯到位,使用落杯器
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 1, Value = true }.Publish();
if (sensor_Sign(1)==1 )
@@ -768,8 +768,8 @@ namespace BPASmartClient.MorktJAKAJC
Thread.Sleep(100);
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 0, Value = true }.Publish();
Thread.Sleep(100);
- new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯 }.Publish();
- Wait(int.Parse(JakaModel.SENCE_取杯));
+ new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位检测_取杯位 }.Publish();
+ Wait(int.Parse(JakaModel.SENCE_取杯位检测_取杯位));
getCup_cnt = getCup_cnt + 1;
Thread.Sleep(100);
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 0, Value = false }.Publish();
diff --git a/BPASmartClient.RobotGripper/BPASmartClient.RobotGripper.csproj b/BPASmartClient.RobotGripper/BPASmartClient.RobotGripper.csproj
new file mode 100644
index 00000000..e7b2574f
--- /dev/null
+++ b/BPASmartClient.RobotGripper/BPASmartClient.RobotGripper.csproj
@@ -0,0 +1,15 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.RobotGripper/RobotGripperMachine.cs b/BPASmartClient.RobotGripper/RobotGripperMachine.cs
new file mode 100644
index 00000000..7a55e09a
--- /dev/null
+++ b/BPASmartClient.RobotGripper/RobotGripperMachine.cs
@@ -0,0 +1,50 @@
+using System;
+using BPASmartClient.Peripheral;
+using BPASmartClient.SerialPort;
+using BPASmartClient.Model.צ;
+using static BPASmartClient.EventBus.EventBus;
+using BPASmartClient.EventBus;
+
+namespace BPASmartClient.RobotGripper
+{
+ public class RobotGripperMachine:BasePeripheral
+ {
+ RobotGripperHelper machineHelper = new RobotGripperHelper();
+ public override void Init()
+ {
+ machineHelper.Open(communicationPar.SerialPort, communicationPar.BaudRate);
+ EventBus.EventBus.GetInstance().Subscribe(DeviceId,delegate(IEvent @event, EventCallBackHandle callBack)
+ {
+ if (@event == null) return;
+ var par = @event as WriteGripper;
+ switch (par?.TagName)
+ {
+ case "PWMControl":
+ machineHelper.Write(Convert.ToByte(par?.CH_Number), Convert.ToString(par?.PWMOutput));
+ break;
+ default:
+ break;
+ }
+ });
+ }
+ public override void Start()
+ {
+
+ }
+
+ public override void Stop()
+ {
+ machineHelper.Stop(communicationPar.SerialPort);
+ }
+
+ public override void WriteData(string address, object value)
+ {
+
+ }
+
+ protected override void InitStatus()
+ {
+
+ }
+ }
+}
diff --git a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs
index 8566b80a..832ee997 100644
--- a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs
+++ b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs
@@ -62,7 +62,7 @@ namespace BPASmartClient.ScreenLib
if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
{
ScreenModelSplitMeals modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelSplitMeals;
- if (modelMaxWok != null && modelMaxWok.Alarm != null)
+ if (modelMaxWok != null && modelMaxWok.Alarm != null)
modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
ViewData = modelMaxWok;
diff --git a/BPASmartClient.ScreenLib/总监视大屏/ScreenALLControlViewModel.cs b/BPASmartClient.ScreenLib/总监视大屏/ScreenALLControlViewModel.cs
index 7af35177..8b1a29b1 100644
--- a/BPASmartClient.ScreenLib/总监视大屏/ScreenALLControlViewModel.cs
+++ b/BPASmartClient.ScreenLib/总监视大屏/ScreenALLControlViewModel.cs
@@ -236,6 +236,7 @@ namespace BPASmartClient.ScreenLib
string str = JsonConvert.SerializeObject(_Statsall?.OrderByDescending(k => k.Count)?.ToList());
StatsCountAll= JsonConvert.DeserializeObject>(str);
}
+ //假数据
}));
Thread.Sleep(1000);
}), $"{DateTime.Now},线程服务");
diff --git a/BPASmartClient.SerialPort/RobotGripperHelper.cs b/BPASmartClient.SerialPort/RobotGripperHelper.cs
new file mode 100644
index 00000000..9e285a25
--- /dev/null
+++ b/BPASmartClient.SerialPort/RobotGripperHelper.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.IO;
+using System.IO.Ports;
+using System.Threading;
+using System.Collections.Concurrent;
+using BPASmartClient.Message;
+using BPASmartClient.Helper;
+
+namespace BPASmartClient.SerialPort
+{
+ public class RobotGripperHelper
+ {
+
+ private System.IO.Ports.SerialPort comPort = new System.IO.Ports.SerialPort();
+ public bool IsOpen => comPort.IsOpen;
+
+ public bool Open(string portName, int baudRate)
+ {
+ if (!System.IO.Ports.SerialPort.GetPortNames().Contains(portName))
+ {
+ MessageLog.GetInstance.Show($"{portName} 串口不存在");
+ }
+ if (!comPort.IsOpen)
+ {
+ comPort.PortName = portName;
+ comPort.BaudRate = baudRate;
+ comPort.DataBits = 8;
+ comPort.Parity = Parity.None;
+ comPort.StopBits = StopBits.One;
+ /*comPort.ReadTimeout = 1000;
+ comPort.WriteTimeout = 1000;*/
+ //comPort.RtsEnable = true; //设置为 true后会读取不到数据
+ comPort.DtrEnable = true;//获取或设置一个值,该值在串行通信过程中启用数据终端就绪 (DTR) 信号。
+ //comPort.RtsEnable = true;//获取或设置一个值,该值指示在串行通信中是否启用请求发送 (RTS) 信号
+ try
+ {
+ comPort.Open();
+ }
+ catch (Exception ex)
+ {
+ MessageLog.GetInstance.ShowEx(ex.ToString());
+ }
+ }
+ /* ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+
+ Thread.Sleep(5000);
+ }), $"开启电爪设备通讯", true);*/
+ MessageLog.GetInstance.Show($"{portName} 串口打开成功");
+ return comPort.IsOpen;
+ }
+ public bool Stop(string portName)
+ {
+ comPort.Close();
+ MessageLog.GetInstance.Show($"{portName} 串口关闭成功");
+ return comPort.IsOpen;
+ }
+ ///
+ /// 舵机控制 #000P1300T1000!
+ ///
+ /// 通道号 0 - 5
+ /// 夹爪幅度 0500 - 2500
+ /// 夹爪时间 0000-9999
+ public void Write(byte index,string value,string time ="1000")
+ {
+ byte[] PwmNumber = Encoding.ASCII.GetBytes(value);
+ byte[] Times = Encoding.ASCII.GetBytes(time);
+ //byte[] buffers = new byte[15] { 0x23, 0x30, 0x30, 0x30, 0x50, PwmNumber[0], PwmNumber[1], PwmNumber[2], PwmNumber[3], 0x54, Times[0], Times[1], Times[2], Times[3], 0x21 };
+ byte[] buffers = new byte[15] { 0x23, 0x30, 0x30, 0x30, 0x50, 0x31, 0x30, 0x35,0x30, 0x54, 0x31,0x30,0x30,0x30, 0x21 };
+ if (IsOpen) comPort.Write(buffers, 0, buffers.Length);
+ }
+ }
+}
diff --git a/DosingSystem/App.xaml.cs b/DosingSystem/App.xaml.cs
index b051e05c..292ba878 100644
--- a/DosingSystem/App.xaml.cs
+++ b/DosingSystem/App.xaml.cs
@@ -56,7 +56,7 @@ namespace BPASmartClient.DosingSystem
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
- Json.Save();
+ Json.Save();
Json.Save();
Json.Save();
BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.LogSave();
@@ -290,7 +290,7 @@ namespace BPASmartClient.DosingSystem
private void DataInit()
{
//Config.GetInstance.Init();
- Json.Read();
+ Json.Read();
Json.Read();
Json.Read();
}
diff --git a/DosingSystem/Model/DeviceInquire.cs b/DosingSystem/Model/DeviceInquire.cs
index bcd7e89b..cdbe12db 100644
--- a/DosingSystem/Model/DeviceInquire.cs
+++ b/DosingSystem/Model/DeviceInquire.cs
@@ -177,12 +177,13 @@ namespace BPASmartClient.DosingSystem
Ping myPing = new Ping();
myPing.PingCompleted += new PingCompletedEventHandler(_myPing_PingCompleted);
myPing.SendAsync(item, 1000, null);
+
});
}
private void _myPing_PingCompleted(object sender, PingCompletedEventArgs e)
{
- if (e.Reply.Status == IPStatus.Success)
+ if (e.Reply != null && e.Reply.Status == IPStatus.Success)
{
string ip = e.Reply.Address.ToString();
if (!DeviceLists.ContainsKey(ip))
@@ -208,13 +209,13 @@ namespace BPASmartClient.DosingSystem
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus() { DeviceName = DeviceName });
- for (int i = 0; i < Json.Data.Recipes.Count; i++)
+ for (int i = 0; i < Json.Data.Recipes.Count; i++)
{
- for (int m = 0; m < Json.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
+ for (int m = 0; m < Json.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
{
- if (Json.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp == ip)
+ if (Json.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp == ip)
{
- Json.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
+ Json.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
}
}
}
@@ -278,7 +279,11 @@ namespace BPASmartClient.DosingSystem
}
else IPQueues.Enqueue(e.Reply.Address.ToString());
}
- else IPQueues.Enqueue(e.Reply.Address.ToString());
+ else
+ {
+ if(e.Reply !=null)
+ IPQueues.Enqueue(e.Reply.Address.ToString());
+ }
}
}
diff --git a/DosingSystem/Model/par/LocaPar.cs b/DosingSystem/Model/par/LocalRecipe.cs
similarity index 93%
rename from DosingSystem/Model/par/LocaPar.cs
rename to DosingSystem/Model/par/LocalRecipe.cs
index 992f898f..8b5cc4ae 100644
--- a/DosingSystem/Model/par/LocaPar.cs
+++ b/DosingSystem/Model/par/LocalRecipe.cs
@@ -9,7 +9,7 @@ using BPASmartClient.Model;
namespace BPASmartClient.DosingSystem
{
- public class LocaPar
+ public class LocalRecipe
{
public ObservableCollection Recipes { get; set; } = new ObservableCollection();
diff --git a/DosingSystem/View/NewRecipeView.xaml.cs b/DosingSystem/View/NewRecipeView.xaml.cs
index 4e8e1be4..b2d9eefa 100644
--- a/DosingSystem/View/NewRecipeView.xaml.cs
+++ b/DosingSystem/View/NewRecipeView.xaml.cs
@@ -26,7 +26,7 @@ namespace BPASmartClient.DosingSystem.View
this.btClose.Click += (o, e) => { this.Close(); };
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRecipeView", true);
- this.Unloaded += (o, s) => { Json.Save(); };
+ this.Unloaded += (o, s) => { Json.Save(); };
}
private void cb_SelectionChanged(object sender, SelectionChangedEventArgs e)
diff --git a/DosingSystem/View/RecipeSettingsView.xaml.cs b/DosingSystem/View/RecipeSettingsView.xaml.cs
index 55bf6e65..fe2f5a1d 100644
--- a/DosingSystem/View/RecipeSettingsView.xaml.cs
+++ b/DosingSystem/View/RecipeSettingsView.xaml.cs
@@ -30,7 +30,7 @@ namespace BPASmartClient.DosingSystem.View
private void RecipeSettingsView_Unloaded(object sender, RoutedEventArgs e)
{
- Json.Save();
+ Json.Save();
}
//public static void SetAlignment()
diff --git a/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs b/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
index c5a76db4..614de6ed 100644
--- a/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
+++ b/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
@@ -38,11 +38,11 @@ namespace BPASmartClient.DosingSystem.ViewModel
res.RawMaterialName = DeviceName;
DeviceInquire.GetInstance.devices.ElementAt(index).DeviceName = DeviceName;
DeviceInquire.GetInstance.GetDevice(IpAddress).SetDeviceName(DeviceName);//设置PLC名称
- for (int i = 0; i < Json.Data.Recipes.Count; i++)
+ for (int i = 0; i < Json.Data.Recipes.Count; i++)
{
- for (int m = 0; m < Json.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
+ for (int m = 0; m < Json.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
{
- Json.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
+ Json.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
}
}
ActionManage.GetInstance.Send("ChangeDeviceNameViewClose");
diff --git a/DosingSystem/ViewModel/NewRecipeViewModel.cs b/DosingSystem/ViewModel/NewRecipeViewModel.cs
index cb6f474b..54da0130 100644
--- a/DosingSystem/ViewModel/NewRecipeViewModel.cs
+++ b/DosingSystem/ViewModel/NewRecipeViewModel.cs
@@ -37,7 +37,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
RawMaterials.Add(item);
}
RecipCode = rm.RecipCode;
- Index = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);
+ Index = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);
}
}), "Details", true);
@@ -82,17 +82,17 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
//编辑配方
- if (Index >= 0 && Index < Json.Data.Recipes.Count)
+ if (Index >= 0 && Index < Json.Data.Recipes.Count)
{
- var res = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);
+ var res = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);
if (res >= 0 && res != Index)
{
ErrorInfo = "配方名称已经存在!";
MessageNotify.GetInstance.ShowDialog("配方名称已经存在!", DialogType.Warning);
return;
}
- Json.Data.Recipes.ElementAt(Index).RecipeName = RecipeName;
- Json.Data.Recipes.ElementAt(Index).RawMaterials.Clear();
+ Json.Data.Recipes.ElementAt(Index).RecipeName = RecipeName;
+ Json.Data.Recipes.ElementAt(Index).RawMaterials.Clear();
RawMaterials.ToList()?.ForEach(item =>
{
var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == item.RawMaterialName);
@@ -105,14 +105,14 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
item.RawMaterialSource = 0;
}
- Json.Data.Recipes.ElementAt(Index).RawMaterials.Add(item);
+ Json.Data.Recipes.ElementAt(Index).RawMaterials.Add(item);
});
- Json