更新
This commit is contained in:
@@ -117,27 +117,25 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
|
||||
String str = "十进制下发:";
|
||||
String str1 = "十六进制下发:";
|
||||
str += "ikey:" + (Integer.parseInt(instcode));
|
||||
str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
|
||||
str += "任务号 ikey:" + (Integer.parseInt(instcode));
|
||||
str1 += "任务号 ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
|
||||
|
||||
str += "/type:" + (type);
|
||||
str1 += "/type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF);
|
||||
str += "指令类型 /type:" + (type);
|
||||
str1 += "指令类型 /type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF);
|
||||
|
||||
str += "/qhd:" + (startAddress);
|
||||
str1 += "/qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF);
|
||||
str += "/fhd:" + (nextAddress);
|
||||
str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
|
||||
str += "取货点 /qhd:" + (startAddress);
|
||||
str1 += "取货点 /qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF);
|
||||
str += "放货点 /fhd:" + (nextAddress);
|
||||
str1 += "放货点 /fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
|
||||
|
||||
str += "/qhd2:" + (startAddress2);
|
||||
str1 += "/qhd2:" + hexToString(qhdhigh2 & 0xFF) + hexToString(qhdlow2 & 0xFF);
|
||||
str += "/fhd2:" + (nextAddress2);
|
||||
str1 += "/fhd2:" + hexToString(fhdhigh2 & 0xFF) + hexToString(fhdlow2 & 0xFF);
|
||||
str += "取货点2 /qhd2:" + (startAddress2);
|
||||
str1 += "取货点2 /qhd2:" + hexToString(qhdhigh2 & 0xFF) + hexToString(qhdlow2 & 0xFF);
|
||||
str += "放货点2 /fhd2:" + (nextAddress2);
|
||||
str1 += "放货点2 /fhd2:" + hexToString(fhdhigh2 & 0xFF) + hexToString(fhdlow2 & 0xFF);
|
||||
|
||||
str += "/priority:" + (priority);
|
||||
str1 += "/priority:" + hexToString(prioritylow & 0xFF);
|
||||
str += "优先级 /priority:" + (priority);
|
||||
str1 += "优先级 /priority:" + hexToString(prioritylow & 0xFF);
|
||||
|
||||
System.out.println(str);
|
||||
System.out.println(str1);
|
||||
byte[] b = new byte[]{};
|
||||
if (type == 1) {
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
@@ -191,13 +189,15 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
(byte) fhdhigh2, (byte) fhdlow2
|
||||
};
|
||||
}
|
||||
log.info("下发AGV作业指令--{}", str1);
|
||||
log.info("下发AGV作业指令 --{}", str1);
|
||||
log.info("下发AGV作业指令--{}", str);
|
||||
log.info("下发agv指令数据--{}", Bytes2HexString(b));
|
||||
|
||||
if (StrUtil.equals(agv_system_type,"2")){
|
||||
TwoNDCSocketConnectionAutoRun.write(b);
|
||||
} else if (StrUtil.equals(agv_system_type,"3")){
|
||||
TwoNDC2SocketConnectionAutoRun.write(b);
|
||||
}
|
||||
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
|
||||
} else {
|
||||
|
||||
String instcode = inst.getInstruction_code();
|
||||
@@ -251,9 +251,10 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) fhdhigh, (byte) fhdlow
|
||||
};
|
||||
log.info("下发AGV作业指令--{}", str1);
|
||||
log.info("下发AGV作业指令 --{}", str1);
|
||||
log.info("下发AGV作业指令--{}", str);
|
||||
log.info("下发agv指令数据--{}", Bytes2HexString(b));
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,11 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
} else {
|
||||
inst.setInstruction_status("2");
|
||||
instructionService.finish(inst);
|
||||
try {
|
||||
instructionService.finish(inst);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
@@ -184,9 +188,6 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
} else {
|
||||
inst.setInstruction_status("2");
|
||||
instructionService.finish(inst);
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
instructionService.cancelNOSendAgv(inst.getInstruction_id());
|
||||
}
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
@@ -289,7 +290,9 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dos.flush();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
log.error("下发agv数据异常:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
|
||||
int mode = 2;
|
||||
|
||||
@LokiLog(type = LokiLogType.AGV)
|
||||
// @LokiLog(type = LokiLogType.AGV)
|
||||
public synchronized void processSocket(int[] arr) throws Exception {
|
||||
device_code = this.getDeviceCode();
|
||||
byte[] data = null;
|
||||
|
||||
@@ -350,7 +350,6 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
} else {
|
||||
this.instruction_apply_time = date;
|
||||
message = "烘箱完成反馈LMS...";
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "开始烘箱完成反馈lms~");
|
||||
ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = new ApplyLabelingAndBindingRequest();
|
||||
JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0);
|
||||
String start_point_code = null;
|
||||
@@ -360,13 +359,15 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
applyLabelingAndBindingRequest.setDevice_code(start_point_code);
|
||||
applyLabelingAndBindingRequest.setType("3");
|
||||
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "烘拷完成,请求参数:"+JSON.toJSONString(applyLabelingAndBindingRequest));
|
||||
if (applyLabelingAndBindingResponse.getstatus() == 200) {
|
||||
requireSucess = true;
|
||||
message = "烘箱完成反馈LMS成功...";
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "烘箱完成反馈LMS响应消息:" + String.valueOf(applyLabelingAndBindingResponse));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "烘拷完成请求成功,响应参数:"+JSON.toJSONString(applyLabelingAndBindingResponse));
|
||||
} else {
|
||||
requireSucess = true;
|
||||
message = "烘箱完成反馈LMS失败,"+String.valueOf(applyLabelingAndBindingResponse);
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "烘箱完成反馈LMS响应消息:" + String.valueOf(applyLabelingAndBindingResponse));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "烘拷完成请求失败,响应参数:"+JSON.toJSONString(applyLabelingAndBindingResponse));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -732,6 +732,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
applyLabelingAndBindingRequest.setWeight(String.valueOf((float) weight / 100));
|
||||
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse =
|
||||
acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:"+JSON.toJSONString(applyLabelingAndBindingRequest));
|
||||
|
||||
if (applyLabelingAndBindingResponse.getstatus() == 200) {
|
||||
message = "申请贴标成功";
|
||||
@@ -743,9 +744,12 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
this.writing(list);
|
||||
this.writing(list);
|
||||
message = "申请贴标下发电气信号成功";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse));
|
||||
requireSucess = true;
|
||||
} else {
|
||||
message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,8 +394,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
public void writing(int command) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
//String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
//Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, command);
|
||||
this.control(itemMap);
|
||||
@@ -730,8 +728,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
apply.put("vehicle_code", container_code);
|
||||
apply.put("device_code", device_code);
|
||||
apply.put("type","1");
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,请求参数:"+apply.toString());
|
||||
String str = acsToWmsService.applyTaskToWms(apply);
|
||||
JSONObject jo = JSON.parseObject(str);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,返回参数:"+jo.toString());
|
||||
if (ObjectUtil.isEmpty(jo)) {
|
||||
message = "接口不通";
|
||||
List list = new ArrayList();
|
||||
@@ -792,20 +792,13 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
//String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
//Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
|
||||
itemMap.put(to_param, Integer.parseInt(value));
|
||||
// itemMap.put(to_param, Integer.parseInt(value));
|
||||
this.control(itemMap);
|
||||
|
||||
}
|
||||
|
||||
public void writing(List list) {
|
||||
|
||||
// String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
// Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Object ob = list.get(i);
|
||||
|
||||
@@ -781,46 +781,20 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
JSONObject jsonObject = datas.getJSONObject(i);
|
||||
String device_code = jsonObject.getString("device_code");
|
||||
String task_code = jsonObject.getString("task_code");
|
||||
|
||||
TaskDto task= taskService.findByTaskCode(task_code);
|
||||
if(ObjectUtil.isEmpty(task)){
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST);
|
||||
resultJson.put("message", "未找到对应的任务:"+task_code);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
//1-允许取放; 2-允许离开
|
||||
String option = jsonObject.getString("option");
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
|
||||
if(StrUtil.equals(task.getTask_type(),"1")){
|
||||
Device device_k = deviceAppService.findDeviceByCode(device_code+"_K");
|
||||
Device device_m = deviceAppService.findDeviceByCode(device_code+"_M");
|
||||
if(device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
|
||||
}
|
||||
if(device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
|
||||
}
|
||||
} else if (StrUtil.equals(task.getTask_type(),"2")){
|
||||
|
||||
if(task.getStart_device_code().endsWith("K")){
|
||||
Device device_k = deviceAppService.findDeviceByCode(device_code+"_K");
|
||||
if(device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
|
||||
}
|
||||
} else if(task.getStart_device_code().endsWith("M")){
|
||||
Device device_m = deviceAppService.findDeviceByCode(device_code+"_M");
|
||||
if(device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
|
||||
}
|
||||
}
|
||||
Device device_k = deviceAppService.findDeviceByCode(device_code+"_K");
|
||||
Device device_m = deviceAppService.findDeviceByCode(device_code+"_M");
|
||||
if(device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
|
||||
}
|
||||
if(device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
|
||||
@@ -390,6 +390,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
if (!StrUtil.equals(task.getAgv_system_type(), "0")
|
||||
&& ObjectUtil.isNotEmpty(task.getAgv_system_type())) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
log.warn("下发AGV指令数据,"+ "指令号:" + dto.getInstruction_code() + ",AGV系统类型:"+ task.getAgv_system_type());
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
|
||||
} else {
|
||||
// Boolean result = createLkInst(task.getStorage_task_type(),dto);
|
||||
@@ -404,7 +405,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
} catch (Exception e) {
|
||||
dto.setSend_status("2");
|
||||
e.printStackTrace();
|
||||
log.error("");
|
||||
log.warn("创建指令异常:"+e.getMessage());
|
||||
}
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
|
||||
Reference in New Issue
Block a user