前后区数量分配:箱子前后区都拣选任务时,根据数量判断去前区后区。
This commit is contained in:
parent
14ff462b79
commit
6a5b4a640e
|
|
@ -129,18 +129,49 @@ public class StackerOutC1(ConveyOperation conveyOperation, DataBaseData dataBase
|
||||||
}
|
}
|
||||||
else // 两个地区都存在任务
|
else // 两个地区都存在任务
|
||||||
{
|
{
|
||||||
ConsoleLog.Info($"出库分流:{area} 箱码:{msg} 存在 1~5 站台任务且存在 6~9 区域任务");
|
// 比对两个区的箱子数量
|
||||||
Random random = new();
|
var readResult_1 = CommonTool.Siemens.ReadInt16WithName($"数量1");
|
||||||
var id = random.Next(0, 100);
|
var readResult_2 = CommonTool.Siemens.ReadInt16WithName($"数量2");
|
||||||
ConveyPLCTask plcTask = new(plcId, id < Convert.ToInt32(CommonData.AppConfig.Pick2Lv) ? (short)ConveyRouterEnum.Move : (short)ConveyRouterEnum.Go);
|
if (readResult_1.Value >= readResult_2.Value)//前区数量多去后区
|
||||||
string errText = conveyOperation.WriteTask(area, plcTask);
|
|
||||||
if (string.IsNullOrEmpty(errText))
|
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"出库分流:{area} 箱码:{msg},写入PLC成功,{plcTask}");
|
ConsoleLog.Info($"出库分流:{area} 箱码:{msg} 存在 1~5 站台任务且存在 6~9 区域任务");
|
||||||
|
ConveyPLCTask plcTask = new(plcId, (short)ConveyRouterEnum.Move);
|
||||||
|
string errText = conveyOperation.WriteTask(area, plcTask);
|
||||||
|
if (string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Success($"出库分流:{area} 箱码:{msg},写入PLC成功,{plcTask}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Warning($"【警告】出库分流:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
else//后区数量多去前区
|
||||||
|
{
|
||||||
|
ConsoleLog.Info($"出库分流:{area} 箱码:{msg} 存在 1~5 站台任务且存在 6~9 区域任务");
|
||||||
|
ConveyPLCTask plcTask = new(plcId, (short)ConveyRouterEnum.Go);
|
||||||
|
string errText = conveyOperation.WriteTask(area, plcTask);
|
||||||
|
if (string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Success($"出库分流:{area} 箱码:{msg},写入PLC成功,{plcTask}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Warning($"【警告】出库分流:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ConsoleLog.Warning($"【警告】出库分流:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
|
||||||
return;
|
|
||||||
|
//ConsoleLog.Info($"出库分流:{area} 箱码:{msg} 存在 1~5 站台任务且存在 6~9 区域任务");
|
||||||
|
//Random random = new();
|
||||||
|
//var id = random.Next(0, 100);
|
||||||
|
//ConveyPLCTask plcTask = new(plcId, id < Convert.ToInt32(CommonData.AppConfig.Pick2Lv) ? (short)ConveyRouterEnum.Move : (short)ConveyRouterEnum.Go);
|
||||||
|
//string errText = conveyOperation.WriteTask(area, plcTask);
|
||||||
|
//if (string.IsNullOrEmpty(errText))
|
||||||
|
//{
|
||||||
|
// ConsoleLog.Success($"出库分流:{area} 箱码:{msg},写入PLC成功,{plcTask}");
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
//ConsoleLog.Warning($"【警告】出库分流:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
||||||
|
//return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user