<add>[important]添加出库异常口逻辑
This commit is contained in:
parent
e12ca2f02b
commit
6b29cd482f
|
|
@ -0,0 +1,102 @@
|
||||||
|
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>
|
||||||
|
/// 出库异常判断的扫码器 C2
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="conveyOperation"></param>
|
||||||
|
/// <param name="dataBaseData"></param>
|
||||||
|
/// <param name="conveyTaskDao"></param>
|
||||||
|
public class StackerOutErrC2(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.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* 判断条码有没有拣选任务 */
|
||||||
|
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.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;
|
||||||
|
}
|
||||||
|
if (conveyTasks.Count < 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;
|
||||||
|
}
|
||||||
|
// 存在拣选任务
|
||||||
|
ConsoleLog.Success($"出库异常口:{area} 箱码:{msg} 存在拣选任务");
|
||||||
|
ConveyPLCTask plcTaskOk = new(plcId, (short)ConveyRouterEnum.Go);
|
||||||
|
string errTextOk = _conveyOperation.WriteTask(area, plcTaskOk);
|
||||||
|
if (string.IsNullOrEmpty(errTextOk))
|
||||||
|
{
|
||||||
|
ConsoleLog.Success($"出库异常口:{area} 箱码:{msg},写入PLC成功,{plcTaskOk}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Warning($"【警告】出库异常口:{area} 箱码:{msg},写入PLC失败,{plcTaskOk},信息:{errTextOk}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user