fix:修复堆垛机空出任务类型异常以及新增木箱退货入库接口

This commit is contained in:
2025-03-28 11:11:55 +08:00
parent 760fe868c1
commit a7a0b4f1fa
3 changed files with 63 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -41,6 +42,7 @@ import org.nl.acs.opc.WcsConfig;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
import org.nl.acs.task.domain.Task;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.exception.BadRequestException;
@@ -871,6 +873,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
this.errorRequireSucess = true;
} else {
instruction.setRemark("堆垛机空出取消指令");
instructionService.cancel(instruction.getInstruction_id());
//清警
cleanErro();
@@ -932,7 +935,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
private void updateData1(String poinCode, Device point, String[] split, String vehicleCode) {
Instruction instructionUpdate = checkInst();
TaskDto taskUpdate = new TaskDto();
LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<Task>()
.eq(Task::getTask_id, instructionUpdate.getTask_id());
Task taskUpdate = taskserver.getOne(wrapper);
instructionUpdate.setStart_point_code(poinCode);
instructionUpdate.setStart_device_code(split[0]);
taskUpdate.setStart_point_code(poinCode);
@@ -940,7 +945,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
taskUpdate.setTask_id(instructionUpdate.getTask_id());
taskUpdate.setRoute_plan_code(instructionUpdate.getRoute_plan_code());
instructionService.update(instructionUpdate);
taskserver.update(taskUpdate);
taskserver.updateById(taskUpdate);
}
private void pakagePLCData(List list, String x, String y, String z, String toCommand, String task) {
@@ -999,7 +1004,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
private void updateData2(String poinCode, Device point, String[] split, String vehicleCode) {
Instruction instructionUpdate = checkInst();
TaskDto taskUpdate = new TaskDto();
LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<Task>()
.eq(Task::getTask_id, instructionUpdate.getTask_id());
Task taskUpdate = taskserver.getOne(wrapper);
instructionUpdate.setNext_point_code(poinCode);
instructionUpdate.setNext_device_code(split[0]);
taskUpdate.setNext_point_code(poinCode);
@@ -1007,7 +1014,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
taskUpdate.setTask_id(instructionUpdate.getTask_id());
taskUpdate.setRoute_plan_code(instructionUpdate.getRoute_plan_code());
instructionService.update(instructionUpdate);
taskserver.update(taskUpdate);
taskserver.updateById(taskUpdate);
}

View File

@@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver;
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
@@ -749,8 +750,56 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
@Override
public JSONObject returnBox(JSONObject whereJson) {
return null;
public JSONObject returnBox(JSONObject param) {
log.info("WMS申请木箱退货入库--------------:申请参数" + param);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code("WMS申请木箱退货入库")
.content("WMS申请木箱退货入库-----申请参数:" + param)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
JSONObject res = new JSONObject();
JSONObject err = new JSONObject();
String deviceCode = param.getString("device_code");
String subVolume = param.getString("sub_volume");
String heightLevel = param.getString("height_level");
if (StrUtil.isEmpty(deviceCode)) {
err.put("code", cn.hutool.http.HttpStatus.HTTP_BAD_REQUEST);
err.put("message", "设备号不能为空!");
return err;
}
if (StrUtil.isEmpty(subVolume)) {
err.put("code", cn.hutool.http.HttpStatus.HTTP_BAD_REQUEST);
err.put("message", "子卷号不能为空!");
return err;
}
if (StrUtil.isEmpty(heightLevel)) {
err.put("code", cn.hutool.http.HttpStatus.HTTP_BAD_REQUEST);
err.put("message", "木箱高度等级不能为空!");
return err;
}
Device device = deviceAppService.findDeviceByCode(deviceCode);
BoxPackageManipulatorDeviceDriver boxPackageManipulatorDeviceDriver;
if (device.getDeviceDriver() instanceof BoxPackageManipulatorDeviceDriver) {
boxPackageManipulatorDeviceDriver = (BoxPackageManipulatorDeviceDriver) device.getDeviceDriver();
List list = new ArrayList();
Map<String, Object> map1 = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
Map<String, Object> map3 = new HashMap<>();
map1.put("code", "to_command");
map1.put("value", 9);
list.add(map1);
map2.put("code", "to_barcode");
map2.put("value", subVolume);
list.add(map2);
map3.put("code", "to_height_level");
map3.put("value", heightLevel);
list.add(map3);
boxPackageManipulatorDeviceDriver.writing(list);
}
res.put("code", cn.hutool.http.HttpStatus.HTTP_OK);
res.put("message", "下发成功!");
return res;
}
@Override
@@ -953,7 +1002,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("move", beltConveyorDeviceDriver.getMove());
jo.put("mode", beltConveyorDeviceDriver.getMode());
jo.put("device_code", parent_device_code);
}else {
} else {
jo.put("device_code", parent_device_code);
}
backja.add(jo);

View File

@@ -1318,7 +1318,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
entity.setUpdate_time(now);
entity.setUpdate_by(currentUsername);
entity.setInstruction_status(InstructionStatusEnum.CANCEL.getIndex());
entity.setRemark("堆垛机空出取消指令");
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
instructionMapper.updateById(ins);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);