taoye пре 2 година
родитељ
комит
b090655a2b
3 измењених фајлова са 183 додато и 155 уклоњено
  1. +10
    -3
      BPASmartClient.MorkF/Control_MorkF.cs
  2. +168
    -150
      BPASmartClient.MorkM/Control_MORKM.cs
  3. +5
    -2
      BPASmartClient.MorkM/OrderLocInfo.cs

+ 10
- 3
BPASmartClient.MorkF/Control_MorkF.cs Прегледај датотеку

@@ -68,7 +68,6 @@ namespace BPASmartClient.MorkF
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T3, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入A料 }, PotActions = new List<StirFryPotAction>() { StirFryPotAction.加油, StirFryPotAction.搅拌臂下位, StirFryPotAction.低速旋转 }, During = 6 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T4, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止旋转, StirFryPotAction.停止火力, StirFryPotAction.搅拌臂上位 } });//加A料
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T5, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入B料 }, PotActions = new List<StirFryPotAction>() { StirFryPotAction.中火持续, StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 6 });

stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T6, PotActions = new List<StirFryPotAction>() { StirFryPotAction.停止火力, StirFryPotAction.停止旋转, StirFryPotAction.搅拌臂上位 } });//加B料

stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T7, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.加入C料 }, PotActions = new List<StirFryPotAction>() { StirFryPotAction.中火持续, StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 9 });
@@ -225,6 +224,7 @@ namespace BPASmartClient.MorkF
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId, MaterialLoc = 3 });//C料
morkF.TakePlateQueue.Enqueue(new OrderLocInfo() { SuborderId = subId });
resultorder.AddRange(new int[] { 1, 2, 3 });
morkF.listStirBom.Add(stirFryBom);
}
#endregion

