NXX 2 lat temu
rodzic
commit
edc09f4401
12 zmienionych plików z 1242 dodań i 332 usunięć
  1. +6
    -0
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  2. BIN
     
  3. BIN
     
  4. BIN
     
  5. +15
    -6
      BPASmartClient.CustomResource/Themes/MyStyle.xaml
  6. +0
    -4
      BPASmartClient.Helper/ThreadManage.cs
  7. +2
    -1
      FryPot_DosingSystem/AGV/WhichCart.cs
  8. +258
    -252
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  9. +29
    -0
      FryPot_DosingSystem/Control/GlobalVariable.cs
  10. +216
    -23
      FryPot_DosingSystem/View/AgvView.xaml
  11. +135
    -34
      FryPot_DosingSystem/View/AgvView.xaml.cs
  12. +581
    -12
      FryPot_DosingSystem/ViewModel/AgvViewModel.cs

+ 6
- 0
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj Wyświetl plik

@@ -22,6 +22,9 @@
<None Remove="Fonts\80号-萌趣小鱼体.ttf" />
<None Remove="Fonts\iconfont.ttf" />
<None Remove="Fonts\Quartz Regular.ttf" />
<None Remove="Image\AGV\agv.png" />
<None Remove="Image\AGV\AGV小车.png" />
<None Remove="Image\AGV\AGV炒锅.png" />
<None Remove="Image\AGV\停车位.png" />
<None Remove="Image\AGV\充电桩.png" />
<None Remove="Image\AGV\墙.png" />
@@ -223,6 +226,9 @@
<Resource Include="Fonts\80号-萌趣小鱼体.ttf" />
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Fonts\Quartz Regular.ttf" />
<Resource Include="Image\AGV\agv.png" />
<Resource Include="Image\AGV\AGV小车.png" />
<Resource Include="Image\AGV\AGV炒锅.png" />
<Resource Include="Image\AGV\停车位.png" />
<Resource Include="Image\AGV\充电桩.png" />
<Resource Include="Image\AGV\墙.png" />





+ 15
- 6
BPASmartClient.CustomResource/Themes/MyStyle.xaml Wyświetl plik

@@ -172,6 +172,13 @@
<ImageBrush x:Key="imageBJ" ImageSource="/BPASmartClient.CustomResource;component/Image/图层1.png" />
<ImageBrush x:Key="image1" ImageSource="/BPASmartClient.CustomResource;component/Image/shape.png" />
<ImageBrush x:Key="image2" ImageSource="/BPASmartClient.CustomResource;component/Image/shape1.png" />
<Style x:Key="image完成" TargetType="Image">
<Style.Setters>
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_Checked.png" />
</Style.Setters>
</Style>

<Style x:Key="image墙" TargetType="Image">
<Style.Setters>
@@ -381,7 +388,7 @@
</Setter>
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/物流车.png" />
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/agv.png" />
</Setter.Value>
</Setter>
</Style.Setters>
@@ -451,8 +458,9 @@

<Style x:Key="border碗" TargetType="Border">
<Style.Setters>
<Setter Property="Height" Value="34"/>
<Setter Property="Height" Value="80"/>
<Setter Property="Width" Value="40"/>
<Setter Property="Margin" Value="0,-20,0,-20"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Background">
<Setter.Value>
@@ -464,9 +472,9 @@

<Style x:Key="border菜" TargetType="Border">
<Style.Setters>
<Setter Property="Margin" Value="0,-7,0,0"/>
<Setter Property="Height" Value="20"/>
<Setter Property="Width" Value="28"/>
<Setter Property="Margin" Value="0,-17,0,0"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="35"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Background">
<Setter.Value>
@@ -1823,9 +1831,10 @@

<!--#region TextBlock-->
<Style x:Key="80号字体样式" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="FontFamily" Value="/BPASmartClient.CustomResource;Component/Fonts/#zihun80hao-mengquxiaoyuti"/>
<Setter Property="Foreground" Value="#FFC6AE82" />
<Setter Property="Foreground" Value="#FFFCD5B5" />
</Style>


+ 0
- 4
BPASmartClient.Helper/ThreadManage.cs Wyświetl plik

@@ -32,10 +32,6 @@ namespace BPASmartClient.Helper
if (CancellationTokenSources.ContainsKey(guid + key))
{
CancellationTokenSources[guid + key]?.Cancel();
if (key.Equals("MainTask"))
{
ActionManage.GetInstance.Send("FryPotDosingMainTaskExit");
}
ActionManage.GetInstance.Register(ExitCallback, guid + key);
}
else


+ 2
- 1
FryPot_DosingSystem/AGV/WhichCart.cs Wyświetl plik

@@ -59,7 +59,8 @@ namespace FryPot_DosingSystem.AGV
public enum IsBool
{
Yes,
No
No,
OnllYes
}
/// <summary>
/// 是否运行


+ 258
- 252
FryPot_DosingSystem/Control/DosingLogicControl.cs Wyświetl plik

@@ -84,9 +84,9 @@ namespace FryPot_DosingSystem.Control
bool LThreeErrorRecipe;//线体3错误配方标识
#endregion
#region agv临时变量
bool agvArriveUpLoad = false;//agv是否到达线体1料位置
bool agvArriveLTwoUpLoad = false;//agv是否到达线体2料位置
bool agvArriveLThreeUpLoad = false;//agv是否到达线体3料位置
bool agvArriveUpLoad = false;//agv是否到达线体1料位置
bool agvArriveLTwoUpLoad = false;//agv是否到达线体2料位置
bool agvArriveLThreeUpLoad = false;//agv是否到达线体3料位置

bool agvArriveUnLoad = false;//线体1 agv是否到达炒锅送料位置
bool LTwoagvArriveUnLoad = false;//线体2 agv是否到达炒锅送料位置
@@ -218,15 +218,15 @@ namespace FryPot_DosingSystem.Control
globalVar = new GlobalVariable();
hardWareStatusModel = HardWareStatusViewModel.GetInstance;
ActionManage.GetInstance.Register(new Action<object[]>(RecipeDataParse), "RecipeSetDown");
ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearRecipes");
ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearRecipes");
ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite");
ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite");
ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitMainTask = true; }), "FryPotDosingMainTaskExit");
HubHelper.GetInstance.Report = new Action<object>(AgvTaskUpReportDataAnalysis);
HubHelper.GetInstance.Upstreamrequest = new Action<object>(AgvFeedBackUpReportDataAnalysis);
ResetProgram();
// ResetProgram();
ReadPlcData();
IniteTask();
MainTask();
CommandRegist();
}

