Browse Source

NDC接口调整

psh
psh 1 year ago
parent
commit
1427a3689d
  1. 2
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java
  2. 22
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
  3. 8
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  4. 30
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  5. 1
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java
  6. 5
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStatusRequest.java
  7. 18
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/controller/AcsToWmsController.java
  8. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/AcsToWmsService.java
  9. 35
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java

2
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java

@ -29,7 +29,7 @@ public interface NDCAgvService {
*/ */
public void sendAgvInstToNDC(String agv_system_type,Instruction inst) throws Exception; public void sendAgvInstToNDC(String agv_system_type,Instruction inst) throws Exception;
public byte[] sendAgvOneModeInst(int phase, int index,int result); public byte[] sendAgvOneModeInst(int phase, int index,int result,int startPoint,int nextPoint,int startHigh,int nextHigh);
public byte[] sendAgvTwoModeInst(int phase, int index,int result); public byte[] sendAgvTwoModeInst(int phase, int index,int result);

22
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java

@ -125,23 +125,35 @@ public class NDCAgvServiceImpl implements NDCAgvService {
} }
@Override @Override
public byte[] sendAgvOneModeInst(int phase, int index, int result) { public byte[] sendAgvOneModeInst(int phase, int index, int result,int startPoint,int nextPoint,int startHigh,int nextHigh) {
if (phase < 0 || index < 0) if (phase < 0 || index < 0)
return null; return null;
byte indexhigh = (byte) IntToHexHigh(index); byte indexhigh = (byte) IntToHexHigh(index);
byte indexlow = (byte) IntToHexLow(index); byte indexlow = (byte) IntToHexLow(index);
byte phasehigh = (byte) IntToHexHigh(phase); byte phasehigh = (byte) IntToHexHigh(phase);
byte phaselow = (byte) IntToHexLow(phase); byte phaselow = (byte) IntToHexLow(phase);
byte startPointHigh =(byte) IntToHexHigh(startPoint);
byte startPointLow =(byte) IntToHexLow(startPoint);
byte nextPointHigh =(byte) IntToHexHigh(nextPoint);
byte nextPointLow =(byte) IntToHexLow(nextPoint);
byte startHighHigh =(byte) IntToHexHigh(startHigh);
byte startHighLow =(byte) IntToHexLow(startHigh);
byte nextHighHigh =(byte) IntToHexHigh(nextHigh);
byte nextHighLow =(byte) IntToHexLow(nextHigh);
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08, (byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X0A, (byte) 0X00, (byte) 0X12,
(byte) 0X00, (byte) 0X01, (byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X6D, (byte) 0X00, (byte) 0X6D,
(byte) 0X00, (byte) 0X06, (byte) 0X00, (byte) 0X0E,
(byte) indexhigh, (byte) indexlow, (byte) indexhigh, (byte) indexlow,
(byte) 0X01, (byte) 0X12, (byte) 0X01, (byte) 0X14,
(byte) phasehigh, (byte) phaselow (byte) phasehigh, (byte) phaselow,
(byte) startPointHigh, (byte) startPointLow,
(byte) nextPointHigh, (byte) nextPointLow,
(byte) startHighHigh, (byte) startHighLow,
(byte) nextHighHigh, (byte) nextHighLow
}; };

8
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java

@ -158,7 +158,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
inst.setSend_status("1"); inst.setSend_status("1");
instructionService.update(inst); instructionService.update(inst);
} }
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
} }
//任务完毕 //任务完毕
//(无车id及状态) //(无车id及状态)
@ -168,13 +168,13 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} else { } else {
log.warn("指令号:{},未反馈wms任务完成,因为agv上报指令号查询指令为空!"); log.warn("指令号:{},未反馈wms任务完成,因为agv上报指令号查询指令为空!");
} }
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
log.info("指令号:{},已反馈agv任务完成!"); log.info("指令号:{},已反馈agv任务完成!");
} }
//请求删除任务 //请求删除任务
//(需要WCS反馈) //(需要WCS反馈)
else if (phase == 0x30) { else if (phase == 0x30) {
data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0); data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0,0,0,0,0);
} }
//任务删除确认 //任务删除确认
//(需要WCS反馈) //(需要WCS反馈)
@ -185,7 +185,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
instructionService.cancelNOSendAgv(inst.getInstruction_id()); instructionService.cancelNOSendAgv(inst.getInstruction_id());
} }
} }
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
} else { } else {
//上报异常信息 //上报异常信息

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

@ -111,7 +111,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (arr[18] * 256 + arr[19] == 0) { if (arr[18] * 256 + arr[19] == 0) {
} }
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
} }
//普通站点 //普通站点
@ -179,7 +179,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body()); JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) { if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code()); log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code());
} else { } else {
log.warn("指令号:{},acs请求wms取货申请成功,wms不允许agv申请取货,未反馈agv允许取货", inst.getInstruction_code()); log.warn("指令号:{},acs请求wms取货申请成功,wms不允许agv申请取货,未反馈agv允许取货", inst.getInstruction_code());
@ -188,8 +188,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code()); log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code());
} }
} else { } else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
} }
//到达取货等待点
//(需要WCS反馈)
} else if (phase == 0x04) {
//取货完毕 //取货完毕
//(需要WCS反馈) //(需要WCS反馈)
} else if (phase == 0x05) { } else if (phase == 0x05) {
@ -240,7 +243,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body()); JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) { if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
log.info("指令号:{},acs反馈wms取货完成成功,wms允许agv取货完成,已反馈agv取货完成", inst.getInstruction_code()); log.info("指令号:{},acs反馈wms取货完成成功,wms允许agv取货完成,已反馈agv取货完成", inst.getInstruction_code());
} else { } else {
log.warn("指令号:{},acs反馈wms取货完成成功,wms不允许agv取货完成,未反馈agv取货完成", inst.getInstruction_code()); log.warn("指令号:{},acs反馈wms取货完成成功,wms不允许agv取货完成,未反馈agv取货完成", inst.getInstruction_code());
@ -249,8 +252,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code()); log.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code());
} }
} else { } else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
} }
//到达放货等待点
//(需要WCS反馈)
} else if (phase == 0x06) {
//到达放货点 //到达放货点
//(需要WCS反馈) //(需要WCS反馈)
} else if (phase == 0x07) { } else if (phase == 0x07) {
@ -297,7 +303,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body()); JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) { if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code()); log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
} else { } else {
log.warn("指令号:{},acs请求wms放货申请成功,wms不允许agv申请放货,未反馈agv允许放货", inst.getInstruction_code()); log.warn("指令号:{},acs请求wms放货申请成功,wms不允许agv申请放货,未反馈agv允许放货", inst.getInstruction_code());
@ -306,7 +312,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code()); log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
} }
} else { } else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
} }
//放货完毕 //放货完毕
//(需要WCS反馈) //(需要WCS反馈)
@ -353,13 +359,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
req.add(map); req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code()); log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
} else { } else {
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code()); log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
} }
} else { } else {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
} }
} }
//到达位置点 //到达位置点
@ -368,13 +374,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
//1、根据货位id找到对应三工位设备,赋给agv属性地址对应的满料位设备 //1、根据货位id找到对应三工位设备,赋给agv属性地址对应的满料位设备
agvaddr = arr[18] * 256 + arr[19]; agvaddr = arr[18] * 256 + arr[19];
agvaddr_copy = agvaddr; agvaddr_copy = agvaddr;
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
} else if (phase == 0x50) {//进入交通灯区域 } else if (phase == 0x50) {//进入交通灯区域
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
} else if (phase == 0x51) {//离开交通灯区域 } else if (phase == 0x51) {//离开交通灯区域
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
} }
if (!ObjectUtil.isEmpty(data)) { if (!ObjectUtil.isEmpty(data)) {

1
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

@ -442,6 +442,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
this.time = date; this.time = date;
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest(); FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
request.setDevice_code(devicecode); request.setDevice_code(devicecode);
request.setMaterial_type(String.valueOf(material_type));
request.setVehicle_code(String.valueOf(barcode)); request.setVehicle_code(String.valueOf(barcode));
if (devicecode.startsWith("TBX")&&type==5) { if (devicecode.startsWith("TBX")&&type==5) {
//满架下料 //满架下料

5
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStatusRequest.java

@ -41,5 +41,10 @@ public class FeedBackTaskStatusRequest extends BaseRequest {
*/ */
private String action; private String action;
/**
* 1-正极板2-负极板3-边负极板
*/
private String material_type;
} }

18
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/controller/AcsToWmsController.java

@ -56,6 +56,15 @@ public class AcsToWmsController {
return new ResponseEntity<>(acsToWmsService.status(param), HttpStatus.OK); return new ResponseEntity<>(acsToWmsService.status(param), HttpStatus.OK);
} }
@PostMapping("/feedbackState")
@Log("ACS系统反馈AGV取放货状态")
@ApiOperation("ACS系统反馈AGV取放货状态")
//@SaCheckPermission("@el.check('schBaseTask:add')")
@SaIgnore
public ResponseEntity<Object> feedbackState(@RequestBody JSONObject param) {
return new ResponseEntity<>(acsToWmsService.feedbackState(param), HttpStatus.OK);
}
@PostMapping("/notify") @PostMapping("/notify")
@Log("acs通知wms") @Log("acs通知wms")
@ApiOperation("acs通知wms") @ApiOperation("acs通知wms")
@ -64,4 +73,13 @@ public class AcsToWmsController {
public ResponseEntity<Object> notify(@RequestBody JSONObject param) { public ResponseEntity<Object> notify(@RequestBody JSONObject param) {
return new ResponseEntity<>(acsToWmsService.notify(param), HttpStatus.OK); return new ResponseEntity<>(acsToWmsService.notify(param), HttpStatus.OK);
} }
// @PostMapping("/notify")
// @Log("acs通知wms")
// @ApiOperation("acs通知wms")
// //@SaCheckPermission("@el.check('schBaseTask:add')")
// @SaIgnore
// public ResponseEntity<Object> notify(@RequestBody JSONObject param) {
// return new ResponseEntity<>(acsToWmsService.notify(param), HttpStatus.OK);
// }
} }

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

@ -15,7 +15,10 @@ public interface AcsToWmsService {
/** 任务反馈 */ /** 任务反馈 */
BaseResponse status(JSONObject param); BaseResponse status(JSONObject param);
/** 任务反馈 */ /** 任务阶段反馈最新点位 */
BaseResponse feedbackState(JSONObject param);
/** acs通知wms */
BaseResponse notify(JSONObject param); BaseResponse notify(JSONObject param);
} }

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

@ -179,4 +179,39 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return BaseResponse.responseOk(requestNo, "反馈成功!"); return BaseResponse.responseOk(requestNo, "反馈成功!");
} }
/**
* 任务阶段反馈最新点位
* todo
* */
@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");
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);
}
AbstractTask task = taskFactory.getTask(requestMethodCode);
// 执行创建任务
task.apply(param);
} catch (Exception e) {
String message = ObjectUtil.isEmpty(e.getMessage())
? ((InvocationTargetException) e).getTargetException().getMessage()
: e.getMessage();
log.error("ACS请求LMS出现错误: {}", message);
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
result.setMessage(message);
result.setRequestNo(requestNo);
// 消息通知
noticeService.createNotice("异常信息:" + message, "acsApply: " + param.getString("request_medthod_code"),
NoticeTypeEnum.EXCEPTION.getCode());
}
return result;
}
} }

Loading…
Cancel
Save