@@ -347,6 +347,7 @@ namespace BPASmartClient.MorkF
{
if (ushort.TryParse(res.BatchingLoc, out ushort loc))
{
//if (morkF.TakeMaterialQueue.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
//将一个商品的ABC料位置存入队列
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId, MaterialLoc = ushort.Parse(res.BatchingLoc) });
@@ -726,7 +727,7 @@ namespace BPASmartClient.MorkF
//{
// Task.Delay(5).Wait();
//}
while ((!morkF.CleanModule||!morkF.SecondCleanModule)&&(!morkF.KitchenOneStatus||!morkF.KitchenSecondStatus)&&(morkF.CleanComplete|| morkF.SecondCleanComplete))//等待取锅条件满足
while (!(!morkF.CleanModule||!morkF.SecondCleanModule)&&(!morkF.KitchenOneStatus||!morkF.KitchenSecondStatus)&&(morkF.CleanComplete|| morkF.SecondCleanComplete))//等待取锅条件满足
{
Task.Delay(5).Wait();
}
@@ -736,6 +737,7 @@ namespace BPASmartClient.MorkF
}
TakePotToKitchen();
WriteData("M1.5", false);//清洗模组1完成复位
WriteData("M2.0", false);//清洗模组2完成复位
MessageLog.GetInstance.Show($"订单【{ morkF.CurrentOrderId}】执行取锅到灶台控制");
while (!morkF.PutPotToKitchenComlete)
{
@@ -863,10 +865,15 @@ namespace BPASmartClient.MorkF
/// </summary>
private void OutDishTask()
{
while (morkF.RoobotIdle || morkF.CleanModule || !morkF.ProvidePlateComplete)//等待条件满足
//while (morkF.RoobotIdle || morkF.CleanModule || !morkF.ProvidePlateComplete)//等待条件满足
//{
// Task.Delay(5).Wait();
//}
while (morkF.RoobotIdle || (!morkF.CleanComplete && !morkF.SecondCleanComplete) || !morkF.ProvidePlateComplete)//等待条件满足
{
Task.Delay(5).Wait();
}
if (morkF.TakePlateQueue.Count == 0)
{
WriteData("M0.7", false);//无订单关闭抽风机


+ 168
- 150
BPASmartClient.MorkM/Control_MORKM.cs Прегледај датотеку

@@ -13,6 +13,8 @@ using BPASmartClient.EventBus;
using static BPASmartClient.EventBus.EventBus;
using BPASmartClient.MorkS.ViewModel;
using BPASmartClient.MorkM.Model;
using System.Collections.ObjectModel;
using BPASmartClient.Model.PLC;

namespace BPASmartClient.MorkM
{
@@ -44,10 +46,10 @@ namespace BPASmartClient.MorkM
// string guid = new Guid().ToString();

// mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid });
// MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】");
// DeviceProcessLogShow($"添加订单:面条位置【{NoodleLoc}】");

// mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid });
// MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】");
// DeviceProcessLogShow($"添加订单:碗位置【{BowlLoc}】");
// Thread.Sleep(60000);
// }), "ForOrder");
// }), "EnableForOrder");
@@ -61,7 +63,7 @@ namespace BPASmartClient.MorkM
// }));
// }), "StopForOrder");

// MessageLog.GetInstance.Show("MORKM 设备初始化完成");
// DeviceProcessLogShow("MORKM 设备初始化完成");
//}

//private void ResetProgram()
@@ -192,12 +194,12 @@ namespace BPASmartClient.MorkM
// {
// orders.Add(new OrderLocInfo() { Loc = item, SuborderId = subId, MakeType = false });
// //mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = item, SuborderId = subId });
// //MessageLog.GetInstance.Show($"添加订单:面条位置【{item}】");
// //DeviceProcessLogShow($"添加订单:面条位置【{item}】");
// }
// if (item >= 10 && item <= 11)
// {
// mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = item, SuborderId = subId, MakeType = false });
// MessageLog.GetInstance.Show($"添加订单:碗位置【{item}】");
// DeviceProcessLogShow($"添加订单:碗位置【{item}】");
// }
// }
// mORKS.DishNumber = orders.Count;//订单中配菜的数量
@@ -242,7 +244,7 @@ namespace BPASmartClient.MorkM
//{
// if (broadcast != null && broadcast is IOTCommandModel iOTCommand)
// {
// MessageLog.GetInstance.Show($"IOT 广播消息命令 {iOTCommand.deviceName} 设备命令 {iOTCommand.CommandName} 控制变量{iOTCommand.CommandValue.Keys.First()}{iOTCommand.CommandValue[iOTCommand.CommandValue.Keys.First()]}");
// DeviceProcessLogShow($"IOT 广播消息命令 {iOTCommand.deviceName} 设备命令 {iOTCommand.CommandName} 控制变量{iOTCommand.CommandValue.Keys.First()}{iOTCommand.CommandValue[iOTCommand.CommandValue.Keys.First()]}");
// switch (iOTCommand.CommandName)
// {
// case 0://控制类
@@ -286,85 +288,95 @@ namespace BPASmartClient.MorkM
///// <summary>
///// 数据解析
///// </summary>
//public void DataParse<T>(T order)
//{
// OrderCount++;
// MessageLog.GetInstance.Show($"接收到{OrderCount}次订单");
// if (order is MorkOrderPush morkOrderPush)
// {
// OrderInformation newOrder = new OrderInformation();//2022.4.30 修改
// List<OrderLocInfo> locs = new List<OrderLocInfo>();
// foreach (var item in morkOrderPush.GoodBatchings)
// {
// var res = Json<BatchingInfoPar>.Data.orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
// if (res != null)
// {
// if (ushort.TryParse(res.BatchingLoc, out ushort loc))
// {
// if (loc >= 1 && loc <= 5)
// {
// locs.Add(new OrderLocInfo() { Loc = ushort.Parse(res.BatchingLoc), SuborderId = morkOrderPush.SuborderId, BatchingId = res.BatchingId, MakeType = morkOrderPush.MakeID == "2" }); //新增冒菜干拌or加汤
// }
// else if (loc >= 10 && loc <= 11)
// {
// int index = 0;
// if (Json<BatchingInfoPar>.Data.recipeBoms != null)
// {
// index = Array.FindIndex(Json<BatchingInfoPar>.Data.recipeBoms?.RecipeIds.ToArray(), p => p.RecipeId == morkOrderPush.RecipeId);
// index++;
// }
// if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == morkOrderPush.SuborderId) == null)
// mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
// {
// Loc = 11,
// SuborderId = morkOrderPush.SuborderId,
// RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0
// });
// }
// }
// }
// }
// //手动供碗 调试用
// mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
// {
// Loc = 11,
// SuborderId = morkOrderPush.SuborderId,
// MakeType = morkOrderPush.MakeID == "2"
// });
// mORKS.DishNumber = locs.Count;//订单中配菜的数量 2022.4.30 修改
// while (locs.Count > 0)
// {
// for (int i = 0; i < locs.Count; i++)
// {
// var res = locs.FirstOrDefault(p => p.Loc % 2 != 0);
// if (res != null)
// {
// //if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == res.SuborderId) == null)
// mORKS.RBTakeNoodleTask.Enqueue(res);
// locs.Remove(res);
public void DataParse()
{
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
if (@event == null) return;
if (@event is DoOrderEvent order)
{
mORKS.doOrderEvents.Add(order);
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"接收到{OrderCount}次订单");
//if (order is MorkOrderPush morkOrderPush)
//{
OrderInformation newOrder = new OrderInformation();//2022.4.30 修改
List<OrderLocInfo> locs = new List<OrderLocInfo>();
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = Json<BatchingInfoPar>.Data.orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
if (ushort.TryParse(res.BatchingLoc, out ushort loc))
{
if (loc >= 1 && loc <= 5)
{
locs.Add(new OrderLocInfo() { Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId, MakeType = order.MorkOrder.MakeID == "2" }); //新增冒菜干拌or加汤
}
else if (loc >= 10 && loc <= 11)
{
int index = 0;
if (Json<BatchingInfoPar>.Data.recipeBoms != null)
{
index = Array.FindIndex(Json<BatchingInfoPar>.Data.recipeBoms?.RecipeIds.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId);
index++;
}
if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
{
Loc = 11,
SuborderId = order.MorkOrder.SuborderId,
RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0
});
}
}
}
}
//手动供碗 调试用
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
{
Loc = 11,
SuborderId = order.MorkOrder.SuborderId,
MakeType = order.MorkOrder.MakeID == "2"
});
mORKS.DishNumber = locs.Count;//订单中配菜的数量 2022.4.30 修改
while (locs.Count > 0)
{
for (int i = 0; i < locs.Count; i++)
{
var res = locs.FirstOrDefault(p => p.Loc % 2 != 0);
if (res != null)
{
//if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == res.SuborderId) == null)
mORKS.RBTakeNoodleTask.Enqueue(res);
locs.Remove(res);

// }
// else
// {
// //if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == locs[i].SuborderId) == null)
// mORKS.RBTakeNoodleTask.Enqueue(locs[i]);
// mORKS.VegtabNum++;
// locs.RemoveAt(i);
}
else
{
//if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == locs[i].SuborderId) == null)
mORKS.RBTakeNoodleTask.Enqueue(locs[i]);
mORKS.VegtabNum++;
locs.RemoveAt(i);

// }
// }
// }
}
}
}

// Dictionary<string, OrderInformation> dic = new Dictionary<string, OrderInformation>();
// newOrder.DishNum = mORKS.DishNumber;
// newOrder.VegatableNumber = mORKS.VegtabNum;
// //newOrder.MakeType = morkOrderPush.MakeType;
// dic.Add(morkOrderPush.SuborderId, newOrder);
// mORKS.Conqueue.Enqueue(dic);
// mORKS.VegtabNum = 0;
// mORKS.DishNumber = 0;
// }
//}
Dictionary<string, OrderInformation> dic = new Dictionary<string, OrderInformation>();
newOrder.DishNum = mORKS.DishNumber;
newOrder.VegatableNumber = mORKS.VegtabNum;
//newOrder.MakeType = morkOrderPush.MakeType;
dic.Add(order.MorkOrder.SuborderId, newOrder);
mORKS.Conqueue.Enqueue(dic);
mORKS.VegtabNum = 0;
mORKS.DishNumber = 0;
//}
}
});
}