@@ -433,19 +433,28 @@ namespace FryPot_DosingSystem.Control
if (RTrig.GetInstance("ResetProgram").Start(globalVar.PlcInite == 1))//判断是否初始化 一初始化就重启主任务
{
MessageLog.GetInstance.ShowUserLog("主任务正在重启");
ThreadManage.GetInstance().StopTask("MainTask", new Action(() =>

ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() =>
{
ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() =>
ActionManage.GetInstance.CancelRegister("RecipeSetDown");
ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
ActionManage.GetInstance.Send("ClearRecipes");
ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
{
globalVar = null;
globalVar = new GlobalVariable();
ReicpeNum = 0;
ActionManage.GetInstance.CancelRegister("RecipeSetDown");
ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
ActionManage.GetInstance.Send("ClearRecipes");
ReadPlcData();
IniteTask();
MessageLog.GetInstance.ShowUserLog("主任务重启完成");
ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
{
ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() =>
{
globalVar = null;
globalVar = new GlobalVariable();
ReicpeNum = 0;
ReadPlcData();
MainTask();
MessageLog.GetInstance.ShowUserLog("主任务重启完成");

}));
}));

}));
}));
}
@@ -624,7 +633,6 @@ namespace FryPot_DosingSystem.Control
}
else
{

hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
}
if (globalVar.rollerLineTwo.OutMaterialingSingle == 1)//运行中
@@ -689,13 +697,13 @@ namespace FryPot_DosingSystem.Control
/// <summary>
/// 初始化任务
/// </summary>
public void IniteTask()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
MainTask();
}), "MainTask");
}
//public void IniteTask()
//{
// ThreadManage.GetInstance().StartLong(new Action(() =>
// {
// MainTask();
// }), "MainTask");
//}
/// <summary>
/// 配方数据接收
/// </summary>
@@ -762,9 +770,11 @@ namespace FryPot_DosingSystem.Control
//LOneFryPotOutputMaterial();
//LTwoFryPotOutputMaterial();
//LThreeFryPotOutputMaterial();
LineOneProcessExecute();
LineTwoProcessExecute();
LineThreeProcessExecute();
ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute();Thread.Sleep(10); }) , "滚筒线1任务线程");
ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");


}
/// <summary>
/// 线体1的执行流程
@@ -774,14 +784,14 @@ namespace FryPot_DosingSystem.Control
if (!globalVar.LOneTaskLock)
{
globalVar.LOneTaskLock = true;
Task.Run(new Action(() =>
{
LOneRecipeDataToPlc();
LOneLoadRoller();
LOneFryPotInputMaterial();
LOneFryPotOutputMaterial();
globalVar.LOneTaskLock = false;
}));
LOneRecipeDataToPlc();
LOneLoadRoller();
LOneFryPotInputMaterial();
LOneFallMaterial();
LOneFryPotOutputMaterial();
LOneEmptyOperate();
globalVar.LOneTaskLock = false;

}

@@ -794,14 +804,14 @@ namespace FryPot_DosingSystem.Control
if (!globalVar.LTwoTaskLock)
{
globalVar.LTwoTaskLock = true;
Task.Run(new Action(() =>
{
LTwoRecipeDataToPlc();
LTwoAgvLoadRoller();
LTwoFryPotInputMaterial();
LTwoFryPotOutputMaterial();
globalVar.LTwoTaskLock = false;
}));
LTwoRecipeDataToPlc();
LTwoAgvLoadRoller();
LTwoFryPotInputMaterial();
LTwoFallMaterial();
LTwoFryPotOutputMaterial();
LTwoEmptyOperate();
globalVar.LTwoTaskLock = false;
}
}
/// <summary>
@@ -812,14 +822,14 @@ namespace FryPot_DosingSystem.Control
if (!globalVar.LThreeTaskLock)
{
globalVar.LThreeTaskLock = true;
Task.Run(new Action(() =>
{
LThreeRecipeDataToPlc();
LThreeAgvLoadRoller();
LThreeFryPotInputMaterial();
LThreeFryPotOutputMaterial();
globalVar.LThreeTaskLock = false;
}));
LThreeRecipeDataToPlc();
LThreeAgvLoadRoller();
LThreeFryPotInputMaterial();
LThreeFallMaterial();
LThreeFryPotOutputMaterial();
LThreeEmptyOperate();
globalVar.LThreeTaskLock = false;
}
}

@@ -950,7 +960,7 @@ namespace FryPot_DosingSystem.Control
MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方");
for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
{
if (result.materialCollection.Count<=8&&result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 1 || headNum == 4))
if (result.materialCollection.Count <= 8 && result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 1 || headNum == 4))
{
//将配方中原料加入新的队列
InputMaterialQuene.Enqueue(new MaterialInfo()
@@ -1123,25 +1133,28 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void LOneFryPotInputMaterial()
{
if (OutputMaterialQuene.Count > 0 && !globalVar.InOrOutputLock)
if (OutputMaterialQuene.Count > 0 && agvArriveUnLoad && globalVar.AgvToFryPot&&!globalVar.PotOneInputMaterialArrive)
{
while (!agvArriveUnLoad)//等待agv到达炒锅位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveUnLoad = false;
MessageLog.GetInstance.ShowRunLog("AGV到达【1】号线体指定炒锅下料位置");
AgvArriveFryPotOneOrFourSingleSetDown();
agvArriveUnLoad = false;
globalVar.PotOneInputMaterialArrive = true;
}
}

public void LOneFallMaterial()
{
if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive&&OutputMaterialQuene.Count>0&&!globalVar.PotOneOutputRollerArrive)
{
FryPotOneRollerTroubleCheck();
if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//炒锅滚筒无故障
{
//炒锅滚筒进料运行到位处理
FryPotOneOrFourInputMaterialRollerOperate();
AgvFromFryPotOneOrFourToClean();//上游下发搬运任务给AGV
globalVar.InOrOutputLock = true;
globalVar.PotOneOutputRollerArrive = true;
}

}
}
/// <summary>
@@ -1149,25 +1162,27 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void LTwoFryPotInputMaterial()
{
if (LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoInOrOutputLock)
if (LTwoOutputMaterialQuene.Count > 0 && LTwoagvArriveUnLoad && globalVar.LTwoAgvToFryPot && !globalVar.LTwoPotInputMaterialArrive)
{
while (!LTwoagvArriveUnLoad)//等待agv到达炒锅位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
LTwoagvArriveUnLoad = false;
MessageLog.GetInstance.ShowRunLog("AGV到达【2】号线体指定炒锅下料位置");
AgvArriveFryPotTwoOrFiveSingleSetDown();
LTwoagvArriveUnLoad = false;
globalVar.LTwoPotInputMaterialArrive = true;
}
}
public void LTwoFallMaterial()
{
if (!globalVar.LTwoInOrOutputLock && (globalVar.fryPotTwo.InputMaterialArrivedSingle == 1 || globalVar.fryPotFive.InputMaterialArrivedSingle == 1) && globalVar.LTwoPotInputMaterialArrive && LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoPotOutputRollerArrive)
{
FryPotTwoRollerTroubleCheck();
if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//炒锅滚筒无故障
{
//炒锅滚筒进料运行到位处理
FryPotTwoOrFiveInputMaterialRollerOperate();
AgvFromFryPotTwoOrFiveToClean();//上游下发搬运任务给AGV
globalVar.LTwoInOrOutputLock = true;
globalVar.LTwoPotOutputRollerArrive = true;
}

}
}
/// <summary>
@@ -1175,25 +1190,28 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void LThreeFryPotInputMaterial()
{
if (LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreeInOrOutputLock)
if (LThreeOutputMaterialQuene.Count > 0 && LThreeagvArriveUnLoad && globalVar.LThreeAgvToFryPot && !globalVar.LThreePotInputMaterialArrive)
{
while (!LThreeagvArriveUnLoad)//等待agv到达炒锅位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
LThreeagvArriveUnLoad = false;
MessageLog.GetInstance.ShowRunLog("AGV到达【3】号线体指定炒锅下料位置");
AgvArriveFryPotThreeSingleSetDown();
LThreeagvArriveUnLoad = false;
globalVar.LThreePotInputMaterialArrive = true;
}
}

public void LThreeFallMaterial()
{
if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive)
{
FryPotThreeRollerTroubleCheck();
if (FryPotThreeAlarm == 1)//炒锅滚筒无故障
{
//炒锅滚筒进料运行到位处理
FryPotThreeInputMaterialRollerOperate();
AgvFromFryPotThreeToClean();//上游下发搬运任务给AGV
globalVar.LThreeInOrOutputLock = true;
globalVar.LThreePotOutputRollerArrive = true;
}

}
}
/// <summary>
@@ -1237,117 +1255,123 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void LOneFryPotOutputMaterial()
{
if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock)
if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && agvArriveUpLoad && globalVar.PotOneOutputRollerArrive&& !globalVar.AgvArrivePot)
{
AgvFromFryPotOneOrFourToClean();//上游下发搬运任务给AGV
while (!agvArriveUpLoad)//等待agv到达炒锅位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveUpLoad = false;

MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线对应炒锅空桶上料位置");
AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
agvArriveUpLoad = false;
globalVar.AgvArrivePot = true;
}
}
public void LOneEmptyOperate()
{
if ((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1) && agvFryPotEmptyRollerArrive&&OutputMaterialQuene.Count>0&& globalVar.AgvArrivePot)
{
FryPotOneRollerTroubleCheck();
if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//无故障
{
FryPotOneOrFourOutEmpetyRollerOperate();
if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
{
while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvFryPotEmptyRollerArrive = false;
agvArriveUpLoad = false;
MessageLog.GetInstance.ShowRunLog("AGV在【1】号滚筒线对应炒锅空桶上料完成,将进行空桶回收");
//AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
globalVar.AllowAgvToLineLoadRoller = true;
globalVar.InOrOutputLock = false;
globalVar.LoadRoller = false;
globalVar.AgvToFryPot = false;
globalVar.PotOneInputMaterialArrive = false;
globalVar.PotOneOutputRollerArrive = false;
globalVar.AgvArrivePot = false;
}
}

}

}
/// <summary>
/// 线体2对应炒锅出桶
/// </summary>
public void LTwoFryPotOutputMaterial()
{
if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoInOrOutputLock)
if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoInOrOutputLock && agvArriveLTwoUpLoad && globalVar.LTwoPotOutputRollerArrive && !globalVar.LTwoAgvArrivePot)
{
AgvFromFryPotTwoOrFiveToClean();//上游下发搬运任务给AGV
while (!agvArriveLTwoUpLoad)//等待agv到达炒锅上料位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveLTwoUpLoad = false;

MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线对应炒锅空桶上料位置");
AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
agvArriveLTwoUpLoad = false;
globalVar.LTwoAgvArrivePot = true;
}
}

