using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Mvc;
|
using System.Threading.Tasks;
|
using WIDESEA_Core.Utilities;
|
using WIDESEA_Entity.DomainModels;
|
using WIDESEA_WCS;
|
using WIDESEA_Services.Services;
|
using System.Collections.Generic;
|
using WIDESEA_Common;
|
using WIDESEA_WCS.WCSClient;
|
using System.Linq;
|
using System;
|
using WIDESEA_Common.CutomerModel;
|
using WIDESEA_Services.Repositories;
|
using WIDESEA_Services;
|
|
namespace WIDESEA_WCSServer.Controllers.ToWMS
|
{
|
|
[Route("api/ToWMS")]
|
[ApiController]
|
public class ToWMSController : ControllerBase
|
{
|
|
/// <summary>
|
/// 接收WMS下发的任务
|
/// </summary>
|
/// <param name="taskinfo"></param>
|
/// <returns></returns>
|
[HttpPost, Route("ReceiveTaskFromWMS"), AllowAnonymous]
|
public WebResponseContent ReceiveTaskFromWMS([FromBody] List<WmsTaskInfo> taskinfo)
|
{
|
Dt_TaskWCSinfoRepository taskWCSinfoRepository = new Dt_TaskWCSinfoRepository(Dt_TaskWCSinfoRepository.Instance.DbContext);
|
Dt_TaskWCSinfoService taskWCSinfoService = new Dt_TaskWCSinfoService(taskWCSinfoRepository);
|
|
return taskWCSinfoService.AddTaskByWms(taskinfo);
|
|
}
|
|
|
|
/// <summary>
|
/// 取消一条未开始执行的任务
|
/// </summary>
|
/// <param name="saveModel"></param>
|
/// <returns></returns>
|
[HttpPost, Route("CancelATask"), AllowAnonymous]
|
public WebResponseContent CancelATask([FromBody] SaveModel saveModel)
|
{
|
Dt_TaskWCSinfoRepository taskWCSinfoRepository = new Dt_TaskWCSinfoRepository(Dt_TaskWCSinfoRepository.Instance.DbContext);
|
Dt_TaskWCSinfoService taskWCSinfoService = new Dt_TaskWCSinfoService(taskWCSinfoRepository);
|
|
return taskWCSinfoService.CancelATask(saveModel);
|
}
|
|
|
/// <summary>
|
/// WMS下发更改任务状态,给测量设备测量完毕后,更新WCS任务状态
|
/// </summary>
|
/// <param name="saveModel"></param>
|
/// <returns></returns>
|
[HttpPost, Route("UpdateWcsTaskState"), AllowAnonymous]
|
public WebResponseContent UpdateWcsTaskState([FromBody] SaveModel saveModel)
|
{
|
Dt_TaskWCSinfoRepository taskWCSinfoRepository = new Dt_TaskWCSinfoRepository(Dt_TaskWCSinfoRepository.Instance.DbContext);
|
Dt_TaskWCSinfoService taskWCSinfoService = new Dt_TaskWCSinfoService(taskWCSinfoRepository);
|
|
return taskWCSinfoService.UpdateWcsTaskState(saveModel);
|
}
|
|
|
/// <summary>
|
/// WMS下发更改任务信息,当入库任务与出库测量任务冲突时,WMS调用此接口来更换目的货位
|
/// </summary>
|
/// <param name="saveModel"></param>
|
/// <returns></returns>
|
[HttpPost, Route("UpdateWcsTaskInformation"), AllowAnonymous]
|
public WebResponseContent UpdateWcsTaskInformation([FromBody] SaveModel saveModel)
|
{
|
Dt_TaskWCSinfoRepository taskWCSinfoRepository = new Dt_TaskWCSinfoRepository(Dt_TaskWCSinfoRepository.Instance.DbContext);
|
Dt_TaskWCSinfoService taskWCSinfoService = new Dt_TaskWCSinfoService(taskWCSinfoRepository);
|
|
return taskWCSinfoService.UpdateWcsTaskInformation(saveModel);
|
}
|
|
|
/// <summary>
|
/// 切换入库线体区的模式,正常模式和应急模式
|
/// </summary>
|
[HttpPost, Route("ChangeInboundLineModel"), AllowAnonymous]
|
public WebResponseContent ChangeInboundLineModel([FromBody] SaveModel saveModel)
|
{
|
return WCSService.ChangeInboundLineModel(saveModel);
|
}
|
|
|
/// <summary>
|
/// 获取入库线体当前模式状态
|
/// </summary>
|
[HttpPost, Route("GetInboundLineCurrentModel"), AllowAnonymous]
|
public WebResponseContent GetInboundLineCurrentModel([FromBody] SaveModel saveModel)
|
{
|
return WCSService.GetInboundLineCurrentModel(saveModel);
|
}
|
|
|
/// <summary>
|
/// 当校验托盘码不一致时,人工触发继续任务
|
/// </summary>
|
[HttpPost, Route("CheckBarcodeSameOk"), AllowAnonymous]
|
public WebResponseContent CheckBarcodeSameOk([FromBody] SaveModel saveModel)
|
{
|
return WCSService.CheckBarcodeSameOk(saveModel);
|
}
|
|
/// <summary>
|
/// 称重后,由人工继续任务
|
/// </summary>
|
[HttpPost, Route("WeightCheckOk"), AllowAnonymous]
|
public WebResponseContent WeightCheckOk([FromBody] SaveModel saveModel)
|
{
|
return WCSService.WeightCheckOk(saveModel);
|
}
|
|
|
/// <summary>
|
/// 取消测量,直接回库
|
/// </summary>
|
[HttpPost, Route("CancelAMeasureTask"), AllowAnonymous]
|
public WebResponseContent CancelAMeasureTask([FromBody] SaveModel saveModel)
|
{
|
Dt_TaskWCSinfoRepository taskWCSinfoRepository = new Dt_TaskWCSinfoRepository(Dt_TaskWCSinfoRepository.Instance.DbContext);
|
Dt_TaskWCSinfoService taskWCSinfoService = new Dt_TaskWCSinfoService(taskWCSinfoRepository);
|
|
return taskWCSinfoService.CancelAMeasureTask(saveModel);
|
}
|
|
}
|
}
|