fyf 2 years ago
parent
commit
8fb43ced6b
6 changed files with 248 additions and 154 deletions
  1. +1
    -0
      FryPot_DosingSystem/AGV/WhichCart.cs
  2. +233
    -151
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  3. +9
    -0
      FryPot_DosingSystem/Control/GlobalVariable.cs
  4. +2
    -0
      FryPot_DosingSystem/View/AgvView.xaml
  5. +2
    -2
      FryPot_DosingSystem/View/AgvView.xaml.cs
  6. +1
    -1
      FryPot_DosingSystem/ViewModel/AgvViewModel.cs

+ 1
- 0
FryPot_DosingSystem/AGV/WhichCart.cs View File

@@ -49,6 +49,7 @@ namespace FryPot_DosingSystem.AGV
hs_2,//2号炒锅-运输空碗到-空碗流水线
hs_3,//3号炒锅-运输空碗到-空碗流水线
hs_4,//4号炒锅-运输空碗到-空碗流水线
hs_5,//5号炒锅-运输空碗到-空碗流水线

hj,//空碗流水线-回到充电桩或者停车桩
}


+ 233
- 151
FryPot_DosingSystem/Control/DosingLogicControl.cs View File

@@ -17,6 +17,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows;
using FryPot_DosingSystem.AGV;