public void LTwoEmptyOperate()
{
if ((globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotFive.EmptyBarrelArrivedSingle == 1) && LTwoagvFryPotEmptyRollerArrive && LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoAgvArrivePot)
{
FryPotTwoRollerTroubleCheck();
if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//无故障
{
FryPotTwoOrFiveOutEmpetyRollerOperate();
if (LTwoOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
{
while (!LTwoagvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
LTwoagvFryPotEmptyRollerArrive = false;
agvArriveLTwoUpLoad = false;
MessageLog.GetInstance.ShowRunLog("AGV在【2】号滚筒线对应炒锅空桶上料完成,将进行空桶回收");
//AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
globalVar.AllowAgvToLineTwoLoadRoller = true;
globalVar.LTwoInOrOutputLock = false;
globalVar.LTwoLoadRoller = false;
globalVar.LTwoAgvToFryPot = false;
globalVar.LTwoPotInputMaterialArrive = false;
globalVar.LTwoPotOutputRollerArrive = false;
globalVar.LTwoAgvArrivePot = false;
}
}

}

}
/// <summary>
/// 线体3对应炒锅出桶
/// </summary>
public void LThreeFryPotOutputMaterial()
{
if (LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeInOrOutputLock)
if (LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeInOrOutputLock && agvArriveLThreeUpLoad && globalVar.LThreePotOutputRollerArrive && !globalVar.LThreeAgvArrivePot)
{
AgvFromFryPotThreeToClean();//上游下发搬运任务给AGV
while (!agvArriveLThreeUpLoad)//等待agv到达炒锅位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveLThreeUpLoad = false;

MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线对应炒锅空桶上料位置");
AgvArriveFryPotThreeOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
agvArriveLThreeUpLoad = false;
globalVar.LThreeAgvArrivePot = true;
}
}

public void LThreeEmptyOperate()
{
if (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 1 && LThreeagvFryPotEmptyRollerArrive && LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeAgvArrivePot)
{
FryPotThreeRollerTroubleCheck();
if (FryPotThreeAlarm == 1)//无故障
if (FryPotThreeAlarm == 1 )//无故障
{
FryPotThreeOutEmpetyRollerOperate();
if (LThreeOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
{
while (!LThreeagvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
LThreeagvFryPotEmptyRollerArrive = false;
agvArriveLThreeUpLoad = false;
MessageLog.GetInstance.ShowRunLog("AGV在【3】号滚筒线对应炒锅空桶上料完成,将进行空桶回收");
//AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
globalVar.AllowAgvToLineThreeLoadRoller = true;
globalVar.LThreeInOrOutputLock = false;
globalVar.LThreeLoadRoller = false;
globalVar.LThreeAgvToFryPot = false;
globalVar.LThreePotInputMaterialArrive = false;
globalVar.LThreePotOutputRollerArrive = false;
globalVar.LThreeAgvArrivePot = false;
}
}

}

}
/// <summary>
/// 炒锅滚筒进料运行到位处理
@@ -1402,18 +1426,18 @@ namespace FryPot_DosingSystem.Control
switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1:
while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
//while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
//{
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 4:
while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
//while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
//{
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
}
}
@@ -1430,14 +1454,14 @@ namespace FryPot_DosingSystem.Control
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 5:
while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
}
}
public void FryPotThreeInputMaterialRollerOperate()
@@ -1447,7 +1471,7 @@ namespace FryPot_DosingSystem.Control
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料");
MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料");
}
/// <summary>
/// 炒锅滚筒空桶出桶处理
@@ -1502,18 +1526,18 @@ namespace FryPot_DosingSystem.Control
switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1:
while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
//while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
//{
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
case 4:
while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
//while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
//{
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
}
}
@@ -1763,30 +1787,23 @@ namespace FryPot_DosingSystem.Control
/// <param name="lineAlarm"></param>
public void AgvFromLineOneToFryPot()
{
erp: if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//无故障
erp: if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble ==0)
{
while (!agvArriveUpLoad)//等待AGV到线体装料位置
if (agvArriveUpLoad && globalVar.LoadRoller && globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.AgvToFryPot)//无故障
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveUpLoad = false;
MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
AgvArriveLineSingelSetDown(InputMaterialQuene);
if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
while (!(globalVar.rollerLineOne.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号
MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
AgvArriveLineSingelSetDown(InputMaterialQuene);
if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
OutputMaterialQuene.Enqueue(materialInfo);
agvArriveUpLoad = false;
globalVar.AgvToFryPot = true;
//原料到位,agv到位,agv自行运料到炒锅
}
MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
OutputMaterialQuene.Enqueue(materialInfo);
//原料到位,agv到位,agv自行运料到炒锅
}


}
}
else//有故障
{
@@ -1809,26 +1826,20 @@ namespace FryPot_DosingSystem.Control
{
erp: if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//无故障
{
while (!agvArriveLTwoUpLoad)//等待AGV到线体装料位置
if (agvArriveLTwoUpLoad && globalVar.LTwoLoadRoller && globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LTwoAgvToFryPot)//无故障
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveLTwoUpLoad = false;
MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
AgvArriveLineSingelSetDown(LTwoInputMaterialQuene);
if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
while (!(globalVar.rollerLineTwo.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号
MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
AgvArriveLineSingelSetDown(LTwoInputMaterialQuene);
if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
LTwoOutputMaterialQuene.Enqueue(materialInfo);
agvArriveLTwoUpLoad = false;
globalVar.LTwoAgvToFryPot = true;
//原料到位,agv到位,agv自行运料到炒锅
}
MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
LTwoOutputMaterialQuene.Enqueue(materialInfo);
//原料到位,agv到位,agv运料到炒锅


}

}
@@ -1853,26 +1864,20 @@ namespace FryPot_DosingSystem.Control
{
erp: if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//无故障
{
while (!agvArriveLThreeUpLoad)//等待AGV到线体装料位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveLThreeUpLoad = false;
MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
AgvArriveLineSingelSetDown(LThreeInputMaterialQuene);
if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
if (agvArriveLThreeUpLoad && globalVar.LThreeLoadRoller && globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.LThreeAgvToFryPot)//无故障
{
while (!(globalVar.rollerLineThree.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号
MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
AgvArriveLineSingelSetDown(LThreeInputMaterialQuene);
if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
LThreeOutputMaterialQuene.Enqueue(materialInfo);
agvArriveLThreeUpLoad = false;
globalVar.LThreeAgvToFryPot = true;
//原料到位,agv到位,agv自行运料到炒锅
}
MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
LThreeOutputMaterialQuene.Enqueue(materialInfo);
//原料到位,agv到位,agv运料到炒锅


}

}
@@ -1935,14 +1940,8 @@ namespace FryPot_DosingSystem.Control
{
if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//输送线无故障
{
if (InputMaterialQuene.Count > 0)
if (InputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineLoadRoller && globalVar.rollerLineOne.OutMaterialingSingle == 1 && !globalVar.LoadRoller)
{
while (!globalVar.AllowAgvToLineLoadRoller || globalVar.rollerLineOne.OutMaterialingSingle == 0)
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
e: string id = Guid.NewGuid().ToString("N");
if (id == LOnerobotJobId)
goto e;
@@ -1951,74 +1950,81 @@ namespace FryPot_DosingSystem.Control
LOnerobotJobId = id;
Thread.Sleep(500);
LineCarryTaskErrorCodeAnalysis(info, 1);
globalVar.LoadRoller = true;


}
}
else
{
MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【1】故障!!!");
// lineAlarm = -1;
}
// lineAlarm = 1;
//else
//{
// MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【1】故障!!!");
// // lineAlarm = -1;
//}
//// lineAlarm = 1;
}
public void AgvToLineTwoLoadRoller()
{
if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//输送线无故障
{
if (LTwoInputMaterialQuene.Count > 0)
if (LTwoInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineTwoLoadRoller && globalVar.rollerLineTwo.OutMaterialingSingle == 1 && !globalVar.LTwoLoadRoller)
{
while (!globalVar.AllowAgvToLineTwoLoadRoller || globalVar.rollerLineTwo.OutMaterialingSingle == 0) //后续考虑是否用while
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
p: string id = Guid.NewGuid().ToString();
e: string id = Guid.NewGuid().ToString("N");
if (id == LTworobotJobId)
goto p;
goto e;

string info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id);
// MessageLog.GetInstance.ShowRunLog("AGV去【2】号滚筒线装桶");
LTworobotJobId = id;
Thread.Sleep(500);
LineCarryTaskErrorCodeAnalysis(info, 2);
globalVar.LTwoLoadRoller = true;
}

}
else
{
MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【2】故障!!!");
//lineAlarm = -1;
}
// lineAlarm = 1;
}
public void AgvToLineThreeLoadRoller()
{
if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
{
if (LThreeInputMaterialQuene.Count > 0)
if (LThreeInputMaterialQuene.Count > 0 && globalVar.AllowAgvToLineThreeLoadRoller && globalVar.rollerLineThree.OutMaterialingSingle == 1 && !globalVar.LThreeLoadRoller)
{
while (!globalVar.AllowAgvToLineThreeLoadRoller || globalVar.rollerLineThree.OutMaterialingSingle == 0) //后续考虑是否用while
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
g: string id = Guid.NewGuid().ToString();
e: string id = Guid.NewGuid().ToString("N");
if (id == LThreerobotJobId)
goto g;
goto e;

string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
// MessageLog.GetInstance.ShowRunLog("AGV去【3】号滚筒线装桶");
LThreerobotJobId = id;
Thread.Sleep(500);
LineCarryTaskErrorCodeAnalysis(info, 3);
globalVar.LThreeLoadRoller = true;
}

}
else
{
MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【3】故障!!!");
// lineAlarm = -1;
}
// lineAlarm = 1;

//if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
//{
// if (LThreeInputMaterialQuene.Count > 0)
// {
// while (!globalVar.AllowAgvToLineThreeLoadRoller || globalVar.rollerLineThree.OutMaterialingSingle == 0) //后续考虑是否用while
// {
// Thread.Sleep(5);
// if (globalVar.ExitMainTask)
// return;
// }
// g: string id = Guid.NewGuid().ToString();
// if (id == LThreerobotJobId)
// goto g;
// string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
// // MessageLog.GetInstance.ShowRunLog("AGV去【3】号滚筒线装桶");
// LThreerobotJobId = id;
// Thread.Sleep(500);
// LineCarryTaskErrorCodeAnalysis(info, 3);
// }

//}
//else
//{
// MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【3】故障!!!");
// // lineAlarm = -1;
//}
}
/// <summary>
/// 1号线体数据下发


+ 29
- 0
FryPot_DosingSystem/Control/GlobalVariable.cs Wyświetl plik

@@ -115,7 +115,36 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public string LThreeCurrentRecipeName { get; set; } = string.Empty;
#endregion
#region 线体1流程互锁变量

public bool LoadRoller { get; set; }

public bool AgvToFryPot { get; set; }

public bool PotOneInputMaterialArrive { get; set; }
public bool PotOneOutputRollerArrive { get; set; }
public bool AgvArrivePot { get; set; }
#endregion
#region 线体2流程互锁变量

public bool LTwoLoadRoller { get; set; }

public bool LTwoAgvToFryPot { get; set; }

public bool LTwoPotInputMaterialArrive { get; set; }
public bool LTwoPotOutputRollerArrive { get; set; }
public bool LTwoAgvArrivePot { get; set; }
#endregion
#region 线体3流程互锁变量

public bool LThreeLoadRoller { get; set; }

public bool LThreeAgvToFryPot { get; set; }

public bool LThreePotInputMaterialArrive { get; set; }
public bool LThreePotOutputRollerArrive { get; set; }
public bool LThreeAgvArrivePot { get; set; }
#endregion
}
/// <summary>
/// 滚筒线1相关变量


+ 216
- 23
FryPot_DosingSystem/View/AgvView.xaml Wyświetl plik

@@ -506,11 +506,21 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Grid Width="60" Height="55">
<Ellipse x:Name="name_11" VerticalAlignment="Bottom" Visibility="Collapsed" Margin="0,0,0,0" Fill="#FF9E4C4C" Stroke="#FF9E4141" Width="60" Height="20"></Ellipse>
<Ellipse x:Name="name_12" VerticalAlignment="Bottom" Visibility="Collapsed" Margin="0,0,0,5" Fill="#FFAD2121" Stroke="#FF9E4141" Width="40" Height="10"></Ellipse>
<Ellipse x:Name="name_21" VerticalAlignment="Bottom" Visibility="Visible" Margin="0,0,0,0" Fill="#FF4CA756" Stroke="#FF419E53" Width="60" Height="20"></Ellipse>
<Ellipse x:Name="name_22" VerticalAlignment="Bottom" Visibility="Visible" Margin="0,0,0,5" Fill="#FF1CAB3F" Stroke="#FF2D842A" Width="40" Height="10"></Ellipse>
<Border x:Name="chezi" Style="{DynamicResource border车}" Width="60" Height="60" HorizontalAlignment="Right" VerticalAlignment="Top"></Border>
<Border x:Name="chezi" Style="{DynamicResource border车}" Margin="0,-3,0,0" Width="60" Height="60" HorizontalAlignment="Right" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5">
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="-0.8" ScaleY="-0.6"/>
<SkewTransform/>
<RotateTransform Angle="185"/>
<TranslateTransform X="1" Y="0.5"/>
</TransformGroup>
</Border.RenderTransform>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Text" Value="Yes">
@@ -634,7 +644,7 @@
<Style x:Key="运输车新" BasedOn="{x:Null}" TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="#FF1F4D69"/>
<Setter Property="Tag" Value="Stop"/>
<Setter Property="Text" Value="Yes"/>
<Setter Property="Text" Value="CaiYes"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
@@ -850,9 +860,11 @@
</TransformGroup>
</Grid.RenderTransform>
<Border Style="{DynamicResource border车}" Width="60" Height="60" HorizontalAlignment="Right"></Border>
<Grid HorizontalAlignment="Right" VerticalAlignment="Top" x:Name="caiping">
<Border Margin="0,20,15,0" Width="20" Height="10" Style="{DynamicResource border菜}"></Border>
<Border Margin="0,20,5,0" Width="20" Height="10" Style="{DynamicResource border菜}"></Border>
<Grid HorizontalAlignment="Right" VerticalAlignment="Center" Margin="20,-35,10,0" x:Name="caiping">
<Grid x:Name="c1" VerticalAlignment="Top" Width="40" Height="60">
<Border Style="{DynamicResource border碗}" Margin="0,-10,0,-6"></Border>
<Border x:Name="cai" VerticalAlignment="Top" Margin="0,0,0,0" Style="{DynamicResource border菜}"></Border>
</Grid>
</Grid>
<Grid x:Name="biaoji" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,20,0,0">
<Path x:Name="path1" Visibility="Collapsed" Data="M142.25,37 L128.75,44 146.40385,53.25" Fill="#26ECCE09" HorizontalAlignment="Right" Height="17" Margin="128,37,54,0" Stroke="#7FECCE09" StrokeThickness="3" Stretch="Fill" VerticalAlignment="Top" Width="18"/>
@@ -866,9 +878,15 @@
<!--#region 是否有物品-->
<Trigger Property="Text" Value="Yes">
<Setter TargetName="caiping" Property="Visibility" Value="Visible" />
<Setter TargetName="cai" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="Text" Value="No">
<Setter TargetName="caiping" Property="Visibility" Value="Collapsed" />
<Setter TargetName="cai" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="Text" Value="OnllYes">
<Setter TargetName="caiping" Property="Visibility" Value="Visible" />
<Setter TargetName="cai" Property="Visibility" Value="Collapsed" />
</Trigger>
<!--#endregion-->

@@ -1096,22 +1114,59 @@
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>
</UserControl.Resources>
<Grid>

<!--#region 测试按钮-->
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,20,100,0" Orientation="Horizontal">
<Button x:Name="StartButton" Width="100" Margin="10,0,0,0" Click="Button_Click" Cursor="Hand">开始</Button>
<Button Width="100" Margin="10,0,0,0" Click="Button_Click_1">取菜</Button>
<Button x:Name="StopButton" Width="100" Margin="10,0,0,0" Click="StopButton_Click" Cursor="Hand">运输菜</Button>
<Button Width="100" Margin="10,0,0,0" Click="Button_Click_2" Cursor="Hand">送空桶</Button>
<Button Width="100" Margin="10,0,0,0" Click="Button_Click_3" Cursor="Hand">回去</Button>
<Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="100,0,100,80" Grid.Column="2">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="0"/>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,20,20,0" Orientation="Horizontal">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="AGV模拟测试" Margin="20,20,20,5" Width="35" FontSize="20" Foreground="#FFFCD5B5" />
<StackPanel>
<TextBlock Margin="5">停车桩测试</TextBlock>
<TextBox x:Name="tcz_text" Margin="5">1</TextBox>
<Button Margin="5" Click="Button_Click" Tag="设置有车" Cursor="Hand">设置有车</Button>
<Button Margin="5" Click="Button_Click" Tag="设置无车" Cursor="Hand">设置无车</Button>
</StackPanel>

<StackPanel>
<TextBlock Margin="5">料筒控制</TextBlock>
<TextBox x:Name="liaotong_text" Margin="5">1</TextBox>
<Button Margin="5" Click="Button_Click" Tag="启动" Cursor="Hand">启动</Button>
<Button Margin="5" Click="Button_Click" Tag="停止" Cursor="Hand">停止</Button>
</StackPanel>

<StackPanel>
<TextBlock Margin="5">设置物料</TextBlock>
<TextBox x:Name="liaotongwuliao_text" Margin="5">1</TextBox>
<TextBox x:Name="liaotongwuliaoshuliang_text" Margin="5">1</TextBox>

<Button Margin="5" Click="Button_Click" Tag="设置物料" Cursor="Hand">设置物料</Button>
</StackPanel>

<StackPanel>
<TextBlock Margin="5">小车测试</TextBlock>
<TextBox x:Name="xiaoche_text" Margin="5">1</TextBox>
<Button Margin="5" Click="Button_Click" Tag="小车停止" Cursor="Hand">小车停止</Button>
<ComboBox x:Name="控制命令" HorizontalAlignment="Left" Width="100"/>
<Button Margin="5" Click="Button_Click" Tag="运行小车" Cursor="Hand">运行小车</Button>
</StackPanel>

<StackPanel>
<TextBlock Margin="5">小车?物品</TextBlock>
<TextBox x:Name="xiaochewuping_text" Margin="5">1</TextBox>
<Button Margin="5" Click="Button_Click" Tag="有菜和碗" Cursor="Hand">有菜和碗</Button>
<Button Margin="5" Click="Button_Click" Tag="只有碗" Cursor="Hand">只有碗</Button>

<Button Margin="5" Click="Button_Click" Tag="无物品" Cursor="Hand">无物品</Button>


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

<Button Width="100" Margin="10,0,0,0" Click="Button_Click_4" Cursor="Hand">停止</Button>

</StackPanel>
<!--#endregion-->

<!--#region 墙体-->
@@ -1235,18 +1290,155 @@
<Border Style="{DynamicResource border炒锅}" Grid.Column="4" HorizontalAlignment="Left">
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅(5)号</TextBlock>
</Border>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="0">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="一号炒锅制作流程" Margin="20,20,20,5" FontSize="20" Foreground="#FFFCD5B5" />
<StackPanel Orientation="Horizontal" Margin="20,5,20,0">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="菜品:" FontSize="20" Foreground="#FFFCD5B5" />
<TextBlock Style="{DynamicResource 80号字体样式}"
Text="{Binding wokModel_1.goodsName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Tag="{Binding wokModel_1.id,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ToolTip="{Binding wokModel_1.orderID,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FF00FFED" />
</StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="步骤:" Margin="20,5,20,0" FontSize="20" Foreground="#FFFCD5B5" />
<ListBox ItemsSource="{Binding wokModel_1.workflows,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Margin="0,0,0,10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="15,5,15,5">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding xh,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<Image Margin="20,0,0,0" Style="{DynamicResource image完成}" Visibility="{Binding visibility,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></Image>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="1">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="二号炒锅制作流程" Margin="20,20,20,5" FontSize="20" Foreground="#FFFCD5B5" />
<StackPanel Orientation="Horizontal" Margin="20,5,20,0">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="菜品:" FontSize="20" Foreground="#FFFCD5B5" />
<TextBlock Style="{DynamicResource 80号字体样式}"
Text="{Binding wokModel_2.goodsName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Tag="{Binding wokModel_2.id,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ToolTip="{Binding wokModel_2.orderID,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FF00FFED" />
</StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="步骤:" Margin="20,5,20,0" FontSize="20" Foreground="#FFFCD5B5" />
<ListBox ItemsSource="{Binding wokModel_2.workflows,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Margin="0,0,0,10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="15,5,15,5">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding xh,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<Image Margin="20,0,0,0" Style="{DynamicResource image完成}" Visibility="{Binding visibility,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></Image>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="2">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="三号炒锅制作流程" Margin="20,20,20,5" FontSize="20" Foreground="#FFFCD5B5" />
<StackPanel Orientation="Horizontal" Margin="20,5,20,0">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="菜品:" FontSize="20" Foreground="#FFFCD5B5" />
<TextBlock Style="{DynamicResource 80号字体样式}"
Text="{Binding wokModel_3.goodsName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Tag="{Binding wokModel_3.id,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ToolTip="{Binding wokModel_3.orderID,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FF00FFED" />
</StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="步骤:" Margin="20,5,20,0" FontSize="20" Foreground="#FFFCD5B5" />
<ListBox ItemsSource="{Binding wokModel_3.workflows,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Margin="0,0,0,10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="15,5,15,5">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding xh,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<Image Margin="20,0,0,0" Style="{DynamicResource image完成}" Visibility="{Binding visibility,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></Image>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="3">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="四号炒锅制作流程" Margin="20,20,20,5" FontSize="20" Foreground="#FFFCD5B5" />
<StackPanel Orientation="Horizontal" Margin="20,5,20,0">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="菜品:" FontSize="20" Foreground="#FFFCD5B5" />
<TextBlock Style="{DynamicResource 80号字体样式}"
Text="{Binding wokModel_4.goodsName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Tag="{Binding wokModel_4.id,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ToolTip="{Binding wokModel_4.orderID,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FF00FFED" />
</StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="步骤:" Margin="20,5,20,0" FontSize="20" Foreground="#FFFCD5B5" />
<ListBox ItemsSource="{Binding wokModel_4.workflows,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Margin="0,0,0,10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="15,5,15,5">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding xh,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<Image Margin="20,0,0,0" Style="{DynamicResource image完成}" Visibility="{Binding visibility,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></Image>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="4">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="五号炒锅制作流程" Margin="20,20,20,5" FontSize="20" Foreground="#FFFCD5B5" />
<StackPanel Orientation="Horizontal" Margin="20,5,20,0">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="菜品:" FontSize="20" Foreground="#FFFCD5B5" />
<TextBlock Style="{DynamicResource 80号字体样式}"
Text="{Binding wokModel_5.goodsName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Tag="{Binding wokModel_5.id,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ToolTip="{Binding wokModel_5.orderID,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#FF00FFED" />
</StackPanel>
<TextBlock Style="{DynamicResource 80号字体样式}" Text="步骤:" Margin="20,5,20,0" FontSize="20" Foreground="#FFFCD5B5" />
<ListBox ItemsSource="{Binding wokModel_5.workflows,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" Margin="0,0,0,10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="15,5,15,5">
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding xh,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<TextBlock Style="{DynamicResource 80号字体样式}" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="16" Foreground="#FF00FFB3" />
<Image Margin="20,0,0,0" Style="{DynamicResource image完成}" Visibility="{Binding visibility,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></Image>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>
</Grid>


<!--#endregion-->

<!--#region 滚筒线,IsEnabled True代表有菜 false 空碗.Text:Start 执行动画 Tag:代表传输带上有几个菜碗-->
<StackPanel Orientation="Horizontal" Height="240" Width="580" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="290,0,0,0">
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">满料桶滚筒线</TextBlock>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="{Binding RollerLines_1.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Tag="{Binding RollerLines_1.DishesNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,0" ></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(1)号</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(1)满料桶滚筒线</TextBlock>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="{Binding RollerLines_2.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Tag="{Binding RollerLines_2.DishesNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="80,0,0,0"></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(2)号</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(2)满料桶滚筒线</TextBlock>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="{Binding RollerLines_3.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Tag="{Binding RollerLines_3.DishesNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="80,0,0,0" ></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(3)号</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(3)满料桶滚筒线</TextBlock>
<TextBox Style="{StaticResource 传送带空}" IsEnabled="False" Text="{Binding RollerLines_4.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Tag="{Binding RollerLines_4.DishesNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="80,0,0,0"></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="16" HorizontalAlignment="Right">空桶滚筒线</TextBlock>
</StackPanel>
@@ -1255,22 +1447,22 @@
<!--#region 停车桩与充电桩-->
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,200,30,0">
<Border Style="{DynamicResource border停车位}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(1号)</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,-15,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(1号)</TextBlock>
</Border>
<Border Style="{DynamicResource border停车位}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(2号)</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,-15,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(2号)</TextBlock>
</Border>
<Border Style="{DynamicResource border停车位}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(3号)</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,-15,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(3号)</TextBlock>
</Border>
<Border Style="{DynamicResource border停车位}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(4号)</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="10,0,-15,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">停车桩(4号)</TextBlock>
</Border>
<Border Style="{DynamicResource border充电桩}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="0,10,0,-13" HorizontalAlignment="Left" VerticalAlignment="Bottom">充电桩(1号)</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="0,10,-25,-13" HorizontalAlignment="Left" VerticalAlignment="Bottom">充电桩(5号)</TextBlock>
</Border>
<Border Style="{DynamicResource border充电桩}">
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="-2,0,0,-13" HorizontalAlignment="Left" VerticalAlignment="Bottom">充电桩(2号)</TextBlock>
<TextBlock Style="{DynamicResource 80号字体样式}" Margin="-2,0,-25,-13" HorizontalAlignment="Left" VerticalAlignment="Bottom">充电桩(6号)</TextBlock>
</Border>
</StackPanel>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,200,100,0">
@@ -1282,5 +1474,6 @@
<TextBox Style="{StaticResource 停车位}" Margin="0,25,0,0" Text="{Binding ParkingPileModel_6.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
<!--#endregion-->

</Grid>
</UserControl>

+ 135
- 34
FryPot_DosingSystem/View/AgvView.xaml.cs Wyświetl plik

@@ -27,46 +27,147 @@ namespace FryPot_DosingSystem.View
{
InitializeComponent();
this.DataContext = AgvViewModel.GetInstance();
控制命令.ItemsSource = AgvViewModel.GetInstance().GetCommand();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
// AgvViewModel.GetInstance().cartModel_1.cartMotionTrajectory = CartMotionTrajectory.Stop;
AgvViewModel.GetInstance().ParkingPileModel_1.isBool = IsBool.No;
AgvViewModel.GetInstance().cartModel_1.isBool=IsBool.No;
AgvViewModel.GetInstance().cartModel_1.cartMotionTrajectory = CartMotionTrajectory.qc_1;
int id = 1;
if (sender is Button)
{
byte[] data;
bool istrue = false;
Button button = sender as Button;
if (button.Tag != null)
{
switch (button.Tag.ToString())
{
case "设置有车":
try
{
id=int.Parse(tcz_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
return;
}
AgvViewModel.GetInstance().Set停车桩(id, IsBool.Yes);
break;
case "设置无车":
try
{
id = int.Parse(tcz_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
return;
}
AgvViewModel.GetInstance().Set停车桩(id, IsBool.No);
break;
case "启动":
try
{
id = int.Parse(liaotong_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Start);
break;
case "停止":
try
{
id = int.Parse(liaotong_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Stop);
break;
case "设置物料":
try
{
id = int.Parse(liaotongwuliao_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-8 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线上数量(id, liaotongwuliaoshuliang_text.Text);
break;
case "小车停止":
try
{
id = int.Parse(xiaoche_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车停止(id);
break;
case "运行小车":
try
{
id = int.Parse(xiaoche_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车运动(id, AgvViewModel.GetInstance().GetCommandValue(控制命令.Text));
break;
case "有菜和碗":
try
{
id = int.Parse(xiaochewuping_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车是否承载物品(id, IsBool.Yes);
break;
case "只有碗":
try
{
id = int.Parse(xiaochewuping_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车是否承载物品(id, IsBool.OnllYes);
break;
case "无物品":
try
{
id = int.Parse(xiaochewuping_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车是否承载物品(id, IsBool.No);
break;

}
}
}
}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
AgvViewModel.GetInstance().RollerLines_1.isRun = IsRun.Start;
}

private void StopButton_Click(object sender, RoutedEventArgs e)
{
AgvViewModel.GetInstance().RollerLines_1.isRun = IsRun.Stop;
AgvViewModel.GetInstance().cartModel_1.isBool = IsBool.Yes;
AgvViewModel.GetInstance().cartModel_1.cartMotionTrajectory = CartMotionTrajectory.yc_1_1;
}

private void Button_Click_2(object sender, RoutedEventArgs e)
{
AgvViewModel.GetInstance().cartModel_1.isBool = IsBool.No;
AgvViewModel.GetInstance().cartModel_1.cartMotionTrajectory = CartMotionTrajectory.hs_1;
}

private void Button_Click_3(object sender, RoutedEventArgs e)
{
AgvViewModel.GetInstance().cartModel_1.cartMotionTrajectory = CartMotionTrajectory.hj;
AgvViewModel.GetInstance().ParkingPileModel_1.isBool = IsBool.Yes;
}

private void Button_Click_4(object sender, RoutedEventArgs e)
{
AgvViewModel.GetInstance().cartModel_1.cartMotionTrajectory = CartMotionTrajectory.Stop;

}
}
}

+ 581
- 12
FryPot_DosingSystem/ViewModel/AgvViewModel.cs Wyświetl plik

@@ -2,9 +2,12 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;

namespace FryPot_DosingSystem.ViewModel
{
@@ -30,25 +33,306 @@ namespace FryPot_DosingSystem.ViewModel
cartModel_2 = new CartModel();
cartModel_3 = new CartModel();
cartModel_4 = new CartModel();
//初始化滚筒线
RollerLines_1 = new RollerLinesModel();
RollerLines_2 = new RollerLinesModel();
RollerLines_3 = new RollerLinesModel();
RollerLines_4 = new RollerLinesModel();
//初始化停车桩
ParkingPileModel_1 = new ParkingPileModel { isBool = IsBool.Yes };
ParkingPileModel_2 = new ParkingPileModel { isBool = IsBool.Yes };
ParkingPileModel_3 = new ParkingPileModel { isBool = IsBool.Yes };
ParkingPileModel_4 = new ParkingPileModel { isBool = IsBool.Yes };
ParkingPileModel_5 = new ParkingPileModel { isBool = IsBool.No };
ParkingPileModel_6 = new ParkingPileModel { isBool = IsBool.No };
//初始化炒锅
wokModel_1 = new WokModel();
wokModel_2 = new WokModel();
wokModel_3 = new WokModel();
wokModel_4 = new WokModel();
wokModel_5 = new WokModel();
Test();
}
#endregion

#region 公共调用函数
public void Test()
{
RollerLines_2.DishesNum = "3";


wokModel_1.goodsName = "番茄炒蛋";
wokModel_1.workflows = new ObservableCollection<WorkflowModel>
{
new WorkflowModel {id=1,Name="取番茄",isBool= IsBool.Yes},
new WorkflowModel {id=2,Name="取蛋" } };
}
#endregion
/// <summary>
/// 设置停车桩或充电桩
/// </summary>
/// <param name="id">设置哪一个停车桩:1 2 3(5 6 为充电桩)</param>
/// <param name="isBool">是否有小车</param>
public void Set停车桩(int id, IsBool isBool)
{
try
{
switch (id)
{
case 1:
ParkingPileModel_1.isBool = isBool;
break;
case 2:
ParkingPileModel_2.isBool = isBool;
break;
case 3:
ParkingPileModel_3.isBool = isBool;
break;
case 4:
ParkingPileModel_4.isBool = isBool;
break;
case 5:
ParkingPileModel_5.isBool = isBool;
break;
case 6:
ParkingPileModel_6.isBool = isBool;
break;
}
}
catch (Exception ex)
{

}
}
/// <summary>
/// 小车停止
/// </summary>
/// <param name="id">默认:1 2 3 4,代表四辆车</param>
public void Set小车停止(int id)
{
try
{
switch (id)
{
case 1:
cartModel_1.cartMotionTrajectory = CartMotionTrajectory.Stop;
break;
case 2:
cartModel_2.cartMotionTrajectory = CartMotionTrajectory.Stop;
break;
case 3:
cartModel_3.cartMotionTrajectory = CartMotionTrajectory.Stop;
break;
case 4:
cartModel_4.cartMotionTrajectory = CartMotionTrajectory.Stop;
break;
}

}
catch (Exception ex)
{

}
}
/// <summary>
/// 控制小车运行
/// </summary>
/// <param name="id">默认:1 2 3 4,代表四辆车</param>
/// <param name="cart"></param>
public void Set小车运动(int id, CartMotionTrajectory cart)
{
try
{
switch (id)
{
case 1:
cartModel_1.cartMotionTrajectory = CartMotionTrajectory.Stop;
Thread.Sleep(10);
cartModel_1.cartMotionTrajectory = cart;
break;
case 2:
cartModel_2.cartMotionTrajectory = CartMotionTrajectory.Stop;
Thread.Sleep(10);
cartModel_2.cartMotionTrajectory = cart;
break;
case 3:
cartModel_3.cartMotionTrajectory = CartMotionTrajectory.Stop;
Thread.Sleep(10);
cartModel_3.cartMotionTrajectory = cart;
break;
case 4:
cartModel_4.cartMotionTrajectory = CartMotionTrajectory.Stop;
Thread.Sleep(10);
cartModel_4.cartMotionTrajectory = cart;
break;
}

}
catch (Exception ex)
{

}
}
/// <summary>
/// 小车是否承载物品
/// </summary>
/// <param name="id">默认:1 2 3 4,代表四辆车</param>
/// <param name="cart"></param>
public void Set小车是否承载物品(int id, IsBool cart)
{
try
{
switch (id)
{
case 1:
cartModel_1.isBool = cart;
break;
case 2:
cartModel_2.isBool = cart;
break;
case 3:
cartModel_3.isBool = cart;
break;
case 4:
cartModel_4.isBool = cart;
break;
}

}
catch (Exception ex)
{

}
}
/// <summary>
/// 滚筒线状态
/// </summary>
/// <param name="id">默认:1 2 3 4,代表四条滚筒线,(4 代表空桶线)</param>
/// <param name="cart"></param>
public void Set滚筒线状态(int id, IsRun cart)
{
try
{
switch (id)
{
case 1:
RollerLines_1.isRun = cart;
break;
case 2:
RollerLines_2.isRun = cart;
break;
case 3:
RollerLines_3.isRun = cart;
break;
case 4:
RollerLines_4.isRun = cart;
break;
}

}
catch (Exception ex)
{

}
}
/// <summary>
/// 滚筒线上数量
/// </summary>
/// <param name="id">默认:1 2 3 4,代表四条滚筒线,(4 代表空桶线)</param>
/// <param name="cart">默认: 1 - 8,最多承载 8个菜品或者8个空碗</param>
public void Set滚筒线上数量(int id, string cart)
{
try
{
switch (id)
{
case 1:
RollerLines_1.DishesNum = cart;
break;
case 2:
RollerLines_2.DishesNum = cart;
break;
case 3:
RollerLines_3.DishesNum = cart;
break;
case 4:
RollerLines_4.DishesNum = cart;
break;
}

#region 公共函数
}
catch (Exception ex)
{

}
}
/// <summary>
/// 设置炒锅显示流程
/// </summary>
/// <param name="id">默认:1 2 3 4 5,代表五个炒锅</param>
/// <param name="mode"></param>
public void Set炒锅显示流程(int id, WokModel mode)
{
try
{
switch (id)
{
case 1:
wokModel_1=mode;
break;
case 2:
wokModel_2 = mode;
break;
case 3:
wokModel_3 = mode;
break;
case 4:
wokModel_4 = mode;
break;
case 5:
wokModel_5 = mode;
break;
}

}
catch (Exception ex)
{

}
}
#endregion

#region 其他函数
/// <summary>
/// 获取所有命令
/// </summary>
public List<string> GetCommand()
{
List<string> vs = new List<string>();
try
{
vs = System.Enum.GetNames(typeof(CartMotionTrajectory))?.ToList();
}
catch (Exception ex)
{
return vs;
}
return vs;
}
/// <summary>
/// 根据命令获取值
/// </summary>
public CartMotionTrajectory GetCommandValue(string name)
{
return ToEnumValue<CartMotionTrajectory>(name);
}
/// <summary>
/// 根据枚举名称获取枚举值
/// </summary>
public T ToEnumValue<T>(string name)
{
return (T)Enum.Parse(typeof(T), name);
}
#endregion

#region 4个滚筒线控制
@@ -312,6 +596,98 @@ namespace FryPot_DosingSystem.ViewModel
}
#endregion

#region 5个炒锅流程控制
/// <summary>
/// 一号炒锅工作流程
/// </summary>
private WokModel _wokModel_1;
public WokModel wokModel_1
{
get
{
return _wokModel_1;
}
set
{
if (_wokModel_1 == value)
return;
_wokModel_1 = value;
OnPropertyChanged("wokModel_1");
}
}
/// <summary>
/// 二号炒锅工作流程
/// </summary>
private WokModel _wokModel_2;
public WokModel wokModel_2
{
get
{
return _wokModel_2;
}
set
{
if (_wokModel_2 == value)
return;
_wokModel_2 = value;
OnPropertyChanged("wokModel_2");
}
}
/// <summary>
/// 三号炒锅工作流程
/// </summary>
private WokModel _wokModel_3;
public WokModel wokModel_3
{
get
{
return _wokModel_3;
}
set
{
if (_wokModel_3 == value)
return;
_wokModel_3 = value;
OnPropertyChanged("wokModel_3");
}
}
/// <summary>
/// 四号炒锅工作流程
/// </summary>
private WokModel _wokModel_4;
public WokModel wokModel_4
{
get
{
return _wokModel_4;
}
set
{
if (_wokModel_4 == value)
return;
_wokModel_4 = value;
OnPropertyChanged("wokModel_4");
}
}
/// <summary>
/// 五号炒锅工作流程
/// </summary>
private WokModel _wokModel_5;
public WokModel wokModel_5
{
get
{
return _wokModel_5;
}
set
{
if (_wokModel_5 == value)
return;
_wokModel_5 = value;
OnPropertyChanged("wokModel_5");
}
}
#endregion
}

/// <summary>
@@ -319,7 +695,6 @@ namespace FryPot_DosingSystem.ViewModel
/// </summary>
public class CartModel : ObservableObject
{

/// <summary>
/// 车上是否有物品
/// </summary>
@@ -333,11 +708,10 @@ namespace FryPot_DosingSystem.ViewModel
set
{
_isBool = value;
Text= _isBool.ToString();
Text = _isBool.ToString();
OnPropertyChanged("isBool");
}
}
/// <summary>
/// 车运动轨迹方式
/// </summary>
@@ -351,7 +725,7 @@ namespace FryPot_DosingSystem.ViewModel
set
{
_cartMotionTrajectory = value;
Tag= _cartMotionTrajectory.ToString();
Tag = _cartMotionTrajectory.ToString();
OnPropertyChanged("cartMotionTrajectory");
}
}
@@ -437,7 +811,7 @@ namespace FryPot_DosingSystem.ViewModel
set
{
_isRun = value;
Text= _isRun.ToString();
Text = _isRun.ToString();
OnPropertyChanged("isBool");
}
}
@@ -460,7 +834,7 @@ namespace FryPot_DosingSystem.ViewModel
try
{
count = int.Parse(_DishesNum);
if (count > 0 && count <= 8)
if (count >= 0 && count <= 8)
{
_DishesNum = count.ToString();
}
@@ -475,8 +849,6 @@ namespace FryPot_DosingSystem.ViewModel
OnPropertyChanged("DishesNum");
}
}


private string _Text = IsRun.Stop.ToString();
public string Text
{
@@ -491,6 +863,203 @@ namespace FryPot_DosingSystem.ViewModel
}
}
}
/// <summary>
/// 炒锅 流程控制
/// </summary>
public class WokModel : ObservableObject
{
/// <summary>
/// id
/// </summary>
private string _id;
public string id
{
get
{
return _id;
}
set
{
_id = value;
OnPropertyChanged("id");
}
}
/// <summary>
/// 订单id
/// </summary>
private string _orderID;
public string orderID
{
get
{
return _orderID;
}
set
{
_orderID = value;
OnPropertyChanged("orderID");
}
}
/// <summary>
/// 商品名称
/// </summary>
private string _goodsName;
public string goodsName
{
get
{
return _goodsName;
}
set
{
_goodsName = value;
OnPropertyChanged("goodsName");
}
}
/// <summary>
/// 其他信息
/// </summary>
private string _other;
public string other
{
get
{
return _other;
}
set
{
_other = value;
OnPropertyChanged("other");
}
}
/// <summary>
/// 工作流程
/// </summary>
private ObservableCollection<WorkflowModel> _workflows = new ObservableCollection<WorkflowModel>();
public ObservableCollection<WorkflowModel> workflows
{
get
{
return _workflows;
}
set
{
_workflows = value;
OnPropertyChanged("workflows");
}
}
public WokModel()
{
id = Guid.NewGuid().ToString();
workflows = new ObservableCollection<WorkflowModel>();
}
}

/// <summary>
/// 工作流程
/// </summary>
public class WorkflowModel : ObservableObject
{
/// <summary>
/// 序号默认:1-10
/// </summary>
private int _id=1;
public int id
{
get
{
return _id;
}
set
{
_id = value;
xh = GetXH.ID(_id);
OnPropertyChanged("id");
}
}
/// <summary>
/// 名称
/// </summary>
private string _Name;
public string Name
{
get
{
return _Name;
}
set
{
_Name = value;
OnPropertyChanged("Name");
}
}
/// <summary>
/// 是否已完成当前步骤
/// </summary>
private IsBool _isBool = IsBool.No;
public IsBool isBool
{
get
{
return _isBool;
}
set
{
_isBool = value;
if (_isBool == IsBool.Yes)
{
visibility = Visibility.Visible;
}
else
{
visibility = Visibility.Collapsed;
}
OnPropertyChanged("isBool");
}
}
private Visibility _visibility = Visibility.Collapsed;
public Visibility visibility
{
get
{
return _visibility;
}
set
{
_visibility = value;
OnPropertyChanged("visibility");
}
}
private string _xh;
public string xh
{
get
{
return _xh;
}
set
{
_xh = value;
OnPropertyChanged("xh");
}
}
}

/// <summary>
/// 获取序号
/// </summary>
static class GetXH
{
//①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿
public static string ID(int i)
{
string strbu = "① ";
string str = "①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿";
if (i <= 50)
{
strbu= str.Substring(i-1, 1)+" ";
}
return strbu;
}
}
}

Ładowanie…
Anuluj
Zapisz