rev:优化代码
This commit is contained in:
@@ -37,8 +37,8 @@ public class ToAgvDevice {
|
|||||||
if (device.getDeviceDriver()instanceof AgvNdcTwoDeviceDriver){
|
if (device.getDeviceDriver()instanceof AgvNdcTwoDeviceDriver){
|
||||||
JSONObject row = new JSONObject();
|
JSONObject row = new JSONObject();
|
||||||
agvNdcTwoDeviceDriver= (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
|
agvNdcTwoDeviceDriver= (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
|
||||||
row.put("device_code", String.valueOf(device.getDevice_code()));
|
row.put("deviceCode", String.valueOf(device.getDevice_code()));
|
||||||
row.put("positionX", String.valueOf(agvNdcTwoDeviceDriver.getX()));
|
row.put("status", String.valueOf(agvNdcTwoDeviceDriver.getX()));
|
||||||
row.put("positionY", String.valueOf(agvNdcTwoDeviceDriver.getY()));
|
row.put("positionY", String.valueOf(agvNdcTwoDeviceDriver.getY()));
|
||||||
row.put("positionAngle", String.valueOf(agvNdcTwoDeviceDriver.getAngle()));
|
row.put("positionAngle", String.valueOf(agvNdcTwoDeviceDriver.getAngle()));
|
||||||
agv_rows.add(row);
|
agv_rows.add(row);
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ import org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.HongXiangStation
|
|||||||
import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver;
|
import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver;
|
||||||
import org.nl.acs.device_driver.two_conveyor.ranging_stations.RangingStationsDeviceDriver;
|
import org.nl.acs.device_driver.two_conveyor.ranging_stations.RangingStationsDeviceDriver;
|
||||||
import org.nl.acs.device_driver.two_conveyor.waste_foil_weighing_station.WasteFoilWeighingStationDriver;
|
import org.nl.acs.device_driver.two_conveyor.waste_foil_weighing_station.WasteFoilWeighingStationDriver;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.feedBackTaskStatus.FeedBackTaskStatusRequest;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToWcsService;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||||
import org.nl.acs.history.ErrorUtil;
|
import org.nl.acs.history.ErrorUtil;
|
||||||
@@ -46,6 +48,7 @@ import org.nl.config.lucene.service.dto.LuceneLogDto;
|
|||||||
import org.nl.config.thread.ThreadPoolExecutorUtil;
|
import org.nl.config.thread.ThreadPoolExecutorUtil;
|
||||||
import org.nl.system.service.param.ISysParamService;
|
import org.nl.system.service.param.ISysParamService;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@@ -74,6 +77,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||||
TwoAgvPhase twoAgvPhase = new TwoAgvPhase();
|
TwoAgvPhase twoAgvPhase = new TwoAgvPhase();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AcsToWcsService acsToWcsService;
|
||||||
|
|
||||||
String error_code = "0";
|
String error_code = "0";
|
||||||
int agvaddr = 0;
|
int agvaddr = 0;
|
||||||
int agvaddr_copy = 0;
|
int agvaddr_copy = 0;
|
||||||
@@ -177,6 +183,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
}
|
}
|
||||||
inst.setCarno(String.valueOf(carno));
|
inst.setCarno(String.valueOf(carno));
|
||||||
instructionService.update(inst);
|
instructionService.update(inst);
|
||||||
|
//反馈取货中
|
||||||
|
FeedBackTaskStatusRequest feedBackTaskStatusRequest = new FeedBackTaskStatusRequest();
|
||||||
|
feedBackTaskStatusRequest.setTaskCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setCarId(inst.getCarno());
|
||||||
|
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setTaskType(taskDto.getTask_type());
|
||||||
|
feedBackTaskStatusRequest.setFeedbackStatus("taking");
|
||||||
|
acsToWcsService.feedTaskStatus(feedBackTaskStatusRequest);
|
||||||
}
|
}
|
||||||
//到达取货点
|
//到达取货点
|
||||||
//(Itype=1/2/3,需要WCS反馈Phase)
|
//(Itype=1/2/3,需要WCS反馈Phase)
|
||||||
@@ -245,6 +259,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
logDto.setLog_level(4);
|
logDto.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
}
|
}
|
||||||
|
//反馈取货中
|
||||||
|
FeedBackTaskStatusRequest feedBackTaskStatusRequest = new FeedBackTaskStatusRequest();
|
||||||
|
feedBackTaskStatusRequest.setTaskCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setCarId(inst.getCarno());
|
||||||
|
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setTaskType(taskDto.getTask_type());
|
||||||
|
feedBackTaskStatusRequest.setFeedbackStatus("applyTake");
|
||||||
|
acsToWcsService.feedTaskStatus(feedBackTaskStatusRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取货完毕
|
// 取货完毕
|
||||||
@@ -297,7 +319,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||||
//放货确认
|
//放货确认
|
||||||
if (standardOrdinarySiteDeviceDriver.getOption() == 1) {
|
if (standardOrdinarySiteDeviceDriver.getOption() == 1) {
|
||||||
log.info("等待一体机进行放货确认,指令号{},设备号{},option值{}", inst,standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
|
log.info("等待一体机进行放货确认,指令号{},设备号{},option值{}", inst, standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
.device_code(this.getDeviceCode())
|
.device_code(this.getDeviceCode())
|
||||||
@@ -306,8 +328,18 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
logDto.setLog_level(4);
|
logDto.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
standardOrdinarySiteDeviceDriver.setOption(0);
|
standardOrdinarySiteDeviceDriver.setOption(0);
|
||||||
|
|
||||||
|
//反馈取货完成
|
||||||
|
FeedBackTaskStatusRequest feedBackTaskStatusRequest = new FeedBackTaskStatusRequest();
|
||||||
|
feedBackTaskStatusRequest.setTaskCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setCarId(inst.getCarno());
|
||||||
|
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setTaskType(taskDto.getTask_type());
|
||||||
|
feedBackTaskStatusRequest.setFeedbackStatus("applyTake");
|
||||||
|
acsToWcsService.feedTaskStatus(feedBackTaskStatusRequest);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log.info("等待一体机进行放货确认,指令号{},设备号{},option值{}", inst,standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
|
log.info("等待一体机进行放货确认,指令号{},设备号{},option值{}", inst, standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "等待一体机进行放货确认,设备号" + device.getDevice_code() + ",指令号" + ikey);
|
logServer.deviceExecuteLog(this.device_code, "", "", "等待一体机进行放货确认,设备号" + device.getDevice_code() + ",指令号" + ikey);
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
|
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
|
||||||
@@ -316,6 +348,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
logDto.setLog_level(4);
|
logDto.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
}
|
}
|
||||||
|
//反馈放货中
|
||||||
|
FeedBackTaskStatusRequest feedBackTaskStatusRequest = new FeedBackTaskStatusRequest();
|
||||||
|
feedBackTaskStatusRequest.setTaskCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setCarId(inst.getCarno());
|
||||||
|
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setTaskType(taskDto.getTask_type());
|
||||||
|
feedBackTaskStatusRequest.setFeedbackStatus("puting");
|
||||||
|
acsToWcsService.feedTaskStatus(feedBackTaskStatusRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,7 +410,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||||
|
//反馈申请放货
|
||||||
|
FeedBackTaskStatusRequest feedBackTaskStatusRequest = new FeedBackTaskStatusRequest();
|
||||||
|
feedBackTaskStatusRequest.setTaskCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setCarId(inst.getCarno());
|
||||||
|
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setTaskType(taskDto.getTask_type());
|
||||||
|
feedBackTaskStatusRequest.setFeedbackStatus("applyTake");
|
||||||
|
acsToWcsService.feedTaskStatus(feedBackTaskStatusRequest);
|
||||||
} else {
|
} else {
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
@@ -426,7 +473,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||||
//卸货确认
|
//卸货确认
|
||||||
if (standardOrdinarySiteDeviceDriver.getOption() == 2) {
|
if (standardOrdinarySiteDeviceDriver.getOption() == 2) {
|
||||||
log.info("等待一体机进行卸货确认,指令号{},设备号{},option值{}", inst,standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
|
log.info("等待一体机进行卸货确认,指令号{},设备号{},option值{}", inst, standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
.device_code(this.getDeviceCode())
|
.device_code(this.getDeviceCode())
|
||||||
@@ -435,8 +482,16 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
logDto.setLog_level(4);
|
logDto.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
standardOrdinarySiteDeviceDriver.setOption(0);
|
standardOrdinarySiteDeviceDriver.setOption(0);
|
||||||
|
//反馈放货完成
|
||||||
|
FeedBackTaskStatusRequest feedBackTaskStatusRequest = new FeedBackTaskStatusRequest();
|
||||||
|
feedBackTaskStatusRequest.setTaskCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setCarId(inst.getCarno());
|
||||||
|
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setTaskType(taskDto.getTask_type());
|
||||||
|
feedBackTaskStatusRequest.setFeedbackStatus("applyTake");
|
||||||
|
acsToWcsService.feedTaskStatus(feedBackTaskStatusRequest);
|
||||||
} else {
|
} else {
|
||||||
log.info("等待一体机进行卸货确认,指令号{},设备号{},option值{}", inst,standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
|
log.info("等待一体机进行卸货确认,指令号{},设备号{},option值{}", inst, standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "等待一体机进行卸货确认,设备号" + device.getDevice_code() + ",指令号" + ikey);
|
logServer.deviceExecuteLog(this.device_code, "", "", "等待一体机进行卸货确认,设备号" + device.getDevice_code() + ",指令号" + ikey);
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
|
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
|
||||||
@@ -446,9 +501,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (phase == 0x70) {
|
||||||
|
|
||||||
else if (phase == 0x70) {
|
|
||||||
//x坐标
|
//x坐标
|
||||||
x = ikey;
|
x = ikey;
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
@@ -494,6 +547,19 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
logDto.setLog_level(4);
|
logDto.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
|
||||||
|
if (status == 6) {
|
||||||
|
//反馈异常
|
||||||
|
if (inst != null) {
|
||||||
|
FeedBackTaskStatusRequest feedBackTaskStatusRequest = new FeedBackTaskStatusRequest();
|
||||||
|
feedBackTaskStatusRequest.setTaskCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setCarId(inst.getCarno());
|
||||||
|
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setTaskType(taskDto.getTask_type());
|
||||||
|
feedBackTaskStatusRequest.setFeedbackStatus("exception");
|
||||||
|
acsToWcsService.feedTaskStatus(feedBackTaskStatusRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (status != last_status && status != 6 && status != 7) {
|
if (status != last_status && status != 6 && status != 7) {
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package org.nl.acs.ext.wms.data.WcsToAcsData;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BaseRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库编码
|
||||||
|
*/
|
||||||
|
private String houseCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统编号
|
||||||
|
*/
|
||||||
|
private String systemCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展参数:砖型等
|
||||||
|
*/
|
||||||
|
private JSONObject parameters;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务类型
|
||||||
|
*/
|
||||||
|
private String taskType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务号
|
||||||
|
*/
|
||||||
|
private String taskCode;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package org.nl.acs.ext.wms.data.WcsToAcsData;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class BaseResponse {
|
||||||
|
/**
|
||||||
|
* 请求结果
|
||||||
|
*/
|
||||||
|
private int responseCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信息
|
||||||
|
*/
|
||||||
|
private String responseMessage;
|
||||||
|
|
||||||
|
|
||||||
|
private Map<String, String> parameters = new HashMap();
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.BaseRequest;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CancelTaskRequest extends BaseRequest {
|
||||||
|
/**
|
||||||
|
* 作废原因
|
||||||
|
*/
|
||||||
|
private String reason;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.BaseResponse;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CancelTaskResponse extends BaseResponse {
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package org.nl.acs.ext.wms.data.WcsToAcsData.createTask;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.BaseRequest;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CreateTaskRequest extends BaseRequest {
|
||||||
|
/**
|
||||||
|
* 任务下发时间
|
||||||
|
*/
|
||||||
|
private Date taskCreateDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 容器编号
|
||||||
|
*/
|
||||||
|
private String containerCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 容器类型
|
||||||
|
*/
|
||||||
|
private String containerType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务起点
|
||||||
|
*/
|
||||||
|
private String locationFrom;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务终点
|
||||||
|
*/
|
||||||
|
private String locationTo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优先级
|
||||||
|
*/
|
||||||
|
private Integer priority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由方案
|
||||||
|
*/
|
||||||
|
String route_plan_code;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package org.nl.acs.ext.wms.data.WcsToAcsData.createTask;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.BaseResponse;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CreateTaskResponse extends BaseResponse {
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package org.nl.acs.ext.wms.data.WcsToAcsData.deviceStatus;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.BaseRequest;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeviceStatusRequest extends BaseRequest {
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.nl.acs.ext.wms.data.WcsToAcsData.deviceStatus;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.BaseResponse;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeviceStatusResponse extends BaseResponse {
|
||||||
|
private int status;
|
||||||
|
private String statusDescription;
|
||||||
|
private Boolean hasGoods;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package org.nl.acs.ext.wms.data.WcsToAcsData.feedBackTaskStatus;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.BaseRequest;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FeedBackTaskStatusRequest extends BaseRequest {
|
||||||
|
/**
|
||||||
|
* 车号
|
||||||
|
*/
|
||||||
|
private String carId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务反馈状态 taking:取货中 applyTake:申请取货 takeFinish:取货完成 puting:放货中 applyPut:申请放货 putFinish:放货完成
|
||||||
|
* errorFinish:任务异常完成 exception:异常 deprecate:作废
|
||||||
|
*/
|
||||||
|
private String feedbackStatus;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package org.nl.acs.ext.wms.data.WcsToAcsData.feedBackTaskStatus;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.BaseResponse;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FeedBackTaskStatusResponse extends BaseResponse {
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.nl.acs.ext.wms.rest;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/wcs")
|
||||||
|
@Slf4j
|
||||||
|
public class AcsToWcsController {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package org.nl.acs.ext.wms.rest;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask.CancelTaskRequest;
|
||||||
|
import org.nl.acs.ext.wms.service.WcsToAcsService;
|
||||||
|
import org.nl.common.logging.annotation.Log;
|
||||||
|
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 java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/wcs")
|
||||||
|
@Slf4j
|
||||||
|
public class WcsToAcsController {
|
||||||
|
private final WcsToAcsService wcsToAcsService;
|
||||||
|
|
||||||
|
@PostMapping("/task")
|
||||||
|
@Log(value = "ACS接收WMS任务")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> createFromWcs(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(wcsToAcsService.crateTask(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package org.nl.acs.ext.wms.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask.CancelTaskRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask.CancelTaskResponse;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.deviceStatus.DeviceStatusRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.deviceStatus.DeviceStatusResponse;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.feedBackTaskStatus.FeedBackTaskStatusRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.feedBackTaskStatus.FeedBackTaskStatusResponse;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface AcsToWcsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ACS向WCS反馈任务状态
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, Object> feedTaskStatus(FeedBackTaskStatusRequest param);
|
||||||
|
|
||||||
|
Map<String, Object> cancelTask(CancelTaskRequest param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备查询
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> checkDeviceStatus(JSONObject whereJson);
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.nl.acs.ext.wms.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask.CancelTaskRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask.CancelTaskResponse;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.createTask.CreateTaskResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface WcsToAcsService {
|
||||||
|
|
||||||
|
Map<String, Object> crateTask(JSONObject whereJson);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
package org.nl.acs.ext.wms.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.Header;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.yomahub.tlog.hutoolhttp.TLogHutoolhttpInterceptor;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.AcsConfig;
|
||||||
|
import org.nl.acs.address.service.AddressService;
|
||||||
|
import org.nl.acs.address.service.dto.AddressDto;
|
||||||
|
import org.nl.acs.ext.wms.data.ApplyPlugPullSitResponse;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask.CancelTaskRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask.CancelTaskResponse;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.deviceStatus.DeviceStatusRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.deviceStatus.DeviceStatusResponse;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.feedBackTaskStatus.FeedBackTaskStatusRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.feedBackTaskStatus.FeedBackTaskStatusResponse;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToWcsService;
|
||||||
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||||
|
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||||
|
import org.nl.system.service.param.ISysParamService;
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class AcsToWcsServiceImpl implements AcsToWcsService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ISysParamService paramService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AddressService addressService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TaskService taskService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DeviceExecuteLogService logServer;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
LuceneExecuteLogService luceneLogService;
|
||||||
|
|
||||||
|
public String token;
|
||||||
|
|
||||||
|
TLogHutoolhttpInterceptor tLogHutoolhttpInterceptor = new TLogHutoolhttpInterceptor();
|
||||||
|
|
||||||
|
|
||||||
|
private String log_file_type = "log_file_type";
|
||||||
|
private String log_type = "ACS请求LMS";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> feedTaskStatus(FeedBackTaskStatusRequest param) {
|
||||||
|
log.info("ACS向WCS反馈任务状态,请求参数{}", param);
|
||||||
|
String result = "";
|
||||||
|
FeedBackTaskStatusResponse feedBackTaskStatusResponse = new FeedBackTaskStatusResponse();
|
||||||
|
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||||
|
AddressDto addressDto = addressService.findByCode("feedTaskStatus");
|
||||||
|
String methods_url = addressDto.getMethods_url();
|
||||||
|
String url = wmsUrl + methods_url;
|
||||||
|
try {
|
||||||
|
//
|
||||||
|
result = HttpRequest.post(url)
|
||||||
|
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||||
|
.header(Header.USER_AGENT, "Hutool http")
|
||||||
|
.body(JSON.toJSONString(param))
|
||||||
|
.execute().body();
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
feedBackTaskStatusResponse = JSONObject.toJavaObject(jsonObject, FeedBackTaskStatusResponse.class);
|
||||||
|
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "feedTaskStatus", String.valueOf(feedBackTaskStatusResponse.getResponseCode()),
|
||||||
|
JSON.toJSONString(param), String.valueOf(result), "ACS向WCS反馈任务状态");
|
||||||
|
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||||
|
return jsonObject;
|
||||||
|
} catch (Exception e) {
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
log.info("ACS向WCS反馈任务状态----返回参数{}", e.getMessage());
|
||||||
|
feedBackTaskStatusResponse = JSONObject.toJavaObject(jsonObject, FeedBackTaskStatusResponse.class);
|
||||||
|
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "feedTaskStatus", String.valueOf(feedBackTaskStatusResponse.getResponseCode()),
|
||||||
|
JSON.toJSONString(param),
|
||||||
|
String.valueOf(result), "ACS向WCS反馈任务状态");
|
||||||
|
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", e.getMessage());
|
||||||
|
map.put("parameters", new HashMap<>());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> cancelTask(CancelTaskRequest param) {
|
||||||
|
log.info("ACS向WCS申请取消任务,请求参数{}", param);
|
||||||
|
String result = "";
|
||||||
|
CancelTaskResponse cancelTaskResponse = new CancelTaskResponse();
|
||||||
|
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||||
|
AddressDto addressDto = addressService.findByCode("cancelTask");
|
||||||
|
String methods_url = addressDto.getMethods_url();
|
||||||
|
String url = wmsUrl + methods_url;
|
||||||
|
try {
|
||||||
|
//
|
||||||
|
result = HttpRequest.post(url)
|
||||||
|
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||||
|
.header(Header.USER_AGENT, "Hutool http")
|
||||||
|
.body(JSON.toJSONString(param))
|
||||||
|
.execute().body();
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
cancelTaskResponse = JSONObject.toJavaObject(jsonObject, CancelTaskResponse.class);
|
||||||
|
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "cancelTask", String.valueOf(cancelTaskResponse.getResponseCode()),
|
||||||
|
JSON.toJSONString(param), String.valueOf(result), "ACS向WCS申请取消任务");
|
||||||
|
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||||
|
return jsonObject;
|
||||||
|
} catch (Exception e) {
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
log.info("ACS向WCS申请取消任务----返回参数{}", e.getMessage());
|
||||||
|
cancelTaskResponse = JSONObject.toJavaObject(jsonObject, CancelTaskResponse.class);
|
||||||
|
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "feedTaskStatus", String.valueOf(cancelTaskResponse.getResponseCode()),
|
||||||
|
JSON.toJSONString(param),
|
||||||
|
String.valueOf(result), "ACS向WCS申请取消任务");
|
||||||
|
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", e.getMessage());
|
||||||
|
map.put("parameters", new HashMap<>());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> checkDeviceStatus(JSONObject whereJson) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
String result = null;
|
||||||
|
AddressDto addressDto = addressService.findByCode("checkDeviceStatus");
|
||||||
|
String wcsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||||
|
String methods_url = addressDto.getMethods_url();
|
||||||
|
String url = wcsurl + methods_url;
|
||||||
|
String deviceCode = MapUtil.getStr(whereJson, "deviceCode");
|
||||||
|
if (StrUtil.isEmpty(deviceCode)) {
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", "请求设备号不能为空!");
|
||||||
|
map.put("parameters", new HashMap<>());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
result = HttpRequest.post(url)
|
||||||
|
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||||
|
.header(Header.USER_AGENT, "Hutool http")
|
||||||
|
.body(JSON.toJSONString(whereJson))
|
||||||
|
.execute().body();
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "checkDeviceStatus", String.valueOf(jsonObject.get("responseCode")),
|
||||||
|
JSON.toJSONString(jsonObject), String.valueOf(result), "ACS向WCS反馈设备状态");
|
||||||
|
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||||
|
log.info("checkDeviceStatus-----输出参数{}", jsonObject.toString());
|
||||||
|
return jsonObject;
|
||||||
|
} catch (Exception e) {
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
log.info("ACS向WCS反馈设备状态----返回参数{}", e.getMessage());
|
||||||
|
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "feedBackDeviceStatus", String.valueOf(jsonObject.get("responseCode")),
|
||||||
|
JSON.toJSONString(whereJson),
|
||||||
|
String.valueOf(result), "ACS向WCS反馈设备状态");
|
||||||
|
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||||
|
Map<String, Object> map1 = new HashMap<>();
|
||||||
|
map1.put("responseCode", 1);
|
||||||
|
map1.put("responseMessage", e.getMessage());
|
||||||
|
map1.put("parameters", new HashMap<>());
|
||||||
|
return map1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,208 @@
|
|||||||
|
package org.nl.acs.ext.wms.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.ext.wms.data.JsonUtl;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask.CancelTaskRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask.CancelTaskResponse;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.createTask.CreateTaskRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.createTask.CreateTaskResponse;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.deviceStatus.DeviceStatusResponse;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToWcsService;
|
||||||
|
import org.nl.acs.ext.wms.service.WcsToAcsService;
|
||||||
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
|
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||||
|
import org.nl.acs.storage_cell.domain.StorageCell;
|
||||||
|
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
|
||||||
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||||
|
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class WcsToAcsServiceImpl implements WcsToAcsService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StorageCellMapper storageCellMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceAppService deviceAppService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TaskService taskserver;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AcsToWcsService acsToWcsService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LuceneExecuteLogService luceneExecuteLogService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
RouteLineService routeLineService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> crateTask(JSONObject whereJson) {
|
||||||
|
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
log.info("taskCreate--------------:输入参数:" + whereJson.toString());
|
||||||
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code("ACS接收WMS任务")
|
||||||
|
.content("ACS接收WMS任务-----输入参数:" + whereJson)
|
||||||
|
.build();
|
||||||
|
logDto.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
//获取甲方wcs传过来的参数
|
||||||
|
String houseCode = whereJson.getString("houseCode");
|
||||||
|
String systemCode = whereJson.getString("systemCode");
|
||||||
|
JSONObject parameters = whereJson.getJSONObject("parameters");
|
||||||
|
String taskCode = whereJson.getString("taskCode");
|
||||||
|
String taskType = whereJson.getString("taskType");
|
||||||
|
String taskCreateDatetime = whereJson.getString("taskCreateDatetime");
|
||||||
|
String containerCode = whereJson.getString("containerCode");
|
||||||
|
String containerType = whereJson.getString("containerType");
|
||||||
|
String start_point_code = whereJson.getString("locationFrom");
|
||||||
|
String next_point_code = whereJson.getString("locationTo");
|
||||||
|
String priority = whereJson.getString("priority");
|
||||||
|
String start_device_code = "";
|
||||||
|
String next_device_code = "";
|
||||||
|
//判断必填项是否为空
|
||||||
|
if (StrUtil.isEmpty(taskCode)) {
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", "任务号不能为空");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(start_point_code)) {
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", "起点不能为空");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(next_point_code)) {
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", "终点不能为空");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(containerCode)) {
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", "容器编号不能为空");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("deviceCode", start_point_code);
|
||||||
|
JSONObject jsonObject1 = new JSONObject();
|
||||||
|
jsonObject1.put("deviceCode", next_point_code);
|
||||||
|
|
||||||
|
Map<String, Object> feedback = acsToWcsService.checkDeviceStatus(jsonObject);
|
||||||
|
Map<String, Object> feedback1 = acsToWcsService.checkDeviceStatus(jsonObject1);
|
||||||
|
int responseCode = Integer.parseInt(String.valueOf(feedback.get("responseCode")));
|
||||||
|
int responseCode1 = Integer.parseInt(String.valueOf(feedback1.get("responseCode")));
|
||||||
|
String fromStatus = String.valueOf(feedback.get("status"));
|
||||||
|
String toStatus = String.valueOf(feedback1.get("status"));
|
||||||
|
Boolean fromHasGoods = (Boolean) feedback.get("hasGoods");
|
||||||
|
Boolean toHasGoods = (Boolean) feedback1.get("hasGoods");
|
||||||
|
|
||||||
|
|
||||||
|
if (responseCode == 0 && responseCode1 == 0){
|
||||||
|
if (fromStatus.equals("0") && toStatus.equals("0")){
|
||||||
|
if (fromHasGoods && !toHasGoods){
|
||||||
|
log.info("起点设备有货,终点设备无货");
|
||||||
|
}else {
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", "起点和终点设备状态异常,请检查起点和终点设备状态!");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", "设备状态异常,请检查起点和终点设备状态!");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", "请求结果代码不为0");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (start_point_code.indexOf("-") > 0) {
|
||||||
|
String str[] = start_point_code.split("-");
|
||||||
|
start_device_code = str[0];
|
||||||
|
} else {
|
||||||
|
start_device_code = start_point_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (next_point_code.indexOf("-") > 0) {
|
||||||
|
String str[] = next_point_code.split("-");
|
||||||
|
next_device_code = str[0];
|
||||||
|
} else {
|
||||||
|
next_device_code = next_point_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询wcs传过来的起点终点路由
|
||||||
|
List<RouteLineDto> list = routeLineService.getShortPathLines(start_device_code, next_device_code, "normal");
|
||||||
|
if (ObjectUtil.isEmpty(list)) {
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", "路由不通!");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
//查询任务编码是否重复
|
||||||
|
TaskDto taskDto = taskserver.findByCodeFromCache(taskCode);
|
||||||
|
if (taskDto != null) {
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", "不能存在相同的任务号!");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
//判断载具编码是否相同
|
||||||
|
if (!StrUtil.isEmpty(containerCode)) {
|
||||||
|
TaskDto vehicle_dto = taskserver.findByContainer(containerCode);
|
||||||
|
if (vehicle_dto != null) {
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", "已存在该容器号的任务!");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("task_code", taskCode);
|
||||||
|
jo.put("start_point_code", start_point_code);
|
||||||
|
jo.put("next_point_code", next_point_code);
|
||||||
|
jo.put("start_parent_code", start_point_code);
|
||||||
|
jo.put("next_parent_code", next_point_code);
|
||||||
|
jo.put("start_device_code", start_device_code);
|
||||||
|
jo.put("next_device_code", next_device_code);
|
||||||
|
jo.put("priority", priority);
|
||||||
|
jo.put("vehicle_code", containerCode);
|
||||||
|
jo.put("vehicle_type", containerType);
|
||||||
|
jo.put("create_time", taskCreateDatetime);
|
||||||
|
jo.put("task_type", taskType);
|
||||||
|
TaskDto task_dto = (TaskDto) JSONObject.parseObject(String.valueOf(jo), TaskDto.class);
|
||||||
|
try {
|
||||||
|
taskserver.create(task_dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
map.put("responseCode", 1);
|
||||||
|
map.put("responseMessage", e.getMessage());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
map.put("responseCode", 0);
|
||||||
|
map.put("responseMessage", "创建任务成功!");
|
||||||
|
map.put("parameters", new HashMap<>());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ import cn.hutool.core.bean.copier.CopyOptions;
|
|||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jiaolm
|
* @author jiaolm
|
||||||
@@ -255,6 +256,31 @@ public class Task extends CommonModel<Task> implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String class_type;
|
private String class_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库编码
|
||||||
|
*/
|
||||||
|
private String house_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统编号
|
||||||
|
*/
|
||||||
|
private String system_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务下发时间
|
||||||
|
*/
|
||||||
|
private String task_create_date_time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 容器编号
|
||||||
|
*/
|
||||||
|
private String container_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 容器类型
|
||||||
|
*/
|
||||||
|
private String container_type;
|
||||||
|
|
||||||
public void copyFrom(Task source) {
|
public void copyFrom(Task source) {
|
||||||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import lombok.Data;
|
|||||||
import org.nl.acs.common.base.CommonFinalParam;
|
import org.nl.acs.common.base.CommonFinalParam;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ldjun
|
* @author ldjun
|
||||||
@@ -365,4 +366,29 @@ public class TaskDto implements Serializable {
|
|||||||
* 15 RGV输送任务
|
* 15 RGV输送任务
|
||||||
*/
|
*/
|
||||||
private String class_type;
|
private String class_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库编码
|
||||||
|
*/
|
||||||
|
private String house_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统编号
|
||||||
|
*/
|
||||||
|
private String system_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务下发时间
|
||||||
|
*/
|
||||||
|
private String task_create_date_time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 容器编号
|
||||||
|
*/
|
||||||
|
private String container_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 容器类型
|
||||||
|
*/
|
||||||
|
private String container_type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
|||||||
import org.nl.acs.device_driver.DeviceDriverDefination;
|
import org.nl.acs.device_driver.DeviceDriverDefination;
|
||||||
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.storage.standard_storage.StandardStorageDeviceDriver;
|
import org.nl.acs.device_driver.storage.standard_storage.StandardStorageDeviceDriver;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask.CancelTaskRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.cancelTask.CancelTaskResponse;
|
||||||
|
import org.nl.acs.ext.wms.data.WcsToAcsData.feedBackTaskStatus.FeedBackTaskStatusRequest;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToWcsService;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.instruction.domain.Instruction;
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||||
@@ -61,6 +65,8 @@ import org.nl.acs.task.service.dto.TaskQueryParam;
|
|||||||
import org.nl.acs.task.service.mapper.TaskMapper;
|
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||||
import org.nl.common.utils.SecurityUtils;
|
import org.nl.common.utils.SecurityUtils;
|
||||||
import org.nl.config.language.LangProcess;
|
import org.nl.config.language.LangProcess;
|
||||||
|
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||||
|
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||||
import org.nl.system.service.param.ISysParamService;
|
import org.nl.system.service.param.ISysParamService;
|
||||||
import org.nl.common.utils.CodeUtil;
|
import org.nl.common.utils.CodeUtil;
|
||||||
|
|
||||||
@@ -111,6 +117,10 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
private DeviceAssignedService deviceAssignedService;
|
private DeviceAssignedService deviceAssignedService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private InstructionService instructionService;
|
private InstructionService instructionService;
|
||||||
|
@Autowired
|
||||||
|
private AcsToWcsService acsToWcsService;
|
||||||
|
@Autowired
|
||||||
|
private LuceneExecuteLogService luceneExecuteLogService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存
|
* 缓存
|
||||||
@@ -537,13 +547,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
@Override
|
@Override
|
||||||
public void create(TaskDto dto) throws Exception {
|
public void create(TaskDto dto) throws Exception {
|
||||||
dto = foramte(dto);
|
dto = foramte(dto);
|
||||||
dto.setInteraction_json(ObjectUtil.isNotEmpty(dto.getInteractionJson()) ? dto.getInteractionJson().toJSONString() : "");
|
|
||||||
if (!StrUtil.isEmpty(dto.getVehicle_code())) {
|
|
||||||
TaskDto vehicle_dto = this.findByContainer(dto.getVehicle_code());
|
|
||||||
if (vehicle_dto != null) {
|
|
||||||
throw new BadRequestException(LangProcess.msg("task_checkExist", dto.getVehicle_code()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String currentUsername = SecurityUtils.getCurrentNickName();
|
String currentUsername = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
String task_uuid = dto.getTask_id();
|
String task_uuid = dto.getTask_id();
|
||||||
@@ -551,14 +554,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
dto.setTask_id(IdUtil.simpleUUID());
|
dto.setTask_id(IdUtil.simpleUUID());
|
||||||
}
|
}
|
||||||
String task_code = dto.getTask_code();
|
String task_code = dto.getTask_code();
|
||||||
if (StrUtil.isEmpty(dto.getCar_no())) {
|
|
||||||
if ((dto.getStart_device_code().equals("A3") && dto.getNext_device_code().equals("A2")) || (dto.getStart_device_code().equals("A3") && dto.getNext_device_code().equals("A1"))) {
|
|
||||||
dto.setCar_no("2");
|
|
||||||
}
|
|
||||||
if (dto.getStart_device_code().equals("A3") && dto.getNext_device_code().equals("A4")) {
|
|
||||||
dto.setCar_no("1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (StrUtil.isEmpty(task_code)) {
|
if (StrUtil.isEmpty(task_code)) {
|
||||||
task_code = CodeUtil.getNewCode("TASK_NO");
|
task_code = CodeUtil.getNewCode("TASK_NO");
|
||||||
task_code = CommonFinalParam.HYPHEN_ + task_code;
|
task_code = CommonFinalParam.HYPHEN_ + task_code;
|
||||||
@@ -879,6 +874,16 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
|
|
||||||
Task task = ConvertUtil.convert(entity, Task.class);
|
Task task = ConvertUtil.convert(entity, Task.class);
|
||||||
taskMapper.updateById(task);
|
taskMapper.updateById(task);
|
||||||
|
|
||||||
|
//反馈放货完成
|
||||||
|
FeedBackTaskStatusRequest feedBackTaskStatusRequest = new FeedBackTaskStatusRequest();
|
||||||
|
feedBackTaskStatusRequest.setTaskCode(task.getTask_code());
|
||||||
|
feedBackTaskStatusRequest.setCarId(task.getCar_no());
|
||||||
|
feedBackTaskStatusRequest.setTaskType(task.getTask_type());
|
||||||
|
feedBackTaskStatusRequest.setFeedbackStatus("deprecate");
|
||||||
|
acsToWcsService.feedTaskStatus(feedBackTaskStatusRequest);
|
||||||
|
//ACS向WCS申请取消任务
|
||||||
|
this.cancelTask(entity);
|
||||||
//移除任务缓存信息
|
//移除任务缓存信息
|
||||||
this.removeByCodeFromCache(entity.getTask_code());
|
this.removeByCodeFromCache(entity.getTask_code());
|
||||||
//反馈上位系统任务状态
|
//反馈上位系统任务状态
|
||||||
@@ -889,6 +894,20 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void cancelTask(TaskDto entity) {
|
||||||
|
TaskDto dto = this.findById(entity.getTask_id());
|
||||||
|
CancelTaskRequest cancelTaskRequest = new CancelTaskRequest();
|
||||||
|
cancelTaskRequest.setTaskCode(dto.getTask_code());
|
||||||
|
cancelTaskRequest.setReason("手动取消");
|
||||||
|
Map<String, Object> cancelTask = acsToWcsService.cancelTask(cancelTaskRequest);
|
||||||
|
int responseCode = Integer.parseInt(String.valueOf(cancelTask.get("responseCode")));
|
||||||
|
if (responseCode == 0){
|
||||||
|
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "cancelTask", String.valueOf(responseCode),
|
||||||
|
JSON.toJSONString(cancelTaskRequest), String.valueOf(cancelTask), "ACS向WCS申请取消任务成功");
|
||||||
|
luceneExecuteLogService.interfaceExecuteLog(luceneLogDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void cancelAndInst(String id) throws Exception {
|
public void cancelAndInst(String id) throws Exception {
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<included>
|
||||||
|
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||||
|
<property name="LOG_HOME" value="${logPath}"/>
|
||||||
|
<!-- 按照每天生成日志文件 -->
|
||||||
|
<appender name="ACSToWCS" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!--日志文件输出的文件名-->
|
||||||
|
<FileNamePattern>${LOG_HOME}/ACS请求WCS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||||
|
<!--日志文件保留天数-->
|
||||||
|
<maxHistory>15</maxHistory>
|
||||||
|
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||||
|
<maxFileSize>50MB</maxFileSize>
|
||||||
|
<!--所有日志最多占多大容量-->
|
||||||
|
<totalSizeCap>2GB</totalSizeCap>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
|
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||||
|
<charset>${log.charset}</charset>
|
||||||
|
</encoder>
|
||||||
|
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 打印sql -->
|
||||||
|
<logger name="org.nl.acs.ext.wms.service.impl.AcsToWcsServiceImpl" level="info" additivity="true">
|
||||||
|
<appender-ref ref="ACSToWCS"/>
|
||||||
|
</logger>
|
||||||
|
</included>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<included>
|
||||||
|
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||||
|
<property name="LOG_HOME" value="${logPath}"/>
|
||||||
|
<!-- 按照每天生成日志文件 -->
|
||||||
|
<appender name="WCSToACS" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!--日志文件输出的文件名-->
|
||||||
|
<FileNamePattern>${LOG_HOME}/WCS下发ACS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||||
|
<!--日志文件保留天数-->
|
||||||
|
<maxHistory>15</maxHistory>
|
||||||
|
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||||
|
<maxFileSize>50MB</maxFileSize>
|
||||||
|
<!--所有日志最多占多大容量-->
|
||||||
|
<totalSizeCap>2GB</totalSizeCap>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||||
|
<charset>${log.charset}</charset>
|
||||||
|
</encoder>
|
||||||
|
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 打印sql -->
|
||||||
|
<logger name="org.nl.acs.ext.wms.service.impl.WcsToAcsServiceImpl" level="info" additivity="true">
|
||||||
|
<appender-ref ref="WCSToACS"/>
|
||||||
|
</logger>
|
||||||
|
</included>
|
||||||
Reference in New Issue
Block a user