Browse Source

NDC接口调整

psh
psh 1 year ago
parent
commit
c173e19565
  1. 107
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  2. 8
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java
  3. 9
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java
  4. 5
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java
  5. 14
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
  6. 12
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  7. 15
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java
  8. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/SchBasePoint.java
  9. 14
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java
  10. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java
  11. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java
  12. 18
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java
  13. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java
  14. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/XSCKTask.java
  15. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ZJBZKDDTask.java
  16. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java
  17. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java

107
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

@ -1,5 +1,6 @@
package org.nl.acs.device_driver.basedriver.agv.ndcone;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
@ -17,6 +18,7 @@ import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDevic
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
import org.nl.acs.ext.wms.data.BaseRequest;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
@ -26,6 +28,7 @@ import org.nl.acs.log.LokiLog;
import org.nl.acs.log.LokiLogType;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.domain.Task;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.system.service.param.ISysParamService;
@ -165,31 +168,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
return;
}
Object reqWms = device.getExtraValue().get("reqWms");
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("vehicle_code", inst.getVehicle_code());
map.put("status", "1");
map.put("device_code", inst.getStart_point_code());
map.put("task_code", inst.getTask_code());
req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs请求wms取货申请成功,wms不允许agv申请取货,未反馈agv允许取货", inst.getInstruction_code());
}
} else {
log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code());
}
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
}
Task task =taskService.getById(inst.getTask_id());
BaseRequest request=new BaseRequest();
request.setRequestNo(IdUtil.simpleUUID());
request.setTaskId(task.getExt_task_id());
request.setPhase(String.valueOf(phase));
acsToWmsService.feedbackState(request);
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
//到达取货等待点
//(需要WCS反馈)
} else if (phase == 0x04) {
@ -229,31 +214,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
return;
}
Object reqWms = device.getExtraValue().get("reqWms");
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("vehicle_code", inst.getVehicle_code());
map.put("status", "2");
map.put("device_code", inst.getStart_point_code());
map.put("task_code", inst.getTask_code());
req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
log.info("指令号:{},acs反馈wms取货完成成功,wms允许agv取货完成,已反馈agv取货完成", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs反馈wms取货完成成功,wms不允许agv取货完成,未反馈agv取货完成", inst.getInstruction_code());
}
} else {
log.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code());
}
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
//到达放货等待点
//(需要WCS反馈)
} else if (phase == 0x06) {
@ -290,30 +251,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到关联编号{}对应的指令", ikey);
return;
}
Object reqWms = device.getExtraValue().get("reqWms");
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("vehicle_code", inst.getVehicle_code());
map.put("status", "3");
map.put("device_code", inst.getNext_point_code());
map.put("task_code", inst.getTask_code());
req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs请求wms放货申请成功,wms不允许agv申请放货,未反馈agv允许放货", inst.getInstruction_code());
}
} else {
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
}
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
//放货完毕
//(需要WCS反馈)
} else if (phase == 0x09) {
@ -348,25 +287,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到编号{}对应的指令", ikey);
return;
}
Object reqWms = device.getExtraValue().get("reqWms");
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("vehicle_code", inst.getVehicle_code());
map.put("status", "4");
map.put("device_code", inst.getNext_point_code());
map.put("task_code", inst.getTask_code());
req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
}
} else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
}
//到达位置点
//(需要WCS反馈)

8
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java

@ -126,7 +126,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status("1");
instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0,0,0,0,0);
agvphase = 0;
index = 0;
inst = null;
@ -141,7 +141,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status("2");
instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0,0,0,0,0);
// OneNDCSocketConnectionAutoRun.write(data);
agvphase = 0;
index = 0;
@ -157,7 +157,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status("5");
instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0,0,0,0,0);
// OneNDCSocketConnectionAutoRun.write(data);
agvphase = 0;
index = 0;
@ -172,7 +172,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status("6");
instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0,0,0,0,0);
// OneNDCSocketConnectionAutoRun.write(data);
agvphase = 0;
index = 0;

9
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java

@ -63,6 +63,15 @@ public class BaseRequest {
*/
private String state;
/**
* 任务号
*/
private String taskId;
/**
* 阶段号
*/
private String phase;
}

5
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java

@ -127,4 +127,9 @@ public interface AcsToWmsService {
* ACS向WMS反馈任务状态
*/
String notify(BaseRequest request);
/**
* 任务阶段反馈最新点位
*/
String feedbackState(BaseRequest request);
}

14
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java

@ -592,4 +592,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.remove(log_file_type);
}
}
@Override
public String feedbackState(BaseRequest requestParam) {
try {
MDC.put(log_file_type, log_type);
String api = addressService.findByCode("feedbackState").getMethods_url();
log.info("feedbackState-----输入参数{}", JSON.toJSONString(requestParam, SerializerFeature.DisableCircularReferenceDetect));
String result = LmsUtil.notifyAcs(api, requestParam);
log.info("feedbackState-----输出参数{}", result);
return result;
} finally {
MDC.remove(log_file_type);
}
}
}

