|
@@ -2,6 +2,7 @@ package com.ruoyi.ams.agv.ndc;
|
|
|
|
|
|
import cn.hutool.core.date.DateUnit;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.thread.ThreadUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.ruoyi.ams.agv.ndc.common.Aci;
|
|
|
import com.ruoyi.ams.agv.ndc.common.ByteUtil;
|
|
@@ -141,31 +142,29 @@ public class AciService {
|
|
|
continue;
|
|
|
}
|
|
|
// try {
|
|
|
- String order = amsHexdefineDetailService.concatOrder(t, basTask);
|
|
|
- log.info("writeOrder:" + order);
|
|
|
- if (t.getBusinessType().equals("m") ||
|
|
|
- t.getBusinessType().equals("01")
|
|
|
- ) {
|
|
|
-
|
|
|
- buffer.put(ByteUtil.hexString2ByteArray(order));
|
|
|
- buffer.flip();
|
|
|
- socketChannel.write(buffer);
|
|
|
- buffer.clear();
|
|
|
- if (DateUtil.between(t.getAddtime(), new Date(), DateUnit.MINUTE) > 2) {
|
|
|
- t.setAciAccept(2);
|
|
|
- t.setRoadway("下发超时2分钟未接收自动取消");
|
|
|
- amsTaskService.updateAmsTask(t);
|
|
|
- }
|
|
|
- } else {
|
|
|
- buffer.put(ByteUtil.hexString2ByteArray(order));
|
|
|
- buffer.flip();
|
|
|
- socketChannel.write(buffer);
|
|
|
- buffer.clear();
|
|
|
- // 修改已发送
|
|
|
- t.setAciAccept(1);
|
|
|
- t.setRoadway("TS请求反馈任务发送成功!");
|
|
|
+ String order = amsHexdefineDetailService.concatOrder(t, basTask);
|
|
|
+ log.info("writeOrder:" + order);
|
|
|
+ if (t.getBusinessType().equals("01")) {
|
|
|
+
|
|
|
+ buffer.put(ByteUtil.hexString2ByteArray(order));
|
|
|
+ buffer.flip();
|
|
|
+ socketChannel.write(buffer);
|
|
|
+ buffer.clear();
|
|
|
+ if (DateUtil.between(t.getAddtime(), new Date(), DateUnit.MINUTE) > 2) {
|
|
|
+ t.setAciAccept(2);
|
|
|
+ t.setRoadway("下发超时2分钟未接收自动取消");
|
|
|
amsTaskService.updateAmsTask(t);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ buffer.put(ByteUtil.hexString2ByteArray(order));
|
|
|
+ buffer.flip();
|
|
|
+ socketChannel.write(buffer);
|
|
|
+ buffer.clear();
|
|
|
+ // 修改已发送
|
|
|
+ t.setAciAccept(1);
|
|
|
+ t.setRoadway("TS请求反馈任务发送成功!");
|
|
|
+ amsTaskService.updateAmsTask(t);
|
|
|
+ }
|
|
|
// } catch (Exception e) {
|
|
|
// e.printStackTrace();
|
|
|
// t.setServerAck(0);
|
|
@@ -220,14 +219,14 @@ public class AciService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
- }catch (IOException i) {
|
|
|
- log.error("NDC通讯异常!" ,i);
|
|
|
+ } catch (IOException i) {
|
|
|
+ log.error("NDC通讯异常!", i);
|
|
|
try {
|
|
|
socketChannel.close();
|
|
|
} catch (Exception exception) {
|
|
|
i.printStackTrace();
|
|
|
}
|
|
|
- }catch (Exception e) {
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
try {
|
|
|
socketChannel.close();
|