前后区数量分配:箱子前后区都拣选任务时,根据数量判断去前区后区。

This commit is contained in:
王海明 2024-09-29 16:37:15 +08:00
parent 14ff462b79
commit 6a5b4a640e

View File

@ -128,11 +128,14 @@ public class StackerOutC1(ConveyOperation conveyOperation, DataBaseData dataBase
return;
}
else // 两个地区都存在任务
{
// 比对两个区的箱子数量
var readResult_1 = CommonTool.Siemens.ReadInt16WithName($"数量1");
var readResult_2 = CommonTool.Siemens.ReadInt16WithName($"数量2");
if (readResult_1.Value >= readResult_2.Value)//前区数量多去后区
{
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);
ConveyPLCTask plcTask = new(plcId, (short)ConveyRouterEnum.Move);
string errText = conveyOperation.WriteTask(area, plcTask);
if (string.IsNullOrEmpty(errText))
{
@ -141,6 +144,34 @@ public class StackerOutC1(ConveyOperation conveyOperation, DataBaseData dataBase
}
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;
}
//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;
}
}