namespace FryPot_DosingSystem.Control
{
@@ -224,7 +225,7 @@ namespace FryPot_DosingSystem.Control
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();
MainTask();
CommandRegist();
@@ -296,7 +297,7 @@ namespace FryPot_DosingSystem.Control
//线体1任务上报
if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指线体上料
{
//日志
}
//线体2任务上报
if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指线体上料
@@ -312,17 +313,21 @@ namespace FryPot_DosingSystem.Control
//线体1任务上报
if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指线体上料
{
AgvViewModel.GetInstance().Set滚筒线上数量(1, (globalVar.LOneMaterialNum - 1).ToString());
AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.Yes);

}
//线体2任务上报
if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指线体上料
{

AgvViewModel.GetInstance().Set滚筒线上数量(2, (globalVar.LTwoMaterialNum - 1).ToString());
AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.Yes);
}
//线体3任务上报
if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指线体上料
{

AgvViewModel.GetInstance().Set滚筒线上数量(3, (globalVar.LThreeMaterialNum - 1).ToString());
AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.Yes);
}
//线体1任务上报
if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料
@@ -391,34 +396,69 @@ namespace FryPot_DosingSystem.Control
//线体1任务上报
if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指空桶下料
{

AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start);
AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.No);
if (globalVar.LFourRollerNum >= 8)
{
AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
}
else
{
AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString());
}
}
//线体2任务上报
if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指空桶下料
{

AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start);
AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.No);
if (globalVar.LFourRollerNum >= 8)
{
AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
}
else
{
AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString());
}
}
//线体3任务上报
if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指空桶下料
{

AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start);
AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.No);
if (globalVar.LFourRollerNum >= 8)
{
AgvViewModel.GetInstance().Set滚筒线上数量(4, "8");
}
else
{
AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString());
}
}
//线体1任务上报
if (objData.state == "DONE" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指空桶下料
{

AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("hj"));
AgvViewModel.GetInstance().Set小车停止(1);
AgvViewModel.GetInstance().Set停车桩(1, IsBool.Yes);
}
//线体2任务上报
if (objData.state == "DONE" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指空桶下料
{

AgvViewModel.GetInstance().Set小车运动(2, AgvViewModel.GetInstance().GetCommandValue("hj"));
AgvViewModel.GetInstance().Set小车停止(2);
AgvViewModel.GetInstance().Set停车桩(2, IsBool.Yes);
}
//线体3任务上报
if (objData.state == "DONE" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指空桶下料
{

AgvViewModel.GetInstance().Set小车运动(3, AgvViewModel.GetInstance().GetCommandValue("hj"));
AgvViewModel.GetInstance().Set小车停止(3);
AgvViewModel.GetInstance().Set停车桩(3, IsBool.Yes);
}
#endregion


}

}
@@ -467,123 +507,123 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void ReadPlcData()
{
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// GetAddressData("D2001", new Action<ushort[]>((data) =>
// {
// globalVar.rollerLineOne.StationOne = data[0];
// globalVar.rollerLineOne.StationTwo = data[1];
// globalVar.rollerLineOne.StationThree = data[2];
// globalVar.rollerLineOne.StationFour = data[3];
// globalVar.rollerLineOne.StationFive = data[4];
// globalVar.rollerLineOne.StationSix = data[5];
// globalVar.rollerLineOne.StationSeven = data[6];
// globalVar.rollerLineOne.StationEight = data[7];
// }));
// GetAddressData("D2011", new Action<ushort[]>((data) =>
// {
// globalVar.rollerLineTwo.StationOne = data[0];
// globalVar.rollerLineTwo.StationTwo = data[1];
// globalVar.rollerLineTwo.StationThree = data[2];
// globalVar.rollerLineTwo.StationFour = data[3];
// globalVar.rollerLineTwo.StationFive = data[4];
// globalVar.rollerLineTwo.StationSix = data[5];
// globalVar.rollerLineTwo.StationSeven = data[6];
// globalVar.rollerLineTwo.StationEight = data[7];
// }));
// GetAddressData("D2021", new Action<ushort[]>((data) =>
// {
// globalVar.rollerLineThree.StationOne = data[0];
// globalVar.rollerLineThree.StationTwo = data[1];
// globalVar.rollerLineThree.StationThree = data[2];
// globalVar.rollerLineThree.StationFour = data[3];
// globalVar.rollerLineThree.StationFive = data[4];
// globalVar.rollerLineThree.StationSix = data[5];
// globalVar.rollerLineThree.StationSeven = data[6];
// globalVar.rollerLineThree.StationEight = data[7];
// }));
// GetAddressData("D2031", new Action<ushort[]>((data) =>
// {
// globalVar.rollerLineOne.OutMaterialingSingle = data[3];
// globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
// globalVar.rollerLineThree.OutMaterialingSingle = data[5];
// //globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6];
// //globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7];
// //globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8];
// AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble = data[6];
// AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble = data[7];
// AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble = data[8];
// }));
// GetAddressData("D2040", new Action<ushort[]>((data) =>
// {
// globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0];
// globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1];
// globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2];
// globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3];
// globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4];
// }));
// GetAddressData("D2045", new Action<ushort[]>((data) =>
// {
// globalVar.fryPotOne.InputMaterialArrivedSingle = data[0];
// globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1];
// globalVar.fryPotThree.InputMaterialArrivedSingle = data[2];
// globalVar.fryPotFour.InputMaterialArrivedSingle = data[3];
// globalVar.fryPotFive.InputMaterialArrivedSingle = data[4];
// }));
// GetAddressData("D2050", new Action<ushort[]>((data) =>
// {
// globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0];
// globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1];
// globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2];
// globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3];
// globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4];
// }));
// GetAddressData("D2065", new Action<ushort[]>((data) =>
// {
// globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0];
// globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1];
// globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2];
// globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3];
// globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4];
// }));
// GetAddressData("D2070", new Action<ushort[]>((data) =>
// {
// //globalVar.fryPotOne.RollerTroubleSingle = data[0];
// //globalVar.fryPotTwo.RollerTroubleSingle = data[1];
// //globalVar.fryPotThree.RollerTroubleSingle = data[2];
// //globalVar.fryPotFour.RollerTroubleSingle = data[3];
// //globalVar.fryPotFive.RollerTroubleSingle = data[4];
// AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble = data[0];
// AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble = data[1];
// AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble = data[2];
// AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble = data[3];
// AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble = data[4];
// }));
// GetAddressData("D2078", new Action<ushort[]>(data =>
// {
// globalVar.rollerLineOne.RecipeCompleteSingle = data[0];
// globalVar.rollerLineTwo.RecipeCompleteSingle = data[1];
// globalVar.rollerLineThree.RecipeCompleteSingle = data[2];
// }));
// GetAddressData("D2075", new Action<ushort[]>(data =>
// {
ThreadManage.GetInstance().StartLong(new Action(() =>
{
GetAddressData("D2001", new Action<ushort[]>((data) =>
{
globalVar.rollerLineOne.StationOne = data[0];
globalVar.rollerLineOne.StationTwo = data[1];
globalVar.rollerLineOne.StationThree = data[2];
globalVar.rollerLineOne.StationFour = data[3];
globalVar.rollerLineOne.StationFive = data[4];
globalVar.rollerLineOne.StationSix = data[5];
globalVar.rollerLineOne.StationSeven = data[6];
globalVar.rollerLineOne.StationEight = data[7];
}));
GetAddressData("D2011", new Action<ushort[]>((data) =>
{
globalVar.rollerLineTwo.StationOne = data[0];
globalVar.rollerLineTwo.StationTwo = data[1];
globalVar.rollerLineTwo.StationThree = data[2];
globalVar.rollerLineTwo.StationFour = data[3];
globalVar.rollerLineTwo.StationFive = data[4];
globalVar.rollerLineTwo.StationSix = data[5];
globalVar.rollerLineTwo.StationSeven = data[6];
globalVar.rollerLineTwo.StationEight = data[7];
}));
GetAddressData("D2021", new Action<ushort[]>((data) =>
{
globalVar.rollerLineThree.StationOne = data[0];
globalVar.rollerLineThree.StationTwo = data[1];
globalVar.rollerLineThree.StationThree = data[2];
globalVar.rollerLineThree.StationFour = data[3];
globalVar.rollerLineThree.StationFive = data[4];
globalVar.rollerLineThree.StationSix = data[5];
globalVar.rollerLineThree.StationSeven = data[6];
globalVar.rollerLineThree.StationEight = data[7];
}));
GetAddressData("D2031", new Action<ushort[]>((data) =>
{
globalVar.rollerLineOne.OutMaterialingSingle = data[3];
globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
globalVar.rollerLineThree.OutMaterialingSingle = data[5];
//globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6];
//globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7];
//globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8];
AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble = data[6];
AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble = data[7];
AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble = data[8];
}));
GetAddressData("D2040", new Action<ushort[]>((data) =>
{
globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0];
globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1];
globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2];
globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3];
globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4];
}));
GetAddressData("D2045", new Action<ushort[]>((data) =>
{
globalVar.fryPotOne.InputMaterialArrivedSingle = data[0];
globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1];
globalVar.fryPotThree.InputMaterialArrivedSingle = data[2];
globalVar.fryPotFour.InputMaterialArrivedSingle = data[3];
globalVar.fryPotFive.InputMaterialArrivedSingle = data[4];
}));
GetAddressData("D2050", new Action<ushort[]>((data) =>
{
globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0];
globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1];
globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2];
globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3];
globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4];
}));
GetAddressData("D2065", new Action<ushort[]>((data) =>
{
globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0];
globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1];
globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2];
globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3];
globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4];
}));
GetAddressData("D2070", new Action<ushort[]>((data) =>
{
//globalVar.fryPotOne.RollerTroubleSingle = data[0];
//globalVar.fryPotTwo.RollerTroubleSingle = data[1];
//globalVar.fryPotThree.RollerTroubleSingle = data[2];
//globalVar.fryPotFour.RollerTroubleSingle = data[3];
//globalVar.fryPotFive.RollerTroubleSingle = data[4];
AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble = data[0];
AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble = data[1];
AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble = data[2];
AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble = data[3];
AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble = data[4];
}));
GetAddressData("D2078", new Action<ushort[]>(data =>
{
globalVar.rollerLineOne.RecipeCompleteSingle = data[0];
globalVar.rollerLineTwo.RecipeCompleteSingle = data[1];
globalVar.rollerLineThree.RecipeCompleteSingle = data[2];
}));
GetAddressData("D2075", new Action<ushort[]>(data =>
{

// globalVar.CleadBarrelEnterSingle = data[0];
// }));
// GetAddressData("D2077", new Action<ushort[]>(data =>
// {
globalVar.CleadBarrelEnterSingle = data[0];
}));
GetAddressData("D2077", new Action<ushort[]>(data =>
{

// globalVar.CleadBarrelExitSingle = data[0];
// }));
// //globalVar.rollerLineOne.OutMaterialingSingle = 0;
// //globalVar.rollerLineOne.StationOne = 401;
// //globalVar.rollerLineOne.StationTwo = 402;
// //globalVar.rollerLineOne.OutMaterialingTroubleSingle = 1;
// // AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble =1;
// RollerLineStatusDisplay();
// Thread.Sleep(10);
//}), "MainViewReadPlcData");
globalVar.CleadBarrelExitSingle = data[0];
}));
//globalVar.rollerLineOne.OutMaterialingSingle = 0;
//globalVar.rollerLineOne.StationOne = 401;
//globalVar.rollerLineOne.StationTwo = 402;
//globalVar.rollerLineOne.OutMaterialingTroubleSingle = 1;
// AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble =1;
RollerLineStatusDisplay();
Thread.Sleep(10);
}), "MainViewReadPlcData");

}
/// <summary>
@@ -713,20 +753,6 @@ namespace FryPot_DosingSystem.Control
{
if (obj != null && obj is NewRecipeModel[] recipes)
{
//int? res = (recipe.materialCollection.ElementAt(0).MaterialLoc) / 100;
//if (res != null)
//{
// switch (res)
// {
// case 1:
// case 4: RecipeQuene.Enqueue(recipe); break;
// case 3: LThreeRecipeQuene.Enqueue(recipe); break;
// case 2:
// case 5: LTwoRecipeQuene.Enqueue(recipe); break;
// }
// ReicpeNum++;
// MessageLog.GetInstance.ShowUserLog($"接收到第{ReicpeNum}个配方");
//}
ReicpeNum = ReicpeNum + recipes.Length;
MessageLog.GetInstance.ShowUserLog($"新接收到{recipes.Length}个配方,总共{ReicpeNum}个配方");
for (int i = 0; i < recipes.Length; i++)
@@ -770,7 +796,8 @@ namespace FryPot_DosingSystem.Control
//LOneFryPotOutputMaterial();
//LTwoFryPotOutputMaterial();
//LThreeFryPotOutputMaterial();
ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute();Thread.Sleep(10); }) , "滚筒线1任务线程");

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任务线程");

