<add>[important]初步处理重复入库任务
This commit is contained in:
parent
fcf6acb39b
commit
54d8744dd5
|
|
@ -0,0 +1,31 @@
|
||||||
|
using DataCheck;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.WcsDto.ElTag;
|
||||||
|
|
||||||
|
public class GetStackerTaskNewDestinationRequest
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务号
|
||||||
|
/// </summary>
|
||||||
|
[DataRules]
|
||||||
|
[JsonPropertyName("taskId")]
|
||||||
|
public string? TaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 新终点
|
||||||
|
/// </summary>
|
||||||
|
[DataRules]
|
||||||
|
[JsonPropertyName("destination")]
|
||||||
|
public string? Destination { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具号
|
||||||
|
/// </summary>
|
||||||
|
[DataRules]
|
||||||
|
[JsonPropertyName("vehicleNo")]
|
||||||
|
public string? VehicleNo { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using WcsMain.ApiServe.ControllerFilter;
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.ElTag;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WMSEntity;
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WMSEntity.WmsTask;
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity.WmsTask;
|
||||||
using WcsMain.ApiServe.Service.WmsService;
|
using WcsMain.ApiServe.Service.WmsService;
|
||||||
|
|
@ -41,6 +42,17 @@ public class WmsTaskController(WmsTaskService wmsTaskService) : ControllerBase
|
||||||
return _wmsTaskService.UpdateStackerTaskStatus(request);
|
return _wmsTaskService.UpdateStackerTaskStatus(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WMS向WCS发送任务新终点,卸货位置有货的时候
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("setStackerTaskNewDestination")]
|
||||||
|
public WmsApiResponse GetStackerTaskNewDestination([FromBody] GetStackerTaskNewDestinationRequest request)
|
||||||
|
{
|
||||||
|
return _wmsTaskService.GetStackerTaskNewDestination(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using DataCheck;
|
using DataCheck;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.ElTag;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WMSEntity;
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WMSEntity.WmsTask;
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity.WmsTask;
|
||||||
using WcsMain.ApiServe.Factory;
|
using WcsMain.ApiServe.Factory;
|
||||||
|
|
@ -17,10 +18,11 @@ namespace WcsMain.ApiServe.Service.WmsService;
|
||||||
/// Wms任务接口逻辑
|
/// Wms任务接口逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Service]
|
[Service]
|
||||||
public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDao)
|
public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDao, AppWcsTaskDao wcsTaskDao)
|
||||||
{
|
{
|
||||||
private readonly AppWmsTaskDao _wmsTaskDao = wmsTaskDao;
|
private readonly AppWmsTaskDao _wmsTaskDao = wmsTaskDao;
|
||||||
private readonly WmsTaskAction _wmsTaskAction = wmsTaskAction;
|
private readonly WmsTaskAction _wmsTaskAction = wmsTaskAction;
|
||||||
|
private readonly AppWcsTaskDao _wcsTaskDao = wcsTaskDao;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 接收WMS任务数据处理
|
/// 接收WMS任务数据处理
|
||||||
|
|
@ -100,10 +102,10 @@ public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDa
|
||||||
case 0:
|
case 0:
|
||||||
string resetErrText = _wmsTaskAction.ResetWmsTaskStatus(request.TaskId, request.Destination, StaticString.WMS); // 重置任务
|
string resetErrText = _wmsTaskAction.ResetWmsTaskStatus(request.TaskId, request.Destination, StaticString.WMS); // 重置任务
|
||||||
return string.IsNullOrEmpty(resetErrText) ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.Fail(resetErrText);
|
return string.IsNullOrEmpty(resetErrText) ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.Fail(resetErrText);
|
||||||
case 3:
|
case 2:
|
||||||
string completeErrText = _wmsTaskAction.CompleteWmsTaskStatus(request.TaskId, StaticString.WMS); // 完成任务
|
string completeErrText = _wmsTaskAction.CompleteWmsTaskStatus(request.TaskId, StaticString.WMS); // 完成任务
|
||||||
return string.IsNullOrEmpty(completeErrText) ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.Fail(completeErrText);
|
return string.IsNullOrEmpty(completeErrText) ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.Fail(completeErrText);
|
||||||
case 999:
|
case 1:
|
||||||
string deleteErrText = _wmsTaskAction.DeleteWmsTaskStatus(request.TaskId, StaticString.WMS); // 删除任务
|
string deleteErrText = _wmsTaskAction.DeleteWmsTaskStatus(request.TaskId, StaticString.WMS); // 删除任务
|
||||||
return string.IsNullOrEmpty(deleteErrText) ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.Fail(deleteErrText);
|
return string.IsNullOrEmpty(deleteErrText) ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.Fail(deleteErrText);
|
||||||
default:
|
default:
|
||||||
|
|
@ -111,6 +113,35 @@ public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WMS向WCS发送任务新终点,卸货位置有货的时候
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WmsApiResponse GetStackerTaskNewDestination(GetStackerTaskNewDestinationRequest request)
|
||||||
|
{
|
||||||
|
if(!CheckData.CheckDataRules(request)) return WmsApiResponseFactory.RequestErr();
|
||||||
|
/* 查找该任务有没有无法卸货 */
|
||||||
|
List<AppWcsTask>? wcsTasks = _wcsTaskDao.Select(new AppWcsTask { TaskId = request.TaskId, TaskStatus = (int)WcsTaskStatusEnum.doubleIn });
|
||||||
|
if(wcsTasks == default) return WmsApiResponseFactory.DataBaseErr();
|
||||||
|
if(wcsTasks.Count() < 1) return WmsApiResponseFactory.Fail($"任务号:{request.TaskId} 没有无法卸货的情况");
|
||||||
|
wcsTasks = [.. wcsTasks.OrderByDescending(x => x.CompleteTime)];
|
||||||
|
var wcsTask = wcsTasks[0]; // 获取最新的一条任务
|
||||||
|
/* 如果是最后一条任务则更新WMS任务终点 */
|
||||||
|
if(wcsTask.IsLastTask())
|
||||||
|
{
|
||||||
|
_wmsTaskDao.Update(new AppWmsTask { TaskId = request.TaskId, Destination = request.Destination, TaskMsg = "WMS修改终点" });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -424,7 +424,7 @@ public class ExeTaskDoubleFork(
|
||||||
/* 判断这个任务是否出现卸货位置有货 */
|
/* 判断这个任务是否出现卸货位置有货 */
|
||||||
if(doubleTask.TaskStatus != (int)WcsTaskStatusEnum.doubleIn) { return false; } // 没有重复入库不执行下面方法
|
if(doubleTask.TaskStatus != (int)WcsTaskStatusEnum.doubleIn) { return false; } // 没有重复入库不执行下面方法
|
||||||
/* 查找这个任务的新任务 */
|
/* 查找这个任务的新任务 */
|
||||||
List<AppWcsTask>? newTasks = _wcsTaskDao.Select(new AppWcsTask { TaskId = doubleTask.TaskId, TaskType = (int)WcsTaskTypeEnum.newTaskForDoubleIn, TaskStatus = (int)WmsTaskStatusEnum.create });
|
List<AppWcsTask>? newTasks = _wcsTaskDao.Select(new AppWcsTask { TaskId = doubleTask.TaskId, TaskType = (int)WcsTaskTypeEnum.newTaskForDoubleIn, TaskStatus = (int)WcsTaskStatusEnum.create });
|
||||||
if (newTasks == default)
|
if (newTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机重复入库任务新任务查询失败,与数据库连接异常");
|
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机重复入库任务新任务查询失败,与数据库连接异常");
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,18 @@ public class AppWmsTaskDao
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 将taskId更新成新的
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="oldTaskId"></param>
|
||||||
|
/// <param name="newTaskId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int UpdateTaskId(string? oldTaskId, string? newTaskId)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user