<add>[important]添加1区出口扫码逻辑
This commit is contained in:
parent
6b29cd482f
commit
b78f8886eb
|
|
@ -0,0 +1,120 @@
|
||||||
|
using WcsMain.Business.Convey.HistoryDataHandler.HisGetData.I;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.DataService;
|
||||||
|
using WcsMain.Enum.Convey;
|
||||||
|
using WcsMain.EquipOperation.Convey;
|
||||||
|
using WcsMain.EquipOperation.Entity;
|
||||||
|
using WcsMain.ExtendMethod;
|
||||||
|
|
||||||
|
namespace WcsMain.Business.Convey.HistoryDataHandler.HisGetData;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 1~5 站台环线的出口
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="conveyOperation"></param>
|
||||||
|
/// <param name="dataBaseData"></param>
|
||||||
|
/// <param name="conveyTaskDao"></param>
|
||||||
|
public class Pick1StandOutC3(ConveyOperation conveyOperation, DataBaseData dataBaseData, AppConveyTaskDao conveyTaskDao) : IBaseGetData
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly ConveyOperation _conveyOperation = conveyOperation;
|
||||||
|
private readonly DataBaseData _dataBaseData = dataBaseData;
|
||||||
|
private readonly AppConveyTaskDao _conveyTaskDao = conveyTaskDao;
|
||||||
|
|
||||||
|
public void ReadFail(string? disPlayName, string msg, string? area, AppRouterMethod routerMethodData)
|
||||||
|
{
|
||||||
|
int plcId = _dataBaseData.GetNewPlcTaskId() ?? StaticData.StaticInt.ErrPlcId;
|
||||||
|
ConveyPLCTask plcTask = new(plcId, (short)ConveyRouterEnum.Move); // 读码失败,移栽进环线继续
|
||||||
|
string errText = _conveyOperation.WriteTask(area, plcTask);
|
||||||
|
if (string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Success($"一区出口:{area} 读码失败,写入PLC成功,{plcTask}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Warning($"【警告】一区出口:{area} 读码失败,写入PLC失败,{plcTask},信息:{errText}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReadSuccess(string? disPlayName, string msg, string? area, AppRouterMethod routerMethodData)
|
||||||
|
{
|
||||||
|
int plcId = _dataBaseData.GetNewPlcTaskId() ?? StaticData.StaticInt.ErrPlcId; // 获取一个 plcId
|
||||||
|
(string code, string direction) = msg.FormatDir();
|
||||||
|
/* 判断方向是否正确 */
|
||||||
|
string? routerDirection = routerMethodData.AllowDirection;
|
||||||
|
if (!string.IsNullOrEmpty(routerDirection))
|
||||||
|
{
|
||||||
|
string[] dirs = routerDirection.Split(',');
|
||||||
|
if (!dirs.Contains(direction))
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】一区出口:{area} 箱码:{msg} 方向:{direction} 方向不正确,允许的方向为:{routerDirection}");
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* 判断条码有没有拣选任务 */
|
||||||
|
List<AppConveyTask>? conveyTasks = _conveyTaskDao.Query(new AppConveyTask { VehicleNo = code, TaskStatus = (int)ConveyTaskStatusEnum.create });
|
||||||
|
if (conveyTasks == default)
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】一区出口:{area} 箱码:{msg} 查询任务失败,和服务器连接中断");
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
if (conveyTasks.Count < 1)
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】一区出口:{area} 箱码:{msg} 无拣选任务");
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/* 判断拣选任务中有没有 1 号台的任务,若有则给一号路向 */
|
||||||
|
|
||||||
|
var pickStand1Task = conveyTasks.Find(f => f.Location == "P1");
|
||||||
|
if(pickStand1Task == default) // 不存在 1 号台任务
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】一区出口:{area} 箱码:{msg} 不存在一号台任务,环线运行");
|
||||||
|
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 号站台");
|
||||||
|
ConveyPLCTask plcTask = new(plcId, (short)ConveyRouterEnum.Router_1); // 存在一号台任务
|
||||||
|
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