|
@@ -8,18 +8,19 @@ using BPASmartClient.Model; |
|
|
using BPASmartClient.Model.PLC; |
|
|
using BPASmartClient.Model.PLC; |
|
|
using BPA.Models; |
|
|
using BPA.Models; |
|
|
using static BPASmartClient.EventBus.EventBus; |
|
|
using static BPASmartClient.EventBus.EventBus; |
|
|
|
|
|
|
|
|
|
|
|
using BPASmartClient.Model.小炒机; |
|
|
|
|
|
using BPASmartClient.MorkF.Model; |
|
|
|
|
|
|
|
|
namespace BPASmartClient.MorkF |
|
|
namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
public class Control_MorkF : BaseDevice |
|
|
public class Control_MorkF : BaseDevice |
|
|
{ |
|
|
{ |
|
|
public override DeviceClientType DeviceType => DeviceClientType.MORKSF; |
|
|
|
|
|
|
|
|
public override DeviceClientType DeviceType => DeviceClientType.MORKCS; |
|
|
public AutoResetEvent minorReset = new AutoResetEvent(false); |
|
|
public AutoResetEvent minorReset = new AutoResetEvent(false); |
|
|
public AutoResetEvent mainReset = new AutoResetEvent(false); |
|
|
public AutoResetEvent mainReset = new AutoResetEvent(false); |
|
|
GVL_MorkF morkF = new GVL_MorkF();//全局对象声明 |
|
|
GVL_MorkF morkF = new GVL_MorkF();//全局对象声明 |
|
|
public StirFryBom stirFryBom = new StirFryBom();//创建获取流程的对象 |
|
|
public StirFryBom stirFryBom = new StirFryBom();//创建获取流程的对象 |
|
|
StirFryGoods stirFryGoods = new StirFryGoods();//创建商品对象 |
|
|
|
|
|
|
|
|
List<StirFryGoods> stirFryGoods = new List<StirFryGoods>();//创建商品对象 |
|
|
List<int> resultorder = new List<int>();//调试变量 |
|
|
List<int> resultorder = new List<int>();//调试变量 |
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 入口 |
|
|
/// 入口 |
|
@@ -321,9 +322,9 @@ namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
//队列 |
|
|
//队列 |
|
|
string subId = Guid.NewGuid().ToString(); |
|
|
string subId = Guid.NewGuid().ToString(); |
|
|
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId, MaterialLoc = 1 });//A料 |
|
|
|
|
|
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId, MaterialLoc = 2 });//B料 |
|
|
|
|
|
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId, MaterialLoc = 3 });//C料 |
|
|
|
|
|
|
|
|
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId, MaterialLoc = new List<int>() { 1 } });//A料 |
|
|
|
|
|
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId, MaterialLoc = new List<int>() { 2 } });//B料 |
|
|
|
|
|
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId, MaterialLoc = new List<int>() { 3 } });//C料 |
|
|
morkF.TakePlateQueue.Enqueue(new OrderLocInfo() { SuborderId = subId }); |
|
|
morkF.TakePlateQueue.Enqueue(new OrderLocInfo() { SuborderId = subId }); |
|
|
resultorder.AddRange(new int[] { 1, 2, 3 }); |
|
|
resultorder.AddRange(new int[] { 1, 2, 3 }); |
|
|
morkF.listStirBom.Add(stirFryBom); |
|
|
morkF.listStirBom.Add(stirFryBom); |
|
@@ -388,6 +389,7 @@ namespace BPASmartClient.MorkF |
|
|
if (@event is MaterialDeliveryEvent material) |
|
|
if (@event is MaterialDeliveryEvent material) |
|
|
{ |
|
|
{ |
|
|
orderMaterialDelivery = material.orderMaterialDelivery; |
|
|
orderMaterialDelivery = material.orderMaterialDelivery; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@@ -401,6 +403,17 @@ namespace BPASmartClient.MorkF |
|
|
WriteRecipeBoms(); |
|
|
WriteRecipeBoms(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
//小炒流程信息 |
|
|
|
|
|
EventBus.EventBus.GetInstance().Subscribe<StirFryGoodsEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callback) |
|
|
|
|
|
{ |
|
|
|
|
|
if (@event == null) return; |
|
|
|
|
|
if (@event is StirFryGoodsEvent stirFry) |
|
|
|
|
|
{ |
|
|
|
|
|
stirFryGoods = stirFry.stirFrymessage.stirFryGoods; |
|
|
|
|
|
MessageLog.GetInstance.Show("接收到小炒流程信息"); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) |
|
|
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) |
|
@@ -423,41 +436,34 @@ namespace BPASmartClient.MorkF |
|
|
if (order.MorkOrder.GoodBatchings == null) return; |
|
|
if (order.MorkOrder.GoodBatchings == null) return; |
|
|
OrderCount++; |
|
|
OrderCount++; |
|
|
DeviceProcessLogShow($"接收到{OrderCount}次订单"); |
|
|
DeviceProcessLogShow($"接收到{OrderCount}次订单"); |
|
|
foreach (var item in order.MorkOrder.GoodBatchings) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var res = stirFryGoods?.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.RecipeId);//匹配订单对应制作流程 |
|
|
|
|
|
if (res != null) |
|
|
{ |
|
|
{ |
|
|
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); |
|
|
|
|
|
if (res != null) |
|
|
|
|
|
|
|
|
morkF.listStirBom.Add(res.StirFryBomInfo);//添加订单制作流程 |
|
|
|
|
|
if (morkF.TakeMaterialQueue.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
{ |
|
|
{ |
|
|
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) }); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = order.MorkOrder.SuborderId, MaterialLoc = res.StirFryBomInfo.ALoc }); |
|
|
|
|
|
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = order.MorkOrder.SuborderId, MaterialLoc = res.StirFryBomInfo.BLoc }); |
|
|
|
|
|
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = order.MorkOrder.SuborderId, MaterialLoc = res.StirFryBomInfo.CLoc }); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//int index = 0; |
|
|
|
|
|
//if (recipeBoms != null) |
|
|
|
|
|
//{ |
|
|
|
|
|
// index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId); |
|
|
|
|
|
// index++; |
|
|
|
|
|
//} |
|
|
|
|
|
if (morkF.TakePlateQueue.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
|
|
morkF.TakePlateQueue.Enqueue(new OrderLocInfo() |
|
|
|
|
|
{ |
|
|
|
|
|
SuborderId = order.MorkOrder.SuborderId, |
|
|
|
|
|
BatchingId = res.BatchingId |
|
|
|
|
|
//RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0 |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//foreach (var item in order.MorkOrder.GoodBatchings) |
|
|
|
|
|
//{ |
|
|
|
|
|
if (morkF.TakePlateQueue.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
|
|
{ |
|
|
|
|
|
morkF.TakePlateQueue.Enqueue(new OrderLocInfo() |
|
|
|
|
|
{ |
|
|
|
|
|
SuborderId = order.MorkOrder.SuborderId, |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
//} |
|
|
} |
|
|
} |
|
|
//根据ID 查找对应制作流程, |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
//} |
|
|
//} |
|
@@ -572,7 +578,7 @@ namespace BPASmartClient.MorkF |
|
|
if (morkF.MainProcessWait) |
|
|
if (morkF.MainProcessWait) |
|
|
{ |
|
|
{ |
|
|
if (morkF.MinorHasTakeMaterial) |
|
|
if (morkF.MinorHasTakeMaterial) |
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@@ -582,7 +588,7 @@ namespace BPASmartClient.MorkF |
|
|
//阻塞辅流程 |
|
|
//阻塞辅流程 |
|
|
minorReset.WaitOne(); |
|
|
minorReset.WaitOne(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
morkF.MinorProessStatus = true; |
|
|
morkF.MinorProessStatus = true; |
|
|
morkF.MainProcessStatus = false; |
|
|
morkF.MainProcessStatus = false; |
|
@@ -624,13 +630,13 @@ namespace BPASmartClient.MorkF |
|
|
case StirFryRobotAction.清洗槽取锅: |
|
|
case StirFryRobotAction.清洗槽取锅: |
|
|
TakePotTask();//执行取锅操作 |
|
|
TakePotTask();//执行取锅操作 |
|
|
break; |
|
|
break; |
|
|
case StirFryRobotAction.加入A料: |
|
|
|
|
|
|
|
|
case StirFryRobotAction.取A料: |
|
|
TakeBurdenATask();//执行取A料操作 |
|
|
TakeBurdenATask();//执行取A料操作 |
|
|
break; |
|
|
break; |
|
|
case StirFryRobotAction.加入B料: |
|
|
|
|
|
|
|
|
case StirFryRobotAction.取B料: |
|
|
TakeBurdenATask();//执行取B料操作 |
|
|
TakeBurdenATask();//执行取B料操作 |
|
|
break; |
|
|
break; |
|
|
case StirFryRobotAction.加入C料: |
|
|
|
|
|
|
|
|
case StirFryRobotAction.取C料: |
|
|
TakeBurdenCTask();//执行取C料操作 |
|
|
TakeBurdenCTask();//执行取C料操作 |
|
|
break; |
|
|
break; |
|
|
case StirFryRobotAction.灶取锅: |
|
|
case StirFryRobotAction.灶取锅: |
|
@@ -708,7 +714,7 @@ namespace BPASmartClient.MorkF |
|
|
//阻塞主流程 |
|
|
//阻塞主流程 |
|
|
mainReset.WaitOne(); |
|
|
mainReset.WaitOne(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
morkF.MinorProessStatus = false; |
|
|
morkF.MinorProessStatus = false; |
|
|
morkF.MainProcessStatus = true; |
|
|
morkF.MainProcessStatus = true; |
|
@@ -771,27 +777,10 @@ namespace BPASmartClient.MorkF |
|
|
/// </summary> |
|
|
/// </summary> |
|
|
private void TurntableControl() |
|
|
private void TurntableControl() |
|
|
{ |
|
|
{ |
|
|
//正常轮询 |
|
|
|
|
|
//if (morkF.TakeMaterialQueue.Count > 0 && !morkF.TurnTableLock) |
|
|
|
|
|
//{ |
|
|
|
|
|
// var result = orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == morkF.TakeMaterialQueue.ElementAt(0).BatchingId).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
// if (result != null) |
|
|
|
|
|
// { |
|
|
|
|
|
// if (ushort.TryParse(result[0].BatchingLoc, out ushort loc)) |
|
|
|
|
|
// { |
|
|
|
|
|
// TurnMaterialStore(loc); |
|
|
|
|
|
// DeviceProcessLogShow($"转台转到【{loc}】位置"); |
|
|
|
|
|
// morkF.TurnTableLock = true; //取料完成后置false |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// elseDeviceProcessLogShow("未找到可用的物料信息"); |
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
|
|
//调试代码 |
|
|
|
|
|
if (morkF.TakeMaterialQueue.Count > 0 && !morkF.TurnTableLock) |
|
|
|
|
|
|
|
|
//模拟订单 |
|
|
|
|
|
if (morkF.TakeMaterialQueue.Count > 0 && !morkF.TurnTableLock && General_Config.SimOrderAllow) |
|
|
{ |
|
|
{ |
|
|
// var result = orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == morkF.TakeMaterialQueue.ElementAt(0).BatchingId).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
if (resultorder != null) |
|
|
if (resultorder != null) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
@@ -807,6 +796,25 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
//正式订单 |
|
|
|
|
|
if (morkF.TakeMaterialQueue.Count > 0 && !morkF.TurnTableLock) |
|
|
|
|
|
{ |
|
|
|
|
|
//var result = orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == morkF.TakeMaterialQueue.ElementAt(0).BatchingId).ToList(); |
|
|
|
|
|
var materialLoc = morkF.TakeMaterialQueue.ElementAt(0).MaterialLoc; |
|
|
|
|
|
if (materialLoc.Count != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
TurnMaterialStore(materialLoc[0]); |
|
|
|
|
|
DeviceProcessLogShow($"转台转到【{materialLoc[0]}】位置"); |
|
|
|
|
|
morkF.TurnTableLock = true; //取料完成后置false |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
DeviceProcessLogShow("未找到可用的物料信息"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -885,12 +893,12 @@ namespace BPASmartClient.MorkF |
|
|
if (morkF.MainProcessStatus) |
|
|
if (morkF.MainProcessStatus) |
|
|
{ |
|
|
{ |
|
|
morkF.MainProcessPotLoc = morkF.CurrentPutPotLoc; |
|
|
morkF.MainProcessPotLoc = morkF.CurrentPutPotLoc; |
|
|
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{morkF.MainCurrentOrderId}】执行取锅到灶台控制"); |
|
|
} |
|
|
} |
|
|
if (morkF.MinorProessStatus) |
|
|
if (morkF.MinorProessStatus) |
|
|
{ |
|
|
{ |
|
|
morkF.MinorProcessPotLoc = morkF.CurrentPutPotLoc; |
|
|
morkF.MinorProcessPotLoc = morkF.CurrentPutPotLoc; |
|
|
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{morkF.MinorCurrentOrderId}】执行取锅到灶台控制"); |
|
|
} |
|
|
} |
|
|
if (morkF.CurrentPutPotLoc == 1) |
|
|
if (morkF.CurrentPutPotLoc == 1) |
|
|
{ |
|
|
{ |
|
@@ -983,11 +991,11 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
{ |
|
|
{ |
|
|
loc = order.MaterialLoc; |
|
|
|
|
|
TakeBurden(loc); |
|
|
|
|
|
|
|
|
loc = order.MaterialLoc[0]; |
|
|
|
|
|
TakeBurden(); |
|
|
TurnReset(loc);//转台复位 |
|
|
TurnReset(loc);//转台复位 |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{order.SuborderId}】,执行到转台{loc}位置取料"); |
|
|
} |
|
|
} |
|
|
//等待取料完成 |
|
|
//等待取料完成 |
|
|
while (!morkF.TakeMaterialComplete) |
|
|
while (!morkF.TakeMaterialComplete) |
|
@@ -1016,11 +1024,11 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
{ |
|
|
{ |
|
|
loc = order.MaterialLoc; |
|
|
|
|
|
TakeBurden(loc); |
|
|
|
|
|
|
|
|
loc = order.MaterialLoc[0]; |
|
|
|
|
|
TakeBurden(); |
|
|
TurnReset(loc);//转台复位 |
|
|
TurnReset(loc);//转台复位 |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{order.SuborderId}】,执行到转台{loc}位置取料"); |
|
|
} |
|
|
} |
|
|
//等待取料完成 |
|
|
//等待取料完成 |
|
|
while (!morkF.TakeMaterialComplete) |
|
|
while (!morkF.TakeMaterialComplete) |
|
@@ -1064,11 +1072,11 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
{ |
|
|
{ |
|
|
loc = order.MaterialLoc; |
|
|
|
|
|
TakeBurden(loc); |
|
|
|
|
|
|
|
|
loc = order.MaterialLoc[0]; |
|
|
|
|
|
TakeBurden(); |
|
|
TurnReset(loc);//转台复位 |
|
|
TurnReset(loc);//转台复位 |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{order.SuborderId}】,执行到转台{loc}位置取料"); |
|
|
} |
|
|
} |
|
|
//等待取料完成 |
|
|
//等待取料完成 |
|
|
while (!morkF.TakeMaterialComplete) |
|
|
while (!morkF.TakeMaterialComplete) |
|
@@ -1097,11 +1105,11 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
{ |
|
|
{ |
|
|
loc = order.MaterialLoc; |
|
|
|
|
|
TakeBurden(loc); |
|
|
|
|
|
|
|
|
loc = order.MaterialLoc[0]; |
|
|
|
|
|
TakeBurden(); |
|
|
TurnReset(loc);//转台复位 |
|
|
TurnReset(loc);//转台复位 |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{order.SuborderId}】,执行到转台{loc}位置取料"); |
|
|
} |
|
|
} |
|
|
//等待取料完成 |
|
|
//等待取料完成 |
|
|
while (!morkF.TakeMaterialComplete) |
|
|
while (!morkF.TakeMaterialComplete) |
|
@@ -1174,11 +1182,11 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
{ |
|
|
{ |
|
|
loc = order.MaterialLoc; |
|
|
|
|
|
TakeBurden(loc); |
|
|
|
|
|
|
|
|
loc = order.MaterialLoc[0]; |
|
|
|
|
|
TakeBurden(); |
|
|
TurnReset(loc);//转台复位 |
|
|
TurnReset(loc);//转台复位 |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{order.SuborderId}】,执行到转台{loc}位置取料"); |
|
|
} |
|
|
} |
|
|
//等待取料完成 |
|
|
//等待取料完成 |
|
|
while (!morkF.TakeMaterialComplete) |
|
|
while (!morkF.TakeMaterialComplete) |
|
@@ -1207,11 +1215,11 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
{ |
|
|
{ |
|
|
loc = order.MaterialLoc; |
|
|
|
|
|
TakeBurden(loc); |
|
|
|
|
|
|
|
|
loc = order.MaterialLoc[0]; |
|
|
|
|
|
TakeBurden(); |
|
|
TurnReset(loc);//转台复位 |
|
|
TurnReset(loc);//转台复位 |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{order.SuborderId}】,执行到转台{loc}位置取料"); |
|
|
} |
|
|
} |
|
|
//等待取料完成 |
|
|
//等待取料完成 |
|
|
while (!morkF.TakeMaterialComplete) |
|
|
while (!morkF.TakeMaterialComplete) |
|
@@ -1245,9 +1253,9 @@ namespace BPASmartClient.MorkF |
|
|
RobotOutMeal(); |
|
|
RobotOutMeal(); |
|
|
WriteData("M1.2", false);//供盘复位 |
|
|
WriteData("M1.2", false);//供盘复位 |
|
|
if (morkF.MainProcessStatus) |
|
|
if (morkF.MainProcessStatus) |
|
|
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到清洗台控制"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{morkF.MainCurrentOrderId}】执行取锅到清洗台控制"); |
|
|
if (morkF.MinorProessStatus) |
|
|
if (morkF.MinorProessStatus) |
|
|
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到清洗台控制"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{morkF.MinorCurrentOrderId}】执行取锅到清洗台控制"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -1271,7 +1279,7 @@ namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
CleanModuleControl("Start", 2); |
|
|
CleanModuleControl("Start", 2); |
|
|
} |
|
|
} |
|
|
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行清洗操作"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{morkF.MainCurrentOrderId}】执行清洗操作"); |
|
|
morkF.MainProcessFlag = false; |
|
|
morkF.MainProcessFlag = false; |
|
|
minorReset.Set(); |
|
|
minorReset.Set(); |
|
|
} |
|
|
} |
|
@@ -1286,7 +1294,7 @@ namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
CleanModuleControl("Start", 2); |
|
|
CleanModuleControl("Start", 2); |
|
|
} |
|
|
} |
|
|
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行清洗操作"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{morkF.MinorCurrentOrderId}】执行清洗操作"); |
|
|
morkF.MinorProcessFlag = false; |
|
|
morkF.MinorProcessFlag = false; |
|
|
mainReset.Set(); |
|
|
mainReset.Set(); |
|
|
} |
|
|
} |
|
@@ -1325,9 +1333,9 @@ namespace BPASmartClient.MorkF |
|
|
/// </summary> |
|
|
/// </summary> |
|
|
public void TurnDownStatusDetect() |
|
|
public void TurnDownStatusDetect() |
|
|
{ |
|
|
{ |
|
|
int potLoc= TurnMachineOrientControl("Down"); |
|
|
|
|
|
|
|
|
int potLoc = TurnMachineOrientControl("Down"); |
|
|
|
|
|
|
|
|
if (potLoc==1) |
|
|
|
|
|
|
|
|
if (potLoc == 1) |
|
|
{ |
|
|
{ |
|
|
while (!morkF.TurnMachineDownComplete)//等待翻转机下降完成 |
|
|
while (!morkF.TurnMachineDownComplete)//等待翻转机下降完成 |
|
|
{ |
|
|
{ |
|
@@ -1335,7 +1343,7 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
WriteData("M8.3", false);//下降完成复位 |
|
|
WriteData("M8.3", false);//下降完成复位 |
|
|
} |
|
|
} |
|
|
if (potLoc==2) |
|
|
|
|
|
|
|
|
if (potLoc == 2) |
|
|
{ |
|
|
{ |
|
|
while (!morkF.SecondTurnMachineDownComplete)//等待翻转机下降完成 |
|
|
while (!morkF.SecondTurnMachineDownComplete)//等待翻转机下降完成 |
|
|
{ |
|
|
{ |
|
@@ -1354,7 +1362,7 @@ namespace BPASmartClient.MorkF |
|
|
//} |
|
|
//} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 翻转机上升及状态检测 |
|
|
/// 翻转机上升及状态检测 |
|
|
/// </summary> |
|
|
/// </summary> |
|
@@ -1367,7 +1375,7 @@ namespace BPASmartClient.MorkF |
|
|
TurnMachineOrientControl("Top");//翻转机上升 |
|
|
TurnMachineOrientControl("Top");//翻转机上升 |
|
|
if (morkF.MainProcessStatus) |
|
|
if (morkF.MainProcessStatus) |
|
|
{ |
|
|
{ |
|
|
if (morkF.MainProcessPotLoc==1) |
|
|
|
|
|
|
|
|
if (morkF.MainProcessPotLoc == 1) |
|
|
{ |
|
|
{ |
|
|
while (!morkF.TurnMachineUpComplete)//等待翻转机上升完成以及取料完成 |
|
|
while (!morkF.TurnMachineUpComplete)//等待翻转机上升完成以及取料完成 |
|
|
{ |
|
|
{ |
|
@@ -1392,14 +1400,14 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
morkF.MainOrderMaterialCom = true; |
|
|
morkF.MainOrderMaterialCom = true; |
|
|
morkF.MainHasTakeMaterial = false; |
|
|
morkF.MainHasTakeMaterial = false; |
|
|
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】,配料倒料完成"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{morkF.MainCurrentOrderId}】,配料倒料完成"); |
|
|
} |
|
|
} |
|
|
else //辅程准备阻塞 |
|
|
else //辅程准备阻塞 |
|
|
{ |
|
|
{ |
|
|
morkF.MainProcessWait = true; |
|
|
morkF.MainProcessWait = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (morkF.MainProcessPotLoc==2) |
|
|
|
|
|
|
|
|
if (morkF.MainProcessPotLoc == 2) |
|
|
{ |
|
|
{ |
|
|
while (!morkF.SecondTurnMachineUpComplete)//等待翻转机上升完成以及取料完成 |
|
|
while (!morkF.SecondTurnMachineUpComplete)//等待翻转机上升完成以及取料完成 |
|
|
{ |
|
|
{ |
|
@@ -1424,12 +1432,12 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
morkF.MainOrderMaterialCom = true; |
|
|
morkF.MainOrderMaterialCom = true; |
|
|
morkF.MainHasTakeMaterial = false; |
|
|
morkF.MainHasTakeMaterial = false; |
|
|
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】,配料倒料完成"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{morkF.MinorCurrentOrderId}】,配料倒料完成"); |
|
|
} |
|
|
} |
|
|
else //辅流程准备阻塞 |
|
|
else //辅流程准备阻塞 |
|
|
{ |
|
|
{ |
|
|
morkF.MainProcessWait = true; |
|
|
morkF.MainProcessWait = true; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (morkF.MinorProessStatus) |
|
|
if (morkF.MinorProessStatus) |
|
@@ -1459,14 +1467,14 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
morkF.MinorOrderMaterialCom = true; |
|
|
morkF.MinorOrderMaterialCom = true; |
|
|
morkF.MinorHasTakeMaterial = false; |
|
|
morkF.MinorHasTakeMaterial = false; |
|
|
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】,配料倒料完成"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{morkF.MainCurrentOrderId}】,配料倒料完成"); |
|
|
} |
|
|
} |
|
|
else //主程准备阻塞 |
|
|
else //主程准备阻塞 |
|
|
{ |
|
|
{ |
|
|
morkF.MinorProcessWait = true; |
|
|
morkF.MinorProcessWait = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (morkF.MinorProcessPotLoc==2) |
|
|
|
|
|
|
|
|
if (morkF.MinorProcessPotLoc == 2) |
|
|
{ |
|
|
{ |
|
|
while (!morkF.SecondTurnMachineUpComplete)//等待翻转机上升完成以及取料完成 |
|
|
while (!morkF.SecondTurnMachineUpComplete)//等待翻转机上升完成以及取料完成 |
|
|
{ |
|
|
{ |
|
@@ -1491,12 +1499,12 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
morkF.MinorOrderMaterialCom = true; |
|
|
morkF.MinorOrderMaterialCom = true; |
|
|
morkF.MinorHasTakeMaterial = false; |
|
|
morkF.MinorHasTakeMaterial = false; |
|
|
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】,配料倒料完成"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{morkF.MinorCurrentOrderId}】,配料倒料完成"); |
|
|
} |
|
|
} |
|
|
else //主流程准备阻塞 |
|
|
else //主流程准备阻塞 |
|
|
{ |
|
|
{ |
|
|
morkF.MinorProcessWait = true; |
|
|
morkF.MinorProcessWait = true; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//if (morkF.MainProcessStatus)//代表主流程执行的操作 |
|
|
//if (morkF.MainProcessStatus)//代表主流程执行的操作 |
|
@@ -1702,7 +1710,7 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
FirstPotGears(number); |
|
|
FirstPotGears(number); |
|
|
} |
|
|
} |
|
|
if (morkF.MinorProcessPotLoc==2) |
|
|
|
|
|
|
|
|
if (morkF.MinorProcessPotLoc == 2) |
|
|
{ |
|
|
{ |
|
|
while (!morkF.SecondPotInPlace) |
|
|
while (!morkF.SecondPotInPlace) |
|
|
{ |
|
|
{ |
|
@@ -1712,9 +1720,9 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (morkF.MainProcessStatus) |
|
|
if (morkF.MainProcessStatus) |
|
|
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{morkF.MainCurrentOrderId}】执行取锅到灶台控制"); |
|
|
if (morkF.MinorProessStatus) |
|
|
if (morkF.MinorProessStatus) |
|
|
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制"); |
|
|
|
|
|
|
|
|
DeviceProcessLogShow($"订单【{morkF.MinorCurrentOrderId}】执行取锅到灶台控制"); |
|
|
} |
|
|
} |
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// PLC转台控制 |
|
|
/// PLC转台控制 |
|
@@ -1818,7 +1826,7 @@ namespace BPASmartClient.MorkF |
|
|
Task.Delay(5).Wait(); |
|
|
Task.Delay(5).Wait(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (morkF.MainProcessPotLoc==2) |
|
|
|
|
|
|
|
|
if (morkF.MainProcessPotLoc == 2) |
|
|
{ |
|
|
{ |
|
|
while (!morkF.SecondPotInPlace) |
|
|
while (!morkF.SecondPotInPlace) |
|
|
{ |
|
|
{ |
|
@@ -1832,7 +1840,7 @@ namespace BPASmartClient.MorkF |
|
|
Task.Delay(5).Wait(); |
|
|
Task.Delay(5).Wait(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if (morkF.MinorProessStatus) |
|
|
if (morkF.MinorProessStatus) |
|
|
{ |
|
|
{ |
|
@@ -1876,8 +1884,8 @@ namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
switch (orientation) |
|
|
switch (orientation) |
|
|
{ |
|
|
{ |
|
|
case "Top": WriteData("M8.0", true); break; |
|
|
|
|
|
case "Down": WriteData("M8.2", true); break; |
|
|
|
|
|
|
|
|
case "Top": WriteData("M8.0", true); break; |
|
|
|
|
|
case "Down": WriteData("M8.2", true); break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
public void SecondPotTurnMachine(string orientation) |
|
|
public void SecondPotTurnMachine(string orientation) |
|
@@ -1895,7 +1903,7 @@ namespace BPASmartClient.MorkF |
|
|
/// <param name="orientation"></param> |
|
|
/// <param name="orientation"></param> |
|
|
public int TurnMachineOrientControl(string orientation) |
|
|
public int TurnMachineOrientControl(string orientation) |
|
|
{ |
|
|
{ |
|
|
int potLoc=0; ; |
|
|
|
|
|
|
|
|
int potLoc = 0; ; |
|
|
//switch (orientation) |
|
|
//switch (orientation) |
|
|
//{ |
|
|
//{ |
|
|
// case "Top": if (morkF.MainProcessStatus) WriteData("M8.0", true); if (morkF.MinorProessStatus) WriteData("M8.4", true); break; |
|
|
// case "Top": if (morkF.MainProcessStatus) WriteData("M8.0", true); if (morkF.MinorProessStatus) WriteData("M8.4", true); break; |
|
@@ -1911,7 +1919,7 @@ namespace BPASmartClient.MorkF |
|
|
if (morkF.MainProcessPotLoc == 2) |
|
|
if (morkF.MainProcessPotLoc == 2) |
|
|
{ |
|
|
{ |
|
|
SecondPotTurnMachine(orientation); |
|
|
SecondPotTurnMachine(orientation); |
|
|
potLoc=2; |
|
|
|
|
|
|
|
|
potLoc = 2; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (morkF.MinorProessStatus) |
|
|
if (morkF.MinorProessStatus) |
|
@@ -1971,7 +1979,7 @@ namespace BPASmartClient.MorkF |
|
|
//} |
|
|
//} |
|
|
if (morkF.MainProcessStatus) |
|
|
if (morkF.MainProcessStatus) |
|
|
{ |
|
|
{ |
|
|
if (morkF.MainProcessPotLoc==1) |
|
|
|
|
|
|
|
|
if (morkF.MainProcessPotLoc == 1) |
|
|
{ |
|
|
{ |
|
|
FirstPotTurnMachine(gear); |
|
|
FirstPotTurnMachine(gear); |
|
|
} |
|
|
} |
|
@@ -1982,7 +1990,7 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
if (morkF.MinorProessStatus) |
|
|
if (morkF.MinorProessStatus) |
|
|
{ |
|
|
{ |
|
|
if (morkF.MinorProcessPotLoc==1) |
|
|
|
|
|
|
|
|
if (morkF.MinorProcessPotLoc == 1) |
|
|
{ |
|
|
{ |
|
|
FirstPotTurnMachine(gear); |
|
|
FirstPotTurnMachine(gear); |
|
|
} |
|
|
} |
|
@@ -1996,7 +2004,7 @@ namespace BPASmartClient.MorkF |
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 取A,B,C料 |
|
|
/// 取A,B,C料 |
|
|
/// </summary> |
|
|
/// </summary> |
|
|
public void TakeBurden(int loc) |
|
|
|
|
|
|
|
|
public void TakeBurden() |
|
|
{ |
|
|
{ |
|
|
if (morkF.MainProcessStatus && morkF.PotInPlace) |
|
|
if (morkF.MainProcessStatus && morkF.PotInPlace) |
|
|
WriteData("M14.1", true);//机器人倒料至1号锅 |
|
|
WriteData("M14.1", true);//机器人倒料至1号锅 |
|
|