12
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -384,13 +384,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if (StrUtil.isEmpty(dto.getLink_num())) {
dto.setIs_send(task.getLink_num());
}
if (task.getTask_type().equals("1") || task.getTask_type().equals("2")) {
// if (task.getTask_type().equals("1") || task.getTask_type().equals("2")) {
dto.setInstruction_type(task.getTask_type());
} else if (false) {
} else {
dto.setInstruction_type("3");
}
// } else if (false) {
//
// } else {
// dto.setInstruction_type("3");
// }
// 查询是否存在相同指令号
// if (!StrUtil.isEmpty(dto.getVehicle_code() )) {

15
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java

@ -187,18 +187,17 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public BaseResponse feedbackState(JSONObject param) {
String requestNo = param.getString("requestNo");
String requestMethodCode = param.getString("request_medthod_code"); // 获取请求方法名
String requestMethodName = param.getString("request_medthod_name");
String taskId = param.getString("taskId");
BaseResponse result = BaseResponse.build(requestNo);
String device_code = param.getString("device_code");
param.put("config_code",requestMethodCode);
try {
if(ObjectUtil.isEmpty(requestMethodCode)){
throw new BadRequestException("任务类型不正确!requestMethodCode:"+requestMethodName+",device_code:"+device_code);
SchBaseTask schBaseTask=taskService.getById(taskId);
if(ObjectUtil.isEmpty(schBaseTask)){
throw new BadRequestException("任务不存在!taskId:"+taskId);
}
AbstractTask task = taskFactory.getTask(requestMethodCode);
AbstractTask task = taskFactory.getTask(schBaseTask.getConfig_code());
// 执行创建任务
task.apply(param);
String resultCode=task.feedbackState(param);
result.getParameters().put("result",resultCode);
} catch (Exception e) {
String message = ObjectUtil.isEmpty(e.getMessage())
? ((InvocationTargetException) e).getTargetException().getMessage()

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/SchBasePoint.java

@ -141,4 +141,10 @@ public class SchBasePoint implements Serializable {
@TableField(exist = false)
private String group_id;
@ApiModelProperty(value = "取货等待点")
private String start_wait_point;
@ApiModelProperty(value = "放货等待点")
private String next_wait_point;
}

14
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java

@ -23,7 +23,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author ldjun
@ -227,4 +229,16 @@ public abstract class AbstractTask {
this.updateStatus(task_code, status);
}
/**
* 任务阶段反馈最新点位
*
* @param param
* @throws BadRequestException
*/
public String feedbackState(JSONObject param) throws BadRequestException {
return this.feedbackTaskState(param);
}
protected abstract String feedbackTaskState(JSONObject param);
}

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java

@ -214,4 +214,21 @@ public class BPSLTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected String feedbackTaskState(JSONObject param) {
int phase=param.getInteger("phase");
String result="0";
switch (phase){
case 3:
break;
case 4:
break;
case 6:
break;
case 7:
break;
}
return result;
}
}

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java

@ -175,4 +175,21 @@ public class KGHJRKTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected String feedbackTaskState(JSONObject param) {
int phase=param.getInteger("phase");
String result="0";
switch (phase){
case 3:
break;
case 4:
break;
case 6:
break;
case 7:
break;
}
return result;
}
}

18
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java

@ -30,6 +30,7 @@ import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* @Author: psh
@ -241,4 +242,21 @@ public class MJXLTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected String feedbackTaskState(JSONObject param) {
int phase=param.getInteger("phase");
String result="0";
switch (phase){
case 3:
break;
case 4:
break;
case 6:
break;
case 7:
break;
}
return result;
}
}

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java

@ -181,4 +181,21 @@ public class TBXBKJTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected String feedbackTaskState(JSONObject param) {
int phase=param.getInteger("phase");
String result="0";
switch (phase){
case 3:
break;
case 4:
break;
case 6:
break;
case 7:
break;
}
return result;
}
}

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/XSCKTask.java

@ -226,4 +226,21 @@ public class XSCKTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected String feedbackTaskState(JSONObject param) {
int phase=param.getInteger("phase");
String result="0";
switch (phase){
case 3:
break;
case 4:
break;
case 6:
break;
case 7:
break;
}
return result;
}
}

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ZJBZKDDTask.java

@ -88,4 +88,21 @@ public class ZJBZKDDTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected String feedbackTaskState(JSONObject param) {
int phase=param.getInteger("phase");
String result="0";
switch (phase){
case 3:
break;
case 4:
break;
case 6:
break;
case 7:
break;
}
return result;
}
}

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java

@ -279,4 +279,21 @@ public class GHSFMTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected String feedbackTaskState(JSONObject param) {
int phase=param.getInteger("phase");
String result="0";
switch (phase){
case 3:
break;
case 4:
break;
case 6:
break;
case 7:
break;
}
return result;
}
}

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java

@ -292,4 +292,21 @@ public class GHSQHTask extends AbstractTask {
public void cancel(String task_code) {
this.updateStatus(task_code, TaskStatus.CANCELED);
}
@Override
protected String feedbackTaskState(JSONObject param) {
int phase=param.getInteger("phase");
String result="0";
switch (phase){
case 3:
break;
case 4:
break;
case 6:
break;
case 7:
break;
}
return result;
}
}

Loading…
Cancel
Save