public void Main()
{
@@ -401,8 +413,8 @@ namespace BPASmartClient.MorkM
mORKS.OutMealType = orderLocInfo.MakeType;//新增冒菜干拌or加汤
TakeBowlControl(orderLocInfo.Loc);
SetRecipeNumber(orderLocInfo.RecipeNumber);
SimpleFactory.GetInstance.OrderChanged(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
MessageLog.GetInstance.Show($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
}
mORKS.TakeBowlInterlock = true;
}
@@ -413,24 +425,24 @@ namespace BPASmartClient.MorkM
/// </summary>
private void TurntableControl()
{
if (GeneralConfig.EnableLocalSimOrder)
{
//不做轮询,直接取面,模拟订单使用
if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
{
if (mORKS.TurntableLowerLimit)
{
TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc);
if (mORKS.RBTakeNoodleTask.ElementAt(0).Loc == mORKS.TurntableFeedbackloc)
{
mORKS.TurntableLocLists.Clear();
mORKS.AllowTakeNoodle = true;
MessageLog.GetInstance.Show($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面");
}
}
}
}
else
//if (GeneralConfig.EnableLocalSimOrder)
//{
// //不做轮询,直接取面,模拟订单使用
// if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
// {
// if (mORKS.TurntableLowerLimit)
// {
// TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc);
// if (mORKS.RBTakeNoodleTask.ElementAt(0).Loc == mORKS.TurntableFeedbackloc)
// {
// mORKS.TurntableLocLists.Clear();
// mORKS.AllowTakeNoodle = true;
// DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面");
// }
// }
// }
//}
//else
{
//正常轮询
if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
@@ -445,7 +457,7 @@ namespace BPASmartClient.MorkM
TurntableStart(mORKS.TurntableFeedbackloc);
mORKS.TurntableLocLists.Clear();
mORKS.AllowTakeNoodle = true;
MessageLog.GetInstance.Show($"控制机器人去转台【{mORKS.TurntableFeedbackloc}】号位置取面");
DeviceProcessLogShow($"控制机器人去转台【{mORKS.TurntableFeedbackloc}】号位置取面");
}
else
{
@@ -458,7 +470,7 @@ namespace BPASmartClient.MorkM
if (mORKS.TurntableFeedbackloc != loc && !mORKS.TurntableLocLists.Contains(loc))
{
TurntableStart(loc);
MessageLog.GetInstance.Show($"没有物料检测的启动转台控制,转台位置:[{loc}]");
DeviceProcessLogShow($"没有物料检测的启动转台控制,转台位置:[{loc}]");
break;
}
else if (mORKS.TurntableFeedbackloc == loc && !mORKS.TurntableLocLists.Contains(loc)) mORKS.TurntableLocLists.Add(loc);
@@ -467,7 +479,7 @@ namespace BPASmartClient.MorkM
}
}
}
else MessageLog.GetInstance.Show("未找到可用的物料信息");
else DeviceProcessLogShow("未找到可用的物料信息");
}
}

