Browse Source

菜品库调整

样式分支
yahaha 2 years ago
parent
commit
5cd86b57fd
4 changed files with 356 additions and 248 deletions
  1. +201
    -200
      BPASmartClient.MorkF/Control_MorkF.cs
  2. +6
    -0
      BPASmartClient.MorkF/Model/MaterialCoordinate.cs
  3. +99
    -46
      BPASmartClient.MorkF/View/MaterialCalibration.xaml
  4. +50
    -2
      BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs

+ 201
- 200
BPASmartClient.MorkF/Control_MorkF.cs View File

@@ -175,6 +175,9 @@ namespace BPASmartClient.MorkF
MaterialCoordinate.GetInstance().frying1 = materialCoordinate.frying1;
MaterialCoordinate.GetInstance().frying2 = materialCoordinate.frying2;
MaterialCoordinate.GetInstance().materialHeight = materialCoordinate.materialHeight;
MaterialCoordinate.GetInstance().MaterialOneX = materialCoordinate.MaterialOneX;
MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX;
MaterialCoordinate.GetInstance().MaterialThreeX = materialCoordinate.MaterialThreeX;
}
////菜品库编号与坐标系对象存储
//SaveMaterialCoordinate();
@@ -1291,7 +1294,7 @@ namespace BPASmartClient.MorkF
return false;
}

if(x < moveX)
if (x < moveX)
{
MessageLog.GetInstance.ShowEx("错误:传感器距离转坐标值大于当前x轴坐标");
return false;
@@ -1315,7 +1318,6 @@ namespace BPASmartClient.MorkF
}

#endif

//伸出爪子
PawExtend();

@@ -1323,13 +1325,42 @@ namespace BPASmartClient.MorkF
Electromagnetism(new List<bool> { false });
Thread.Sleep(500);

//菜品盒子出菜品库,往上移动一个盒子的距离
if (!SetArmPosition(x - moveX - materialBoxHeight, y))

int heightDifferent = 0;
//根据x轴所在坐标系,计算高度差。
if( (x > 0 && x <= MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["1"].X)&&
(MaterialCoordinate.GetInstance().MaterialOneX > 0 && MaterialCoordinate.GetInstance().MaterialOneX < x))
{
//菜品盒子出菜品库,往上移动一个盒子的距离
if (!SetArmPosition(MaterialCoordinate.GetInstance().MaterialOneX, y))
{
return false;
}
}
else if( (x <= MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["10"].X && x > MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["1"].X)&&
(MaterialCoordinate.GetInstance().MaterialTwoX > 0 && MaterialCoordinate.GetInstance().MaterialTwoX < x))
{
//菜品盒子出菜品库,往上移动一个盒子的距离
if (!SetArmPosition(MaterialCoordinate.GetInstance().MaterialTwoX, y))
{
return false;
}
}
else if ((x > MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["10"].X && x <= MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["20"].X) &&
(MaterialCoordinate.GetInstance().MaterialThreeX > 0 && MaterialCoordinate.GetInstance().MaterialThreeX < x))
{
//菜品盒子出菜品库,往上移动一个盒子的距离
if (!SetArmPosition(MaterialCoordinate.GetInstance().MaterialThreeX, y))
{
return false;
}
}
else
{
MessageLog.GetInstance.ShowEx("错误:未设置当前菜品库出菜位置");
return false;
}


#if true
//爪子去2号位放菜
if (!PawToPoint2())
@@ -1337,16 +1368,19 @@ namespace BPASmartClient.MorkF
return false;
}
#endif
////判断炒锅是否可以放盒
//for (int i = 0; materialSleepCount > i && !morkFs[fryIndex].FryPot1_HOBTPut; i++)
//{
// Thread.Sleep(materialSleepTime);
// if (i >= materialSleepCount - 1)
// {
// MessageLog.GetInstance.Show("等待炒锅允许放盒超时");
// return;
// }
//}
//收缩爪子
PawShrink();

//判断炒锅是否可以放盒
for (int i = 0; materialSleepCount > i && !morkFs[fryIndex].FryPot1_HOBTPut; i++)
{
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount - 1)
{
MessageLog.GetInstance.Show("等待炒锅允许放盒超时");
return false;
}
}

//关闭启磁吸
MagnetOff(fryNum);
@@ -1379,6 +1413,9 @@ namespace BPASmartClient.MorkF
}
#endif

//伸出爪子
PawExtend();

