Browse Source

180项目更新

样式分支
taoye 2 years ago
parent
commit
0f6fc527fd
4 changed files with 289 additions and 258 deletions
  1. +0
    -4
      BPASmartClient.Helper/ThreadManage.cs
  2. +258
    -252
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  3. +29
    -0
      FryPot_DosingSystem/Control/GlobalVariable.cs
  4. +2
    -2
      FryPot_DosingSystem/View/RecipeSetView.xaml

+ 0
- 4
BPASmartClient.Helper/ThreadManage.cs View File

@@ -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


+ 258
- 252
FryPot_DosingSystem/Control/DosingLogicControl.cs View File

@@ -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 View File

@@ -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相关变量


+ 2
- 2
FryPot_DosingSystem/View/RecipeSetView.xaml View File

@@ -58,7 +58,7 @@
Foreground="Aqua"
IcoText="&#xe626;"
Cursor="Hand"
Style="{StaticResource NewButtonStyle}"
Style="{StaticResource IcoButtonStyle}"
Command="{Binding NewRecipe}">
</pry:IcoButton>
<pry:IcoButton
@@ -68,7 +68,7 @@
Foreground="Aqua"
IcoText="&#xe626;"
Cursor="Hand"
Style="{StaticResource NewButtonStyle}"
Style="{StaticResource IcoButtonStyle}"
Command="{Binding SaveRecipe}">
</pry:IcoButton>



Loading…
Cancel
Save