|
- using BPA.Message;
- using BPA.Message.Enum;
- using BPASmartClient.Device;
- using BPASmartClient.EventBus;
- using BPASmartClient.Helper;
- using BPASmartClient.Message;
- using BPASmartClient.Model;
- using BPASmartClient.Model.PLC;
- using BPA.Models;
- using static BPASmartClient.EventBus.EventBus;
- using BPASmartClient.Model.小炒机;
- using BPASmartClient.MorkF.Model;
- using System.Text;
- using System.Collections.Concurrent;
-
- namespace BPASmartClient.MorkF
- {
- public class Control_MorkF : BaseDevice
- {
- /// <summary>
- /// while循环最大sleep次数
- /// </summary>
- private const int sleepCount = 20;
-
- /// <summary>
- /// while循环每次sleep时间
- /// </summary>
- private const int sleepTime = 500;
-
- /// <summary>
- /// 初始化炒锅数量
- /// </summary>
- private int count = 2;
-
- //当前炒锅,默认为1号炒锅
- private int fryIndex = 0;
-
- public override DeviceClientType DeviceType => DeviceClientType.MORKCS;
- public AutoResetEvent minorReset = new AutoResetEvent(false);
- public AutoResetEvent mainReset = new AutoResetEvent(false);
-
- /// <summary>
- /// 炒锅编号与炒锅实例
- /// </summary>
- Dictionary<int,GVL_MorkF> morkFs = new Dictionary<int, GVL_MorkF>();//全局对象声明
-
- /// <summary>
- /// 菜品库对象
- /// </summary>
- ML_MorkF ml_morkf = new ML_MorkF();
-
- /// <summary>
- /// 小炒菜单集合
- /// </summary>
- public static List<StirFryGoods> LocalstirFryGoods = new List<StirFryGoods>();
-
- /// <summary>
- /// 待炒小炒队列
- /// </summary>
- private ConcurrentQueue<OrderLocInfo> StirFryGoodsQuenes = new ConcurrentQueue<OrderLocInfo>();
-
- /// <summary>
- /// 炒锅炒制线程名称
- /// </summary>
- private const String striConst = "炒锅{0}炒制{1}线程";
-
- /// <summary>
- /// 当前炒制菜品
- /// </summary>
- private OrderLocInfo nowStirFryGood = null;
-
- List<int> resultorder = new List<int>();//调试变量
-
- /// <summary>
- /// 入口
- /// </summary>
- public override void DoMain()
- {
- IsHealth = true;
- //WriteControl("VD836", 0);
- //WriteControl("VD840", 0);
- //Thread.Sleep(400);
- //WriteControl("M0.0", true);
-
- for (int i = 0;i< count;i++)
- {
- morkFs.Add(i, new GVL_MorkF());
- }
-
- DataParse();//数据解析
- CommandRegist();//调试
- ServerInit();
- DeviceProcessLogShow("MORKF 设备初始化完成");
- }
-
- /// <summary>
- /// 主任务
- /// </summary>
- public override void MainTask()
- {
- MainProcessExcute();
- //MinorProcessExcute();
- //SingleProcess();
- }
-
- public override void Stop()
- {
- IsHealth = false;
- }
-
- #region 调试代码
- public void CommandRegist()
- {
- #region 设备控制
- ActionManage.GetInstance.Register(PLCInite, "InitCommand");
- ActionManage.GetInstance.Register(StartOrder, "StartOrder");
- ActionManage.GetInstance.Register(StartOrderMain, "开始下单");
- ActionManage.GetInstance.Register(StartLocalOrder, "StartLocalOrder");
- ActionManage.GetInstance.Register(StopLocalOrder, "StopLocalOrder");
- #endregion
-
- #region 菜品库
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- FoodLibInit();
- }), "FoodLibInit");
- }), "FoodLibInit");
- ActionManage.GetInstance.Register(new Action<object>((o) =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- Electromagnetism(o);
- }), "Electromagnetism");
- }), "Electromagnetism");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- GetDistance_1();
- }), "GetDistance_1");
- }), "GetDistance_1");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- GetDistance_2();
- }), "GetDistance_2");
- }), "GetDistance_2");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- GetDistance_3();
- }), "GetDistance_3");
- }), "GetDistance_3");
- ActionManage.GetInstance.Register(PawTurnFront, "PawTurnFront");
- ActionManage.GetInstance.Register(PawTurnBack, "PawTurnBack");
- ActionManage.GetInstance.Register(new Action<object>((list) =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- if(list is List<int> list_int)
- {
- if (list_int.Count == 2)
- {
- SetArmPosition(list_int[0], list_int[1]);
- }
- }
- }), "SetArmPosition");
- }), "SetArmPosition");
- #endregion
- //ActionManage.GetInstance.Register(PLCInite, "InitCommand");
- #region 配料控制
- ActionManage.GetInstance.Register(new Action<object>((o) =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- OutSeasoning(o, fryIndex);
- }), "OutMaterials");
- }), "OutMaterials");
- //ActionManage.GetInstance.Register(OutSeasoning, "OutMaterials");
- #endregion
-
- #region 炒锅
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- Plc1Reset(fryIndex);
- }), "Plc1Reset");
- }) , "Plc1Reset");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- AddOil();
- }), "AddOil");
- }), "AddOil");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- StartFire(fryIndex);
- }), "StartFire");
- }), "StartFire");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- StopFire(fryIndex);
- }), "StopFire");
- }), "StopFire");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- StartStir(fryIndex);
- }), "StartStir");
- }), "StartStir");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- StopStir(fryIndex);
- }), "StopStir");
- }), "StopStir");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- OutFood(fryIndex);
- }), "OutFood");
- }), "OutFood");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- StirArmGoOrigin(fryIndex);
- }), "StirArmGoOrigin");
- }), "StirArmGoOrigin");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- StirArmGoWork(fryIndex);
- }), "StirArmGoWork");
- }), "StirArmGoWork");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- HBOTGoWork(fryIndex);
- }), "HBOTGoWork");
- }), "HBOTGoWork");
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- OutMeal(fryIndex);
- }), "OutMeal");
- }), "OutMeal");
-
- ActionManage.GetInstance.Register(new Action<object>((o) =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- SetFire(o,fryIndex);
- }), "SetFire");
- }), "SetFire");
-
- ActionManage.GetInstance.Register(new Action<object>((o) =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- SetFry(o);
- }), "SetFry");
- }), "SetFry");
-
- ActionManage.GetInstance.Register(new Action<object>((o) =>
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- SetStir(o,fryIndex);
- }), "SetStir");
- }), "SetStir");
- #endregion
-
-
- }
-
- /// <summary>
- /// 本地菜单下单
- /// </summary>
- private void StartOrder(object o)
- {
- if(o==null) return;
- if(o is int goodId)
- {
- var res = LocalstirFryGoods?.FirstOrDefault(p => p.GoodsKey == goodId);//匹配订单对应制作流程
- if (res != null)
- {
- /* morkF.listStirBom.Add(res.StirFryBomInfo);*///添加订单制作流程
- if (StirFryGoodsQuenes.Count > 0) return;
- StirFryGoodsQuenes.Enqueue(new OrderLocInfo()
- {
- SuborderId = Guid.NewGuid().ToString(),
- StirPotActions = res.StirPotActions,
- GoodName = "本地菜品"
- });
- MessageLog.GetInstance.Show($"添加本地订单{res.GoodsKey}");
- }
- }
- }
-
- /// <summary>
- /// 本地菜单下单
- /// </summary>
- private void StartOrderMain(object o)
- {
- if (o == null) return;
- if (o is string goodId)
- {
- var res = LocalstirFryGoods?.FirstOrDefault(p => p.GoodsKey.ToString() == goodId);//匹配订单对应制作流程
- if (res != null)
- {
- /* morkF.listStirBom.Add(res.StirFryBomInfo);*///添加订单制作流程
- if (StirFryGoodsQuenes.Count > 0) return;
- StirFryGoodsQuenes.Enqueue(new OrderLocInfo()
- {
- SuborderId = Guid.NewGuid().ToString(),
- StirPotActions = res.StirPotActions,
- GoodName = "本地菜品"
- });
- MessageLog.GetInstance.Show($"添加本地订单{res.GoodsKey}");
- }
- }
- }
-
- private void StartLocalOrder()
- {
- if (StirFryGoodsQuenes.Count > 0) return;//只能一个一个做
- if (Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions.Count>0)
- {
- StirFryGoodsQuenes.Enqueue(new OrderLocInfo()
- {
- SuborderId = Guid.NewGuid().ToString(),
- StirPotActions = Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions,
- GoodName = "本地菜品"
- });
- MessageLog.GetInstance.Show($"添加本地模拟的订单{Json<LocalPotStep>.Data.LocalstirFryGoods.GoodsKey}");
- }
- }
-
- /// <summary>
- /// 停止本地菜单炒制
- /// </summary>
- private void StopLocalOrder(int num = -1)
- {
- //判断当前是否有炒制菜品
- if (nowStirFryGood == null) return;
-
- //根据morkFs中是否有num执行不同的停止操作
- if (!morkFs.ContainsKey(num))
- {
- //根据调试界面的当前炒锅编号停止炒制线程
- ThreadManage.GetInstance().StopTask(String.Format(striConst, fryIndex.ToString(), nowStirFryGood.GoodName), new Action(() => { Plc1Reset(fryIndex); }));
- }
- else
- {
- //根据炒锅编号停止炒制线程
- ThreadManage.GetInstance().StopTask(String.Format(striConst, fryIndex.ToString(), nowStirFryGood.GoodName), new Action(() => { Plc1Reset(num); }));
- }
- }
-
- /// <summary>
- /// 重置程序
- /// </summary>
- public override void ResetProgram()
- {
- IsHealth = true;
- morkFs.Clear();
- morkFs = new Dictionary<int, GVL_MorkF>();
- ml_morkf = new ML_MorkF();
-
- //根据编号new炒锅实例对象
- for (int i = 0; i < count; i++)
- {
- morkFs.Add(i, new GVL_MorkF());
- }
- }
-
- #endregion
-
- #region 公用PLC方法
- /// <summary>
- /// 获取设备PLC的所有状态
- /// </summary>
- /// <param name="key"></param>
- /// <param name="action"></param>
- /// <param name="num">炒锅编号</param>
- private void GetStatus(string key, Action<object> action, int num)
- {
- if (dicPort2peripheralStatus.ContainsKey(num))
- {
- if (dicPort2peripheralStatus[num].ContainsKey(key))
- {
- action((object)dicPort2peripheralStatus[num][key]);//获取PLC指定地址的状态值
- }
- }
- }
-
- /// <summary>
- /// PLC数据读取
- /// </summary>
- public override void ReadData()
- {
-
- for (int i = 0; i < morkFs.Count; i++)
- {
- GetStatus("LB50", new Action<object>((objects) =>
- {
- if (!morkFs.ContainsKey(i))
- {
- return;
- }
- if (objects is bool[] bools)
- {
- morkFs[i].FryPot1_InitialComplete = bools[0];
- morkFs[i].FryPot1_HOBTPut = bools[1];
- morkFs[i].FryPot1_HOBTGet = bools[2];
- morkFs[i].FryPot1_MaterialIntoPot = bools[3];
- morkFs[i].OutFoodCompelete = bools[4];
- morkFs[i].CanOutFood = bools[5];
- morkFs[i].GetFoodCompelete = bools[6];
- morkFs[i].CanOutPotWashingWater = bools[7];
- morkFs[i].ArmOnOrigin = bools[8];
- morkFs[i].ArmOnWorking = bools[9];
- morkFs[i].PotOnOrigin = bools[10];
- }
-
- }), i);
- }
- for (int j = 0; j < morkFs.Count; j++)
- {
- GetStatus("LB74", new Action<object>((objects) =>
- {
- if (!morkFs.ContainsKey(j))
- {
- return;
- }
-
- if (objects is bool[] bools)
- {
- for (int i = 0; i < 14; i++)
- {
- morkFs[j].PassWay1_Compelete[i] = bools[i];
- }
- }
-
- }), j);
- }
- for (int i = 0; i < morkFs.Count; i++)
- {
- if (!morkFs.ContainsKey(i))
- {
- return;
- }
-
- GetStatus("LB90", new Action<object>((objects) =>
- {
- if (objects is bool[] bools)
- {
- morkFs[i].AutoMode = bools[0];
- }
-
- }), i);
- }
-
- //获取激光距离
- GetStatus("VW270", new Action<object>((objects) =>
- {
- if (objects is int[] bools)
- {
- for (int i = 0; i < 1; i++)
- {
- ml_morkf.LaserDistance = bools[i];
- }
- }
- }), 2);
-
- //获取坐标X
- GetStatus("VD828", new Action<object>((objects) =>
- {
- if (objects is int[] bools)
- {
- for (int i = 0; i < 1; i++)
- {
- ml_morkf.ArmPositionX = bools[i];
- }
- }
- }), 2);
-
- //获取坐标Y
- GetStatus("VD832", new Action<object>((objects) =>
- {
- if (objects is int[] bools)
- {
- for (int i = 0; i < 1; i++)
- {
- ml_morkf.ArmPositionY = bools[i];
- }
- }
- }), 2);
-
- //获取爪子到达位置
- GetStatus("M11.0", new Action<object>((objects) =>
- {
- if (objects is bool[] bools && bools.Length > 3)
- {
-
- //ml_morkf.PawArrivePortOne = bools[0];
- //ml_morkf.PawArrivePortTwo = bools[1];
- //ml_morkf.PawArrivePortThree = bools[2];
-
- if (isInitialPaw == false)
- {
- isInitialArrive = true;
- }
- else
- {
- //小炒爪子到达1号位上升沿信号捕获
- if (RTrig.GetInstance("SmartGitdistance1Complete").Start(bools[0]))
- {
- ml_morkf.PawArrivePortOne = true;
- }
- //小炒爪子到达3号位上升沿信号捕获
- if (RTrig.GetInstance("SmartGitdistance2Complete").Start(bools[1]))
- {
- ml_morkf.PawArrivePortTwo = true;
- }
- //小炒爪子到达3号位上升沿信号捕获
- if (RTrig.GetInstance("SmartGitdistance3Complete").Start(bools[2]))
- {
- ml_morkf.PawArrivePortThree = true;
- }
- isInitialArrive = true;
- }
- }
- }), 2);
-
- //获取定位到达状态
- GetStatus("M10.0", new Action<object>((objects) =>
- {
- if (objects is bool[] bools)
- {
- for (int i = 0; i < 1; i++)
- {
- //ml_morkf.ArriveComplete = bools[i];
- //小炒定点到达上升沿信号捕获
- if (RTrig.GetInstance("SmartArriveComplete").Start(bools[i]))
- {
- if (isInitialArrive == false)
- {
- MessageLog.GetInstance.Show("到达上升沿为true,isInitialArrive is false");
- isInitialArrive = true;
- }
- else
- {
- MessageLog.GetInstance.Show("到达上升沿为true");
- ml_morkf.ArriveComplete = true;
- isInitialArrive = true;
- }
- }
- }
- }
-
- }), 2);
-
- //获取总初始化完成
- GetStatus("M10.2", new Action<object>((objects) =>
- {
- if (objects is bool[] bools)
- {
- for (int i = 0; i < 1; i++)
- {
- ml_morkf.InitialComplete = bools[i];
- }
- }
- }), 2);
-
- //抓手初始化完成
- GetStatus("M10.3", new Action<object>((objects) =>
- {
- if (objects is bool[] bools)
- {
- for (int i = 0; i < 1; i++)
- {
- ml_morkf.PawInitialComplete = bools[i];
- }
- }
- }), 2);
-
- }
-
- #endregion
-
- #region 菜品库PLC操作方法
- /// <summary>
- /// 菜品库数据写入
- /// </summary>
- /// <param name="address"></param>
- /// <param name="value"></param>
- private void MaterailLibrary_Write(string address, object value,int num)
- {
- WriteControlExact(address, value, num);
- }
- /// <summary>
- /// 菜品库初始化
- /// </summary>
- public void FoodLibInit(int num = 2)
- {
- MaterailLibrary_Write("M0.2", true, num);
- }
- /// <summary>
- /// 电磁阀启停
- /// </summary>
- /// <param name="o">电磁阀启停:true:启动。false:停止。</param>
- public void Electromagnetism(object o,int num = 2)
- {
- if (o == null) return;
- if (o is List<bool> bs && bs.Count == 1)
- {
- MaterailLibrary_Write("M1.3", bs[0],num);
- }
- }
- public bool GetDistance_1(int num = 2)
- {
- MessageLog.GetInstance.Show("爪子去到1号位");
- MaterailLibrary_Write("M1.0", true, num);
- for (int i = 0; i < sleepCount && !ml_morkf.PawArrivePortOne; i++)
- {
- Thread.Sleep(sleepTime);
- if (i >= sleepCount - 1)
- {
- MessageLog.GetInstance.Show("爪子去到1号位超时");
- return false;
- }
- }
- MessageLog.GetInstance.Show("爪子去到1号位完成");
- return true;
- }
- public bool GetDistance_2(int num = 2)
- {
- MessageLog.GetInstance.Show("爪子去到2号位");
- MaterailLibrary_Write("M1.1", true, num);
- for (int i = 0; i < sleepCount && !ml_morkf.PawArrivePortTwo; i++)
- {
- Thread.Sleep(sleepTime);
- if (i >= sleepCount - 1)
- {
- MessageLog.GetInstance.Show("爪子去到2号位超时");
- return false;
- }
- }
- MessageLog.GetInstance.Show("爪子去到2号位完成");
- return true;
- }
- public bool GetDistance_3(int num = 2)
- {
- MessageLog.GetInstance.Show("爪子去到3号位");
- MaterailLibrary_Write("M1.2", true,num);
- for (int i = 0; i < sleepCount && !ml_morkf.PawArrivePortThree; i++)
- {
- Thread.Sleep(sleepTime);
- if (i >= sleepCount - 1)
- {
- MessageLog.GetInstance.Show("爪子去到3号位超时");
- return false;
- }
- }
- MessageLog.GetInstance.Show("爪子去到3号位完成");
- return true;
- }
- public void PawTurnFront(int num = 2)
- {
- MaterailLibrary_Write("", true, num);
- }
- public void PawTurnBack(int num = 2)
- {
- MaterailLibrary_Write("", true, num);
- }
-
- /// <summary>
- /// 设定机械臂的位置
- /// </summary>
- /// <param name="x"></param>
- /// <param name="y"></param>
- public bool SetArmPosition(int x, int y, int num = 2)
- {
- //取反
- x -= 2 * x;
- y -= 2 * y;
- MaterailLibrary_Write("VD836", x, num);
- Thread.Sleep(100);
- MaterailLibrary_Write("VD840", y, num);
-
- Thread.Sleep(200);
-
- MessageLog.GetInstance.Show($"机械臂移动到[{x},{y}]");
- //定位启动
- MaterailLibrary_Write("M0.0", true, num);
-
- for (int i = 0; i < sleepCount && !ml_morkf.ArriveComplete; i++)
- {
- Thread.Sleep(sleepTime);
- if (i >= sleepCount - 1)
- {
- MessageLog.GetInstance.Show("机械臂移动操作超时");
- return false;
- }
- }
-
- MessageLog.GetInstance.Show("机械臂移动操作完成");
-
- Thread.Sleep(500);
-
- return true;
- }
-
- //菜品库锁
- object lock_Materail = new object();
-
- private const int up = 10000;
-
- /// <summary>
- /// 获取菜品
- /// </summary>
- public void GetMaterail(int x,int y)
- {
- //设置到抓菜处
- if(!SetArmPosition(x, y))
- {
- return;
- }
-
- //Thread.Sleep(2000);
-
- //关闭电磁阀
- Electromagnetism(new List<bool> { true });
- Thread.Sleep(500);
-
- //爪子去1号位抓菜
- if (!GetDistance_1())
- {
- return;
- }
- Thread.Sleep(500);
-
- //移动前开启电磁阀
- Electromagnetism(new List<bool> { false });
- Thread.Sleep(500);
-
- //设置到出菜处,都在x轴-40000处出菜
- if (!SetArmPosition(-40000, y))
- {
- return;
- }
-
- Thread.Sleep(500);
- //爪子去3号位放菜
- if (!GetDistance_3())
- {
- return;
- }
- Thread.Sleep(500);
- ////关闭电磁阀
- //Electromagnetism(new List<bool> { false });
- //Thread.Sleep(300);
- }
-
- /// <summary>
- /// 获取菜品测试
- /// </summary>
- /// <param name="isGet"></param>
- private void GetMaterailTest(int getNum)
- {
- ThreadManage.GetInstance().Start(new Action(()=>{
- int x1 = 0, x2 = 0, y= 0;
-
- for (int i = 0; i < sleepCount * 2 && ml_morkf.MaterailIsWorking; i++)
- {
- Thread.Sleep(sleepTime);
- if (i >= sleepCount * 2 - 1)
- {
- MessageLog.GetInstance.Show("菜品库正在工作中.....");
- return;
- }
- }
-
- //if (!ml_morkf.InitialComplete)
- //{
- // MessageLog.GetInstance.Show("菜品库未初始化");
- // return;
- //}
- if (getNum == 0)
- {
- x2 = -20000;
- y = 40000;
-
- }
- else if (getNum == 1)
- {
- x2 = -15000;
- y = -52500;
- }
- else
- {
- MessageLog.GetInstance.Show("菜品库无效操作");
- return;
- }
- try
- {
- lock (lock_Materail)
- {
- ml_morkf.MaterailIsWorking = true;
- }
- //菜品库去指定位置
- if (!SetArmPosition(x1, y))
- {
- MessageLog.GetInstance.Show("菜品库[机械臂操作失败]");
- return;
- }
- //取菜操作
- GetMaterail(x2,y);
-
-
- //机械臂去取菜放位
- if (!SetArmPosition(-30000, -20000))
- {
- MessageLog.GetInstance.Show("菜品库[机械臂操作失败]");
- return;
- }
-
- //机械臂回原点
- if (!SetArmPosition(0, 0))
- {
- MessageLog.GetInstance.Show("菜品库[机械臂操作失败]");
- return;
- }
- }
- catch (Exception ex)
- {
-
- }
- finally
- {
- lock (lock_Materail)
- {
- ml_morkf.MaterailIsWorking = false;
- }
- }
-
- }),$"菜品库操作{getNum}");
- }
- #endregion
-
-
- #region 炒锅PLC基本操作方法
- /// <summary>
- /// 炒锅写寄存器方法,num为炒锅对应编号,从0开始
- /// </summary>
- /// <param name="address">寄存器地址</param>
- /// <param name="value">值</param>
- /// <param name="num">炒锅编号</param>
- private void FirePot_Write(string address, object value, int num)
- {
- WriteControlExact(address, value, num);
- }
-
- /// <summary>
- /// 出调料
- /// </summary>
- /// <param name="o"></param>
- public void OutSeasoning(object o, int num)
- {
- if (o == null) return;
- if (o is List<int> ints && ints.Count == 2 && morkFs.ContainsKey(num))
- {
- FirePot_Write(morkFs[num].PassWayValue[ints[0]], (ushort)ints[1], num);//写入通道值
- Thread.Sleep(400);
- FirePot_Write(morkFs[num].StartPassWay[ints[0]], true, num);//开启通道
- Thread.Sleep(400);
- FirePot_Write(morkFs[num].StartPassWay[ints[0]], false, num);//开启通道
- }
- }
-
- /// <summary>
- /// 出多个调料
- /// </summary>
- public void OutSeasonings(List<SeasoningList> seasoningLists, int num)
- {
- //防止越界
- if (!morkFs.ContainsKey(num))
- {
- return;
- }
-
- foreach (SeasoningList seasoning in seasoningLists)
- {
- FirePot_Write(morkFs[num].PassWayValue[seasoning.Loc], (ushort)seasoning.Qty, num);
- Thread.Sleep(300);
- }
- foreach (SeasoningList seasoning in seasoningLists)
- {
- FirePot_Write(morkFs[num].StartPassWay[seasoning.Loc], true, num);
- Thread.Sleep(300);
- }
- foreach (SeasoningList seasoning in seasoningLists)
- {
- FirePot_Write(morkFs[num].StartPassWay[seasoning.Loc], false, num);
- Thread.Sleep(300);
- }
-
- foreach (SeasoningList seasoning in seasoningLists)
- {
- FirePot_Write(morkFs[num].StartPassWay[seasoning.Loc], false, num);
- Thread.Sleep(300);
- }
- }
-
- /// <summary>
- /// 复位
- /// </summary>
- public void Plc1Reset(int num)
- {
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- StopFire(num);
- Thread.Sleep(200);
- StopStir(num);
- Thread.Sleep(200);
- FirePot_Write("LB5", false, num);
- Thread.Sleep(200);
- FirePot_Write("LB3", false, num);
- Thread.Sleep(200);
- FirePot_Write("LB6", false, num);
- Thread.Sleep(200);
- FirePot_Write("LB7", false, num);
- Thread.Sleep(200);
- FirePot_Write("LB4", false, num);
- Thread.Sleep(200);
- FirePot_Write("LB53", false, num);
- if (morkFs.ContainsKey(num))
- {
- foreach (var item in morkFs[num].StartPassWay.Values)
- {
- Thread.Sleep(200);
- FirePot_Write(item, false, num);
- }
- }
- }), "炒锅1初始化");
-
- }
-
- /// <summary>
- /// 炒锅初始化
- /// </summary>
- public void PLCInite()
- {
- for (int i = 0; i < morkFs.Count; i++)
- {
- FirePot_Write("LB0", true, i);
-
- for (int j = 0; j < sleepCount && !morkFs[i].FryPot1_InitialComplete; j++)
- {
- Thread.Sleep(sleepTime);
- if (j >= sleepCount - 1)
- {
- MessageLog.GetInstance.Show($"炒锅{j}初始化超时");
- }
- }
-
- //while (!morkFs[i].FryPot1_InitialComplete)
- //{
- // Thread.Sleep(500);
- //}
- FirePot_Write("LB0", false, i);
- }
- }
-
- //加油
- public void AddOil()
- {
-
- }
- //加热启动
- public void StartFire(int num)
- {
- FirePot_Write("LB1", true, num);
- Thread.Sleep(200);
- }
- //加热停止
- public void StopFire(int num)
- {
- FirePot_Write("LB1", false, num);
- Thread.Sleep(200);
- }
- //搅拌启动
- public void StartStir(int num)
- {
- FirePot_Write("LB2", true, num);
- Thread.Sleep(200);
- }
- //搅拌启停止
- public void StopStir(int num)
- {
- FirePot_Write("LB2", false, num);
- Thread.Sleep(200);
- }
- //倒菜
- public void OutFood(int num)
- {
- if (!morkFs.ContainsKey(num))
- {
- return;
- }
-
- FirePot_Write("LB3", true, num);
- MessageLog.GetInstance.Show("倒菜启动");
-
- Thread.Sleep(400);
-
- for (int i = 0; i < sleepCount && !morkFs[num].FryPot1_MaterialIntoPot; i++)
- {
- Thread.Sleep(sleepTime);
- if (i >= sleepCount - 1)
- {
- MessageLog.GetInstance.Show($"炒锅{num}倒菜超时");
- }
- }
-
- FirePot_Write("LB3", false, num);
- Thread.Sleep(200);
- MessageLog.GetInstance.Show("倒菜完成");
- }
- //搅拌臂去原点位
- public void StirArmGoOrigin(int num)
- {
- if (!morkFs.ContainsKey(num))
- {
- return;
- }
-
- FirePot_Write("LB5", true, num);
- MessageLog.GetInstance.Show("搅拌臂去原点位");
-
- for (int i = 0; i < sleepCount && !morkFs[num].ArmOnOrigin; i++)
- {
- Thread.Sleep(sleepTime);
- if (i >= sleepCount - 1)
- {
- MessageLog.GetInstance.Show($"炒锅{num}搅拌臂去原点位超时");
- }
- }
-
- //while (!morkFs[num].ArmOnOrigin)
- //{
- // Thread.Sleep(200);
- //}
- FirePot_Write("LB5", false, num);
- Thread.Sleep(200);
- MessageLog.GetInstance.Show("搅拌臂到达原点位");
-
-
-
- }
-
- //搅拌臂去炒制位
- public void StirArmGoWork(int num)
- {
- if (!morkFs.ContainsKey(num))
- {
- return;
- }
-
- if (!morkFs[num].ArmOnWorking/* && morkFs[num].PotOnOrigin*/)
- {
- FirePot_Write("LB6", true, num);
- MessageLog.GetInstance.Show("搅拌臂去工作位");
-
- for (int i = 0; i < sleepCount && !morkFs[num].ArmOnWorking; i++)
- {
- Thread.Sleep(sleepTime);
- if (i >= sleepCount - 1)
- {
- MessageLog.GetInstance.Show($"炒锅{num}搅拌臂去炒制位超时");
- }
- }
-
- //while (!morkFs[num].ArmOnWorking)
- //{
- // Thread.Sleep(200);
- //}
-
- FirePot_Write("LB6", false, num);
- Thread.Sleep(200);
- MessageLog.GetInstance.Show("搅拌臂到达工作位");
- }
-
- }
- //HBOT放盒子到位
- public void HBOTGoWork(int num)
- {
- FirePot_Write("LB7", true, num);
- Thread.Sleep(400);
- FirePot_Write("LB7", false, num);
- }
- //出餐启动
- public void OutMeal(int num)
- {
- if (!morkFs[num].ArmOnOrigin /*&& morkFs[num].PotOnOrigin*/)
- {
- MessageLog.GetInstance.Show("搅拌臂不在原点位,无法完成出餐");
- return;
- }
- FirePot_Write("LB4", true, num);
- Thread.Sleep(200);
- FirePot_Write("LB4", false, num);
- }
- //加热挡位设定
- public void SetFire(object o, int num)
- {
- if (o == null) return;
- if (o is List<int> ints && ints.Count == 1)
- {
- FirePot_Write("LW14", (ushort)ints[0], num);
- Thread.Sleep(200);
-
- }
-
- }
-
- public void SetFry(object o)
- {
- if (o == null) return;
- if (o is List<int> ints && ints.Count == 1)
- {
- fryIndex = ints[0] - 1;
- }
- }
-
- /// <summary>
- /// 搅拌挡位设定
- /// </summary>
- /// <param name="o"></param>
- public void SetStir(object o, int num)
- {
- if (o == null) return;
- if (o is List<int> ints && ints.Count == 1)
- {
- FirePot_Write("LW15", (ushort)ints[0], num);
- Thread.Sleep(200);
-
- }
- }
-
- #endregion
-
-
- bool isInitialArrive = false;
-
- bool isInitialPaw = false;
-
- #region 联网交互
- private void ServerInit()
- {
- //物料信息
- EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
- {
- if (@event == null) return;
- if (@event is MaterialDeliveryEvent material)
- {
- orderMaterialDelivery = material.orderMaterialDelivery;
-
- }
- });
-
- //配方数据信息
- EventBus.EventBus.GetInstance().Subscribe<RecipeBomEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
- {
- if (@event == null) return;
- if (@event is RecipeBomEvent recipe)
- {
- recipeBoms = recipe.recipeBoms;
- }
- });
- //小炒流程信息
- EventBus.EventBus.GetInstance().Subscribe<StirFryGoodsEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callback)
- {
- if (@event == null) return;
- if (@event is StirFryGoodsEvent stirFry)
- {
- if(stirFry.stirFrymessage != null)
- {
- if (stirFry.stirFrymessage.stirFryGoods.Count > 0)
- {
- foreach (var item in stirFry.stirFrymessage.stirFryGoods)
- {
- LocalstirFryGoods.Add(new StirFryGoods
- {
- GoodsKey = item.GoodsKey,
- StirPotActions = OrderSort(item.StirPotActions),
- });
- GlobalFoodMenu.LocalFoodMenus.Add(new FoodMenuModel
- {
- GoodKey = item.GoodsKey.ToString(),
- GoodName = "",
- });
- }
- }
- }
-
- MessageLog.GetInstance.Show("接收到小炒流程信息");
- //流程解析
- foreach (var item in LocalstirFryGoods)
- {
- MessageLog.GetInstance.Show($"添加菜谱{item.GoodsKey}");
- // morkF.listStirBom.Add(item.StirFryBomInfo);//添加订单制作流程
- string MenuStep = "菜单步骤:";
- foreach (var items in item.StirPotActions)
- {
- switch (items.Actions)
- {
- case nameof(StirFryPotActionEnum.加热开启):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位1):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位2):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位3):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位4):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位5):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位6):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位7):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位8):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位9):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位10):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.停止加热):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.加调料):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.取原料):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.开启搅拌):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置搅拌挡位1):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置搅拌挡位2):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.设置搅拌挡位3):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.关闭搅拌):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.出餐启动):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.道菜启动):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.炒制菜品):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.搅拌臂原点位):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.搅拌臂炒制位):
- MenuStep += items.Actions + ",";
- break;
- case nameof(StirFryPotActionEnum.洗锅):
- MenuStep += items.Actions + ",";
- break;
- default:
- break;
-
- }
-
-
- }
- MessageLog.GetInstance.Show(MenuStep);
-
-
-
- }
- }
- });
- }
-
- /// <summary>
- /// 订单排序
- /// </summary>
- /// <param name="potActions"></param>
- /// <returns></returns>
- private List<PotActions> OrderSort(List<PotActions> potActions)
- {
- if (potActions.Count > 1)
- {
- potActions.Sort(
- delegate (PotActions st1, PotActions st2)
- {
- //降序排列
- //return st2.FryTime.CompareTo(st1.FryTime);
-
- //升序版(颠倒 st1 和 st2 即可)
- return st1.FryTime.CompareTo(st2.FryTime);
-
- });
- }
- return potActions;
- }
-
- /// <summary>
- /// 订单状态发布
- /// </summary>
- /// <param name="subid"></param>
- /// <param name="oRDER_STATUS"></param>
- private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
- {
- EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid });
- }
-
- /// <summary>
- /// 数据解析
- /// </summary>
- private void DataParse()
- {
- //if (!morkFs.ContainsKey(num))
- //{
- // return;
- //}
-
- EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
- {
- if (@event == null) return;
- if (@event is DoOrderEvent order)
- {
- if (order.MorkOrder.GoodBatchings == null) return;
- OrderCount++;
- DeviceProcessLogShow($"接收到{OrderCount}次订单");
- Enum.GetNames(typeof(StirFryPotActionEnum));
-
- //var res = LocalstirFryGoods?.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.RecipeId);//匹配订单对应制作流程
- if(order.MorkOrder.GoodBatchings.Count <= 0)
- {
- return;
- }
-
- if(order.MorkOrder.DeviceId != DeviceId)
- {
- return;
- }
-
- //var res = LocalstirFryGoods[0];
- //if (res != null)
- //{
- // /* morkF.listStirBom.Add(res.StirFryBomInfo);*///添加订单制作流程
- // //添加到带炒小炒队列
- // if (StirFryGoodsQuenes.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
- // {
- // lock (lock_MainProcessExcute)
- // {
- // StirFryGoodsQuenes.Enqueue(new OrderLocInfo()
- // {
- // SuborderId = order.MorkOrder.SuborderId,
- // StirPotActions = res.StirPotActions,
- // GoodName = order.MorkOrder.GoodsName
- // });
- // }
- // }
- //}
-
- //暂时使用本地菜单
- StartLocalOrder();
- }
-
- });
- }
- #endregion
-
-
- private object lock_MainProcessExcute = new object();
-
- /// <summary>
- /// 炒锅主流程
- /// </summary>
- private void MainProcessExcute()
- {
- //判断是否有订单信息
- if(StirFryGoodsQuenes.Count > 0)
- {
- //遍历炒锅,找到合适、空闲的炒锅
- for(int i = 0;i<morkFs.Count;i++)
- {
- if (/*morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete &&*/
- !morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&是否在炒菜中
- {
- lock(lock_MainProcessExcute)
- {
- //待炒小炒队列出队列
- if (StirFryGoodsQuenes.TryDequeue(out var res))
- {
- //设置当前炒制菜品
- nowStirFryGood = res;
- //炒锅工作状态置为正在工作中
- morkFs[i].FryWorking = true;
- //空闲炒锅入队列
- morkFs[i].StirFryGoodsQuenes.Enqueue(res);
- MessageLog.GetInstance.Show($"炒锅{i}开始炒制菜品{res.GoodName}");
-
- //开启线程进行炒制
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- try
- {
- int getMaterailNum = 0;
- foreach (var potActions in res.StirPotActions)
- {
- if (ThreadManage.GetInstance().IsCanncel(String.Format(striConst, i.ToString(), nowStirFryGood.GoodName)))
- {
- return;
- }
-
- switch (potActions.Actions)
- {
- case nameof(StirFryPotActionEnum.加热开启):
- StartFire(i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位1):
- SetFire(new List<int> { 1 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位2):
- SetFire(new List<int> { 2 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位3):
- SetFire(new List<int> { 3 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位4):
- SetFire(new List<int> { 4 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位5):
- SetFire(new List<int> { 5 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位6):
- SetFire(new List<int> { 6 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位7):
- SetFire(new List<int> { 7 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位8):
- SetFire(new List<int> { 8 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位9):
- SetFire(new List<int> { 9 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置加热挡位10):
- SetFire(new List<int> { 10 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.停止加热):
- StopFire(i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.加调料):
- OutSeasonings(potActions.SeasoningLists, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.取原料):
- GetMaterailTest(getMaterailNum);
- getMaterailNum++;
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.开启搅拌):
- StartStir(i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置搅拌挡位1):
- SetStir(new List<int> { 1 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置搅拌挡位2):
- SetStir(new List<int> { 2 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.设置搅拌挡位3):
- SetStir(new List<int> { 3 }, i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.关闭搅拌):
- StopStir(i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.出餐启动):
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.道菜启动):
- OutFood(i);
- break;
- case nameof(StirFryPotActionEnum.炒制菜品):
- Thread.Sleep(potActions.During * 1000);
- break;
- case nameof(StirFryPotActionEnum.搅拌臂原点位):
- StirArmGoOrigin(i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.搅拌臂炒制位):
- StirArmGoWork(i);
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- case nameof(StirFryPotActionEnum.洗锅):
- MessageLog.GetInstance.Show(potActions.Actions);
- break;
- default:
- break;
-
- }
- }
-
-
- Plc1Reset(i);//复位
- Thread.Sleep(3000);
- //回原点位
- StirArmGoOrigin(i);
-
- //while (!morkFs[i].ArmOnOrigin)
- //{
- // Thread.Sleep(100);
- //}
- //出餐
- //OutMeal(i);
- MessageLog.GetInstance.Show($"菜品{res.GoodName}完成");
-
-
- }
- catch (Exception ex)
- {
- ThreadManage.GetInstance().StopTask($"炒锅{i}{res.GoodName}炒制线程");
- MessageLog.GetInstance.Show($"炒锅{i}炒制菜品{res.GoodName}出错,错误信息:" + ex.Message);
- }
- finally
- {
- nowStirFryGood = null;
- //炒完后出队列
- morkFs[i].StirFryGoodsQuenes.TryDequeue(out var orderQueue);
- morkFs[i].FryWorking = false;
- }
- }), String.Format(striConst, i.ToString(), nowStirFryGood.GoodName)/*$"炒锅{i}炒制{res.GoodName}线程"*/);
- }
- }
- break;
- }
- }
- }
- }
-
- /// <summary>
- /// 信号处理
- /// </summary>
- private void SingleProcess()
- {
-
- //if (!morkF.AutoMode)
- //{
- // if (morkF.IsAuto)
- // {
- // Plc1Reset();
- // morkF.IsAuto = false;
- // }
- //}
- //else morkF.IsAuto = true;
-
-
-
- }
-
- public override void SimOrder()
- {
- ActionManage.GetInstance.Register(morkSim, "模拟小炒锅1订单");
- }
-
- private void morkSim(object o)
- {
- //if (o == null) return;
- //if(o is List<int> ins)
- //{
- // ThreadManage.GetInstance().Start(new Action(() =>
- // {
- // if (morkF.FryPot1_InitialComplete && morkF.AutoMode)//初始化完成&&自动模式&& 锅在原点位置
- // {
- // if (!morkF.ArmOnWorking)//搅拌臂是否在工作位
- // {
- // StirArmGoWork();
-
- // while (!morkF.ArmOnWorking)
- // {
- // Thread.Sleep(500);
- // }
- // OutSeasoning(new List<int> { 1, 100 });//加油500g
- // while (!morkF.PassWay1_1Compelete)
- // {
- // Thread.Sleep(1000);
- // }
- // WriteControlExact(morkF.StartPassWay[ 1], false);//开启通道关闭
- // Thread.Sleep(500);
- // SetFire(new List<int> { ins[1] });//加热三档
-
- // StartFire();//开始加热
- // Thread.Sleep(500);
- // SetStir(new List<int> { ins[2] });//搅拌二挡
- // Thread.Sleep(500);
- // StartStir();//开始搅拌
- // Thread.Sleep(ins[0]*1000);//加热10s
-
- // OutSeasoning(new List<int> { 11, 30 });//加调料1 50g
- // Thread.Sleep(400);
- // OutSeasoning(new List<int> { 12, 30 });//加调料2 30g
- // while (!morkF.PassWay1_11Compelete&& !morkF.PassWay1_12Compelete)
- // {
- // Thread.Sleep(1000);
- // }
-
-
-
-
- // WriteControlExact(morkF.StartPassWay[11], false);//开启通道关闭
- // Thread.Sleep(500);
- // WriteControlExact(morkF.StartPassWay[12], false);//开启通道信号关闭
-
-
-
- // Thread.Sleep(500);
-
- // OutFood();//倒菜品1
- // while (!morkF.FryPot1_MaterialIntoPot)//菜品1倒菜完成
- // {
- // Thread.Sleep(500);
- // }
- // WriteControlExact("LB53", false);
- // Thread.Sleep(500);
- // SetFire(new List<int> { ins[4] });//菜品1加热档
- // Thread.Sleep(500);
- // SetStir(new List<int>() { ins[5] });//菜品1搅拌挡
- // Thread.Sleep(ins[3]*1000);//菜品1炒制时间
-
- // OutSeasoning(new List<int> {3, 8 });//加调料3 20g
- // while (!morkF.PassWay1_3Compelete)
- // {
- // Thread.Sleep(1000);
- // }
- // WriteControlExact(morkF.StartPassWay[3], false);//开启通道信号关闭
- // Thread.Sleep(500);
- // OutFood();//倒菜菜品2
- // while (!morkF.FryPot1_MaterialIntoPot)//菜品2倒菜完成
- // {
- // Thread.Sleep(500);
- // }
- // WriteControlExact("LB53", false);
- // Thread.Sleep(500);
- // SetFire(new List<int> { ins[7] });//菜品2加热档
- // Thread.Sleep(500);
- // SetStir(new List<int>() { ins[8] });//菜品2搅拌挡
- // Thread.Sleep(ins[6] * 1000);//菜品2炒制时间
-
-
-
- // StopStir();//停止搅拌
- // Thread.Sleep(500);
- // StopFire();//停止加热
- // Thread.Sleep(2000);
- // StirArmGoOrigin();//搅拌臂回原点位
- // }
- // }
- // }), "模拟炒锅1订单");
- //}
-
-
- }
- }
- }
|