刘先源
2 months ago
21 changed files with 1806 additions and 14 deletions
@ -1,9 +1,61 @@ |
|||
package org.nl.wms.ext.mes.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Description: wms请求acs |
|||
* @Date: 2023/8/3 |
|||
*/ |
|||
public interface WmsToMesService { |
|||
|
|||
/** |
|||
* 通知mes任务完成组织数据 |
|||
* @param task:任务实体类 |
|||
* @return JSONObject:返回结果 |
|||
*/ |
|||
JSONObject receiveTaskStatusMesData(SchBaseTask task); |
|||
|
|||
|
|||
/** |
|||
* 通知mes任务完成 |
|||
* @param jo: { |
|||
* "header": { |
|||
* "method": "ServicesCUS.Module_CUS.CUS_AcceptAGVReturnInformation", |
|||
* "account": "DS", |
|||
* "password": "DS", |
|||
* "version": "", |
|||
* "modules": [], |
|||
* "mac": "", |
|||
* "lang": "zh_CN", |
|||
* "is_debug": true, |
|||
* "platform": "web", |
|||
* "session": "" |
|||
* }, |
|||
* "content": { |
|||
* "TaskCode": "RS1#2023-10-18000001", |
|||
* "AGVCode": "111", |
|||
* "ArrivedLocation": "111", |
|||
* "IsPlacedLocation": "0" |
|||
* } |
|||
* } |
|||
* @return JSONObject:返回参数 { |
|||
* "isSuccess": true, |
|||
* "needUpdate": false, |
|||
* "needLogout": false, |
|||
* "Code": 0, |
|||
* "uri": "ServicesCUS.Module_CUS.CUS_AcceptAGVReturnInformation", |
|||
* "Message": "", |
|||
* "Exception": null, |
|||
* "ExceptionMessage": null, |
|||
* "StackTrace": null, |
|||
* "Content": { |
|||
* "ReturnStatus": 0, |
|||
* "ReturnInfo": "返回成功", |
|||
* "MsgTime": "2023-10-19 10:59:56" |
|||
* } |
|||
* } |
|||
*/ |
|||
JSONObject receiveTaskStatusMes(JSONObject jo); |
|||
} |
|||
|
@ -0,0 +1,139 @@ |
|||
package org.nl.wms.ext.mes.service.dto; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class ResultTaskConfirmMesDto { |
|||
|
|||
/* |
|||
* 方法 |
|||
*/ |
|||
private String method; |
|||
|
|||
/* |
|||
* 账号 |
|||
*/ |
|||
private String account; |
|||
|
|||
/* |
|||
* 密码 |
|||
*/ |
|||
private String password; |
|||
|
|||
/* |
|||
* 版本 |
|||
*/ |
|||
private String version; |
|||
|
|||
/* |
|||
* 模块 |
|||
*/ |
|||
private JSONArray modules; |
|||
|
|||
/* |
|||
* mac |
|||
*/ |
|||
private String mac; |
|||
|
|||
/* |
|||
* 语言 |
|||
*/ |
|||
private String lang; |
|||
|
|||
/* |
|||
* 是否debug |
|||
*/ |
|||
private boolean is_debug; |
|||
|
|||
/* |
|||
* 表单 |
|||
*/ |
|||
private String platform; |
|||
|
|||
/* |
|||
* session |
|||
*/ |
|||
private String session; |
|||
|
|||
public String getMethod() { |
|||
return "ServicesCUS.Module_CUS.CUS_AcceptAGVReturnInformation"; |
|||
} |
|||
|
|||
public void setMethod(String method) { |
|||
this.method = method; |
|||
} |
|||
|
|||
public String getAccount() { |
|||
return "DS"; |
|||
} |
|||
|
|||
public void setAccount(String account) { |
|||
this.account = account; |
|||
} |
|||
|
|||
public String getPassword() { |
|||
return "DS"; |
|||
} |
|||
|
|||
public void setPassword(String password) { |
|||
this.password = password; |
|||
} |
|||
|
|||
public String getVersion() { |
|||
return ""; |
|||
} |
|||
|
|||
public void setVersion(String version) { |
|||
this.version = version; |
|||
} |
|||
|
|||
public JSONArray getModules() { |
|||
return new JSONArray(); |
|||
} |
|||
|
|||
public void setModules(JSONArray modules) { |
|||
this.modules = modules; |
|||
} |
|||
|
|||
public String getMac() { |
|||
return ""; |
|||
} |
|||
|
|||
public void setMac(String mac) { |
|||
this.mac = mac; |
|||
} |
|||
|
|||
public String getLang() { |
|||
return "zh_CN"; |
|||
} |
|||
|
|||
public void setLang(String lang) { |
|||
this.lang = lang; |
|||
} |
|||
|
|||
public boolean getIs_debug() { |
|||
return true; |
|||
} |
|||
|
|||
public void setIs_debug(boolean is_debug) { |
|||
this.is_debug = is_debug; |
|||
} |
|||
|
|||
public String getPlatform() { |
|||
return "web"; |
|||
} |
|||
|
|||
public void setPlatform(String platform) { |
|||
this.platform = platform; |
|||
} |
|||
|
|||
public String getSession() { |
|||
return ""; |
|||
} |
|||
|
|||
public void setSession(String session) { |
|||
this.session = session; |
|||
} |
|||
} |
@ -0,0 +1,139 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks.fj; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.config.IdUtil; |
|||
import org.nl.wms.ext.mes.service.WmsToMesService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.AcsTaskDto; |
|||
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.util.TaskUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* @Author: lxy |
|||
* @Description: AB区送模具到地面货架 |
|||
* @Date: 2024/9/24 |
|||
*/ |
|||
@Component(value = "KABDMTask") |
|||
@TaskType("KABDMTask") |
|||
public class KABDMTask extends AbstractTask { |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
|
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
|
|||
@Autowired |
|||
private WmsToMesService wmsToMesService; |
|||
|
|||
@Override |
|||
public String create(JSONObject json) { |
|||
SchBaseTask task = new SchBaseTask(); |
|||
task.setTask_id(IdUtil.getStringId()); |
|||
task.setTask_code(json.getString("TaskCode")); |
|||
task.setTask_status(TaskStatus.CREATE.getCode()); |
|||
task.setConfig_code(json.getString("task_type")); |
|||
task.setPoint_code1(json.getString("PickingLocation")); |
|||
task.setPoint_code2(json.getString("PlacedLocation")); |
|||
task.setRequest_param(json.toString()); |
|||
task.setPriority(json.getString("Priority")); |
|||
task.setCreate_id(SecurityUtils.getCurrentUserId()); |
|||
task.setCreate_name(SecurityUtils.getCurrentNickName()); |
|||
task.setCreate_time(DateUtil.now()); |
|||
taskService.save(task); |
|||
return task.getTask_id(); |
|||
} |
|||
|
|||
@Override |
|||
public AcsTaskDto sendAcsParam(String taskId) { |
|||
SchBaseTask taskDao = taskService.getById(taskId); |
|||
|
|||
// 组织下发给acs的数据
|
|||
AcsTaskDto acsTaskDto = new AcsTaskDto(); |
|||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id()); |
|||
acsTaskDto.setTask_code(taskDao.getTask_code()); |
|||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1()); |
|||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2()); |
|||
acsTaskDto.setPriority(taskDao.getPriority()); |
|||
acsTaskDto.setTask_type("1"); |
|||
|
|||
return acsTaskDto; |
|||
} |
|||
|
|||
@Override |
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { |
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
TaskUtils.setUpdateByAcs(taskObj); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
|
|||
// 通知mes任务完成
|
|||
wmsToMesService.receiveTaskStatusMesData(taskObj); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
} |
@ -0,0 +1,139 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks.fj; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.config.IdUtil; |
|||
import org.nl.wms.ext.mes.service.WmsToMesService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.AcsTaskDto; |
|||
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.util.TaskUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* @Author: lxy |
|||
* @Description: 地面货架送模具到AB区 |
|||
* @Date: 2024/9/24 |
|||
*/ |
|||
@Component(value = "KDMABTask") |
|||
@TaskType("KDMABTask") |
|||
public class KDMABTask extends AbstractTask { |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
|
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
|
|||
@Autowired |
|||
private WmsToMesService wmsToMesService; |
|||
|
|||
@Override |
|||
public String create(JSONObject json) { |
|||
SchBaseTask task = new SchBaseTask(); |
|||
task.setTask_id(IdUtil.getStringId()); |
|||
task.setTask_code(json.getString("TaskCode")); |
|||
task.setTask_status(TaskStatus.CREATE.getCode()); |
|||
task.setConfig_code(json.getString("task_type")); |
|||
task.setPoint_code1(json.getString("PickingLocation")); |
|||
task.setPoint_code2(json.getString("PlacedLocation")); |
|||
task.setRequest_param(json.toString()); |
|||
task.setPriority(json.getString("Priority")); |
|||
task.setCreate_id(SecurityUtils.getCurrentUserId()); |
|||
task.setCreate_name(SecurityUtils.getCurrentNickName()); |
|||
task.setCreate_time(DateUtil.now()); |
|||
taskService.save(task); |
|||
return task.getTask_id(); |
|||
} |
|||
|
|||
@Override |
|||
public AcsTaskDto sendAcsParam(String taskId) { |
|||
SchBaseTask taskDao = taskService.getById(taskId); |
|||
|
|||
// 组织下发给acs的数据
|
|||
AcsTaskDto acsTaskDto = new AcsTaskDto(); |
|||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id()); |
|||
acsTaskDto.setTask_code(taskDao.getTask_code()); |
|||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1()); |
|||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2()); |
|||
acsTaskDto.setPriority(taskDao.getPriority()); |
|||
acsTaskDto.setTask_type("1"); |
|||
|
|||
return acsTaskDto; |
|||
} |
|||
|
|||
@Override |
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { |
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
TaskUtils.setUpdateByAcs(taskObj); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
|
|||
// 通知mes任务完成
|
|||
wmsToMesService.receiveTaskStatusMesData(taskObj); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
} |
@ -0,0 +1,139 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks.fj; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.config.IdUtil; |
|||
import org.nl.wms.ext.mes.service.WmsToMesService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.AcsTaskDto; |
|||
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.util.TaskUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* @Author: lxy |
|||
* @Description: AB区送满托盘到地面货架 |
|||
* @Date: 2024/9/24 |
|||
*/ |
|||
@Component(value = "MABDMTask") |
|||
@TaskType("MABDMTask") |
|||
public class MABDMTask extends AbstractTask { |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
|
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
|
|||
@Autowired |
|||
private WmsToMesService wmsToMesService; |
|||
|
|||
@Override |
|||
public String create(JSONObject json) { |
|||
SchBaseTask task = new SchBaseTask(); |
|||
task.setTask_id(IdUtil.getStringId()); |
|||
task.setTask_code(json.getString("TaskCode")); |
|||
task.setTask_status(TaskStatus.CREATE.getCode()); |
|||
task.setConfig_code(json.getString("task_type")); |
|||
task.setPoint_code1(json.getString("PickingLocation")); |
|||
task.setPoint_code2(json.getString("PlacedLocation")); |
|||
task.setRequest_param(json.toString()); |
|||
task.setPriority(json.getString("Priority")); |
|||
task.setCreate_id(SecurityUtils.getCurrentUserId()); |
|||
task.setCreate_name(SecurityUtils.getCurrentNickName()); |
|||
task.setCreate_time(DateUtil.now()); |
|||
taskService.save(task); |
|||
return task.getTask_id(); |
|||
} |
|||
|
|||
@Override |
|||
public AcsTaskDto sendAcsParam(String taskId) { |
|||
SchBaseTask taskDao = taskService.getById(taskId); |
|||
|
|||
// 组织下发给acs的数据
|
|||
AcsTaskDto acsTaskDto = new AcsTaskDto(); |
|||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id()); |
|||
acsTaskDto.setTask_code(taskDao.getTask_code()); |
|||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1()); |
|||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2()); |
|||
acsTaskDto.setPriority(taskDao.getPriority()); |
|||
acsTaskDto.setTask_type("1"); |
|||
|
|||
return acsTaskDto; |
|||
} |
|||
|
|||
@Override |
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { |
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
TaskUtils.setUpdateByAcs(taskObj); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
|
|||
// 通知mes任务完成
|
|||
wmsToMesService.receiveTaskStatusMesData(taskObj); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
} |
@ -0,0 +1,139 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks.fj; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.config.IdUtil; |
|||
import org.nl.wms.ext.mes.service.WmsToMesService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.AcsTaskDto; |
|||
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.util.TaskUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* @Author: lxy |
|||
* @Description: AB区送满托盘到钢平台货架 |
|||
* @Date: 2024/9/24 |
|||
*/ |
|||
@Component(value = "MABGPTHJTask") |
|||
@TaskType("MABGPTHJTask") |
|||
public class MABGPTHJTask extends AbstractTask { |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
|
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
|
|||
@Autowired |
|||
private WmsToMesService wmsToMesService; |
|||
|
|||
@Override |
|||
public String create(JSONObject json) { |
|||
SchBaseTask task = new SchBaseTask(); |
|||
task.setTask_id(IdUtil.getStringId()); |
|||
task.setTask_code(json.getString("TaskCode")); |
|||
task.setTask_status(TaskStatus.CREATE.getCode()); |
|||
task.setConfig_code(json.getString("task_type")); |
|||
task.setPoint_code1(json.getString("PickingLocation")); |
|||
task.setPoint_code2(json.getString("PlacedLocation")); |
|||
task.setRequest_param(json.toString()); |
|||
task.setPriority(json.getString("Priority")); |
|||
task.setCreate_id(SecurityUtils.getCurrentUserId()); |
|||
task.setCreate_name(SecurityUtils.getCurrentNickName()); |
|||
task.setCreate_time(DateUtil.now()); |
|||
taskService.save(task); |
|||
return task.getTask_id(); |
|||
} |
|||
|
|||
@Override |
|||
public AcsTaskDto sendAcsParam(String taskId) { |
|||
SchBaseTask taskDao = taskService.getById(taskId); |
|||
|
|||
// 组织下发给acs的数据
|
|||
AcsTaskDto acsTaskDto = new AcsTaskDto(); |
|||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id()); |
|||
acsTaskDto.setTask_code(taskDao.getTask_code()); |
|||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1()); |
|||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2()); |
|||
acsTaskDto.setPriority(taskDao.getPriority()); |
|||
acsTaskDto.setTask_type("1"); |
|||
|
|||
return acsTaskDto; |
|||
} |
|||
|
|||
@Override |
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { |
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
TaskUtils.setUpdateByAcs(taskObj); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
|
|||
// 通知mes任务完成
|
|||
wmsToMesService.receiveTaskStatusMesData(taskObj); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
} |
@ -0,0 +1,139 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks.fj; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.config.IdUtil; |
|||
import org.nl.wms.ext.mes.service.WmsToMesService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.AcsTaskDto; |
|||
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.util.TaskUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* @Author: lxy |
|||
* @Description: 包装线下料送满托到拆盘机 |
|||
* @Date: 2024/9/24 |
|||
*/ |
|||
@Component(value = "MBZCPTask") |
|||
@TaskType("MBZCPTask") |
|||
public class MBZCPTask extends AbstractTask { |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
|
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
|
|||
@Autowired |
|||
private WmsToMesService wmsToMesService; |
|||
|
|||
@Override |
|||
public String create(JSONObject json) { |
|||
SchBaseTask task = new SchBaseTask(); |
|||
task.setTask_id(IdUtil.getStringId()); |
|||
task.setTask_code(json.getString("TaskCode")); |
|||
task.setTask_status(TaskStatus.CREATE.getCode()); |
|||
task.setConfig_code(json.getString("task_type")); |
|||
task.setPoint_code1(json.getString("PickingLocation")); |
|||
task.setPoint_code2(json.getString("PlacedLocation")); |
|||
task.setRequest_param(json.toString()); |
|||
task.setPriority(json.getString("Priority")); |
|||
task.setCreate_id(SecurityUtils.getCurrentUserId()); |
|||
task.setCreate_name(SecurityUtils.getCurrentNickName()); |
|||
task.setCreate_time(DateUtil.now()); |
|||
taskService.save(task); |
|||
return task.getTask_id(); |
|||
} |
|||
|
|||
@Override |
|||
public AcsTaskDto sendAcsParam(String taskId) { |
|||
SchBaseTask taskDao = taskService.getById(taskId); |
|||
|
|||
// 组织下发给acs的数据
|
|||
AcsTaskDto acsTaskDto = new AcsTaskDto(); |
|||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id()); |
|||
acsTaskDto.setTask_code(taskDao.getTask_code()); |
|||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1()); |
|||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2()); |
|||
acsTaskDto.setPriority(taskDao.getPriority()); |
|||
acsTaskDto.setTask_type("1"); |
|||
|
|||
return acsTaskDto; |
|||
} |
|||
|
|||
@Override |
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { |
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
TaskUtils.setUpdateByAcs(taskObj); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
|
|||
// 通知mes任务完成
|
|||
wmsToMesService.receiveTaskStatusMesData(taskObj); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
} |
@ -0,0 +1,139 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks.fj; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.config.IdUtil; |
|||
import org.nl.wms.ext.mes.service.WmsToMesService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.AcsTaskDto; |
|||
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.util.TaskUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* @Author: lxy |
|||
* @Description: C区送满托盘到D区 |
|||
* @Date: 2024/9/24 |
|||
*/ |
|||
@Component(value = "MCDTask") |
|||
@TaskType("MCDTask") |
|||
public class MCDTask extends AbstractTask { |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
|
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
|
|||
@Autowired |
|||
private WmsToMesService wmsToMesService; |
|||
|
|||
@Override |
|||
public String create(JSONObject json) { |
|||
SchBaseTask task = new SchBaseTask(); |
|||
task.setTask_id(IdUtil.getStringId()); |
|||
task.setTask_code(json.getString("TaskCode")); |
|||
task.setTask_status(TaskStatus.CREATE.getCode()); |
|||
task.setConfig_code(json.getString("task_type")); |
|||
task.setPoint_code1(json.getString("PickingLocation")); |
|||
task.setPoint_code2(json.getString("PlacedLocation")); |
|||
task.setRequest_param(json.toString()); |
|||
task.setPriority(json.getString("Priority")); |
|||
task.setCreate_id(SecurityUtils.getCurrentUserId()); |
|||
task.setCreate_name(SecurityUtils.getCurrentNickName()); |
|||
task.setCreate_time(DateUtil.now()); |
|||
taskService.save(task); |
|||
return task.getTask_id(); |
|||
} |
|||
|
|||
@Override |
|||
public AcsTaskDto sendAcsParam(String taskId) { |
|||
SchBaseTask taskDao = taskService.getById(taskId); |
|||
|
|||
// 组织下发给acs的数据
|
|||
AcsTaskDto acsTaskDto = new AcsTaskDto(); |
|||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id()); |
|||
acsTaskDto.setTask_code(taskDao.getTask_code()); |
|||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1()); |
|||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2()); |
|||
acsTaskDto.setPriority(taskDao.getPriority()); |
|||
acsTaskDto.setTask_type("1"); |
|||
|
|||
return acsTaskDto; |
|||
} |
|||
|
|||
@Override |
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { |
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
TaskUtils.setUpdateByAcs(taskObj); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
|
|||
// 通知mes任务完成
|
|||
wmsToMesService.receiveTaskStatusMesData(taskObj); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
} |
@ -0,0 +1,139 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks.fj; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.config.IdUtil; |
|||
import org.nl.wms.ext.mes.service.WmsToMesService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.AcsTaskDto; |
|||
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.util.TaskUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* @Author: lxy |
|||
* @Description: D区送满托盘到地面货架 |
|||
* @Date: 2024/9/24 |
|||
*/ |
|||
@Component(value = "MDDMTask") |
|||
@TaskType("MDDMTask") |
|||
public class MDDMTask extends AbstractTask { |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
|
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
|
|||
@Autowired |
|||
private WmsToMesService wmsToMesService; |
|||
|
|||
@Override |
|||
public String create(JSONObject json) { |
|||
SchBaseTask task = new SchBaseTask(); |
|||
task.setTask_id(IdUtil.getStringId()); |
|||
task.setTask_code(json.getString("TaskCode")); |
|||
task.setTask_status(TaskStatus.CREATE.getCode()); |
|||
task.setConfig_code(json.getString("task_type")); |
|||
task.setPoint_code1(json.getString("PickingLocation")); |
|||
task.setPoint_code2(json.getString("PlacedLocation")); |
|||
task.setRequest_param(json.toString()); |
|||
task.setPriority(json.getString("Priority")); |
|||
task.setCreate_id(SecurityUtils.getCurrentUserId()); |
|||
task.setCreate_name(SecurityUtils.getCurrentNickName()); |
|||
task.setCreate_time(DateUtil.now()); |
|||
taskService.save(task); |
|||
return task.getTask_id(); |
|||
} |
|||
|
|||
@Override |
|||
public AcsTaskDto sendAcsParam(String taskId) { |
|||
SchBaseTask taskDao = taskService.getById(taskId); |
|||
|
|||
// 组织下发给acs的数据
|
|||
AcsTaskDto acsTaskDto = new AcsTaskDto(); |
|||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id()); |
|||
acsTaskDto.setTask_code(taskDao.getTask_code()); |
|||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1()); |
|||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2()); |
|||
acsTaskDto.setPriority(taskDao.getPriority()); |
|||
acsTaskDto.setTask_type("1"); |
|||
|
|||
return acsTaskDto; |
|||
} |
|||
|
|||
@Override |
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { |
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
TaskUtils.setUpdateByAcs(taskObj); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
|
|||
// 通知mes任务完成
|
|||
wmsToMesService.receiveTaskStatusMesData(taskObj); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
} |
@ -0,0 +1,139 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks.fj; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.config.IdUtil; |
|||
import org.nl.wms.ext.mes.service.WmsToMesService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.AcsTaskDto; |
|||
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.util.TaskUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* @Author: lxy |
|||
* @Description: 地面货架送满托盘到拆盘输送线 |
|||
* @Date: 2024/9/24 |
|||
*/ |
|||
@Component(value = "MDMCPTask") |
|||
@TaskType("MDMCPTask") |
|||
public class MDMCPTask extends AbstractTask { |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
|
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
|
|||
@Autowired |
|||
private WmsToMesService wmsToMesService; |
|||
|
|||
@Override |
|||
public String create(JSONObject json) { |
|||
SchBaseTask task = new SchBaseTask(); |
|||
task.setTask_id(IdUtil.getStringId()); |
|||
task.setTask_code(json.getString("TaskCode")); |
|||
task.setTask_status(TaskStatus.CREATE.getCode()); |
|||
task.setConfig_code(json.getString("task_type")); |
|||
task.setPoint_code1(json.getString("PickingLocation")); |
|||
task.setPoint_code2(json.getString("PlacedLocation")); |
|||
task.setRequest_param(json.toString()); |
|||
task.setPriority(json.getString("Priority")); |
|||
task.setCreate_id(SecurityUtils.getCurrentUserId()); |
|||
task.setCreate_name(SecurityUtils.getCurrentNickName()); |
|||
task.setCreate_time(DateUtil.now()); |
|||
taskService.save(task); |
|||
return task.getTask_id(); |
|||
} |
|||
|
|||
@Override |
|||
public AcsTaskDto sendAcsParam(String taskId) { |
|||
SchBaseTask taskDao = taskService.getById(taskId); |
|||
|
|||
// 组织下发给acs的数据
|
|||
AcsTaskDto acsTaskDto = new AcsTaskDto(); |
|||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id()); |
|||
acsTaskDto.setTask_code(taskDao.getTask_code()); |
|||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1()); |
|||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2()); |
|||
acsTaskDto.setPriority(taskDao.getPriority()); |
|||
acsTaskDto.setTask_type("1"); |
|||
|
|||
return acsTaskDto; |
|||
} |
|||
|
|||
@Override |
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { |
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
TaskUtils.setUpdateByAcs(taskObj); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
|
|||
// 通知mes任务完成
|
|||
wmsToMesService.receiveTaskStatusMesData(taskObj); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
} |
@ -0,0 +1,139 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks.fj; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.config.IdUtil; |
|||
import org.nl.wms.ext.mes.service.WmsToMesService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.AcsTaskDto; |
|||
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.util.TaskUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* @Author: lxy |
|||
* @Description: 钢平台货架送满托到AB生产区 |
|||
* @Date: 2024/9/24 |
|||
*/ |
|||
@Component(value = "MGPTHJABTask") |
|||
@TaskType("MGPTHJABTask") |
|||
public class MGPTHJABTask extends AbstractTask { |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
|
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
|
|||
@Autowired |
|||
private WmsToMesService wmsToMesService; |
|||
|
|||
@Override |
|||
public String create(JSONObject json) { |
|||
SchBaseTask task = new SchBaseTask(); |
|||
task.setTask_id(IdUtil.getStringId()); |
|||
task.setTask_code(json.getString("TaskCode")); |
|||
task.setTask_status(TaskStatus.CREATE.getCode()); |
|||
task.setConfig_code(json.getString("task_type")); |
|||
task.setPoint_code1(json.getString("PickingLocation")); |
|||
task.setPoint_code2(json.getString("PlacedLocation")); |
|||
task.setRequest_param(json.toString()); |
|||
task.setPriority(json.getString("Priority")); |
|||
task.setCreate_id(SecurityUtils.getCurrentUserId()); |
|||
task.setCreate_name(SecurityUtils.getCurrentNickName()); |
|||
task.setCreate_time(DateUtil.now()); |
|||
taskService.save(task); |
|||
return task.getTask_id(); |
|||
} |
|||
|
|||
@Override |
|||
public AcsTaskDto sendAcsParam(String taskId) { |
|||
SchBaseTask taskDao = taskService.getById(taskId); |
|||
|
|||
// 组织下发给acs的数据
|
|||
AcsTaskDto acsTaskDto = new AcsTaskDto(); |
|||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id()); |
|||
acsTaskDto.setTask_code(taskDao.getTask_code()); |
|||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1()); |
|||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2()); |
|||
acsTaskDto.setPriority(taskDao.getPriority()); |
|||
acsTaskDto.setTask_type("1"); |
|||
|
|||
return acsTaskDto; |
|||
} |
|||
|
|||
@Override |
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { |
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
TaskUtils.setUpdateByAcs(taskObj); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
|
|||
// 通知mes任务完成
|
|||
wmsToMesService.receiveTaskStatusMesData(taskObj); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
} |
@ -0,0 +1,139 @@ |
|||
package org.nl.wms.sch.task_manage.task.tasks.fj; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.config.IdUtil; |
|||
import org.nl.wms.ext.mes.service.WmsToMesService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch.task_manage.AbstractTask; |
|||
import org.nl.wms.sch.task_manage.AcsTaskDto; |
|||
import org.nl.wms.sch.task_manage.GeneralDefinition; |
|||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
|||
import org.nl.wms.sch.task_manage.task.TaskType; |
|||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.wms.util.TaskUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* @Author: lxy |
|||
* @Description: 钢平台货架送满托到拆盘机 |
|||
* @Date: 2024/9/24 |
|||
*/ |
|||
@Component(value = "MGPTHJCPTask") |
|||
@TaskType("MGPTHJCPTask") |
|||
public class MGPTHJCPTask extends AbstractTask { |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
|
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
|
|||
@Autowired |
|||
private WmsToMesService wmsToMesService; |
|||
|
|||
@Override |
|||
public String create(JSONObject json) { |
|||
SchBaseTask task = new SchBaseTask(); |
|||
task.setTask_id(IdUtil.getStringId()); |
|||
task.setTask_code(json.getString("TaskCode")); |
|||
task.setTask_status(TaskStatus.CREATE.getCode()); |
|||
task.setConfig_code(json.getString("task_type")); |
|||
task.setPoint_code1(json.getString("PickingLocation")); |
|||
task.setPoint_code2(json.getString("PlacedLocation")); |
|||
task.setRequest_param(json.toString()); |
|||
task.setPriority(json.getString("Priority")); |
|||
task.setCreate_id(SecurityUtils.getCurrentUserId()); |
|||
task.setCreate_name(SecurityUtils.getCurrentNickName()); |
|||
task.setCreate_time(DateUtil.now()); |
|||
taskService.save(task); |
|||
return task.getTask_id(); |
|||
} |
|||
|
|||
@Override |
|||
public AcsTaskDto sendAcsParam(String taskId) { |
|||
SchBaseTask taskDao = taskService.getById(taskId); |
|||
|
|||
// 组织下发给acs的数据
|
|||
AcsTaskDto acsTaskDto = new AcsTaskDto(); |
|||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id()); |
|||
acsTaskDto.setTask_code(taskDao.getTask_code()); |
|||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1()); |
|||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2()); |
|||
acsTaskDto.setPriority(taskDao.getPriority()); |
|||
acsTaskDto.setTask_type("1"); |
|||
|
|||
return acsTaskDto; |
|||
} |
|||
|
|||
@Override |
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { |
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
TaskUtils.setUpdateByAcs(taskObj); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
// 任务完成
|
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
|
|||
// 通知mes任务完成
|
|||
wmsToMesService.receiveTaskStatusMesData(taskObj); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
taskObj.setFinished_type(taskFinishedType.getCode()); |
|||
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
} |
Loading…
Reference in new issue