whm #2

Merged
icewint merged 2 commits from whm into master 2024-10-21 15:26:14 +08:00
Showing only changes of commit 6a5b4a640e - Show all commits

View File

@ -129,18 +129,49 @@ public class StackerOutC1(ConveyOperation conveyOperation, DataBaseData dataBase
}
else // 两个地区都存在任务
{
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))
// 比对两个区的箱子数量
var readResult_1 = CommonTool.Siemens.ReadInt16WithName($"数量1");
var readResult_2 = CommonTool.Siemens.ReadInt16WithName($"数量2");
if (readResult_1.Value >= readResult_2.Value)//前区数量多去后区
{
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;
}
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;
}
}