diff --git a/HBLConsole.Factory/SimpleFactory.cs b/HBLConsole.Factory/SimpleFactory.cs index 6e53e2c..c69862f 100644 --- a/HBLConsole.Factory/SimpleFactory.cs +++ b/HBLConsole.Factory/SimpleFactory.cs @@ -139,7 +139,7 @@ namespace HBLConsole.Factory control?.Init(); //ActionManage.GetInstance.Register(new Action((o) => { control?.DataParse(o); }), "DataParse"); ActionManage.GetInstance.Register(new Action(() => { control?.ConnectOk(); }), $"{GeneralConfig.DeviceType.ToString()}/ConnectOk"); - ActionManage.GetInstance.Register(new Action((o) => { control?.SimOrder(o); }), "SimOrder"); + ActionManage.GetInstance.Register(new Action((o) => { control?.SimOrder(o); }), "SimOrder");//模拟订单委托注册 ActionManage.GetInstance.Register(new Action((o) => { control?.IotBroadcast(o); }), "IotBroadcast"); ConnectHelper.GetInstance.Init(); ActionManage.GetInstance.Send("监控数据初始化"); diff --git a/HBLConsole.GVL/InternetInfo.cs b/HBLConsole.GVL/InternetInfo.cs index 4fbcdee..4932056 100644 --- a/HBLConsole.GVL/InternetInfo.cs +++ b/HBLConsole.GVL/InternetInfo.cs @@ -11,6 +11,8 @@ using System.Threading; using HBLConsole.Service; using BPA.ApolloClient; using BPA.Message; +using Com.Ctrip.Framework.Apollo; +using Com.Ctrip.Framework.Apollo.Logging; namespace HBLConsole.GVL { @@ -51,12 +53,16 @@ namespace HBLConsole.GVL deviceId = int.Parse(System.Configuration.ConfigurationManager.AppSettings["deviceId"]); IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()); - configurationBuilder.AddApolloConfiguration(p => - { - p.AppId = "dev1_order"; - p.MetaServer = apolloUri; - p.Namespaces = new List() { "DEV.Config" }; - }); + LogManager.UseConsoleLogging(LogLevel.Info); + var apolloBuilder = configurationBuilder.AddApollo(new ApolloOptions { AppId = "dev1_order", MetaServer = "http://111.9.47.105:28080/" }); + apolloBuilder.AddDefault(); + apolloBuilder.AddNamespace("DEV.Config"); + //configurationBuilder.AddApolloConfiguration(p => + //{ + // p.AppId = "dev1_order"; + // p.MetaServer = apolloUri; + // p.Namespaces = new List() { "DEV.Config" }; + //}); IConfiguration config = configurationBuilder.Build(); var mqttBroker = config.GetSection("BrokerHostSettings"); MQTT_Config = mqttBroker.Value.FromJSON(); diff --git a/HBLConsole.MORKM/Control_MORKM.cs b/HBLConsole.MORKM/Control_MORKM.cs index aeb9cbc..4e1bd6d 100644 --- a/HBLConsole.MORKM/Control_MORKM.cs +++ b/HBLConsole.MORKM/Control_MORKM.cs @@ -373,7 +373,7 @@ namespace HBLConsole.MORKM mORKS.TakeBowlId = orderLocInfo.SuborderId; TakeBowlControl(orderLocInfo.Loc); SetRecipeNumber(orderLocInfo.RecipeNumber); - SimpleFactory.GetInstance.OrderChanged(mORKS.TakeBowlId, ORDER_STATUS.COOKING); + // SimpleFactory.GetInstance.OrderChanged(mORKS.TakeBowlId, ORDER_STATUS.COOKING); MessageLog.GetInstance.Show($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]"); } mORKS.TakeBowlInterlock = true; @@ -469,16 +469,20 @@ namespace HBLConsole.MORKM //取面控制 if (mORKS.AllowRun && mORKS.RobotIdle && !mORKS.Feeding && !mORKS.RobotTaskInterlock && mORKS.AllowTakeNoodle && mORKS.TurntableMoveInPlace && !mORKS.TakeNoodleInterlock && !mORKS.OutNoodleing && mORKS.RBTakeNoodleTask.Count > 0) { + int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置 if (loc >= 0 && loc <= 5) { + if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo)) { - mORKS.CookNodelId[loc] = orderLocInfo.SuborderId; + + // mORKS.CookNodelId[loc] = orderLocInfo.SuborderId; + mORKS.orderLocInfos[loc] = orderLocInfo; SetFallNoodleLoc((ushort)(loc + 1)); //机器人开始取面 RobotTakeNoodle(); - SimpleFactory.GetInstance.OrderChanged(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); + // SimpleFactory.GetInstance.OrderChanged(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); MessageLog.GetInstance.Show($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏"); //写入煮面时间 @@ -490,6 +494,7 @@ namespace HBLConsole.MORKM mORKS.TakeNoodleInterlock = true; } } + } } @@ -500,267 +505,446 @@ namespace HBLConsole.MORKM { if (mORKS.AllowFallNoodle && mORKS.RobotTaskInterlock && !mORKS.TakeNoodleInterlock && mORKS.RobotIdle && !mORKS.TakeMealDetect) { - int loc = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0); + + int loc = 0; + mORKS.exlusion = false; + //int loc = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0); + if (Array.FindLastIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0) == -1) + { + loc = -1; + } + else + { + if (mORKS.orderLocInfos[Array.FindLastIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0)].Loc % 2 != 0 && mORKS.orderLocInfos[Array.FindIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0)].Loc % 2 != 0 && Array.FindLastIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0) != Array.FindIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0)) + { + loc = Array.FindIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0); + mORKS.AllMeat = true; + } + else + { + if (mORKS.Count > 0) + { + loc = Array.FindLastIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0); + } + else + { + loc = Array.FindIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0); + } + } + } + // int locLast= Array.FindLastIndex(mORKS.orderLocInfos, p => p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0); + //string[] number = Array.FindAll(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0); + + //List list = new List();//存储位置信息 + //for (int i = 0; i < mORKS.CookNodelId.Length; i++) + //{ + // if ((mORKS.CookNodelId[i] == mORKS.IngredientsCompleteId) && mORKS.CookNodelId[i].Length > 0) + // { + // list.Add(i); + // } + //} + //for (int j = 0; j < list.Count; j++) + //{ + // if (list[j] >= 0 && list[j] <= 5) + // { + // if (mORKS.CookNoodlesComplete[list[j]]) + // { + // SetTakeNoodleLoc((ushort)(list[j] + 1)); + // RobotOutMeal(); + // CookNoodleStatusReset((ushort)(list[j] + 1)); + // ResetAllowFallNoodle(); + // mORKS.OutMealId = mORKS.IngredientsCompleteId; + // mORKS.CookNodelId[list[j]] = string.Empty; + // MessageLog.GetInstance.Show($"{list[j] + 1}号位置出餐控制"); + // mORKS.OutNoodleing = true; + // } + // } + //} + + //if (mORKS.CookNodelId.GetIndex(mORKS.OutMealId) < 0) + //{ + // mORKS.IngredientsCompleteId = string.Empty; + // CookComplete();//告诉机器人冒菜已经煮完 + //} + //-----------------------------------------------------------------------// if (loc >= 0 && loc <= 5) { if (mORKS.CookNoodlesComplete[loc]) { - SetTakeNoodleLoc((ushort)(loc + 1)); - RobotOutMeal(); - CookNoodleStatusReset((ushort)(loc + 1)); - ResetAllowFallNoodle(); - mORKS.OutMealId = mORKS.IngredientsCompleteId; - mORKS.IngredientsCompleteId = string.Empty; - mORKS.CookNodelId[loc] = string.Empty; - - if (mORKS.CookNodelId.GetIndex(mORKS.OutMealId) < 0) + + if (mORKS.orderLocInfos[loc].Loc % 2 == 0)//素 + { + SetTakeNoodleLoc((ushort)(loc + 1)); + RobotOutMeal(); + CookNoodleStatusReset((ushort)(loc + 1)); + // ResetAllowFallNoodle(); + mORKS.OutMealId = mORKS.IngredientsCompleteId; + // mORKS.CookNodelId[loc] = string.Empty; + mORKS.orderLocInfos[loc] = null; + mORKS.Count++; + MessageLog.GetInstance.Show($"{loc + 1}号位置出餐控制"); + mORKS.OutNoodleing = true; + mORKS.Num = 0; + foreach (var item in mORKS.orderLocInfos) + { + if (item != null) + { + if (item.SuborderId == mORKS.OutMealId) + { + mORKS.Num++; + } + } + + } + if (mORKS.Num != 0) + Thread.Sleep(3000); + } + else if (mORKS.Count > 0&&mORKS.orderLocInfos[loc].Loc % 2 != 0)//荤 { + SetTakeNoodleLoc((ushort)(loc + 1)); + RobotOutMeal(); + CookNoodleStatusReset((ushort)(loc + 1)); + // ResetAllowFallNoodle(); + mORKS.OutMealId = mORKS.IngredientsCompleteId; + // mORKS.CookNodelId[loc] = string.Empty; + mORKS.orderLocInfos[loc] = null; + mORKS.Count++; + MessageLog.GetInstance.Show($"{loc + 1}号位置出餐控制"); + mORKS.OutNoodleing = true; + //Thread.Sleep(3000); + //------------------------// + mORKS.Num = 0; + foreach (var item in mORKS.orderLocInfos) + { + if (item != null) + { + if (item.SuborderId == mORKS.OutMealId) + { + mORKS.Num++; + } + } + + } + if (mORKS.Num == 0) + { + + CookComplete(); //告诉机器人冒菜已经煮完 + ResetAllowFallNoodle(); + mORKS.exlusion = true; + mORKS.Count = 0; + mORKS.IngredientsCompleteId = string.Empty; + mORKS.TakeBowlId = string.Empty; + mORKS.TakeBowlInterlock = false; + //IsAddSoup();//判断是否加汤 + } + } + else + { + + if (mORKS.AllMeat) + { + SetTakeNoodleLoc((ushort)(loc + 1)); + RobotOutMeal(); + CookNoodleStatusReset((ushort)(loc + 1)); + // ResetAllowFallNoodle(); + mORKS.OutMealId = mORKS.IngredientsCompleteId; + // mORKS.CookNodelId[loc] = string.Empty; + mORKS.orderLocInfos[loc] = null; + // mORKS.Count++; + MessageLog.GetInstance.Show($"{loc + 1}号位置出餐控制"); + mORKS.OutNoodleing = true; + + mORKS.Num = 0; + foreach (var item in mORKS.orderLocInfos) + { + if (item != null) + { + if (item.SuborderId == mORKS.OutMealId) + { + mORKS.Num++; + } + } + + } + if (mORKS.Num != 0) + Thread.Sleep(3000); + } + else + { + mORKS.Count++; + mORKS.OutMealId = mORKS.IngredientsCompleteId; + } + + } + mORKS.Num = 0; + foreach (var item in mORKS.orderLocInfos) + { + if (item != null) + { + if (item.SuborderId == mORKS.OutMealId) + { + mORKS.Num++; + } + } + + } + if (mORKS.Num == 0&&mORKS.exlusion==false) + { + CookComplete(); //告诉机器人冒菜已经煮完 + ResetAllowFallNoodle(); + mORKS.AllMeat = false; + mORKS.Count = 0; + mORKS.IngredientsCompleteId = string.Empty; + mORKS.TakeBowlId = string.Empty; + mORKS.TakeBowlInterlock = false; //IsAddSoup();//判断是否加汤 } - MessageLog.GetInstance.Show($"{loc + 1}号位置出餐控制"); - mORKS.OutNoodleing = true; + } + } } } - /// - /// 信号检测 - /// - private void SingleDetect() - { - //允许倒面信号检测 - if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowFallNoodle)) + /// + /// 信号检测 + /// + private void SingleDetect() { - mORKS.IngredientsCompleteId = mORKS.TakeBowlId; - mORKS.TakeBowlId = string.Empty; - MessageLog.GetInstance.Show($"碗到位,允许到面,{mORKS.IngredientsCompleteId}"); - mORKS.TakeBowlInterlock = false; - } + //允许倒面信号检测 + if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowFallNoodle)) + { + mORKS.IngredientsCompleteId = mORKS.TakeBowlId; + // mORKS.TakeBowlId = string.Empty; + MessageLog.GetInstance.Show("碗到位,允许到面"); + //MessageLog.GetInstance.Show($"碗到位,允许到面,{mORKS.IngredientsCompleteId}"); + // mORKS.TakeBowlInterlock = false; + } - //出餐完成信号检测 - if (RTrig.GetInstance("CompleteChange").Start(mORKS.RbOutMealComplete)) - { - SimpleFactory.GetInstance.OrderChanged(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK); - MessageLog.GetInstance.Show($"订单【{mORKS.OutMealId}】制作完成"); - mORKS.OutNoodleing = false; - } + //出餐完成信号检测 + if (RTrig.GetInstance("CompleteChange").Start(mORKS.RbOutMealComplete)) + { + // SimpleFactory.GetInstance.OrderChanged(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK); + MessageLog.GetInstance.Show($"订单【{mORKS.OutMealId}】制作完成"); + mORKS.OutNoodleing = false; + } - //取餐完成逻辑处理 - if (DelayRTrig.GetInstance("CompleteChange1").Start(mORKS.RbOutMealComplete && !mORKS.TakeMealDetect, 2)) - { - SimpleFactory.GetInstance.OrderChanged(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); - MessageLog.GetInstance.Show($"订单【{mORKS.OutMealId}】取餐完成"); - ResetCookComplete(); - mORKS.OutMealId = string.Empty; - } + //取餐完成逻辑处理 + if (DelayRTrig.GetInstance("CompleteChange1").Start(mORKS.RbOutMealComplete && !mORKS.TakeMealDetect, 2)) + { + // SimpleFactory.GetInstance.OrderChanged(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); + MessageLog.GetInstance.Show($"订单【{mORKS.OutMealId}】取餐完成"); + ResetCookComplete(); + mORKS.OutMealId = string.Empty; + } - //机器人取面完成信号检测 - if (RTrig.GetInstance("TakeNoodleComplete").Start(mORKS.RbTakeNoodleComplete)) - { - mORKS.TakeNoodleInterlock = false; - mORKS.AllowTakeNoodle = false; - mORKS.TurntableInterlock = false; - MessageLog.GetInstance.Show("机器人取面完成信号检测"); - TakeNoodleCompleteReset(); - } + //机器人取面完成信号检测 + if (RTrig.GetInstance("TakeNoodleComplete").Start(mORKS.RbTakeNoodleComplete)) + { + mORKS.TakeNoodleInterlock = false; + mORKS.AllowTakeNoodle = false; + mORKS.TurntableInterlock = false; + MessageLog.GetInstance.Show("机器人取面完成信号检测"); + TakeNoodleCompleteReset(); + } - //转台到位检测 - //if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.TurntableMoveInPlace)) - //{ - // mORKS.TurntableInterlock = false; - //} + //转台到位检测 + //if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.TurntableMoveInPlace)) + //{ + // mORKS.TurntableInterlock = false; + //} - int OutMealRequstCount = mORKS.CookNoodlesComplete.Where(p => p == true).ToList().Count; - int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count; - mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowFallNoodle && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0); - } + int OutMealRequstCount = mORKS.CookNoodlesComplete.Where(p => p == true).ToList().Count; + int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count; + mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowFallNoodle && (mlCount >=2 || mORKS.RBTakeNoodleTask.Count == 0); + } - #region PLC 控制函数 + #region PLC 控制函数 - /// - /// 写入配方数据到 PLC - /// - private void WriteRecipeBoms() - { - List recipeBoms = new List(); - if (Json.Data.recipeBoms == null) return; - foreach (var item in Json.Data.recipeBoms.RecipeIds) + /// + /// 写入配方数据到 PLC + /// + private void WriteRecipeBoms() { - foreach (var rec in item.Recipes) + List recipeBoms = new List(); + if (Json.Data.recipeBoms == null) return; + foreach (var item in Json.Data.recipeBoms.RecipeIds) { - recipeBoms.Add((ushort)rec); + foreach (var rec in item.Recipes) + { + recipeBoms.Add((ushort)rec); + } } - } - if (recipeBoms.Count > 0) - { - if (ModbusTcpHelper.GetInstance.Write(1100, WriteType.HoldingRegisters, recipeBoms.ToArray())) + if (recipeBoms.Count > 0) { - MessageLog.GetInstance.Show("成功写入配方数据"); + if (ModbusTcpHelper.GetInstance.Write(1100, WriteType.HoldingRegisters, recipeBoms.ToArray())) + { + MessageLog.GetInstance.Show("成功写入配方数据"); + } } + else { MessageLog.GetInstance.Show("配方数据为空"); } } - else { MessageLog.GetInstance.Show("配方数据为空"); } - } - /// - /// 转台移动 - /// - //private void MoveTurntable() - //{ - // //ModbusTcpHelper.GetInstance.Write(325, WriteType.Coils, true); - //} - - /// - /// 取面完成复位 - /// - private void TakeNoodleCompleteReset() - { - ModbusTcpHelper.GetInstance.Write(1124, WriteType.Coils, false); - } + /// + /// 转台移动 + /// + //private void MoveTurntable() + //{ + // //ModbusTcpHelper.GetInstance.Write(325, WriteType.Coils, true); + //} - /// - /// 指定煮面口状态复位 - /// - /// - private void CookNoodleStatusReset(int num) - { - if (num >= 1 && num <= 6) + /// + /// 取面完成复位 + /// + private void TakeNoodleCompleteReset() { - ushort addRess = (ushort)(1136 + num - 1); - ModbusTcpHelper.GetInstance.Write(addRess, WriteType.Coils, false); - MessageLog.GetInstance.Show($"{num}号煮面口占用复位"); + ModbusTcpHelper.GetInstance.Write(1124, WriteType.Coils, false); } - } - - /// - /// 写配方编号 - /// - /// - private void SetRecipeNumber(ushort num) - { - ModbusTcpHelper.GetInstance.Write(100, WriteType.HoldingRegisters, num); - } - - /// - /// 启动转台 - /// - /// - private void TurntableStart(ushort loc) - { - mORKS.CurrentLoc = loc; - mORKS.TurntableInterlock = true; - mORKS.TurntableLocLists.Add(loc); - ModbusTcpHelper.GetInstance.Write(101, WriteType.HoldingRegisters, loc); - ModbusTcpHelper.GetInstance.Write(325, WriteType.Coils, true); - } + /// + /// 指定煮面口状态复位 + /// + /// + private void CookNoodleStatusReset(int num) + { + if (num >= 1 && num <= 6) + { + ushort addRess = (ushort)(1136 + num - 1); + ModbusTcpHelper.GetInstance.Write(addRess, WriteType.Coils, false); + MessageLog.GetInstance.Show($"{num}号煮面口占用复位"); + } - /// - /// 设置倒面位置 - /// - /// - private void SetFallNoodleLoc(ushort loc) - { - ModbusTcpHelper.GetInstance.Write(102, WriteType.HoldingRegisters, loc); - } + } - /// - /// 设置取面位置 - /// - /// - private void SetTakeNoodleLoc(ushort loc) - { - ModbusTcpHelper.GetInstance.Write(103, WriteType.HoldingRegisters, loc); - } + /// + /// 写配方编号 + /// + /// + private void SetRecipeNumber(ushort num) + { + ModbusTcpHelper.GetInstance.Write(100, WriteType.HoldingRegisters, num); + } - /// - /// 取碗控制 - /// - /// - private void TakeBowlControl(ushort loc) - { - if (loc == 10)//小碗 + /// + /// 启动转台 + /// + /// + private void TurntableStart(ushort loc) { - ModbusTcpHelper.GetInstance.Write(321, WriteType.Coils, true); + mORKS.CurrentLoc = loc; + mORKS.TurntableInterlock = true; + mORKS.TurntableLocLists.Add(loc); + ModbusTcpHelper.GetInstance.Write(101, WriteType.HoldingRegisters, loc); + ModbusTcpHelper.GetInstance.Write(325, WriteType.Coils, true); } - else if (loc == 11)//大碗 + + /// + /// 设置倒面位置 + /// + /// + private void SetFallNoodleLoc(ushort loc) { - ModbusTcpHelper.GetInstance.Write(322, WriteType.Coils, true); + ModbusTcpHelper.GetInstance.Write(102, WriteType.HoldingRegisters, loc); } - } - /// - /// 机器人取面 - /// - private void RobotTakeNoodle() - { - ModbusTcpHelper.GetInstance.Write(323, WriteType.Coils, true); - } + /// + /// 设置取面位置 + /// + /// + private void SetTakeNoodleLoc(ushort loc) + { + ModbusTcpHelper.GetInstance.Write(103, WriteType.HoldingRegisters, loc); + } - /// - /// 机器人取餐 - /// - private void RobotOutMeal() - { - ModbusTcpHelper.GetInstance.Write(324, WriteType.Coils, true); - var result = ModbusTcpHelper.GetInstance.Read(324, ReadType.Coils); - if (result is bool res) - while (!res) + /// + /// 取碗控制 + /// + /// + private void TakeBowlControl(ushort loc) + { + if (loc == 10)//小碗 { - ModbusTcpHelper.GetInstance.Write(324, WriteType.Coils, true); + ModbusTcpHelper.GetInstance.Write(321, WriteType.Coils, true); } - } + else if (loc == 11)//大碗 + { + ModbusTcpHelper.GetInstance.Write(322, WriteType.Coils, true); + } + } - /// - /// 制作完成信号复位 - /// - private void ResetCookComplete() - { - ModbusTcpHelper.GetInstance.Write(1126, WriteType.Coils, false); - } + /// + /// 机器人取面 + /// + private void RobotTakeNoodle() + { + ModbusTcpHelper.GetInstance.Write(323, WriteType.Coils, true); + } - /// - /// 复位允许取面信号 - /// - private void ResetAllowFallNoodle() - { - ModbusTcpHelper.GetInstance.Write(1123, WriteType.Coils, false); - } + /// + /// 机器人取餐 + /// + private void RobotOutMeal() + { + ModbusTcpHelper.GetInstance.Write(324, WriteType.Coils, true); + var result = ModbusTcpHelper.GetInstance.Read(324, ReadType.Coils); + if (result is bool res) + while (!res) + { + ModbusTcpHelper.GetInstance.Write(324, WriteType.Coils, true); + } + } - /// - /// 设备初始化 - /// - public async void DeviceInit() - { - ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, true); - await Task.Delay(1000); - ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, false); + /// + /// 制作完成信号复位 + /// + private void ResetCookComplete() + { + ModbusTcpHelper.GetInstance.Write(1126, WriteType.Coils, false); + } - } + /// + /// 复位允许取面信号 + /// + private void ResetAllowFallNoodle() + { + ModbusTcpHelper.GetInstance.Write(1123, WriteType.Coils, false); + } - /// - /// 制作完成,允许机器人往外推碗 - /// - public void CookComplete() - { - ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M0.6"), WriteType.Coils, true); - } + /// + /// 设备初始化 + /// + public async void DeviceInit() + { + ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, true); + await Task.Delay(1000); + ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, false); + + } + + /// + /// 制作完成,允许机器人往外推碗 + /// + public void CookComplete() + { + ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M0.6"), WriteType.Coils, true); + } + + /// + /// 是否加汤 + /// + public void IsAddSoup() + { + ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M0.7"), WriteType.Coils, true); + } + #endregion - /// - /// 是否加汤 - /// - public void IsAddSoup() - { - ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M0.7"), WriteType.Coils, true); - } - #endregion + } } -} diff --git a/HBLConsole.MORKM/GVL_MORKM.cs b/HBLConsole.MORKM/GVL_MORKM.cs index 4ac359f..a1cc789 100644 --- a/HBLConsole.MORKM/GVL_MORKM.cs +++ b/HBLConsole.MORKM/GVL_MORKM.cs @@ -331,7 +331,7 @@ namespace HBLConsole.MORKM /// 煮面口对应的订单ID /// public string[] CookNodelId = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, }; - + public OrderLocInfo[] orderLocInfos = new OrderLocInfo[6] { null,null,null,null,null,null}; /// /// 出餐订单ID /// @@ -348,6 +348,16 @@ namespace HBLConsole.MORKM [VariableMonitor("转台当前启动位置")] public ushort CurrentLoc { get; set; } = 0; + //public ConcurrentQueue MeatDish{ get; set; }//荤菜 + + //public ConcurrentQueue VegetablesDish { get; set; }//素菜 + + public int Num { get; set; } //记录同一个订单是否所有配菜均已出锅 + + public int Count { get; set; } + + public bool exlusion { get; set; } //互斥 + public bool AllMeat { get; set; } #endregion } } diff --git a/HBLConsole.MainConsole/Main.cs b/HBLConsole.MainConsole/Main.cs index 7ba26e4..c981627 100644 --- a/HBLConsole.MainConsole/Main.cs +++ b/HBLConsole.MainConsole/Main.cs @@ -44,7 +44,7 @@ namespace HBLConsole.MainConsole Json.Data.parSets.Add(new ParSet() { CheckBoxContext = $"煮面口{i + 1}屏蔽", - Minute = 0, + Minute = 1, Second = 0, IsShield = false, TextBlockContext = $"煮面口{i + 1}时间设定"