|
- using BPASmartClient.AGV;
- using BPASmartClient.AGV.Enums;
- using BPASmartClient.AGV.Feedback;
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.Helper;
- using BPASmartClient.HubHelper;
- using FryPot_DosingSystem.Model;
- using FryPot_DosingSystem.ViewModel;
- using Newtonsoft.Json;
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Media;
- using System.Windows;
-
- namespace FryPot_DosingSystem.Control
- {
- internal class DosingLogicControl
- {
- public static DosingLogicControl _instance;
- public static DosingLogicControl GetInstance => _instance ??= new DosingLogicControl();
- public ConcurrentDictionary<string, object> PlcReadData = new ConcurrentDictionary<string, object>();
- /// <summary>
- /// 配方队列
- /// </summary>
- public ConcurrentQueue<NewRecipeModel> RecipeQuene = new ConcurrentQueue<NewRecipeModel>();
- /// <summary>
- /// 进料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> InputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 出料原料队列
- /// </summary>
- public ConcurrentQueue<MaterialInfo> OutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
- /// <summary>
- /// 全局变量对象声明
- /// </summary>
- GlobalVariable globalVar;
- /// <summary>
- /// 线体状态对象声明
- /// </summary>
- HardWareStatusViewModel hardWareStatusModel;
-
- #region 上位机内部变量
- //int lineAlarm = 0;//线体故障信号 1:无故障 -1:故障
- int FryPotAlarm = 0;//炒锅滚筒故障信号 1:无故障 -1:故障
- int ReicpeNum = 0;//记录接收到的配方数
- #endregion
- #region agv临时变量
- bool agvArriveUpLoad = false;//agv是否到达线体装料位置
- bool agvArriveUnLoad = false;//agv是否到达炒锅送料位置
- bool agvFryPotEmptyRollerArrive = false;//agv是否拿到炒锅空桶
- string robotJobId = String.Empty;//当前上游系统任务号,全局唯一
- //List<string> robotJobIds = new List<string>();//存储当前上游系统任务号,全局唯一
- bool loadInteractive = false;// fasle:不需要上料交互 true:需要上料交互
- #endregion
- public DosingLogicControl()
- {
- globalVar = new GlobalVariable();
- hardWareStatusModel = HardWareStatusViewModel.GetInstance;
- ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
- ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearRecipes");
- ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite");
- ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite");
- ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitMainTask = true; }), "FryPotDosingMainTaskExit");
- HubHelper.GetInstance.Report = new Action<object>(AgvTaskUpReportDataAnalysis);
- HubHelper.GetInstance.Upstreamrequest = new Action<object>(AgvFeedBackUpReportDataAnalysis);
- ResetProgram();
- ReadPlcData();
- IniteTask();
- }
-
- /// <summary>
- /// AGV上下料上报数据解析
- /// </summary>
- /// <param name="obj"></param>
- private void AgvFeedBackUpReportDataAnalysis(object obj)
- {
- if (obj != null && obj is byte[] datas)
- {
- string strData = Encoding.UTF8.GetString(datas);
- object objData = JsonConvert.DeserializeObject(strData);
- if (objData != null && objData is Upstreamrequest upDownReportData)
- {
- //if (upDownReportData.body != null && upDownReportData.body is UpstreamrequestBody body)
- //{
- // if (body.robotJobId == robotJobId && body.command == "LOAD")//同一任务号且处于上料阶段
- // {
- // agvArriveUpLoad = true;//AGV到达上料位置
- // }
- // if (body.robotJobId == robotJobId && body.command == "UNLOAD")//同一任务号且处于下料阶段
- // {
- // agvArriveUnLoad = true;//AGV到达下料位置
- // }
-
- //}
- }
- }
- }
-
- /// <summary>
- /// AGV搬运任务上报数据解析
- /// </summary>
- /// <param name="obj"></param>
- private void AgvTaskUpReportDataAnalysis(object obj)
- {
- if (obj != null && obj is byte[] datas)
- {
- string strData = Encoding.UTF8.GetString(datas);
- object objData = JsonConvert.DeserializeObject(strData);
- if (objData != null && objData is AGVToUpSystem agvUpReportData)
- {
- //if (agvUpReportData.body != null && agvUpReportData.body is AGVToUpSystemBody body)
- //{
- // if (body.state == "ROLLER_LOAD_FINISH" && body.jobData.startPointCode == "")//上料完成以及到达指定上料点位
- // {
- // agvFryPotEmptyRollerArrive = true;
- // }
- //}
- }
- }
- }
-
- /// <summary>
- /// 主任务重启
- /// </summary>
- private void ResetProgram()
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- if (RTrig.GetInstance("ResetProgram").Start(globalVar.PlcInite == 1))//判断是否初始化 一初始化就重启主任务
- {
- MessageLog.GetInstance.ShowRunLog("主任务正在重启");
- ThreadManage.GetInstance().StopTask("MainTask", new Action(() =>
- {
- ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() =>
- {
- globalVar = null;
- globalVar = new GlobalVariable();
- ReicpeNum = 0;
- ActionManage.GetInstance.CancelRegister("RecipeSetDown");
- ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
- ActionManage.GetInstance.Send("ClearRecipes");
- ReadPlcData();
- IniteTask();
- MessageLog.GetInstance.ShowRunLog("主任务重启完成");
- }));
- }));
- }
-
- Thread.Sleep(10);
- }), "ResetProgram");
- }
- /// <summary>
- /// 实时获取plc数据
- /// </summary>
- public void ReadPlcData()
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- GetAddressData("D2001", new Action<ushort[]>((data) =>
- {
- globalVar.rollerLineOne.StationOne = data[0];
- globalVar.rollerLineOne.StationTwo = data[1];
- globalVar.rollerLineOne.StationThree = data[2];
- globalVar.rollerLineOne.StationFour = data[3];
- globalVar.rollerLineOne.StationFive = data[4];
- globalVar.rollerLineOne.StationSix = data[5];
- globalVar.rollerLineOne.StationSeven = data[6];
- globalVar.rollerLineOne.StationEight = data[7];
- }));
- GetAddressData("D2011", new Action<ushort[]>((data) =>
- {
- globalVar.rollerLineTwo.StationOne = data[0];
- globalVar.rollerLineTwo.StationTwo = data[1];
- globalVar.rollerLineTwo.StationThree = data[2];
- globalVar.rollerLineTwo.StationFour = data[3];
- globalVar.rollerLineTwo.StationFive = data[4];
- globalVar.rollerLineTwo.StationSix = data[5];
- globalVar.rollerLineTwo.StationSeven = data[6];
- globalVar.rollerLineTwo.StationEight = data[7];
- }));
- GetAddressData("D2021", new Action<ushort[]>((data) =>
- {
- globalVar.rollerLineThree.StationOne = data[0];
- globalVar.rollerLineThree.StationTwo = data[1];
- globalVar.rollerLineThree.StationThree = data[2];
- globalVar.rollerLineThree.StationFour = data[3];
- globalVar.rollerLineThree.StationFive = data[4];
- globalVar.rollerLineThree.StationSix = data[5];
- globalVar.rollerLineThree.StationSeven = data[6];
- globalVar.rollerLineThree.StationEight = data[7];
- }));
- GetAddressData("D2031", new Action<ushort[]>((data) =>
- {
- globalVar.rollerLineOne.OutMaterialingSingle = data[3];
- globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
- globalVar.rollerLineThree.OutMaterialingSingle = data[5];
- globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6];
- globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7];
- globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8];
- }));
- GetAddressData("D2040", new Action<ushort[]>((data) =>
- {
- globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0];
- globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1];
- globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2];
- globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3];
- globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4];
- }));
- GetAddressData("D2045", new Action<ushort[]>((data) =>
- {
- globalVar.fryPotOne.InputMaterialArrivedSingle = data[0];
- globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1];
- globalVar.fryPotThree.InputMaterialArrivedSingle = data[2];
- globalVar.fryPotFour.InputMaterialArrivedSingle = data[3];
- globalVar.fryPotFive.InputMaterialArrivedSingle = data[4];
- }));
- GetAddressData("D2050", new Action<ushort[]>((data) =>
- {
- globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0];
- globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1];
- globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2];
- globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3];
- globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4];
- }));
- GetAddressData("D2065", new Action<ushort[]>((data) =>
- {
- globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0];
- globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1];
- globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2];
- globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3];
- globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4];
- }));
- GetAddressData("D2070", new Action<ushort[]>((data) =>
- {
- globalVar.fryPotOne.RollerTroubleSingle = data[0];
- globalVar.fryPotTwo.RollerTroubleSingle = data[1];
- globalVar.fryPotThree.RollerTroubleSingle = data[2];
- globalVar.fryPotFour.RollerTroubleSingle = data[3];
- globalVar.fryPotFive.RollerTroubleSingle = data[4];
- }));
- GetAddressData("D2078", new Action<ushort[]>(data =>
- {
- globalVar.rollerLineOne.RecipeCompleteSingle = data[0];
- globalVar.rollerLineTwo.RecipeCompleteSingle = data[1];
- globalVar.rollerLineThree.RecipeCompleteSingle = data[2];
- }));
- GetAddressData("D2075", new Action<ushort[]>(data =>
- {
-
- globalVar.CleadBarrelEnterSingle = data[0];
- }));
- GetAddressData("D2077", new Action<ushort[]>(data =>
- {
-
- globalVar.CleadBarrelExitSingle = data[0];
- }));
- //globalVar.rollerLineOne.OutMaterialingSingle = 0;
- //globalVar.rollerLineOne.StationOne = 401;
- //globalVar.rollerLineOne.StationTwo = 402;
- //globalVar.rollerLineOne.OutMaterialingTroubleSingle = 1;
- RollerLineStatusDisplay();
- Thread.Sleep(10);
- }), "MainViewReadPlcData");
-
- }
- /// <summary>
- /// 滚筒线运行状态显示
- /// </summary>
- private void RollerLineStatusDisplay()
- {
- hardWareStatusModel.RollerOneModel.LocOneRollerSerial = globalVar.rollerLineOne.StationOne;
- hardWareStatusModel.RollerOneModel.LocTwoRollerSerial = globalVar.rollerLineOne.StationTwo;
- hardWareStatusModel.RollerOneModel.LocThreeRollerSerial = globalVar.rollerLineOne.StationThree;
- hardWareStatusModel.RollerOneModel.LocFourRollerSerial = globalVar.rollerLineOne.StationFour;
- hardWareStatusModel.RollerOneModel.LocFiveRollerSerial = globalVar.rollerLineOne.StationFive;
- hardWareStatusModel.RollerOneModel.LocSixRollerSerial = globalVar.rollerLineOne.StationSix;
- hardWareStatusModel.RollerOneModel.LocSevenRollerSerial = globalVar.rollerLineOne.StationSeven;
- hardWareStatusModel.RollerOneModel.LocEightRollerSerial = globalVar.rollerLineOne.StationEight;
- if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0)
- {
-
- hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
- }
- else
- {
-
- hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
- }
- if (globalVar.rollerLineOne.OutMaterialingSingle == 1)//运行中
- {
-
- hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
- }
- else
- {
-
- hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
- }
- hardWareStatusModel.RollerTwoModel.LocOneRollerSerial = globalVar.rollerLineTwo.StationOne;
- hardWareStatusModel.RollerTwoModel.LocTwoRollerSerial = globalVar.rollerLineTwo.StationTwo;
- hardWareStatusModel.RollerTwoModel.LocThreeRollerSerial = globalVar.rollerLineTwo.StationThree;
- hardWareStatusModel.RollerTwoModel.LocFourRollerSerial = globalVar.rollerLineTwo.StationFour;
- hardWareStatusModel.RollerTwoModel.LocFiveRollerSerial = globalVar.rollerLineTwo.StationFive;
- hardWareStatusModel.RollerTwoModel.LocSixRollerSerial = globalVar.rollerLineTwo.StationSix;
- hardWareStatusModel.RollerTwoModel.LocSevenRollerSerial = globalVar.rollerLineTwo.StationSeven;
- hardWareStatusModel.RollerTwoModel.LocEightRollerSerial = globalVar.rollerLineTwo.StationEight;
- if (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 0)
- {
- hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
- }
- else
- {
-
- hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
- }
- if (globalVar.rollerLineTwo.OutMaterialingSingle == 1)//运行中
- {
-
- hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
-
- }
- else
- {
- hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
- }
- hardWareStatusModel.RollerThreeModel.LocOneRollerSerial = globalVar.rollerLineThree.StationOne;
- hardWareStatusModel.RollerThreeModel.LocTwoRollerSerial = globalVar.rollerLineThree.StationTwo;
- hardWareStatusModel.RollerThreeModel.LocThreeRollerSerial = globalVar.rollerLineThree.StationThree;
- hardWareStatusModel.RollerThreeModel.LocFourRollerSerial = globalVar.rollerLineThree.StationFour;
- hardWareStatusModel.RollerThreeModel.LocFiveRollerSerial = globalVar.rollerLineThree.StationFive;
- hardWareStatusModel.RollerThreeModel.LocSixRollerSerial = globalVar.rollerLineThree.StationSix;
- hardWareStatusModel.RollerThreeModel.LocSevenRollerSerial = globalVar.rollerLineThree.StationSeven;
- hardWareStatusModel.RollerThreeModel.LocEightRollerSerial = globalVar.rollerLineThree.StationEight;
- if (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 0)
- {
- hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
- }
- else
- {
- hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
- }
- if (globalVar.rollerLineThree.OutMaterialingSingle == 1)//运行中
- {
- hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
- }
- else
- {
- hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
- }
- //滚筒线4
-
- }
- /// <summary>
- /// 返回指定地址指定长度的数据
- /// </summary>
- /// <param name="address"></param>
- /// <returns></returns>
- public void GetAddressData(string address, Action<ushort[]> action)
- {
- PlcReadData = DeviceOperate.GetInstance.GetAllData();
- if (PlcReadData.ContainsKey(address))
- {
- action((ushort[])(PlcReadData[address]));
- }
- }
- /// <summary>
- /// 写Plc数据
- /// </summary>
- /// <param name="address"></param>
- /// <param name="Value"></param>
- public void WritePlcData(string address, ushort Value)
- {
- DeviceOperate.GetInstance.WritePlcData(address, Value);
- }
- /// <summary>
- /// 初始化任务
- /// </summary>
- public void IniteTask()
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- MainTask();
- }), "MainTask");
- }
- /// <summary>
- /// 配方数据接收
- /// </summary>
- public void RecipeDataParse(object obj)
- {
- Task.Run(new Action(() =>
- {
- if (obj != null && obj is NewRecipeModel recipe)
- {
- RecipeQuene.Enqueue(recipe);
- ReicpeNum++;
- MessageLog.GetInstance.ShowRunLog($"接收到第{ReicpeNum}个配方");
- }
-
- }));
-
-
-
- }
- /// <summary>
- /// 开启主任务
- /// </summary>
- public void MainTask()
- {
- RecipeDataToPlc();
- AgvLoadRoller();
- FryPotInputMaterial();
- FryPotOutputMaterial();
- }
- /// <summary>
- /// 数据下发PLC
- /// </summary>
- public void RecipeDataToPlc()
- {
- if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0)//后续添加其它限制条件
- {
- //NewRecipeModel newRecipe = new NewRecipeModel();
- MaterialType material = new MaterialType();
- if (RecipeQuene.TryDequeue(out NewRecipeModel result))
- {
- MessageLog.GetInstance.ShowRunLog($"开始制作【{result.RecipeName}】 配方");
- //for (int k = 0; k < result.materialCollection.Count-1; k++)
- //{
- // for (int j = 0; j < result.materialCollection.Count-1-k; j++)
- // {
- // if (result.materialCollection[j].MaterialLoc > result.materialCollection[j + 1].MaterialLoc)
- // {
- // material = result.materialCollection[j];
- // result.materialCollection[j] = result.materialCollection[j + 1];
- // result.materialCollection[j + 1] = material;
- // }
- // }
- //}
- for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
- {
- //将配方中原料加入新的队列
- InputMaterialQuene.Enqueue(new MaterialInfo()
- {
- materialType = result.materialCollection[i],
- materialId = result.RecipeId
- });
- ushort n = result.materialCollection[i].MaterialLoc;
- switch (n / 100)
- {
- case 1:
- case 4: RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//1号滚筒线桶号以及重量数据下发
- case 2:
- case 5: RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//2号滚筒线桶号以及重量数据下发
- case 3: RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//3号滚筒线桶号以及重量数据下发
- }
- }
- switch (result.materialCollection[0].MaterialLoc / 100)
- {
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count); break;//发送1号滚筒线工序数据
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count); break;//发送2号滚筒线工序数据
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count); break;//发送3号滚筒线工序数据
- }
- }
- }
-
- }
- /// <summary>
- /// AGV到配方对应线体装桶以及出料到炒锅
- /// </summary>
- public void AgvLoadRoller()
- {
- //lineAlarm = 0;
- if (InputMaterialQuene.Count > 0)
- {
- switch (InputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- case 4: AgvToLineOneLoadRoller(); AgvFromLineOneToFryPot(); break;//AGV到1号线体装桶
- case 2:
- case 5: AgvToLineTwoLoadRoller(); AgvFromLineTwoToFryPot(); break;//AGV到2号线体装桶
- case 3: AgvToLineThreeLoadRoller(); AgvFromLineThreeToFryPot(); break;//AGV到3号线体装桶
- }
- }
-
- }
- /// <summary>
- /// AGV从炒锅送料位置到倒料过程处理
- /// </summary>
- public void FryPotInputMaterial()
- {
- if (OutputMaterialQuene.Count > 0 && !globalVar.InOrOutputLock)
- {
-
- while (!agvArriveUnLoad)//等待agv到达炒锅位置
- {
- Thread.Sleep(5);
- if (globalVar.ExitMainTask)
- return;
- }
- AgvArriveFryPotSingleSetDown();
- FryPotRollerTroubleCheck();
- if (FryPotAlarm == 1)//炒锅滚筒无故障
- {
- //炒锅滚筒进料运行到位处理
- FryPotInputMaterialRollerOperate();
- globalVar.InOrOutputLock = true;
- }
-
- }
-
- }
- /// <summary>
- /// 炒锅出桶
- /// </summary>
- public void FryPotOutputMaterial()
- {
- if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock)
- {
- AgvFromFryPotToClean();//上游下发搬运任务给AGV
- while (!agvArriveUpLoad)//等待agv到达炒锅位置
- {
- Thread.Sleep(5);
- if (globalVar.ExitMainTask)
- return;
- }
- agvArriveUpLoad = false;
- AgvArriveFryPotOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
- FryPotRollerTroubleCheck();
- if (FryPotAlarm == 1)//无故障
- {
- FryPotOutEmpetyRollerOperate();
- if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
- {
- while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶
- {
- Thread.Sleep(5);
- if (globalVar.ExitMainTask)
- return;
- }
- //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
- globalVar.AllowAgvToLineLoadRoller = true;
- globalVar.InOrOutputLock = false;
- }
- }
-
- }
- }
- /// <summary>
- /// 炒锅滚筒进料运行到位处理
- /// </summary>
- public void FryPotInputMaterialRollerOperate()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
- {
- Thread.Sleep(5); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
- case 2:
- while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
- {
- Thread.Sleep(5); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
- case 3:
- while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
- {
- Thread.Sleep(5); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
- case 4:
- while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
- {
- Thread.Sleep(5); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
- case 5:
- while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
- {
- Thread.Sleep(5); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
- }
-
- }
- /// <summary>
- /// 炒锅滚筒空桶出桶处理
- /// </summary>
- public void FryPotOutEmpetyRollerOperate()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
- {
- Thread.Sleep(5); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
- case 2:
- while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
- {
- Thread.Sleep(5); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
- case 3:
- while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
- {
- Thread.Sleep(5); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
- case 4:
- while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
- {
- Thread.Sleep(5); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
- case 5:
- while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
- {
- Thread.Sleep(5); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
-
- }
- }
- /// <summary>
- /// 发送agv送料就位信号至PLC(线体到炒锅)
- /// </summary>
- public void AgvArriveFryPotSingleSetDown()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
- case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
- case 3: DeviceOperate.GetInstance.WritePlcData("D1057", 1); break;//agv到炒锅3送料就位信号
- case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
- case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
- }
- }
- /// <summary>
- /// 发送agv回桶就位信号至PLC
- /// </summary>
- public void AgvArriveFryPotOutEmptyRollerSingleSetDown()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
- case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
- case 3: DeviceOperate.GetInstance.WritePlcData("D1062", 1); break;//agv到炒锅3送料就位信号
- case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
- case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
- }
- }
- /// <summary>
- /// AGV离开炒锅运送空桶任务
- /// </summary>
- public void AgvFromFryPotToClean()
- {
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- erp: string id = Guid.NewGuid().ToString("N");//上游唯一ID
- if (id == robotJobId)
- {
- goto erp;
- }
- string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
- robotJobId = id;
- FryCarryTaskErrorCodeAnalysis(info, 1); break;
- case 2:
- erp1: string id1 = Guid.NewGuid().ToString("N");//上游唯一ID
- if (id1 == robotJobId)
- {
- goto erp1;
- }
- string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
- robotJobId = id1;
- FryCarryTaskErrorCodeAnalysis(info1, 2); break;
- case 3:
- erp2: string id2 = Guid.NewGuid().ToString("N");//上游唯一ID
- if (id2 == robotJobId)
- {
- goto erp2;
- }
- string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
- robotJobId = id2;
- FryCarryTaskErrorCodeAnalysis(info2, 3); break;
- case 4:
- erp3: string id3 = Guid.NewGuid().ToString("N");//上游唯一ID
- if (id3 == robotJobId)
- {
- goto erp3;
- }
- string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
- robotJobId = id3;
- FryCarryTaskErrorCodeAnalysis(info3, 4); break;
- case 5:
- erp4: string id4 = Guid.NewGuid().ToString("N");//上游唯一ID
- if (id4 == robotJobId)
- {
- goto erp4;
- }
- string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
- robotJobId = id4;
- FryCarryTaskErrorCodeAnalysis(info4, 5); break;
- }
- }
- /// <summary>
- /// 处理agv从线体1到送料到炒锅的条件
- /// </summary>
- /// <param name="lineAlarm"></param>
- public void AgvFromLineOneToFryPot()
- {
- erp: if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0)//无故障
- {
- while (!agvArriveUpLoad)//等待AGV到线体装料位置
- {
- Thread.Sleep(5);
- if (globalVar.ExitMainTask)
- return;
- }
- agvArriveUpLoad = false;
- AgvArriveLineSingelSetDown();
- if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
- {
- while (!(globalVar.rollerLineOne.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号
- {
- Thread.Sleep(5);
- if (globalVar.ExitMainTask)
- return;
- }
- OutputMaterialQuene.Enqueue(materialInfo);
- //原料到位,agv到位,agv自行运料到炒锅
- }
-
- }
- else//有故障
- {
- while (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 1)
- {
- Thread.Sleep(50);
- if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
- //lineAlarm = 1;
- goto erp;
- }
- }
- /// <summary>
- /// 处理agv从线体2到送料到炒锅的条件
- /// </summary>
- /// <param name="lineAlarm"></param>
- public void AgvFromLineTwoToFryPot()
- {
- erp: if (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 0)//无故障
- {
- while (!agvArriveUpLoad)//等待AGV到线体装料位置
- {
- Thread.Sleep(5);
- if (globalVar.ExitMainTask)
- return;
- }
- agvArriveUpLoad = false;
- AgvArriveLineSingelSetDown();
- if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
- {
- while (!(globalVar.rollerLineTwo.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号
- {
- Thread.Sleep(5);
- if (globalVar.ExitMainTask)
- return;
- }
- OutputMaterialQuene.Enqueue(materialInfo);
- //原料到位,agv到位,agv运料到炒锅
- }
-
- }
- else//有故障
- {
- while (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 1)
- {
- Thread.Sleep(50);
- if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
- // lineAlarm = 1;
- goto erp;
- }
- }
- /// <summary>
- /// 处理agv从线体3到送料到炒锅的条件
- /// </summary>
- /// <param name="lineAlarm"></param>
- public void AgvFromLineThreeToFryPot()
- {
- erp: if (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 0)//无故障
- {
- while (!agvArriveUpLoad)//等待AGV到线体装料位置
- {
- Thread.Sleep(5);
- if (globalVar.ExitMainTask)
- return;
- }
- agvArriveUpLoad = false;
- AgvArriveLineSingelSetDown();
- if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
- {
- while (!(globalVar.rollerLineThree.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号
- {
- Thread.Sleep(5);
- if (globalVar.ExitMainTask)
- return;
- }
- OutputMaterialQuene.Enqueue(materialInfo);
- //原料到位,agv到位,agv运料到炒锅
- }
-
- }
- else //有故障
- {
- while (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 1)
- {
- Thread.Sleep(50);
- if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
- // lineAlarm = 1;
- goto erp;
- }
- }
- /// <summary>
- /// 线体搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public void LineCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- MessageLog.GetInstance.ShowRunLog($"AGV去{num}号线体");
- globalVar.AllowAgvToLineLoadRoller = false;
- }
- else if (errorCode == "Analysis Error")
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号线体接口调用失败,请检查");
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号线体失败,错误码:{errorCode}");
- }
- }
- /// <summary>
- /// 炒锅搬运任务错误码分析
- /// </summary>
- /// <param name="errorCode"></param>
- /// <param name="num"></param>
- public void FryCarryTaskErrorCodeAnalysis(string errorCode, int num)
- {
- if (errorCode == "SUCCESS")
- {
- MessageLog.GetInstance.ShowRunLog($"AGV离开{num}号炒锅");
- }
- else if (errorCode == "Analysis Error")
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅接口调用失败,请检查");
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅失败,错误码:{errorCode}");
- }
- }
-
- public void AgvToLineOneLoadRoller()
- {
- if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0)//输送线无故障
- {
- if (InputMaterialQuene.Count > 0)
- {
- while (!globalVar.AllowAgvToLineLoadRoller || globalVar.rollerLineOne.OutMaterialingSingle == 0)
- {
- Thread.Sleep(5);
- if (globalVar.ExitMainTask)
- return;
- }
- e: string id = Guid.NewGuid().ToString("N");
- if (id == robotJobId)
- goto e;
- string info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
- robotJobId = id;
- Thread.Sleep(500);
- LineCarryTaskErrorCodeAnalysis(info, 1);
- }
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【1】故障!!!");
- // lineAlarm = -1;
- }
- // lineAlarm = 1;
- }
- public void AgvToLineTwoLoadRoller()
- {
- if (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 0)//输送线无故障
- {
- if (InputMaterialQuene.Count > 0)
- {
- while (!globalVar.AllowAgvToLineLoadRoller || globalVar.rollerLineOne.OutMaterialingSingle == 0) //后续考虑是否用while
- {
- Thread.Sleep(5);
- if (globalVar.ExitMainTask)
- return;
- }
- p: string id = Guid.NewGuid().ToString();
- if (id == robotJobId)
- goto p;
- string info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id);
- robotJobId = id;
- Thread.Sleep(500);
- LineCarryTaskErrorCodeAnalysis(info, 2);
- }
-
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【2】故障!!!");
- //lineAlarm = -1;
- }
- // lineAlarm = 1;
- }
- public void AgvToLineThreeLoadRoller()
- {
- if (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 0)//输送线无故障
- {
- if (InputMaterialQuene.Count > 0)
- {
- while (!globalVar.AllowAgvToLineLoadRoller || globalVar.rollerLineOne.OutMaterialingSingle == 0) //后续考虑是否用while
- {
- Thread.Sleep(5);
- if (globalVar.ExitMainTask)
- return;
- }
- g: string id = Guid.NewGuid().ToString();
- if (id == robotJobId)
- goto g;
- string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
- robotJobId = id;
- Thread.Sleep(500);
- LineCarryTaskErrorCodeAnalysis(info, 3);
- }
-
- }
- else
- {
- MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【3】故障!!!");
- // lineAlarm = -1;
- }
- // lineAlarm = 1;
- }
- /// <summary>
- /// 1号线体数据下发
- /// </summary>
- /// <param name="count"></param>
- /// <param name="materialLoc"></param>
- /// <param name="materialWeight"></param>
- public void RollerOneDataWrite(int count, ushort materialLoc, ushort materialWeight)
- {
- switch (count)
- {
- case 0:
- DeviceOperate.GetInstance.WritePlcData("D1001", materialLoc);//桶1位置
- DeviceOperate.GetInstance.WritePlcData("D1010", materialWeight);//桶2重量
- break;
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1002", materialLoc);//桶2位置
- DeviceOperate.GetInstance.WritePlcData("D1011", materialWeight);//桶2重量
- break;
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1003", materialLoc);//桶3位置
- DeviceOperate.GetInstance.WritePlcData("D1012", materialWeight);//桶3重量
- break;
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1004", materialLoc);//桶4位置
- DeviceOperate.GetInstance.WritePlcData("D1013", materialWeight);//桶4重量
- break;
- case 4:
- DeviceOperate.GetInstance.WritePlcData("D1005", materialLoc);//桶5位置
- DeviceOperate.GetInstance.WritePlcData("D1014", materialWeight);//桶5重量
- break;
- case 5:
- DeviceOperate.GetInstance.WritePlcData("D1006", materialLoc);//桶6位置
- DeviceOperate.GetInstance.WritePlcData("D1015", materialWeight);//桶6重量
- break;
- case 6:
- DeviceOperate.GetInstance.WritePlcData("D1007", materialLoc);//桶7位置
- DeviceOperate.GetInstance.WritePlcData("D1016", materialWeight);//桶7重量
- break;
- case 7:
- DeviceOperate.GetInstance.WritePlcData("D1008", materialLoc);//桶8位置
- DeviceOperate.GetInstance.WritePlcData("D1017", materialWeight);//桶8重量
- break;
-
- }
- }
- /// <summary>
- /// 2号线体数据下发
- /// </summary>
- /// <param name="count"></param>
- /// <param name="materialLoc"></param>
- /// <param name="materialWeight"></param>
- public void RollerTwoDataWrite(int count, ushort materialLoc, ushort materialWeight)
- {
- switch (count)
- {
- case 0:
- DeviceOperate.GetInstance.WritePlcData("D1018", materialLoc);//桶1位置
- DeviceOperate.GetInstance.WritePlcData("D1027", materialWeight);//桶2重量
- break;
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1019", materialLoc);//桶2位置
- DeviceOperate.GetInstance.WritePlcData("D1028", materialWeight);//桶2重量
- break;
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1020", materialLoc);//桶3位置
- DeviceOperate.GetInstance.WritePlcData("D1029", materialWeight);//桶3重量
- break;
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1021", materialLoc);//桶4位置
- DeviceOperate.GetInstance.WritePlcData("D1030", materialWeight);//桶4重量
- break;
- case 4:
- DeviceOperate.GetInstance.WritePlcData("D1022", materialLoc);//桶5位置
- DeviceOperate.GetInstance.WritePlcData("D1031", materialWeight);//桶5重量
- break;
- case 5:
- DeviceOperate.GetInstance.WritePlcData("D1023", materialLoc);//桶6位置
- DeviceOperate.GetInstance.WritePlcData("D1032", materialWeight);//桶6重量
- break;
- case 6:
- DeviceOperate.GetInstance.WritePlcData("D1024", materialLoc);//桶7位置
- DeviceOperate.GetInstance.WritePlcData("D1033", materialWeight);//桶7重量
- break;
- case 7:
- DeviceOperate.GetInstance.WritePlcData("D1025", materialLoc);//桶8位置
- DeviceOperate.GetInstance.WritePlcData("D1034", materialWeight);//桶8重量
- break;
-
- }
- }
- /// <summary>
- /// 3号线体数据下发
- /// </summary>
- /// <param name="count"></param>
- /// <param name="materialLoc"></param>
- /// <param name="materialWeight"></param>
- public void RollerThreeDataWrite(int count, ushort materialLoc, ushort materialWeight)
- {
- switch (count)
- {
- case 0:
- DeviceOperate.GetInstance.WritePlcData("D1035", materialLoc);//桶1位置
- DeviceOperate.GetInstance.WritePlcData("D1044", materialWeight);//桶2重量
- break;
- case 1:
- DeviceOperate.GetInstance.WritePlcData("D1036", materialLoc);//桶2位置
- DeviceOperate.GetInstance.WritePlcData("D1045", materialWeight);//桶2重量
- break;
- case 2:
- DeviceOperate.GetInstance.WritePlcData("D1037", materialLoc);//桶3位置
- DeviceOperate.GetInstance.WritePlcData("D1046", materialWeight);//桶3重量
- break;
- case 3:
- DeviceOperate.GetInstance.WritePlcData("D1038", materialLoc);//桶4位置
- DeviceOperate.GetInstance.WritePlcData("D1047", materialWeight);//桶4重量
- break;
- case 4:
- DeviceOperate.GetInstance.WritePlcData("D1039", materialLoc);//桶5位置
- DeviceOperate.GetInstance.WritePlcData("D1048", materialWeight);//桶5重量
- break;
- case 5:
- DeviceOperate.GetInstance.WritePlcData("D1040", materialLoc);//桶6位置
- DeviceOperate.GetInstance.WritePlcData("D1049", materialWeight);//桶6重量
- break;
- case 6:
- DeviceOperate.GetInstance.WritePlcData("D1041", materialLoc);//桶7位置
- DeviceOperate.GetInstance.WritePlcData("D1050", materialWeight);//桶7重量
- break;
- case 7:
- DeviceOperate.GetInstance.WritePlcData("D1042", materialLoc);//桶8位置
- DeviceOperate.GetInstance.WritePlcData("D1051", materialWeight);//桶8重量
- break;
-
- }
-
- }
- /// <summary>
- /// AGV进料就位信号下发至PLC
- /// </summary>
- public void AgvArriveLineSingelSetDown()
- {
- switch (InputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- case 4: DeviceOperate.GetInstance.WritePlcData("D1052", 1); break;//AGV进料就位信号1
- case 2:
- case 5: DeviceOperate.GetInstance.WritePlcData("D1053", 1); break;//AGV进料就位信号2
- case 3: DeviceOperate.GetInstance.WritePlcData("D1054", 1); break;//AGV进料就位信号3
- }
-
- }
- /// <summary>
- /// 炒锅滚筒信号检测
- /// </summary>
- public void FryPotRollerTroubleCheck()
- {
- FryPotAlarm = 0;
- switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
- {
- case 1:
- if (globalVar.fryPotOne.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotOne.RollerTroubleSingle == 1)
- {
- Thread.Sleep(50); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
- FryPotAlarm = 1; break;
- case 2:
- if (globalVar.fryPotTwo.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotTwo.RollerTroubleSingle == 1)
- {
- Thread.Sleep(50); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行");
- FryPotAlarm = 1; break;
- case 3:
- if (globalVar.fryPotThree.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotThree.RollerTroubleSingle == 1)
- {
- Thread.Sleep(50); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
- FryPotAlarm = 1; break;
- case 4:
- if (globalVar.fryPotFour.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotFour.RollerTroubleSingle == 1)
- {
- Thread.Sleep(50); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
- FryPotAlarm = 1; break;
- case 5:
- if (globalVar.fryPotFive.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotFive.RollerTroubleSingle == 1)
- {
- Thread.Sleep(50); if (globalVar.ExitMainTask)
- return;
- }
- MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行");
- FryPotAlarm = 1; break;
-
- }
- }
-
- }
- }
|