<add>[important]添加拣选站台5扫码逻辑
This commit is contained in:
parent
7160730c40
commit
9691bcedb9
|
|
@ -12,7 +12,12 @@ namespace WcsMain.Business.Convey.HistoryDataHandler.HisGetData;
|
|||
/// <summary>
|
||||
/// 拣选站台的逻辑
|
||||
/// </summary>
|
||||
/// <remarks></remarks>
|
||||
/// <param name="conveyOperation"></param>
|
||||
/// <param name="dataBaseData"></param>
|
||||
/// <param name="conveyTaskDao"></param>
|
||||
/// <remarks>
|
||||
/// P1、P2、P3、P4、P6、P7、P8
|
||||
/// </remarks>
|
||||
public class PickStandGetData(ConveyOperation conveyOperation, DataBaseData dataBaseData, AppConveyTaskDao conveyTaskDao) : IBaseGetData
|
||||
{
|
||||
private readonly ConveyOperation _conveyOperation = conveyOperation;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,167 @@
|
|||
using WcsMain.Business.Convey.HistoryDataHandler.HisGetData.I;
|
||||
using WcsMain.Common;
|
||||
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>
|
||||
/// 拣选站台 P5
|
||||
/// </summary>
|
||||
/// <param name="conveyOperation"></param>
|
||||
/// <param name="dataBaseData"></param>
|
||||
/// <param name="conveyTaskDao"></param>
|
||||
public class PickStandP5(ConveyOperation conveyOperation, DataBaseData dataBaseData, AppConveyTaskDao conveyTaskDao) : IBaseGetData
|
||||
{
|
||||
private readonly ConveyOperation _conveyOperation = conveyOperation;
|
||||
private readonly DataBaseData _dataBaseData = dataBaseData;
|
||||
private readonly AppConveyTaskDao _conveyTaskDao = conveyTaskDao;
|
||||
|
||||
/// <summary>
|
||||
/// 读码失败
|
||||
/// </summary>
|
||||
/// <param name="disPlayName"></param>
|
||||
/// <param name="msg"></param>
|
||||
/// <param name="area"></param>
|
||||
/// <param name="routerMethodData"></param>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读码成功
|
||||
/// </summary>
|
||||
/// <param name="disPlayName"></param>
|
||||
/// <param name="msg"></param>
|
||||
/// <param name="area"></param>
|
||||
/// <param name="routerMethodData"></param>
|
||||
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.Router_2); // 右移栽出环线
|
||||
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;
|
||||
}
|
||||
/* 判断有没有这个站台的任务 */
|
||||
var conveyTask = conveyTasks.Find(f => f.Location == area);
|
||||
if(conveyTask != default) // 存在任务
|
||||
{
|
||||
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}");
|
||||
int updateResult = _conveyTaskDao.Update(new AppConveyTask() { TaskId = conveyTask.TaskId, MoveTime = DateTime.Now, TaskStatus = (int)ConveyTaskStatusEnum.moved });
|
||||
if (updateResult < 1)
|
||||
{
|
||||
ConsoleLog.Warning($"【警告】拣选站台:{area} 箱码:{msg} 更新移栽状态失败");
|
||||
}
|
||||
else
|
||||
{
|
||||
ConsoleLog.Success($"拣选站台:{area} 箱码:{msg} 更新移栽状态成功");
|
||||
}
|
||||
return;
|
||||
}
|
||||
ConsoleLog.Warning($"【警告】拣选站台:{area} 箱码:{msg},写入PLC失败,{plcTaskOk},信息:{errTextOk}");
|
||||
return;
|
||||
}
|
||||
/* 检查有没有 (6~9) pick2区的任务 */
|
||||
List<AppConveyStand> pick2Stand = CommonData.AppConveyStands.FindAll(f => f.StandType == (int)ConveyStandTypeEnum.pick && f.Area == "pick2");
|
||||
List<string?> pick2Stands = pick2Stand.Select(f => f.StandId).ToList();
|
||||
bool exists = false; // 默认不存在 6~9 站台(pick2 区域) 任务
|
||||
foreach (var conveyTaskItem in conveyTasks)
|
||||
{
|
||||
if (pick2Stands.Contains(conveyTaskItem.Location))
|
||||
{
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(exists) // 存在 6~9 站台(pick2 区域) 任务
|
||||
{
|
||||
ConsoleLog.Info($"拣选站台:{area} 箱码:{msg} 存在pick2区域的任务");
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
ConsoleLog.Warning($"【警告】拣选站台:{area} 箱码:{msg} 无 pick2 区域拣选任务");
|
||||
ConveyPLCTask plcTask = new(plcId, (short)ConveyRouterEnum.Router_2); // 右移栽出环线
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
"AllowedHosts": "*",
|
||||
"Settings": {
|
||||
"DBMysql": "server=192.168.103.200;port=3306;user=developer;password=developer;database=wcs_main;",
|
||||
"DBMysqlLocal": "server=192.168.234.128;port=3306;user=developer;password=developer;database=wcs_suzhoukt;",
|
||||
"DBMysqlLocal": "server=112.4.208.194;port=3001;user=developer;password=developer;database=wcs_kate_suzhou;",
|
||||
|
||||
"DBMssql": "Data Source=192.168.142.131;Initial Catalog=wcs;User Id=sa;Password=Sa123;",
|
||||
"DBMssqlLocal": "Data Source=192.168.142.131;Initial Catalog=wcs_stacker;User Id=sa;Password=Sa123;",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user