From 3d1b61cb6c5bef47b4c560dc4e9058cec259cbef Mon Sep 17 00:00:00 2001
From: gengby <858962040@qq.com>
Date: Wed, 4 Jan 2023 13:55:21 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../service/impl/InstructionServiceImpl.java  | 30 +++++++++++++++----
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
index 97038b3..d5a7c21 100644
--- a/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
+++ b/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
@@ -20,6 +20,7 @@ import org.nl.acs.device_driver.lamp_three_color.LampThreecolorDeviceDriver;
 import org.nl.acs.device_driver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
 import org.nl.acs.device_driver.standard_conveyor_control_with_plcscanner.StandardCoveyorControlWithPlcScannerDeviceDriver;
 import org.nl.acs.device_driver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
+import org.nl.acs.device_driver.standard_conveyor_line.StandardConveyorLineDeviceDriver;
 import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
 import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver;
 import org.nl.acs.device_driver.traffic_light.TrafficLightDeviceDriver;
@@ -298,7 +299,24 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
         Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
         Device nextdevice = appService.findDeviceByCode(dto.getNext_device_code());
         dto.setRemark(startdevice.getBatch());
+        StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver;
+        StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver;
+        if (startdevice.getDeviceDriver() instanceof StandardConveyorLineDeviceDriver) {
+            standardConveyorLineDeviceDriver = (StandardConveyorLineDeviceDriver) startdevice.getDeviceDriver();
+            standardConveyorLineDeviceDriver.writing(1, 1);
+            standardConveyorLineDeviceDriver.writing(3, Integer.parseInt(dto.getInstruction_code()));
+        }
+
+        if (nextdevice.getDeviceDriver() instanceof StandardConveyorLineDeviceDriver) {
+            standardConveyorLineDeviceDriver = (StandardConveyorLineDeviceDriver) nextdevice.getDeviceDriver();
+            standardConveyorLineDeviceDriver.writing(1, 1);
+            standardConveyorLineDeviceDriver.writing(3, Integer.parseInt(dto.getInstruction_code()));
+        }
 
+//        if (startdevice.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) {
+//            standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) startdevice.getDeviceDriver();
+//            //standardCoveyorControlDeviceDriver.writing();
+//        }
 
         try {
             // != 0 为agv任务
@@ -337,7 +355,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
         } catch (Exception e) {
             dto.setSend_status("2");
             log.info("指令号:" + dto.getInstruction_code() + "下发agv失败!");
-            logServer.log(dto.getTask_code(),"create","","","指令号:" + dto.getInstruction_code() + "下发agv失败!","","",dto.getVehicle_code());
+            logServer.log(dto.getTask_code(), "create", "", "", "指令号:" + dto.getInstruction_code() + "下发agv失败!", "", "", dto.getVehicle_code());
             e.printStackTrace();
         }
 
@@ -552,7 +570,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
         } else {
             jo1.put("hasGoodStatus", "2");
         }
-        jo1.put("put_goods_time",DateUtil.now());
+        jo1.put("put_goods_time", DateUtil.now());
         jo1.put("material_type", startdevice.getMaterial_type());
         jo1.put("quantity", startdevice.getQuantity());
         jo1.put("remark", startdevice.getRemark());
@@ -754,7 +772,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
         // != 0 为agv任务 1=magic 2=NDC 3=XZ
         if (!StrUtil.equals(type, "0")) {
             if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "1")
-             && !StrUtil.equals(entity.getSend_status(),"2")) {
+                    && !StrUtil.equals(entity.getSend_status(), "2")) {
                 agvService.deleteAgvInst(entity.getInstruction_code());
                 flag = true;
 
@@ -766,7 +784,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
                     flag = true;
                 }
             } else if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "3")
-                && !StrUtil.equals(entity.getSend_status(),"2")) {
+                    && !StrUtil.equals(entity.getSend_status(), "2")) {
                 agvService.deleteXZAgvInst(entity.getInstruction_code());
                 flag = true;
             } else {
@@ -913,7 +931,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
     }
 
 
-
     @Override
     public Instruction findByInstCodeFromCache(String inst_code) {
         for (int i = 0; i < this.instructions.size(); i++) {
@@ -933,7 +950,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
                 return inst;
             }
         }
-        return null;    }
+        return null;
+    }
 
     @Override
     public Instruction findByIdFromCache(String id) {