add:对接MES缺料请求,叫满送空任务
opt:优化工单配盘
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
package org.nl.wms.ext_manage.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.wms.ext_manage.service.MesToWmsService;
|
||||||
|
import org.nl.wms.ext_manage.service.dto.MesTaskParams;
|
||||||
|
import org.nl.wms.welding_manage.service.work_order.IWorkOrderService;
|
||||||
|
import org.nl.wms.welding_manage.service.work_order.dto.WorkOrderDto;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/mes")
|
||||||
|
@Slf4j
|
||||||
|
public class MesToWmsController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MesToWmsService mesToWmsService;
|
||||||
|
@Autowired
|
||||||
|
private IWorkOrderService iWorkOrderService;
|
||||||
|
|
||||||
|
@PostMapping("/lineLackMat")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity task(@Valid @RequestBody MesTaskParams mesTaskParams){
|
||||||
|
mesToWmsService.task(mesTaskParams);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/subWorkOrder")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity subWorkOrder(@RequestBody WorkOrderDto dto){
|
||||||
|
iWorkOrderService.insert(dto);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package org.nl.wms.ext_manage.service;
|
||||||
|
|
||||||
|
import org.nl.wms.ext_manage.service.dto.MesTaskParams;
|
||||||
|
|
||||||
|
public interface MesToWmsService {
|
||||||
|
void task(MesTaskParams mesTaskParams);
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package org.nl.wms.ext_manage.service.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MesTaskParams {
|
||||||
|
@NotBlank(message = "产线不能为空")
|
||||||
|
@JsonProperty("LineCode")
|
||||||
|
private String lineCode;
|
||||||
|
|
||||||
|
@NotBlank(message = "用料位置不能为空")
|
||||||
|
@JsonProperty("PortCode")
|
||||||
|
private String portCode;
|
||||||
|
|
||||||
|
@NotBlank(message = "工单编码不能为空")
|
||||||
|
@JsonProperty("OrderCode")
|
||||||
|
private String orderCode;
|
||||||
|
|
||||||
|
@NotBlank(message = "RequestedCode不能为空")
|
||||||
|
@JsonProperty("RequestedCode")
|
||||||
|
private String requestedCode; //返空+送满 1 送满 2 返空 3 托盘余料退回 4
|
||||||
|
|
||||||
|
@JsonProperty("RequestedOn")
|
||||||
|
private String requestedOn;
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package org.nl.wms.ext_manage.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.config.SpringContextHolder;
|
||||||
|
import org.nl.wms.ext_manage.service.MesToWmsService;
|
||||||
|
import org.nl.wms.ext_manage.service.dto.MesTaskParams;
|
||||||
|
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||||
|
import org.nl.wms.sch_manage.service.core.tasks.LineCallFullTask;
|
||||||
|
import org.nl.wms.sch_manage.service.core.tasks.LineReturnEmptyTask;
|
||||||
|
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||||
|
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||||
|
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||||
|
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MesToWmsServiceImpl implements MesToWmsService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBasePointService iSchBasePointService;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public void task(MesTaskParams mesTaskParams) {
|
||||||
|
SchBasePoint portPoint = iSchBasePointService.selectByCode(mesTaskParams.getPortCode());
|
||||||
|
if (portPoint == null){
|
||||||
|
throw new BadRequestException(String.format("请求失败,点位%s信息不存在",mesTaskParams.getPortCode()));
|
||||||
|
}
|
||||||
|
String vehicleCode = portPoint.getVehicle_code();
|
||||||
|
|
||||||
|
switch (mesTaskParams.getRequestedCode()){
|
||||||
|
case "1" ://返空 + 送满
|
||||||
|
//不用处理顺序执行
|
||||||
|
case "3" ://返空
|
||||||
|
case "4" ://托盘余料退回
|
||||||
|
if (StrUtil.isEmptyIfStr(vehicleCode)){
|
||||||
|
throw new BadRequestException("请求失败,上料口没有绑定托盘");
|
||||||
|
}
|
||||||
|
//获取回空对接位
|
||||||
|
SchBasePoint pointDJ = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
||||||
|
.isNull(SchBasePoint::getVehicle_code)
|
||||||
|
.likeRight(SchBasePoint::getPoint_code, mesTaskParams.getLineCode() + "DJ"));
|
||||||
|
if (pointDJ == null){
|
||||||
|
throw new BadRequestException("未找到空闲返空对接位");
|
||||||
|
}
|
||||||
|
JSONObject taskFormReturn = new JSONObject();
|
||||||
|
taskFormReturn.put("config_code","LineReturnEmptyTask");
|
||||||
|
taskFormReturn.put("point_code1", portPoint.getPoint_code());
|
||||||
|
taskFormReturn.put("point_code2", pointDJ.getPoint_code());
|
||||||
|
taskFormReturn.put("vehicle_code", vehicleCode);
|
||||||
|
taskFormReturn.put("create_name", "MES");
|
||||||
|
LineReturnEmptyTask lineReturnEmptyTask = SpringContextHolder.getBean("LineReturnEmptyTask");
|
||||||
|
lineReturnEmptyTask.create(taskFormReturn);
|
||||||
|
if(Objects.equals(mesTaskParams.getRequestedCode(), "3") || Objects.equals(mesTaskParams.getRequestedCode(), "4")) break;
|
||||||
|
case "2" ://叫满
|
||||||
|
if (!StrUtil.isEmptyIfStr(vehicleCode) && Objects.equals(mesTaskParams.getRequestedCode(), "2")){
|
||||||
|
throw new BadRequestException("请求失败,上料口存在托盘占用");
|
||||||
|
}
|
||||||
|
//获取组盘信息
|
||||||
|
List<GroupPlate> groupList = iMdPbGroupplateService.list(new LambdaQueryWrapper<GroupPlate>()
|
||||||
|
.eq(GroupPlate::getLoad_port, portPoint.getPoint_code())
|
||||||
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
|
||||||
|
if (groupList.isEmpty()){
|
||||||
|
throw new BadRequestException("叫满任务失败,库存没有当前下料口的组盘物料");
|
||||||
|
}
|
||||||
|
String storagevehicleCode = groupList.get(0).getStoragevehicle_code();
|
||||||
|
//根据托盘获取当前起点
|
||||||
|
SchBasePoint start_point = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
||||||
|
.eq(SchBasePoint::getVehicle_code, storagevehicleCode));
|
||||||
|
JSONObject taskFormCall = new JSONObject();
|
||||||
|
taskFormCall.put("config_code","LineCallFullTask");
|
||||||
|
taskFormCall.put("point_code1", start_point.getPoint_code());
|
||||||
|
taskFormCall.put("point_code2", portPoint.getPoint_code());
|
||||||
|
taskFormCall.put("vehicle_code", storagevehicleCode);
|
||||||
|
taskFormCall.put("create_name", "MES");
|
||||||
|
LineCallFullTask lineCallFullTask = SpringContextHolder.getBean("LineCallFullTask");
|
||||||
|
lineCallFullTask.create(taskFormCall);
|
||||||
|
if (Objects.equals(mesTaskParams.getRequestedCode(), "2")) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
package org.nl.wms.sch_manage.service.core.tasks;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.common.utils.CodeUtil;
|
||||||
|
import org.nl.common.utils.IdUtil;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||||
|
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||||
|
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||||
|
import org.nl.wms.sch_manage.service.core.AbstractTask;
|
||||||
|
import org.nl.wms.sch_manage.service.core.AcsTaskDto;
|
||||||
|
import org.nl.wms.sch_manage.service.core.TaskType;
|
||||||
|
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||||
|
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||||
|
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: Liuxy
|
||||||
|
* @Description: 产线返空托盘
|
||||||
|
* @Date: 2025/6/6
|
||||||
|
*/
|
||||||
|
@Component(value = "LineCallFullTask")
|
||||||
|
@TaskType("LineCallFullTask")
|
||||||
|
public class LineCallFullTask extends AbstractTask {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务服务类
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseTaskService taskService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点位服务
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private ISchBasePointService iSchBasePointService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String create(JSONObject json) {
|
||||||
|
SchBaseTask task = new SchBaseTask();
|
||||||
|
task.setTask_id(IdUtil.getStringId());
|
||||||
|
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
||||||
|
task.setTask_status(TaskStatus.CREATE.getCode());
|
||||||
|
task.setConfig_code(json.getString("config_code"));
|
||||||
|
task.setPoint_code1(json.getString("point_code1"));
|
||||||
|
task.setPoint_code2(json.getString("point_code2"));
|
||||||
|
task.setVehicle_code(json.getString("vehicle_code"));
|
||||||
|
task.setRequest_param(json.toString());
|
||||||
|
task.setPriority(json.getString("Priority"));
|
||||||
|
task.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||||
|
task.setCreate_name(json.getString("create_name"));
|
||||||
|
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("执行中");
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
if (status.equals(TaskStatus.FINISHED)) {
|
||||||
|
this.finishTask(taskObj);
|
||||||
|
}
|
||||||
|
if (status.equals(TaskStatus.CANCELED)) {
|
||||||
|
this.cancelTask(taskObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceFinish(String task_code) {
|
||||||
|
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||||
|
if (ObjectUtil.isEmpty(taskObj)) {
|
||||||
|
throw new BadRequestException("该任务不存在");
|
||||||
|
}
|
||||||
|
this.finishTask(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_code) {
|
||||||
|
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||||
|
if (ObjectUtil.isEmpty(taskObj)) {
|
||||||
|
throw new BadRequestException("该任务不存在");
|
||||||
|
}
|
||||||
|
if (Integer.parseInt(taskObj.getTask_status()) > Integer.parseInt(TaskStatus.CREATE.getCode())) {
|
||||||
|
throw new BadRequestException("只能取消生成中的任务!");
|
||||||
|
}
|
||||||
|
this.cancelTask(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void finishTask(SchBaseTask taskObj) {
|
||||||
|
// 更新起点
|
||||||
|
iSchBasePointService.update(
|
||||||
|
new UpdateWrapper<SchBasePoint>().lambda()
|
||||||
|
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||||
|
.set(SchBasePoint::getVehicle_code, null)
|
||||||
|
.set(SchBasePoint::getIos_id, null)
|
||||||
|
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货"))
|
||||||
|
);
|
||||||
|
// 更新终点
|
||||||
|
iSchBasePointService.update(
|
||||||
|
new UpdateWrapper<SchBasePoint>().lambda()
|
||||||
|
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
|
||||||
|
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||||
|
.set(SchBasePoint::getIos_id, null)
|
||||||
|
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有货"))
|
||||||
|
);
|
||||||
|
// 更新任务
|
||||||
|
taskObj.setRemark("已完成");
|
||||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void cancelTask(SchBaseTask taskObj) {
|
||||||
|
// 更新起点
|
||||||
|
iSchBasePointService.update(
|
||||||
|
new UpdateWrapper<SchBasePoint>().lambda()
|
||||||
|
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||||
|
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货"))
|
||||||
|
);
|
||||||
|
// 更新终点
|
||||||
|
iSchBasePointService.update(
|
||||||
|
new UpdateWrapper<SchBasePoint>().lambda()
|
||||||
|
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
|
||||||
|
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货"))
|
||||||
|
);
|
||||||
|
// 更新任务
|
||||||
|
taskObj.setRemark("已取消");
|
||||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
package org.nl.wms.sch_manage.service.core.tasks;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.common.utils.CodeUtil;
|
||||||
|
import org.nl.common.utils.IdUtil;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||||
|
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||||
|
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||||
|
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||||
|
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||||
|
import org.nl.wms.sch_manage.service.core.AbstractTask;
|
||||||
|
import org.nl.wms.sch_manage.service.core.AcsTaskDto;
|
||||||
|
import org.nl.wms.sch_manage.service.core.TaskType;
|
||||||
|
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||||
|
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||||
|
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: Liuxy
|
||||||
|
* @Description: 产线返空托盘
|
||||||
|
* @Date: 2025/6/6
|
||||||
|
*/
|
||||||
|
@Component(value = "LineReturnEmptyTask")
|
||||||
|
@TaskType("LineReturnEmptyTask")
|
||||||
|
public class LineReturnEmptyTask extends AbstractTask {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务服务类
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseTaskService taskService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点位服务
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private ISchBasePointService iSchBasePointService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String create(JSONObject json) {
|
||||||
|
SchBaseTask task = new SchBaseTask();
|
||||||
|
task.setTask_id(IdUtil.getStringId());
|
||||||
|
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
||||||
|
task.setTask_status(TaskStatus.CREATE.getCode());
|
||||||
|
task.setConfig_code(json.getString("config_code"));
|
||||||
|
task.setPoint_code1(json.getString("point_code1"));
|
||||||
|
task.setPoint_code2(json.getString("point_code2"));
|
||||||
|
task.setVehicle_code(json.getString("vehicle_code"));
|
||||||
|
task.setRequest_param(json.toString());
|
||||||
|
task.setPriority(json.getString("Priority"));
|
||||||
|
task.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||||
|
task.setCreate_name(json.getString("create_name"));
|
||||||
|
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("执行中");
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
if (status.equals(TaskStatus.FINISHED)) {
|
||||||
|
this.finishTask(taskObj);
|
||||||
|
}
|
||||||
|
if (status.equals(TaskStatus.CANCELED)) {
|
||||||
|
this.cancelTask(taskObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceFinish(String task_code) {
|
||||||
|
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||||
|
if (ObjectUtil.isEmpty(taskObj)) {
|
||||||
|
throw new BadRequestException("该任务不存在");
|
||||||
|
}
|
||||||
|
this.finishTask(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_code) {
|
||||||
|
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||||
|
if (ObjectUtil.isEmpty(taskObj)) {
|
||||||
|
throw new BadRequestException("该任务不存在");
|
||||||
|
}
|
||||||
|
if (Integer.parseInt(taskObj.getTask_status()) > Integer.parseInt(TaskStatus.CREATE.getCode())) {
|
||||||
|
throw new BadRequestException("只能取消生成中的任务!");
|
||||||
|
}
|
||||||
|
this.cancelTask(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void finishTask(SchBaseTask taskObj) {
|
||||||
|
// 更新起点
|
||||||
|
iSchBasePointService.update(
|
||||||
|
new UpdateWrapper<SchBasePoint>().lambda()
|
||||||
|
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||||
|
.set(SchBasePoint::getVehicle_code, null)
|
||||||
|
.set(SchBasePoint::getIos_id, null)
|
||||||
|
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货"))
|
||||||
|
);
|
||||||
|
// 更新终点
|
||||||
|
iSchBasePointService.update(
|
||||||
|
new UpdateWrapper<SchBasePoint>().lambda()
|
||||||
|
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
|
||||||
|
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||||
|
.set(SchBasePoint::getIos_id, null)
|
||||||
|
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有货"))
|
||||||
|
);
|
||||||
|
// 更新任务
|
||||||
|
taskObj.setRemark("已完成");
|
||||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void cancelTask(SchBaseTask taskObj) {
|
||||||
|
// 更新起点
|
||||||
|
iSchBasePointService.update(
|
||||||
|
new UpdateWrapper<SchBasePoint>().lambda()
|
||||||
|
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||||
|
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货"))
|
||||||
|
);
|
||||||
|
// 更新终点
|
||||||
|
iSchBasePointService.update(
|
||||||
|
new UpdateWrapper<SchBasePoint>().lambda()
|
||||||
|
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
|
||||||
|
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货"))
|
||||||
|
);
|
||||||
|
// 更新任务
|
||||||
|
taskObj.setRemark("已取消");
|
||||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -113,4 +113,9 @@ public class GroupPlate implements Serializable {
|
|||||||
* 来源单据类型
|
* 来源单据类型
|
||||||
*/
|
*/
|
||||||
private String ext_type;
|
private String ext_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上料口
|
||||||
|
*/
|
||||||
|
private String load_port;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,8 @@
|
|||||||
|
|
||||||
<insert id="insertAllData">
|
<insert id="insertAllData">
|
||||||
INSERT INTO md_pb_groupplate(
|
INSERT INTO md_pb_groupplate(
|
||||||
group_id,storagevehicle_code,material_id,material_code,pcsn,qty,qty_unit_id,qty_unit_name,ext_code,load_port,create_id,create_name,create_time
|
group_id,storagevehicle_code,material_id,material_code,pcsn,qty,qty_unit_id,qty_unit_name,ext_code,load_port,create_id,create_name,create_time,
|
||||||
|
status
|
||||||
) values
|
) values
|
||||||
<foreach collection="data" item="item" separator=",">
|
<foreach collection="data" item="item" separator=",">
|
||||||
(
|
(
|
||||||
@@ -112,7 +113,8 @@
|
|||||||
#{item.load_port},
|
#{item.load_port},
|
||||||
#{item.create_id},
|
#{item.create_id},
|
||||||
#{item.create_name},
|
#{item.create_name},
|
||||||
#{item.create_time}
|
#{item.create_time},
|
||||||
|
#{item.status}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ public class WorkOrderController {
|
|||||||
return new ResponseEntity<>(TableDataInfo.build(iWorkOrderService.getOrderBomItem(orderCode)), HttpStatus.OK);
|
return new ResponseEntity<>(TableDataInfo.build(iWorkOrderService.getOrderBomItem(orderCode)), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getListPda")
|
||||||
|
public ResponseEntity getListPda(Map query, PageQuery page){
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(iWorkOrderService.queryList(page,query)),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("保存工单")
|
@Log("保存工单")
|
||||||
public ResponseEntity<Object> save(@Validated @RequestBody WorkOrderDto dto)
|
public ResponseEntity<Object> save(@Validated @RequestBody WorkOrderDto dto)
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ const loadPortOptions = computed(() => {
|
|||||||
|
|
||||||
async function fetchWorkOrders() {
|
async function fetchWorkOrders() {
|
||||||
try {
|
try {
|
||||||
const res = await request.get('/api/workOrder', { params: { status: 2 } })
|
const res = await request.get('/api/workOrder/getListPda', { params: { status: 2 } })
|
||||||
orderList.value = res.content || []
|
orderList.value = res.content || []
|
||||||
} catch {
|
} catch {
|
||||||
// error handled by interceptor
|
// error handled by interceptor
|
||||||
|
|||||||
Reference in New Issue
Block a user