@@ -855,6 +882,8 @@ namespace FryPot_DosingSystem.Control
{
LThreeErrorRecipe = false;
int headNum = result.materialCollection[0].MaterialLoc / 100;
globalVar.LThreeMaterialNum = result.materialCollection.Count;
globalVar.LThreeFryPotSerial = headNum;
globalVar.LThreeCurrentRecipeName = result.RecipeName;
MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线开始制作【{result.RecipeName}】 配方");
for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
@@ -907,6 +936,8 @@ namespace FryPot_DosingSystem.Control
{
LTwoErrorRecipe = false;
int headNum = result.materialCollection[0].MaterialLoc / 100;
globalVar.LTwoMaterialNum = result.materialCollection.Count;
globalVar.LTwoFryPotSerial = headNum;
globalVar.LTwoCurrentRecipeName = result.RecipeName;
MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线开始制作【{result.RecipeName}】 配方");
for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
@@ -955,7 +986,9 @@ namespace FryPot_DosingSystem.Control
if (RecipeQuene.TryDequeue(out NewRecipeModel result))
{
ErrorRecipe = false;
int headNum = result.materialCollection[0].MaterialLoc / 100; ;
int headNum = result.materialCollection[0].MaterialLoc / 100;
globalVar.LOneMaterialNum = result.materialCollection.Count;
globalVar.LOneFryPotSerial = headNum;
globalVar.LOneCurrentRecipeName = result.RecipeName;
MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方");
for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
@@ -1133,9 +1166,17 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void LOneFryPotInputMaterial()
{
if (OutputMaterialQuene.Count > 0 && agvArriveUnLoad && globalVar.AgvToFryPot&&!globalVar.PotOneInputMaterialArrive)
if (OutputMaterialQuene.Count > 0 && agvArriveUnLoad && globalVar.AgvToFryPot && !globalVar.PotOneInputMaterialArrive)
{
MessageLog.GetInstance.ShowRunLog("AGV到达【1】号线体指定炒锅下料位置");
if (globalVar.LOneFryPotSerial == 1)
{
AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("yc_1_1"));
}
else if (globalVar.LOneFryPotSerial == 4)
{
AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("yc_1-4"));
}
MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅下料位置");
AgvArriveFryPotOneOrFourSingleSetDown();
agvArriveUnLoad = false;
globalVar.PotOneInputMaterialArrive = true;
@@ -1144,11 +1185,12 @@ namespace FryPot_DosingSystem.Control

public void LOneFallMaterial()
{
if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive&&OutputMaterialQuene.Count>0&&!globalVar.PotOneOutputRollerArrive)
if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive)
{
FryPotOneRollerTroubleCheck();
if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//炒锅滚筒无故障
{
AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.No);
//炒锅滚筒进料运行到位处理
FryPotOneOrFourInputMaterialRollerOperate();
AgvFromFryPotOneOrFourToClean();//上游下发搬运任务给AGV
@@ -1164,6 +1206,14 @@ namespace FryPot_DosingSystem.Control
{
if (LTwoOutputMaterialQuene.Count > 0 && LTwoagvArriveUnLoad && globalVar.LTwoAgvToFryPot && !globalVar.LTwoPotInputMaterialArrive)
{
if (globalVar.LTwoFryPotSerial == 2)
{
AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_2);
}
else if (globalVar.LTwoFryPotSerial == 5)
{
AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_5);
}
MessageLog.GetInstance.ShowRunLog("AGV到达【2】号线体指定炒锅下料位置");
AgvArriveFryPotTwoOrFiveSingleSetDown();
LTwoagvArriveUnLoad = false;
@@ -1177,6 +1227,7 @@ namespace FryPot_DosingSystem.Control
FryPotTwoRollerTroubleCheck();
if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//炒锅滚筒无故障
{
AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.No);
//炒锅滚筒进料运行到位处理
FryPotTwoOrFiveInputMaterialRollerOperate();
AgvFromFryPotTwoOrFiveToClean();//上游下发搬运任务给AGV
@@ -1192,6 +1243,7 @@ namespace FryPot_DosingSystem.Control
{
if (LThreeOutputMaterialQuene.Count > 0 && LThreeagvArriveUnLoad && globalVar.LThreeAgvToFryPot && !globalVar.LThreePotInputMaterialArrive)
{
AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.yc_3_3);
MessageLog.GetInstance.ShowRunLog("AGV到达【3】号线体指定炒锅下料位置");
AgvArriveFryPotThreeSingleSetDown();
LThreeagvArriveUnLoad = false;
@@ -1201,11 +1253,12 @@ namespace FryPot_DosingSystem.Control

public void LThreeFallMaterial()
{
if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive)
if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive)
{
FryPotThreeRollerTroubleCheck();
if (FryPotThreeAlarm == 1)//炒锅滚筒无故障
{
AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.No);
//炒锅滚筒进料运行到位处理
FryPotThreeInputMaterialRollerOperate();
AgvFromFryPotThreeToClean();//上游下发搬运任务给AGV
@@ -1255,7 +1308,7 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void LOneFryPotOutputMaterial()
{
if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && agvArriveUpLoad && globalVar.PotOneOutputRollerArrive&& !globalVar.AgvArrivePot)
if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && agvArriveUpLoad && globalVar.PotOneOutputRollerArrive && !globalVar.AgvArrivePot)
{

MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线对应炒锅空桶上料位置");
@@ -1266,14 +1319,24 @@ namespace FryPot_DosingSystem.Control
}
public void LOneEmptyOperate()
{
if ((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1) && agvFryPotEmptyRollerArrive&&OutputMaterialQuene.Count>0&& globalVar.AgvArrivePot)
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))//空桶出桶后,出料原料队列移除对应原料
{
AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.OnllYes);
if (globalVar.LOneFryPotSerial == 1)
{
AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("hs_1"));
}
else if (globalVar.LOneFryPotSerial == 4)
{
AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("hs_4"));
}
agvFryPotEmptyRollerArrive = false;
agvArriveUpLoad = false;
MessageLog.GetInstance.ShowRunLog("AGV在【1】号滚筒线对应炒锅空桶上料完成,将进行空桶回收");
@@ -1285,12 +1348,13 @@ namespace FryPot_DosingSystem.Control
globalVar.PotOneInputMaterialArrive = false;
globalVar.PotOneOutputRollerArrive = false;
globalVar.AgvArrivePot = false;
globalVar.LOneMaterialNum--;
}
}
}

}
/// <summary>
/// 线体2对应炒锅出桶
/// </summary>
@@ -1316,6 +1380,15 @@ namespace FryPot_DosingSystem.Control
FryPotTwoOrFiveOutEmpetyRollerOperate();
if (LTwoOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
{
AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.OnllYes);
if (globalVar.LOneFryPotSerial == 2)
{
AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_2);
}
else if (globalVar.LOneFryPotSerial == 5)
{
AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_5);
}
LTwoagvFryPotEmptyRollerArrive = false;
agvArriveLTwoUpLoad = false;
MessageLog.GetInstance.ShowRunLog("AGV在【2】号滚筒线对应炒锅空桶上料完成,将进行空桶回收");
@@ -1352,11 +1425,13 @@ namespace FryPot_DosingSystem.Control
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))//空桶出桶后,出料原料队列移除对应原料
{
AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes);
AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3);
LThreeagvFryPotEmptyRollerArrive = false;
agvArriveLThreeUpLoad = false;
MessageLog.GetInstance.ShowRunLog("AGV在【3】号滚筒线对应炒锅空桶上料完成,将进行空桶回收");
@@ -1787,15 +1862,17 @@ 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)
{
if (agvArriveUpLoad && globalVar.LoadRoller && globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.AgvToFryPot)//无故障
{

MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
AgvArriveLineSingelSetDown(InputMaterialQuene);
if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start);
OutputMaterialQuene.Enqueue(materialInfo);
agvArriveUpLoad = false;
globalVar.AgvToFryPot = true;
@@ -1833,6 +1910,7 @@ namespace FryPot_DosingSystem.Control
if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start);
LTwoOutputMaterialQuene.Enqueue(materialInfo);
agvArriveLTwoUpLoad = false;
globalVar.LTwoAgvToFryPot = true;
@@ -1871,6 +1949,7 @@ namespace FryPot_DosingSystem.Control
if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");
AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start);
LThreeOutputMaterialQuene.Enqueue(materialInfo);
agvArriveLThreeUpLoad = false;
globalVar.LThreeAgvToFryPot = true;
@@ -1903,6 +1982,9 @@ namespace FryPot_DosingSystem.Control
{
if (errorCode == "SUCCESS")
{
AgvViewModel.GetInstance().Set停车桩(num, IsBool.No);
AgvViewModel.GetInstance().Set小车是否承载物品(num, IsBool.No);
AgvViewModel.GetInstance().Set小车运动(num, AgvViewModel.GetInstance().GetCommandValue($"qc_{num}"));
MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶");
globalVar.AllowAgvToLineLoadRoller = false;
}
@@ -2024,7 +2106,7 @@ namespace FryPot_DosingSystem.Control
// MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【3】故障!!!");
// // lineAlarm = -1;
//}
}
/// <summary>
/// 1号线体数据下发


