瀏覽代碼

大屏优化。

菜品库计算修复bug。
样式分支
yahaha 1 年之前
父節點
當前提交
bbe11b2132
共有 6 個檔案被更改,包括 97 行新增49 行删除
  1. +2
    -1
      BPASmartClient.Business/LocalMqtt.cs
  2. +57
    -34
      BPASmartClient.MorkF/Control_MorkF.cs
  3. +9
    -2
      BPASmartClient.MorkF/GVL_MorkF.cs
  4. +6
    -0
      BPASmartClient.MorkF/View/DebugView.xaml
  5. +14
    -10
      BPASmartClient.MorkF/View/MaterialCalibration.xaml
  6. +9
    -2
      BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs

+ 2
- 1
BPASmartClient.Business/LocalMqtt.cs 查看文件

@@ -33,7 +33,8 @@ namespace BPASmartClient.Business
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(DeviceType)) ;
});
mQTTProxy.Connect("emqx_u_block", "emqx_p_admin3658765490789", "47.108.65.220", 1883, $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");//"10.2.1.254""admin", "public"
//mQTTProxy.Connect("emqx_u_block", "emqx_p_admin3658765490789", "47.108.65.220", 1883, $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");//"10.2.1.254""admin", "public"
mQTTProxy.Connect("admin", "public1", "171.221.208.23", 11883, $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");//"10.2.1.254""admin", "public"
}

public void Start()


+ 57
- 34
BPASmartClient.MorkF/Control_MorkF.cs 查看文件

@@ -136,6 +136,15 @@ namespace BPASmartClient.MorkF

List<int> resultorder = new List<int>();//调试变量

/// <summary>
/// 告警列表
/// </summary>
private List<AlarmModel> alarmModel = new List<AlarmModel>();

/// <summary>
///
/// </summary>
private List<StatsModel> statsModels = new List<StatsModel>();
/// <summary>
/// 入口
/// </summary>
@@ -559,7 +568,8 @@ namespace BPASmartClient.MorkF
{
ThreadManage.GetInstance().Start(new Action(() =>
{
OutFood(fryIndex);
string error;
OutFood(fryIndex,out error);
}), "OutFood");
}), "OutFood");

@@ -575,7 +585,8 @@ namespace BPASmartClient.MorkF
{
ThreadManage.GetInstance().Start(new Action(() =>
{
StirArmGoWork(fryIndex);
string error;
StirArmGoWork(fryIndex, out error);
}), "StirArmGoWork");
}), "StirArmGoWork");

@@ -1625,7 +1636,7 @@ namespace BPASmartClient.MorkF
FirePot_Write(item, false, num);
}
}
}), "炒锅1初始化");
}), $"炒锅{num}初始化");

}

@@ -1685,12 +1696,13 @@ namespace BPASmartClient.MorkF
Thread.Sleep(200);
}
//倒菜
public bool OutFood(int num,bool isMaterial = false)
public bool OutFood(int num,out string error,bool isMaterial = false)
{
bool ret = true;

if (!morkFs.ContainsKey(num))
{
error = $"编号为{num}的炒锅无法找到";
return false;
}
int i = 0;
@@ -1710,6 +1722,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
error = $"炒锅{num}倒菜超时:未能等到取菜完成,请检查菜品库是否正常运行";
MessageLog.GetInstance.ShowEx($"炒锅{num}倒菜超时:未能等到取菜完成");
ret &= false;
}
@@ -1734,6 +1747,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
error = $"炒锅{num}倒菜超时,请联系相关工作人员";
MessageLog.GetInstance.ShowEx($"炒锅{num}倒菜超时");
ret &= false;
}
@@ -1743,6 +1757,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(200);
MessageLog.GetInstance.Show("倒菜完成");
morkFs[num].GetMaterialComplete = false;
error = string.Empty;
return ret;
}
//搅拌臂去原点位
@@ -1771,11 +1786,13 @@ namespace BPASmartClient.MorkF
}