//开启磁吸
MagnetOn(fryNum);

@@ -1388,15 +1425,15 @@ namespace BPASmartClient.MorkF
Electromagnetism(new List<bool> { true });
Thread.Sleep(300);

//收缩爪子
PawShrink();

//设置到炒锅i出菜处
if (!SetArmPosition(x + materialToFryDistance, y))
{
return false;
}

//收缩爪子
PawShrink();

#if true
//爪子回到2号位
if (!PawToPoint2())
@@ -1404,6 +1441,9 @@ namespace BPASmartClient.MorkF
return false;
}
#endif

//开启电磁阀
Electromagnetism(new List<bool> { false });
if (morkFs.ContainsKey(fryNum))
{
morkFs[fryNum].GetMaterialComplete = true;
@@ -1458,7 +1498,7 @@ namespace BPASmartClient.MorkF

int surplus = 0;
//根据距离算出菜品余量
Laser2CoordinateState state = LaserDistance2MaterialCount(laserHigh, out surplus);
Laser2CoordinateState state = LaserDistance2MaterialCount(laserHigh, item.Value.X, out surplus);
if (state != Laser2CoordinateState.MaterialNormal || state != Laser2CoordinateState.MaterialEmpty)
{
return false;
@@ -1488,136 +1528,47 @@ namespace BPASmartClient.MorkF
public Laser2CoordinateState LaserDistance2Coordinate(int distance, int x, out int x_high)
{
x_high = 0;
int heightDifferent = 0;
//int heightDifferent = 0;
int boxCount = 0;
//传感器高度小于6,无法移出,菜品库满
if (distance < 60)
{
MessageLog.GetInstance.ShowEx("错误:传感器距离不满足出菜高度");
return Laser2CoordinateState.MaterialOverdo;
}
////传感器高度小于6,无法移出,菜品库满
//if (distance < 60)
//{
// MessageLog.GetInstance.ShowEx("错误:传感器距离不满足出菜高度");
// return Laser2CoordinateState.MaterialOverdo;
//}
try
{
if (x > 0 && x <= MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["1"].X)
{
heightDifferent = MaterialCoordinate.GetInstance().distance_1 - distance;
////菜盒放多了
//if (heightDifferent < 10)
//{
// return Laser2CoordinateState.MaterialOverdo;
//}
//else if (distance >= 10 && distance < 15)
//{
// x_high = 11441;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 15 && distance < 19)
//{
// x_high = 5720;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 19 && distance < 23)
//{
// x_high = 0;
// return Laser2CoordinateState.MaterialNormal;
//}
//else
//{
// return Laser2CoordinateState.MaterialEmpty;
//}
}
else if (x <= MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["10"].X && x > MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["1"].X)
{
heightDifferent = MaterialCoordinate.GetInstance().distance_2 - distance;
////菜盒放多了
//if (distance < 6)
//{
// return Laser2CoordinateState.MaterialOverdo;
//}
//else if (distance >= 6 && distance < 10)
//{
// x_high = 24882;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 10 && distance < 15)
//{
// x_high = 18661;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 15 && distance < 19)
//{
// x_high = 12441;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 19 && distance < 23)
//{
// x_high = 6220;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 23 && distance < 28)
//{
// x_high = 0;
// return Laser2CoordinateState.MaterialNormal;
//}
//else
//{
// return Laser2CoordinateState.MaterialEmpty;
//}
}
else if (x > MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["10"].X && x <= MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["20"].X)
{
heightDifferent = MaterialCoordinate.GetInstance().distance_3 - distance;
////菜盒放多了
//if (distance < 7)
//{
// return Laser2CoordinateState.MaterialOverdo;
//}
//else if (distance >= 7 && distance < 12)
//{
// x_high = 24882;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 12 && distance < 17)
//{
// x_high = 18661;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 17 && distance < 21)
//{
// x_high = 12441;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 21 && distance < 26)
//{
// x_high = 6220;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 26 && distance < 30)
//{
// x_high = 0;
// return Laser2CoordinateState.MaterialNormal;
//}
//else
//{
// return Laser2CoordinateState.MaterialEmpty;
//}
}
else
{

return Laser2CoordinateState.MaterialOverdo;
}
//盒子高度为45,但是需要考虑到误差,因此除以50
boxCount = heightDifferent / 50;
if (heightDifferent <= 20)
////根据x轴所在坐标系,计算高度差。
//if (x > 0 && x <= MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["1"].X)
//{
// heightDifferent = MaterialCoordinate.GetInstance().distance_1 - distance;
//}
//else if (x <= MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["10"].X && x > MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["1"].X)
//{
// heightDifferent = MaterialCoordinate.GetInstance().distance_2 - distance;
//}
//else if (x > MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["10"].X && x <= MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["20"].X)
//{
// heightDifferent = MaterialCoordinate.GetInstance().distance_3 - distance;
//}
//else
//{
// return Laser2CoordinateState.MaterialOverdo;
//}
////盒子高度为45,但是需要考虑到误差,因此除以50
//boxCount = heightDifferent / 50;
//if (heightDifferent <= 20)
//{
// MessageLog.GetInstance.ShowEx("错误:菜品量为空");
// return Laser2CoordinateState.MaterialEmpty;
//}
Laser2CoordinateState laser2CoordinateState = LaserDistance2MaterialCount(distance, x, out boxCount);
if (laser2CoordinateState == Laser2CoordinateState.MaterialNormal)
{
MessageLog.GetInstance.ShowEx("错误:菜品量为空");
return Laser2CoordinateState.MaterialEmpty;
//盒子高度计算除去起始位置的那个盒子
x_high = (boxCount - 1) * materialBoxHeight;
}

//盒子高度计算除去起始位置的那个盒子
x_high = boxCount * materialBoxHeight;
return Laser2CoordinateState.MaterialNormal;
return laser2CoordinateState;

}
catch(Exception ex)
@@ -1632,46 +1583,94 @@ namespace BPASmartClient.MorkF
/// <param name="distance"></param>
/// <param name="x"></param>
/// <returns></returns>
public Laser2CoordinateState LaserDistance2MaterialCount(int distance, out int count)
public Laser2CoordinateState LaserDistance2MaterialCount(int distance, int x, out int count)
{
count = 0;
try
{
//菜盒放多了
if (distance < 6)
//传感器高度小于80mm,无法移出,菜品库满
if (distance < 80)
{
MessageLog.GetInstance.ShowEx("错误:传感器距离不满足出菜高度");
return Laser2CoordinateState.MaterialOverdo;
}
else if (distance >= 6 && distance < 10)
int heightDifferent = 0;
//根据x轴所在坐标系,计算高度差。
if (x > 0 && x <= MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["1"].X)
{
count = 5;
return Laser2CoordinateState.MaterialNormal;
heightDifferent = MaterialCoordinate.GetInstance().distance_1 - distance;
}
else if (distance >= 10 && distance < 14)
else if (x <= MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["10"].X && x > MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["1"].X)
{
count = 4;
return Laser2CoordinateState.MaterialNormal;
heightDifferent = MaterialCoordinate.GetInstance().distance_2 - distance;
}
else if (distance >= 14 && distance < 19)
else if (x > MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["10"].X && x <= MaterialCoordinate.GetInstance().dicNoMaterialCoordinate["20"].X)
{
count = 3;
return Laser2CoordinateState.MaterialNormal;
heightDifferent = MaterialCoordinate.GetInstance().distance_3 - distance;
}
else
{
return Laser2CoordinateState.MaterialOverdo;
}
else if (distance >= 19 && distance < 23)
//盒子高度为45,但是需要考虑到误差,不足35,则认为为空
int boxCount = heightDifferent / 35;
count = boxCount;
if (count == 0)
{
count = 2;
return Laser2CoordinateState.MaterialNormal;
MessageLog.GetInstance.Show("菜品库为空");
return Laser2CoordinateState.MaterialEmpty;
}
else if (distance >= 23 && distance < 28)
else if(count > 6)
{
count = 1;
return Laser2CoordinateState.MaterialNormal;
MessageLog.GetInstance.Show("菜品库数量超量");
return Laser2CoordinateState.MaterialOverdo;
}
else
{
count = 0;
return Laser2CoordinateState.MaterialEmpty;
return Laser2CoordinateState.MaterialNormal;
}
//if (heightDifferent <= 20)
//{
// MessageLog.GetInstance.ShowEx("错误:菜品量为空");
// return Laser2CoordinateState.MaterialEmpty;
//}

////菜盒放多了
//if (distance < 6)
//{
// return Laser2CoordinateState.MaterialOverdo;
//}
//else if (distance >= 6 && distance < 10)
//{
// count = 5;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 10 && distance < 14)
//{
// count = 4;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 14 && distance < 19)
//{
// count = 3;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 19 && distance < 23)
//{
// count = 2;
// return Laser2CoordinateState.MaterialNormal;
//}
//else if (distance >= 23 && distance < 28)
//{
// count = 1;
// return Laser2CoordinateState.MaterialNormal;
//}
//else
//{
// count = 0;
// return Laser2CoordinateState.MaterialEmpty;
//}
}
catch (Exception ex)
{
@@ -1884,7 +1883,9 @@ namespace BPASmartClient.MorkF
}
int i = 0;

if(isMaterial)
MessageLog.GetInstance.Show("倒菜启动开始");

if (isMaterial)
{
//判断是否完成取菜
for (i = 0; i < materialSleepCount && !morkFs[num].GetMaterialComplete; i++)
@@ -2341,7 +2342,7 @@ namespace BPASmartClient.MorkF
//遍历炒锅,找到合适、空闲的炒锅
for(int i = 0;i<morkFs.Count;i++)
{
if (/*morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete &&*/ ml_morkf.InitialComplete &&
if (morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete && ml_morkf.InitialComplete &&
!morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&菜品库初始化&&是否在炒菜中
{
Thread.Sleep(5000);
@@ -2464,45 +2465,45 @@ namespace BPASmartClient.MorkF
//炒锅取菜状态置为未取到
morkFs[i].GetMaterialComplete = false;

//if(testi % 2==0)
//{
// MaterialInfo materialInfo = new MaterialInfo();
// materialInfo.Loc = "5";
// materialInfo.Qty = 10;
// materialInfo.Name = "肉片";
// materialInfo.Id = "1232131";
// materialOperationQuenes.Enqueue(new MaterialOperation { materialInfo = materialInfo, fryNum = i });
//}
//else
//{
// MaterialInfo materialInfo = new MaterialInfo();
// materialInfo.Loc = "24";
// materialInfo.Qty = 10;
// materialInfo.Name = "青椒";
// materialInfo.Id = "1232131";
// materialOperationQuenes.Enqueue(new MaterialOperation { materialInfo = materialInfo, fryNum = i });
//}
//testi++;

if (potActions.MaterialLists != null)
if (testi % 2 == 0)
{
foreach (var item in potActions.MaterialLists)
{
//通过ID获取有效的菜品对象
MaterialInfo materialInfo = MaterialSurplusOperation.GetInstance().GetVailedMaterial(item.MaterialId);
if (materialInfo == null)
{
MessageLog.GetInstance.ShowEx($"炒锅{i}获取菜品[{item.MaterialId}]失败,库存不足");
continue;
}

materialOperationQuenes.Enqueue(new MaterialOperation { materialInfo = materialInfo, fryNum = i });
}
MaterialInfo materialInfo = new MaterialInfo();
materialInfo.Loc = "5";
materialInfo.Qty = 10;
materialInfo.Name = "肉片";
materialInfo.Id = "1232131";
materialOperationQuenes.Enqueue(new MaterialOperation { materialInfo = materialInfo, fryNum = i });
}
else
{
MessageLog.GetInstance.ShowEx($"炒锅{i}获取菜品失败,菜品列表为空");
MaterialInfo materialInfo = new MaterialInfo();
materialInfo.Loc = "24";
materialInfo.Qty = 10;
materialInfo.Name = "青椒";
materialInfo.Id = "1232131";
materialOperationQuenes.Enqueue(new MaterialOperation { materialInfo = materialInfo, fryNum = i });
}
testi++;

//if (potActions.MaterialLists != null)
//{
// foreach (var item in potActions.MaterialLists)
// {
// //通过ID获取有效的菜品对象
// MaterialInfo materialInfo = MaterialSurplusOperation.GetInstance().GetVailedMaterial(item.MaterialId);
// if (materialInfo == null)
// {
// MessageLog.GetInstance.ShowEx($"炒锅{i}获取菜品[{item.MaterialId}]失败,库存不足");
// continue;
// }

// materialOperationQuenes.Enqueue(new MaterialOperation { materialInfo = materialInfo, fryNum = i });
// }
//}
//else
//{
// MessageLog.GetInstance.ShowEx($"炒锅{i}获取菜品失败,菜品列表为空");
//}
MessageLog.GetInstance.Show(potActions.Actions);
break;
case nameof(StirFryPotActionEnum.开启搅拌):


+ 6
- 0
BPASmartClient.MorkF/Model/MaterialCoordinate.cs View File

@@ -49,6 +49,12 @@ namespace BPASmartClient.MorkF.Model

public Coordinate materialHeight { get; set; } = new Coordinate() { X = 0, Y = 0 };

public int MaterialOneX { get; set; } = -1;

public int MaterialTwoX { get; set; } = -1;

public int MaterialThreeX { get; set; } = -1;

public int distance_1 { get; set; } = 0;
public int distance_2 { get; set; } = 0;
public int distance_3 { get; set; } = 0;


+ 99
- 46
BPASmartClient.MorkF/View/MaterialCalibration.xaml View File

@@ -653,53 +653,106 @@
</Grid>
</GroupBox>
<GroupBox Grid.Row="3" Header="菜品库特殊点位" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<WrapPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="菜品库高度测量" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionMaterialHeight}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<WrapPanel>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding MaterialHeightX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding MaterialHeightY}" Width="100"/>
</WrapPanel>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="炒锅1菜品交互位置" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionFrying1}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<WrapPanel>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding Frying1X}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding Frying1Y}" Width="100"/>
</WrapPanel>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="炒锅2菜品交互位置" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionFrying2}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<WrapPanel>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding Frying2X}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding Frying2Y}" Width="100"/>
</WrapPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="菜品库高度测量" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionMaterialHeight}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<WrapPanel>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding MaterialHeightX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding MaterialHeightY}" Width="100"/>
</WrapPanel>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="炒锅1菜品交互位置" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionFrying1}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<WrapPanel>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding Frying1X}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding Frying1Y}" Width="100"/>
</WrapPanel>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="炒锅2菜品交互位置" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionFrying2}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<WrapPanel>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding Frying2X}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding Frying2Y}" Width="100"/>
</WrapPanel>
</Grid>
</Grid>
</WrapPanel>
<WrapPanel Grid.Row="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="第一层菜品库出菜位置" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionMaterialOne}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<WrapPanel>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding MaterialOneX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="0" IsEnabled="False" Width="100"/>
</WrapPanel>
</Grid>
</Grid>
</Grid>
</WrapPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="第二层菜品库出菜位置" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionMaterialTwo}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<WrapPanel>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding MaterialTwoX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="0" IsEnabled="False" Width="100"/>
</WrapPanel>
</Grid>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<RadioButton Content="第三层菜品库出菜位置" Margin="5,0" IsEnabled="True" IsChecked="{Binding PositionMaterialThree}" GroupName="MaterialPosition" HorizontalAlignment="Center"/>
<Grid Grid.Row="1">
<WrapPanel>
<TextBlock Text="x轴:" Margin="10,0"/>
<TextBox Grid.Column="1" Text="{Binding MaterialThreeX}" Width="100"/>
<TextBlock Grid.Column="2" Text="Y轴:" Margin="10,0"/>
<TextBox Grid.Column="3" Text="0" IsEnabled="False" Width="100"/>
</WrapPanel>
</Grid>
</Grid>
</WrapPanel>
</Grid>
</GroupBox>
<GroupBox Grid.Row="4" Header="操作" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid >


+ 50
- 2
BPASmartClient.MorkF/ViewModel/MaterialCalibrationViewModel.cs View File

@@ -255,6 +255,24 @@ namespace BPASmartClient.MorkF.ViewModel
public int Frying2Y { get { return _Frying2Y; } set { _Frying2Y = value; OnPropertyChanged(); } }
private int _Frying2Y;
#endregion
#region 第一层菜品库出菜位置
public bool PositionMaterialOne { get { return _PositionMaterialOne; } set { _PositionMaterialOne = value; OnPropertyChanged(); } }
private bool _PositionMaterialOne;
public int MaterialOneX { get { return _MaterialOneX; } set { _MaterialOneX = value; OnPropertyChanged(); } }
private int _MaterialOneX;
#endregion
#region 第二层菜品库出菜位置
public bool PositionMaterialTwo { get { return _PositionMaterialTwo; } set { _PositionMaterialTwo = value; OnPropertyChanged(); } }
private bool _PositionMaterialTwo;
public int MaterialTwoX { get { return _MaterialTwoX; } set { _MaterialTwoX = value; OnPropertyChanged(); } }
private int _MaterialTwoX;
#endregion
#region 第三层菜品库出菜位置
public bool PositionMaterialThree { get { return _PositionMaterialThree; } set { _PositionMaterialThree = value; OnPropertyChanged(); } }
private bool _PositionMaterialThree;
public int MaterialThreeX { get { return _MaterialThreeX; } set { _MaterialThreeX = value; OnPropertyChanged(); } }
private int _MaterialThreeX;
#endregion
#region 菜品库各传感器高度临时值
public int Distance_1 { get { return _Distance_1; } set { _Distance_1 = value; OnPropertyChanged(); } }
private int _Distance_1;
@@ -478,6 +496,9 @@ namespace BPASmartClient.MorkF.ViewModel
materialCoordinate.distance_1 = Distance_1;
materialCoordinate.distance_2 = Distance_2;
materialCoordinate.distance_3 = Distance_3;
materialCoordinate.MaterialOneX = MaterialOneX;
materialCoordinate.MaterialTwoX = MaterialTwoX;
materialCoordinate.MaterialThreeX = MaterialThreeX;