@@ -476,7 +488,7 @@ namespace BPASmartClient.MorkM
{
mORKS.CurrentLoc = 0;
mORKS.TurntableInterlock = false;
MessageLog.GetInstance.Show("转台到位检测");
DeviceProcessLogShow("转台到位检测");
}

//补料完成检测
@@ -486,7 +498,7 @@ namespace BPASmartClient.MorkM
{
mORKS.TurntableLocLists.Clear();
mORKS.TurntableInterlock = false;
MessageLog.GetInstance.Show("补料完成检测");
DeviceProcessLogShow("补料完成检测");
}
}
}
@@ -512,7 +524,7 @@ namespace BPASmartClient.MorkM
//机器人开始取面
RobotTakeNoodle();
// SimpleFactory.GetInstance.OrderChanged(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);
MessageLog.GetInstance.Show($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏");
DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏");

//写入煮菜时间
List<ushort> values = new List<ushort>();
@@ -520,13 +532,14 @@ namespace BPASmartClient.MorkM
{
values.Add(2);//分
values.Add(0);//秒
ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetWordAddress($"VW{116 + (loc * 6)}"), WriteType.HoldingRegisters, values.ToArray());
// //ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetWordAddress($"VW{116 + (loc * 6)}"), WriteType.HoldingRegisters, values.ToArray());
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address =$"VW{ 116 + (loc * 6) }" , Value = values.ToArray() });
}
else //荤菜
{
values.Add(4);//分
values.Add(0);//秒
ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetWordAddress($"VW{116 + (loc * 6)}"), WriteType.HoldingRegisters, values.ToArray());
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = $"VW{ 116 + (loc * 6) }", Value = values.ToArray() });
}


@@ -588,7 +601,7 @@ namespace BPASmartClient.MorkM
// mORKS.CookNodelId[loc] = string.Empty;
mORKS.orderLocInfos[location] = null;

