@@ -189,15 +189,21 @@ namespace FryPot_DosingSystem.Control
globalVar.agvArriveLineFour = true;
globalVar.agvArriveLineFour = true;
}), "AgvArriveLineFourLoc");
}), "AgvArriveLineFourLoc");
ActionManage.GetInstance.Register(new Action(() =>
{
EmptyRollerCleanTaskRestart();
}), "EmptyRollerCleanTaskRestart");
#endregion
#endregion
//接口调试
//接口调试
ActionManage.GetInstance.Register(new Action(() =>
ActionManage.GetInstance.Register(new Action(() =>
{
{
string id = Guid.NewGuid().ToString();
string id = Guid.NewGuid().ToString();
string errorCode=AGVHelper._Instance.AgvToLineOneLoadRoller(id);
string errorCode = AGVHelper._Instance.AgvToLineOneLoadRoller(id);
if (errorCode == "SUCCESS")
if (errorCode == "SUCCESS")
{
{
MessageLog.GetInstance.ShowRunLog($"AGV任务下发成功");
MessageLog.GetInstance.ShowRunLog($"AGV任务下发成功");
}
}
else if (errorCode == "Analysis Error")
else if (errorCode == "Analysis Error")
@@ -209,6 +215,31 @@ namespace FryPot_DosingSystem.Control
MessageLog.GetInstance.ShowRunLog($"提示:AGV任务下发失败,错误码:{errorCode}");
MessageLog.GetInstance.ShowRunLog($"提示:AGV任务下发失败,错误码:{errorCode}");
}
}
}), "AgvDebug");
}), "AgvDebug");
ActionManage.GetInstance.Register(new Action(() =>
{
globalVar.agvArriveLineOneLoadCom = true;
}), "AgvLineOneLoadEmptyCom");
ActionManage.GetInstance.Register(new Action(() =>
{
globalVar.agvArriveLineTwoLoadCom = true;
}), "AgvLineTwoLoadEmptyCom");
ActionManage.GetInstance.Register(new Action(() =>
{
globalVar.agvArriveLineThreeLoadCom = true;
}), "AgvLineThreeLoadEmptyCom");
ActionManage.GetInstance.Register(new Action(() =>
{
globalVar.rollerLineOne.CanRun = true;
}), "AGVLineOneLoadCom");
ActionManage.GetInstance.Register(new Action(() =>
{
globalVar.rollerLineTwo.CanRun = true;
}), "AGVLineTwoLoadCom");
ActionManage.GetInstance.Register(new Action(() =>
{
globalVar.rollerLineThree.CanRun = true;
}), "AGVLineThreeLoadCom");
ActionManage.GetInstance.Register(new Action(() =>
ActionManage.GetInstance.Register(new Action(() =>
{
{
@@ -812,6 +843,7 @@ namespace FryPot_DosingSystem.Control
//线体1任务上报
//线体1任务上报
if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LSevenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体1空桶上料
if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LSevenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体1空桶上料
{
{
globalVar.agvArriveLineOneLoadCom = true;
AgvViewModel.GetInstance().Set滚筒线上数量(1, (globalVar.LOneMaterialNum - 1).ToString());
AgvViewModel.GetInstance().Set滚筒线上数量(1, (globalVar.LOneMaterialNum - 1).ToString());
AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
//到清洗处
//到清洗处
@@ -819,6 +851,7 @@ namespace FryPot_DosingSystem.Control
//线体2任务上报
//线体2任务上报
if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LEightrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体2空桶上料
if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LEightrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体2空桶上料
{
{
globalVar.agvArriveLineTwoLoadCom = true;
AgvViewModel.GetInstance().Set滚筒线上数量(2, (globalVar.LTwoMaterialNum - 1).ToString());
AgvViewModel.GetInstance().Set滚筒线上数量(2, (globalVar.LTwoMaterialNum - 1).ToString());
AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
@@ -828,6 +861,7 @@ namespace FryPot_DosingSystem.Control
//线体3任务上报
//线体3任务上报
if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体3空桶上料
if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体3空桶上料
{
{
globalVar.agvArriveLineThreeLoadCom = true;
AgvViewModel.GetInstance().Set滚筒线上数量(3, (globalVar.LThreeMaterialNum - 1).ToString());
AgvViewModel.GetInstance().Set滚筒线上数量(3, (globalVar.LThreeMaterialNum - 1).ToString());
AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes);
//到清洗处
//到清洗处
@@ -918,7 +952,7 @@ namespace FryPot_DosingSystem.Control
AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3);
AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3);
}
}
//线体1任务上报
//线体1任务上报
if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料
if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料
{
{
@@ -1053,9 +1087,9 @@ namespace FryPot_DosingSystem.Control
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");
//ActionManage.GetInstance.CancelRegister("RecipeSetDown");
//ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
// ActionManage.GetInstance.Send("ClearRecipes");
ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
{
{
ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
@@ -1105,7 +1139,8 @@ namespace FryPot_DosingSystem.Control
globalVar.agvArriveUpLoad = false;
globalVar.agvArriveUpLoad = false;
globalVar.agvArriveUnLoad = false;
globalVar.agvArriveUnLoad = false;
globalVar.agvFryPotEmptyRollerArrive = false;
globalVar.agvFryPotEmptyRollerArrive = false;
globalVar.EmptyRollerUnLoadcCom = false;
globalVar.agvLineOneLoadCom = false;
ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
MessageLog.GetInstance.ShowUserLog("滚筒线【1】任务重启成功");
MessageLog.GetInstance.ShowUserLog("滚筒线【1】任务重启成功");
}));
}));
@@ -1136,7 +1171,8 @@ namespace FryPot_DosingSystem.Control
globalVar.agvArriveLTwoUpLoad = false;
globalVar.agvArriveLTwoUpLoad = false;
globalVar.LTwoagvArriveUnLoad = false;
globalVar.LTwoagvArriveUnLoad = false;
globalVar.LTwoagvFryPotEmptyRollerArrive = false;
globalVar.LTwoagvFryPotEmptyRollerArrive = false;
globalVar.LTwoEmptyRollerUnLoadcCom = false;
globalVar.agvLineTwoLoadCom = false;
ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
MessageLog.GetInstance.ShowUserLog("滚筒线【2】任务重启成功");
MessageLog.GetInstance.ShowUserLog("滚筒线【2】任务重启成功");
}));
}));
@@ -1165,11 +1201,41 @@ namespace FryPot_DosingSystem.Control
globalVar.agvArriveLThreeUpLoad = false;
globalVar.agvArriveLThreeUpLoad = false;
globalVar.LThreeagvArriveUnLoad = false;
globalVar.LThreeagvArriveUnLoad = false;
globalVar.LThreeagvFryPotEmptyRollerArrive = false;
globalVar.LThreeagvFryPotEmptyRollerArrive = false;
globalVar.LThreeEmptyRollerUn Loadc Com = false;
globalVar.agv Line ThreeLoadCom = false;
ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
MessageLog.GetInstance.ShowUserLog("滚筒线【3】任务重启成功");
MessageLog.GetInstance.ShowUserLog("滚筒线【3】任务重启成功");
}));
}));
}
}
public void EmptyRollerCleanTaskRestart()
{
ThreadManage.GetInstance().StopTask("空桶清洗任务线程", new Action(() =>
{
globalVar.rollerLineOne.EmptyRollerNums.Clear();
globalVar.rollerLineOne.IsEpmtyBefore = false;
// globalVar.rollerLineOne.CanRun = true;
globalVar.rollerLineTwo.EmptyRollerNums.Clear();
globalVar.rollerLineTwo.IsEpmtyBefore = false;
//globalVar.rollerLineTwo.CanRun = true;
globalVar.rollerLineThree.EmptyRollerNums.Clear();
globalVar.rollerLineThree.IsEpmtyBefore = false;
//globalVar.rollerLineThree.CanRun = true;
globalVar.agvArriveLineFour = false;
globalVar.agvArriveCleanLoad = false;
globalVar.agvArriveCleanUnLoad = false;
globalVar.agvArriveLineOneLoadEmptyRoller = false;
globalVar.agvArriveLineTwoLoadEmptyRoller = false;
globalVar.agvArriveLineThreeLoadEmptyRoller = false;
globalVar.agvArriveLineOneLoadCom = false;
globalVar.agvArriveLineTwoLoadCom = false;
globalVar.agvArriveLineThreeLoadCom = false;
ThreadManage.GetInstance().StartLong(new Action(() => { LineFourProcessExecute(); Thread.Sleep(10); }), "空桶清洗任务线程");
MessageLog.GetInstance.ShowUserLog("空桶清洗任务重启成功");
}));
}
/// <summary>
/// <summary>
/// 实时获取plc数据
/// 实时获取plc数据
/// </summary>
/// </summary>
@@ -1215,9 +1281,9 @@ namespace FryPot_DosingSystem.Control
globalVar.rollerLineOne.OutMaterialingSingle = data[3];
globalVar.rollerLineOne.OutMaterialingSingle = data[3];
globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
globalVar.rollerLineThree.OutMaterialingSingle = data[5];
globalVar.rollerLineThree.OutMaterialingSingle = data[5];
//globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6];
//globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7];
//globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8];
//globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6];
//globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7];
//globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8];
AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble = data[6];
AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble = data[6];
AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble = data[7];
AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble = data[7];
AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble = data[8];
AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble = data[8];
@@ -1257,11 +1323,11 @@ namespace FryPot_DosingSystem.Control
}));
}));
GetAddressData("D2070", new Action<ushort[]>((data) =>
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];
//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.FryPotOneRollerTrouble = data[0];
AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble = data[1];
AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble = data[1];
AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble = data[2];
AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble = data[2];
@@ -1284,32 +1350,32 @@ namespace FryPot_DosingSystem.Control
globalVar.CleadBarrelExitSingle = data[0];
globalVar.CleadBarrelExitSingle = data[0];
}));
}));
//炒锅1状态数据
//炒锅1状态数据
GetFryOneData("D2001", new Action<ushort[]>(data =>
GetFryOneData("D2001", new Action<ushort[]>(data =>
{
{
}));
}));
//炒锅2状态数据
//炒锅2状态数据
GetFryTwoData("D2001", new Action<ushort[]>(data =>
GetFryTwoData("D2001", new Action<ushort[]>(data =>
{
{
}));
}));
//炒锅3状态数据
//炒锅3状态数据
GetFryThreeData("D2001", new Action<ushort[]>(data =>
GetFryThreeData("D2001", new Action<ushort[]>(data =>
{
{
}));
}));
//炒锅4状态数据
//炒锅4状态数据
GetFryFourData("D2001", new Action<ushort[]>(data =>
GetFryFourData("D2001", new Action<ushort[]>(data =>
{
{
}));
}));
//炒锅5状态数据
//炒锅5状态数据
GetFryFiveData("D2001", new Action<ushort[]>(data =>
GetFryFiveData("D2001", new Action<ushort[]>(data =>
{
{
}));
}));
//线体上放空桶
//线体上放空桶
if (globalVar.rollerLineOne.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineOne.EmptyRollerNum != 0)
if (globalVar.rollerLineOne.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineOne.EmptyRollerNum != 0)
{
{
globalVar.rollerLineOne.EmptyRollerNums.Add(globalVar.rollerLineOne.EmptyRollerNum);
globalVar.rollerLineOne.EmptyRollerNums.Add(globalVar.rollerLineOne.EmptyRollerNum);
@@ -1322,7 +1388,7 @@ namespace FryPot_DosingSystem.Control
{
{
globalVar.rollerLineThree.EmptyRollerNums.Add(globalVar.rollerLineThree.EmptyRollerNum);
globalVar.rollerLineThree.EmptyRollerNums.Add(globalVar.rollerLineThree.EmptyRollerNum);
}
}
//炒锅状态数据
//炒锅状态数据
if (globalVar.fryPotOne.OilConfirm == 1)
if (globalVar.fryPotOne.OilConfirm == 1)
{
{
FryPotMonitorManage.GetInstance.fryOne.OilCapacity = globalVar.fryPotOne.OilCapacity;
FryPotMonitorManage.GetInstance.fryOne.OilCapacity = globalVar.fryPotOne.OilCapacity;
@@ -1348,7 +1414,7 @@ namespace FryPot_DosingSystem.Control
FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity;
FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity;
FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity;
FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity;
}
}
//炒锅状态实时显示
//炒锅状态实时显示
FryPotStatusDisplay();
FryPotStatusDisplay();
RollerLineStatusDisplay();
RollerLineStatusDisplay();
Thread.Sleep(10);
Thread.Sleep(10);
@@ -1807,7 +1873,7 @@ namespace FryPot_DosingSystem.Control
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(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
ThreadManage.GetInstance().StartLong(new Action(() => { LineFourProcessExecute(); Thread.Sleep(10); }), "清洗台 任务线程");
ThreadManage.GetInstance().StartLong(new Action(() => { LineFourProcessExecute(); Thread.Sleep(10); }), "空桶 清洗任务线程");
}
}
@@ -1869,11 +1935,13 @@ namespace FryPot_DosingSystem.Control
}
}
private void LineFourProcessExecute()
private void LineFourProcessExecute()
{
{
//
AgvFromLineToCleanPlate();
AgvFromLineToCleanPlate();
AgvArriveCleanPlate();
CallAgvToLineFour();
CleanPlateUpLoad();
CleanPlateUpLoad();
EmptyRollerToLinFour();
EmptyRollerToLinFour();
CallAgvToLineFour();
AgvArriveCleanPlate();
}
}
private void CleanPlateUpLoad()
private void CleanPlateUpLoad()
@@ -1893,11 +1961,12 @@ namespace FryPot_DosingSystem.Control
if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//输送线无故障
if (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 0)//输送线无故障
{
{
//线体1到清洗台
//线体1到清洗台
if (!globalVar.rollerLineOne.IsEpmtyBefore)
if (!globalVar.rollerLineOne.IsEpmtyBefore && globalVar.rollerLineOne.CanRun )
{
{
var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight);
if (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Count > 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶
if ((globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Count > 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0) && InputMaterialQuene.Count > 0 && globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || ( res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Count > 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0) ))//工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶
{
{
//下发AGV去空桶线洗桶任务
//下发AGV去空桶线洗桶任务
e: string id = Guid.NewGuid().ToString("N");
e: string id = Guid.NewGuid().ToString("N");
if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
@@ -1908,6 +1977,7 @@ namespace FryPot_DosingSystem.Control
Thread.Sleep(500);
Thread.Sleep(500);
LineToCleanCarryTaskErrorCodeAnalysis(info, 1);
LineToCleanCarryTaskErrorCodeAnalysis(info, 1);
globalVar.rollerLineOne.IsEpmtyBefore = true;
globalVar.rollerLineOne.IsEpmtyBefore = true;
//globalVar.rollerLineOne.CanRun = false;
AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处
}
}
}
}
@@ -1919,10 +1989,10 @@ namespace FryPot_DosingSystem.Control
// 线体2到清洗台
// 线体2到清洗台
if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//输送线无故障
if (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 0)//输送线无故障
{
{
if (!globalVar.rollerLineTwo.IsEpmtyBefore)
if (!globalVar.rollerLineTwo.IsEpmtyBefore && globalVar.rollerLineTwo.CanRun )
{
{
var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight);
if (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶
if ((globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0) && LTwoInputMaterialQuene.Count > 0 && globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || ( res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0) ))//工位8上面有桶且不是配方上的原料桶,即空桶
{
{
//下发AGV去空桶线洗桶任务
//下发AGV去空桶线洗桶任务
e: string id = Guid.NewGuid().ToString("N");
e: string id = Guid.NewGuid().ToString("N");
@@ -1934,6 +2004,7 @@ namespace FryPot_DosingSystem.Control
Thread.Sleep(500);
Thread.Sleep(500);
LineToCleanCarryTaskErrorCodeAnalysis(info, 2);
LineToCleanCarryTaskErrorCodeAnalysis(info, 2);
globalVar.rollerLineTwo.IsEpmtyBefore = true;
globalVar.rollerLineTwo.IsEpmtyBefore = true;
// globalVar.rollerLineTwo.CanRun = false;
AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处
}
}
}
}
@@ -1945,10 +2016,10 @@ namespace FryPot_DosingSystem.Control
//线体3到清洗台
//线体3到清洗台
if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
if (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 0)//输送线无故障
{
{
if (!globalVar.rollerLineThree.IsEpmtyBefore)
if (!globalVar.rollerLineThree.IsEpmtyBefore && globalVar.rollerLineThree.CanRun )
{
{
var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight);
if (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Count > 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶
if ((globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Count > 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0) && LThreeInputMaterialQuene.Count > 0 && globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || ( res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Count > 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0) ))//工位8上面有桶且不是配方上的原料桶,即空桶
{
{
//下发AGV去空桶线洗桶任务
//下发AGV去空桶线洗桶任务
e: string id = Guid.NewGuid().ToString("N");
e: string id = Guid.NewGuid().ToString("N");
@@ -1960,6 +2031,7 @@ namespace FryPot_DosingSystem.Control
Thread.Sleep(500);
Thread.Sleep(500);
LineToCleanCarryTaskErrorCodeAnalysis(info, 3);
LineToCleanCarryTaskErrorCodeAnalysis(info, 3);
globalVar.rollerLineThree.IsEpmtyBefore = true;
globalVar.rollerLineThree.IsEpmtyBefore = true;
//globalVar.rollerLineThree.CanRun = false;
AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处
}
}
}
}
@@ -1993,7 +2065,7 @@ namespace FryPot_DosingSystem.Control
{
{
//是否需要手动给PLC置位??
//是否需要手动给PLC置位??
globalVar.CleanComplete = 0;
globalVar.CleanComplete = 0;
e: string id = Guid.NewGuid().ToString("N");
e: string id = Guid.NewGuid().ToString("N");
if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
goto e;
goto e;
@@ -2063,6 +2135,7 @@ namespace FryPot_DosingSystem.Control
}
}
else
else
{
{
MessageLog.GetInstance.ShowRunLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
LThreeInputMaterialQuene.Clear();
LThreeInputMaterialQuene.Clear();
LThreeErrorRecipe = true;
LThreeErrorRecipe = true;
@@ -2164,6 +2237,7 @@ namespace FryPot_DosingSystem.Control
}
}
else
else
{
{
MessageLog.GetInstance.ShowRunLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
LTwoInputMaterialQuene.Clear();
LTwoInputMaterialQuene.Clear();
LTwoErrorRecipe = true;
LTwoErrorRecipe = true;
@@ -2262,6 +2336,7 @@ namespace FryPot_DosingSystem.Control
}
}
else
else
{
{
MessageLog.GetInstance.ShowRunLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作");
InputMaterialQuene.Clear();
InputMaterialQuene.Clear();
ErrorRecipe = true;
ErrorRecipe = true;
@@ -2363,8 +2438,23 @@ namespace FryPot_DosingSystem.Control
{
{
AgvToLineOneLoadRoller();
AgvToLineOneLoadRoller();
AgvFromLineOneToFryPot();//AGV到1号线体装桶
AgvFromLineOneToFryPot();//AGV到1号线体装桶
AgvLineOneLoadRollerCom();
}
}
/// <summary>
/// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
/// </summary>
/// <exception cref="NotImplementedException"></exception>
private void AgvLineOneLoadRollerCom()
{
if (globalVar.agvLineOneLoadCom)
{
globalVar.rollerLineOne.CanRun = true;
globalVar.agvLineOneLoadCom = false;
MessageLog.GetInstance.ShowRunLog("AGV在【1】号滚筒线装桶完成");
}
}
}
}
/// <summary>
/// <summary>
/// AGV到配方线体2装桶以及出料到炒锅
/// AGV到配方线体2装桶以及出料到炒锅
/// </summary>
/// </summary>
@@ -2372,13 +2462,25 @@ namespace FryPot_DosingSystem.Control
{
{
if (LTwoInputMaterialQuene.Count > 0)
if (LTwoInputMaterialQuene.Count > 0)
{
{
AgvToLineTwoLoadRoller();
AgvToLineTwoLoadRoller();
AgvFromLineTwoToFryPot();//AGV到2号线体装桶
AgvFromLineTwoToFryPot();//AGV到2号线体装桶
AgvLineTwoLoadRollerCom();
}
}
}
}
/// <summary>
/// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
/// </summary>
private void AgvLineTwoLoadRollerCom()
{
if (globalVar.agvLineTwoLoadCom)
{
globalVar.rollerLineTwo.CanRun = true;
globalVar.agvLineTwoLoadCom = false;
MessageLog.GetInstance.ShowRunLog("AGV在【2】号滚筒线装桶完成");
}
}
/// <summary>
/// <summary>
/// AGV到配方线体3装桶以及出料到炒锅
/// AGV到配方线体3装桶以及出料到炒锅
/// </summary>
/// </summary>
@@ -2389,8 +2491,19 @@ namespace FryPot_DosingSystem.Control
AgvToLineThreeLoadRoller();
AgvToLineThreeLoadRoller();
AgvFromLineThreeToFryPot();//AGV到2号线体装桶
AgvFromLineThreeToFryPot();//AGV到2号线体装桶
AgvLineThreeLoadRollerCom();
}
}
/// <summary>
/// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件
/// </summary>
private void AgvLineThreeLoadRollerCom()
{
if (globalVar.agvLineThreeLoadCom)
{
globalVar.rollerLineThree.CanRun = true;
globalVar.agvLineThreeLoadCom = false;
MessageLog.GetInstance.ShowRunLog("AGV在【3】号滚筒线装桶完成");
}
}
}
}
/// <summary>
/// <summary>
@@ -2772,7 +2885,7 @@ namespace FryPot_DosingSystem.Control
{
{
globalVar.agvArriveLineFour = false;
globalVar.agvArriveLineFour = false;
//线体四信号交互
//线体四信号交互
MessageLog.GetInstance.ShowRunLog("空桶到达空桶 回收线体,准备卸桶");
MessageLog.GetInstance.ShowRunLog("AGV到达【4】号 回收线体,准备卸桶");
MessageLog.GetInstance.ShowRunLog("卸桶完成");
MessageLog.GetInstance.ShowRunLog("卸桶完成");
}
}
}
}
@@ -3265,14 +3378,19 @@ namespace FryPot_DosingSystem.Control
{
{
MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置");
DeviceOperate.GetInstance.WritePlcData("D1052", 1);//agv到达线体1上料位置信号下发plc
DeviceOperate.GetInstance.WritePlcData("D1052", 1);//agv到达线体1上料位置信号下发plc
MessageLog.GetInstance.ShowRunLog($"AGV正在装载{emptyRollerNum}号空料桶");
MessageLog.GetInstance.ShowRunLog($"AGV正在装载【 {emptyRollerNum}】 号空料桶");
AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start);
AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start);
globalVar.LOneMaterialNum--;
globalVar.LOneMaterialNum--;
globalVar.agvArriveLineOneLoadEmptyRoller = false;
globalVar.agvArriveLineOneLoadEmptyRoller = false;
globalVar.rollerLineOne.IsEpmtyBefore = false;
globalVar.rollerLineOne.EmptyRollerNums.RemoveAt(0);
//原料到位,agv到位,agv自行运料到清洗处
//原料到位,agv到位,agv自行运料到清洗处
}
}
if (globalVar.agvArriveLineOneLoadCom)//上料完成
{
globalVar.rollerLineOne.EmptyRollerNums.RemoveAt(0);
globalVar.agvArriveLineOneLoadCom = false;
globalVar.rollerLineOne.IsEpmtyBefore = false;
MessageLog.GetInstance.ShowRunLog($"AGV在【1】号线体完成{emptyRollerNum}号空料桶装载");
}
}
}
else//有故障
else//有故障
{
{
@@ -3339,14 +3457,20 @@ namespace FryPot_DosingSystem.Control
{
{
MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置");
DeviceOperate.GetInstance.WritePlcData("D1053", 1);//agv到达线体2上料位置信号下发plc
DeviceOperate.GetInstance.WritePlcData("D1053", 1);//agv到达线体2上料位置信号下发plc
MessageLog.GetInstance.ShowRunLog($"AGV正在装载{emptyRollerNum}号空料桶");
MessageLog.GetInstance.ShowRunLog($"AGV正在装载【 {emptyRollerNum}】 号空料桶");
AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start);
AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start);
globalVar.LTwoMaterialNum--;
globalVar.LTwoMaterialNum--;
globalVar.agvArriveLineTwoLoadEmptyRoller = false;
globalVar.agvArriveLineTwoLoadEmptyRoller = false;
globalVar.rollerLineTwo.IsEpmtyBefore = false;
globalVar.rollerLineTwo.EmptyRollerNums.RemoveAt(0);
//原料到位,agv到位,agv自行运料到清洗处
//原料到位,agv到位,agv自行运料到清洗处
}
}
if (globalVar.agvArriveLineTwoLoadCom)//上料完成
{
globalVar.rollerLineTwo.EmptyRollerNums.RemoveAt(0);
globalVar.agvArriveLineTwoLoadCom = false;
globalVar.rollerLineTwo.IsEpmtyBefore = false;
MessageLog.GetInstance.ShowRunLog($"AGV在【2】号线体完成【{emptyRollerNum}】号空料桶装载");
}
}
}
else//有故障
else//有故障
{
{
@@ -3413,14 +3537,21 @@ namespace FryPot_DosingSystem.Control
{
{
MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置");
DeviceOperate.GetInstance.WritePlcData("D1054", 1);//agv到达线体3上料位置信号下发plc
DeviceOperate.GetInstance.WritePlcData("D1054", 1);//agv到达线体3上料位置信号下发plc
MessageLog.GetInstance.ShowRunLog($"AGV正在装载{emptyRollerNum}号空料桶");
MessageLog.GetInstance.ShowRunLog($"AGV正在装载【 {emptyRollerNum}】 号空料桶");
AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start);
AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start);
globalVar.LThreeMaterialNum--;
globalVar.LThreeMaterialNum--;
globalVar.agvArriveLineThreeLoadEmptyRoller = false;
globalVar.agvArriveLineThreeLoadEmptyRoller = false;
globalVar.rollerLineThree.IsEpmtyBefore = false;
globalVar.rollerLineThree.EmptyRollerNums.RemoveAt(0);
// globalVar.rollerLineThree.IsEpmtyBefore = false;
//原料到位,agv到位,agv自行运料到清洗处
//原料到位,agv到位,agv自行运料到清洗处
}
}
if (globalVar.agvArriveLineThreeLoadCom)//上料完成
{
globalVar.rollerLineThree.EmptyRollerNums.RemoveAt(0);
globalVar.agvArriveLineThreeLoadCom = false;
globalVar.rollerLineThree.IsEpmtyBefore = false;
MessageLog.GetInstance.ShowRunLog($"AGV在【3】号线体完成【{emptyRollerNum}】号空料桶装载");
}
}
}
else//有故障
else//有故障
{
{
@@ -3535,6 +3666,7 @@ namespace FryPot_DosingSystem.Control
{
{
if (globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineOne.IsEpmtyBefore)//工位8上面是配方料桶
if (globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineOne.IsEpmtyBefore)//工位8上面是配方料桶
{
{
globalVar.rollerLineOne.CanRun = false;
e: string id = Guid.NewGuid().ToString("N");
e: string id = Guid.NewGuid().ToString("N");
if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
goto e;
goto e;
@@ -3545,6 +3677,10 @@ namespace FryPot_DosingSystem.Control
LineCarryTaskErrorCodeAnalysis(info, 1);
LineCarryTaskErrorCodeAnalysis(info, 1);
globalVar.LoadRoller = true;
globalVar.LoadRoller = true;
}
}
//else if (globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
//{
// globalVar.rollerLineOne.CanRun = true;
//}
//else // 工位8上面不是配方料桶或没有桶时
//else // 工位8上面不是配方料桶或没有桶时
//{
//{
// if (!globalVar.rollerLineOne.IsEpmtyBefore)
// if (!globalVar.rollerLineOne.IsEpmtyBefore)
@@ -3588,6 +3724,7 @@ namespace FryPot_DosingSystem.Control
{
{
if (globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineTwo.IsEpmtyBefore)//工位8上面是配方料桶
if (globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineTwo.IsEpmtyBefore)//工位8上面是配方料桶
{
{
globalVar.rollerLineTwo.CanRun = false;
e: string id = Guid.NewGuid().ToString("N");
e: string id = Guid.NewGuid().ToString("N");
if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
goto e;
goto e;
@@ -3598,6 +3735,10 @@ namespace FryPot_DosingSystem.Control
LineCarryTaskErrorCodeAnalysis(info, 2);
LineCarryTaskErrorCodeAnalysis(info, 2);
globalVar.LTwoLoadRoller = true;
globalVar.LTwoLoadRoller = true;
}
}
//else if (globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
//{
// globalVar.rollerLineTwo.CanRun = true;
//}
}
}
//else// 工位8上面不是配方料桶或没有桶时
//else// 工位8上面不是配方料桶或没有桶时
//{
//{
@@ -3634,6 +3775,7 @@ namespace FryPot_DosingSystem.Control
{
{
if (globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineThree.IsEpmtyBefore)//工位8上面是配方料桶
if (globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineThree.IsEpmtyBefore)//工位8上面是配方料桶
{
{
globalVar.rollerLineThree.CanRun = false;
e: string id = Guid.NewGuid().ToString("N");
e: string id = Guid.NewGuid().ToString("N");
if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId)
goto e;
goto e;
@@ -3644,6 +3786,10 @@ namespace FryPot_DosingSystem.Control
LineCarryTaskErrorCodeAnalysis(info, 3);
LineCarryTaskErrorCodeAnalysis(info, 3);
globalVar.LThreeLoadRoller = true;
globalVar.LThreeLoadRoller = true;
}
}
//else if (globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc)
//{
// globalVar.rollerLineThree.CanRun = true;
//}
//else // 工位8上面不是配方料桶或没有桶时
//else // 工位8上面不是配方料桶或没有桶时
//{
//{
// if (!globalVar.rollerLineThree.IsEpmtyBefore)
// if (!globalVar.rollerLineThree.IsEpmtyBefore)