+ 9
- 0
FryPot_DosingSystem/Control/GlobalVariable.cs View File

@@ -145,6 +145,15 @@ namespace FryPot_DosingSystem.Control
public bool LThreePotOutputRollerArrive { get; set; }
public bool LThreeAgvArrivePot { get; set; }
#endregion
#region AGV视图显示变量
public int LOneMaterialNum = 0;
public int LOneFryPotSerial = 1;
public int LTwoMaterialNum = 0;
public int LTwoFryPotSerial = 2;
public int LThreeMaterialNum = 0;
public int LThreeFryPotSerial = 3;
public int LFourRollerNum = 0;
#endregion
}
/// <summary>
/// 滚筒线1相关变量


+ 2
- 0
FryPot_DosingSystem/View/AgvView.xaml View File

@@ -1250,6 +1250,7 @@
</ResourceDictionary>
</UserControl.Resources>
<Viewbox>
<Grid>

<!--#region 测试按钮-->
@@ -1615,4 +1616,5 @@
<!--#endregion-->

</Grid>
</Viewbox>
</UserControl>

+ 2
- 2
FryPot_DosingSystem/View/AgvView.xaml.cs View File

@@ -74,7 +74,7 @@ namespace FryPot_DosingSystem.View
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Start);
@@ -86,7 +86,7 @@ namespace FryPot_DosingSystem.View
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Stop);


+ 1
- 1
FryPot_DosingSystem/ViewModel/AgvViewModel.cs View File

@@ -51,7 +51,7 @@ namespace FryPot_DosingSystem.ViewModel
wokModel_3 = new WokModel();
wokModel_4 = new WokModel();
wokModel_5 = new WokModel();
Test();
// Test();
}
#endregion



Loading…
Cancel
Save