MessageLog.GetInstance.Show($"{location + 1}号位置出餐控制");
DeviceProcessLogShow($"{location + 1}号位置出餐控制");
mORKS.OutNoodleing = true;
mORKS.Count++;
CheckLastDish();
@@ -613,7 +626,7 @@ namespace BPASmartClient.MorkM
// mORKS.CookNodelId[loc] = string.Empty;
mORKS.orderLocInfos[location] = null;
// mORKS.Count++;
MessageLog.GetInstance.Show($"{location + 1}号位置出餐控制");
DeviceProcessLogShow($"{location + 1}号位置出餐控制");
mORKS.OutNoodleing = true;
mORKS.CountMeat++;
CheckLastDish();
@@ -649,7 +662,7 @@ namespace BPASmartClient.MorkM
if (mORKS.OutMealType)
{
AddSoup();//加汤
MessageLog.GetInstance.Show("正在加汤");
DeviceProcessLogShow("正在加汤");
}
else
{
@@ -690,8 +703,8 @@ namespace BPASmartClient.MorkM

mORKS.IngredientsCompleteId = mORKS.TakeBowlId;
// mORKS.TakeBowlId = string.Empty;
// MessageLog.GetInstance.Show("碗到位,允许到面");
MessageLog.GetInstance.Show($"碗到位,允许到面,{mORKS.IngredientsCompleteId}");
// DeviceProcessLogShow("碗到位,允许到面");
DeviceProcessLogShow($"碗到位,允许到面,{mORKS.IngredientsCompleteId}");
// mORKS.TakeBowlInterlock = false;
}

@@ -699,16 +712,16 @@ namespace BPASmartClient.MorkM
if (RTrig.GetInstance("CompleteChange").Start(mORKS.RbOutMealComplete))
{

SimpleFactory.GetInstance.OrderChanged(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK);
MessageLog.GetInstance.Show($"订单【{mORKS.OutMealId}】制作完成");
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK);
DeviceProcessLogShow($"订单【{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}】取餐完成");
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
ResetCookComplete();
mORKS.OutMealId = string.Empty;
}
@@ -719,7 +732,7 @@ namespace BPASmartClient.MorkM
mORKS.TakeNoodleInterlock = false;
mORKS.AllowTakeNoodle = false;
mORKS.TurntableInterlock = false;
MessageLog.GetInstance.Show("机器人取面完成信号检测");
DeviceProcessLogShow("机器人取面完成信号检测");
TakeNoodleCompleteReset();
}

@@ -777,12 +790,12 @@ namespace BPASmartClient.MorkM
}
if (recipeBoms.Count > 0)
{
if (ModbusTcpHelper.GetInstance.Write(1100, WriteType.HoldingRegisters, recipeBoms.ToArray()))
{
MessageLog.GetInstance.Show("成功写入配方数据");
}
//if (//ModbusTcpHelper.GetInstance.Write(1100, WriteType.HoldingRegisters, recipeBoms.ToArray()))
//{
// DeviceProcessLogShow("成功写入配方数据");
//}
}
else { MessageLog.GetInstance.Show("配方数据为空"); }
else { DeviceProcessLogShow("配方数据为空"); }
}

/// <summary>
@@ -790,7 +803,7 @@ namespace BPASmartClient.MorkM
/// </summary>
private void TakeNoodleCompleteReset()
{
ModbusTcpHelper.GetInstance.Write(1124, WriteType.Coils, false);
////ModbusTcpHelper.GetInstance.Write(1124, WriteType.Coils, false);
}

/// <summary>
@@ -802,8 +815,8 @@ namespace BPASmartClient.MorkM
if (num >= 1 && num <= 6)
{
ushort addRess = (ushort)(1136 + num - 1);
ModbusTcpHelper.GetInstance.Write(addRess, WriteType.Coils, false);
MessageLog.GetInstance.Show($"{num}号煮面口占用复位");
//ModbusTcpHelper.GetInstance.Write(addRess, WriteType.Coils, false);
DeviceProcessLogShow($"{num}号煮面口占用复位");
}

}
@@ -814,7 +827,7 @@ namespace BPASmartClient.MorkM
/// <param name="num"></param>
private void SetRecipeNumber(ushort num)
{
ModbusTcpHelper.GetInstance.Write(100, WriteType.HoldingRegisters, num);
//ModbusTcpHelper.GetInstance.Write(100, WriteType.HoldingRegisters, num);
}

/// <summary>
@@ -826,8 +839,8 @@ namespace BPASmartClient.MorkM
mORKS.CurrentLoc = loc;
mORKS.TurntableInterlock = true;
mORKS.TurntableLocLists.Add(loc);
ModbusTcpHelper.GetInstance.Write(101, WriteType.HoldingRegisters, loc);
ModbusTcpHelper.GetInstance.Write(325, WriteType.Coils, true);
//ModbusTcpHelper.GetInstance.Write(101, WriteType.HoldingRegisters, loc);
//ModbusTcpHelper.GetInstance.Write(325, WriteType.Coils, true);
}

