HuKang 1 vuosi sitten
vanhempi
commit
010495633a
1 muutettua tiedostoa jossa 23 lisäystä ja 19 poistoa
  1. 23 19
      warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/AciService.java

+ 23 - 19
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/AciService.java

@@ -141,25 +141,29 @@ public class AciService {
                             continue;
                         }
 //                        try {
-                            String order = amsHexdefineDetailService.concatOrder(t, basTask);
-                            log.info("writeOrder:" + order);
-                            if (true) {
-
-                                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();
+                        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);
@@ -176,7 +180,7 @@ public class AciService {
                 //因为设置了异步 这边不会阻塞 测试了一下 服务器断开这边会抛出异常 但是写的时候不会抛出异常 可能是设置了异步的原因
                 int readLenth = socketChannel.read(buffer);
                 if (readLenth == -1) {
-                    throw new IOException();
+//                    throw new IOException();
                 }
                 if (readLenth > 0) {
                     buffer.flip();