Json<MaterialCoordinate>.Data = materialCoordinate;
Json<MaterialCoordinate>.Save();
@@ -486,6 +507,9 @@ namespace BPASmartClient.MorkF.ViewModel
MaterialCoordinate.GetInstance().frying2 = materialCoordinate.frying2;
MaterialCoordinate.GetInstance().materialHeight = materialCoordinate.materialHeight;
MaterialCoordinate.GetInstance().dicNoMaterialCoordinate = materialCoordinate.dicNoMaterialCoordinate;
MaterialCoordinate.GetInstance().MaterialOneX = materialCoordinate.MaterialOneX;
MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX;
MaterialCoordinate.GetInstance().MaterialThreeX = materialCoordinate.MaterialThreeX;
}

/// <summary>
@@ -650,6 +674,9 @@ namespace BPASmartClient.MorkF.ViewModel
}
}

MaterialOneX = materialCoordinate.MaterialOneX;
MaterialTwoX = materialCoordinate.MaterialTwoX;
MaterialThreeX = materialCoordinate.MaterialThreeX;
MaterialHeightX = materialCoordinate.materialHeight.X;
MaterialHeightY = materialCoordinate.materialHeight.Y;
Frying1X = materialCoordinate.frying1.X;
@@ -786,9 +813,18 @@ namespace BPASmartClient.MorkF.ViewModel
Frying1Y = Frying1Y + OperationY;
break;
case "Frying2":
Frying2X = Frying1X + OperationX;
Frying2X = Frying2X + OperationX;
Frying2Y = Frying2Y + OperationY;
break;
case "MaterialOne":
MaterialOneX = MaterialOneX + OperationX;
break;
case "MaterialTwo":
MaterialTwoX = MaterialTwoX + OperationX;
break;
case "MaterialThree":
MaterialThreeX = MaterialThreeX + OperationX;
break;
default:
break;
}
@@ -802,7 +838,7 @@ namespace BPASmartClient.MorkF.ViewModel
if (!PositionOne && !PositionTwo && !PositionThree && !PositionFour && !PositionFive && !PositionSix && !PositionSeven && !PositionEight && !PositionNine
&& !PositionTen && !PositionEleven && !PositionTwelve && !PositionThirteen && !PositionFourteen && !PositionFifteen && !PositionSixteen && !PositionSeventeen && !PositionEighteen
&& !PositionNineteen && !PositionTwenty && !PositionTwentyOne && !PositionTwentyTwo && !PositionTwentyThree && !PositionTwentyFour && !PositionTwentyFive && !PositionTwentySix && !PositionTwentySeven
&& !PositionMaterialHeight && !PositionFrying1 && !PositionFrying2)
&& !PositionMaterialHeight && !PositionFrying1 && !PositionFrying2 && !PositionMaterialOne && !PositionMaterialThree &&!PositionMaterialTwo)
{
MessageBox.Show("未选择点位");
return;
@@ -928,6 +964,18 @@ namespace BPASmartClient.MorkF.ViewModel
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "Frying2", Frying2X + OperationX, Frying2Y + OperationY });//设定机械臂当前位置
}
if(PositionMaterialOne)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "MaterialOne", MaterialOneX + OperationX, 0 });//设定机械臂当前位置
}
if (PositionMaterialTwo)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "MaterialTwo", MaterialTwoX + OperationX, 0 });//设定机械臂当前位置
}
if (PositionMaterialThree)
{
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "MaterialThree", MaterialThreeX + OperationX, 0 });//设定机械臂当前位置
}
}

public MaterialCalibrationViewModel()


Loading…
Cancel
Save