diff --git a/BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml b/BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml index 9abfd756..5247d35a 100644 --- a/BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml @@ -373,8 +373,9 @@ - - + + + diff --git a/FryPot_DosingSystem/App.xaml.cs b/FryPot_DosingSystem/App.xaml.cs index 334104e0..123863ae 100644 --- a/FryPot_DosingSystem/App.xaml.cs +++ b/FryPot_DosingSystem/App.xaml.cs @@ -25,6 +25,7 @@ namespace FryPot_DosingSystem /// public partial class App : Application { + public static Window MainWindow; protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); @@ -44,7 +45,7 @@ namespace FryPot_DosingSystem } else mv.Close(); - + MainWindow = mv; //HubHelper.GetInstance.Report = new Action((o) => //{ @@ -57,7 +58,7 @@ namespace FryPot_DosingSystem //}); //本地服务连接 - + } @@ -86,7 +87,7 @@ namespace FryPot_DosingSystem SubMenuName = "配方下发", SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, AssemblyName = "FryPot_DosingSystem", - ToggleWindowPath = "View.RecipeSendDownView" + ToggleWindowPath = "View.RecipesSendDown" }); MenuManage.GetInstance.menuModels.Add(new MenuModel() diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index 46961704..f7defdac 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -141,10 +141,13 @@ namespace FryPot_DosingSystem.Control string LFourrobotJobId = string.Empty;//线体4当前上游系统任务号,全局唯一 从炒锅1、4到线体4路径 string LFiverobotJobId = string.Empty; //从炒锅2、5到线体4路径 string LSixrobotJobId = string.Empty; //从炒锅3到线体4路径 - string LSevenrobotJobId = string.Empty; //从线体1到清洗台路径 - string LEightrobotJobId = string.Empty; //从线体2到清洗台路径 - string LNinerobotJobId = string.Empty; //从线体3到清洗台路径 - string LTenrobotJobId = string.Empty; //从清洗台到线体4路径 + List LSevenrobotJobId =new List(); //从线体1到清洗台路径 + List LEightrobotJobId = new List();//从线体2到清洗台路径 + List LNinerobotJobId = new List(); //从线体3到清洗台路径 + List LTenrobotJobId = new List(); //从清洗台到线体4路径 + + Dictionary agvCode = new Dictionary() { { "1",1 }, { "2",2 }, { "3",3 }, { "4",4 } };//agv小车的编号对AGV动画小车编号 + public int CleanNum = 0;//当前清洗台桶数 @@ -178,7 +181,9 @@ namespace FryPot_DosingSystem.Control }), "CleanPlateCallAgv"); ActionManage.GetInstance.Register(new Action(() => { - globalVar.agvArriveCleanUnLoad = true;//清洗台空桶下料就位 + globalVar.rollerLineOne.agvArriveCleanUnLoad = true;//清洗台空桶下料就位 + globalVar.rollerLineTwo.agvArriveCleanUnLoad = true; + globalVar.rollerLineThree.agvArriveCleanUnLoad = true; }), "AgvArriveCleanPlateLoc"); ActionManage.GetInstance.Register(new Action(() => @@ -189,7 +194,9 @@ namespace FryPot_DosingSystem.Control ActionManage.GetInstance.Register(new Action(() => { globalVar.agvArriveLineFour = true; - + globalVar.rollerLineOne.agvArriveLineFour = true; + globalVar.rollerLineTwo.agvArriveLineFour = true; + globalVar.rollerLineThree.agvArriveLineFour = true; }), "AgvArriveLineFourLoc"); ActionManage.GetInstance.Register(new Action(() => @@ -226,7 +233,10 @@ namespace FryPot_DosingSystem.Control ActionManage.GetInstance.Register(() => { - MessageLog.GetInstance.ShowRunLog("4号线卸桶完成"); + MessageLog.GetInstance.ShowRunLog("清洗台空桶在【4】号线卸桶完成"); + MessageLog.GetInstance.ShowRunLog("【1】号线炒锅空桶在【4】号线卸桶完成"); + MessageLog.GetInstance.ShowRunLog("【2】号线炒锅空桶在【4】号线卸桶完成"); + MessageLog.GetInstance.ShowRunLog("【3】号线炒锅空桶在【4】号线卸桶完成"); }, "AgvArriveLineFourLocCom"); ActionManage.GetInstance.Register(() => @@ -235,10 +245,10 @@ namespace FryPot_DosingSystem.Control }, "AgvArriveCleanPlateLocLoadCom"); - ActionManage.GetInstance.Register(() => + ActionManage.GetInstance.Register(() => { globalVar.rollerLineOne.RecipeCompleteSingle = 1; - + }, "LineOneRecipeComSignal"); ActionManage.GetInstance.Register(() => { @@ -428,7 +438,7 @@ namespace FryPot_DosingSystem.Control DateTime timeNow = DateTime.Now; if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days) { - Directory.Delete(item); + Directory.Delete(item, true); } } } @@ -442,7 +452,7 @@ namespace FryPot_DosingSystem.Control DateTime timeNow = DateTime.Now; if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days) { - Directory.Delete(item); + Directory.Delete(item, true); } } } @@ -456,7 +466,7 @@ namespace FryPot_DosingSystem.Control DateTime timeNow = DateTime.Now; if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days) { - Directory.Delete(item); + Directory.Delete(item, true); } } } @@ -470,7 +480,7 @@ namespace FryPot_DosingSystem.Control DateTime timeNow = DateTime.Now; if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days) { - Directory.Delete(item); + Directory.Delete(item, true); } } } @@ -484,7 +494,7 @@ namespace FryPot_DosingSystem.Control DateTime timeNow = DateTime.Now; if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > days) { - Directory.Delete(item); + Directory.Delete(item, true); } } } @@ -674,7 +684,7 @@ namespace FryPot_DosingSystem.Control Upstreamrequest objData = JsonConvert.DeserializeObject(obj.ToString()); if (objData != null) { - #region 线体到炒锅 + #region 线体到炒锅请求上下料 //线体1请求上下料 if (objData.robotJobId == LOnerobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料 { @@ -713,12 +723,13 @@ namespace FryPot_DosingSystem.Control if (objData.robotJobId == LFourrobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料 { globalVar.agvArriveUpLoad = true;//AGV到达上料位置 - + } if (objData.robotJobId == LFourrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段 { - globalVar.agvArriveLineFour = true;//AGV到达下料位置 - + globalVar.rollerLineOne.agvArriveLineFour = true;//AGV到达下料位置 + // AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start); + } if (objData.robotJobId == LFiverobotJobId && objData.command == "LOAD") @@ -728,8 +739,9 @@ namespace FryPot_DosingSystem.Control } if (objData.robotJobId == LFiverobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段 { - globalVar.agvArriveLineFour = true;//AGV到达下料位置 - + globalVar.rollerLineTwo.agvArriveLineFour = true;//AGV到达下料位置 + + } if (objData.robotJobId == LSixrobotJobId && objData.command == "LOAD") @@ -739,51 +751,62 @@ namespace FryPot_DosingSystem.Control } if (objData.robotJobId == LSixrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段 { - globalVar.agvArriveLineFour = true;//AGV到达下料位置 + globalVar.rollerLineThree.agvArriveLineFour = true;//AGV到达下料位置 + + } #endregion - #region 线体到清洗台 - if (objData.robotJobId == LSevenrobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料 + #region 线体123到清洗台请求上下料 + if (LSevenrobotJobId.FirstOrDefault(p=>p==objData.robotJobId)!=null && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料 { globalVar.agvArriveLineOneLoadEmptyRoller = true;//AGV到达上料位置 } - if (objData.robotJobId == LSevenrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段 + if (LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "UNLOAD")//同一任务号且处于下料阶段 { - globalVar.agvArriveCleanUnLoad = true;//AGV到达下料位置 - + + globalVar.rollerLineOne.agvArriveCleanUnLoad = true;//AGV到达下料位置 + } - if (objData.robotJobId == LEightrobotJobId && objData.command == "LOAD") + if ( LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "LOAD") { globalVar.agvArriveLineTwoLoadEmptyRoller = true;//AGV到达上料位置 } - if (objData.robotJobId == LEightrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段 + if ( LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "UNLOAD")//同一任务号且处于下料阶段 { - globalVar.agvArriveCleanUnLoad = true;//AGV到达下料位置 + + globalVar.rollerLineTwo.agvArriveCleanUnLoad = true;//AGV到达下料位置 + } - if (objData.robotJobId == LSixrobotJobId && objData.command == "LOAD") + if (LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "LOAD") { globalVar.agvArriveLineThreeLoadEmptyRoller = true;//AGV到达上料位置 } - if (objData.robotJobId == LSixrobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段 + if (LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "UNLOAD")//同一任务号且处于下料阶段 { - globalVar.agvArriveCleanUnLoad = true;//AGV到达下料位置 + + globalVar.rollerLineThree.agvArriveCleanUnLoad = true;//AGV到达下料位置 + } #endregion - - if (objData.robotJobId == LTenrobotJobId && objData.command == "LOAD") + #region 清洗台到线体4请求上下料 + if (LTenrobotJobId.FirstOrDefault(p=>p==objData.robotJobId)!=null && objData.command == "LOAD") { globalVar.agvArriveCleanLoad = true;//agv到达清洗台上料位置 } - if (objData.robotJobId == LTenrobotJobId && objData.command == "UNLOAD") + if (LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.command == "UNLOAD") { + globalVar.agvArriveLineFour = true;//agv到达线体4下料位置 + + } + #endregion } } @@ -816,138 +839,108 @@ namespace FryPot_DosingSystem.Control { //日志 } - //---------------------空桶从线体去清洗-------------------------------// - //线体1任务上报 - if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体空桶上料 - { - // globalVar.rollerLineOne.IsEpmtyBefore = false; - } - //线体2任务上报 - if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体空桶上料 - { - // globalVar.rollerLineTwo.IsEpmtyBefore = false; - } - //线体3任务上报 - if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")// AGV正在上料,指线体空桶上料 - { - // globalVar.rollerLineThree.IsEpmtyBefore = false; - } + //线体1任务上报 if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体上料 { - - AgvViewModel.GetInstance().Set滚筒线上数量(1, (globalVar.LOneMaterialNum - 1).ToString()); - AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.Yes); + globalVar.agvLineOneLoadCom = true; + AgvViewModel.GetInstance().Set滚筒线上数量(1, (--globalVar.LOneMaterialNum).ToString()); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes); if (globalVar.LOneFryPotSerial == 1) { - AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_1); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_1_1); } else if (globalVar.LOneFryPotSerial == 4) { - AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.yc_1_4); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_1_4); } } //线体2任务上报 if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体上料 { - - AgvViewModel.GetInstance().Set滚筒线上数量(2, (globalVar.LTwoMaterialNum - 1).ToString()); - AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.Yes); + globalVar.agvLineTwoLoadCom = true; + AgvViewModel.GetInstance().Set滚筒线上数量(2, (--globalVar.LTwoMaterialNum).ToString()); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes); if (globalVar.LTwoFryPotSerial == 2) { - AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_2); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_2_2); } else if (globalVar.LTwoFryPotSerial == 5) { - AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_5); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_2_5); } } //线体3任务上报 if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体上料 { - - AgvViewModel.GetInstance().Set滚筒线上数量(3, (globalVar.LThreeMaterialNum - 1).ToString()); - AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.Yes); - AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.yc_3_3); + globalVar.agvLineThreeLoadCom = true; + AgvViewModel.GetInstance().Set滚筒线上数量(3, (--globalVar.LThreeMaterialNum).ToString()); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.Yes); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.yc_3_3); } - //线体1任务上报 - if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LSevenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体1空桶上料 + if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "" && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体到炒锅下料 { - globalVar.agvArriveLineOneLoadCom = true; - AgvViewModel.GetInstance().Set滚筒线上数量(1, (globalVar.LOneMaterialNum - 1).ToString()); - AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes); - AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.tqx_1); - //到清洗处 + } //线体2任务上报 - if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LEightrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体2空桶上料 + if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "" && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体到炒锅下料 { - globalVar.agvArriveLineTwoLoadCom = true; - AgvViewModel.GetInstance().Set滚筒线上数量(2, (globalVar.LTwoMaterialNum - 1).ToString()); - AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes); - AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.tqx_2); - //到清洗处 } //线体3任务上报 - if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体3空桶上料 + if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "" && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体到炒锅下料 { - globalVar.agvArriveLineThreeLoadCom = true; - AgvViewModel.GetInstance().Set滚筒线上数量(3, (globalVar.LThreeMaterialNum - 1).ToString()); - AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes); - AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.tqx_3); - //到清洗处 } //线体1任务上报 - if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料 + if (objData.state == "DONE" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体到炒锅下料 { - + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode],CartMotionTrajectory.hj); + AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]); + AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes); } //线体2任务上报 - if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料 + if (objData.state == "DONE" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体到炒锅下料 { - + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj); + AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]); + AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes); } //线体3任务上报 - if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料 + if (objData.state == "DONE" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体到炒锅下料 { - + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hj); + AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]); + AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes); } - //线体1任务上报 - if (objData.state == "DONE" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体下料 - { + #endregion - } - //线体2任务上报 - if (objData.state == "DONE" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体下料 - { - } - //线体3任务上报 - if (objData.state == "DONE" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体下料 - { - } - #endregion - #region 空桶上下料任务信息回报 + + + + #region 炒锅空桶上下料任务信息回报 //线体1任务上报 - if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料 + if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LFourrobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料 { //日志 } //线体2任务上报 - if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料 + if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LFiverobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料 { //日志 } //线体3任务上报 - if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料 + if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指炒锅空桶上料 { //日志 } @@ -956,36 +949,36 @@ namespace FryPot_DosingSystem.Control if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LFourrobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指炒锅空桶上料 { globalVar.agvFryPotEmptyRollerArrive = true; - AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.OnllYes); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes); if (globalVar.LOneFryPotSerial == 1) { - AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_1); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_1); } else if (globalVar.LOneFryPotSerial == 4) { - AgvViewModel.GetInstance().Set小车运动(1, CartMotionTrajectory.hs_4); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_4); } } //线体2任务上报 if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LFiverobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指炒锅空桶上料 { globalVar.LTwoagvFryPotEmptyRollerArrive = true; - AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.OnllYes); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes); if (globalVar.LTwoFryPotSerial == 2) { - AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_2); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_2); } else if (globalVar.LTwoFryPotSerial == 5) { - AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_5); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_5); } } //线体3任务上报 if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指炒锅空桶上料 { globalVar.LThreeagvFryPotEmptyRollerArrive = true; - AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes); - AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_3); } @@ -993,124 +986,173 @@ namespace FryPot_DosingSystem.Control if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料 { AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start); - AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.No); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No); + + } + //线体2任务上报 + if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFiverobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料 + { + AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No); + + } + //线体3任务上报 + if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料 + { + AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No); + + } + //线体1任务上报 + if (objData.state == "DONE" && objData.robotJobId == LFourrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料 + { + MessageLog.GetInstance.ShowRunLog("1号线炒锅空桶在4号线卸桶完成"); + if (globalVar.LFourRollerNum >= 8) { AgvViewModel.GetInstance().Set滚筒线上数量(4, "8"); } else { - AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString()); + AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString()); } + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj")); + AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]); + AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes); + } //线体2任务上报 - if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFiverobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料 + if (objData.state == "DONE" && objData.robotJobId == LFiverobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料 { - AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start); - AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.No); + MessageLog.GetInstance.ShowRunLog("2号线炒锅空桶在4号线卸桶完成"); + if (globalVar.LFourRollerNum >= 8) { AgvViewModel.GetInstance().Set滚筒线上数量(4, "8"); } else { - AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString()); + AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString()); } + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj")); + AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]); + AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes); } //线体3任务上报 - if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LSixrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料 + if (objData.state == "DONE" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料 { - AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start); - AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.No); + MessageLog.GetInstance.ShowRunLog("3号线炒锅空桶在4号线卸桶完成"); + if (globalVar.LFourRollerNum >= 8) { AgvViewModel.GetInstance().Set滚筒线上数量(4, "8"); } else { - AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString()); + AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString()); } + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj")); + AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]); + AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes); } + #endregion + #region 线体123空桶到清戏台 //线体1任务上报 - if (objData.state == "DONE" && objData.robotJobId == LFourrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料 + if (objData.state == "ROLLER_LOAD_FINISH" && LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体1空桶上料 { - // globalVar.EmptyRollerUnLoadcCom = true; - AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("hj")); - AgvViewModel.GetInstance().Set小车停止(1); - AgvViewModel.GetInstance().Set停车桩(1, IsBool.Yes); - + globalVar.agvArriveLineOneLoadCom = true; + AgvViewModel.GetInstance().Set滚筒线上数量(1, (--globalVar.LOneMaterialNum).ToString()); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_1); + //到清洗处 } //线体2任务上报 - if (objData.state == "DONE" && objData.robotJobId == LFiverobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料 + if (objData.state == "ROLLER_LOAD_FINISH" && LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体2空桶上料 { - // globalVar.EmptyRollerUnLoadcCom = true; - AgvViewModel.GetInstance().Set小车运动(2, AgvViewModel.GetInstance().GetCommandValue("hj")); - AgvViewModel.GetInstance().Set小车停止(2); - AgvViewModel.GetInstance().Set停车桩(2, IsBool.Yes); + globalVar.agvArriveLineTwoLoadCom = true; + AgvViewModel.GetInstance().Set滚筒线上数量(2, (--globalVar.LTwoMaterialNum).ToString()); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_2); + //到清洗处 + } //线体3任务上报 - if (objData.state == "DONE" && objData.robotJobId == LSixrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指炒锅空桶下料 + if (objData.state == "ROLLER_LOAD_FINISH" && LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体3空桶上料 { - // globalVar.EmptyRollerUnLoadcCom = true; - AgvViewModel.GetInstance().Set小车运动(3, AgvViewModel.GetInstance().GetCommandValue("hj")); - AgvViewModel.GetInstance().Set小车停止(3); - AgvViewModel.GetInstance().Set停车桩(3, IsBool.Yes); + globalVar.agvArriveLineThreeLoadCom = true; + AgvViewModel.GetInstance().Set滚筒线上数量(3, (--globalVar.LThreeMaterialNum).ToString()); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.tqx_3); + //到清洗处 + } - if (objData.state == "DONE" && objData.robotJobId == LSevenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体1到清戏台空桶下料 + + if (objData.state == "DONE" && LSevenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体1到清戏台空桶下料 { - MessageLog.GetInstance.ShowRunLog("清洗台卸桶完成"); - AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj")); - AgvViewModel.GetInstance().Set小车停止(4); - AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes); + LSevenrobotJobId.Remove(objData.robotJobId); + MessageLog.GetInstance.ShowRunLog("线体【1】空桶在清洗台卸桶完成"); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj); + AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes); + AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum); } - if (objData.state == "DONE" && objData.robotJobId == LEightrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体2到清戏台空桶下料 + if (objData.state == "DONE" && LEightrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体2到清戏台空桶下料 { - MessageLog.GetInstance.ShowRunLog("清洗台卸桶完成"); - AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj")); - AgvViewModel.GetInstance().Set小车停止(4); - AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes); + LEightrobotJobId.Remove(objData.robotJobId); + MessageLog.GetInstance.ShowRunLog("线体【2】空桶在清洗台卸桶完成"); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj); + AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes); + AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum); } - if (objData.state == "DONE" && objData.robotJobId == LNinerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体3到清戏台空桶下料 + if (objData.state == "DONE" && LNinerobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指从线体3到清戏台空桶下料 { - MessageLog.GetInstance.ShowRunLog("清洗台卸桶完成"); - AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj")); - AgvViewModel.GetInstance().Set小车停止(4); - AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes); + LNinerobotJobId.Remove(objData.robotJobId); + MessageLog.GetInstance.ShowRunLog("线体【3】空桶在清洗台卸桶完成"); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.qxt_hj); + AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes); + AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum); } - if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LTenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料位置上料完成,指清戏台空桶到上料 + #endregion + #region 清洗台到线体4 + if (objData.state == "ROLLER_LOAD_FINISH" && LTenrobotJobId.FirstOrDefault(p=>p==objData.robotJobId)!=null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料位置上料完成,指清戏台空桶到上料 { MessageLog.GetInstance.ShowRunLog("清洗台空桶装载完成"); - AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes); - AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.hs_4);//去四号空桶线 - + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.OnllYes); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], CartMotionTrajectory.hs_4);//去四号空桶线 + AgvViewModel.GetInstance().SetCleanRollerNum(--CleanNum); + } - if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTenrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指清洗台空桶到线体4下料 + if (objData.state == "ROLLER_UNLOAD_DOING" && LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.targetPointCode == "")//指定下料点正在下料,指清洗台空桶到线体4下料 { AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start); - AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.No); + + } + + if (objData.state == "DONE"&& LTenrobotJobId.FirstOrDefault(p => p == objData.robotJobId) != null && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指清戏台空桶到线体4下料 + { + LTenrobotJobId.Remove(objData.robotJobId); + MessageLog.GetInstance.ShowRunLog("【4】号线空桶回桶完成"); if (globalVar.LFourRollerNum >= 8) { AgvViewModel.GetInstance().Set滚筒线上数量(4, "8"); } else { - AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString()); + AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString()); } - } - - if (objData.state == "DONE" && objData.robotJobId == LTenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指清戏台空桶到线体4下料 - { - MessageLog.GetInstance.ShowRunLog("【4】号线空桶回桶完成"); - AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue("hj")); - AgvViewModel.GetInstance().Set小车停止(4); - AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes); + AgvViewModel.GetInstance().Set小车是否承载物品(agvCode[objData.jobData.agvCode], IsBool.No); + AgvViewModel.GetInstance().Set小车运动(agvCode[objData.jobData.agvCode], AgvViewModel.GetInstance().GetCommandValue("hj")); + AgvViewModel.GetInstance().Set小车停止(agvCode[objData.jobData.agvCode]); + AgvViewModel.GetInstance().Set停车桩(agvCode[objData.jobData.agvCode], IsBool.Yes); } - #endregion + } } @@ -1272,7 +1314,9 @@ namespace FryPot_DosingSystem.Control globalVar.agvArriveLineFour = false; globalVar.agvArriveCleanLoad = false; - globalVar.agvArriveCleanUnLoad = false; + globalVar.rollerLineOne.agvArriveCleanUnLoad = false; + globalVar.rollerLineTwo.agvArriveCleanUnLoad = false; + globalVar.rollerLineThree.agvArriveCleanUnLoad = false; globalVar.agvArriveLineOneLoadEmptyRoller = false; globalVar.agvArriveLineTwoLoadEmptyRoller = false; globalVar.agvArriveLineThreeLoadEmptyRoller = false; @@ -1431,14 +1475,20 @@ namespace FryPot_DosingSystem.Control if (globalVar.rollerLineOne.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineOne.EmptyRollerNum != 0) { globalVar.rollerLineOne.EmptyRollerNums.Add(globalVar.rollerLineOne.EmptyRollerNum); + ++globalVar.LOneMaterialNum; + //是否手动复位PLC } if (globalVar.rollerLineTwo.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineTwo.EmptyRollerNum != 0) { globalVar.rollerLineTwo.EmptyRollerNums.Add(globalVar.rollerLineTwo.EmptyRollerNum); + ++globalVar.LTwoMaterialNum; + //是否手动复位PLC } if (globalVar.rollerLineThree.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineThree.EmptyRollerNum != 0) { globalVar.rollerLineThree.EmptyRollerNums.Add(globalVar.rollerLineThree.EmptyRollerNum); + ++globalVar.LThreeMaterialNum; + //是否手动复位PLC } //炒锅状态数据 if (globalVar.fryPotOne.OilConfirm == 1) @@ -1539,10 +1589,10 @@ namespace FryPot_DosingSystem.Control if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty) { - using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) + using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; - PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToShortDateString() }; + PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe,Time = DateTime.Now.ToShortDateString() }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1555,7 +1605,7 @@ namespace FryPot_DosingSystem.Control Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()); if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty) { - using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) + using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToShortDateString() }; @@ -1575,9 +1625,9 @@ namespace FryPot_DosingSystem.Control if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty) { - using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) + using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { - + writeStream.Position = writeStream.Length; PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToShortDateString() }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1591,9 +1641,9 @@ namespace FryPot_DosingSystem.Control Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()); if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty) { - using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) + using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { - + writeStream.Position = writeStream.Length; PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToShortDateString() }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1611,9 +1661,9 @@ namespace FryPot_DosingSystem.Control if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty) { - using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) + using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { - + writeStream.Position = writeStream.Length; PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToShortDateString() }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1627,9 +1677,9 @@ namespace FryPot_DosingSystem.Control Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()); if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty) { - using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) + using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { - + writeStream.Position = writeStream.Length; PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToShortDateString() }; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(writeStream, p1); @@ -1647,7 +1697,7 @@ namespace FryPot_DosingSystem.Control if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty) { - using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) + using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToShortDateString() }; @@ -1663,7 +1713,7 @@ namespace FryPot_DosingSystem.Control Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()); if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty) { - using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) + using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToShortDateString() }; @@ -1683,7 +1733,7 @@ namespace FryPot_DosingSystem.Control if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty) { - using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) + using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToShortDateString() }; @@ -1699,7 +1749,7 @@ namespace FryPot_DosingSystem.Control Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()); if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty) { - using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) + using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write)) { writeStream.Position = writeStream.Length; PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToShortDateString() }; @@ -1989,11 +2039,13 @@ namespace FryPot_DosingSystem.Control { //线体123到清洗台 AgvFromLineToCleanPlate(); - AgvArriveCleanPlate(); - //清洗台到线体4 + AgvArriveCleanPlateFromLine(); + + //空桶到线体4 CallAgvToLineFour(); CleanPlateUpLoad(); - EmptyRollerToLinFour(); + //清洗台或线体123空桶到线体4 + EmptyRollerToLinFourFromClean(); } private void CleanPlateUpLoad() @@ -2004,9 +2056,7 @@ namespace FryPot_DosingSystem.Control WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC MessageLog.GetInstance.ShowRunLog("AGV到达清洗台空桶上料位置"); // MessageLog.GetInstance.ShowRunLog("清洗台空桶装载完成"); - AgvViewModel.GetInstance().SetCleanRollerNum(--CleanNum); - AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes); - AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.qxt_4); + } } @@ -2026,11 +2076,11 @@ namespace FryPot_DosingSystem.Control //下发AGV去空桶线洗桶任务 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 || LSevenrobotJobId.FirstOrDefault(p => p == id)!=null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null) goto e; - + string info = AGVHelper.GetInstance.AgvLeaveLOneToClean(id);//1号线到洗桶处 - LFourrobotJobId = id; + LSevenrobotJobId.Add(id); Thread.Sleep(500); LineToCleanCarryTaskErrorCodeAnalysis(info, 1); globalVar.rollerLineOne.IsEpmtyBefore = true; @@ -2053,11 +2103,11 @@ namespace FryPot_DosingSystem.Control { //下发AGV去空桶线洗桶任务 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 || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null) goto e; string info = AGVHelper.GetInstance.AgvLeaveLTwoToClean(id);//2号线到洗桶处 - LFiverobotJobId = id; + LEightrobotJobId.Add(id); Thread.Sleep(500); LineToCleanCarryTaskErrorCodeAnalysis(info, 2); globalVar.rollerLineTwo.IsEpmtyBefore = true; @@ -2080,11 +2130,11 @@ namespace FryPot_DosingSystem.Control { //下发AGV去空桶线洗桶任务 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 || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null) goto e; string info = AGVHelper.GetInstance.AgvLeaveLThreeToClean(id);//3号线到洗桶处 - LSixrobotJobId = id; + LNinerobotJobId.Add(id); Thread.Sleep(500); LineToCleanCarryTaskErrorCodeAnalysis(info, 3); globalVar.rollerLineThree.IsEpmtyBefore = true; @@ -2100,24 +2150,39 @@ namespace FryPot_DosingSystem.Control } /// - /// AGV到达清洗台下料位置 + /// AGV从线体123到达清洗台下料位置 /// - private void AgvArriveCleanPlate() + private void AgvArriveCleanPlateFromLine() { - if (globalVar.agvArriveCleanUnLoad) - { - globalVar.agvArriveCleanUnLoad = false; - MessageLog.GetInstance.ShowRunLog("空桶到达清洗位置,准备卸桶"); - AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.No); - AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.qxt_hj); - AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes); - AgvViewModel.GetInstance().SetCleanRollerNum(++CleanNum); + if (globalVar.rollerLineOne.agvArriveCleanUnLoad) + { + globalVar.rollerLineOne.agvArriveCleanUnLoad = false; + MessageLog.GetInstance.ShowRunLog("空桶从线体1到达清洗位置,准备卸桶"); + //plc交互 WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC // MessageLog.GetInstance.ShowRunLog("卸桶完成"); } - } + if (globalVar.rollerLineTwo.agvArriveCleanUnLoad) + { + globalVar.rollerLineTwo.agvArriveCleanUnLoad = false; + MessageLog.GetInstance.ShowRunLog("空桶从线体2到达清洗位置,准备卸桶"); + + //plc交互 + WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC + // MessageLog.GetInstance.ShowRunLog("卸桶完成"); + } + if (globalVar.rollerLineThree.agvArriveCleanUnLoad) + { + globalVar.rollerLineThree.agvArriveCleanUnLoad = false; + MessageLog.GetInstance.ShowRunLog("空桶从线体3到达清洗位置,准备卸桶"); + //plc交互 + WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC + // MessageLog.GetInstance.ShowRunLog("卸桶完成"); + } + } + /// /// 呼叫Agv从清洗台运洗好的空桶到四号线体 /// @@ -2128,11 +2193,11 @@ namespace FryPot_DosingSystem.Control //是否需要手动给PLC置位?? globalVar.CleanComplete = 0; 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 || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null) goto e; string info = AGVHelper.GetInstance.AgvFromCleanToLineFourUnLoadRoller(id); - LTenrobotJobId = id; + LTenrobotJobId.Add(id); Thread.Sleep(500); MessageLog.GetInstance.ShowRunLog("清洗台呼叫AGV取桶"); CleanToLineCarryTaskErrorCodeAnalysis(info, 4); @@ -2144,7 +2209,7 @@ namespace FryPot_DosingSystem.Control /// private void LThreeRecipeDataToPlc() { - if (LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && !LThreeErrorRecipe&&globalVar.rollerLineThree.RecipeCompleteSingle==1) + if (LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && !LThreeErrorRecipe && globalVar.rollerLineThree.RecipeCompleteSingle == 1) { globalVar.rollerLineThree.RecipeComMidSingle = 1; if (globalVar.LThreeCurrentRecipeName != string.Empty) @@ -2165,7 +2230,7 @@ namespace FryPot_DosingSystem.Control Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; }); } } - if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0&&globalVar.rollerLineThree.RecipeComMidSingle==1)//后续添加其它限制条件 + if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && globalVar.rollerLineThree.RecipeComMidSingle == 1)//后续添加其它限制条件 { Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = string.Empty; })); Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows = new ObservableCollection(); })); @@ -2206,7 +2271,7 @@ namespace FryPot_DosingSystem.Control } } DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count);//发送3号滚筒线工序数据 - globalVar.rollerLineThree.RecipeComMidSingle = 0; + globalVar.rollerLineThree.RecipeComMidSingle = 0; } } @@ -2219,7 +2284,7 @@ namespace FryPot_DosingSystem.Control /// private void LTwoRecipeDataToPlc() { - if (LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && !LTwoErrorRecipe&&globalVar.rollerLineTwo.RecipeCompleteSingle == 1) + if (LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && !LTwoErrorRecipe && globalVar.rollerLineTwo.RecipeCompleteSingle == 1) { globalVar.rollerLineTwo.RecipeComMidSingle = 1; if (globalVar.LTwoCurrentRecipeName != string.Empty) @@ -2252,7 +2317,7 @@ namespace FryPot_DosingSystem.Control } } - if (LTwoRecipeQuene.Count > 0 && LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && globalVar.rollerLineTwo.RecipeComMidSingle== 1)//后续添加其它限制条件 + if (LTwoRecipeQuene.Count > 0 && LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && globalVar.rollerLineTwo.RecipeComMidSingle == 1)//后续添加其它限制条件 { if (globalVar.LTwoFryPotSerial == 2) { @@ -2281,7 +2346,7 @@ namespace FryPot_DosingSystem.Control { if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 2 || headNum == 5)) { - if (headNum == 1)//炒锅2 + if (headNum == 2)//炒锅2 { fryTwoRecipe = result.RecipeName;//炒锅状态开始记录 Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = result.RecipeName; })); @@ -2322,7 +2387,7 @@ namespace FryPot_DosingSystem.Control /// private void LOneRecipeDataToPlc() { - if (OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && !ErrorRecipe&&globalVar.rollerLineOne.RecipeCompleteSingle==1) + if (OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && !ErrorRecipe && globalVar.rollerLineOne.RecipeCompleteSingle == 1) { globalVar.rollerLineOne.RecipeComMidSingle = 1; if (globalVar.LOneCurrentRecipeName != string.Empty) @@ -2354,7 +2419,7 @@ namespace FryPot_DosingSystem.Control Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; fryFourRecipe = string.Empty; }); } } - if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0&&globalVar.rollerLineOne.RecipeComMidSingle==1)//后续添加其它限制条件 + if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && globalVar.rollerLineOne.RecipeComMidSingle == 1)//后续添加其它限制条件 { if (globalVar.LOneFryPotSerial == 1) { @@ -2647,7 +2712,7 @@ namespace FryPot_DosingSystem.Control { Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); })); } - AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.No); + //炒锅滚筒进料运行到位处理 FryPotOneOrFourInputMaterialRollerOperate(); AgvFromFryPotOneOrFourToClean();//上游下发搬运任务给AGV @@ -2707,7 +2772,7 @@ namespace FryPot_DosingSystem.Control Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); })); } - AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.No); + //炒锅滚筒进料运行到位处理 FryPotTwoOrFiveInputMaterialRollerOperate(); AgvFromFryPotTwoOrFiveToClean();//上游下发搬运任务给AGV @@ -2743,7 +2808,7 @@ namespace FryPot_DosingSystem.Control { Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep, Name = LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); })); - AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.No); + //炒锅滚筒进料运行到位处理 FryPotThreeInputMaterialRollerOperate(); AgvFromFryPotThreeToClean();//上游下发搬运任务给AGV @@ -2829,7 +2894,6 @@ namespace FryPot_DosingSystem.Control //} globalVar.agvFryPotEmptyRollerArrive = false; globalVar.InOrOutputLock = false; - globalVar.LOneMaterialNum--; MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LOneFryPotSerial}】号炒锅将空桶回收到4号滚筒线"); //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 globalVar.AllowAgvToLineLoadRoller = true; @@ -2885,7 +2949,7 @@ namespace FryPot_DosingSystem.Control //} globalVar.LTwoagvFryPotEmptyRollerArrive = false; globalVar.LTwoInOrOutputLock = false; - globalVar.LTwoMaterialNum--; + MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LTwoFryPotSerial}】号炒锅将空桶回收到4号滚筒线"); //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 globalVar.AllowAgvToLineTwoLoadRoller = true; @@ -2931,7 +2995,7 @@ namespace FryPot_DosingSystem.Control //AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3); globalVar.LThreeagvFryPotEmptyRollerArrive = false; globalVar.LThreeInOrOutputLock = false; - globalVar.LThreeMaterialNum--; + MessageLog.GetInstance.ShowRunLog($"AGV在【{globalVar.LThreeFryPotSerial}】号炒锅将空桶回收到4号滚筒线"); //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 globalVar.AllowAgvToLineThreeLoadRoller = true; @@ -2947,25 +3011,48 @@ namespace FryPot_DosingSystem.Control } } + /// /// 4号线体下料 /// - public void EmptyRollerToLinFour() + public void EmptyRollerToLinFourFromClean() { + if (globalVar.agvArriveLineFour)//agv到达线体4下料位置 { globalVar.agvArriveLineFour = false; //线体四信号交互 WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC - MessageLog.GetInstance.ShowRunLog("AGV到达【4】号回收线体,准备卸桶"); + MessageLog.GetInstance.ShowRunLog("AGV从清洗台到达【4】号回收线体,准备卸桶"); // MessageLog.GetInstance.ShowRunLog("卸桶完成"); - AgvViewModel.GetInstance().Set滚筒线状态(4, IsRun.Start); - AgvViewModel.GetInstance().Set滚筒线上数量(4, (++globalVar.LFourRollerNum).ToString()); - AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.No); - AgvViewModel.GetInstance().Set小车运动(4, CartMotionTrajectory.hj); - AgvViewModel.GetInstance().Set停车桩(4, IsBool.Yes); } + if (globalVar.rollerLineOne.agvArriveLineFour)//agv到达线体4下料位置 + { + globalVar.rollerLineOne.agvArriveLineFour = false; + //线体四信号交互 + WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC + MessageLog.GetInstance.ShowRunLog("AGV从1号线体对应炒锅到达【4】号回收线体,准备卸桶"); + // MessageLog.GetInstance.ShowRunLog("卸桶完成"); + } + if (globalVar.rollerLineTwo.agvArriveLineFour)//agv到达线体4下料位置 + { + globalVar.rollerLineTwo.agvArriveLineFour = false; + //线体四信号交互 + WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC + MessageLog.GetInstance.ShowRunLog("AGV从2号线体对应炒锅到达【4】号回收线体,准备卸桶"); + // MessageLog.GetInstance.ShowRunLog("卸桶完成"); + } + if (globalVar.rollerLineThree.agvArriveLineFour)//agv到达线体4下料位置 + { + globalVar.rollerLineThree.agvArriveLineFour = false; + //线体四信号交互 + WritePlcData("D1067", 1);//AGV空桶回桶就位信号下发PLC + MessageLog.GetInstance.ShowRunLog("AGV从3号炒锅到达【4】号回收线体,准备卸桶"); + // MessageLog.GetInstance.ShowRunLog("卸桶完成"); + } + } + ///// ///// 2号线体对应空桶清洗 ///// @@ -3341,7 +3428,7 @@ namespace FryPot_DosingSystem.Control { case 1: erp: string id = Guid.NewGuid().ToString("N");//上游唯一ID - 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 || LSevenrobotJobId.FirstOrDefault(p=>p==id)!=null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null) { goto erp; } @@ -3351,7 +3438,7 @@ namespace FryPot_DosingSystem.Control FryCarryTaskErrorCodeAnalysis(info, 1); break; case 4: erp3: string id3 = Guid.NewGuid().ToString("N");//上游唯一ID - if (id3 == LOnerobotJobId || id3 == LTworobotJobId || id3 == LThreerobotJobId || id3 == LFourrobotJobId || id3 == LFiverobotJobId || id3 == LSixrobotJobId || id3 == LSevenrobotJobId || id3 == LEightrobotJobId || id3 == LNinerobotJobId || id3 == LTenrobotJobId) + if (id3 == LOnerobotJobId || id3 == LTworobotJobId || id3 == LThreerobotJobId || id3 == LFourrobotJobId || id3 == LFiverobotJobId || id3 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id3) != null || LEightrobotJobId.FirstOrDefault(p => p == id3) != null || LNinerobotJobId.FirstOrDefault(p => p == id3) != null || LTenrobotJobId.FirstOrDefault(p => p == id3) != null) { goto erp3; } @@ -3370,7 +3457,7 @@ namespace FryPot_DosingSystem.Control { case 2: erp1: string id1 = Guid.NewGuid().ToString("N");//上游唯一ID - if (id1 == LOnerobotJobId || id1 == LTworobotJobId || id1 == LThreerobotJobId || id1 == LFourrobotJobId || id1 == LFiverobotJobId || id1 == LSixrobotJobId || id1 == LSevenrobotJobId || id1 == LEightrobotJobId || id1 == LNinerobotJobId || id1 == LTenrobotJobId) + if (id1 == LOnerobotJobId || id1 == LTworobotJobId || id1 == LThreerobotJobId || id1 == LFourrobotJobId || id1 == LFiverobotJobId || id1 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id1) != null || LEightrobotJobId.FirstOrDefault(p => p == id1) != null || LNinerobotJobId.FirstOrDefault(p => p == id1) != null || LTenrobotJobId.FirstOrDefault(p => p == id1) != null) { goto erp1; } @@ -3380,7 +3467,7 @@ namespace FryPot_DosingSystem.Control FryCarryTaskErrorCodeAnalysis(info1, 2); break; case 5: erp4: string id4 = Guid.NewGuid().ToString("N");//上游唯一ID - if (id4 == LOnerobotJobId || id4 == LTworobotJobId || id4 == LThreerobotJobId || id4 == LFourrobotJobId || id4 == LFiverobotJobId || id4 == LSixrobotJobId || id4 == LSevenrobotJobId || id4 == LEightrobotJobId || id4 == LNinerobotJobId || id4 == LTenrobotJobId) + if (id4 == LOnerobotJobId || id4 == LTworobotJobId || id4 == LThreerobotJobId || id4 == LFourrobotJobId || id4 == LFiverobotJobId || id4 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id4) != null || LEightrobotJobId.FirstOrDefault(p => p == id4) != null || LNinerobotJobId.FirstOrDefault(p => p == id4) != null || LTenrobotJobId.FirstOrDefault(p => p == id4) != null) { goto erp4; } @@ -3396,7 +3483,7 @@ namespace FryPot_DosingSystem.Control public void AgvFromFryPotThreeToClean() { erp2: string id2 = Guid.NewGuid().ToString("N");//上游唯一ID - if (id2 == LOnerobotJobId || id2 == LTworobotJobId || id2 == LThreerobotJobId || id2 == LFourrobotJobId || id2 == LFiverobotJobId || id2 == LSixrobotJobId || id2 == LSevenrobotJobId || id2 == LEightrobotJobId || id2 == LNinerobotJobId || id2 == LTenrobotJobId) + if (id2 == LOnerobotJobId || id2 == LTworobotJobId || id2 == LThreerobotJobId || id2 == LFourrobotJobId || id2 == LFiverobotJobId || id2 == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id2) != null || LEightrobotJobId.FirstOrDefault(p => p == id2) != null || LNinerobotJobId.FirstOrDefault(p => p == id2) != null || LTenrobotJobId.FirstOrDefault(p => p == id2) != null) { goto erp2; } @@ -3421,7 +3508,7 @@ namespace FryPot_DosingSystem.Control if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) { MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶"); - AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start); + globalVar.LOneCurrentCookingStep++; OutputMaterialQuene.Enqueue(materialInfo); globalVar.agvArriveUpLoad = false; @@ -3456,8 +3543,8 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置"); DeviceOperate.GetInstance.WritePlcData("D1052", 1);//agv到达线体1上料位置信号下发plc MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶"); - AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start); - globalVar.LOneMaterialNum--; + + globalVar.agvArriveLineOneLoadEmptyRoller = false; //原料到位,agv到位,agv自行运料到清洗处 } @@ -3466,7 +3553,7 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineOne.EmptyRollerNums.RemoveAt(0); globalVar.agvArriveLineOneLoadCom = false; globalVar.rollerLineOne.IsEpmtyBefore = false; - MessageLog.GetInstance.ShowRunLog($"AGV在【1】号线体完成{emptyRollerNum}号空料桶装载"); + MessageLog.GetInstance.ShowRunLog($"AGV在【1】号线体完成【{emptyRollerNum}】号空料桶装载"); } } else//有故障 @@ -3498,7 +3585,7 @@ namespace FryPot_DosingSystem.Control if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) { MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶"); - AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start); + globalVar.LTwoCurrentCookingStep++; LTwoOutputMaterialQuene.Enqueue(materialInfo); globalVar.agvArriveLTwoUpLoad = false; @@ -3535,8 +3622,8 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置"); DeviceOperate.GetInstance.WritePlcData("D1053", 1);//agv到达线体2上料位置信号下发plc MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶"); - AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start); - globalVar.LTwoMaterialNum--; + + globalVar.agvArriveLineTwoLoadEmptyRoller = false; //原料到位,agv到位,agv自行运料到清洗处 @@ -3578,7 +3665,7 @@ namespace FryPot_DosingSystem.Control if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) { MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶"); - AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start); + globalVar.LThreeCurrentCookingStep++; LThreeOutputMaterialQuene.Enqueue(materialInfo); globalVar.agvArriveLThreeUpLoad = false; @@ -3615,8 +3702,8 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置"); DeviceOperate.GetInstance.WritePlcData("D1054", 1);//agv到达线体3上料位置信号下发plc MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶"); - AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start); - globalVar.LThreeMaterialNum--; + + globalVar.agvArriveLineThreeLoadEmptyRoller = false; // globalVar.rollerLineThree.IsEpmtyBefore = false; @@ -3653,9 +3740,6 @@ 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; } @@ -3677,9 +3761,7 @@ namespace FryPot_DosingSystem.Control { if (errorCode == "SUCCESS") { - AgvViewModel.GetInstance().Set停车桩(num, IsBool.No); - AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.No); - AgvViewModel.GetInstance().Set小车运动(4, AgvViewModel.GetInstance().GetCommandValue($"tqx_{num}")); + MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶"); } else if (errorCode == "Analysis Error") @@ -3700,9 +3782,7 @@ namespace FryPot_DosingSystem.Control { if (errorCode == "SUCCESS") { - AgvViewModel.GetInstance().Set停车桩(num, IsBool.No); - AgvViewModel.GetInstance().Set小车是否承载物品(num, IsBool.No); - AgvViewModel.GetInstance().Set小车运动(num, CartMotionTrajectory.jtqx); + MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线卸桶"); } else if (errorCode == "Analysis Error") @@ -3745,7 +3825,7 @@ namespace FryPot_DosingSystem.Control { globalVar.rollerLineOne.CanRun = false; 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 || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null) goto e; string info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id); @@ -3803,7 +3883,7 @@ namespace FryPot_DosingSystem.Control { globalVar.rollerLineTwo.CanRun = false; 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 || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null) goto e; string info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id); @@ -3854,7 +3934,7 @@ namespace FryPot_DosingSystem.Control { globalVar.rollerLineThree.CanRun = false; 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 || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null) goto e; string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id); diff --git a/FryPot_DosingSystem/Control/GlobalVariable.cs b/FryPot_DosingSystem/Control/GlobalVariable.cs index 52c19054..443dbff9 100644 --- a/FryPot_DosingSystem/Control/GlobalVariable.cs +++ b/FryPot_DosingSystem/Control/GlobalVariable.cs @@ -185,8 +185,8 @@ namespace FryPot_DosingSystem.Control public int LFourRollerNum { get; set; } = 0;//4号线体空桶数量 //新增空桶清洗系列变量 - public bool agvArriveLineFour { get; set; }//agv到达线体4下料位置从清洗台或炒锅 - public bool agvArriveCleanUnLoad { get; set; }//agv到达清洗台下料位置 + public bool agvArriveLineFour { get; set; }//agv从清洗台到达线体4下料位置 + //public bool agvArriveCleanUnLoad { get; set; }//agv到达清洗台下料位置 public bool agvArriveCleanLoad { get; set; }//agv到达清洗台上料位置 public bool agvArriveLineOneLoadEmptyRoller { get; set; }//agv到达线体1空桶上料位置 @@ -272,6 +272,14 @@ namespace FryPot_DosingSystem.Control /// 线体1上所有空桶的编号集合 /// public List EmptyRollerNums { get; set; } = new List(); + /// + /// AGV从炒锅到达线体4空桶下料位置 + /// + public bool agvArriveLineFour { get; set; } + /// + /// AGV从线体1到达清洗台 + /// + public bool agvArriveCleanUnLoad { get; set; } } /// /// 滚筒线2相关变量 @@ -344,6 +352,14 @@ namespace FryPot_DosingSystem.Control /// 线体2上所有空桶的编号集合 /// public List EmptyRollerNums { get; set; } = new List(); + /// + /// AGV从炒锅到达线体4空桶下料位置 + /// + public bool agvArriveLineFour { get; set; } + /// + /// AGV从线体2到达清洗台 + /// + public bool agvArriveCleanUnLoad { get; set; } } /// /// 滚筒线3相关变量 @@ -417,6 +433,14 @@ namespace FryPot_DosingSystem.Control /// 线体3上所有空桶的编号集合 /// public List EmptyRollerNums { get; set; } = new List(); + /// + /// AGV从炒锅到达线体4空桶下料位置 + /// + public bool agvArriveLineFour { get; set; } + /// + /// AGV从线体3到达清洗台 + /// + public bool agvArriveCleanUnLoad { get; set; } } /// /// 滚筒线4相关变量 diff --git a/FryPot_DosingSystem/Model/FlowProcessModel.cs b/FryPot_DosingSystem/Model/FlowProcessModel.cs index fb2a0a33..1144a045 100644 --- a/FryPot_DosingSystem/Model/FlowProcessModel.cs +++ b/FryPot_DosingSystem/Model/FlowProcessModel.cs @@ -14,10 +14,10 @@ namespace FryPot_DosingSystem.Model /// public string RecipeName { get { return _recipeName; }set { _recipeName = value;OnPropertyChanged(); } } private string _recipeName; - /// - /// 工艺步骤 - /// - public int Id { get; set; } + ///// + ///// 工艺步骤 + ///// + //public int Id { get; set; } /// /// 炒制原料/桶号 diff --git a/FryPot_DosingSystem/Model/FlowProcessNames.cs b/FryPot_DosingSystem/Model/FlowProcessNames.cs new file mode 100644 index 00000000..85b76ca2 --- /dev/null +++ b/FryPot_DosingSystem/Model/FlowProcessNames.cs @@ -0,0 +1,17 @@ +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FryPot_DosingSystem.Model +{ + internal class FlowProcessNames:ObservableObject + { + private static FlowProcessNames _instance; + public static FlowProcessNames GetInstance => _instance ?? (_instance = new FlowProcessNames()); + public ObservableCollection Names { get; set; } = new ObservableCollection(); + } +} diff --git a/FryPot_DosingSystem/View/DeviceListVIew.xaml b/FryPot_DosingSystem/View/DeviceListVIew.xaml index acfa4837..d25db1e8 100644 --- a/FryPot_DosingSystem/View/DeviceListVIew.xaml +++ b/FryPot_DosingSystem/View/DeviceListVIew.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel" + xmlns:local="clr-namespace:FryPot_DosingSystem.View" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/FryPot_DosingSystem/View/FlowProcessView.xaml b/FryPot_DosingSystem/View/FlowProcessView.xaml index 1233e617..bc5f3c6e 100644 --- a/FryPot_DosingSystem/View/FlowProcessView.xaml +++ b/FryPot_DosingSystem/View/FlowProcessView.xaml @@ -5,11 +5,384 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:FryPot_DosingSystem.View" xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel" + xmlns:Themes1="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic" mc:Ignorable="d" Title="FlowProcessView" Height="550" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True"> + + + + + + M 0 0 L 3.5 4 L 7 0 Z + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -26,6 +399,9 @@ + + + @@ -51,25 +427,28 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/FryPot_DosingSystem/View/FlowProcessView.xaml.cs b/FryPot_DosingSystem/View/FlowProcessView.xaml.cs index 318c8402..57576935 100644 --- a/FryPot_DosingSystem/View/FlowProcessView.xaml.cs +++ b/FryPot_DosingSystem/View/FlowProcessView.xaml.cs @@ -1,4 +1,5 @@ using BPASmartClient.Helper; +using FryPot_DosingSystem.Model; using System; using System.Collections.Generic; using System.Linq; @@ -20,16 +21,93 @@ namespace FryPot_DosingSystem.View /// public partial class FlowProcessView : Window { + public FlowProcessView() { InitializeComponent(); this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; ActionManage.GetInstance.CancelRegister("CloseFlowProcessView"); - ActionManage.GetInstance.Register(new Action(() => { + ActionManage.GetInstance.Register(new Action(() => + { this.Close(); }), "CloseFlowProcessView"); + + } - + private void Label_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + Label txt = sender as Label; + if (txt != null) + { + StackPanel oldSp = FindFirstVisualChild(itemcontrols, "stk"); + if (oldSp != null) + oldSp.Background = new SolidColorBrush(Color.FromRgb(38, 76, 115)); + StackPanel sp = VisualTreeHelper.GetParent(txt) as StackPanel; + sp.Background = new SolidColorBrush(Color.FromRgb(8, 20, 36)); + ActionManage.GetInstance.Send("CurrentItemId", txt.Content); + } + } + + + public StackPanel FindFirstVisualChild(DependencyObject obj, string childName) + { + for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) + { + DependencyObject child = VisualTreeHelper.GetChild(obj, i); + if (child != null && child is StackPanel && child.GetValue(NameProperty).ToString() == childName) + { + if (child is StackPanel stack && stack.Background?.ToString() == "#FF081424") + return stack; + } + else + { + StackPanel SP = FindFirstVisualChild(child, childName); + if (SP != null) + { + return SP; + } + } + } + return null; + } + + //private void ComboBox_KeyUp(object sender, KeyEventArgs e) + //{ + // var res = sender as ComboBox; + // Json.Read(); + + // if (res.Text != null && res.Text != String.Empty) + // { + // var datas = Json.Data.Names.Where(s => s.Contains(res.Text.Trim())); + // // var datas = Json.Data.Names.ToList().FindAll(s => s.Contains(res.Text.Trim())); + // if (datas.Count() > 0) + // { + // res.ItemsSource = datas; + // res.IsDropDownOpen = true; + // } + // else + // { + // res.IsDropDownOpen = false; + // } + // } + //} + + //private void ComboBox_LostFocus(object sender, RoutedEventArgs e) + //{ + // var res = sender as ComboBox; + // if (res.Text != null && res.Text != String.Empty) + // { + // if (!Json.Data.Names.Contains(res.Text.Trim()))//判断是否存在原料 + // { + // //FlowProcessNames.GetInstance.Names.Add(res.Text.Trim()); + // //Json.Data = FlowProcessNames.GetInstance; + // Json.Data.Names.Add(res.Text.Trim()); + // Json.Save(); + + // } + + // } + //} } } diff --git a/FryPot_DosingSystem/View/NewRecipeView.xaml.cs b/FryPot_DosingSystem/View/NewRecipeView.xaml.cs index a923dbfd..efac7617 100644 --- a/FryPot_DosingSystem/View/NewRecipeView.xaml.cs +++ b/FryPot_DosingSystem/View/NewRecipeView.xaml.cs @@ -40,7 +40,7 @@ namespace FryPot_DosingSystem.View var res = sender as ComboBox; Json.Read(); - if (res.Text != null) + if (res.Text != null && res.Text != String.Empty) { var datas = Json.Data.Names.Where(s => s.Contains(res.Text.Trim())); // var datas = Json.Data.Names.ToList().FindAll(s => s.Contains(res.Text.Trim())); @@ -59,7 +59,7 @@ namespace FryPot_DosingSystem.View private void ComboBox_LostFocus(object sender, RoutedEventArgs e) { var res = sender as ComboBox; - if (res.Text != null) + if (res.Text != null && res.Text != String.Empty) { if (!MaterialNames.GetInstance.Names.Contains(res.Text.Trim()))//判断是否存在原料 { diff --git a/FryPot_DosingSystem/View/RecipesSendDown.xaml b/FryPot_DosingSystem/View/RecipesSendDown.xaml new file mode 100644 index 00000000..eaa15085 --- /dev/null +++ b/FryPot_DosingSystem/View/RecipesSendDown.xaml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FryPot_DosingSystem/View/RecipesSendDown.xaml.cs b/FryPot_DosingSystem/View/RecipesSendDown.xaml.cs new file mode 100644 index 00000000..2b243032 --- /dev/null +++ b/FryPot_DosingSystem/View/RecipesSendDown.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FryPot_DosingSystem.View +{ + /// + /// RecipesSendDown.xaml 的交互逻辑 + /// + public partial class RecipesSendDown : UserControl + { + public RecipesSendDown() + { + InitializeComponent(); + } + } +} diff --git a/FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs b/FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs index aabae4bd..42198778 100644 --- a/FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs +++ b/FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs @@ -13,69 +13,162 @@ namespace FryPot_DosingSystem.ViewModel internal class FlowProcessSetViewModel { public int Id { get; set; } = 0; + public static int materialNum { get; set; } public ObservableCollection flowProcessModels { get; set; } = new ObservableCollection(); - public string currnetRecipeName { get; set;} + public string currentRecipeName { get; set; } + public static int currentItemId { get; set; } public RelayCommand CloseWindowCommand { get; set; } + public ObservableCollection FlowItems { get; set; } = new ObservableCollection(); public RelayCommand ConfirmCommand { get; set; } + public RelayCommand AddLastFlowItemCommand { get; set; } + public RelayCommand AddFrontFlowItemCommand { get; set; } + public RelayCommand DeleteFlowItemCommand { get; set; } public FlowProcessSetViewModel() { + Json.Read(); + // FlowProcessNames.GetInstance.Names = Json.Data.Names; + FlowItems = Json.Data.Names; + ActionManage.GetInstance.Register(new Action((obj) => + { + if (obj != null) + try + { + currentItemId = Convert.ToInt32(obj); + } + catch (Exception) + { + + } + }), "CurrentItemId"); + //ActionManage.GetInstance.Register(new Action(obj => + //{ + // if (obj != null) + // materialNum = Convert.ToInt32(obj); + //}), "MaterialNum"); ActionManage.GetInstance.Register(new Action(recipeName => { if (recipeName != null) { - currnetRecipeName = recipeName.ToString(); + currentRecipeName = recipeName.ToString(); var res = Json.Data.Recipes.FirstOrDefault(p => p.FlowProcess.RecipeName == recipeName.ToString()); - if (res != null && res is NewRecipeModel recipe&&res.FlowProcess.fpModels.Count==res.materialCollection.Count+1) //编辑已有工艺 + if (res != null && res is NewRecipeModel recipe) //编辑已有工艺 { - //flowProcessModels = recipe.FlowProcess.fpModels; + foreach (var item in recipe.materialCollection) + { + if (!FlowItems.Contains(item.MaterialName)) + FlowItems.Insert(0, item.MaterialName);//下拉框 + } foreach (var item in recipe.FlowProcess.fpModels) { - flowProcessModels.Add(new FlowProcessModel { Id = item.Id, FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime }); + flowProcessModels.Add(new FlowProcessModel {FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime }); } + + // ActionManage.GetInstance.Send("MaterialNum", recipe.materialCollection.Count); } else//创建新工艺 { - var name = Json.Data.Recipes.FirstOrDefault(p=>p.RecipeName==recipeName.ToString()); + var name = Json.Data.Recipes.FirstOrDefault(p => p.RecipeName == recipeName.ToString()); if (name != null) { - if (name.FlowProcess.fpModels.Count > 0) - { - name.FlowProcess.fpModels.Clear(); - } name.FlowProcess.RecipeName = recipeName.ToString(); - flowProcessModels.Add(new FlowProcessModel { Id = Id + 1, FryMaterialNum = "油" }); - Id++; + foreach (var item in name.materialCollection) { - flowProcessModels.Add(new FlowProcessModel { Id = Id + 1, FryMaterialNum = item.MaterialName }); - Id++; + + if (!FlowItems.Contains(item.MaterialName)) + FlowItems.Insert(0, item.MaterialName);//下拉框 } - name.FlowProcess.fpModels= flowProcessModels; + ActionManage.GetInstance.Send("MaterialNum", name.materialCollection.Count); + name.FlowProcess.fpModels = flowProcessModels; } - + } } - + }), "EditFlowProcess"); CloseWindowCommand = new RelayCommand(() => { - ActionManage.GetInstance.Send("CloseFlowProcessView"); }); ConfirmCommand = new RelayCommand(() => { - var name = Json.Data.Recipes.FirstOrDefault(p => p.RecipeName == currnetRecipeName.ToString()); + var name = Json.Data.Recipes.FirstOrDefault(p => p.RecipeName == currentRecipeName.ToString()); if (name != null) { - name.FlowProcess.RecipeName = currnetRecipeName.ToString(); - name.FlowProcess.fpModels = flowProcessModels; + name.FlowProcess.RecipeName = currentRecipeName.ToString(); + // name.FlowProcess.fpModels = flowProcessModels; + name.FlowProcess.fpModels.Clear(); + foreach (var item in flowProcessModels) + { + name.FlowProcess.fpModels.Add(new FlowProcessModel { FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime }); + } + foreach (var item in name.materialCollection) + { + string s= Json.Data.Names.FirstOrDefault(p=>p == item.MaterialName); + Json.Data.Names.Remove(s); + } } Json.Save(); + + + Json.Save(); ActionManage.GetInstance.Send("CloseFlowProcessView"); }); + + AddFrontFlowItemCommand = new RelayCommand(() => + { + try + { + if (currentItemId == 0) + { + flowProcessModels.Insert(0, new FlowProcessModel()); + } + else + { + flowProcessModels.Insert(currentItemId, new FlowProcessModel()); + currentItemId = currentItemId + 1; + } + } + catch (Exception) + { + + //throw; + } + + }); + AddLastFlowItemCommand = new RelayCommand(() => + { + try + { + if (flowProcessModels.Count <= 0) + { + flowProcessModels.Insert(0, new FlowProcessModel()); + + } + else if (currentItemId != 0) + { + flowProcessModels.Insert(currentItemId + 1, new FlowProcessModel()); + } + else + { + flowProcessModels.Add(new FlowProcessModel()); + } + } + catch (Exception) + { + + // throw; + } + }); + DeleteFlowItemCommand = new RelayCommand(() => + { + if (flowProcessModels.Count > 0) + flowProcessModels.RemoveAt(currentItemId); + currentItemId = 0; + }); } } } diff --git a/FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs b/FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs index e54fb21b..f2ee52ae 100644 --- a/FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs +++ b/FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs @@ -118,7 +118,7 @@ namespace FryPot_DosingSystem.ViewModel } else { - MessageBox.Show("配方名称重复,请重命名!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show("配方名称重复或为空,请重命名!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } diff --git a/FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs b/FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs index 66075fef..76622ed2 100644 --- a/FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs +++ b/FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs @@ -1,4 +1,6 @@ -using BPASmartClient.Helper; +using BPASmartClient.CustomResource.UserControls; +using BPASmartClient.CustomResource.UserControls.MessageShow; +using BPASmartClient.Helper; using BPASmartClient.Message; using FryPot_DosingSystem.Model; using Microsoft.Toolkit.Mvvm.ComponentModel; @@ -38,13 +40,15 @@ namespace FryPot_DosingSystem.ViewModel if (res != null) { RecipeSetDown(new NewRecipeModel[] { res }); - res.RecipeSetInfo = "配方下发成功"; - Task.Run(() => { Thread.Sleep(1500); res.RecipeSetInfo = string.Empty; }); + //res.RecipeSetInfo = "配方下发成功"; + //Task.Run(() => { Thread.Sleep(1500); res.RecipeSetInfo = string.Empty; }); + NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); } else { - res.RecipeSetInfo = "配方下发失败"; - Task.Run(() => { Thread.Sleep(1500); res.RecipeSetInfo = string.Empty; }); + //res.RecipeSetInfo = "配方下发失败"; + //Task.Run(() => { Thread.Sleep(1500); res.RecipeSetInfo = string.Empty; }); + NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"配方下发失败!"); } } @@ -53,23 +57,28 @@ namespace FryPot_DosingSystem.ViewModel { if (Recipes != null) { - //foreach (var recipeModel in Recipes) - //{ - // RecipeSetDown(recipeModel); - //} - RecipeSetDown(Recipes.ToArray()); - Task.Run(() => + try + { + RecipeSetDown(Recipes.ToArray()); + NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"所有配方下发成功!"); + } + catch (Exception) { - foreach (var item in Recipes) - { - item.RecipeSetInfo = "下发成功"; - } - Thread.Sleep(1500); - foreach (var item in Recipes) - { - item.RecipeSetInfo = string.Empty; - } - }); + + NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"配方下发失败!"); + } + //Task.Run(() => + //{ + // foreach (var item in Recipes) + // { + // item.RecipeSetInfo = "下发成功"; + // } + // Thread.Sleep(1500); + // foreach (var item in Recipes) + // { + // item.RecipeSetInfo = string.Empty; + // } + //}); } diff --git a/FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs b/FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs index 35e078a1..86734c42 100644 --- a/FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs +++ b/FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs @@ -1,4 +1,6 @@ using BPASmartClient.CustomResource.Pages.Model; +using BPASmartClient.CustomResource.UserControls; +using BPASmartClient.CustomResource.UserControls.MessageShow; using BPASmartClient.Helper; using FryPot_DosingSystem.Model; using FryPot_DosingSystem.View; @@ -83,6 +85,7 @@ namespace FryPot_DosingSystem.ViewModel { Json.Save(); count = recipeModels.Count; + NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!"); })); EditRecipeCommand = new RelayCommand((Id) => {