/// <summary>
@@ -836,7 +849,7 @@ namespace BPASmartClient.MorkM
/// <param name="loc"></param>
private void SetFallNoodleLoc(ushort loc)
{
ModbusTcpHelper.GetInstance.Write(102, WriteType.HoldingRegisters, loc);
//ModbusTcpHelper.GetInstance.Write(102, WriteType.HoldingRegisters, loc);
}

/// <summary>
@@ -845,7 +858,7 @@ namespace BPASmartClient.MorkM
/// <param name="loc"></param>
private void SetTakeNoodleLoc(ushort loc)
{
ModbusTcpHelper.GetInstance.Write(103, WriteType.HoldingRegisters, loc);
//ModbusTcpHelper.GetInstance.Write(103, WriteType.HoldingRegisters, loc);
}

/// <summary>
@@ -856,11 +869,11 @@ namespace BPASmartClient.MorkM
{
if (loc == 10)//小碗
{
ModbusTcpHelper.GetInstance.Write(321, WriteType.Coils, true);
//ModbusTcpHelper.GetInstance.Write(321, WriteType.Coils, true);
}
else if (loc == 11)//大碗
{
ModbusTcpHelper.GetInstance.Write(322, WriteType.Coils, true);
//ModbusTcpHelper.GetInstance.Write(322, WriteType.Coils, true);
}
}

@@ -869,7 +882,7 @@ namespace BPASmartClient.MorkM
/// </summary>
private void RobotTakeNoodle()
{
ModbusTcpHelper.GetInstance.Write(323, WriteType.Coils, true);
//ModbusTcpHelper.GetInstance.Write(323, WriteType.Coils, true);
}

/// <summary>
@@ -877,13 +890,13 @@ namespace BPASmartClient.MorkM
/// </summary>
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);
}
// 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);
// }
}

/// <summary>
@@ -891,7 +904,7 @@ namespace BPASmartClient.MorkM
/// </summary>
private void ResetCookComplete()
{
ModbusTcpHelper.GetInstance.Write(1126, WriteType.Coils, false);
//ModbusTcpHelper.GetInstance.Write(1126, WriteType.Coils, false);
}

/// <summary>
@@ -899,7 +912,7 @@ namespace BPASmartClient.MorkM
/// </summary>
private void ResetAllowFallNoodle()
{
ModbusTcpHelper.GetInstance.Write(1123, WriteType.Coils, false);
//ModbusTcpHelper.GetInstance.Write(1123, WriteType.Coils, false);
}

/// <summary>
@@ -907,9 +920,9 @@ namespace BPASmartClient.MorkM
/// </summary>
public async void DeviceInit()
{
ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, true);
//ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, true);
await Task.Delay(1000);
ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, false);
//ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, false);

}

@@ -918,7 +931,8 @@ namespace BPASmartClient.MorkM
/// </summary>
public void CookComplete()
{
ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M0.6"), WriteType.Coils, true);
////ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M0.6"), WriteType.Coils, true);
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = "M0.6", Value = true });
}

/// <summary>
@@ -926,7 +940,8 @@ namespace BPASmartClient.MorkM
/// </summary>
public void AddSoup()
{
ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M0.7"), WriteType.Coils, true);
////ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M0.7"), WriteType.Coils, true);
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = "M0.7", Value = true });
}

private void ServerInit()
@@ -987,7 +1002,10 @@ namespace BPASmartClient.MorkM
}), "WriteBools");
ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice");
}

private void WriteData(string address, object value)
{
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value });
}
public override void ResetProgram()
{
mORKS = null;


+ 5
- 2
BPASmartClient.MorkM/OrderLocInfo.cs Прегледај датотеку

@@ -1,4 +1,5 @@
using System;
using BPA.Message;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -13,6 +14,7 @@ namespace BPASmartClient.MorkM
public ushort RecipeNumber { get; set; }
public int BatchingId { get; set; }
public string GoodName { get; set; }
public bool MakeType { get; set; }
}

/// <summary>
@@ -24,6 +26,7 @@ namespace BPASmartClient.MorkM

public int DishNum { get; set; }

// public GoodsMakeType MakeType { get; set; }

// public GoodsMakeType MakeType { get; set; }
}
}

Loading…
Откажи
Сачувај