//搅拌臂去炒制位
public bool StirArmGoWork(int num)
public bool StirArmGoWork(int num,out string error)
{
error = string.Empty;
bool ret = true;
if (!morkFs.ContainsKey(num))
{
error = $"编号为{num}的炒锅无法找到";
return false;
}

@@ -1789,6 +1806,7 @@ namespace BPASmartClient.MorkF
Thread.Sleep(sleepTime);
if (i >= sleepCount - 1)
{
error = $"炒锅{num}搅拌臂去炒制位超时";
MessageLog.GetInstance.ShowEx($"炒锅{num}搅拌臂去炒制位超时");
ret &= false;
}
@@ -2138,8 +2156,8 @@ namespace BPASmartClient.MorkF
//遍历炒锅,找到合适、空闲的炒锅
for(int i = 0;i<morkFs.Count;i++)
{
if (/*morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete &&*/
!morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&是否在炒菜中
if (morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete && ml_morkf.InitialComplete &&
!morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&菜品库初始化&&是否在炒菜中
{
Thread.Sleep(5000);

@@ -2161,6 +2179,10 @@ namespace BPASmartClient.MorkF
{
try
{
string error = string.Empty;
//初始化大屏
morkFs[i].ScreenInit();

bool ret = true;
MessageLog.GetInstance.Show($"炒锅{i}开始炒制菜品{res.GoodName}");
@@ -2182,8 +2204,8 @@ namespace BPASmartClient.MorkF
break;
}

//调试大屏用代码
Thread.Sleep(5000);
////调试大屏用代码
//Thread.Sleep(5000);

//更新
morkFs[i].UpdateProcess(potActions);
@@ -2274,22 +2296,6 @@ namespace BPASmartClient.MorkF
{
MessageLog.GetInstance.ShowEx($"炒锅{i}获取菜品失败,菜品列表为空");
}
//if(getMaterailNum == 0)
//{
// if (NoMaterial2Coordinate(MaterialCoordinate.MLNumberList[1], out myCoordinate))
// {
// materialOperationQuenes.Enqueue(new MaterialOperation() { fryNum = i, coordinate = myCoordinate });
// getMaterailNum++;
// }
//}
//else if(getMaterailNum == 1)
//{
// if (NoMaterial2Coordinate(MaterialCoordinate.MLNumberList[4], out myCoordinate))
// {
// materialOperationQuenes.Enqueue(new MaterialOperation() { fryNum = i, coordinate = myCoordinate });
// getMaterailNum++;
// }
//}
MessageLog.GetInstance.Show(potActions.Actions);
break;
case nameof(StirFryPotActionEnum.开启搅拌):
@@ -2316,7 +2322,11 @@ namespace BPASmartClient.MorkF
MessageLog.GetInstance.Show(potActions.Actions);
break;
case nameof(StirFryPotActionEnum.道菜启动):
ret = OutFood(i, true);
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 });
}
break;
case nameof(StirFryPotActionEnum.炒制菜品):
Thread.Sleep(potActions.During * 1000);
@@ -2326,7 +2336,11 @@ namespace BPASmartClient.MorkF
MessageLog.GetInstance.Show(potActions.Actions);
break;
case nameof(StirFryPotActionEnum.搅拌臂炒制位):
ret = StirArmGoWork(i);
ret = StirArmGoWork(i,out error);
if (ret == false)
{
alarmModel.Add(new AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error });
}
MessageLog.GetInstance.Show(potActions.Actions);
break;
case nameof(StirFryPotActionEnum.洗锅):
@@ -2347,6 +2361,16 @@ namespace BPASmartClient.MorkF

//菜品统计数量+1
morkFs[i].orderCount++;

StatsModel statsModel = statsModels.FirstOrDefault(p => p.Name == res.GoodName);
if (statsModel != null)
{
statsModel.Count++;
}
else
{
statsModels.Add(new StatsModel() { Name = res.GoodName, Count = 0 });
}
}
catch (Exception ex)
{
@@ -2360,9 +2384,9 @@ namespace BPASmartClient.MorkF
nowStirFryGood[i] = null;
//炒完后出队列
morkFs[i].StirFryGoodsQuenes.TryDequeue(out var orderQueue);
morkFs[i].FryWorking = false;
morkFs[i].FryWorking = false;
//初始化大屏
morkFs[i].ScreenInit();
morkFs[i].ScreenClear();
}
}), String.Format(striConst, i.ToString(), nowStirFryGood[i].GoodName)/*$"炒锅{i}炒制{res.GoodName}线程"*/, true);
}
@@ -2412,7 +2436,6 @@ namespace BPASmartClient.MorkF
LocalMqtt.GetInstance.Init(ScreenDeviceType.小炒);
ThreadManage.GetInstance().StartLong(new Action(() =>
{
List<StatsModel> statsModels = new List<StatsModel>();
statsModels.Add(new StatsModel() { Name = "帝王蟹", Count = 666 });
//int i = new Random().Next(0, 100);
//List<ProcessModel> processModels= new List<ProcessModel>();
@@ -2441,11 +2464,11 @@ namespace BPASmartClient.MorkF
ScreenModelMinWok maxWok = new ScreenModelMinWok
{
IsRun = IsHealth ? IsRun.运行 : IsRun.停止,//new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止, //设备是否运行
WorkStatus_1 = morkFs[0].FryPot1_InitialComplete ? WorkStatus.工作 : WorkStatus.停止,// (WorkStatus)new Random().Next(0, 3), //设备运行状态
WorkStatus_2 = morkFs[1].FryPot1_InitialComplete ? WorkStatus.工作 : WorkStatus.停止,//(WorkStatus)new Random().Next(0, 3), //设备运行状态
WorkStatus_1 = morkFs[0].FryPot1_InitialComplete ? ((morkFs[0].Task != null)? WorkStatus.工作:WorkStatus.待机) : WorkStatus.停止,// (WorkStatus)new Random().Next(0, 3), //设备运行状态
WorkStatus_2 = morkFs[1].FryPot1_InitialComplete ? ((morkFs[1].Task != null) ? WorkStatus.工作 : WorkStatus.待机) : WorkStatus.停止,//(WorkStatus)new Random().Next(0, 3), //设备运行状态
RobotStatu = (WorkStatus)new Random().Next(0, 3), //机器人状态 待机 1 正常
Alarm = new List<AlarmModel>(), //告警集合
FailuresCount = 0, //故障数
Alarm = alarmModel, //告警集合
FailuresCount = alarmModel.Count, //故障数
StatsCount = statsModels, //统计菜品数量
MinWok_Dishes_1 = morkFs[0].GoodName,//"满汉全席",//当前炒制菜品名
MinWok_Dishes_2 = morkFs[1].GoodName,


+ 9
- 2
BPASmartClient.MorkF/GVL_MorkF.cs 查看文件

@@ -243,6 +243,7 @@ namespace BPASmartClient.MorkF

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

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

/// <summary>


+ 6
- 0
BPASmartClient.MorkF/View/DebugView.xaml 查看文件

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

<Grid.RowDefinitions>
<RowDefinition Height="81" ></RowDefinition>
<RowDefinition Height="81" ></RowDefinition>
@@ -188,5 +192,7 @@

</StackPanel>

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

+ 14
- 10
BPASmartClient.MorkF/View/MaterialCalibration.xaml 查看文件

@@ -5,8 +5,9 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkF.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkF.ViewModel"
x:Name="菜品库校验"
mc:Ignorable="d"
d:DesignHeight="1200" d:DesignWidth="1300">
d:DesignHeight="1000" d:DesignWidth="1300">
<UserControl.DataContext>
<vm:MaterialCalibrationViewModel/>
</UserControl.DataContext>
@@ -79,14 +80,15 @@
</UserControl.Resources>

<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="300" ></RowDefinition>
</Grid.RowDefinitions>

<GroupBox Grid.Row="0" Header="菜品库第一层" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="150" ></RowDefinition>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="菜品库第一层" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid Height="150">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
@@ -680,6 +682,8 @@
<Button Content="读取" Command="{Binding ReadCoordinate}"/>
</WrapPanel>
</Grid>
</GroupBox>
</GroupBox>
</Grid>
</ScrollViewer>
</Grid>
</UserControl>

+ 9
- 2
BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs 查看文件

@@ -264,12 +264,12 @@ namespace BPASmartClient.MorkF.ViewModel
/// <summary>
/// Y轴大菜品库的间隙
/// </summary>
private const int bigMaterialClearanceY = 9000;
private const int bigMaterialClearanceY = 15000;

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

/// <summary>
/// X轴菜品库的间隙
@@ -443,6 +443,9 @@ namespace BPASmartClient.MorkF.ViewModel
}
}

/// <summary>
/// 从json文件中读取菜品库坐标系数据
/// </summary>
private void PhysicalMaterialCoordinate()
{
MaterialCoordinate materialCoordinate = ReadMaterialCoordinate();
@@ -569,6 +572,10 @@ namespace BPASmartClient.MorkF.ViewModel

}

/// <summary>
///
/// </summary>
/// <param name="Num"></param>
private void Calibration(string Num)
{
switch (Num)


Loading…
取消
儲存