web service 更新
This commit is contained in:
@@ -37,7 +37,7 @@ public interface XianGongAgvService {
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public HttpResponse markComplete(String code) throws Exception;
|
public HttpResponse markComplete(String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询AGV状态
|
* 查询AGV状态
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
|
|
||||||
@LokiLog(type = LokiLogType.AGV)
|
@LokiLog(type = LokiLogType.AGV)
|
||||||
@Override
|
@Override
|
||||||
public HttpResponse markComplete(String code) throws Exception {
|
public HttpResponse markComplete(String code) {
|
||||||
|
|
||||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||||
|
|||||||
@@ -159,61 +159,6 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
inst.setAgv_jobno(String.valueOf(index));
|
inst.setAgv_jobno(String.valueOf(index));
|
||||||
inst.setSend_status("1");
|
inst.setSend_status("1");
|
||||||
instructionService.update(inst);
|
instructionService.update(inst);
|
||||||
TaskDto task = taskService.findByCodeFromCache(inst.getTask_code());
|
|
||||||
JSONObject request = new JSONObject();
|
|
||||||
request.put("REQCODE", task.getExt_task_id());
|
|
||||||
request.put("TASKCODE", task.getTask_code());
|
|
||||||
request.put("PODCODE", task.getVehicle_code());
|
|
||||||
request.put("TASKTYPE", task.getTask_type());
|
|
||||||
request.put("METHOD", "1");
|
|
||||||
request.put("AGVCODE", String.valueOf(index));
|
|
||||||
request.put("REQTIME", DateUtil.now());
|
|
||||||
acsToWmsService.taskExecution(request);
|
|
||||||
}
|
|
||||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
||||||
} else if (phase == 0x03) {
|
|
||||||
// 到达取货点请求取货
|
|
||||||
if (ObjectUtil.isNotEmpty(inst)) {
|
|
||||||
TaskDto task = taskService.findByCodeFromCache(inst.getTask_code());
|
|
||||||
JSONObject request = new JSONObject();
|
|
||||||
request.put("REQCODE", task.getExt_task_id());
|
|
||||||
request.put("TASKCODE", task.getTask_code());
|
|
||||||
request.put("PODCODE", task.getVehicle_code());
|
|
||||||
request.put("TASKTYPE", task.getTask_type());
|
|
||||||
request.put("METHOD", "2");
|
|
||||||
request.put("AGVCODE", String.valueOf(index));
|
|
||||||
request.put("REQTIME", DateUtil.now());
|
|
||||||
acsToWmsService.taskExecution(request);
|
|
||||||
}
|
|
||||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
||||||
} else if (phase == 0x05) {
|
|
||||||
// 取货完成请求离开
|
|
||||||
if (ObjectUtil.isNotEmpty(inst)) {
|
|
||||||
TaskDto task = taskService.findByCodeFromCache(inst.getTask_code());
|
|
||||||
JSONObject request = new JSONObject();
|
|
||||||
request.put("REQCODE", task.getExt_task_id());
|
|
||||||
request.put("TASKCODE", task.getTask_code());
|
|
||||||
request.put("PODCODE", task.getVehicle_code());
|
|
||||||
request.put("TASKTYPE", task.getTask_type());
|
|
||||||
request.put("METHOD", "3");
|
|
||||||
request.put("AGVCODE", String.valueOf(index));
|
|
||||||
request.put("REQTIME", DateUtil.now());
|
|
||||||
acsToWmsService.taskExecution(request);
|
|
||||||
}
|
|
||||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
||||||
} else if (phase == 0x07) {
|
|
||||||
// 请求放货
|
|
||||||
if (ObjectUtil.isNotEmpty(inst)) {
|
|
||||||
TaskDto task = taskService.findByCodeFromCache(inst.getTask_code());
|
|
||||||
JSONObject request = new JSONObject();
|
|
||||||
request.put("REQCODE", task.getExt_task_id());
|
|
||||||
request.put("TASKCODE", task.getTask_code());
|
|
||||||
request.put("PODCODE", task.getVehicle_code());
|
|
||||||
request.put("TASKTYPE", task.getTask_type());
|
|
||||||
request.put("METHOD", "4");
|
|
||||||
request.put("AGVCODE", String.valueOf(index));
|
|
||||||
request.put("REQTIME", DateUtil.now());
|
|
||||||
acsToWmsService.taskExecution(request);
|
|
||||||
}
|
}
|
||||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package org.nl.acs.device_driver.basedriver.agv.ndcone;
|
package org.nl.acs.device_driver.basedriver.agv.ndcone;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -22,6 +24,9 @@ import org.nl.acs.log.LokiLogType;
|
|||||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
import org.nl.acs.opc.Device;
|
import org.nl.acs.opc.Device;
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.acs.wsdl.org.tempuri.RTMSAGVSERVICE;
|
||||||
import org.nl.modules.system.service.ParamService;
|
import org.nl.modules.system.service.ParamService;
|
||||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
@@ -123,7 +128,16 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
inst.setCarno(String.valueOf(carno));
|
inst.setCarno(String.valueOf(carno));
|
||||||
instructionService.update(inst);
|
instructionService.update(inst);
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + "反馈:" + data);
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + "反馈:" + data);
|
||||||
|
TaskDto task = SpringContextHolder.getBean(TaskService.class).findByCodeFromCache(inst.getTask_code());
|
||||||
|
JSONObject request = new JSONObject();
|
||||||
|
request.put("REQCODE", task.getTask_code());
|
||||||
|
request.put("TASKCODE", task.getTask_code());
|
||||||
|
request.put("PODCODE", task.getVehicle_code());
|
||||||
|
request.put("TASKTYPE", task.getTask_type());
|
||||||
|
request.put("METHOD", "1");
|
||||||
|
request.put("AGVCODE", this.device_code);
|
||||||
|
request.put("REQTIME", DateUtil.now());
|
||||||
|
new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(request.toJSONString());
|
||||||
//到达取货点
|
//到达取货点
|
||||||
//(需要WCS反馈)
|
//(需要WCS反馈)
|
||||||
} else if (phase == 0x03) {
|
} else if (phase == 0x03) {
|
||||||
@@ -183,6 +197,17 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
}
|
}
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||||
|
|
||||||
|
TaskDto task = SpringContextHolder.getBean(TaskService.class).findByCodeFromCache(inst.getTask_code());
|
||||||
|
JSONObject request = new JSONObject();
|
||||||
|
request.put("REQCODE", task.getTask_code());
|
||||||
|
request.put("TASKCODE", task.getTask_code());
|
||||||
|
request.put("PODCODE", task.getVehicle_code());
|
||||||
|
request.put("TASKTYPE", task.getTask_type());
|
||||||
|
request.put("METHOD", "2");
|
||||||
|
request.put("AGVCODE", this.device_code);
|
||||||
|
request.put("REQTIME", DateUtil.now());
|
||||||
|
new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(request.toJSONString());
|
||||||
|
|
||||||
//取货完毕
|
//取货完毕
|
||||||
//(需要WCS反馈)
|
//(需要WCS反馈)
|
||||||
} else if (phase == 0x05) {
|
} else if (phase == 0x05) {
|
||||||
@@ -254,6 +279,17 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
}
|
}
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||||
|
|
||||||
|
TaskDto task = SpringContextHolder.getBean(TaskService.class).findByCodeFromCache(inst.getTask_code());
|
||||||
|
JSONObject request = new JSONObject();
|
||||||
|
request.put("REQCODE", task.getTask_code());
|
||||||
|
request.put("TASKCODE", task.getTask_code());
|
||||||
|
request.put("PODCODE", task.getVehicle_code());
|
||||||
|
request.put("TASKTYPE", task.getTask_type());
|
||||||
|
request.put("METHOD", "3");
|
||||||
|
request.put("AGVCODE", this.device_code);
|
||||||
|
request.put("REQTIME", DateUtil.now());
|
||||||
|
new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(request.toJSONString());
|
||||||
|
|
||||||
//到达放货点
|
//到达放货点
|
||||||
//(需要WCS反馈)
|
//(需要WCS反馈)
|
||||||
} else if (phase == 0x07) {
|
} else if (phase == 0x07) {
|
||||||
@@ -305,6 +341,17 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
}
|
}
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||||
|
|
||||||
|
TaskDto task = SpringContextHolder.getBean(TaskService.class).findByCodeFromCache(inst.getTask_code());
|
||||||
|
JSONObject request = new JSONObject();
|
||||||
|
request.put("REQCODE", task.getTask_code());
|
||||||
|
request.put("TASKCODE", task.getTask_code());
|
||||||
|
request.put("PODCODE", task.getVehicle_code());
|
||||||
|
request.put("TASKTYPE", task.getTask_type());
|
||||||
|
request.put("METHOD", "4");
|
||||||
|
request.put("AGVCODE", this.device_code);
|
||||||
|
request.put("REQTIME", DateUtil.now());
|
||||||
|
new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(request.toJSONString());
|
||||||
|
|
||||||
//放货完毕
|
//放货完毕
|
||||||
//(需要WCS反馈)
|
//(需要WCS反馈)
|
||||||
} else if (phase == 0x09) {
|
} else if (phase == 0x09) {
|
||||||
|
|||||||
@@ -27,4 +27,16 @@ public class CancelTaskRequest extends BaseRequest {
|
|||||||
*/
|
*/
|
||||||
Map<String,String> params;
|
Map<String,String> params;
|
||||||
|
|
||||||
|
String REQCODE;
|
||||||
|
|
||||||
|
String TASKCODE;
|
||||||
|
|
||||||
|
String TASKTYPE;
|
||||||
|
|
||||||
|
String METHOD;
|
||||||
|
|
||||||
|
String AGVCODE;
|
||||||
|
|
||||||
|
String REQTIME;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public interface WmsToAcsService {
|
|||||||
*
|
*
|
||||||
* @param jsonObject 条件
|
* @param jsonObject 条件
|
||||||
*/
|
*/
|
||||||
CancelTaskResponse cancelFromWms(String jsonObject) throws Exception;
|
CancelTaskResponse cancelFromWms(String jsonObject);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设置有无货属性
|
* 修改设置有无货属性
|
||||||
|
|||||||
@@ -60,47 +60,38 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
private String log_type = "LMS请求ACS";
|
private String log_type = "LMS请求ACS";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CancelTaskResponse cancelFromWms(String param) throws Exception {
|
public CancelTaskResponse cancelFromWms(String param) {
|
||||||
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
|
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
|
||||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||||
JSONArray datas = JSONArray.parseArray(param);
|
// JSONArray datas = JSONArray.parseArray(param);
|
||||||
CancelTaskResponse response = new CancelTaskResponse();
|
CancelTaskResponse response = new CancelTaskResponse();
|
||||||
JSONArray errArr = new JSONArray();
|
CancelTaskRequest request = JsonUtl.format(param, CancelTaskRequest.class);
|
||||||
for (int i = 0; i < datas.size(); i++) {
|
|
||||||
String data = datas.get(i).toString();
|
|
||||||
CancelTaskRequest request = JsonUtl.format(param, CancelTaskRequest.class);
|
|
||||||
|
|
||||||
String task_uuid = request.getExt_task_id();
|
// String task_uuid = request.getExt_task_id();
|
||||||
String task_code = request.getTask_code();
|
String task_code = request.getTASKCODE();
|
||||||
String vehicle_code = request.getVehicle_code();
|
String vehicle_code = request.getVehicle_code();
|
||||||
|
|
||||||
if (StrUtil.isEmpty(task_uuid)) {
|
// if (StrUtil.isEmpty(task_uuid)) {
|
||||||
throw new WDKException("任务标识不能为空");
|
// throw new WDKException("任务标识不能为空");
|
||||||
|
// }
|
||||||
|
if (StrUtil.isEmpty(task_code)) {
|
||||||
|
throw new WDKException("任务号不能为空!");
|
||||||
|
}
|
||||||
|
String cancelTaskCheck = paramService.findByCode(AcsConfig.CANCELTASKCHECK).getValue();
|
||||||
|
if (StrUtil.equals(cancelTaskCheck, "1")) {
|
||||||
|
taskService.cancelFromCode(task_code);
|
||||||
|
} else if (StrUtil.equals(cancelTaskCheck, "0")) {
|
||||||
|
Instruction inst = instructionService.findByTaskcode(task_code);
|
||||||
|
if (inst == null) {
|
||||||
|
taskService.cancelFromCode(task_code);
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("指令正在执行中,操作失败!");
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(task_code)) {
|
|
||||||
throw new WDKException("任务号不能为空");
|
|
||||||
}
|
|
||||||
String cancelTaskCheck = paramService.findByCode(AcsConfig.CANCELTASKCHECK).getValue();
|
|
||||||
if (StrUtil.equals(cancelTaskCheck, "1")) {
|
|
||||||
taskService.cancel(task_uuid);
|
|
||||||
} else if (StrUtil.equals(cancelTaskCheck, "0")) {
|
|
||||||
Instruction inst = instructionService.findByTaskcode(task_code);
|
|
||||||
if (inst == null) {
|
|
||||||
taskService.cancel(task_uuid);
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("指令正在执行中,操作失败!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(errArr)) {
|
|
||||||
response.setStatus(200);
|
response.setStatus(HttpStatus.OK.value());
|
||||||
} else {
|
|
||||||
response.setStatus(400);
|
|
||||||
}
|
|
||||||
response.setMessage("success");
|
response.setMessage("success");
|
||||||
response.setErrArr(errArr);
|
|
||||||
log.info("cancelFromWms--------------:输出参数:" + response);
|
log.info("cancelFromWms--------------:输出参数:" + response);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
@@ -458,70 +449,67 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
try {
|
try {
|
||||||
MDC.put(log_file_type, log_type);
|
MDC.put(log_file_type, log_type);
|
||||||
log.info("crateTask-----输入参数{}", param);
|
log.info("crateTask-----输入参数{}", param);
|
||||||
JSONArray datas = JSONArray.parseArray("[" + param + "]");
|
|
||||||
CreateTaskResponse response = new CreateTaskResponse();
|
CreateTaskResponse response = new CreateTaskResponse();
|
||||||
JSONArray errArr = new JSONArray();
|
JSONArray errArr = new JSONArray();
|
||||||
for (int i = 0; i < datas.size(); i++) {
|
CreateTaskRequest request = JsonUtl.format(param, CreateTaskRequest.class);
|
||||||
String data = datas.get(i).toString();
|
|
||||||
CreateTaskRequest request = JsonUtl.format(data, CreateTaskRequest.class);
|
|
||||||
// String ext_task_id = request.getREQCODE();
|
// String ext_task_id = request.getREQCODE();
|
||||||
String task_code = request.getTASKCODE();
|
String task_code = request.getTASKCODE();
|
||||||
String start_device_code = request.getSTARTPOSITION();
|
String start_device_code = request.getSTARTPOSITION();
|
||||||
// String start_device_code2 = request.getStart_device_code2();
|
// String start_device_code2 = request.getStart_device_code2();
|
||||||
String next_device_code = request.getENNPOSITION();
|
String next_device_code = request.getENNPOSITION();
|
||||||
// String next_device_code2 = request.getNext_device_code2();
|
// String next_device_code2 = request.getNext_device_code2();
|
||||||
// String put_device_code = request.getPut_device_code();
|
// String put_device_code = request.getPut_device_code();
|
||||||
String priority = request.getPriority();
|
String priority = request.getPriority();
|
||||||
String vehicle_code = request.getPODCODE();
|
String vehicle_code = request.getPODCODE();
|
||||||
String vehicle_type = request.getVehicle_type();
|
String vehicle_type = request.getVehicle_type();
|
||||||
String route_plan_code = request.getRoute_plan_code();
|
String route_plan_code = request.getRoute_plan_code();
|
||||||
String task_type = request.getTASKTYPE();
|
String task_type = request.getTASKTYPE();
|
||||||
String storage_task_type = request.getDtl_type();
|
String storage_task_type = request.getDtl_type();
|
||||||
String agv_system_type = request.getAgv_system_type();
|
String agv_system_type = request.getAgv_system_type();
|
||||||
String remark = request.getRemark();
|
String remark = request.getRemark();
|
||||||
double oven_time = 0.00d;
|
double oven_time = 0.00d;
|
||||||
if (StrUtil.isNotEmpty(request.getOven_time())) {
|
if (StrUtil.isNotEmpty(request.getOven_time())) {
|
||||||
oven_time = Double.parseDouble(request.getOven_time());
|
oven_time = Double.parseDouble(request.getOven_time());
|
||||||
}
|
}
|
||||||
String temperature = request.getTemperature();
|
String temperature = request.getTemperature();
|
||||||
Map<String, String> params = request.getParams();
|
Map<String, String> params = request.getParams();
|
||||||
|
|
||||||
String start_point_code = "";
|
String start_point_code = "";
|
||||||
String start_point_code2 = "";
|
String start_point_code2 = "";
|
||||||
String next_point_code = "";
|
String next_point_code = "";
|
||||||
String next_point_code2 = "";
|
String next_point_code2 = "";
|
||||||
String put_point_code = "";
|
String put_point_code = "";
|
||||||
if (StrUtil.isEmpty(task_code)) {
|
if (StrUtil.isEmpty(task_code)) {
|
||||||
response.setREQCODE(task_code);
|
response.setREQCODE(task_code);
|
||||||
response.setREPLYTIME(DateUtil.now());
|
response.setREPLYTIME(DateUtil.now());
|
||||||
response.setREQCODE("1");
|
response.setRTCODE("1");
|
||||||
response.setRTMSG("任务号不能为空!");
|
response.setRTMSG("任务号不能为空!");
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(start_device_code)) {
|
if (StrUtil.isEmpty(start_device_code)) {
|
||||||
response.setREQCODE(task_code);
|
response.setREQCODE(task_code);
|
||||||
response.setREPLYTIME(DateUtil.now());
|
response.setREPLYTIME(DateUtil.now());
|
||||||
response.setREQCODE("1");
|
response.setRTCODE("1");
|
||||||
response.setRTMSG("起点不能为空!");
|
response.setRTMSG("起点不能为空!");
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(next_device_code)) {
|
if (StrUtil.isEmpty(next_device_code)) {
|
||||||
response.setREQCODE(task_code);
|
response.setREQCODE(task_code);
|
||||||
response.setREPLYTIME(DateUtil.now());
|
response.setREPLYTIME(DateUtil.now());
|
||||||
response.setREQCODE("1");
|
response.setRTCODE("1");
|
||||||
response.setRTMSG("终点不能为空!");
|
response.setRTMSG("终点不能为空!");
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0);
|
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0);
|
||||||
if (!ObjectUtil.isEmpty(start_device_json)) {
|
if (!ObjectUtil.isEmpty(start_device_json)) {
|
||||||
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_device_code : (String) start_device_json.get("storage_code");
|
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_device_code : (String) start_device_json.get("storage_code");
|
||||||
}
|
}
|
||||||
JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code + "'").uniqueResult(0);
|
JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code + "'").uniqueResult(0);
|
||||||
if (!ObjectUtil.isEmpty(next_device_json)) {
|
if (!ObjectUtil.isEmpty(next_device_json)) {
|
||||||
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
|
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
|
||||||
}
|
}
|
||||||
// JSONObject start_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code2 + "'").uniqueResult(0);
|
// JSONObject start_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code2 + "'").uniqueResult(0);
|
||||||
// if (!ObjectUtil.isEmpty(start_device_json2)) {
|
// if (!ObjectUtil.isEmpty(start_device_json2)) {
|
||||||
// start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_device_code2 : (String) start_device_json2.get("storage_code");
|
// start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_device_code2 : (String) start_device_json2.get("storage_code");
|
||||||
@@ -534,19 +522,19 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
// if (!ObjectUtil.isEmpty(put_device_json)) {
|
// if (!ObjectUtil.isEmpty(put_device_json)) {
|
||||||
// put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) put_device_json.get("storage_code");
|
// put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) put_device_json.get("storage_code");
|
||||||
// }
|
// }
|
||||||
if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) {
|
if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) {
|
||||||
String str[] = start_point_code.split("-");
|
String str[] = start_point_code.split("-");
|
||||||
start_device_code = str[0];
|
start_device_code = str[0];
|
||||||
} else {
|
} else {
|
||||||
start_device_code = start_point_code;
|
start_device_code = start_point_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.isNotEmpty(next_point_code) && next_point_code.indexOf("-") > 0) {
|
if (StrUtil.isNotEmpty(next_point_code) && next_point_code.indexOf("-") > 0) {
|
||||||
String str[] = next_point_code.split("-");
|
String str[] = next_point_code.split("-");
|
||||||
next_device_code = str[0];
|
next_device_code = str[0];
|
||||||
} else {
|
} else {
|
||||||
next_device_code = next_point_code;
|
next_device_code = next_point_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (StrUtil.isNotEmpty(start_point_code2) && start_point_code2.indexOf("-") > 0) {
|
// if (StrUtil.isNotEmpty(start_point_code2) && start_point_code2.indexOf("-") > 0) {
|
||||||
// String str[] = start_point_code2.split("-");
|
// String str[] = start_point_code2.split("-");
|
||||||
@@ -569,9 +557,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
// put_device_code = put_point_code;
|
// put_device_code = put_point_code;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (StrUtil.isEmpty(route_plan_code)) {
|
if (StrUtil.isEmpty(route_plan_code)) {
|
||||||
route_plan_code = "normal";
|
route_plan_code = "normal";
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (StrUtil.equals(task_type, "5") && taskService.querySameDeviceReadyTask(start_device_code, next_device_code, "0") > 1) {
|
// if (StrUtil.equals(task_type, "5") && taskService.querySameDeviceReadyTask(start_device_code, next_device_code, "0") > 1) {
|
||||||
// JSONObject json = new JSONObject();
|
// JSONObject json = new JSONObject();
|
||||||
@@ -581,73 +569,73 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
// errArr.add(json);
|
// errArr.add(json);
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
||||||
if (taskDto != null) {
|
if (taskDto != null) {
|
||||||
|
response.setREQCODE(task_code);
|
||||||
|
response.setREPLYTIME(DateUtil.now());
|
||||||
|
response.setRTCODE("1");
|
||||||
|
response.setRTMSG("不能存在相同的任务号!");
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||||
|
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
|
||||||
|
if (vehicle_dto != null) {
|
||||||
response.setREQCODE(task_code);
|
response.setREQCODE(task_code);
|
||||||
response.setREPLYTIME(DateUtil.now());
|
response.setREPLYTIME(DateUtil.now());
|
||||||
response.setREQCODE("1");
|
response.setRTCODE("1");
|
||||||
response.setRTMSG("不能存在相同的任务号!");
|
response.setRTMSG("不能存在相同的料车号!");
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
}
|
||||||
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
|
|
||||||
if (vehicle_dto != null) {
|
|
||||||
response.setREQCODE(task_code);
|
|
||||||
response.setREPLYTIME(DateUtil.now());
|
|
||||||
response.setREQCODE("1");
|
|
||||||
response.setRTMSG("不能存在相同的料车号!");
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StrUtil.isEmpty(start_point_code)) {
|
if (StrUtil.isEmpty(start_point_code)) {
|
||||||
response.setREQCODE(task_code);
|
response.setREQCODE(task_code);
|
||||||
response.setREPLYTIME(DateUtil.now());
|
response.setREPLYTIME(DateUtil.now());
|
||||||
response.setREQCODE("1");
|
response.setRTCODE("1");
|
||||||
response.setRTMSG(start_device_code + "未找到对应点位!");
|
response.setRTMSG(start_device_code + "未找到对应点位!");
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(next_point_code)) {
|
if (StrUtil.isEmpty(next_point_code)) {
|
||||||
response.setREQCODE(task_code);
|
response.setREQCODE(task_code);
|
||||||
response.setREPLYTIME(DateUtil.now());
|
response.setREPLYTIME(DateUtil.now());
|
||||||
response.setREQCODE("1");
|
response.setRTCODE("1");
|
||||||
response.setRTMSG(next_device_code + "未找到对应点位!");
|
response.setRTMSG(next_device_code + "未找到对应点位!");
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("task_code", task_code);
|
jo.put("task_code", task_code);
|
||||||
jo.put("task_id", task_code);
|
jo.put("task_id", task_code);
|
||||||
jo.put("start_point_code", start_point_code);
|
jo.put("start_point_code", start_point_code);
|
||||||
jo.put("next_point_code", next_point_code);
|
jo.put("next_point_code", next_point_code);
|
||||||
jo.put("start_point_code2", start_point_code2);
|
jo.put("start_point_code2", start_point_code2);
|
||||||
jo.put("next_point_code2", next_point_code2);
|
jo.put("next_point_code2", next_point_code2);
|
||||||
jo.put("put_point_code", put_point_code);
|
jo.put("put_point_code", put_point_code);
|
||||||
jo.put("start_parent_code", start_point_code);
|
jo.put("start_parent_code", start_point_code);
|
||||||
jo.put("next_parent_code", next_point_code);
|
jo.put("next_parent_code", next_point_code);
|
||||||
jo.put("start_device_code", start_device_code);
|
jo.put("start_device_code", start_device_code);
|
||||||
jo.put("next_device_code", next_device_code);
|
jo.put("next_device_code", next_device_code);
|
||||||
// jo.put("start_device_code2", start_device_code2);
|
// jo.put("start_device_code2", start_device_code2);
|
||||||
// jo.put("next_device_code2", next_device_code2);
|
// jo.put("next_device_code2", next_device_code2);
|
||||||
// jo.put("put_device_code", put_device_code);
|
// jo.put("put_device_code", put_device_code);
|
||||||
jo.put("priority", priority);
|
jo.put("priority", priority);
|
||||||
jo.put("vehicle_code", vehicle_code);
|
jo.put("vehicle_code", vehicle_code);
|
||||||
jo.put("vehicle_type", vehicle_type);
|
jo.put("vehicle_type", vehicle_type);
|
||||||
jo.put("storage_task_type", storage_task_type);
|
jo.put("storage_task_type", storage_task_type);
|
||||||
jo.put("agv_system_type", agv_system_type);
|
jo.put("agv_system_type", agv_system_type);
|
||||||
jo.put("oven_time", (int) Math.ceil(oven_time));
|
jo.put("oven_time", (int) Math.ceil(oven_time));
|
||||||
jo.put("remark", remark);
|
jo.put("remark", remark);
|
||||||
jo.put("params", params);
|
jo.put("params", params);
|
||||||
jo.put("task_type", task_type);
|
jo.put("task_type", task_type);
|
||||||
|
|
||||||
if (!StrUtil.isEmpty(task_code)) {
|
if (!StrUtil.isEmpty(task_code)) {
|
||||||
jo.put("ext_task_id", task_code);
|
jo.put("ext_task_id", task_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||||
try {
|
try {
|
||||||
// task_type=7 则是立库任务需要下刻下发
|
// task_type=7 则是立库任务需要下刻下发
|
||||||
if (StrUtil.equals(task_dto.getTask_type(), "7")) {
|
if (StrUtil.equals(task_dto.getTask_type(), "7")) {
|
||||||
// taskService.create(task_dto);
|
// taskService.create(task_dto);
|
||||||
// try{
|
// try{
|
||||||
// taskService.createInst(task_dto.getTask_id());
|
// taskService.createInst(task_dto.getTask_id());
|
||||||
@@ -660,53 +648,43 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
// errArr.add(json);
|
// errArr.add(json);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//创建临时指令 不创建、不生成
|
//创建临时指令 不创建、不生成
|
||||||
//等立库反馈成功才能创建任务和指令
|
//等立库反馈成功才能创建任务和指令
|
||||||
Instruction inst = taskService.createTemporaryInst(task_dto);
|
Instruction inst = taskService.createTemporaryInst(task_dto);
|
||||||
Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(), inst);
|
Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(), inst);
|
||||||
|
|
||||||
if (StrUtil.equals(resp.result, "true")) {
|
if (StrUtil.equals(resp.result, "true")) {
|
||||||
//创建任务和指令
|
//创建任务和指令
|
||||||
taskService.create(task_dto);
|
taskService.create(task_dto);
|
||||||
inst.setSend_status("1");
|
inst.setSend_status("1");
|
||||||
taskService.createInst(inst);
|
taskService.createInst(inst);
|
||||||
|
|
||||||
} else {
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("task_code", task_code);
|
|
||||||
// json.put("ext_task_id", ext_task_id);
|
|
||||||
json.put("message", resp.getComment());
|
|
||||||
json.put("code", resp.code);
|
|
||||||
json.put("data", data);
|
|
||||||
errArr.add(json);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
taskService.create(task_dto);
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("task_code", task_code);
|
||||||
|
// json.put("ext_task_id", ext_task_id);
|
||||||
|
json.put("message", resp.getComment());
|
||||||
|
json.put("code", resp.code);
|
||||||
|
json.put("data", param);
|
||||||
|
errArr.add(json);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
response.setREQCODE(task_code);
|
|
||||||
response.setREPLYTIME(DateUtil.now());
|
|
||||||
response.setREQCODE("1");
|
|
||||||
response.setRTMSG(e.getMessage());
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(errArr)) {
|
|
||||||
response.setREPLYTIME(DateUtil.now());
|
|
||||||
response.setREQCODE("0");
|
|
||||||
response.setRTMSG("success");
|
|
||||||
} else {
|
|
||||||
response.setStatus(400);
|
|
||||||
if (ObjectUtil.isNotEmpty(errArr)) {
|
|
||||||
response.setMessage(errArr.getJSONObject(0).getString("message"));
|
|
||||||
} else {
|
} else {
|
||||||
response.setMessage("false");
|
taskService.create(task_dto);
|
||||||
}
|
}
|
||||||
response.setErrArr(errArr);
|
} catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
response.setREQCODE(task_code);
|
||||||
|
response.setREPLYTIME(DateUtil.now());
|
||||||
|
response.setRTCODE("1");
|
||||||
|
response.setRTMSG(e.getMessage());
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
response.setREQCODE(task_code);
|
||||||
|
response.setREPLYTIME(DateUtil.now());
|
||||||
|
response.setRTCODE("0");
|
||||||
|
response.setRTMSG("success");
|
||||||
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response));
|
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response));
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
package org.nl.acs.ext.wms.service.wsdl;
|
|
||||||
|
|
||||||
import javax.jws.WebParam;
|
|
||||||
import javax.jws.WebService;
|
|
||||||
|
|
||||||
@WebService(targetNamespace = "http://service.mrxu.com/")
|
|
||||||
public interface IWebServiceTest {
|
|
||||||
|
|
||||||
String getDept(@WebParam(name = "jsonStr")String jsonStr);
|
|
||||||
}
|
|
||||||
@@ -32,12 +32,12 @@ public class PublishEndpoint implements ApplicationRunner {
|
|||||||
for(String beanName : beanNames) {
|
for(String beanName : beanNames) {
|
||||||
String publishAddr = applicationConnect.getType(beanName).getAnnotation(AutoPublish.class).publishAddress();
|
String publishAddr = applicationConnect.getType(beanName).getAnnotation(AutoPublish.class).publishAddress();
|
||||||
EndpointImpl endpoint = new EndpointImpl(bus, applicationConnect.getBean(beanName));
|
EndpointImpl endpoint = new EndpointImpl(bus, applicationConnect.getBean(beanName));
|
||||||
endpoint.publish(publishAddr);
|
endpoint.publish("/" + publishAddr);
|
||||||
|
|
||||||
log.info(String.format("发布接口地址:[%s]", publishAddr));
|
log.info(String.format("发布接口地址:[%s]", publishAddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("weBservice接口自动发布结束");
|
log.info("webService接口自动发布结束");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
package org.nl.acs.ext.wms.service.wsdl;
|
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.jws.WebService;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@Service("WebServiceTest")
|
|
||||||
@AutoPublish(publishAddress = "ACS")
|
|
||||||
@WebService(endpointInterface = "org.nl.acs.ext.wms.service.wsdl.IWebServiceTest",
|
|
||||||
serviceName = "WebServiceTest",
|
|
||||||
targetNamespace = "http://127.0.0.1:8010/WebServiceTest/"
|
|
||||||
)
|
|
||||||
public class WebServiceTest implements IWebServiceTest {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDept(String jsonStr) {
|
|
||||||
return "111";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package org.nl.acs.ext.wms.service.wsdl;
|
||||||
|
|
||||||
|
import javax.jws.WebParam;
|
||||||
|
import javax.jws.WebService;
|
||||||
|
|
||||||
|
@WebService(targetNamespace = "http://service.mrxu.com/")
|
||||||
|
public interface WmsToAcsWebService {
|
||||||
|
|
||||||
|
String createTask(@WebParam(name = "jsonStr") String jsonStr);
|
||||||
|
|
||||||
|
String cancelTask(@WebParam(name = "jsonStr") String jsonStr);
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package org.nl.acs.ext.wms.service.wsdl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.acs.ext.wms.data.CreateTaskResponse;
|
||||||
|
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
@Service("WmsToAcsWebService")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@AutoPublish(publishAddress = "ACS")
|
||||||
|
@javax.jws.WebService(endpointInterface = "org.nl.acs.ext.wms.service.wsdl.WmsToAcsWebService",
|
||||||
|
serviceName = "WmsToAcsWebService",
|
||||||
|
targetNamespace = "http://127.0.0.1:8010/WmsToAcsWebService/"
|
||||||
|
)
|
||||||
|
public class WmsToAcsWebServiceImpl implements WmsToAcsWebService {
|
||||||
|
|
||||||
|
private final WmsToAcsService wmsToAcsService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createTask(String jsonStr) {
|
||||||
|
CreateTaskResponse methodResult = wmsToAcsService.crateTask(jsonStr);
|
||||||
|
JSONObject response = new JSONObject();
|
||||||
|
response.put("REQCODE", methodResult.getREQCODE());
|
||||||
|
response.put("REPLYTIME", methodResult.getREPLYTIME());
|
||||||
|
response.put("RTCODE", methodResult.getRTCODE());
|
||||||
|
response.put("AGVCODE", methodResult.getAGVCODE());
|
||||||
|
response.put("RTMSG", methodResult.getRTMSG());
|
||||||
|
return response.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String cancelTask(String jsonStr) {
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
JSONObject json = JSONObject.parseObject(jsonStr);
|
||||||
|
if (ObjectUtil.isEmpty(json)) {
|
||||||
|
result.put("REPLYTIME", DateUtil.now());
|
||||||
|
result.put("RTCODE", "1");
|
||||||
|
result.put("RTMSG", "请求参数空!");
|
||||||
|
return result.toJSONString();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
wmsToAcsService.cancelFromWms(jsonStr);
|
||||||
|
result.put("REQCODE", json.getString("REQCODE"));
|
||||||
|
result.put("REPLYTIME", DateUtil.now());
|
||||||
|
result.put("RTCODE", "0");
|
||||||
|
result.put("RTMSG", "success");
|
||||||
|
return result.toJSONString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.put("REQCODE", json.getString("REQCODE"));
|
||||||
|
result.put("REPLYTIME", DateUtil.now());
|
||||||
|
result.put("RTCODE", "1");
|
||||||
|
result.put("RTMSG", e.getMessage());
|
||||||
|
return result.toJSONString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -185,7 +185,7 @@ public interface TaskService {
|
|||||||
*
|
*
|
||||||
* @param ids
|
* @param ids
|
||||||
*/
|
*/
|
||||||
void cancel(String ids) throws Exception;
|
void cancel(String ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手动创建指令
|
* 手动创建指令
|
||||||
@@ -314,5 +314,5 @@ public interface TaskService {
|
|||||||
*/
|
*/
|
||||||
Integer querySameDeviceReadyTask(String start_device,String next_device,String status);
|
Integer querySameDeviceReadyTask(String start_device,String next_device,String status);
|
||||||
|
|
||||||
|
void cancelFromCode(String ids);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user