rev:更新
This commit is contained in:
@@ -11,4 +11,8 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public class DeviceAssignedQueryParam {
|
||||
|
||||
private String device_code;
|
||||
private String inst_nextDevice_code;
|
||||
private String task_nextDevice_code;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.acs.device.device.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -44,7 +45,11 @@ public class DeviceAssignedServiceImpl extends CommonServiceImpl<DeviceAssignedM
|
||||
@Override
|
||||
public PageInfo<DeviceAssignedDto> queryAll(DeviceAssignedQueryParam query, Pageable pageable) {
|
||||
IPage<DeviceAssigned> queryPage = PageUtil.toMybatisPage(pageable);
|
||||
IPage<DeviceAssigned> page = deviceAssignedMapper.selectPage(queryPage, QueryHelpMybatisPlus.getPredicate(query));
|
||||
LambdaQueryWrapper<DeviceAssigned> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.like(StrUtil.isNotBlank(query.getDevice_code()), DeviceAssigned::getDevice_code, query.getDevice_code())
|
||||
.and(StrUtil.isNotBlank(query.getTask_nextDevice_code()), s -> s.like(DeviceAssigned::getTask_nextDevice_code, query.getTask_nextDevice_code()))
|
||||
.and(StrUtil.isNotBlank(query.getInst_nextDevice_code()), s -> s.like(DeviceAssigned::getInst_nextDevice_code, query.getInst_nextDevice_code()));
|
||||
IPage<DeviceAssigned> page = deviceAssignedMapper.selectPage(queryPage, lqw);
|
||||
return ConvertUtil.convertPage(page, DeviceAssignedDto.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +144,11 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
private boolean requireSuccess = false;
|
||||
|
||||
|
||||
/**
|
||||
* 关联站点申请任务请求标记
|
||||
*/
|
||||
private boolean withStationRequireSuccess = false;
|
||||
|
||||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
@@ -200,6 +205,10 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
private void executeLogicBefore() {
|
||||
if (this.move != this.lastMove) {
|
||||
this.requireSuccess = false;
|
||||
this.withStationRequireSuccess = false;
|
||||
}
|
||||
if (this.mode != this.lastMode) {
|
||||
this.requireSuccess = false;
|
||||
}
|
||||
if (!StrUtil.equals(this.barcode, this.lastBarcode) && this.move == 1) {
|
||||
this.requireInTaskTime = System.currentTimeMillis();
|
||||
@@ -327,6 +336,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
.build();
|
||||
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request);
|
||||
if (response.isSuccess()) {
|
||||
this.writing(ItemProtocol.TO_COMMAND.getKey(), CommandEnum.COMMAND_6.getValue());
|
||||
this.requireSuccess = true;
|
||||
}
|
||||
}
|
||||
@@ -579,7 +589,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
Device device = deviceAppService.findDeviceByCode(next_device_code);
|
||||
if (device != null) {
|
||||
String pinkDeviceCode = Optional.ofNullable(device.getExtraValue().get("pinkDeviceCode")).map(Objects::toString).orElse("");
|
||||
if (StrUtil.equals(taskDto.getNext_device_code(), pinkDeviceCode)) {
|
||||
if (StrUtil.isNotEmpty(pinkDeviceCode)) {
|
||||
Device pinkDevice = deviceAppService.findDeviceByCode(pinkDeviceCode);
|
||||
if (pinkDevice != null && pinkDevice.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) pinkDevice.getDeviceDriver();
|
||||
@@ -718,7 +728,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
@SneakyThrows
|
||||
private void update_inst_status(Instruction instruction) {
|
||||
if (InstructionStatusEnum.READY.getIndex().equals(instruction.getInstruction_status()) && this.currentDeviceCode.equals(instruction.getStart_device_code())) {
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 '" + InstructionStatusEnum.getName(instruction.getInstruction_status()) + "' -> " + InstructionStatusEnum.BUSY.getName()));
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 " + InstructionStatusEnum.getName(instruction.getInstruction_status()) + " -> " + InstructionStatusEnum.BUSY.getName()));
|
||||
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
instruction.setExecute_device_code(this.currentDeviceCode);
|
||||
instructionService.update(instruction);
|
||||
@@ -732,7 +742,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
}
|
||||
this.unExecutedMessage = "";
|
||||
}
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 '" + InstructionStatusEnum.getName(instruction.getInstruction_status()) + "' -> " + InstructionStatusEnum.FINISHED.getName()));
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "指令号:" + instruction.getInstruction_code() + ", 修改指令状态为 " + InstructionStatusEnum.getName(instruction.getInstruction_status()) + " -> " + InstructionStatusEnum.FINISHED.getName()));
|
||||
instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
||||
instruction.setExecute_device_code(this.currentDeviceCode);
|
||||
instructionService.finish(instruction);
|
||||
@@ -751,6 +761,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
map.put("isError", this.isError);
|
||||
map.put("unExecutedMessage", this.unExecutedMessage);
|
||||
map.put("requireSuccess", this.requireSuccess);
|
||||
map.put("requireSuccessLabel", this.requireSuccess ? "是" : "否");
|
||||
map.put("mode", AppModeEnum.getLabelByCode(this.mode));
|
||||
String belongToConveyor = Optional.ofNullable(this.getExtraValue().get("belongToConveyor")).map(Object::toString).orElse(null);
|
||||
if (belongToConveyor != null) {
|
||||
@@ -763,7 +774,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
}
|
||||
map.put("move", this.move == 0 ? "无货" : "有货");
|
||||
map.put("hasGoods", this.move);
|
||||
map.put("task", this.task);
|
||||
map.put("task", this.task + " (" + (instructionService.findByCodeFromCache(String.valueOf(this.task)) == null ? "已结束" : "执行中") + ")");
|
||||
map.put("action", this.action == 0 ? "不允许取放" : "允许取放");
|
||||
map.put("error", ErrorEnum.getLabel(this.error));
|
||||
map.put("barcode", this.barcode);
|
||||
|
||||
@@ -1256,10 +1256,15 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
map.put("message", this.message);
|
||||
map.put("unExecutedMessage", this.unExecutedMessage);
|
||||
map.put("prohibitInWarehouse", this.prohibitInWarehouse);
|
||||
map.put("prohibitInWarehouseLabel", this.prohibitInWarehouse ? "是" : "否");
|
||||
map.put("prohibitOutWarehouse", this.prohibitOutWarehouse);
|
||||
map.put("prohibitOutWarehouseLabel", this.prohibitOutWarehouse ? "是" : "否");
|
||||
map.put("stopReceiveTask", this.stopReceiveTask);
|
||||
map.put("stopReceiveTaskLabel", this.stopReceiveTask ? "是" : "否");
|
||||
map.put("requireSuccess", this.requireSuccess);
|
||||
map.put("requireSuccessLabel", this.requireSuccess ? "是" : "否");
|
||||
map.put("againRequireSuccess", this.againRequireSuccess);
|
||||
map.put("againRequireSuccessLabel", this.againRequireSuccess ? "是" : "否");
|
||||
map.put("mode", ModeEnum.getDescByNum(this.mode));
|
||||
map.put("front_command", CommandEnum.getDesc(this.front_command));
|
||||
map.put("front_task", this.front_task + " (" + (instructionService.findByCodeFromCache(String.valueOf(this.front_task)) == null ? "已结束" : "执行中") + ")");
|
||||
|
||||
@@ -89,7 +89,7 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
continue;
|
||||
}
|
||||
if (!requireSuccess && StrUtil.isNotEmpty(appearanceInspectionScannerConveyorDeviceDriver.getBarcode())
|
||||
&& !appearanceInspectionScannerConveyorDeviceDriver.isRequireSuccess()) {
|
||||
&& !appearanceInspectionScannerConveyorDeviceDriver.isWithStationRequireSuccess()) {
|
||||
TaskDto taskDto = taskServer.findByContainer(appearanceInspectionScannerConveyorDeviceDriver.getBarcode());
|
||||
if (ObjectUtil.isEmpty(taskDto)) {
|
||||
String getLinkDeviceCode = Optional.ofNullable(device.getExtraValue().get("getLinkDeviceCode")).map(Object::toString).orElse(null);
|
||||
@@ -105,14 +105,14 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
logServer.deviceExecuteLog(new LuceneLogDto(this.device_code, "申请任务...." + request.toString()));
|
||||
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request);
|
||||
if (response.isSuccess()) {
|
||||
appearanceInspectionScannerConveyorDeviceDriver.setRequireSuccess(true);
|
||||
appearanceInspectionScannerConveyorDeviceDriver.setWithStationRequireSuccess(true);
|
||||
this.requireSuccess = true;
|
||||
}
|
||||
} else {
|
||||
Device linkDevice = deviceAppservice.findDeviceByCode(getLinkDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(linkDevice) && linkDevice.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver2 = (AppearanceInspectionScannerConveyorDeviceDriver) linkDevice.getDeviceDriver();
|
||||
if (appearanceInspectionScannerConveyorDeviceDriver2.getMove() == 1 && !appearanceInspectionScannerConveyorDeviceDriver2.isRequireSuccess()) {
|
||||
if (appearanceInspectionScannerConveyorDeviceDriver2.getMove() == 1 && !appearanceInspectionScannerConveyorDeviceDriver2.isWithStationRequireSuccess()) {
|
||||
TaskDto taskDto2 = taskServer.findByContainer(appearanceInspectionScannerConveyorDeviceDriver2.getBarcode());
|
||||
if (ObjectUtil.isEmpty(taskDto2)) {
|
||||
JSONObject param = new JSONObject();
|
||||
@@ -128,8 +128,8 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request);
|
||||
if (response.isSuccess()) {
|
||||
this.requireSuccess = true;
|
||||
appearanceInspectionScannerConveyorDeviceDriver.setRequireSuccess(true);
|
||||
appearanceInspectionScannerConveyorDeviceDriver2.setRequireSuccess(true);
|
||||
appearanceInspectionScannerConveyorDeviceDriver.setWithStationRequireSuccess(true);
|
||||
appearanceInspectionScannerConveyorDeviceDriver2.setWithStationRequireSuccess(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -145,7 +145,7 @@ public class WithStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
logServer.deviceExecuteLog(new LuceneLogDto(this.device_code, "申请任务...." + request.toString()));
|
||||
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request);
|
||||
if (response.isSuccess()) {
|
||||
appearanceInspectionScannerConveyorDeviceDriver.setRequireSuccess(true);
|
||||
appearanceInspectionScannerConveyorDeviceDriver.setWithStationRequireSuccess(true);
|
||||
this.requireSuccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,13 @@ import java.util.Objects;
|
||||
*/
|
||||
public class ArrayComparisonUtil {
|
||||
public static boolean equals(Object oldValue, Object newValue) {
|
||||
|
||||
if ((oldValue instanceof String && newValue == null && "".equals(oldValue)) ||
|
||||
(newValue instanceof String && oldValue == null && "".equals(newValue))) {
|
||||
return true;
|
||||
}
|
||||
if (oldValue == null || newValue == null) {
|
||||
return Objects.equals(oldValue, newValue);
|
||||
return ObjectUtil.equals(oldValue, newValue);
|
||||
}
|
||||
Class<?> oldType = oldValue.getClass();
|
||||
Class<?> newType = newValue.getClass();
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package org.nl.acs.ext.wms.data.req;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nl.acs.ext.wms.IpUtil;
|
||||
import org.nl.config.IdUtil;
|
||||
|
||||
@@ -14,12 +18,15 @@ import org.nl.config.IdUtil;
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CommonRequest {
|
||||
|
||||
private String service;
|
||||
|
||||
private String type;
|
||||
|
||||
@Builder.Default
|
||||
private String ip = IpUtil.LOCAL_IP;
|
||||
|
||||
@Builder.Default
|
||||
@@ -28,5 +35,14 @@ public class CommonRequest {
|
||||
@Builder.Default
|
||||
private String trace_id = "trace_id_" + IdUtil.getStringId();
|
||||
|
||||
private JSONObject data;
|
||||
private Object data;
|
||||
|
||||
|
||||
public JSONArray handleArray() {
|
||||
return JSONArray.parseArray(JSON.toJSONString(data));
|
||||
}
|
||||
|
||||
public JSONObject handleObject() {
|
||||
return (JSONObject) data;
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,8 @@ package org.nl.acs.ext.wms.rest;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.ext.wms.data.req.CommonRequest;
|
||||
import org.nl.acs.ext.wms.service.GateWayService;
|
||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||
import org.nl.acs.ext.wms.service.dto.InteracteDto;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -33,8 +31,8 @@ public class WmsToAcsController {
|
||||
|
||||
@PostMapping("/apply")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> apply(@RequestBody InteracteDto form) {
|
||||
return new ResponseEntity<>(gateWayService.apply(form), HttpStatus.OK);
|
||||
public ResponseEntity<Object> apply(@RequestBody CommonRequest request) {
|
||||
return new ResponseEntity<>(gateWayService.apply(request), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.nl.acs.ext.wms.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.ext.wms.service.dto.InteracteDto;
|
||||
import org.nl.acs.ext.wms.data.req.CommonRequest;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -15,16 +17,20 @@ public class GateWayService {
|
||||
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
@Autowired
|
||||
private LuceneExecuteLogService logService;
|
||||
|
||||
public JSONObject apply(InteracteDto param) {
|
||||
if ("crateTask".equals(param.getType())) {
|
||||
return wmsToAcsService.crateTask(param.getData());
|
||||
} else if ("switchInOut".equals(param.getType())) {
|
||||
return wmsToAcsService.switchInOut(param.getData());
|
||||
} else if ("pinkStartStop".equals(param.getType())) {
|
||||
return wmsToAcsService.pinkStartStop(param.getData());
|
||||
}
|
||||
public JSONObject apply(CommonRequest request) {
|
||||
JSONObject resp = new JSONObject();
|
||||
if ("createTask".equals(request.getType())) {
|
||||
return wmsToAcsService.crateTask(request.handleArray());
|
||||
} else if ("switchInOut".equals(request.getType())) {
|
||||
return wmsToAcsService.switchInOut(request.handleObject());
|
||||
} else if ("pinkStartStop".equals(request.getType())) {
|
||||
return wmsToAcsService.pinkStartStop(request.handleObject());
|
||||
} else if ("toCommand".equals(request.getType())) {
|
||||
return wmsToAcsService.toCommand(request.handleObject());
|
||||
}
|
||||
resp.put("code", "400");
|
||||
resp.put("msg", "type有误");
|
||||
return resp;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.acs.ext.wms.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
|
||||
@@ -12,7 +13,7 @@ public interface WmsToAcsService {
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
JSONObject crateTask(JSONObject req);
|
||||
JSONObject crateTask(JSONArray req);
|
||||
|
||||
/**
|
||||
* 出入库模式切换
|
||||
@@ -31,4 +32,11 @@ public interface WmsToAcsService {
|
||||
*/
|
||||
JSONObject pinkStartStop(JSONObject req);
|
||||
|
||||
/**
|
||||
* 下发输送线转动命令
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
JSONObject toCommand(JSONObject req);
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package org.nl.acs.ext.wms.service.dto;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2024/5/29 16:26
|
||||
*/
|
||||
@Data
|
||||
public class InteracteDto {
|
||||
|
||||
String service;
|
||||
String type;
|
||||
String ip;
|
||||
String request_time;
|
||||
String trace_id;
|
||||
JSONObject data;
|
||||
}
|
||||
@@ -38,20 +38,20 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
@Autowired
|
||||
private DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
private TaskService taskserver;
|
||||
private TaskService taskService;
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject crateTask(JSONObject req) {
|
||||
log.info("createFromWms--------------:输入参数:" + JSON.toJSONString(req));
|
||||
public JSONObject crateTask(JSONArray req) {
|
||||
log.info("crateTask--------------:输入参数:" + JSON.toJSONString(req));
|
||||
try {
|
||||
JSONArray datas = req.getJSONArray("tasks");
|
||||
JSONArray errArr = new JSONArray();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject task = datas.getJSONObject(i);
|
||||
String ext_task_id = task.getString("ext_task_id");
|
||||
for (int i = 0; i < req.size(); i++) {
|
||||
JSONObject task = req.getJSONObject(i);
|
||||
String ext_task_id = task.getString("id");
|
||||
String task_code = task.getString("task_code");
|
||||
String start_device_code = task.getString("start_device_code");
|
||||
String next_device_code = task.getString("next_device_code");
|
||||
String start_device_code = task.getString("point_code1");
|
||||
String next_device_code = task.getString("point_code2");
|
||||
String put_device_code = task.getString("put_device_code");
|
||||
String priority = task.getString("priority");
|
||||
String vehicle_code = task.getString("vehicle_code");
|
||||
@@ -61,7 +61,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String remark = task.getString("remark");
|
||||
String storage_task_type = task.getString("storage_task_type");
|
||||
String agv_system_type = task.getString("agv_system_type");
|
||||
JSONObject param = task.getJSONObject("param");
|
||||
JSONObject params = task.getJSONObject("params");
|
||||
String start_point_code = "";
|
||||
String next_point_code = "";
|
||||
String put_point_code = "";
|
||||
@@ -136,7 +136,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
route_plan_code = "normal";
|
||||
}
|
||||
|
||||
TaskDto taskDto = taskserver.findByCodeFromCache(task_code);
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
||||
if (taskDto != null) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
@@ -146,7 +146,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
continue;
|
||||
}
|
||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||
TaskDto vehicle_dto = taskserver.findByContainer(vehicle_code);
|
||||
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
|
||||
if (vehicle_dto != null) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
@@ -191,7 +191,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
jo.put("agv_system_type", agv_system_type);
|
||||
jo.put("storage_task_type", storage_task_type);
|
||||
jo.put("remark", remark);
|
||||
jo.put("params", param);
|
||||
jo.put("params", params);
|
||||
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||
try {
|
||||
taskserver.create(task_dto);
|
||||
taskService.create(task_dto);
|
||||
} catch (Exception e) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
@@ -224,7 +224,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
resp.put("errArr", errArr);
|
||||
}
|
||||
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(resp));
|
||||
log.info("crateTask--------------:输出参数:" + JSON.toJSONString(resp));
|
||||
return resp;
|
||||
} finally {
|
||||
}
|
||||
@@ -232,6 +232,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
@Override
|
||||
public JSONObject switchInOut(JSONObject reqs) {
|
||||
log.info("switchInOut--------------:输入参数:" + JSON.toJSONString(reqs));
|
||||
Assert.notNull(reqs);
|
||||
String device_code = reqs.getString("device_code");
|
||||
if (StrUtil.isBlank(device_code)) {
|
||||
@@ -247,13 +248,13 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
if (belongToConveyorDevice != null && belongToConveyorDevice.getDeviceDriver() instanceof StripConveyorDeviceDriver) {
|
||||
StripConveyorDeviceDriver stripConveyorDeviceDriver = (StripConveyorDeviceDriver) belongToConveyorDevice.getDeviceDriver();
|
||||
//切换为入库
|
||||
if ("1".equals(type)) {
|
||||
if ("0".equals(type)) {
|
||||
String samePoint = Optional.ofNullable(device.getExtraValue().get("samePoint")).map(Object::toString).orElse(null);
|
||||
TaskDto taskDto;
|
||||
if (StrUtil.isNotEmpty(samePoint)) {
|
||||
taskDto = taskserver.findByNextCode(samePoint);
|
||||
taskDto = taskService.findByNextCode(samePoint);
|
||||
} else {
|
||||
taskDto = taskserver.findByNextCode(device_code);
|
||||
taskDto = taskService.findByNextCode(device_code);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(taskDto)) {
|
||||
throw new BadRequestException("ACS存在出库任务,无法切换为入库模式");
|
||||
@@ -268,13 +269,13 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
stripConveyorDeviceDriver.writing("toCommand", 0);
|
||||
}
|
||||
//切换为出库
|
||||
else if ("2".equals(type)) {
|
||||
else if ("1".equals(type)) {
|
||||
String samePoint = Optional.ofNullable(device.getExtraValue().get("samePoint")).map(Object::toString).orElse(null);
|
||||
TaskDto taskDto;
|
||||
if (StrUtil.isNotEmpty(samePoint)) {
|
||||
taskDto = taskserver.findByStartCode(samePoint);
|
||||
taskDto = taskService.findByStartCode(samePoint);
|
||||
} else {
|
||||
taskDto = taskserver.findByStartCode(device_code);
|
||||
taskDto = taskService.findByStartCode(device_code);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(taskDto)) {
|
||||
throw new BadRequestException("ACS存在入库任务,无法切换为出库模式");
|
||||
@@ -290,22 +291,24 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
}
|
||||
JSONObject resp = new JSONObject();
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "切换出入库模式成功");
|
||||
resp.put("code", "200");
|
||||
resp.put("msg", "切换出入库模式成功");
|
||||
log.info("switchInOut--------------:输出参数:" + JSON.toJSONString(resp));
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject pinkStartStop(JSONObject reqs) {
|
||||
log.info("pinkStartStop--------------:输入参数:" + JSON.toJSONString(reqs));
|
||||
Assert.notNull(reqs);
|
||||
JSONObject resp = new JSONObject();
|
||||
String device_code = reqs.getString("device_code");
|
||||
if (StrUtil.isBlank(device_code)) {
|
||||
throw new BadRequestException("设备号不能为空!");
|
||||
}
|
||||
String type = reqs.getString("type");
|
||||
String type = reqs.getString("status");
|
||||
if (StrUtil.isEmpty(type)) {
|
||||
throw new BadRequestException("启停类型不能为空!");
|
||||
throw new BadRequestException("启停状态不能为空!");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (device != null && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
@@ -318,8 +321,34 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
} else {
|
||||
throw new BadRequestException("设备不存在");
|
||||
}
|
||||
resp.put("status", 200);
|
||||
resp.put("message", "切换成功");
|
||||
resp.put("code", "200");
|
||||
resp.put("msg", "切换成功");
|
||||
log.info("pinkStartStop--------------:输出参数:" + JSON.toJSONString(resp));
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject toCommand(JSONObject req) {
|
||||
log.info("toCommand--------------:输入参数:" + JSON.toJSONString(req));
|
||||
Assert.notNull(req);
|
||||
String device_code = req.getString("device_code");
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
throw new BadRequestException("设备号不能为空");
|
||||
}
|
||||
Integer toCommand = req.getInteger("toCommand");
|
||||
if (toCommand == null) {
|
||||
throw new BadRequestException("下发参数不能为空");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
|
||||
if (device != null && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
|
||||
appearanceInspectionScannerConveyorDeviceDriver.writing("toCommand", toCommand);
|
||||
}
|
||||
JSONObject resp = new JSONObject();
|
||||
resp.put("code", "200");
|
||||
resp.put("msg", "下发成功");
|
||||
log.info("toCommand--------------:输出参数:" + JSON.toJSONString(resp));
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@ public enum InstructionStatusEnum {
|
||||
return arr;
|
||||
}
|
||||
|
||||
public static String getName(String code) {
|
||||
public static String getName(String index) {
|
||||
for (InstructionStatusEnum c : InstructionStatusEnum.values()) {
|
||||
if (c.code == code) {
|
||||
if (c.index.equals(index)) {
|
||||
return c.name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1749,7 +1749,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public List<Instruction> findReadyInstByStartDeviceCode(List<String> start_device_code_list, String noY) {
|
||||
String currentNoY = noY == null ? "" : noY;
|
||||
// String currentNoY = noY == null ? "" : noY;
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
@@ -1763,7 +1764,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public List<Instruction> findReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY) {
|
||||
String currentNoY = noY == null ? "" : noY;
|
||||
//String currentNoY = noY == null ? "" : noY;
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
@@ -1777,7 +1779,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public List<Instruction> findReadyInstByDeviceCode(List<String> device_code_list, String noY) {
|
||||
String currentNoY = noY == null ? "" : noY;
|
||||
//String currentNoY = noY == null ? "" : noY;
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
@@ -1790,7 +1793,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public Instruction findReadyInstByStartDeviceCode(Instruction frontInst, String link_device_code, String noY) {
|
||||
String currentNoY = noY == null ? "" : noY;
|
||||
//String currentNoY = noY == null ? "" : noY;
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
@@ -1807,7 +1811,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public Instruction findReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY) {
|
||||
String currentNoY = noY == null ? "" : noY;
|
||||
// String currentNoY = noY == null ? "" : noY;
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
@@ -1822,7 +1827,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public Instruction findReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY) {
|
||||
String currentNoY = noY == null ? "" : noY;
|
||||
//String currentNoY = noY == null ? "" : noY;
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
@@ -1837,7 +1843,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public Instruction findReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY) {
|
||||
String currentNoY = noY == null ? "" : noY;
|
||||
//String currentNoY = noY == null ? "" : noY;
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.nl.acs.task.service.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author Gengby
|
||||
* @Date 2024/7/1
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum WmsTaskStatusEnum {
|
||||
RUN("1", "20", "执行中"),
|
||||
|
||||
FINISH("2", "90", "完成"),
|
||||
|
||||
CANCEL("3", "100", "取消");
|
||||
|
||||
private String acsStatus;
|
||||
private String wmsStatus;
|
||||
private String desc;
|
||||
|
||||
public static String getWmsStatusByAcsStatus(String acsStatus) {
|
||||
for (WmsTaskStatusEnum status : WmsTaskStatusEnum.values()) {
|
||||
if (status.getAcsStatus().equals(acsStatus)) {
|
||||
return status.getWmsStatus();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,7 @@ import org.nl.acs.task.service.TaskFeedbackService;
|
||||
import org.nl.acs.common.base.PageInfo;
|
||||
import org.nl.acs.common.base.QueryHelpMybatisPlus;
|
||||
import org.nl.acs.common.base.service.impl.CommonServiceImpl;
|
||||
import org.nl.acs.task.service.enums.WmsTaskStatusEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
import org.nl.common.utils.FileUtil;
|
||||
@@ -563,7 +564,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
//向缓存添加任务信息
|
||||
this.addTaskToCache(dto);
|
||||
//反馈上位系统任务状态
|
||||
this.feedWmsTaskStatus(entity);
|
||||
this.feedWmsTaskStatus(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1252,7 +1253,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
if (!StrUtil.startWith(taskDto.getTask_code(), CommonFinalParam.HYPHEN_) && StrUtil.equals(hasWms, CommonFinalParam.ONE)) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("taskCode", entity.getTask_code());
|
||||
param.put("status", "");
|
||||
param.put("status", WmsTaskStatusEnum.getWmsStatusByAcsStatus(taskDto.getTask_status()));
|
||||
CommonRequest request =
|
||||
CommonRequest
|
||||
.builder()
|
||||
@@ -1307,7 +1308,9 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
|
||||
@Override
|
||||
public List<TaskDto> findReadyTaskByXDeviceCode(List<String> xDeviceCodeList, String noY) {
|
||||
String currentNoY = noY == null ? "" : noY;
|
||||
// String currentNoY = noY == null ? "" : noY;
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
|
||||
return Optional.ofNullable(this.tasks)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
@@ -1330,7 +1333,9 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
String front_to_x = frontTask.getTo_x();
|
||||
String front_to_y = frontTask.getTo_y();
|
||||
String front_to_z = frontTask.getTo_z();
|
||||
String currentBackNoY = backNoY == null ? "" : backNoY;
|
||||
//String currentBackNoY = backNoY == null ? "" : backNoY;
|
||||
Set<String> currentBackNoY = backNoY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(backNoY.split(",")));
|
||||
|
||||
return Optional.ofNullable(this.tasks)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
@@ -1353,7 +1358,9 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
String front_from_x = frontTask.getFrom_x();
|
||||
String front_from_y = frontTask.getFrom_y();
|
||||
String front_from_z = frontTask.getFrom_z();
|
||||
String currentBackNoY = backNoY == null ? "" : backNoY;
|
||||
//String currentBackNoY = backNoY == null ? "" : backNoY;
|
||||
Set<String> currentBackNoY = backNoY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(backNoY.split(",")));
|
||||
|
||||
return Optional.ofNullable(this.tasks)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
|
||||
Reference in New Issue
Block a user