using System;
|
using System.Linq;
|
using HH.WCS.Mobox3.Template.Entity;
|
using HH.WCS.Mobox3.Template.Entity.Dto;
|
using HH.WCS.Mobox3.Template.Util.Helper;
|
|
namespace HH.WCS.Mobox3.Template.Controller.Service
|
{
|
/// <summary>
|
/// 作业实现类
|
/// </summary>
|
public static class OperationService
|
{
|
/// <summary>
|
/// 推送作业
|
/// </summary>
|
/// <param name="operationCode">任务号</param>
|
/// <returns></returns>
|
public static ResultDto<object> SendOperation(string operationCode)
|
{
|
var result = new ResultDto<object>();
|
|
// 查询该托盘作业是否存在
|
var operation = AdoSqlHelper<Operation>.QueryFirst(p=>p.S_CODE == operationCode);
|
|
// 任务不存在
|
if (operation == null)
|
{
|
// 任务不存在
|
result.code = 400;
|
result.msg = "当前任务不存在";
|
return result;
|
}
|
|
// 任务存在,下发任务给线体到指定终点
|
var conveyorlinesInfoDto = Settings.ConveyorlinesInfos.First(p=>p.purpose == "入库口");
|
|
// 给入库口写条形码以及目的地,任务号等数据
|
// S7....
|
|
// 修改任务状态
|
operation.N_B_STATE = 1;
|
operation.S_B_STATE = "执行中";
|
operation.T_START_TIME = DateTime.Now;
|
AdoSqlHelper<Operation>.UpdateFirst(operation, p => new { p.N_B_STATE, p.S_B_STATE, p.T_START_TIME });
|
|
result.code = 200;
|
result.msg = "任务推送成功";
|
return result;
|
}
|
}
|
}
|