From 047663f37ca8d2d06d52803f50b010415ad168cf Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Mon, 22 Jun 2026 10:52:40 +0800 Subject: [PATCH] =?UTF-8?q?rev:=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nladmin-system/doc/acs_storage_cell.xlsx | Bin 0 -> 37316 bytes acs/acs2/nladmin-system/nlsso-server/pom.xml | 5 + .../src/main/java/org/nl/AppRun.java | 63 +- .../src/main/java/org/nl/acs/AcsConfig.java | 4 + .../main/java/org/nl/acs/agv/AgvWaitUtil.java | 28 - .../org/nl/acs/agv/server/NDCAgvService.java | 3 +- .../agv/server/impl/NDCAgvServiceImpl.java | 27 +- .../server/impl/XianGongAgvServiceImpl.java | 111 -- .../auto/run/BMSSocketConnectionAutoRun.java | 845 ++++++++++++++ .../auto/run/NDCSocketConnectionAutoRun.java | 710 ++++++++++++ .../run/OneNDCSocketConnectionAutoRun.java | 287 ----- .../run/TwoNDCSocketConnectionAutoRun.java | 417 ------- .../service/impl/DeviceServiceImpl.java | 74 +- .../agv/ndcone/AgvNdcOneDeviceDriver.java | 380 +------ .../agv/ndctwo/AgvNdcTwoDeviceDriver.java | 1001 ++++++++++++----- .../device_driver/agv/utils/TwoAgvPhase.java | 64 +- .../agv/xg_agv/XgagvDeviceDriver.java | 138 +-- .../agv/xg_agv_car/XgAgvCarDeviceDriver.java | 5 +- .../StandardAutodoorDeviceDriver.java | 29 +- .../BeltConveyorDeviceDriver.java | 90 +- .../StandardInspectSiteDeviceDriver.java | 19 +- .../StandardOrdinarySiteDefination.java | 2 +- .../StandardOrdinarySiteDeviceDriver.java | 5 +- .../StandardManipulatoDeviceDriver.java | 43 +- .../elevator/ElevatorDoorDefination.java | 63 ++ .../elevator/ElevatorDoorDeviceDriver.java | 134 +++ .../zz_driver/elevator/ItemProtocol.java | 66 ++ .../ToElevatorDoorCommandControl.java | 29 + .../ItemProtocol.java | 14 +- ...roductionLineDockingStationDefination.java | 2 +- ...ductionLineDockingStationDeviceDriver.java | 107 +- .../ItemProtocol.java | 22 +- .../RemoveSealCoverPositionDefination.java | 2 +- .../RemoveSealCoverPositionDriver.java | 29 +- .../UnpackingConveyorDeviceDriver.java | 48 +- .../unpacking_machine/ItemProtocol.java | 12 +- .../UnpackingMachineDefination.java | 2 +- .../UnpackingMachineDeviceDriver.java | 48 +- .../main/java/org/nl/acs/ext/wms/AcsUtil.java | 4 +- .../main/java/org/nl/acs/ext/wms/LmsUtil.java | 4 +- .../acs/ext/wms/rest/WmsToAcsController.java | 72 +- .../acs/ext/wms/service/AcsToWmsService.java | 113 -- .../acs/ext/wms/service/WmsToAcsService.java | 90 +- .../wms/service/impl/AcsToWmsServiceImpl.java | 781 +------------ .../wms/service/impl/WmsToAcsServiceImpl.java | 364 +----- .../service/InstructionService.java | 8 + .../service/impl/InstructionServiceImpl.java | 217 ++-- .../nl/acs/opc/DeviceOpcProtocolRunable.java | 42 +- .../java/org/nl/acs/task/domain/Task.java | 3 + .../org/nl/acs/task/service/TaskService.java | 8 + .../task/service/impl/TaskServiceImpl.java | 188 ++-- .../lucene/config/AsyncLuceneAppender.java | 6 +- .../config/lucene/config/LuceneAppender.java | 20 +- .../lucene/enums/DeviceLogTypeEnum.java | 19 + .../config/lucene/rest/LuceneController.java | 42 +- .../config/lucene/service/LuceneService.java | 3 +- .../lucene/service/dto/LuceneLogDto.java | 128 +-- .../impl/LuceneExecuteLogServiceImpl.java | 25 +- .../service/impl/LuceneServiceImpl.java | 166 +-- .../service/quartz/task/AutoCreateInst.java | 170 +-- .../service/quartz/task/AutoCreateInst1.java | 187 +++ .../service/quartz/task/Ndcconnect.java | 4 +- .../src/main/resources/_sql/zzzw_acs.sql | 5 + .../main/resources/config/application-dev.yml | 4 +- .../resources/config/application-prod.yml | 6 +- ...ync_instruction_and_task_group_columns.sql | 8 + .../log/BMSSocketConnectionAutoRun.xml | 21 + .../main/resources/log/NDCAgvServiceImpl.xml | 4 +- ...Run.xml => NDCSocketConnectionAutoRun.xml} | 4 +- .../log/OneNDCSocketConnectionAutoRun.xml | 33 - .../main/resources/log/XgAgvDeviceDriver.xml | 34 - .../resources/log/XianGongAgvServiceImpl.xml | 29 - .../src/main/resources/logback-spring.xml | 7 +- .../src/i18n/langs/instruction/en.js | 6 +- .../src/i18n/langs/instruction/in.js | 6 +- .../src/i18n/langs/instruction/zh.js | 6 +- acs/acs2/nladmin-ui/src/i18n/langs/task/en.js | 3 + acs/acs2/nladmin-ui/src/i18n/langs/task/in.js | 3 + acs/acs2/nladmin-ui/src/i18n/langs/task/zh.js | 6 +- .../src/views/acs/device/config.vue | 10 +- .../acs/device/driver/agv/agv_ndc_two.vue | 114 ++ .../views/acs/device/driver/elevator_door.vue | 413 +++++++ .../production_line_docking_station.vue | 413 +++++++ .../driver/remove_seal_cover_position.vue | 413 +++++++ .../acs/device/driver/unpacking_conveyor.vue | 413 +++++++ .../nladmin-ui/src/views/acs/device/index.vue | 67 ++ .../src/views/acs/device/opc/index.vue | 23 +- .../src/views/acs/instruction/index.vue | 204 +++- .../nladmin-ui/src/views/acs/task/index.vue | 287 +++-- .../src/views/monitor/logQuery/api/lucene.js | 32 + .../src/views/monitor/logQuery/index.vue | 128 ++- .../src/views/monitor/logQuery/search.vue | 159 +-- .../src/views/monitor/logQuery/time.vue | 64 ++ .../src/views/monitor/lucene/api/lucene.js | 23 +- .../src/views/monitor/lucene/index.vue | 59 +- .../src/views/monitor/lucene/search.vue | 157 +-- .../controller/GroupController.java | 218 +++- .../dao/mapper/BsrealStorattrMapper.xml | 10 +- .../mapper/MdPbStoragevehicleextMapper.xml | 5 + .../service/dao/mapper/SectattrMapper.xml | 28 +- .../impl/MdCsCustomerbaseServiceImpl.java | 5 +- .../impl/MdCsSupplierbaseServiceImpl.java | 5 +- .../impl/MdMeMaterialbaseServiceImpl.java | 7 +- .../impl/MdPbMeasureunitServiceImpl.java | 5 +- .../service/impl/StructattrServiceImpl.java | 18 +- .../StSectStrategyController.java | 2 +- .../StStrategyConfigController.java | 2 +- .../impl/base/EmptyVehicleOutHandler.java | 4 + .../service/impl/MesToWmsServiceImpl.java | 2 + .../controller/PdaIosInController.java | 31 +- .../controller/PdaIosOutController.java | 106 +- .../ios_manage/dto/ZwConfirmInDto.java | 1 + .../service/impl/PdaIosInServiceImpl.java | 179 ++- .../service/impl/PdaIosOutServiceImpl.java | 34 + .../controller/PdaJBController.java | 6 + .../controller/PdaSchPointController.java | 7 + .../controller/PdaSchTaskController.java | 15 +- .../sch_manage/service/PdaJBService.java | 2 + .../service/PdaSchPointService.java | 2 + .../sch_manage/service/PdaSchTaskService.java | 4 + .../service/impl/PdaJBServiceImpl.java | 420 ++++--- .../service/impl/PdaSchPointServiceImpl.java | 53 +- .../service/impl/PdaSchTaskServiceImpl.java | 25 + .../controller/PmFormDataController.java | 8 +- .../pm_manage/enums/WorkOrderStatusEnum.java | 6 +- .../service/dao/PmFormMaterialDto.java | 7 +- .../dao/mapper/xml/PmFormDataMapper.xml | 8 +- .../impl/PdmBdWorkorderServiceImpl.java | 14 +- .../service/impl/PmFormDataServiceImpl.java | 75 +- .../nl/wms/sch_manage/enums/StatusEnum.java | 2 +- .../service/ISchBasePointService.java | 3 +- .../dao/mapper/SchBasePointMapper.java | 4 +- .../service/dao/mapper/SchBasePointMapper.xml | 4 +- .../service/dao/mapper/SchBaseTaskMapper.xml | 8 + .../service/impl/SchBasePointServiceImpl.java | 22 +- .../sch_manage/service/util/AbstractTask.java | 52 +- .../sch_manage/service/util/AcsTaskDto.java | 5 + .../sch_manage/service/util/TaskHandle.java | 12 + .../service/util/tasks/BackInManualTask.java | 161 +++ .../service/util/tasks/BackInTask.java | 8 + .../service/util/tasks/MoveTask.java | 1 + .../service/util/tasks/PdaPointTask.java | 1 + .../service/util/tasks/StInTask.java | 1 + .../service/util/tasks/StOutTask.java | 1 + .../util/tasks/VehicleInManualTask.java | 178 +++ .../service/util/tasks/VehicleInTask.java | 12 + .../service/util/tasks/VehicleOutTask.java | 12 + .../service/util/tasks/jb/JbBackAgvTask.java | 51 +- .../util/tasks/jb/JbBackManualTask.java | 138 +++ .../service/util/tasks/jb/JbDownAgvTask.java | 172 ++- ...nAgvTwoTask.java => JbDownManualTask.java} | 139 +-- .../service/util/tasks/jb/JbUpAgvTask.java | 79 +- .../service/util/tasks/jb/JbUpManualTask.java | 215 ++++ .../tasks/zw/DownEmptyUpFullManualTask.java | 363 ++++++ .../util/tasks/zw/DownEmptyUpFullTask.java | 3 +- .../service/util/tasks/zw/InBillTask.java | 222 +++- .../tasks/zw/SeparateMaterialManualTask.java | 346 ++++++ .../util/tasks/zw/SeparateMaterialTask.java | 75 +- .../warehouse_manage/enums/IOSConstant.java | 2 + .../inAndOut/service/IInBillService.java | 16 + .../service/impl/InBillServiceImpl.java | 511 +++++++-- .../service/impl/OutBillServiceImpl.java | 72 +- .../dao/mapper/MdPbGroupplateMapper.xml | 8 +- .../main/resources/config/application-dev.yml | 4 +- lms/nladmin-ui/.env.development | 4 +- .../wms/basedata/bsrealstorattr/index.vue | 58 +- .../src/views/wms/basedata/customer/index.vue | 54 +- .../views/wms/basedata/group/UploadDialog.vue | 125 ++ .../src/views/wms/basedata/group/group.js | 18 +- .../src/views/wms/basedata/group/index.vue | 125 +- .../src/views/wms/basedata/measure/index.vue | 54 +- .../src/views/wms/basedata/sectattr/index.vue | 84 +- .../views/wms/basedata/structattr/index.vue | 6 +- .../src/views/wms/basedata/supp/index.vue | 54 +- .../views/wms/pm_manage/form_data/index.vue | 375 +++--- .../pm_manage/workerorder/MaterialDialog.vue | 5 +- .../pm_manage/workerorder/MaterialDialog2.vue | 5 +- .../pm_manage/workerorder/batchAddDialog.vue | 29 +- .../views/wms/pm_manage/workerorder/index.vue | 78 +- .../src/views/wms/sch/task/index.vue | 20 +- .../src/views/wms/st/movebill/AddDialog.vue | 36 +- .../src/views/wms/st/outbill/DivDialog.vue | 7 +- 182 files changed, 10714 insertions(+), 5396 deletions(-) create mode 100644 acs/acs2/nladmin-system/doc/acs_storage_cell.xlsx create mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/BMSSocketConnectionAutoRun.java create mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/NDCSocketConnectionAutoRun.java delete mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java delete mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java create mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ElevatorDoorDefination.java create mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ElevatorDoorDeviceDriver.java create mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ItemProtocol.java create mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ToElevatorDoorCommandControl.java create mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/enums/DeviceLogTypeEnum.java create mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst1.java create mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/resources/db/migration/V2__sync_instruction_and_task_group_columns.sql create mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/BMSSocketConnectionAutoRun.xml rename acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/{TwoNDCSocketConnectionAutoRun.xml => NDCSocketConnectionAutoRun.xml} (87%) delete mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/OneNDCSocketConnectionAutoRun.xml delete mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/XgAgvDeviceDriver.xml delete mode 100644 acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/XianGongAgvServiceImpl.xml create mode 100644 acs/acs2/nladmin-ui/src/views/acs/device/driver/elevator_door.vue create mode 100644 acs/acs2/nladmin-ui/src/views/acs/device/driver/production_line_docking_station.vue create mode 100644 acs/acs2/nladmin-ui/src/views/acs/device/driver/remove_seal_cover_position.vue create mode 100644 acs/acs2/nladmin-ui/src/views/acs/device/driver/unpacking_conveyor.vue create mode 100644 acs/acs2/nladmin-ui/src/views/monitor/logQuery/api/lucene.js create mode 100644 acs/acs2/nladmin-ui/src/views/monitor/logQuery/time.vue create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/BackInManualTask.java create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/VehicleInManualTask.java create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/jb/JbBackManualTask.java rename lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/jb/{JbDownAgvTwoTask.java => JbDownManualTask.java} (53%) create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/jb/JbUpManualTask.java create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/zw/DownEmptyUpFullManualTask.java create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch_manage/service/util/tasks/zw/SeparateMaterialManualTask.java create mode 100644 lms/nladmin-ui/src/views/wms/basedata/group/UploadDialog.vue diff --git a/acs/acs2/nladmin-system/doc/acs_storage_cell.xlsx b/acs/acs2/nladmin-system/doc/acs_storage_cell.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..e38b70f7c231f66fadab37a8807f0f2ed5fc13df GIT binary patch literal 37316 zcmZ5{WmuKn)-{p>0s;~O5-Q!@pdcU((%sVC9TE?%bR*p*-6bF$n~?5q>Hh9}<8#h= z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EP2q@i9MZ!}f%mjEG%zzj{`=nlH2{W_7dOHKTz8s_C^yc( z20wbdzI_QE0J`=zh6V<;FH7{J$Um z*A)K!a5~_hnV%cR|9<@6SN`{7;UM_q|IeHM?>PT`NPown4gNo$m7F9xI4%^F%iwQ8 LaORdF(69a<org.springframework.boot spring-boot-starter-web + + io.netty + netty-all + 4.1.23.Final + diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java index 12b3b20..5f70a10 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java @@ -6,6 +6,7 @@ import com.alicp.jetcache.anno.config.EnableMethodCache; import lombok.extern.slf4j.Slf4j; import org.dromara.dynamictp.core.spring.EnableDynamicTp; import org.mybatis.spring.annotation.MapperScan; +import org.nl.acs.auto.run.BMSSocketConnectionAutoRun; import org.nl.config.SpringContextHolder; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -15,6 +16,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; /** @@ -27,10 +29,7 @@ import org.springframework.web.bind.annotation.RestController; @EnableAsync @RestController @EnableDynamicTp -@SpringBootApplication(exclude = { - QuartzAutoConfiguration.class, - org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class -}) +@SpringBootApplication(exclude = {QuartzAutoConfiguration.class, org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class}) @ServletComponentScan //https://blog.csdn.net/qq_36850813/article/details/101194250 @EnableTransactionManagement @EnableMethodCache(basePackages = "org.nl") @@ -59,5 +58,61 @@ public class AppRun { public String index() { return "Backend service started successfully"; } + + @GetMapping("/shenchu/{no}") + @SaIgnore + public String start(@PathVariable Integer no) { + BMSSocketConnectionAutoRun.writeArmExtend(no); + return "Backend service started successfully"; + } + + @GetMapping("/tuihui/{no}") + @SaIgnore + public String writeArmRetract(@PathVariable Integer no) { + BMSSocketConnectionAutoRun.writeArmRetract(no); + return "Backend service started successfully"; + } + + @GetMapping("/kaishichongdian/{no}") + @SaIgnore + public String kaishichongdian(@PathVariable Integer no) { + BMSSocketConnectionAutoRun.writeStartCharge(no); + return "Backend service started successfully"; + } + + @GetMapping("/tingzhichongdian/{no}") + @SaIgnore + public String tingzhichongdian(@PathVariable Integer no) { + BMSSocketConnectionAutoRun.writeStopCharge(no); + return "Backend service started successfully"; + } + + @GetMapping("/shenchudaowei/{no}") + @SaIgnore + public String shenchudaowei(@PathVariable Integer no) { + boolean armExtended = BMSSocketConnectionAutoRun.isArmExtended(no); + return String.valueOf(armExtended); + } + + @GetMapping("/tuihuidaowei/{no}") + @SaIgnore + public String tuihuidaowei(@PathVariable Integer no) { + boolean armExtended = BMSSocketConnectionAutoRun.isArmRetracted(no); + return String.valueOf(armExtended); + } + + @GetMapping("/chongdianzhong/{no}") + @SaIgnore + public String chongdianzhong(@PathVariable Integer no) { + boolean armExtended = BMSSocketConnectionAutoRun.isCharging(no); + return String.valueOf(armExtended); + } + + @GetMapping("/stop/{no}") + @SaIgnore + public String stop(@PathVariable Integer no) { + boolean armExtended = BMSSocketConnectionAutoRun.isChargeStopped(no); + return String.valueOf(armExtended); + } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java index 680f15f..7f7df74 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java @@ -37,6 +37,10 @@ public interface AcsConfig { * AGV系统端口 */ String AGVPORT = "agvport"; + /** + * BMS/充电桩站点连接配置(JSON数组) + */ + String BMS_STATIONS = "bmsStations"; /** * 二楼1区agv系统接口地址 */ diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java index aeafc12..704df9b 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java @@ -12,8 +12,6 @@ import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.task.enums.ActionTypeEnum; import org.nl.common.exception.BadRequestException; -import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; @@ -38,8 +36,6 @@ public class AgvWaitUtil { @Autowired private DeviceAppService deviceAppService; - @Autowired - private LuceneExecuteLogService luceneExecuteLogService; @Autowired ISysParamService paramService; @@ -70,28 +66,10 @@ public class AgvWaitUtil { JSONObject param = new JSONObject(); param.put("taskCode", inst.getTask_code()); param.put("actionType", ActionTypeEnum.IN_FINISHING.getCode().toString()); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(inst.getCarno()) - .content("诺宝取货完成请求lms:" + inst.getTask_code() + "--" + ActionTypeEnum.IN_FINISHING.getStatus()) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); String response = acsToWmsService.secondaryAllocationPoint(param); JSONObject jo = JSON.parseObject(response); if (jo.getInteger("status") == 200) { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(inst.getCarno()) - .content("诺宝取货完成请求lms,参数,接口返回:" + jo) - .build(); - logDto2.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto2); } else { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(inst.getCarno()) - .content("请求lms追加动诺宝作块失败,返回参数:" + jo) - .build(); - logDto2.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto2); throw new BadRequestException("追加动诺宝作块返回失败"); } } @@ -100,12 +78,6 @@ public class AgvWaitUtil { public JSONObject waitInPut(String endDeviceCode, Instruction inst) { log.info("仙工AGV请求放货,设备号 - {}", endDeviceCode); Device endDevice = deviceAppService.findDeviceByCode(endDeviceCode); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(inst.getCarno()) - .content("允许放货" + "点位" + endDeviceCode) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); JSONObject map = new JSONObject(); map.put("status", 200); map.put("message", "允许放货!"); diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java index 9821fed..85c5e14 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java @@ -27,11 +27,10 @@ public interface NDCAgvService { /** * 下发任务 - * @param agv_system_type * @param inst * @throws Exception */ - public void sendAgvInstToNDC(String agv_system_type, Instruction inst) throws Exception; + public void sendAgvInstToNDC(Instruction inst) throws Exception; /** * 一号agv指令 diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index 2dbc0db..6135409 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -7,17 +7,17 @@ import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.dto.AgvDto; -import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun; +import org.nl.acs.auto.run.NDCSocketConnectionAutoRun; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.impl.DeviceServiceImpl; import org.nl.acs.instruction.domain.Instruction; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.common.exception.BadRequestException; import org.nl.common.utils.CodeUtil; import org.nl.config.SpringContextHolder; +import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.system.service.dict.ISysDictService; import org.nl.system.service.dict.dao.Dict; import org.nl.system.service.param.ISysParamService; @@ -39,7 +39,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { private final ISysParamService paramService; // private final AcsToWmsService acsToWmsService; private final ISysDictService dictService; - private final DeviceExecuteLogService logServer; + private final LuceneExecuteLogService logServer; Map AGVDeviceStatus = new HashMap(); @@ -70,7 +70,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { log.info("下发删除AGV指令--{}", Bytes2HexString(b)); // NDCSocketConnectionAutoRun.write(b); - TwoNDCSocketConnectionAutoRun.write(b); + NDCSocketConnectionAutoRun.write(b); System.out.println("下发删除agv指令数据:" + Bytes2HexString(b)); } @@ -79,14 +79,11 @@ public class NDCAgvServiceImpl implements NDCAgvService { /** * 组装指令下发到NDC - * @param agv_system_type + * * @param inst */ @Override - public void sendAgvInstToNDC(String agv_system_type, Instruction inst) { - log.info("sendAgvInstToNDC 指令下发NDC:" + "inst_code:" + inst.getInstruction_code() + ",agv_system_type:" + agv_system_type + ",agv_inst_type:" + inst.getAgv_inst_type() + - ",priority:" + inst.getPriority() + ",startAddress:" + inst.getStart_point_code() + - ",nextAddress:" + inst.getNext_point_code()); + public void sendAgvInstToNDC(Instruction inst) { if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { String instcode = inst.getInstruction_code(); int type = Integer.parseInt(inst.getAgv_inst_type()); @@ -159,11 +156,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { log.info("下发AGV作业指令 --{}", str1); log.info("下发AGV作业指令--{}", str); log.info("下发agv指令数据--{}", Bytes2HexString(b)); - - if (StrUtil.equals(agv_system_type, "2")) { -// OneNDCSocketConnectionAutoRun.write(b); - TwoNDCSocketConnectionAutoRun.write(b); - } + NDCSocketConnectionAutoRun.write(b); } } @@ -390,7 +383,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { try { // OneNDCSocketConnectionAutoRun.write(b); - TwoNDCSocketConnectionAutoRun.write(b); + NDCSocketConnectionAutoRun.write(b); } catch (Exception e) { log.error("下发充电任务失败{}{}", e, e.getMessage()); } @@ -440,7 +433,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { try { // OneNDCSocketConnectionAutoRun.write(b); - TwoNDCSocketConnectionAutoRun.write(b); + NDCSocketConnectionAutoRun.write(b); } catch (Exception e) { e.getMessage(); return false; @@ -525,7 +518,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { try { // OneNDCSocketConnectionAutoRun.write(b); - TwoNDCSocketConnectionAutoRun.write(b); + NDCSocketConnectionAutoRun.write(b); temp.setValue("1"); temp.setPara2(String.valueOf(carno)); dictService.updateDetail(temp); diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java index eccdd07..50abf9b 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java @@ -32,8 +32,6 @@ import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.common.exception.BadRequestException; import org.nl.config.language.LangProcess; -import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -61,8 +59,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { @Autowired private TaskService taskserver; - @Autowired - private LuceneExecuteLogService luceneExecuteLogService; @Autowired private DeviceAppService deviceAppservice; @@ -272,12 +268,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { jo.put("blocks", createBlocksData(inst)); //运单优先级 jo.put("priority", inst.getPriority()); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("下发诺宝运单") - .content("任务号:" + inst.getTask_code() + ",指令号:" + inst.getInstruction_code() + ",下发agv订单序列参数:" + jo) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); log.info("任务号:{},指令号{},下发诺宝运单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo); if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { @@ -293,12 +283,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { //超时,毫秒 .timeout(20000) .execute(); - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("诺宝运单响应") - .content("任务号:" + inst.getTask_code() + ",指令号:" + inst.getInstruction_code() + ",下发诺宝订单序列反馈参数:" + jo) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); log.info("任务号:{},指令号{},状态{},下发agv订单序列反馈:{}", inst.getTask_code(), inst.getInstruction_code(), result.getStatus(), result.body()); return result; @@ -741,21 +725,10 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { String inst_code = requestParam.getString("task_code"); Instruction instructionDto = instructionService.findByCodeFromCache(inst_code); if (ObjectUtil.isEmpty(instructionDto)) { - LuceneLogDto logDto = LuceneLogDto.builder() - .content("请求失败,未找到指令!" + inst_code) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); throw new BadRequestException("请求失败,未找到指令!"); } String address = requestParam.getString("address"); if (StrUtil.isBlank(address)) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(instructionDto.getCarno()) - .content("请求失败,地址为空!" ) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); throw new BadRequestException("请求失败,地址为空!"); } if (address.contains("IN") || address.contains("WAIT")) { @@ -767,12 +740,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { deviceCodeNow = address.substring(0, address.length() - 5); } if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(instructionDto.getCarno()) - .content("设备号 " + deviceCodeNow + " 不存在!") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!"); } //一楼诺宝agv @@ -819,12 +786,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { map.put("status", 200); map.put("message", "允许叉车放货!" + "点位" + newPointCode); log.info("允许仙工AGV放货,设备号 - {}", newPointCode); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(instructionDto.getCarno()) - .content("叉车允许放货" + "新点位:" + newPointCode + map ) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); return map; } //放货前等待 @@ -864,21 +825,9 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { private String applyCCAgvTask(String task_code, Instruction instructionDto) { JSONObject param = new JSONObject(); param.put("task_code", task_code); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(instructionDto.getCarno()) - .content("叉车二次分配请求lms,参数:" + task_code) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); String response = acsToWmsService.applySendOutTwo(param); JSONObject jo = JSON.parseObject(response); if (jo.getInteger("status") == 200) { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(instructionDto.getCarno()) - .content("叉车二次分配请求lms,参数,接口返回:" + jo) - .build(); - logDto2.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto2); //二次分配更新点位 updataTask(instructionDto, jo.getString("data")); //请求成功调用叉车追加动作块 @@ -886,12 +835,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { return jo.getString("data"); } else { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(instructionDto.getCarno()) - .content("叉车二次分配请求lms失败,返回参数:" + jo.getString("message")) - .build(); - logDto2.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto2); throw new BadRequestException("叉车二次分配请求lms返回失败"); } } @@ -903,12 +846,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { jo.put("blocks", createBlocksDataTowCCStart(nextPoint)); //追加订单封口 jo.put("complete", true); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(instructionDto.getCarno()) - .content("指令号:" + instructionCode + ",追加叉车运单参数:" + jo) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); log.info("任务号:{},指令号{},追加诺宝叉车运单:{}", instructionCode, instructionCode, jo); if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { @@ -924,12 +861,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { //超时,毫秒 .timeout(20000) .execute(); - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code(instructionDto.getCarno()) - .content("指令号:" + instructionCode + ",下发追加诺宝叉车运单反馈参数:" + result) - .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); log.info("指令号{},状态{},下发追加叉车运单序列反馈:{}", instructionCode, result.getStatus(), result.body()); } @@ -975,23 +906,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { JSONObject param = new JSONObject(); param.put("taskCode", task_code); param.put("actionType", actionType.toString()); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(instructionDto.getCarno()) - .content("二次分配请求lms,参数:" + task_code + "--" + ActionTypeEnum.getStatus(actionType)) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); String response = acsToWmsService.secondaryAllocationPoint(param); JSONObject jo = JSON.parseObject(response); if (jo.getInteger("status") == 200) { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(instructionDto.getCarno()) - .content("二次分配请求lms,参数,接口返回:" + jo) - .build(); - logDto2.setLog_level(4); //二次分配更新点位 updataTask(instructionDto, jo.getString("data")); - luceneExecuteLogService.deviceExecuteLog(logDto2); if (!ActionTypeEnum.IN_FINISHING.getCode().equals(actionType)) { //请求成功调用诺宝追加动作块 sendAddSequencesToNBAgv(instructionDto.getInstruction_code(), jo.getString("data"), instructionDto); @@ -999,12 +918,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { return jo.getString("data"); } else { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(instructionDto.getCarno()) - .content("二次分配请求lms,返回参数:" + jo) - .build(); - logDto2.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto2); throw new BadRequestException("二次分配请求lms返回失败"); } @@ -1045,12 +958,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { jo.put("blocks", createBlocksForklift(inst, interactionJsonDTO)); //运单优先级 jo.put("priority", inst.getPriority()); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("下发叉车运单") - .content("任务号:" + inst.getTask_code() + ",指令号:" + inst.getInstruction_code() + ",下发叉车订单序列参数:" + jo) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); log.info("任务号:{},指令号{},下发agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo); if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { @@ -1066,12 +973,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { //超时,毫秒 .timeout(20000) .execute(); - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("叉车运单响应") - .content("任务号:" + inst.getTask_code() + ",指令号:" + inst.getInstruction_code() + ",下发叉车订单序列反馈参数:" + jo) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); log.info("任务号:{},指令号{},状态{},下发agv叉车订单序列反馈:{}", inst.getTask_code(), inst.getInstruction_code(), result.getStatus(), result.body()); return result; @@ -1102,12 +1003,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } //追加订单封口 jo.put("complete", true); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("追加诺宝运单") - .content("指令号:" + instructionCode + ",追加诺宝运单参数:" + jo) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); log.info("任务号:{},指令号{},追加诺宝运单:{}", instructionCode, point, jo); if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { @@ -1123,12 +1018,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { //超时,毫秒 .timeout(20000) .execute(); - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("追加诺宝运单参数") - .content("指令号:" + instructionCode + ",下发追加诺宝运单反馈参数:" + jo) - .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); log.info("指令号{},状态{},下发追加诺宝运单序列反馈:{}", instructionCode, result.getStatus(), result.body()); } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/BMSSocketConnectionAutoRun.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/BMSSocketConnectionAutoRun.java new file mode 100644 index 0000000..9f1f998 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/BMSSocketConnectionAutoRun.java @@ -0,0 +1,845 @@ +package org.nl.acs.auto.run; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import io.netty.bootstrap.Bootstrap; +import io.netty.buffer.ByteBuf; +import io.netty.channel.Channel; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelFutureListener; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; +import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioSocketChannel; +import io.netty.handler.codec.ByteToMessageDecoder; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.AcsConfig; +import org.nl.config.SpringContextHolder; +import org.nl.system.service.param.ISysParamService; +import org.nl.system.service.param.dao.Param; +import org.nl.system.service.param.impl.SysParamServiceImpl; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.zip.CRC32; + +@Slf4j +@Component +public class BMSSocketConnectionAutoRun extends AbstractAutoRunnable { + + private static final byte[] FRAME_HEAD = new byte[]{ + (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, + (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF + }; + private static final byte[] FRAME_TAIL = new byte[]{ + (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, + (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE + }; + private static final int FRAME_LEN = 26; + private static final int REPORT_FRAME_LEN = 34; + + private static final int CHARGE_CMD_NONE = 0x0000; + private static final int CHARGE_CMD_START = 0x0001; + private static final int CHARGE_CMD_STOP = 0x0002; + + private static final int ARM_CMD_NONE = 0x0000; + private static final int ARM_CMD_RETRACT = 0x0001; + private static final int ARM_CMD_EXTEND = 0x0002; + + private static final int ARM_STATE_UNKNOWN = 0; + private static final int ARM_STATE_RETRACTED = 1; + private static final int ARM_STATE_EXTENDED = 2; + + private static final int CHARGER_STATE_INVALID = 0; + private static final int CHARGER_STATE_CHARGING = 1; + private static final int CHARGER_STATE_STOPPED = 2; + + private static final long RECONNECT_DELAY_MS = 3000L; + private static final long CONFIG_REFRESH_MS = 5000L; + private static final long STATUS_EXPIRE_MS = 3000L; + private static final int CIRCUIT_FAILURE_THRESHOLD = 5; + private static final long CIRCUIT_OPEN_MS = 30000L; + + private static final Map CLIENTS = new ConcurrentHashMap<>(); + private static final AtomicBoolean stopRequested = new AtomicBoolean(false); + private static volatile NioEventLoopGroup workerGroup; + + @Override + public String getCode() { + return BMSSocketConnectionAutoRun.class.getSimpleName(); + } + + @Override + public String getName() { + return "BMS充电桩TCP连接"; + } + + @Override + public void autoRun() { + ISysParamService paramService = SpringContextHolder.getBean(SysParamServiceImpl.class); + stopRequested.set(false); + ensureWorkerGroup(); + + while (!stopRequested.get()) { + try { + refreshStations(loadStationConfigs(paramService)); + } catch (Exception e) { + log.error("刷新BMS站点配置失败", e); + } + + try { + Thread.sleep(CONFIG_REFRESH_MS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + stopRequested.set(true); + } + } + + shutdownClients(); + shutdownWorkerGroup(); + } + + @Override + public void stop() { + stopRequested.set(true); + super.after(); + shutdownClients(); + shutdownWorkerGroup(); + } + + public static void write(byte[] data, int stationNo) { + if (ObjectUtil.isEmpty(data)) { + return; + } + StationClient client = CLIENTS.get(stationNo); + if (client == null) { + log.warn("BMS站点{}未配置连接,忽略下发数据: {}", stationNo, bytesToHex(data)); + return; + } + client.send(data); + } + + public static void writeStartCharge(int stationNo) { + write(buildFixedFrame(CHARGE_CMD_START, ARM_CMD_NONE, stationNo), stationNo); + } + + public static void writeStopCharge(int stationNo) { + write(buildFixedFrame(CHARGE_CMD_STOP, ARM_CMD_NONE, stationNo), stationNo); + } + + public static void writeChargeComplete(int stationNo) { + writeStopCharge(stationNo); + } + + public static void writeArmRetract(int stationNo) { + write(buildFixedFrame(CHARGE_CMD_NONE, ARM_CMD_RETRACT, stationNo), stationNo); + } + + public static void writeArmExtend(int stationNo) { + write(buildFixedFrame(CHARGE_CMD_NONE, ARM_CMD_EXTEND, stationNo), stationNo); + } + + public static void writeNoAction(int stationNo) { + write(buildFixedFrame(CHARGE_CMD_NONE, ARM_CMD_NONE, stationNo), stationNo); + } + + public static boolean isArmExtended(int stationNo) { + return readStatus(stationNo).armState == ARM_STATE_EXTENDED; + } + + public static boolean isArmRetracted(int stationNo) { + return readStatus(stationNo).armState == ARM_STATE_RETRACTED; + } + + public static boolean isCharging(int stationNo) { + return readStatus(stationNo).chargerState == CHARGER_STATE_CHARGING; + } + + public static boolean isChargeStopped(int stationNo) { + return readStatus(stationNo).chargerState == CHARGER_STATE_STOPPED; + } + + public static boolean waitArmExtended(int stationNo, long timeoutMs) throws InterruptedException { + return waitUntil(stationNo, timeoutMs, WaitTarget.ARM_EXTENDED); + } + + public static boolean waitArmRetracted(int stationNo, long timeoutMs) throws InterruptedException { + return waitUntil(stationNo, timeoutMs, WaitTarget.ARM_RETRACTED); + } + + public static boolean waitCharging(int stationNo, long timeoutMs) throws InterruptedException { + return waitUntil(stationNo, timeoutMs, WaitTarget.CHARGING); + } + + public static boolean waitChargeStopped(int stationNo, long timeoutMs) throws InterruptedException { + return waitUntil(stationNo, timeoutMs, WaitTarget.CHARGE_STOPPED); + } + + public static byte[] buildFixedFrame(int chargeCmd, int armCmd, int stationNo) { + if (stationNo < 0 || stationNo > 0xFFFF) { + throw new IllegalArgumentException("stationNo must be in [0, 65535]"); + } + byte[] frame = new byte[FRAME_LEN]; + System.arraycopy(FRAME_HEAD, 0, frame, 0, FRAME_HEAD.length); + + int offset = FRAME_HEAD.length; + writeUInt16BE(frame, offset, chargeCmd); + offset += 2; + writeUInt16BE(frame, offset, armCmd); + offset += 2; + writeUInt16BE(frame, offset, stationNo); + offset += 2; + writeUInt32BE(frame, offset, calculateCrc32(frame, FRAME_HEAD.length, 6)); + offset += 4; + + System.arraycopy(FRAME_TAIL, 0, frame, offset, FRAME_TAIL.length); + return frame; + } + + public static BmsStationStatus getStationStatus(int stationNo) { + return readStatus(stationNo); + } + + public static boolean isConnected(int stationNo) { + StationClient client = CLIENTS.get(stationNo); + return client != null && client.isConnected(); + } + + public static String getCircuitState(int stationNo) { + StationClient client = CLIENTS.get(stationNo); + return client == null ? CircuitState.OPEN.name() : client.getCircuitState().name(); + } + + public static String getLastConnectError(int stationNo) { + StationClient client = CLIENTS.get(stationNo); + return client == null ? "station not configured" : client.getLastConnectError(); + } + + public static long getLastUpdateTimeMs(int stationNo) { + StationClient client = CLIENTS.get(stationNo); + return client == null ? 0L : client.getLastUpdateTimeMs(); + } + + private static void ensureWorkerGroup() { + if (workerGroup == null) { + synchronized (BMSSocketConnectionAutoRun.class) { + if (workerGroup == null) { + workerGroup = new NioEventLoopGroup(); + } + } + } + } + + private static void refreshStations(List configs) { + if (configs.isEmpty()) { + log.warn("BMS参数{}为空或无有效站点配置", AcsConfig.BMS_STATIONS); + for (StationClient client : CLIENTS.values()) { + client.close(); + } + CLIENTS.clear(); + return; + } + + Map latest = new ConcurrentHashMap<>(); + for (StationConfig config : configs) { + latest.put(config.stationNo, config); + CLIENTS.compute(config.stationNo, (stationNo, existing) -> { + if (existing == null) { + StationClient created = new StationClient(config); + created.ensureConnected(); + return created; + } + existing.refreshConfig(config); + return existing; + }); + } + + List toRemove = new ArrayList<>(); + for (Integer stationNo : CLIENTS.keySet()) { + if (!latest.containsKey(stationNo)) { + toRemove.add(stationNo); + } + } + for (Integer stationNo : toRemove) { + StationClient removed = CLIENTS.remove(stationNo); + if (removed != null) { + removed.close(); + } + } + } + + private static List loadStationConfigs(ISysParamService paramService) { + Param param = paramService.findByCode(AcsConfig.BMS_STATIONS); + if (param == null || StrUtil.isBlank(param.getValue())) { + return Collections.emptyList(); + } + + try { + JSONArray array = JSON.parseArray(param.getValue()); + if (array == null || array.isEmpty()) { + return Collections.emptyList(); + } + + List configs = new ArrayList<>(); + for (int i = 0; i < array.size(); i++) { + JSONObject item = array.getJSONObject(i); + if (item == null) { + continue; + } + Integer stationNo = item.getInteger("stationNo"); + String ip = StrUtil.trim(item.getString("ip")); + Integer port = item.getInteger("port"); + if (stationNo == null || stationNo < 0 || stationNo > 0xFFFF) { + log.warn("BMS站点配置无效,stationNo异常: {}", item); + continue; + } + if (StrUtil.isBlank(ip)) { + log.warn("BMS站点{}配置无效,ip为空", stationNo); + continue; + } + if (port == null || port <= 0 || port > 65535) { + log.warn("BMS站点{}配置无效,port异常: {}", stationNo, port); + continue; + } + configs.add(new StationConfig(stationNo, ip, port)); + } + return configs; + } catch (Exception e) { + log.error("解析BMS站点参数{}失败,原始值: {}", AcsConfig.BMS_STATIONS, param.getValue(), e); + return Collections.emptyList(); + } + } + + private static void shutdownClients() { + for (StationClient client : CLIENTS.values()) { + client.close(); + } + CLIENTS.clear(); + } + + private static void shutdownWorkerGroup() { + NioEventLoopGroup group = workerGroup; + workerGroup = null; + if (group != null) { + try { + group.shutdownGracefully().syncUninterruptibly(); + } catch (Exception e) { + log.error("关闭BMS Netty线程组失败", e); + } + } + } + + private static BmsStationStatus readStatus(int stationNo) { + StationClient client = CLIENTS.get(stationNo); + if (client == null) { + return new BmsStationStatus(); + } + return client.snapshotStatus(); + } + + private static boolean waitUntil(int stationNo, long timeoutMs, WaitTarget target) throws InterruptedException { + long end = System.currentTimeMillis() + timeoutMs; + while (System.currentTimeMillis() <= end) { + if (target.match(readStatus(stationNo))) { + return true; + } + Thread.sleep(100); + } + return false; + } + + private static void writeUInt16BE(byte[] target, int offset, int value) { + target[offset] = (byte) ((value >> 8) & 0xFF); + target[offset + 1] = (byte) (value & 0xFF); + } + + private static int readUInt16BE(byte[] source, int offset) { + return ((source[offset] & 0xFF) << 8) | (source[offset + 1] & 0xFF); + } + + private static void writeUInt32BE(byte[] target, int offset, long value) { + target[offset] = (byte) ((value >> 24) & 0xFF); + target[offset + 1] = (byte) ((value >> 16) & 0xFF); + target[offset + 2] = (byte) ((value >> 8) & 0xFF); + target[offset + 3] = (byte) (value & 0xFF); + } + + private static long readUInt32BE(byte[] source, int offset) { + return ((long) (source[offset] & 0xFF) << 24) + | ((long) (source[offset + 1] & 0xFF) << 16) + | ((long) (source[offset + 2] & 0xFF) << 8) + | (long) (source[offset + 3] & 0xFF); + } + + private static long calculateCrc32(byte[] source, int offset, int len) { + CRC32 crc32 = new CRC32(); + crc32.update(source, offset, len); + return crc32.getValue(); + } + + private static boolean validateChecksum(byte[] frame) { + if (frame == null) { + return false; + } + if (frame.length == FRAME_LEN) { + long expected = readUInt32BE(frame, FRAME_HEAD.length + 6); + long actual = calculateCrc32(frame, FRAME_HEAD.length, 6); + return expected == actual; + } + if (frame.length == REPORT_FRAME_LEN) { + long expected = readUInt32BE(frame, FRAME_HEAD.length + 14); + long actual = calculateCrc32(frame, FRAME_HEAD.length, 14); + return expected == actual; + } + return false; + } + + private static String bytesToHex(byte[] bytes) { + StringBuilder sb = new StringBuilder(bytes.length * 2); + for (byte aByte : bytes) { + sb.append(String.format("%02x", aByte)); + } + return sb.toString(); + } + + private interface WaitTarget { + WaitTarget ARM_EXTENDED = s -> s.armState == ARM_STATE_EXTENDED; + WaitTarget ARM_RETRACTED = s -> s.armState == ARM_STATE_RETRACTED; + WaitTarget CHARGING = s -> s.chargerState == CHARGER_STATE_CHARGING; + WaitTarget CHARGE_STOPPED = s -> s.chargerState == CHARGER_STATE_STOPPED; + + boolean match(BmsStationStatus status); + } + + private enum CircuitState { + CLOSED, + OPEN, + HALF_OPEN + } + + private static final class StationConfig { + private final int stationNo; + private final String ip; + private final int port; + + private StationConfig(int stationNo, String ip, int port) { + this.stationNo = stationNo; + this.ip = ip; + this.port = port; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof StationConfig)) { + return false; + } + StationConfig that = (StationConfig) o; + return stationNo == that.stationNo && port == that.port && Objects.equals(ip, that.ip); + } + + @Override + public int hashCode() { + return Objects.hash(stationNo, ip, port); + } + } + + private static final class StationClient { + private final AtomicBoolean reconnectScheduled = new AtomicBoolean(false); + private final AtomicBoolean closed = new AtomicBoolean(false); + private final AtomicBoolean probeInFlight = new AtomicBoolean(false); + private volatile StationConfig config; + private volatile Channel channel; + private volatile BmsStationStatus latestStatus = new BmsStationStatus(); + private volatile CircuitState circuitState = CircuitState.CLOSED; + private volatile int consecutiveFailures = 0; + private volatile long openUntilMs = 0L; + private volatile String lastConnectError = ""; + private volatile long lastConnectSuccessTimeMs = 0L; + private volatile long lastConnectAttemptTimeMs = 0L; + + private StationClient(StationConfig config) { + this.config = config; + } + + private void refreshConfig(StationConfig latestConfig) { + StationConfig oldConfig = this.config; + this.config = latestConfig; + if (!latestConfig.equals(oldConfig)) { + log.info("BMS站点{}连接配置更新 {}:{} -> {}:{}", + latestConfig.stationNo, oldConfig.ip, oldConfig.port, latestConfig.ip, latestConfig.port); + closeChannel(); + ensureConnected(); + } else { + ensureConnected(); + } + } + + private void ensureConnected() { + if (closed.get() || stopRequested.get()) { + return; + } + if (!allowConnectAttempt()) { + return; + } + Channel current = this.channel; + if (current != null && current.isActive()) { + return; + } + if (!reconnectScheduled.compareAndSet(false, true)) { + return; + } + NioEventLoopGroup group = workerGroup; + if (group == null || group.isShutdown() || group.isShuttingDown() || group.isTerminated()) { + reconnectScheduled.set(false); + return; + } + group.schedule(this::doConnect, 0, TimeUnit.MILLISECONDS); + } + + private void doConnect() { + if (closed.get() || stopRequested.get()) { + reconnectScheduled.set(false); + return; + } + try { + lastConnectAttemptTimeMs = System.currentTimeMillis(); + Bootstrap bootstrap = new Bootstrap(); + bootstrap.group(workerGroup) + .channel(NioSocketChannel.class) + .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 5000) + .option(ChannelOption.SO_KEEPALIVE, true) + .option(ChannelOption.TCP_NODELAY, true) + .handler(new ChannelInitializer() { + @Override + protected void initChannel(SocketChannel ch) { + ch.pipeline().addLast(new BmsFrameDecoder()); + ch.pipeline().addLast(new BmsInboundHandler(StationClient.this)); + } + }); + + StationConfig currentConfig = this.config; + ChannelFuture future = bootstrap.connect(currentConfig.ip, currentConfig.port); + future.addListener((ChannelFutureListener) f -> { + reconnectScheduled.set(false); + if (closed.get() || stopRequested.get()) { + if (f.channel().isOpen()) { + f.channel().close(); + } + probeInFlight.set(false); + return; + } + if (f.isSuccess()) { + channel = f.channel(); + onConnectSuccess(); + log.info("BMS站点{}连接成功 {}:{}", currentConfig.stationNo, currentConfig.ip, currentConfig.port); + } else { + onConnectFailure(f.cause()); + } + }); + } catch (Exception e) { + reconnectScheduled.set(false); + onConnectFailure(e); + } + } + + private void scheduleReconnect() { + if (closed.get() || stopRequested.get()) { + return; + } + if (circuitState == CircuitState.OPEN) { + long delay = Math.max(0L, openUntilMs - System.currentTimeMillis()); + if (!reconnectScheduled.compareAndSet(false, true)) { + return; + } + workerGroup.schedule(() -> { + reconnectScheduled.set(false); + ensureConnected(); + }, delay, TimeUnit.MILLISECONDS); + return; + } + NioEventLoopGroup group = workerGroup; + if (group == null || group.isShutdown() || group.isShuttingDown() || group.isTerminated()) { + return; + } + if (!reconnectScheduled.compareAndSet(false, true)) { + return; + } + group.schedule(() -> { + reconnectScheduled.set(false); + ensureConnected(); + }, RECONNECT_DELAY_MS, TimeUnit.MILLISECONDS); + } + + private void send(byte[] data) { + if (closed.get() || stopRequested.get()) { + log.warn("BMS站点{}连接已停止,忽略下发数据: {}", config.stationNo, bytesToHex(data)); + return; + } + if (circuitState == CircuitState.OPEN) { + log.warn("BMS站点{}断路器打开,忽略下发数据: {}", config.stationNo, bytesToHex(data)); + return; + } + Channel current = this.channel; + if (current == null || !current.isActive()) { + log.warn("BMS站点{}连接未建立或已断开,忽略下发数据: {}", config.stationNo, bytesToHex(data)); + ensureConnected(); + return; + } + log.info("下发BMS站点{}数据(HEX): {}", config.stationNo, bytesToHex(data)); + current.writeAndFlush(current.alloc().buffer(data.length).writeBytes(data)).addListener((ChannelFutureListener) future -> { + if (!future.isSuccess()) { + log.error("下发BMS站点{}数据失败: {}", config.stationNo, bytesToHex(data), future.cause()); + Channel failedChannel = future.channel(); + if (failedChannel != null && failedChannel.isOpen()) { + failedChannel.close(); + } + } + }); + } + + private void updateStatus(byte[] frame) { + if (!validateChecksum(frame)) { + log.warn("BMS站点{}收到CRC校验失败报文,忽略: {}", config.stationNo, bytesToHex(frame)); + return; + } + int dataOffset = FRAME_HEAD.length; + int outputVoltage = readUInt16BE(frame, dataOffset); + int outputCurrent = readUInt16BE(frame, dataOffset + 2); + int armState = readUInt16BE(frame, dataOffset + 4); + int chargerState = readUInt16BE(frame, dataOffset + 6); + int reportStationNo = readUInt16BE(frame, dataOffset + 8); + if (reportStationNo != config.stationNo) { + log.warn("BMS站点{}收到站点{}上报,忽略异常报文: {}", config.stationNo, reportStationNo, bytesToHex(frame)); + return; + } + + BmsStationStatus status = new BmsStationStatus(); + status.stationNo = reportStationNo; + status.outputVoltageRaw = outputVoltage; + status.outputCurrentRaw = outputCurrent; + status.armState = armState; + status.chargerState = chargerState; + status.lastUpdateTimeMs = System.currentTimeMillis(); + status.rawFrameHex = bytesToHex(frame); + latestStatus = status; + + log.info("BMS状态更新 stationNo={}, armState={}, chargerState={}, voltageRaw={}, currentRaw={}", + reportStationNo, armState, chargerState, outputVoltage, outputCurrent); + } + + private BmsStationStatus snapshotStatus() { + BmsStationStatus source = latestStatus; + BmsStationStatus copy = new BmsStationStatus(); + copy.stationNo = source.stationNo; + copy.outputVoltageRaw = source.outputVoltageRaw; + copy.outputCurrentRaw = source.outputCurrentRaw; + copy.armState = source.armState; + copy.chargerState = source.chargerState; + copy.lastUpdateTimeMs = source.lastUpdateTimeMs; + copy.rawFrameHex = source.rawFrameHex; + if (copy.lastUpdateTimeMs <= 0 || System.currentTimeMillis() - copy.lastUpdateTimeMs > STATUS_EXPIRE_MS) { + copy.armState = ARM_STATE_UNKNOWN; + copy.chargerState = CHARGER_STATE_INVALID; + } + return copy; + } + + private void handleChannelInactive(Channel inactiveChannel) { + if (channel == inactiveChannel) { + channel = null; + } + scheduleReconnect(); + } + + private void handleException(Channel channel, Throwable cause) { + log.error("BMS站点{}连接异常", config.stationNo, cause); + if (channel != null && channel.isOpen()) { + channel.close(); + } else { + scheduleReconnect(); + } + } + + private void close() { + closed.set(true); + closeChannel(); + } + + private boolean isConnected() { + Channel current = this.channel; + return current != null && current.isActive(); + } + + private CircuitState getCircuitState() { + return circuitState; + } + + private String getLastConnectError() { + return lastConnectError; + } + + private long getLastUpdateTimeMs() { + return latestStatus.lastUpdateTimeMs; + } + + private boolean allowConnectAttempt() { + long now = System.currentTimeMillis(); + if (circuitState == CircuitState.OPEN) { + if (now < openUntilMs) { + return false; + } + circuitState = CircuitState.HALF_OPEN; + log.info("BMS站点{}断路器进入HALF_OPEN,开始试探连接", config.stationNo); + } + if (circuitState == CircuitState.HALF_OPEN) { + return probeInFlight.compareAndSet(false, true); + } + return true; + } + + private void onConnectSuccess() { + consecutiveFailures = 0; + openUntilMs = 0L; + lastConnectError = ""; + lastConnectSuccessTimeMs = System.currentTimeMillis(); + circuitState = CircuitState.CLOSED; + probeInFlight.set(false); + } + + private void onConnectFailure(Throwable cause) { + reconnectScheduled.set(false); + probeInFlight.set(false); + lastConnectError = cause == null ? "unknown error" : cause.getClass().getSimpleName() + ": " + String.valueOf(cause.getMessage()); + consecutiveFailures++; + if (circuitState == CircuitState.HALF_OPEN || consecutiveFailures >= CIRCUIT_FAILURE_THRESHOLD) { + circuitState = CircuitState.OPEN; + openUntilMs = System.currentTimeMillis() + CIRCUIT_OPEN_MS; + log.warn("BMS站点{}断路器打开,连续失败{}次,{}ms后再试,原因: {}", + config.stationNo, consecutiveFailures, CIRCUIT_OPEN_MS, lastConnectError); + } else { + log.warn("BMS站点{}连接失败,第{}次重试前失败,原因: {}", + config.stationNo, consecutiveFailures, lastConnectError, cause); + } + scheduleReconnect(); + } + + private void closeChannel() { + Channel current = this.channel; + this.channel = null; + if (current != null) { + try { + current.close().syncUninterruptibly(); + } catch (Exception e) { + log.error("关闭BMS站点{}连接失败", config.stationNo, e); + } + } + } + } + + private static final class BmsFrameDecoder extends ByteToMessageDecoder { + @Override + protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) { + while (true) { + int frameStart = findFrameStart(in); + if (frameStart < 0) { + if (in.readableBytes() > FRAME_HEAD.length) { + in.skipBytes(in.readableBytes() - FRAME_HEAD.length + 1); + } + return; + } + if (frameStart > 0) { + in.skipBytes(frameStart); + } + if (in.readableBytes() < REPORT_FRAME_LEN) { + return; + } + if (!hasTail(in, in.readerIndex())) { + in.skipBytes(1); + continue; + } + byte[] frame = new byte[REPORT_FRAME_LEN]; + in.readBytes(frame); + out.add(frame); + } + } + + private int findFrameStart(ByteBuf in) { + int start = in.readerIndex(); + int end = in.writerIndex() - FRAME_HEAD.length; + for (int i = start; i <= end; i++) { + boolean match = true; + for (int j = 0; j < FRAME_HEAD.length; j++) { + if (in.getByte(i + j) != FRAME_HEAD[j]) { + match = false; + break; + } + } + if (match) { + return i - start; + } + } + return -1; + } + + private boolean hasTail(ByteBuf in, int frameStartIndex) { + int tailStart = frameStartIndex + REPORT_FRAME_LEN - FRAME_TAIL.length; + for (int i = 0; i < FRAME_TAIL.length; i++) { + if (in.getByte(tailStart + i) != FRAME_TAIL[i]) { + return false; + } + } + return true; + } + } + + private static final class BmsInboundHandler extends SimpleChannelInboundHandler { + private final StationClient client; + + private BmsInboundHandler(StationClient client) { + this.client = client; + } + + @Override + protected void channelRead0(ChannelHandlerContext ctx, byte[] frame) { + client.updateStatus(frame); + } + + @Override + public void channelInactive(ChannelHandlerContext ctx) throws Exception { + client.handleChannelInactive(ctx.channel()); + super.channelInactive(ctx); + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { + client.handleException(ctx.channel(), cause); + } + } + + public static class BmsStationStatus { + public int stationNo; + public int outputVoltageRaw; + public int outputCurrentRaw; + public int armState = ARM_STATE_UNKNOWN; + public int chargerState = CHARGER_STATE_INVALID; + public long lastUpdateTimeMs; + public String rawFrameHex; + } +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/NDCSocketConnectionAutoRun.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/NDCSocketConnectionAutoRun.java new file mode 100644 index 0000000..58eb797 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/NDCSocketConnectionAutoRun.java @@ -0,0 +1,710 @@ +package org.nl.acs.auto.run; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.AcsConfig; +import org.nl.acs.agv.server.NDCAgvService; +import org.nl.acs.device.domain.Device; +import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device_driver.agv.ndcone.AgvNdcOneDeviceDriver; +import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver; +import org.nl.acs.device_driver.zz_driver.elevator.ElevatorDoorDeviceDriver; +import org.nl.acs.instruction.domain.Instruction; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.impl.InstructionServiceImpl; +import org.nl.acs.opc.DeviceAppService; +import org.nl.config.MapOf; +import org.nl.config.SpringContextHolder; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; +import org.nl.system.service.param.ISysParamService; +import org.nl.system.service.param.impl.SysParamServiceImpl; +import org.springframework.stereotype.Component; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; + + +@Slf4j +@Component +public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { + + static volatile Socket socket; + String ip = "192.168.46.225"; + int port = 1234; + static volatile DataOutputStream dos; + static volatile DataInputStream dis; + static volatile boolean stopRequested = false; + static volatile boolean connected = false; + + private static final Map ADDR_STATION = MapOf.of(201, 1, 202, 2); + + /** + * 电梯外面的防火门装置,1号电梯门有 + */ + private List containsFireOpen = Arrays.asList("ELEVATOR1_DOOR1", "ELEVATOR1_DOOR2"); + + @Override + public String getCode() { + return NDCSocketConnectionAutoRun.class.getSimpleName(); + } + + @Override + public String getName() { + return "株洲中钨AGV系统"; + } + + @Override + public void autoRun() throws IOException { + ISysParamService paramService = SpringContextHolder.getBean(SysParamServiceImpl.class); + InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); + NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); + DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); + DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); + LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); + + stopRequested = false; + while (!stopRequested) { + try { + log.info("AGV系统链接开始"); + ip = paramService.findByCode(AcsConfig.AGVURL).getValue(); + port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue()); + InetSocketAddress socketAddress = new InetSocketAddress(ip, port); + + byte[] b = new byte[1024]; + socket = new Socket(); + socket.connect(socketAddress, 5 * 1000); + socket.setKeepAlive(true);//长链接 + socket.setSoTimeout(0);//读取超时时间 + dos = new DataOutputStream(socket.getOutputStream()); + dis = new DataInputStream(socket.getInputStream()); + connected = true; + log.info("AGV系统链接成功 {}:{}", ip, port); + + while (!stopRequested && ObjectUtil.isNotEmpty(socket) && socket.isConnected() && !socket.isClosed()) { + int count = dis.read(b); + if (count == -1) { + log.error("agv连接出现异常:服务端被关闭"); + break; + } + + int[] arr = new int[count]; + StringBuilder bs = new StringBuilder(); + + for (int i = 0; i < count; i++) { + int temp = b[i]; + if (temp < 0) { + temp += 256; + } + arr[i] = temp; + bs.append(temp < 16 ? "0" : "").append(Integer.toHexString(temp)); + } + if (arr.length < 10) { + log.info("接收agv上报信息:" + bs); + } else { + if (arr[8] * 256 + arr[9] == 0x73) { + byte[] data = null; + //执行阶段 + int phase = arr[16] * 256 + arr[17]; + // agv任务号 + int index = arr[12] * 256 + arr[13]; + //任务号 + int ikey = arr[26] * 256 + arr[27]; + //站点号 + int agvaddr = arr[18] * 256 + arr[19]; + //车号 + int carno = arr[20]; + Instruction inst = null; + if (ikey != 0) { + inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); + } + log.info("接收agv上报信息:" + bs); + log.info("接收agv上报信息:" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); + Device device = null; + String device_code = null; + String old_device_code = null; + if (agvaddr != 0) { + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, "-")) { + String[] point = old_device_code.split("-"); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, ".")) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + } else { + device_code = old_device_code; + } + device = deviceAppService.findDeviceByCode(device_code); + } + + AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver; + //开始任务 + if (phase == 0x01) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x01") + .request_direction("AGV->ACS") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .content("phase=0x01;ikey=" + ikey + ",index=" + index) + .build()); + + if (!ObjectUtil.isEmpty(inst)) { + inst.setInstruction_status("1"); + inst.setAgv_jobno(String.valueOf(index)); + inst.setSend_status("1"); + instructionService.update(inst); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x01") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) + .content("已反馈AGVphase=0x01;ikey=" + ikey + ",index=" + index) + .build()); + } + } + //任务完毕 + //(无车id及状态) + else if (phase == 0x14) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x14") + .request_direction("AGV->ACS") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .content("phase=0x14;ikey=" + ikey + ",index=" + index) + .build()); + if (ObjectUtil.isEmpty(inst)) { + log.info("未找到指令号{}对应的指令", ikey); + } else { + String agvcar = inst.getCarno(); + Device agvDevice = deviceAppService.findDeviceByCode(agvcar); + if (agvDevice != null) { + if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { + agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver(); + agvNdcTwoDeviceDriver.setInstruction(null); + } + } + inst.setInstruction_status("2"); + try { + instructionService.finish(inst); + } catch (Exception e) { + log.error("完成指令失败", e); + } + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x14") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) + .content("已反馈AGVphase=0x14;ikey=" + ikey + ",index=" + index) + .build()); + } + //请求删除任务 + //(需要WCS反馈) + else if (phase == 0x30) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x30") + .request_direction("AGV->ACS") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .content("phase=0x30;ikey=" + ikey + ",index=" + index) + .build()); + data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x30") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) + .content("已反馈AGVphase=0x30;ikey=" + ikey + ",index=" + index) + .build()); + } + //任务删除确认 + //(需要WCS反馈) + else if (phase == 0xFF) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0xFF") + .request_direction("AGV->ACS") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .content("phase=0xFF;ikey=" + ikey + ",index=" + index) + .build()); + if (ObjectUtil.isEmpty(inst)) { + log.info("未找到指令号{}对应的指令", ikey); + } else { + instructionService.cancelNOSendAgv(inst.getInstruction_id()); + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0xFF") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) + .content("已反馈AGVphase=0xFF;ikey=" + ikey + ",index=" + index) + .build()); + } + //任务删除结束 + else if (phase == 0x0F) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x0F") + .request_direction("AGV->ACS") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .content("phase=0x0F;ikey=" + ikey + ",index=" + index) + .build()); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x0F") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) + .content("已反馈AGVphase=0x0F;ikey=" + ikey + ",index=" + index) + .build()); + } // 开门 + else if (phase == 0x50) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x50") + .request_direction("AGV->ACS") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .content("phase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + if (ObjectUtil.isEmpty(device_code)) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x50") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: agvaddr=" + agvaddr + " 对应设备号为空") + .content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + log.info(agvaddr + "对应设备号为空!"); + return; + } + if (ObjectUtil.isNotEmpty(device) && device.getDeviceDriver() instanceof ElevatorDoorDeviceDriver) { + ElevatorDoorDeviceDriver elevatorDoorDeviceDriver = (ElevatorDoorDeviceDriver) device.getDeviceDriver(); + try { + elevatorDoorDeviceDriver.writing("call", "1"); + } catch (Exception e) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x50") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: 下发开门信号异常: " + e.getMessage()) + .content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + log.info("下发电气信号失败:" + e.getMessage()); + log.error("下发呼叫电梯信号失败", e); + } + if (containsFireOpen.contains(device.getDevice_code())) { + if (elevatorDoorDeviceDriver.getOpen() == 1 && elevatorDoorDeviceDriver.getCall() == 1 && elevatorDoorDeviceDriver.getFire_open() == 1) { + log.info("下发开门信号值为:{},读取开门信号值为:{}", elevatorDoorDeviceDriver.getCall(), elevatorDoorDeviceDriver.getOpen()); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x50") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) + .content("已反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + } else { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x50") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: 未满足反馈条件, call=" + elevatorDoorDeviceDriver.getCall() + ", open=" + elevatorDoorDeviceDriver.getOpen() + ", fire_open=" + elevatorDoorDeviceDriver.getFire_open()) + .content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{},读取防火门状态:{}", elevatorDoorDeviceDriver.getCall(), elevatorDoorDeviceDriver.getOpen(), elevatorDoorDeviceDriver.getFire_open()); + } + } else { + if (elevatorDoorDeviceDriver.getOpen() == 1 && elevatorDoorDeviceDriver.getCall() == 1) { + log.info("下发开门信号值为:{},读取开门信号值为:{}", elevatorDoorDeviceDriver.getCall(), elevatorDoorDeviceDriver.getOpen()); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x50") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) + .content("已反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + } else { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x50") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: 未满足反馈条件, call=" + elevatorDoorDeviceDriver.getCall() + ", open=" + elevatorDoorDeviceDriver.getOpen()) + .content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{}", elevatorDoorDeviceDriver.getCall(), elevatorDoorDeviceDriver.getOpen()); + } + } + } else { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x50") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: device_code=" + device_code + " 不是电梯门设备") + .content("未反馈AGVphase=0x50;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + log.info(agvaddr + "对应设备号为空!"); + } + } + // 关门 + else if (phase == 0x51) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x51") + .request_direction("AGV->ACS") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .content("phase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + if (ObjectUtil.isEmpty(device_code)) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x51") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: agvaddr=" + agvaddr + " 对应设备号为空") + .content("未反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + log.info(agvaddr + "对应设备号为空!"); + return; + } + if (ObjectUtil.isNotEmpty(device) && device.getDeviceDriver() instanceof ElevatorDoorDeviceDriver) { + ElevatorDoorDeviceDriver elevatorDoorDeviceDriver = (ElevatorDoorDeviceDriver) device.getDeviceDriver(); + try { + elevatorDoorDeviceDriver.writing("call", "0"); + } catch (Exception e) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x51") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: 下发关门信号异常: " + e.getMessage()) + .content("未反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + log.info("下发电气信号失败:" + e.getMessage()); + log.error("下发关门信号失败", e); + } + if (elevatorDoorDeviceDriver.getOpen() == 0 && elevatorDoorDeviceDriver.getCall() == 0) { + log.info("读取关门信号值为:{}", elevatorDoorDeviceDriver.getOpen()); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x51") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) + .content("已反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + } else { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x51") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: 未满足反馈条件, call=" + elevatorDoorDeviceDriver.getCall() + ", open=" + elevatorDoorDeviceDriver.getOpen()) + .content("未反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + log.info("未下发NDC信号原因: 读取自动门信号值为:{}", elevatorDoorDeviceDriver.getOpen()); + } + } else { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x51") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: device_code=" + device_code + " 不是电梯门设备") + .content("未反馈AGVphase=0x51;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + log.info(device_code + "对应设备号为空!"); + } + } //请求充电,需要充电桩伸出到位 + else if (phase == 0x64) { + //ikey是充电桩的站点号 + //carno是车号 + //ADDR_STATION 是AGV站点号对应的充电桩桩号 + Integer stationNo = ADDR_STATION.get(ikey); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x64") + .request_direction("AGV->ACS") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .content("phase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) + .build()); + if (ObjectUtil.isEmpty(stationNo)) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x64") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: ikey=" + ikey + " 未映射到充电桩stationNo") + .content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) + .build()); + continue; + } + boolean armExtended = false; + try { + armExtended = BMSSocketConnectionAutoRun.isArmExtended(stationNo); + } catch (Exception e) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x64") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: 查询充电臂状态异常: " + e.getMessage()) + .content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) + .build()); + continue; + } + if (armExtended) { + try { + BMSSocketConnectionAutoRun.writeStartCharge(stationNo); + }catch (Exception e){ + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x64") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: 下发开始充电异常: " + e.getMessage()) + .content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) + .build()); + continue; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x64") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) + .content("已反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) + .build()); + } else { + try { + BMSSocketConnectionAutoRun.writeArmExtend(stationNo); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x64") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: 充电臂未伸出,已下发伸臂命令") + .content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) + .build()); + } catch (Exception e) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x64") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: 下发伸臂命令异常: " + e.getMessage()) + .content("未反馈AGVphase=0x64;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) + .build()); + continue; + } + } + } + //请求离开,需要充电桩缩回到位 + else if (phase == 0x66) { + //ikey是充电桩的站点号 + //carno是车号 + //ADDR_STATION 是AGV站点号对应的充电桩桩号 + Integer stationNo = ADDR_STATION.get(ikey); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x66") + .request_direction("AGV->ACS") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .content("phase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) + .build()); + if (ObjectUtil.isEmpty(stationNo)) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x66") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: ikey=" + ikey + " 未映射到充电桩stationNo") + .content("未反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) + .build()); + continue; + } + boolean armRetracted = BMSSocketConnectionAutoRun.isArmRetracted(stationNo); + if (armRetracted) { + try { + BMSSocketConnectionAutoRun.writeStopCharge(stationNo); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x66") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) + .content("已反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) + .build()); + } catch (Exception e) { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x66") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: 停止充电或反馈异常: " + e.getMessage()) + .content("未反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) + .build()); + } + } else { + BMSSocketConnectionAutoRun.writeStopCharge(stationNo); + BMSSocketConnectionAutoRun.writeArmRetract(stationNo); + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x66") + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: 充电臂未缩回到位,下发退回") + .content("未反馈AGVphase=0x66;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",stationNo=" + stationNo) + .build()); + } + } + else { + if (phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) { + device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19])); + } else { + device = deviceAppService.findDeviceByCode(Integer.toString(arr[20])); + } + try { + if (ObjectUtil.isNotEmpty(device)) { + if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { + agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver(); + agvNdcTwoDeviceDriver.processSocket(arr); + } + } else { + luceneExecuteLogService.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x" + Integer.toHexString(phase).toUpperCase()) + .request_direction("ACS->AGV") + .method("NDCSocketConnectionAutoRun.autoRun") + .request_param(bs.toString().toUpperCase()) + .response_param("原因: 当前phase=" + phase + " 未找到对应设备") + .content("未反馈AGVphase=0x" + Integer.toHexString(phase).toUpperCase() + ";ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code) + .build()); + log.info("当前phase:" + phase + "未找到对应设备"); + } + } catch (Exception e) { + log.info("processSocket出错:{},{}", e, e.getMessage()); + log.error("processSocket出错", e); + } + } + if (!ObjectUtil.isEmpty(data)) { + write(data); + } + } else { + log.debug("agv上报不是0073类型动作,不处理"); + } + } + } + } catch (Exception e) { + log.info("TwoAgv链接异常"); + log.error("agv连接出现异常:{}", e); + } finally { + closeResources(); + } + + if (!stopRequested) { + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + stopRequested = true; + } + } + } + } + + + @Override + public void stop() { + stopRequested = true; + super.after(); + closeResources(); + } + + + private void closeResources() { + try { + connected = false; + if (dis != null) { + dis.close(); + } + if (dos != null) { + dos.close(); + } + if (socket != null && !socket.isClosed()) { + socket.close(); + } + } catch (IOException e) { + log.error("关闭资源时发生错误: {}", e.getMessage(), e); + } finally { + dis = null; + dos = null; + socket = null; + } + } + + + public static void write(byte[] b) { + if (ObjectUtil.isEmpty(b)) { + return; + } + if (stopRequested) { + log.warn("AGV连接已停止,忽略下发数据: {}", Bytes2HexString(b)); + return; + } + if (!connected || ObjectUtil.isEmpty(socket) || socket.isClosed() || !socket.isConnected() || ObjectUtil.isEmpty(dos)) { + log.warn("AGV连接未建立或已断开,忽略下发数据: {}", Bytes2HexString(b)); + return; + } + try { + log.info("下发agv数据:" + Bytes2HexString(b)); + dos.write(b); + dos.flush(); + } catch (Exception e) { + connected = false; + try { + if (socket != null && !socket.isClosed()) { + socket.close(); + } + } catch (IOException e1) { + log.error("关闭异常socket失败", e1); + } finally { + socket = null; + dos = null; + dis = null; + } + try { + Thread.sleep(1000); + } catch (InterruptedException e1) { + Thread.currentThread().interrupt(); + } + log.error("下发agv数据失败,连接已标记断开: {}", Bytes2HexString(b), e); + } + } +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java deleted file mode 100644 index 6d5962e..0000000 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java +++ /dev/null @@ -1,287 +0,0 @@ -//package org.nl.acs.auto.run; -// -//import cn.hutool.core.util.ObjectUtil; -//import lombok.extern.slf4j.Slf4j; -//import org.nl.acs.AcsConfig; -//import org.nl.acs.agv.server.NDCAgvService; -//import org.nl.acs.common.base.CommonFinalParam; -//import org.nl.acs.device.domain.Device; -//import org.nl.acs.device.service.DeviceService; -//import org.nl.acs.device_driver.agv.ndcone.AgvNdcOneDeviceDriver; -//import org.nl.acs.ext.wms.service.AcsToWmsService; -//import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; -//import org.nl.acs.instruction.domain.Instruction; -//import org.nl.acs.instruction.enums.InstructionStatusEnum; -//import org.nl.acs.instruction.service.InstructionService; -//import org.nl.acs.instruction.service.impl.InstructionServiceImpl; -//import org.nl.acs.log.service.DeviceExecuteLogService; -//import org.nl.acs.opc.DeviceAppService; -//import org.nl.config.SpringContextHolder; -//import org.nl.config.lucene.service.LuceneExecuteLogService; -//import org.nl.system.service.dict.ISysDictService; -//import org.nl.system.service.dict.dao.Dict; -//import org.nl.system.service.param.ISysParamService; -//import org.nl.system.service.param.impl.SysParamServiceImpl; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.stereotype.Component; -// -//import java.io.DataInputStream; -//import java.io.DataOutputStream; -//import java.io.IOException; -//import java.net.InetSocketAddress; -//import java.net.Socket; -//import java.util.Date; -//import java.util.List; -// -//import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; -// -///** -// * Demo class -// * -// * @author zhoujj -// * @date 2023/12/06 -// */ -//@Slf4j -//@Component -//public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { -// -// Socket socket; -// String ip = "192.168.46.225"; -// int port = 1234; -// static DataOutputStream dos; -// static DataInputStream dis; -// private int recordTimeOut = 10000; -// private Date recordTime; -// String[] ERROR = new String[]{ -// "货叉尖部传感器触发", "S300传感器触发", "载货状态改变", "急停按钮触发", "触边开关出发", "需要复位", -// "停在充电位", "取货失败", "放货失败", "轮子打滑", "没有动作码不能进入站点", "取货时有货", "丢失定位", -// "抬叉停止"}; -// boolean bConnected = true; -// -// boolean isReConnect = false; -// -// @Autowired -// ISysParamService paramService; -// @Autowired -// AutoRunService autoRunService; -// @Autowired -// LuceneExecuteLogService luceneExecuteLogService; -// @Autowired -// ISysDictService dictService; -// -// -// public OneNDCSocketConnectionAutoRun() { -// this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut); -// } -// -// @Override -// public String getCode() { -// return OneNDCSocketConnectionAutoRun.class.getSimpleName(); -// } -// -// @Override -// public String getName() { -// return "NDC在线连接"; -// } -// -// @Override -// public void autoRun() throws IOException { -// System.out.println("NDCAgv链接开始"); -// ISysParamService ISysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class); -// InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); -// AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); -// NDCAgvService NDCAgvService = SpringContextHolder.getBean(NDCAgvService.class); -// DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); -// DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); -// DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); -// ip = paramService.findByCode(AcsConfig.AGVURL2).getValue(); -// port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT2).getValue()); -// InetSocketAddress socketAddress = new InetSocketAddress(ip, port); -// -// try { -// byte[] b = new byte[1024]; -// socket = new Socket(ip, port); -// socket.connect(socketAddress, 5 * 1000); -// socket.setKeepAlive(true);//长链接 -// socket.setSoTimeout(30000);//读取超时时间 -// dos = new DataOutputStream(socket.getOutputStream()); -// dis = new DataInputStream(socket.getInputStream()); -// System.out.println("NDCAgv链接成功"); -// log.info("NDCAgv链接成功"); -// while (bConnected) { -// int count = dis.read(b); -// -// if (count == -1) { -// break; -// } -// -// int[] arr = new int[count]; -// StringBuffer bs = new StringBuffer(); -// -// for (int i = 0; i < count; i++) { -// int temp = b[i]; -// if (temp < 0) { -// temp += 256; -// } -// arr[i] = temp; -// StringBuffer bs1 = new StringBuffer("0"); -// bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp)); -// } -// -// boolean flag = false; -// if (arr[8] * 256 + arr[9] == 0x73) { -// byte[] data = null; -// System.out.println("接收agv上报信息:" + bs); -// //执行阶段 -// int phase = arr[16] * 256 + arr[17]; -// // agv任务号 -// int index = arr[12] * 256 + arr[13]; -// /** -// * 任务号 -// */ -// int ikey = arr[26] * 256 + arr[27]; -// //站点号 -// int agvaddr = arr[18] * 256 + arr[19]; -// //车号 -// int carno = arr[20]; -// //充电桩站点号 -// int station = arr[25]; -// Instruction link_inst = null; -// Instruction inst = null; -// List insts = null; -// boolean link_flag = false; -// Device agv_device = null; -// if (carno != 0) { -// agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno)); -// } -// if (ikey != 0) { -// inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); -// if (ObjectUtil.isEmpty(inst)) { -// inst = instructionService.findByCode(String.valueOf(ikey)); -// } -// } -// if (!ObjectUtil.isEmpty(link_inst)) { -// link_flag = true; -// } -// log.info("接收agv上报信息:" + bs); -// log.info("接收agv上报信息:" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); -// Device device = null; -// String device_code = null; -// -// -// // -// AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; -// -// //开始任务/上报订单号 -// if (phase == 0x01) { -// if (!ObjectUtil.isEmpty(inst)) { -// inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); -// inst.setAgv_jobno(String.valueOf(index)); -// inst.setSend_status(CommonFinalParam.ONE); -// instructionService.update(inst); -// } -// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); -// } -// //任务完毕 -// //(无车id及状态) -// else if (phase == 0x14) { -// if (!ObjectUtil.isEmpty(inst)) { -// instructionService.finish(inst.getInstruction_id()); -// } else { -// log.warn("指令号:{},未反馈wms任务完成,因为agv上报指令号查询指令为空!"); -// } -// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); -// log.info("指令号:{},已反馈agv任务完成!"); -// } -// //请求删除任务 -// //(需要WCS反馈) -// else if (phase == 0x30) { -// data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0, 0, 0, 0, 0); -// } -// //任务删除确认 -// //(需要WCS反馈) -// else if (phase == 0xFF) { -// -// if (!ObjectUtil.isEmpty(inst)) { -// if (!ObjectUtil.isEmpty(inst)) { -// instructionService.cancelNOSendAgv(inst.getInstruction_id()); -// } -// } -// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); -// -// } else { -// //上报异常信息 -// //(不需要WCS反馈) -// if (phase == 0x67) { -// device = deviceAppService.findDeviceByCode(Integer.toString(arr[27])); -// } else { -// device = deviceAppService.findDeviceByCode(Integer.toString(arr[20])); -// } -// if (ObjectUtil.isNotEmpty(device)) { -// if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { -// agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver(); -// agvNdcOneDeviceDriver.processSocket(arr); -// } -// } -// -// } -// if (!ObjectUtil.isEmpty(data)) { -// write(data); -// } -// -// } else { -// System.out.println("agv上报不是0073类型动作,不处理"); -// } -// } -// -// } catch (Exception e) { -// System.out.println("Agv链接异常"); -// log.info("Agv链接异常"); -// log.error("agv连接出现异常:{}", e); -// if (ObjectUtil.isNotEmpty(socket)) { -// socket.close(); -// } -// System.out.println(e.getMessage()); -// e.printStackTrace(); -// -// } finally { -// -// -// } -// -// } -// -// -// @Override -// public void stop() { -// super.after(); -// try { -// socket.close(); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } -// -// -// public static void write(byte[] b) { -// try { -// log.info("下发agv数据:" + Bytes2HexString(b)); -// System.out.println("下发agv数据:" + Bytes2HexString(b)); -// dos.write(b); -// dos.flush(); -// } catch (IOException e) { -// // TODO Auto-generated catch block -// try { -// Thread.sleep(5000L); -// log.info("再次下发agv数据:" + Bytes2HexString(b)); -// System.out.println("再次下发agv数据:" + Bytes2HexString(b)); -// dos.write(b); -// dos.flush(); -// } catch (Exception e1) { -// e1.printStackTrace(); -// } -// -// } -// } -//} -// diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java deleted file mode 100644 index 396d8f0..0000000 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java +++ /dev/null @@ -1,417 +0,0 @@ -package org.nl.acs.auto.run; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.AcsConfig; -import org.nl.acs.agv.server.NDCAgvService; -import org.nl.acs.device.domain.Device; -import org.nl.acs.device.service.DeviceService; -import org.nl.acs.device_driver.agv.ndcone.AgvNdcOneDeviceDriver; -import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver; -import org.nl.acs.device_driver.autodoor.standard_autodoor.StandardAutodoorDeviceDriver; -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; -import org.nl.acs.instruction.domain.Instruction; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.impl.InstructionServiceImpl; -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.DeviceAppService; -import org.nl.config.SpringContextHolder; -import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; -import org.nl.system.service.dict.ISysDictService; -import org.nl.system.service.dict.dao.Dict; -import org.nl.system.service.param.ISysParamService; -import org.nl.system.service.param.impl.SysParamServiceImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.Map; - -import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; - - -@Slf4j -@Component -public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { - - Socket socket; - String ip = "192.168.46.225"; - int port = 1234; - static DataOutputStream dos; - static DataInputStream dis; - private int recordTimeOut = 10000; - private Date recordTime; - String[] ERROR = new String[]{ - "货叉尖部传感器触发", "S300传感器触发", "载货状态改变", "急停按钮触发", "触边开关出发", "需要复位", - "停在充电位", "取货失败", "放货失败", "轮子打滑", "没有动作码不能进入站点", "取货时有货", "丢失定位", - "抬叉停止"}; - boolean bConnected = true; - - boolean isReConnect = false; - int i = 1; - boolean requireSucessRegion = false; - boolean requireSucessTake = false; - boolean requireSucessPut = false; - - - @Autowired - ISysParamService paramService; - @Autowired - AutoRunService autoRunService; - @Autowired - LuceneExecuteLogService luceneExecuteLogService; - @Autowired - ISysDictService dictService; - - public TwoNDCSocketConnectionAutoRun() { - this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut); - } - - @Override - public String getCode() { - return TwoNDCSocketConnectionAutoRun.class.getSimpleName(); - } - - @Override - public String getName() { - return "2楼1区域AGV系统"; - } - - @Override - public void autoRun() throws IOException { - ISysParamService paramService = SpringContextHolder.getBean(SysParamServiceImpl.class); - InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); - AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); - DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); - DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - - try { - log.info("2楼1区域AGV系统链接开始"); - ip = paramService.findByCode(AcsConfig.AGVURL).getValue(); - port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue()); - InetSocketAddress socketAddress = new InetSocketAddress(ip, port); - - byte[] b = new byte[1024]; - socket = new Socket(); - socket.connect(socketAddress, 5 * 1000); - socket.setKeepAlive(true);//长链接 - socket.setSoTimeout(30000);//读取超时时间 - dos = new DataOutputStream(socket.getOutputStream()); - dis = new DataInputStream(socket.getInputStream()); - - while (socket.isConnected()) { - System.out.println("当前socket状态:"+socket.isConnected()); - int count = dis.read(b); -// System.out.println("当前count值:"+count); - if (count == -1) { - log.error("agv连接出现异常:服务端被关闭"); - if (ObjectUtil.isNotEmpty(socket)) { - socket.close(); - } - break; - } - - int[] arr = new int[count]; - StringBuffer bs = new StringBuffer(); - - for (int i = 0; i < count; i++) { - int temp = b[i]; - if (temp < 0) - temp += 256; - arr[i] = temp; - StringBuffer bs1 = new StringBuffer("0"); - bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp)); - } - - System.out.println("收到请求参数:" + bs); - - boolean flag = false; - if (arr.length < 10) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("ndc") - .content("接收agv上报信息:" + bs) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - log.info("接收agv上报信息:" + bs); - } else { - if (arr[8] * 256 + arr[9] == 0x73) { - byte[] data = null; - System.out.println("接收agv上报信息:" + bs); - //执行阶段 - int phase = arr[16] * 256 + arr[17]; - // agv任务号 - int index = arr[12] * 256 + arr[13]; - //任务号 - int ikey = arr[26] * 256 + arr[27]; - //站点号 - int agvaddr = arr[18] * 256 + arr[19]; - //车号 - int carno = arr[20]; - //充电桩站点号 - int station = arr[25]; - Instruction inst = null; - if (ikey != 0) { - inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); - } - log.info("接收agv上报信息:" + bs); - log.info("接收agv上报信息:" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); - Device device = null; - String device_code = null; - String old_device_code = null; - String emptyNum = null; - //自动门 - StandardAutodoorDeviceDriver standardAutodoorDeviceDriver; - if (agvaddr != 0) { - old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); - if (StrUtil.contains(old_device_code, "-")) { - String[] point = old_device_code.split("-"); - device_code = point[0]; - } else if (StrUtil.contains(old_device_code, ".")) { - String[] point = old_device_code.split("\\."); - device_code = point[0]; - emptyNum = point[1]; - } else { - device_code = old_device_code; - } - device = deviceAppService.findDeviceByCode(device_code); - } - - AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver; - AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; - //开始任务 - if (phase == 0x01) { - if (!ObjectUtil.isEmpty(inst)) { - inst.setInstruction_status("1"); - inst.setAgv_jobno(String.valueOf(index)); - inst.setSend_status("1"); - instructionService.update(inst); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - } - flag = true; - } - //任务完毕 - //(无车id及状态) - else if (phase == 0x14) { - if (ObjectUtil.isEmpty(inst)) { - log.info("未找到指令号{}对应的指令", ikey); - } else { - String agvcar = inst.getCarno(); - Device agvDevice = deviceAppService.findDeviceByCode(agvcar); - if (agvDevice != null) { - if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { - agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver(); - agvNdcTwoDeviceDriver.setInstruction(null); - } else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { - agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver(); - agvNdcOneDeviceDriver.setInstruction(null); - } - } - inst.setInstruction_status("2"); - try { - instructionService.finish(inst); - } catch (Exception e) { - e.printStackTrace(); - } - } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - } - //请求删除任务 - //(需要WCS反馈) - else if (phase == 0x30) { -// data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0); - data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0, 0, 0); - } - //任务删除确认 - //(需要WCS反馈) - else if (phase == 0xFF) { - if (ObjectUtil.isEmpty(inst)) { - log.info("未找到指令号{}对应的指令", ikey); - } else { - instructionService.cancelNOSendAgv(inst.getInstruction_id()); - } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } - // 开门 - else if (phase == 0x50) { - if (ObjectUtil.isEmpty(device_code)) { - log.info(agvaddr + "对应设备号为空!"); - return; - } - if (ObjectUtil.isNotEmpty(device)) { - if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { - standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); - try { - standardAutodoorDeviceDriver.writing("to_open", "1"); - standardAutodoorDeviceDriver.writing("to_close", "0"); - } catch (Exception e) { - log.info("下发电气信号失败:" + e.getMessage()); - e.printStackTrace(); - } - if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getToOpen() == 1) { - log.info("下发开门信号值为:{},读取开门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getOpen()); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose()); - } - } - } else { - log.info(agvaddr + "对应设备号为空!"); - } - - } - // 关门 - else if (phase == 0x51) { - if (ObjectUtil.isEmpty(device_code)) { - log.info(agvaddr + "对应设备号为空!"); - return; - } - if (ObjectUtil.isNotEmpty(device)) { - if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { - standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); - try { - standardAutodoorDeviceDriver.writing("to_close", "1"); - standardAutodoorDeviceDriver.writing("to_open", "0"); - } catch (Exception e) { - log.info("下发电气信号失败:" + e.getMessage()); - e.printStackTrace(); - } - if (standardAutodoorDeviceDriver.getClose() == 1) { - log.info("读取关门信号值为:{}", standardAutodoorDeviceDriver.getClose()); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - log.info("未下发NDC信号原因: 读取自动门信号值为:{}", standardAutodoorDeviceDriver.getClose()); - } - } - } else { - log.info(device_code + "对应设备号为空!"); - } - } - // todo: ?? - else if (phase == 0x64){ - log.info("AGV车号{}反馈充电任务下发成功,锁定充电桩{}",agvaddr,station); - Dict dict = dictService.getDictByName3("station",String.valueOf(agvaddr),null); - if (ObjectUtil.isNotEmpty(dict)){ - dict.setValue("1"); - dict.setPara2(String.valueOf(agvaddr)); - dict.setPara3("下发成功"); - dictService.updateDetail(dict); - } - //充电成功 - } - // todo: ?? - else if (phase == 0x65){ - log.info("AGV车号{}反馈充电中,充电桩{}",agvaddr,station); - //充电取消上报 - } - // todo: ?? - else if (phase == 0x66){ - log.info("AGV车号{}反馈充电任务已取消,释放充电桩{}",agvaddr,station); - Dict dict = dictService.getDictByName3("station",String.valueOf(agvaddr),null); - if (ObjectUtil.isNotEmpty(dict)){ - dict.setValue("0"); - dict.setPara2(""); - dict.setPara3("充电桩空闲"); - dictService.updateDetail(dict); - } - } - else { - //上报异常信息 - //(不需要WCS反馈) - if (phase == 0x67 || phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) { - device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19])); - } else { - device = deviceAppService.findDeviceByCode(Integer.toString(arr[20])); - } - try { - if (ObjectUtil.isNotEmpty(device)) { - if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { - agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver(); - agvNdcTwoDeviceDriver.processSocket(arr); - } else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { - agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver(); - agvNdcOneDeviceDriver.processSocket(arr); - } - } else { - log.info("当前phase:" + phase + "未找到对应设备"); - } - } catch (Exception e) { - log.info("processSocket出错:{},{}", e, e.getMessage()); - e.printStackTrace(); - } - } - if (!ObjectUtil.isEmpty(data)) { - write(data); - } - } else { - System.out.println("agv上报不是0073类型动作,不处理"); - } - } - } - } catch (Exception e) { - System.out.println("TwoAgv链接异常"); - log.info("TwoAgv链接异常"); - log.error("agv连接出现异常:{}", e); - logServer.deviceExecuteLog("NDC2", "", "", "agv异常" + e.getMessage()); - logServer.deviceExecuteLog("NDC2", "", "", "agv异常" + e); - if (ObjectUtil.isNotEmpty(socket)) { - socket.close(); - } - System.out.println(e.getMessage()); - } finally { - closeResources(); - } - - } - - - @Override - public void stop() { - super.after(); - closeResources(); - } - - - private void closeResources() { - try { - if (dis != null) dis.close(); - if (dos != null) dos.close(); - if (socket != null && !socket.isClosed()) socket.close(); - } catch (IOException e) { - log.error("关闭资源时发生错误: {}", e.getMessage(), e); - } - } - - - public static void write(byte[] b) { - try { - log.info("下发agv数据:" + Bytes2HexString(b)); - System.out.println("下发agv数据:" + Bytes2HexString(b)); - dos.write(b); - dos.flush(); - } catch (Exception e) { - // TODO Auto-generated catch block - try { - Thread.sleep(1000); - log.info("再次下发agv数据:" + Bytes2HexString(b)); - System.out.println("再次下发agv数据:" + Bytes2HexString(b)); - dos.write(b); - dos.flush(); - } catch (Exception e1) { - e1.printStackTrace(); - } - - } - } -} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index 9fc61f9..1ca2a55 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -1828,7 +1828,6 @@ public class DeviceServiceImpl extends CommonServiceImpl i if (file.isEmpty()) { throw new BadRequestException(LangProcess.msg("error_nullPoint")); } - Long currentUserId = Long.valueOf(SecurityUtils.getCurrentUserId()); String nickName = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); // 1.获取上传文件输入流 @@ -1842,33 +1841,26 @@ public class DeviceServiceImpl extends CommonServiceImpl i // 调用用 hutool 方法读取数据 默认调用第一个sheet ExcelReader excelReader = ExcelUtil.getReader(inputStream); + List headerRow = excelReader.readRow(0); + Map headerIndexMap = buildHeaderIndexMap(headerRow); // 从第二行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列 List> read = excelReader.read(1, excelReader.getRowCount()); // 循环获取的数据 for (int i = 0; i < read.size(); i++) { List list = read.get(i); JSONObject param = new JSONObject(); - String device_code = list.get(0).toString(); - String device_name = list.get(1).toString(); - String device_type = list.get(2).toString(); - String is_config = list.get(3).toString(); - String is_route = list.get(4).toString(); - String region = list.get(5).toString(); - String in_device_name = null; - String en_device_name = null; - String zh_device_name = null; - if(list.size() > 6 && ObjectUtil.isNotEmpty(list.get(6))){ - in_device_name = list.get(6).toString(); - } - if(list.size() > 7 && ObjectUtil.isNotEmpty(list.get(7))){ - en_device_name = list.get(7).toString(); - } - if(list.size() > 8 && ObjectUtil.isNotEmpty(list.get(8))){ - zh_device_name = list.get(8).toString(); - } + String device_code = readCell(list, headerIndexMap, "设备编码"); + String device_name = readCell(list, headerIndexMap, "设备名称"); + String in_device_name = readCell(list, headerIndexMap, "印尼设备名称"); + String en_device_name = readCell(list, headerIndexMap, "英文设备名称"); + String zh_device_name = readCell(list, headerIndexMap, "中文设备名称"); + String device_type = readCell(list, headerIndexMap, "设备类型"); + String region = readCell(list, headerIndexMap, "区域"); + String is_config = normalizeBooleanValue(readCell(list, headerIndexMap, "是否配置")); + String is_route = normalizeBooleanValue(readCell(list, headerIndexMap, "是否为路由设备")); if (StrUtil.isEmpty(device_code)) { - throw new BadRequestException(LangProcess.msg("error_checkNull", "device_code")); + continue; } if (StrUtil.isEmpty(device_name)) { device_name = device_code; @@ -1877,7 +1869,7 @@ public class DeviceServiceImpl extends CommonServiceImpl i device_type = "conveyor"; } if (StrUtil.isEmpty(is_config)) { - is_config = "FALSE"; + is_config = "false"; } if (StrUtil.isEmpty(is_route)) { is_route = "false"; @@ -1916,6 +1908,46 @@ public class DeviceServiceImpl extends CommonServiceImpl i } } + private Map buildHeaderIndexMap(List headerRow) { + Map headerIndexMap = new HashMap<>(); + if (CollectionUtils.isEmpty(headerRow)) { + return headerIndexMap; + } + for (int i = 0; i < headerRow.size(); i++) { + if (ObjectUtil.isEmpty(headerRow.get(i))) { + continue; + } + headerIndexMap.put(StrUtil.trim(headerRow.get(i).toString()), i); + } + return headerIndexMap; + } + + private String readCell(List row, Map headerIndexMap, String headerName) { + Integer index = headerIndexMap.get(headerName); + if (index == null || index >= row.size()) { + return null; + } + Object value = row.get(index); + if (ObjectUtil.isEmpty(value)) { + return null; + } + return StrUtil.trim(value.toString()); + } + + private String normalizeBooleanValue(String value) { + if (StrUtil.isBlank(value)) { + return null; + } + String normalized = StrUtil.trim(value).toLowerCase(Locale.ROOT); + if ("1".equals(normalized) || "true".equals(normalized) || "yes".equals(normalized) || "y".equals(normalized) || "是".equals(normalized)) { + return "true"; + } + if ("0".equals(normalized) || "false".equals(normalized) || "no".equals(normalized) || "n".equals(normalized) || "否".equals(normalized)) { + return "false"; + } + throw new BadRequestException("Excel列值无效: " + value + ",请在“是否配置/是否为路由设备”列中填写 true/false、1/0、是/否"); + } + public Map getValue1(JSONArray wss, int j, Integer dbInterval, int i) { int size = wss.size(); Map map = new ListOrderedMap<>(); diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndcone/AgvNdcOneDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndcone/AgvNdcOneDeviceDriver.java index 441a992..731160e 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndcone/AgvNdcOneDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.agv.server.NDCAgvService; -import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun; +import org.nl.acs.auto.run.NDCSocketConnectionAutoRun; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; import org.nl.acs.device.service.DeviceService; @@ -26,12 +26,9 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.impl.InstructionServiceImpl; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.DeviceAppService; import org.nl.config.SpringContextHolder; -import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import java.util.HashMap; @@ -50,12 +47,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); // DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); - LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); - OneAgvPhase oneAgvPhase = new OneAgvPhase(); int agvaddr = 0; @@ -170,18 +164,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic //(不需要WCS反馈) if (phase == 0x02) { inst.setCarno(String.valueOf(carno)); - instructionService.update(inst); - logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈车号:" + carno + ",指令号:" + ikey); - - //到达取货点 + instructionService.update(inst);//到达取货点 //(需要WCS反馈) } else if (phase == 0x03) { if (agvaddr == 0) { agvaddr = agvaddr_copy; } - if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); - return; + if (agvaddr < 1) {return; } CommonFinalParam commonFinalParam = new CommonFinalParam(); device_code = deviceService.queryDeviceCodeByAddress(agvaddr); @@ -201,15 +190,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic device = deviceAppService.findDeviceByCode(device_code); if (ObjectUtil.isEmpty(device_code)) { - log.info(agvaddr + "对应设备号为空!"); - logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空"); - return; + log.info(agvaddr + "对应设备号为空!");return; } //校验agv上报站点编号与指令起始点相同 if (ObjectUtil.isEmpty(inst)) { - log.info("未找到编号{}对应的指令", ikey); - logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); - return; + log.info("未找到编号{}对应的指令", ikey);return; } if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { @@ -233,23 +218,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (unpackingMachineDeviceDriver.getAction() == 1 && unpackingMachineDeviceDriver.getMode() > 0 && unpackingMachineDeviceDriver.getMove() == 1) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",模式信号:" + unpackingMachineDeviceDriver.getMode() + ",动作信号:" + unpackingMachineDeviceDriver.getAction() + ",光电信号:" + unpackingMachineDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -267,23 +240,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (unpackingConveyorDeviceDriver.getAction() == 1 && unpackingConveyorDeviceDriver.getMode() > 0 && unpackingConveyorDeviceDriver.getMove() > 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",模式信号:" + unpackingConveyorDeviceDriver.getMode() + ",动作信号:" + unpackingConveyorDeviceDriver.getAction() + ",光电信号:" + unpackingConveyorDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -300,20 +261,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } if (productionLineDockingStationDeviceDriver.getAction() == 1 && productionLineDockingStationDeviceDriver.getMove() == 1) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + productionLineDockingStationDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -330,20 +279,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic //到达取货点1 if (removeSealCoverPositionDriver.getAction() == 3 && "1".equals(instruction.getHave_lid()) && removeSealCoverPositionDriver.getMode() > 0 ) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + removeSealCoverPositionDriver.getAction() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -355,9 +292,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (agvaddr == 0) { agvaddr = agvaddr_copy; } - if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); - return; + if (agvaddr < 1) {return; } if (agvaddr != 0) { old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); @@ -376,15 +311,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic device = deviceAppService.findDeviceByCode(device_code); if (ObjectUtil.isEmpty(device_code)) { - log.info(agvaddr + "对应设备号为空!"); - logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code); - return; + log.info(agvaddr + "对应设备号为空!");return; } //校验agv上报站点编号与指令起始点相同 if (ObjectUtil.isEmpty(inst)) { - log.info("未找到关联编号{}对应的指令", ikey); - logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); - return; + log.info("未找到关联编号{}对应的指令", ikey);return; } if (StrUtil.equals(inst.getStart_device_code(), device_code)) { @@ -405,12 +336,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { unpackingMachineDeviceDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -424,12 +349,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { unpackingConveyorDeviceDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -443,12 +362,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { productionLineDockingStationDeviceDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -462,30 +375,20 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic // 取货完毕 removeSealCoverPositionDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } } } - if (ObjectUtil.isNotEmpty(data)) { - logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); - } + if (ObjectUtil.isNotEmpty(data)) {} //到达放货点 //(需要WCS反馈) } else if (phase == 0x08) { if (agvaddr == 0) { agvaddr = agvaddr_copy; } - if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); - return; + if (agvaddr < 1) {return; } if (agvaddr != 0) { old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); @@ -531,23 +434,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (unpackingMachineDeviceDriver.getAction() == 1 && unpackingMachineDeviceDriver.getMode() > 0 && unpackingMachineDeviceDriver.getMove() == 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",模式信号:" + unpackingMachineDeviceDriver.getMode() + ",动作信号:" + unpackingMachineDeviceDriver.getAction() + ",光电信号:" + unpackingMachineDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -563,20 +454,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } if (unpackingConveyorDeviceDriver.getAction() == 1) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + unpackingConveyorDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -592,20 +471,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } if (productionLineDockingStationDeviceDriver.getAction() == 2 && productionLineDockingStationDeviceDriver.getMove()==0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + productionLineDockingStationDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -621,20 +488,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic // } if (removeSealCoverPositionDriver.getAction() == 1 && "1".equals(instruction.getHave_lid()) && removeSealCoverPositionDriver.getMode() > 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + removeSealCoverPositionDriver.getAction() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -645,9 +500,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (agvaddr == 0) { agvaddr = agvaddr_copy; } - if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); - return; + if (agvaddr < 1) {return; } if (agvaddr != 0) { old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); @@ -689,12 +542,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { unpackingMachineDeviceDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -708,12 +555,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { unpackingConveyorDeviceDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -727,13 +568,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { productionLineDockingStationDeviceDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - //回传MES放货完毕 逻辑:acs-> lms -> mes String task_code = inst.getTask_code(); JSONObject jsonObject = new JSONObject(); @@ -757,12 +591,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { removeSealCoverPositionDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -775,9 +603,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (agvaddr == 0) { agvaddr = agvaddr_copy; } - if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); - return; + if (agvaddr < 1) {return; } CommonFinalParam commonFinalParam = new CommonFinalParam(); device_code = deviceService.queryDeviceCodeByAddress(agvaddr); @@ -797,15 +623,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic device = deviceAppService.findDeviceByCode(device_code); if (ObjectUtil.isEmpty(device_code)) { - log.info(agvaddr + "对应设备号为空!"); - logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空"); - return; + log.info(agvaddr + "对应设备号为空!");return; } //校验agv上报站点编号与指令起始点相同 if (ObjectUtil.isEmpty(inst)) { - log.info("未找到编号{}对应的指令", ikey); - logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); - return; + log.info("未找到编号{}对应的指令", ikey);return; } if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) { @@ -821,23 +643,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (unpackingMachineDeviceDriver.getAction() == 1 && unpackingMachineDeviceDriver.getMode() > 0 && unpackingMachineDeviceDriver.getMove() > 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",模式信号:" + unpackingMachineDeviceDriver.getMode() + ",动作信号:" + unpackingMachineDeviceDriver.getAction() + ",光电信号:" + unpackingMachineDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -853,20 +663,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } if (unpackingConveyorDeviceDriver.getAction() == 1) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + unpackingConveyorDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -882,20 +680,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } if (productionLineDockingStationDeviceDriver.getAction() == 1 && productionLineDockingStationDeviceDriver.getMove() == 1) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + productionLineDockingStationDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -913,20 +699,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); if (removeSealCoverPositionDriver.getAction() == 4 && "2".equals(instruction.getHave_lid()) && removeSealCoverPositionDriver.getMode() > 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + removeSealCoverPositionDriver.getAction() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -936,9 +710,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (agvaddr == 0) { agvaddr = agvaddr_copy; } - if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); - return; + if (agvaddr < 1) {return; } if (agvaddr != 0) { old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); @@ -957,15 +729,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic device = deviceAppService.findDeviceByCode(device_code); if (ObjectUtil.isEmpty(device_code)) { - log.info(agvaddr + "对应设备号为空!"); - logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code); - return; + log.info(agvaddr + "对应设备号为空!");return; } //校验agv上报站点编号与指令起始点相同 if (ObjectUtil.isEmpty(inst)) { - log.info("未找到关联编号{}对应的指令", ikey); - logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); - return; + log.info("未找到关联编号{}对应的指令", ikey);return; } if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); @@ -983,12 +751,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { unpackingMachineDeviceDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -1002,12 +764,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { unpackingConveyorDeviceDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -1021,12 +777,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { productionLineDockingStationDeviceDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -1040,12 +790,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { removeSealCoverPositionDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -1056,9 +800,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (agvaddr == 0) { agvaddr = agvaddr_copy; } - if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); - return; + if (agvaddr < 1) {return; } if (agvaddr != 0) { old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); @@ -1104,23 +846,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (unpackingMachineDeviceDriver.getAction() == 1 && unpackingMachineDeviceDriver.getMode() > 0 && unpackingMachineDeviceDriver.getMove() == 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",模式信号:" + unpackingMachineDeviceDriver.getMode() + ",动作信号:" + unpackingMachineDeviceDriver.getAction() + ",光电信号:" + unpackingMachineDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } if (device.getDeviceDriver() instanceof UnpackingConveyorDeviceDriver) { @@ -1136,20 +866,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (unpackingConveyorDeviceDriver.getAction() == 1 && unpackingConveyorDeviceDriver.getMove() == 0 && unpackingConveyorDeviceDriver.getMode() > 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + unpackingConveyorDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -1165,20 +883,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } if (productionLineDockingStationDeviceDriver.getAction() == 2 && productionLineDockingStationDeviceDriver.getMove() == 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + productionLineDockingStationDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -1194,20 +900,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic // } if (removeSealCoverPositionDriver.getAction() == 2 && "2".equals(instruction.getHave_lid()) && removeSealCoverPositionDriver.getMode() > 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + removeSealCoverPositionDriver.getAction() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -1217,9 +911,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (agvaddr == 0) { agvaddr = agvaddr_copy; } - if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); - return; + if (agvaddr < 1) {return; } old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); @@ -1271,12 +963,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { unpackingConveyorDeviceDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -1290,12 +976,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { productionLineDockingStationDeviceDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -1309,12 +989,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic try { removeSealCoverPositionDriver.writing(map); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } @@ -1337,12 +1011,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic JSONObject jsonObject = new JSONObject(); jsonObject.put("task_code", task_code); jsonObject.put("vehicle_code", agvaddr); - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("AGV-61") - .content("料桶检验AGV扫码反馈:" + jsonObject.toJSONString() + ";设备:AGV-61") - .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); ApplyPlugPullSitResponse response = acsToWmsService.actionCheckMaterialBucket(jsonObject); if (response.getCode() == 200) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); @@ -1365,8 +1033,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic // this.setErrorInfo(ikey, code, info); // } - if (error != last_error) { -// DeviceErrorLogDto dto = new DeviceErrorLogDto(); + if (error != last_error) {// DeviceErrorLogDto dto = new DeviceErrorLogDto(); // dto.setDevice_code(this.getDevice().getDevice_code()); // dto.setError_code(String.valueOf(error_code)); // dto.setError_info(error_message); @@ -1399,6 +1066,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic //三色灯状态 status = ikey; + if (status != last_status) {} if (status != last_status && status != 6 && status != 7) { boolean flag = true; JSONObject param = new JSONObject(); @@ -1424,10 +1092,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic last_status = status; } if (!ObjectUtil.isEmpty(data)) { - phase = 0; - logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); -// OneNDCSocketConnectionAutoRun.write(data); - TwoNDCSocketConnectionAutoRun.write(data); + phase = 0;// OneNDCSocketConnectionAutoRun.write(data); + NDCSocketConnectionAutoRun.write(data); } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index 494b51b..9f6d86a 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -9,16 +9,19 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; import org.nl.acs.agv.server.NDCAgvService; -import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun; +import org.nl.acs.auto.run.BMSSocketConnectionAutoRun; +import org.nl.acs.auto.run.NDCSocketConnectionAutoRun; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.agv.utils.TwoAgvPhase; -import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.device_driver.driver.AbstractDeviceDriver; +import org.nl.acs.device_driver.zz_driver.elevator.ElevatorDoorDeviceDriver; +import org.nl.acs.device_driver.zz_driver.production_line_docking_station.ProductionLineDockingStationDeviceDriver; +import org.nl.acs.device_driver.zz_driver.remove_seal_cover_position.RemoveSealCoverPositionDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.history.ErrorUtil; @@ -28,25 +31,20 @@ import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.impl.InstructionServiceImpl; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.task.service.TaskService; -import org.nl.acs.task.service.dto.TaskDto; -import org.nl.acs.task.service.impl.TaskServiceImpl; +import org.nl.config.MapOf; import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; -import org.nl.config.thread.ThreadPoolExecutorUtil; import org.nl.system.service.dict.ISysDictService; import org.nl.system.service.dict.dao.Dict; import org.nl.system.service.param.ISysParamService; import org.nl.config.SpringContextHolder; import java.time.LocalTime; -import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.Map; -import java.util.concurrent.ThreadPoolExecutor; + +import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; /** @@ -59,29 +57,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic ISysParamService ISysParamService = SpringContextHolder.getBean(ISysParamService.class); InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); - TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class); AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); + LuceneExecuteLogService logServer = SpringContextHolder.getBean(LuceneExecuteLogService.class); DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); - LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); TwoAgvPhase twoAgvPhase = new TwoAgvPhase(); ISysDictService dictService = SpringContextHolder.getBean(ISysDictService.class); String error_code = "0"; int agvaddr = 0; - int agvaddr_copy = 0; - int weight = 0; - int agv_power = 0; String device_code = ""; int phase = 0; - int region = 0; int error = 0; int last_error = 0; private Instruction instruction; - String message = null; int x = 0; //x坐标 int y = 0; //y坐标 int angle = 0; //角度 @@ -90,9 +81,16 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic int last_status = 0; //三色灯状态 String error_message = ""; String error_type = "agv_error_type"; - Boolean isonline = true; - Boolean iserror = false; - boolean isCharge = false; + + + private Integer lastPhase = 0; + + /** + * 下发NDC指令需要指定车辆 + * 需要根据车辆的状态指定 + */ + private boolean canIssued = true; + private boolean last_canIssued = true; private synchronized void setErrorInfo(int error, String error_code, String error_message) { this.error = error; @@ -115,36 +113,19 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic //车号 int carno = arr[20]; Instruction inst = null; - Device agv_device = null; - if (carno != 0) { - agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno)); - } - TaskDto task = null; if (ikey != 0) { - if (phase != 0x67 && phase != 0x71 && phase != 0x72 && phase != 0x73 && phase != 0x74 && phase != 0x75) { + if (phase != 0x67 && phase != 0x70 && phase != 0x71 && phase != 0x72 && phase != 0x73 && phase != 0x74) { inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); this.instruction = inst; } - if (ObjectUtil.isNotEmpty(inst)) { -// log.info("该指令号未找到对应指令:" + ikey); -// message = "该指令号未找到对应指令:" + ikey; -// logServer.deviceExecuteLog(this.device_code, "", "", "该指令号未找到对应指令:" + ikey); -// return; - task = taskService.findByTaskCode(inst.getTask_code()); - } else { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("指令号为空!") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + if (ObjectUtil.isEmpty(inst) && phase != 0x67 && phase != 0x70 && phase != 0x71 && phase != 0x72 && phase != 0x73 && phase != 0x74) { + log.warn("指令号{}未找到对应指令", ikey); } } Device device = null; String old_device_code = null; - String emptyNum = null; String device_code = null; if (agvaddr != 0) { @@ -156,7 +137,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { String[] point = old_device_code.split("\\."); device_code = point[0]; - emptyNum = point[1]; } else { device_code = old_device_code; } @@ -165,11 +145,17 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic //普通站点 StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - //标准-光电检测 - StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; - + RemoveSealCoverPositionDriver removeSealCoverPositionDriver; + ProductionLineDockingStationDeviceDriver productionLineDockingStationDeviceDriver; if (phase == 0x02) { + logServer.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x02") + .request_direction("AGV->ACS") + .method("AgvNdcTwoDeviceDriver.processSocket") + .request_param(Bytes2HexString(toBytes(arr))) + .content("phase=0x02;ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + device_code + ",agv_car=" + carno) + .build()); if (ObjectUtil.isEmpty(inst)) { log.info("未找到指令号{}对应的指令", ikey); return; @@ -180,11 +166,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic //到达取货点 //(Itype=1/2/3,需要WCS反馈Phase) else if (phase == 0x03) { - if (agvaddr == 0) { - agvaddr = agvaddr_copy; - } + logPhaseRequest(phase, ikey, index, agvaddr, device_code, carno, arr); if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); + logPhaseNoAck(phase, ikey, index, agvaddr, this.device_code, carno, arr, "原因: agvaddr参数有误"); + logServer.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.device_code) + .content("agv地址参数有误,phase:" + phase) + .build()); return; } device_code = deviceService.queryDeviceCodeByAddress(agvaddr); @@ -197,7 +185,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { String[] point = old_device_code.split("\\."); device_code = point[0]; - emptyNum = point[1]; } else { device_code = old_device_code; } @@ -205,16 +192,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic device = deviceAppService.findDeviceByCode(device_code); if (ObjectUtil.isEmpty(device_code)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: agvaddr=" + agvaddr + " 对应设备号为空"); log.info(agvaddr + "对应设备号为空!"); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content(agvaddr + "对应设备号为空") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); return; } if (ObjectUtil.isEmpty(inst)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到指令号" + ikey + "对应的指令"); log.info("未找到指令号{}对应的指令", ikey); return; } @@ -225,38 +208,63 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); standardOrdinarySiteDeviceDriver.setOption(0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { + removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); + //需要判断终点是料筒缓存库还是其它区域,若是料筒缓存库则是取带盖的,否则是取无盖的 + String nextDeviceCode = inst.getNext_device_code(); + Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode); + if (nextDevice != null) { + if ("7".equals(nextDevice.getRegion())) { + if (removeSealCoverPositionDriver.getAction() == 4) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 取货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } + } else { + if (removeSealCoverPositionDriver.getAction() == 3) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 取货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } + } + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到nextDeviceCode=" + nextDeviceCode + "对应设备"); + } + } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { + productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); + // 下发到达取货点,判断是否允许取货 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 1); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货指令异常: " + e.getMessage()); + return; + } + if (productionLineDockingStationDeviceDriver.getAction() == 1) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许取货, action=" + productionLineDockingStationDeviceDriver.getAction()); + } } else { - data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } + lastPhase = 3; } // 取货完毕 //(Itype=1/2/3,需要WCS反馈Phase) else if (phase == 0x05) { - if (agvaddr == 0) { - agvaddr = agvaddr_copy; - } + logPhaseRequest(phase, ikey, index, agvaddr, device_code, carno, arr); if (agvaddr < 1) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agv地址参数有误,phase:" + phase) - .build(); - logDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(logDto); + logPhaseNoAck(phase, ikey, index, agvaddr, this.device_code, carno, arr, "原因: agvaddr参数有误"); + log.warn("agv地址参数有误, phase:{}", phase); return; } if (agvaddr != 0) { @@ -268,7 +276,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { String[] point = old_device_code.split("\\."); device_code = point[0]; - emptyNum = point[1]; } else { device_code = old_device_code; } @@ -276,16 +283,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic device = deviceAppService.findDeviceByCode(device_code); if (ObjectUtil.isEmpty(device_code)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: agvaddr=" + agvaddr + " 对应设备号为空"); log.info(agvaddr + "对应设备号为空!"); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("对应设备号为空" + device_code) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); return; } if (ObjectUtil.isEmpty(inst)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到指令号" + ikey + "对应的指令"); log.info("未找到指令号{}对应的指令", ikey); return; } @@ -296,40 +299,66 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); standardOrdinarySiteDeviceDriver.setAgvphase(phase); standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setInst(inst); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { + removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); + //需要判断终点是料筒缓存库还是其它区域,若是料筒缓存库则是取完带盖的,否则是取完无盖的 + String nextDeviceCode = inst.getNext_device_code(); + Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode); + if (nextDevice != null) { + if ("7".equals(nextDevice.getRegion())) { + try { + removeSealCoverPositionDriver.writing("to_command", 3); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + try { + removeSealCoverPositionDriver.writing("to_command", 4); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到nextDeviceCode=" + nextDeviceCode + "对应设备"); + } + } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { + productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); + // 下发取货完成 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 2); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货完成指令异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else { - data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } // 到达放货点 //(Itype=1/2/3,需要WCS反馈) - else if (phase == 0x07) { - if (agvaddr == 0) { - agvaddr = agvaddr_copy; - } + else if (phase == 0x08) { + logPhaseRequest(phase, ikey, index, agvaddr, device_code, carno, arr); if (agvaddr < 1) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agv地址参数有误,phase:" + phase) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + logPhaseNoAck(phase, ikey, index, agvaddr, this.device_code, carno, arr, "原因: agvaddr参数有误"); + log.warn("agv地址参数有误, phase:{}", phase); return; } if (agvaddr != 0) { @@ -341,7 +370,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { String[] point = old_device_code.split("\\."); device_code = point[0]; - emptyNum = point[1]; } else { device_code = old_device_code; } @@ -349,49 +377,74 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic device = deviceAppService.findDeviceByCode(device_code); if (ObjectUtil.isEmpty(device_code)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: agvaddr=" + agvaddr + " 对应设备号为空"); log.info(agvaddr + "对应设备号为空!"); return; } if (ObjectUtil.isEmpty(inst)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到指令号" + ikey + "对应的指令"); log.info("未找到指令号{}对应的指令", ikey); return; } if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); standardOrdinarySiteDeviceDriver.setOption(0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { + removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); + //需要判断起点是料桶缓存库还是其它区域的,若是料桶缓存库,则是放带盖的,否则是放无盖的 + String startDeviceCode = inst.getStart_device_code(); + Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode); + if (startDevice != null) { + if ("7".equals(startDevice.getRegion())) { + if (removeSealCoverPositionDriver.getAction() == 1) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 放货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } + } else { + if (removeSealCoverPositionDriver.getAction() == 2) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 放货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } + } + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到startDeviceCode=" + startDeviceCode + "对应设备"); + } + } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { + productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); + // 下发到达放货点,判断是否允许放货 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 3); + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货指令异常: " + e.getMessage()); + return; + } + if (productionLineDockingStationDeviceDriver.getAction() == 2) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许放货, action=" + productionLineDockingStationDeviceDriver.getAction()); + } } else { - data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } //放货完成 //(Itype=1/2/3,需要WCS反馈) - else if (phase == 0x09) { - if (agvaddr == 0) { - agvaddr = agvaddr_copy; - } + else if (phase == 0x0A) { + logPhaseRequest(phase, ikey, index, agvaddr, device_code, carno, arr); if (agvaddr < 1) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agv地址参数有误,phase:" + phase) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + logPhaseNoAck(phase, ikey, index, agvaddr, this.device_code, carno, arr, "原因: agvaddr参数有误"); + log.warn("agv地址参数有误, phase:{}", phase); return; } if (agvaddr != 0) { @@ -403,7 +456,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { String[] point = old_device_code.split("\\."); device_code = point[0]; - emptyNum = point[1]; } else { device_code = old_device_code; } @@ -411,180 +463,491 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic device = deviceAppService.findDeviceByCode(device_code); if (ObjectUtil.isEmpty(device_code)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: agvaddr=" + agvaddr + " 对应设备号为空"); log.info(agvaddr + "对应设备号为空!"); return; } if (ObjectUtil.isEmpty(inst)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到指令号" + ikey + "对应的指令"); log.info("未找到指令号{}对应的指令", ikey); return; } if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); standardOrdinarySiteDeviceDriver.setAgvphase(phase); standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setInst(inst); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { + removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); + //需要判断起点是料桶缓存库还是其它区域的,若是料桶缓存库,则是放带盖的完成,否则是放无盖的完成 + String startDeviceCode = inst.getStart_device_code(); + Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode); + if (startDevice != null) { + if ("7".equals(startDevice.getRegion())) { + try { + removeSealCoverPositionDriver.writing("to_command", 1); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + try { + removeSealCoverPositionDriver.writing("to_command", 2); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到startDeviceCode=" + startDeviceCode + "对应设备"); + } + } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { + productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); + // 下发放货完成 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 4); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货完成指令异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else { - data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } + // 到达第二次取货点 + //(Itype=3/4,需要WCS反馈) + else if (phase == 0x0C) { + logPhaseRequest(phase, ikey, index, agvaddr, device_code, carno, arr); + if (agvaddr < 1) { + logPhaseNoAck(phase, ikey, index, agvaddr, this.device_code, carno, arr, "原因: agvaddr参数有误"); + log.warn("agv地址参数有误, phase:{}", phase); + return; + } + if (agvaddr != 0) { + CommonFinalParam commonFinalParam = new CommonFinalParam(); + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) { + String[] point = old_device_code.split(commonFinalParam.getBARRE()); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + } else { + device_code = old_device_code; + } + } + + device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device_code)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: agvaddr=" + agvaddr + " 对应设备号为空"); + log.info(agvaddr + "对应设备号为空!"); + return; + } + if (ObjectUtil.isEmpty(inst)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到指令号" + ikey + "对应的指令"); + log.info("未找到指令号{}对应的指令", ikey); + return; + } + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + standardOrdinarySiteDeviceDriver.setOption(0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { + removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); + //需要判断终点是料筒缓存库还是其它区域,若是料筒缓存库则是取带盖的,否则是取无盖的 + String nextDeviceCode2 = inst.getNext_device_code2(); + Device nextDevice2 = deviceAppService.findDeviceByCode(nextDeviceCode2); + if (nextDevice2 != null) { + if ("7".equals(nextDevice2.getRegion())) { + if (removeSealCoverPositionDriver.getAction() == 4) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 第二次取货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } + } else { + if (removeSealCoverPositionDriver.getAction() == 3) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 第二次取货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } + } + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到nextDeviceCode2=" + nextDeviceCode2 + "对应设备"); + } + } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { + productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); + // 下发到达取货点,判断是否允许取货 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 1); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货指令异常: " + e.getMessage()); + return; + } + if (productionLineDockingStationDeviceDriver.getAction() == 1) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许第二次取货, action=" + productionLineDockingStationDeviceDriver.getAction()); + } + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + lastPhase = 12; + } + // 第二次取货完成 + //(Itype=3/4,需要WCS反馈) + else if (phase == 0x0E) { + logPhaseRequest(phase, ikey, index, agvaddr, device_code, carno, arr); + if (agvaddr < 1) { + logPhaseNoAck(phase, ikey, index, agvaddr, this.device_code, carno, arr, "原因: agvaddr参数有误"); + log.warn("agv地址参数有误, phase:{}", phase); + return; + } + if (agvaddr != 0) { + CommonFinalParam commonFinalParam = new CommonFinalParam(); + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) { + String[] point = old_device_code.split(commonFinalParam.getBARRE()); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + } else { + device_code = old_device_code; + } + } + + device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device_code)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: agvaddr=" + agvaddr + " 对应设备号为空"); + log.info(agvaddr + "对应设备号为空!"); + return; + } + if (ObjectUtil.isEmpty(inst)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到指令号" + ikey + "对应的指令"); + log.info("未找到指令号{}对应的指令", ikey); + return; + } + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + standardOrdinarySiteDeviceDriver.setAgvphase(phase); + standardOrdinarySiteDeviceDriver.setIndex(index); + standardOrdinarySiteDeviceDriver.setInst(inst); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { + removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); + //需要判断终点是料筒缓存库还是其它区域,若是料筒缓存库则是取完带盖的,否则是取完无盖的 + String nextDeviceCode2 = inst.getNext_device_code2(); + Device nextDevice2 = deviceAppService.findDeviceByCode(nextDeviceCode2); + if (nextDevice2 != null) { + if ("7".equals(nextDevice2.getRegion())) { + try { + removeSealCoverPositionDriver.writing("to_command", 3); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + try { + removeSealCoverPositionDriver.writing("to_command", 4); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货完成动作异常: " + e.getMessage()); + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到nextDeviceCode2=" + nextDeviceCode2 + "对应设备"); + } + } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { + productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); + // 下发取货完成 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 2); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货完成指令异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } + // 到达第二次放货点 + //(Itype=3/4,需要WCS反馈) + else if (phase == 0x10) { + logPhaseRequest(phase, ikey, index, agvaddr, device_code, carno, arr); + if (agvaddr < 1) { + logPhaseNoAck(phase, ikey, index, agvaddr, this.device_code, carno, arr, "原因: agvaddr参数有误"); + log.warn("agv地址参数有误, phase:{}", phase); + return; + } + if (agvaddr != 0) { + CommonFinalParam commonFinalParam = new CommonFinalParam(); + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) { + String[] point = old_device_code.split(commonFinalParam.getBARRE()); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + } else { + device_code = old_device_code; + } + } + + device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device_code)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: agvaddr=" + agvaddr + " 对应设备号为空"); + log.info(agvaddr + "对应设备号为空!"); + return; + } + if (ObjectUtil.isEmpty(inst)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到指令号" + ikey + "对应的指令"); + log.info("未找到指令号{}对应的指令", ikey); + return; + } + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + standardOrdinarySiteDeviceDriver.setOption(0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { + removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); + //需要判断起点是料桶缓存库还是其它区域的,若是料桶缓存库,则是放带盖的,否则是放无盖的 + String startDeviceCode2 = inst.getStart_device_code2(); + Device startDevice2 = deviceAppService.findDeviceByCode(startDeviceCode2); + if (startDevice2 != null) { + if ("7".equals(startDevice2.getRegion())) { + if (removeSealCoverPositionDriver.getAction() == 1) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 第二次放货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } + } else { + if (removeSealCoverPositionDriver.getAction() == 2) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 第二次放货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } + } + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到startDeviceCode2=" + startDeviceCode2 + "对应设备"); + } + } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { + productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); + // 下发到达放货点,判断是否允许放货 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 3); + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货指令异常: " + e.getMessage()); + return; + } + if (productionLineDockingStationDeviceDriver.getAction() == 2) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许第二次放货, action=" + productionLineDockingStationDeviceDriver.getAction()); + } + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } + // 第二次放货完成 + //(Itype=3/4,需要WCS反馈) + else if (phase == 0x12) { + logPhaseRequest(phase, ikey, index, agvaddr, device_code, carno, arr); + if (agvaddr < 1) { + logPhaseNoAck(phase, ikey, index, agvaddr, this.device_code, carno, arr, "原因: agvaddr参数有误"); + log.warn("agv地址参数有误, phase:{}", phase); + return; + } + if (agvaddr != 0) { + CommonFinalParam commonFinalParam = new CommonFinalParam(); + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) { + String[] point = old_device_code.split(commonFinalParam.getBARRE()); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + } else { + device_code = old_device_code; + } + } + + device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device_code)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: agvaddr=" + agvaddr + " 对应设备号为空"); + log.info(agvaddr + "对应设备号为空!"); + return; + } + if (ObjectUtil.isEmpty(inst)) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到指令号" + ikey + "对应的指令"); + log.info("未找到指令号{}对应的指令", ikey); + return; + } + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + standardOrdinarySiteDeviceDriver.setAgvphase(phase); + standardOrdinarySiteDeviceDriver.setIndex(index); + standardOrdinarySiteDeviceDriver.setInst(inst); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { + removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); + //需要判断起点是料桶缓存库还是其它区域的,若是料桶缓存库,则是放带盖的完成,否则是放无盖的完成 + String startDeviceCode2 = inst.getStart_device_code2(); + Device startDevice2 = deviceAppService.findDeviceByCode(startDeviceCode2); + if (startDevice2 != null) { + if ("7".equals(startDevice2.getRegion())) { + try { + removeSealCoverPositionDriver.writing("to_command", 1); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + try { + removeSealCoverPositionDriver.writing("to_command", 2); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到startDeviceCode2=" + startDeviceCode2 + "对应设备"); + } + } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { + productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); + // 下发放货完成 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 4); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货完成指令异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } + + // 允许进入站点 + else if (phase == 0x4D) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } + // 上报data61ƒ + else if (phase == 0x61) { + if (ObjectUtil.isEmpty(inst)) { + log.info("未找到指令号{}对应的指令", ikey); + return; + } + if (lastPhase == 3) { + String vehicleCode = inst.getVehicle_code(); + if (Integer.toString(agvaddr).equals(vehicleCode)) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + lastPhase = 0; + } else { + log.info("AGV上报载具码与任务不一致:{},{}", Integer.toString(agvaddr), vehicleCode); + } + } else if (lastPhase == 12) { + String vehicleCode2 = inst.getVehicle_code2(); + if (Integer.toString(agvaddr).equals(vehicleCode2)) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + lastPhase = 0; + } else { + log.info("AGV上报载具码与任务不一致:{},{}", Integer.toString(agvaddr), vehicleCode2); + } + } + //agvaddr载具号 + //car还是车号 + //ikey指令号 + } //上传AGV电量 else if (phase == 0x70) { //x坐标 x = ikey; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "x坐标:" + x) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else if (phase == 0x71) { //y坐标 y = ikey; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "y坐标:" + y) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else if (phase == 0x72) { //车辆角度 angle = ikey; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "车辆角度:" + angle) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else if (phase == 0x73) { log.info("接收agv上报信息,phase == 0x73:" + phase); //agv电量 electric_qty = ikey; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "agv电量:" + electric_qty) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - //自动充电的车号 - String is_atuo_car = ISysParamService.findByCode(AcsConfig.IS_ATUO_CAR).getValue(); - //当前上报的车号 - String now_car = String.valueOf(this.agvaddr); - //如果配置的车号是诺宝车号 - if(now_car.equals(is_atuo_car)){ - //是否开启自动充电 - String is_atuo_electric = ISysParamService.findByCode(AcsConfig.IS_ATUO_ELECTRIC).getValue(); - log.info("接收agv上报信息,is_atuo_electric:" + is_atuo_electric); - if("1".equals(is_atuo_electric)){ - String electric_begin = ISysParamService.findByCode(AcsConfig.ELECTRIC_BEGIN).getValue(); - String[] begins = electric_begin.split(":"); - String electric_end = ISysParamService.findByCode(AcsConfig.ELECTRIC_END).getValue(); - String[] ends = electric_end.split(":"); - // 定义时间段 - LocalTime startTime = LocalTime.of(Integer.parseInt(begins[0]), Integer.parseInt(begins[1])); // 上午8点 - LocalTime endTime = LocalTime.of(Integer.parseInt(ends[0]), Integer.parseInt(ends[1])); // 晚上22点 - // 获取当前时间 - LocalTime now = LocalTime.now(); - // 判断当前时间是否在时间段内 - boolean isInRange = !now.isBefore(startTime) && !now.isAfter(endTime); - int electric = 0 ; - //早上8-22点 - if(isInRange){ - electric = Integer.parseInt(ISysParamService.findByCode(AcsConfig.ELECTRIC).getValue()); - }else{ - electric = Integer.parseInt(ISysParamService.findByCode(AcsConfig.ELECTRIC2).getValue()); - } - if (electric_qty>0 && electric_qty < electric) { - log.info("当前车辆{}电量为{}低于{},开始判断是否需要充电!", this.agvaddr, electric_qty,electric); - //判断是否已下发充电任务 - Dict dict1 = dictService.getDictByName3("station",String.valueOf(this.agvaddr),null); - if(ObjectUtil.isNotEmpty(dict1)){ - log.info("当前车辆{}已分配充电桩{},退出后续判断",this.agvaddr,dict1.getPara1()); - }else{ - //未下发,判断是否有空闲充电桩 - Dict dict = dictService.getDictByName2("station"); - if(ObjectUtil.isNotEmpty(dict)){ - ndcAgvService.charge(String.valueOf(this.agvaddr)); - isCharge =true; - }else{ - log.info("当前车辆{}电量为{}低于{},但无空闲充电桩!", this.agvaddr, electric_qty,electric); - } - } - } - } - } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else if (phase == 0x74) { //三色灯状态 status = ikey; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "三色灯状态:" + status) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - - if (status != last_status && status != 6 && status != 7) { - boolean flag = true; - JSONObject param = new JSONObject(); - param.put("device_code", this.device_code); - if (status == 1) { - param.put("mode", 0); - } else if (status == 2) { - param.put("mode", 3); - } else if ("345".contains(String.valueOf(status))) { - param.put("mode", 2); - } else { - flag = false; - } - - if (flag) { - param.put("device_name", this.getDevice().getDevice_name()); - param.put("device_type", "4"); - param.put("product_area", ISysParamService.findByCode("productArea").getValue()); - acsToWmsService.sendDeviceStatus(param); - } + if (status != last_status) { + logServer.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.device_code) + .content("自动线程读取信号status:" + last_status + "->" + status) + .build()); } + if (status == 1 || status == 5 || status == 6 || status == 7) { + canIssued = false; + } else { + canIssued = true; + } + + if (canIssued != last_canIssued) { + logServer.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.device_code) + .content("自动线程读取信号canIssued:" + last_canIssued + "->" + canIssued) + .build()); + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); last_status = status; - } //进入区域(phase值) - else if (phase == 0x50) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "自动门开门") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - //离开区域(phase值) - else if (phase == 0x51) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "自动门关门") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + last_canIssued = canIssued; } //上报异常信息 //(不需要WCS反馈) else if (phase == 0x67) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "异常信息:" + error) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); //故障信息 if (ikey == 0) { this.setErrorInfo(ikey, "0", "正常"); @@ -595,39 +958,31 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic this.setErrorInfo(ikey, code, info); } if (error != last_error) { - DeviceErrorLogDto dto = new DeviceErrorLogDto(); - dto.setDevice_code(this.getDevice().getDevice_code()); - dto.setError_code(String.valueOf(error_code)); - dto.setError_info(error_message); - deviceErrorLogService.create(dto); - - JSONObject param = new JSONObject(); - param.put("device_code", this.device_code); - param.put("error", error); - param.put("error_msg", error == 0 ? "" : this.getError_message()); - param.put("device_name", this.getDevice().getDevice_name()); - param.put("device_type", "4"); - param.put("product_area", ISysParamService.findByCode("productArea").getValue()); - acsToWmsService.sendDeviceStatus(param); +// logServer.deviceExecuteLog(LuceneLogDto.builder() +// .device_code(this.device_code) +// .content("自动线程读取信号error:" + last_error + "->" + error) +// .build()); +// DeviceErrorLogDto dto = new DeviceErrorLogDto(); +// dto.setDevice_code(this.getDevice().getDevice_code()); +// dto.setError_code(String.valueOf(error_code)); +// dto.setError_info(error_message); +// deviceErrorLogService.create(dto); +// +// JSONObject param = new JSONObject(); +// param.put("device_code", this.device_code); +// param.put("error", error); +// param.put("error_msg", error == 0 ? "" : this.getError_message()); +// param.put("device_name", this.getDevice().getDevice_name()); +// param.put("device_type", "4"); +// param.put("product_area", ISysParamService.findByCode("productArea").getValue()); +// acsToWmsService.sendDeviceStatus(param); } last_error = error; + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } + if (!ObjectUtil.isEmpty(data)) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); -// if (StrUtil.equals(inst.getAgv_system_type(), "2")) { -// TwoNDCSocketConnectionAutoRun.write(data); -// } -// else if (StrUtil.equals(inst.getAgv_system_type(), "3")) { -// TwoNDC2SocketConnectionAutoRun.write(data); -// } - if (StrUtil.equals(inst.getAgv_system_type(), "2")) { - TwoNDCSocketConnectionAutoRun.write(data); - } + NDCSocketConnectionAutoRun.write(data); } } @@ -656,7 +1011,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic jo.put("task_code", ObjectUtil.isEmpty(instruction) ? "0" : instruction.getTask_code()); //异常 jo.put("fault", this.getError_message()); - jo.put("message", message); return jo; } @@ -676,4 +1030,49 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic return jo; } + private byte[] toBytes(int[] arr) { + byte[] bytes = new byte[arr.length]; + for (int i = 0; i < arr.length; i++) { + bytes[i] = (byte) arr[i]; + } + return bytes; + } + + private void logPhaseRequest(int phase, int ikey, int index, int agvaddr, String deviceCode, int carno, int[] arr) { + logServer.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x" + toHexPhase(phase)) + .request_direction("AGV->ACS") + .method("AgvNdcTwoDeviceDriver.processSocket") + .request_param(Bytes2HexString(toBytes(arr))) + .content("phase=0x" + toHexPhase(phase) + ";ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + deviceCode + ",agv_car=" + carno) + .build()); + } + + private void logPhaseAck(int phase, int ikey, int index, int agvaddr, String deviceCode, int carno, int[] arr, byte[] data) { + logServer.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x" + toHexPhase(phase)) + .request_direction("ACS->AGV") + .method("AgvNdcTwoDeviceDriver.processSocket") + .request_param(Bytes2HexString(toBytes(arr))) + .response_param(ObjectUtil.isEmpty(data) ? "" : Bytes2HexString(data)) + .content("已反馈AGVphase=0x" + toHexPhase(phase) + ";ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + deviceCode + ",agv_car=" + carno) + .build()); + } + + private void logPhaseNoAck(int phase, int ikey, int index, int agvaddr, String deviceCode, int carno, int[] arr, String reason) { + logServer.interfaceExecuteLog(LuceneLogDto.builder() + .request_url("socket://ndc/phase/0x" + toHexPhase(phase)) + .request_direction("ACS->AGV") + .method("AgvNdcTwoDeviceDriver.processSocket") + .request_param(Bytes2HexString(toBytes(arr))) + .response_param(reason) + .content("未反馈AGVphase=0x" + toHexPhase(phase) + ";ikey=" + ikey + ",index=" + index + ",agvaddr=" + agvaddr + ",device_code=" + deviceCode + ",agv_car=" + carno) + .build()); + } + + private String toHexPhase(int phase) { + String hex = Integer.toHexString(phase).toUpperCase(); + return hex.length() == 1 ? "0" + hex : hex; + } + } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/utils/TwoAgvPhase.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/utils/TwoAgvPhase.java index 0050427..aa23c18 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/utils/TwoAgvPhase.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/utils/TwoAgvPhase.java @@ -14,42 +14,50 @@ public class TwoAgvPhase implements IAgv { return "到达取货点1"; } else if (phase == 0x05) { return "取货点1取货完毕"; - } else if (phase == 0x07) { - return "到达取货点2"; - } else if (phase == 0x09) { - return "取货点2取货完毕"; + } else if (phase == 0x08) { + return "到达放货点1"; } else if (phase == 0x0A) { - return "自动缓存线--到达送满框1"; - } else if (phase == 0x0B) { - return "到达倒料点1"; + return "放货点1放货完毕"; } else if (phase == 0x0C) { - return "自动缓存线--送满框完毕1"; - } else if (phase == 0x0D) { - return "倒料点1倒料完毕"; + return "到达取货点2"; } else if (phase == 0x0E) { - return "自动缓存线--到达取空框1"; - } else if (phase == 0x0F) { - return "到达倒料点2"; - } else if (phase == 0x11) { - return "倒料点2倒料完毕"; - } else if (phase == 0x13) { - return "到达送箱点1"; - } else if (phase == 0x15) { - return "送箱点1送箱完毕"; - } else if (phase == 0x17) { - return "到达送箱点2"; - } else if (phase == 0x19) { - return "送箱完毕/送空框完毕2"; + return "取货点2取货完毕"; + } else if (phase == 0x10) { + return "到达放货点2"; + } else if (phase == 0x12) { + return "放货点2放货完毕"; } else if (phase == 0x30) { return "请求删除任务"; } else if (phase == 0xFF) { return "任务删除确认"; - } else if (phase == 0x64) { - return "取货完毕/取满框完毕1/点对点取货完毕"; - } else if (phase == 0x65) { - return "称重就绪"; - } else if (phase == 0x1A) { + } else if (phase == 0x14) { return "任务完毕"; + } else if (phase == 0x4D) { + return "允许进入站点"; + } else if (phase == 0x50) { + return "进入区域"; + } else if (phase == 0x51) { + return "离开区域"; + } else if (phase == 0x61) { + return "上传data61"; + } else if (phase == 0x67) { + return "上报异常信息"; + } else if (phase == 0x70) { + return "上报x坐标"; + } else if (phase == 0x71) { + return "上报y坐标"; + } else if (phase == 0x72) { + return "上报角度"; + } else if (phase == 0x73) { + return "上报电量"; + } else if (phase == 0x74) { + return "上报车状态"; + } else if (phase == 0x64) { + return "充电任务下发成功"; + } else if (phase == 0x65) { + return "充电中"; + } else if (phase == 0x66) { + return "充电任务已取消"; } return null; } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv/XgagvDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv/XgagvDeviceDriver.java index ff626a4..4c66983 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv/XgagvDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv/XgagvDeviceDriver.java @@ -26,8 +26,6 @@ import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; -import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; import org.openscada.opc.lib.da.Server; import org.springframework.beans.factory.annotation.Autowired; @@ -52,8 +50,6 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); @Autowired DeviceAppService deviceAppService = SpringContextHolder.getBean("deviceAppServiceImpl"); - @Autowired - LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); ; @Autowired AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); @@ -184,36 +180,15 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device cancle_navigation = this.itemProtocol.getCancle_navigation(); drum_run_status = this.itemProtocol.getDrum_run_status(); stop = this.itemProtocol.getStop(); - if (home_relocation != last_home_relocation) { -// luceneExecuteLogService.deviceExecuteLog( -// new LuceneLogDto(this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.device_code, ItemProtocol.to_home_relocation, this.last_home_relocation, this.home_relocation)); - } + if (home_relocation != last_home_relocation) {} if (stop != last_stop) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.stop + "变更从" + this.last_stop + "->" + this.stop) - .build(); - logDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(logDto); } if (address != last_address) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.address + this.last_address + "->" + this.address) - .build(); - logDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(logDto); } if (electricity != last_electricity) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.electricity + this.last_electricity + "->" + this.electricity) - .build(); - logDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(logDto); } //获取最小电量 @@ -336,13 +311,8 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device Server server = ReadUtil.getServer(opcservcerid); Map itemMap = new HashMap(); itemMap.put(to_command, value); - LuceneLogDto resplogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("下发信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + key + "value:" + value) - .build(); - ReadUtil.write(itemMap, server); - } + ReadUtil.write(itemMap, server);} @Override public JSONObject getDeviceStatusName() { @@ -391,25 +361,7 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device jo.put("device_code", this.device_code); jo.put("task_code", inst.getTask_code()); ja.add(jo); - LuceneLogDto reqlogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("请求参数:" + jo) - .requestparam("请求参数:" + jo) - .method("feedAgvTaskStatus") - .build(); - reqlogDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(reqlogDto); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); - LuceneLogDto resplogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("返回参数:" + resp.body()) - .responseparam("返回参数:" + resp.body()) - .method("feedAgvTaskStatus") - .status_code(String.valueOf(resp.getStatus())) - .build(); - resplogDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(resplogDto); - if (resp.getStatus() == 200) { inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); @@ -434,24 +386,7 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device jo.put("device_code", this.device_code); jo.put("task_code", inst.getTask_code()); ja.add(jo); - LuceneLogDto reqlogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("请求参数:" + jo) - .requestparam("请求参数:" + jo) - .method("feedAgvTaskStatus") - .build(); - reqlogDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(reqlogDto); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); - LuceneLogDto resplogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("返回参数:" + resp.body()) - .responseparam("返回参数:" + resp.body()) - .method("feedAgvTaskStatus") - .status_code(String.valueOf(resp.getStatus())) - .build(); - reqlogDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(resplogDto); if (resp.getStatus() == 200) { inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); @@ -473,24 +408,7 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device jo.put("device_code", this.device_code); jo.put("task_code", inst.getTask_code()); ja.add(jo); - LuceneLogDto reqlogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("请求参数:" + jo) - .requestparam("请求参数:" + jo) - .method("feedAgvTaskStatus") - .build(); - reqlogDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(reqlogDto); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); - LuceneLogDto resplogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("返回参数:" + resp.body()) - .responseparam("返回参数:" + resp.body()) - .method("feedAgvTaskStatus") - .status_code(String.valueOf(resp.getStatus())) - .build(); - reqlogDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(resplogDto); if (resp.getStatus() == 200) { inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); inst.setExecute_status("3"); @@ -510,24 +428,7 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device jo.put("device_code", this.device_code); jo.put("task_code", inst.getTask_code()); ja.add(jo); - LuceneLogDto reqlogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("请求参数:" + jo) - .requestparam("请求参数:" + jo) - .method("feedAgvTaskStatus") - .build(); - reqlogDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(reqlogDto); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); - LuceneLogDto resplogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("返回参数:" + resp.body()) - .responseparam("返回参数:" + resp.body()) - .method("feedAgvTaskStatus") - .status_code(String.valueOf(resp.getStatus())) - .build(); - reqlogDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(resplogDto); if (resp.getStatus() == 200) { writing("to_line", 2); inst.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex()); @@ -542,24 +443,7 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device jo.put("status", "5"); jo.put("device_code", this.address); ja.add(jo); - LuceneLogDto reqlogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("请求参数:" + jo) - .requestparam("请求参数:" + jo) - .method("feedAgvTaskStatus") - .build(); - reqlogDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(reqlogDto); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); - LuceneLogDto resplogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("返回参数:" + resp.body()) - .responseparam("返回参数:" + resp.body()) - .method("feedAgvTaskStatus") - .status_code(String.valueOf(resp.getStatus())) - .build(); - reqlogDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(resplogDto); if (resp.getStatus() == 200) { writing("to_di_low", 0); writing("to_di_height", 0); @@ -608,24 +492,7 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device jo.put("status", "5"); jo.put("device_code", "A4"); ja.add(jo); - LuceneLogDto reqlogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("请求参数:" + jo) - .requestparam("请求参数:" + jo) - .method("feedAgvTaskStatus") - .build(); - reqlogDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(reqlogDto); HttpResponse resp = acsToWmsService.feedAgvTaskStatus(ja); - LuceneLogDto resplogDto = LuceneLogDto.builder() - .device_code(device_code) - .content("返回参数:" + resp.body()) - .responseparam("返回参数:" + resp.body()) - .method("feedAgvTaskStatus") - .status_code(String.valueOf(resp.getStatus())) - .build(); - reqlogDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(resplogDto); if (resp.getStatus() == 200) { writing("to_di_low", 0); writing("to_di_height", 0); @@ -664,4 +531,3 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device return true; } } - diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDeviceDriver.java index 6c70564..1b2cf75 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/xg_agv_car/XgAgvCarDeviceDriver.java @@ -19,12 +19,12 @@ import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.task.service.TaskService; import org.nl.config.SpringContextHolder; +import org.nl.config.lucene.service.LuceneExecuteLogService; import org.springframework.beans.factory.annotation.Autowired; import java.util.Date; @@ -54,7 +54,7 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device @Autowired AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); + LuceneExecuteLogService logServer = SpringContextHolder.getBean(LuceneExecuteLogService.class); @Autowired NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class); @Autowired @@ -310,4 +310,3 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device } } } - diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java index a8d8478..d5cdd96 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java @@ -9,7 +9,6 @@ import org.nl.acs.device.domain.Device; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.utils.ReadUtil; import org.nl.config.SpringContextHolder; @@ -31,7 +30,6 @@ import java.util.Map; public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor { protected ItemProtocol itemProtocol = new ItemProtocol(this); protected ToDoorCommandControl toDoorCommandControl = new ToDoorCommandControl(this); - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); @Autowired LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); @@ -63,13 +61,32 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem toOpen = this.itemProtocol.getToOpen(); toClose = this.itemProtocol.getToClose(); if (open != last_open) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号open:" + last_open + "->" + open); + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.device_code) + .content("自动线程读取信号open:" + last_open + "->" + open) + .build()); } if (close != last_close) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.device_code) + .content("自动线程读取信号close:" + last_close + "->" + close) + .build()); if(close ==1 ){ this.writing("to_close","0"); } } + if (toOpen != last_toOpen) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.device_code) + .content("自动线程读取信号toOpen:" + last_toOpen + "->" + toOpen) + .build()); + } + if (toClose != last_toClose) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.device_code) + .content("自动线程读取信号toClose:" + last_toClose + "->" + toClose) + .build()); + } last_open = open; last_close = close; @@ -85,7 +102,7 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem itemMap.put(to_param, Integer.parseInt(value)); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content("下发多个电气信号" + itemMap) + .content("下发信号:" + itemMap) .build(); luceneExecuteLogService.deviceExecuteLog(logDto); try { @@ -103,6 +120,10 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem Map itemMap = new HashMap(); itemMap.put(to_command, command); ReadUtil.write(itemMap, server); + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(device_code) + .content("下发信号:" + itemMap) + .build()); log.info("下发PLC信号:{},{}", to_command, command); System.out.println("设备:" + this.device_code + ",下发PLC信号:" + to_command + ",value:" + command); diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java index 75db7af..d5306d5 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java @@ -24,7 +24,6 @@ import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.enums.InstructionStatusEnum; import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; @@ -33,8 +32,6 @@ import org.nl.acs.task.service.TaskService; import org.nl.acs.utils.DeviceErrorUtil; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; -import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.springframework.beans.factory.annotation.Autowired; @@ -63,15 +60,9 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); @Autowired AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - @Autowired AgvService agvService = SpringContextHolder.getBean(AgvService.class); @Autowired DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); - - LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); - ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); @@ -242,9 +233,13 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements requireSucess = false; } - if (mode != last_mode) { - requireSucess = false; + if (mode != last_mode) {requireSucess = false; } + if (heartbeat != last_heartbeat) {} + if (move != last_move) {} + if (action != last_action) {} + if (error != last_error) {} + if (task != last_task) {} if (move != 0 && task > 0) { CompletableFuture.runAsync(() -> { @@ -254,12 +249,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements } catch (Exception e) { e.printStackTrace(); log.error("更新指令失败原因:{}", e.getMessage()); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("设备号" + device_code + "报错原因:" + e.getMessage()) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } }); if (null != inst) { @@ -332,19 +321,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements PrintWriter pw = new PrintWriter(sw); var17.printStackTrace(pw); String stackTrace = sw.toString(); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content(this.device_code + extracted + ",报错信息:" + var17.getMessage() + ",堆栈跟踪:" + stackTrace) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content(this.device_code + extracted + ",报错信息:" + var17.getMessage()) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); var17.printStackTrace(); } } @@ -371,14 +348,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements + "." + org.nl.acs.device_driver.conveyor.belt_conveyor.ItemProtocol.item_to_command; Map itemMap = new HashMap(); itemMap.put(to_command, command); - this.control(itemMap); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("下发多个电气信号" + itemMap) - .build(); - logDto.setLog_level(3); - luceneExecuteLogService.deviceExecuteLog(logDto); - } + this.control(itemMap);} private void applyEmptyTask(String type, int mode) { Date date = new Date(); @@ -393,12 +363,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements param.put("device_code", device_code); param.put("container_type", container_type); param.put("type", type); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("申请空托盘出入库,参数:" + param) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); HttpResponse httpResponse = acsToWmsService.applyTwo(param); JSONObject jsonObject = null; if(ObjectUtil.isNotEmpty(httpResponse)){ @@ -407,12 +371,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements } message = "申请空托盘出入库,返回参数:" + jsonObject; if (ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200) { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(device_code) - .content("申请空托盘出入库,参数,接口返回:" + jsonObject) - .build(); - logDto2.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto2); List list1 = new ArrayList(); Map map = new HashMap(); map.put("code", "to_command"); @@ -423,12 +381,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements } else { this.iserror = true; message = "申请空托盘出入库出错,返回参数:" + jsonObject; - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(device_code) - .content("申请空托盘出入库,返回参数:" + jsonObject) - .build(); - logDto2.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto2); } } catch (Exception e) { e.printStackTrace(); @@ -456,15 +408,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements + "." + json.getString("code"); itemMap.put(to_param, json.getString("value")); } - } - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("下发多个电气信号" + itemMap) - .build(); - logDto.setLog_level(3); - luceneExecuteLogService.deviceExecuteLog(logDto); - logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); - try { + }try { this.checkcontrol(itemMap); } catch (Exception e) { e.printStackTrace(); @@ -482,15 +426,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements itemMap.put(to_param, Integer.parseInt(param)); //itemMap.put(to_param, Integer.parseInt(value)); - this.control(itemMap); - logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + param); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("下发多个电气信号" + itemMap) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } + this.control(itemMap);} public synchronized boolean finish_instruction() throws Exception { instructionService.finish(inst); @@ -568,17 +504,13 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) { inst.setInstruction_status(CommonFinalParam.ONE); inst.setExecute_device_code(this.device_code); - instructionService.update(inst); - logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task); - } + instructionService.update(inst);} //当货物到达b点,实现完成指令 if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()) || StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) { if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { inst.setExecute_device_code(this.device_code); - finish_instruction(); - logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task); - } + finish_instruction();} } } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/StandardInspectSiteDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/StandardInspectSiteDeviceDriver.java index 2fc71f1..1700b54 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/StandardInspectSiteDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/StandardInspectSiteDeviceDriver.java @@ -181,11 +181,23 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp /*material_type = this.itemProtocol.getMaterialType(); barcode = this.itemProtocol.getBarcode();*/ if (mode != last_mode) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(devicecode) + .content("自动线程读取信号mode:" + last_mode + "->" + mode) + .build()); this.setRequireSucess(false); } if (move != last_move) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(devicecode) + .content("自动线程读取信号move:" + last_move + "->" + move) + .build()); } if (error != last_error) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(devicecode) + .content("自动线程读取信号error:" + last_error + "->" + error) + .build()); } @@ -259,9 +271,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp } LuceneLogDto logDto = LuceneLogDto.builder() .device_code(devicecode) - .content("下发多个电气信号" + itemMap) + .content("下发信号:" + itemMap) .build(); - logDto.setLog_level(3); luceneExecuteLogService.deviceExecuteLog(logDto); } @@ -284,6 +295,10 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp itemMap.put(to_task, command); } this.control(itemMap); + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(devicecode) + .content("下发信号:" + itemMap) + .build()); } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDefination.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDefination.java index f2fd473..4effd62 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDefination.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDefination.java @@ -43,7 +43,7 @@ public class StandardOrdinarySiteDefination implements DeviceDriverDefination { @Override public List getFitDeviceTypes() { List types = new LinkedList(); - types.add(DeviceType.conveyor); + types.add(DeviceType.station); return types; } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java index 41870a3..adc45e5 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java @@ -20,13 +20,13 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.history.ErrorUtil; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.task.service.TaskService; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; +import org.nl.config.lucene.service.LuceneExecuteLogService; import org.springframework.beans.factory.annotation.Autowired; import java.util.Date; @@ -54,7 +54,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple @Autowired AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); + LuceneExecuteLogService logServer = SpringContextHolder.getBean(LuceneExecuteLogService.class); @Autowired NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class); @@ -225,4 +225,3 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple } } } - diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/standard_manipulator/StandardManipulatoDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/standard_manipulator/StandardManipulatoDeviceDriver.java index 871a173..3ad9683 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/standard_manipulator/StandardManipulatoDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/standard_manipulator/StandardManipulatoDeviceDriver.java @@ -23,7 +23,6 @@ import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; @@ -32,8 +31,6 @@ import org.nl.acs.route.service.impl.RouteLineServiceImpl; import org.nl.acs.task.service.TaskService; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; -import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; import org.springframework.beans.factory.annotation.Autowired; import java.util.Date; @@ -50,9 +47,6 @@ import java.util.Map; public class StandardManipulatoDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { protected ItemProtocol itemProtocol = new ItemProtocol(this); - @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); @Autowired InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); @@ -66,9 +60,6 @@ public class StandardManipulatoDeviceDriver extends AbstractOpcDeviceDriver impl DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); @Autowired AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - @Autowired - LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); - //工作模式 int mode = 0; int last_mode = 0; @@ -160,9 +151,14 @@ public class StandardManipulatoDeviceDriver extends AbstractOpcDeviceDriver impl heartbeat = this.itemProtocol.getHeartbeat(); - if (mode != last_mode) { - requireSucess = false; + if (mode != last_mode) {requireSucess = false; } + if (move != last_move) {} + if (action != last_action) {} + if (walk_y != last_walk_y) {} + if (error != last_error) {} + if (task != last_task) {} + if (heartbeat != last_heartbeat) {} if (mode == 0) { this.setIsonline(false); message = "universal_off-line"; @@ -184,12 +180,6 @@ public class StandardManipulatoDeviceDriver extends AbstractOpcDeviceDriver impl } catch (Exception var17) { this.iserror = true; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content(this.device_code + "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); var17.printStackTrace(); } @@ -236,21 +226,16 @@ public class StandardManipulatoDeviceDriver extends AbstractOpcDeviceDriver impl }else { map.put("to_is_labeling","0"); } - this.writing(map); - logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务,返回参数:" + applyManipulatorActionResponse); - message = "universal_message12"; + this.writing(map);message = "universal_message12"; requireSucess = true; } else { map.put("to_command", 99); this.writing(map); requireSucess = true; - message = "universal_message13"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务反馈失败,返回参数:" + applyManipulatorActionResponse); - } + message = "universal_message13";} } public void writing(Map map) { - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); Map itemMap = new LinkedHashMap<>(); map.forEach((key, value) -> { if (ObjectUtil.isNotEmpty(value)) { @@ -258,15 +243,7 @@ public class StandardManipulatoDeviceDriver extends AbstractOpcDeviceDriver impl } }); if (ObjectUtil.isNotEmpty(itemMap)) { - this.control(itemMap); - logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("下发多个电气信号" + itemMap) - .build(); - logDto.setLog_level(3); - luceneExecuteLogService.deviceExecuteLog(logDto); - } + this.control(itemMap);} } public String getToParam() { diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ElevatorDoorDefination.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ElevatorDoorDefination.java new file mode 100644 index 0000000..61a0727 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ElevatorDoorDefination.java @@ -0,0 +1,63 @@ +package org.nl.acs.device_driver.zz_driver.elevator; + +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device.domain.Device; +import org.nl.acs.device.enums.DeviceType; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +/** + * 电梯门驱动定义 + */ +@Service +public class ElevatorDoorDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "elevator_door"; + } + + @Override + public String getDriverName() { + return "电梯门"; + } + + @Override + public String getDriverDescription() { + return "电梯门"; + } + + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new ElevatorDoorDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return ElevatorDoorDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList(); + types.add(DeviceType.conveyor); + return types; + } + + + @Override + public List getReadableItemDtos() { + return ItemProtocol.getReadableItemDtos(); + } + + @Override + public List getWriteableItemDtos() { + return ItemProtocol.getWriteableItemDtos(); + } + +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ElevatorDoorDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ElevatorDoorDeviceDriver.java new file mode 100644 index 0000000..61b1505 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ElevatorDoorDeviceDriver.java @@ -0,0 +1,134 @@ +package org.nl.acs.device_driver.zz_driver.elevator; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.domain.Device; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.acs.utils.ReadUtil; +import org.nl.config.SpringContextHolder; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; +import org.openscada.opc.lib.da.Server; + +import java.util.HashMap; +import java.util.Map; + + +/** + * 电梯门驱动 + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class ElevatorDoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + protected ToElevatorDoorCommandControl toElevatorDoorCommandControl = new ToElevatorDoorCommandControl(this); + private final LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); + + private int open = -1; + private int last_open = -1; + private int call = -1; + private int last_call = -1; + private int fire_open = -1; + private int last_fire_open = -1; + + String device_code = null; + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() { + device_code = this.getDevice().getDevice_code(); + open = this.itemProtocol.getOpen(); + fire_open = this.itemProtocol.getFireOpen(); + call = this.itemProtocol.getCall(); + if (fire_open != last_fire_open) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.device_code) + .content("自动线程读取信号fire_open:" + last_fire_open + "->" + fire_open) + .build()); + } + if (open != last_open) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.device_code) + .content("自动线程读取信号open:" + last_open + "->" + open) + .build()); + } + if (call != last_call) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.device_code) + .content("自动线程读取信号call:" + last_call + "->" + call) + .build()); + } + last_open = open; + last_fire_open = fire_open; + last_call = call; + } + + + public void writing(String param, String value) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + param; + Map itemMap = new HashMap(); + itemMap.put(to_param, Integer.parseInt(value)); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发信号:" + itemMap) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto); + try { + this.toElevatorDoorCommandControl.control(param, value); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void writing(String param, int command) { + String to_command = String.format("%s.%s.%s.%s", 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 itemMap = new HashMap(); + itemMap.put(to_command, command); + ReadUtil.write(itemMap, server); + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(device_code) + .content("下发信号:" + itemMap) + .build()); + log.info("下发PLC信号:{},{}", to_command, command); + System.out.println("设备:" + this.device_code + ",下发PLC信号:" + to_command + ",value:" + command); + + } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String open = ""; + if (this.getOpen() == 0) { + open = "开门到位"; + } else if (this.getOpen() == 1) { + open = "未开门到位"; + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("open", open); + jo.put("isOnline", true); + + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } + + +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ItemProtocol.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ItemProtocol.java new file mode 100644 index 0000000..9644e47 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ItemProtocol.java @@ -0,0 +1,66 @@ +package org.nl.acs.device_driver.zz_driver.elevator; + +import cn.hutool.core.util.StrUtil; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class ItemProtocol { + public static String item_call = "call"; + public static String item_open = "open"; + public static String item_fire_open = "fire_open"; + + + private ElevatorDoorDeviceDriver driver; + + public ItemProtocol(ElevatorDoorDeviceDriver driver) { + this.driver = driver; + } + + public int getOpen() { + return this.getOpcIntegerValue(item_open); + } + public int getFireOpen() { + return this.getOpcIntegerValue(item_fire_open); + } + + public int getCall() { + return this.getOpcIntegerValue(item_call); + } + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + } else { + return value; + } + return -1; + } + + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + //0开到位 1未开到位 + list.add(new ItemDto(item_open, "开门到位", "10001")); + list.add(new ItemDto(item_fire_open, "防火门开到位", "10002")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + //1呼叫电梯 + list.add(new ItemDto(item_call, "呼叫电梯", "00001")); + return list; + } + + + @Override + public String toString() { + return ""; + } +} + diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ToElevatorDoorCommandControl.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ToElevatorDoorCommandControl.java new file mode 100644 index 0000000..2d67570 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/elevator/ToElevatorDoorCommandControl.java @@ -0,0 +1,29 @@ +package org.nl.acs.device_driver.zz_driver.elevator; + + +import org.nl.acs.device_driver.autodoor.standard_autodoor.StandardAutodoorDeviceDriver; + +import java.util.HashMap; +import java.util.Map; + +public class ToElevatorDoorCommandControl { + + private ElevatorDoorDeviceDriver driver; + + public ToElevatorDoorCommandControl(ElevatorDoorDeviceDriver driver){ + this.driver = driver; + } + + public void control(String param, String value) throws Exception { +// ItemValue[] itemValues = new ItemValue[]{new ItemValue(this.driver.getItem(ItemProtocol.item_to_command), command)}; + Map itemMap = new HashMap(); + String to_param = this.driver.getDevice().getOpc_server_code() + "." + this.driver.getDevice().getOpc_plc_code() + "." + this.driver.getDevice().getDevice_code() + + "."+ param; + itemMap.put(to_param, Integer.parseInt(value)); + try { + this.driver.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/production_line_docking_station/ItemProtocol.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/production_line_docking_station/ItemProtocol.java index e9064cd..605c927 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/production_line_docking_station/ItemProtocol.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/production_line_docking_station/ItemProtocol.java @@ -98,18 +98,18 @@ ItemProtocol { public static List getReadableItemDtos() { ArrayList list = new ArrayList<>(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); - list.add(new ItemDto(item_mode, "工作模式", "DB600.B2")); - list.add(new ItemDto(item_move, "光电信号", "DB600.B3")); - list.add(new ItemDto(item_action, "取放信号", "DB600.B4")); - list.add(new ItemDto(item_error, "报警信号", "DB600.B5")); + list.add(new ItemDto(item_heartbeat, "心跳", "03001")); + list.add(new ItemDto(item_mode, "工作模式", "44001")); + list.add(new ItemDto(item_move, "光电信号", "44002")); + list.add(new ItemDto(item_action, "取放信号", "44003")); + list.add(new ItemDto(item_error, "报警信号", "44004")); return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList<>(); - list.add(new ItemDto(item_to_command, "下发命令", "DB601.W0")); - list.add(new ItemDto(item_to_error, "下发故障代码", "DB601.W2")); + list.add(new ItemDto(item_to_command, "下发命令", "44101")); + list.add(new ItemDto(item_to_error, "下发故障代码", "44102")); return list; } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/production_line_docking_station/ProductionLineDockingStationDefination.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/production_line_docking_station/ProductionLineDockingStationDefination.java index 86f0d2b..5d2a734 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/production_line_docking_station/ProductionLineDockingStationDefination.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/production_line_docking_station/ProductionLineDockingStationDefination.java @@ -40,7 +40,7 @@ public class ProductionLineDockingStationDefination implements OpcDeviceDriverDe @Override public List getFitDeviceTypes() { List types = new LinkedList(); - types.add(DeviceType.robot); + types.add(DeviceType.conveyor); return types; } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/production_line_docking_station/ProductionLineDockingStationDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/production_line_docking_station/ProductionLineDockingStationDeviceDriver.java index 28fd0c3..fadd5dd 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/production_line_docking_station/ProductionLineDockingStationDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/production_line_docking_station/ProductionLineDockingStationDeviceDriver.java @@ -10,21 +10,14 @@ import org.nl.acs.device.domain.Device; import org.nl.acs.device.service.DeviceExtraService; import org.nl.acs.device.service.impl.DeviceExtraServiceImpl; import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.ext.wms.data.ApplyManipulatorActionRequest; -import org.nl.acs.ext.wms.data.ApplyManipulatorActionResponse; -import org.nl.acs.ext.wms.data.ApplyPlugPullSitResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; -import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; -import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; @@ -49,8 +42,6 @@ public class ProductionLineDockingStationDeviceDriver extends AbstractOpcDeviceD protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); @Autowired InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); @@ -117,53 +108,48 @@ public class ProductionLineDockingStationDeviceDriver extends AbstractOpcDeviceD action = itemProtocol.getAction(); move = itemProtocol.getMove(); error = itemProtocol.getError(); + + //信号日志 + if (mode != last_mode) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号mode:" + this.last_mode + "->" + this.mode) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto); + requireSucess = false; + } + + if (action != last_action) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号action:" + this.last_action + "->" + this.action) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + + if (move != last_move) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号move:" + this.last_move + "->" + this.move) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + + if (!this.itemProtocol.getIsonline()) { + this.setIsonline(false); + this.setIserror(true); + //未联机 + } else if (mode == 0) { + this.setIsonline(false); + this.setIserror(true); + //有报警 + } else { + this.setIsonline(true); + this.setIserror(false); + } } catch (Exception e) { return; } - - - //信号日志 - if (mode != last_mode) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.item_mode + "变更从" + this.last_mode + "->" + this.mode) - .build(); - logDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(logDto); - requireSucess = false; - } - - if (action != last_action) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.item_action + "变更从" + this.last_action + "->" + this.action) - .build(); - logDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - - if (move != last_move) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.item_move + "变更从" + this.last_move + "->" + this.move) - .build(); - logDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - - if (!this.itemProtocol.getIsonline()) { - this.setIsonline(false); - this.setIserror(true); - //未联机 - } else if (mode == 0) { - this.setIsonline(false); - this.setIserror(true); - //有报警 - } else { - this.setIsonline(true); - this.setIserror(false); - } - last_mode = mode; last_action = action; last_move = move; @@ -181,13 +167,10 @@ public class ProductionLineDockingStationDeviceDriver extends AbstractOpcDeviceD }); if (ObjectUtil.isNotEmpty(itemMap)) { this.checkcontrol(itemMap); - logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("下发多个电气信号" + itemMap) - .build(); - logDto.setLog_level(3); - luceneExecuteLogService.deviceExecuteLog(logDto); + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.getDevice().getDevice_code()) + .content("下发信号:" + itemMap) + .build()); } } @@ -195,6 +178,10 @@ public class ProductionLineDockingStationDeviceDriver extends AbstractOpcDeviceD Map itemMap = new HashMap<>(); itemMap.put(getToParam(commandKey), command); this.control(itemMap); + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.getDevice().getDevice_code()) + .content("下发信号:" + itemMap) + .build()); } public String getToParam(String key) { diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/remove_seal_cover_position/ItemProtocol.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/remove_seal_cover_position/ItemProtocol.java index a0d3e3a..e78eb30 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/remove_seal_cover_position/ItemProtocol.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/remove_seal_cover_position/ItemProtocol.java @@ -22,6 +22,10 @@ ItemProtocol { public static String item_heartbeat = "heartbeat"; //工作模式 0-脱机;1-弃用(留作兼容);2-待机;3-运行中; public static String item_mode = "mode"; + /** + * 光电信号 + */ + public static String item_move = "move"; //取放信号 public static String item_action = "action"; //报警 @@ -49,6 +53,9 @@ ItemProtocol { public int getMode() { return this.getOpcIntegerValue(item_mode); } + public int getMove() { + return this.getOpcIntegerValue(item_move); + } public int getAction() { return this.getOpcIntegerValue(item_action); @@ -97,18 +104,19 @@ ItemProtocol { public static List getReadableItemDtos() { ArrayList list = new ArrayList<>(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); - list.add(new ItemDto(item_mode, "工作模式", "DB600.B2")); - list.add(new ItemDto(item_action, "取放信号", "DB600.B4")); - list.add(new ItemDto(item_error, "报警信号", "DB600.B5")); - list.add(new ItemDto(item_task, "任务号", "DB600.D6")); + list.add(new ItemDto(item_heartbeat, "心跳", "03001")); + list.add(new ItemDto(item_move, "光电信号", "44001")); + list.add(new ItemDto(item_mode, "工作模式", "44002")); + list.add(new ItemDto(item_action, "取放信号", "44003")); + list.add(new ItemDto(item_error, "报警信号", "44004")); + list.add(new ItemDto(item_task, "任务号", "44005")); return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList<>(); - list.add(new ItemDto(item_to_command, "下发命令", "DB601.W2")); - list.add(new ItemDto(item_to_task, "下发故障代码", "DB601.D8")); + list.add(new ItemDto(item_to_command, "下发命令", "44101")); + list.add(new ItemDto(item_to_task, "下发故障代码", "44102")); return list; } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/remove_seal_cover_position/RemoveSealCoverPositionDefination.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/remove_seal_cover_position/RemoveSealCoverPositionDefination.java index 10196d3..df1a6c7 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/remove_seal_cover_position/RemoveSealCoverPositionDefination.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/remove_seal_cover_position/RemoveSealCoverPositionDefination.java @@ -40,7 +40,7 @@ public class RemoveSealCoverPositionDefination implements OpcDeviceDriverDefinat @Override public List getFitDeviceTypes() { List types = new LinkedList(); - types.add(DeviceType.robot); + types.add(DeviceType.conveyor); return types; } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/remove_seal_cover_position/RemoveSealCoverPositionDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/remove_seal_cover_position/RemoveSealCoverPositionDriver.java index 5473c33..60ffa7b 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/remove_seal_cover_position/RemoveSealCoverPositionDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/remove_seal_cover_position/RemoveSealCoverPositionDriver.java @@ -17,7 +17,6 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; @@ -44,8 +43,6 @@ public class RemoveSealCoverPositionDriver extends AbstractOpcDeviceDriver imple protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); @Autowired InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); @@ -66,7 +63,6 @@ public class RemoveSealCoverPositionDriver extends AbstractOpcDeviceDriver imple //0-脱机;1-弃用(留作兼容);2-待机;3-运行中; int mode = 0; int last_mode = 0; - //取放信号 int action = 0; int last_action = 0; @@ -112,6 +108,7 @@ public class RemoveSealCoverPositionDriver extends AbstractOpcDeviceDriver imple device_code = this.getDeviceCode(); heartbeat = itemProtocol.getHeartbeat(); mode = itemProtocol.getMode(); + move = itemProtocol.getMove(); action = itemProtocol.getAction(); task = itemProtocol.getTask(); error = itemProtocol.getError(); @@ -124,9 +121,8 @@ public class RemoveSealCoverPositionDriver extends AbstractOpcDeviceDriver imple if (mode != last_mode) { LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.item_mode + "变更从" + this.last_mode + "->" + this.mode) + .content("自动线程读取信号mode:" + this.last_mode + "->" + this.mode) .build(); - logDto.setLog_level(2); luceneExecuteLogService.deviceExecuteLog(logDto); requireSucess = false; } @@ -134,18 +130,16 @@ public class RemoveSealCoverPositionDriver extends AbstractOpcDeviceDriver imple if (action != last_action) { LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.item_action + "变更从" + this.last_action + "->" + this.action) + .content("自动线程读取信号action:" + this.last_action + "->" + this.action) .build(); - logDto.setLog_level(2); luceneExecuteLogService.deviceExecuteLog(logDto); } if (task != last_task) { LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content("信号" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + ItemProtocol.item_task + "变更从" + this.last_task + "->" + this.task) + .content("自动线程读取信号task:" + this.last_task + "->" + this.task) .build(); - logDto.setLog_level(2); luceneExecuteLogService.deviceExecuteLog(logDto); } @@ -182,13 +176,10 @@ public class RemoveSealCoverPositionDriver extends AbstractOpcDeviceDriver imple }); if (ObjectUtil.isNotEmpty(itemMap)) { this.checkcontrol(itemMap); - logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("下发多个电气信号" + itemMap) - .build(); - logDto.setLog_level(3); - luceneExecuteLogService.deviceExecuteLog(logDto); + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.getDevice().getDevice_code()) + .content("下发信号:" + itemMap) + .build()); } } @@ -196,6 +187,10 @@ public class RemoveSealCoverPositionDriver extends AbstractOpcDeviceDriver imple Map itemMap = new HashMap<>(); itemMap.put(getToParam(commandKey), command); this.control(itemMap); + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.getDevice().getDevice_code()) + .content("下发信号:" + itemMap) + .build()); } public String getToParam(String key) { diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_conveyor/UnpackingConveyorDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_conveyor/UnpackingConveyorDeviceDriver.java index 2de557e..54ba1ae 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_conveyor/UnpackingConveyorDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_conveyor/UnpackingConveyorDeviceDriver.java @@ -12,7 +12,6 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.data.ApplyPlugPullSitResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.history.ErrorUtil; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.config.language.LangProcess; import org.nl.config.lucene.service.LuceneExecuteLogService; @@ -34,8 +33,6 @@ public class UnpackingConveyorDeviceDriver extends AbstractOpcDeviceDriver imple /** 协议 */ protected ItemProtocol itemProtocol = new ItemProtocol(this); @Resource - private DeviceExecuteLogService logServer; - @Resource private LuceneExecuteLogService luceneExecuteLogService; @Resource private AcsToWmsService acsToWmsService; @@ -114,6 +111,36 @@ public class UnpackingConveyorDeviceDriver extends AbstractOpcDeviceDriver imple } catch (Exception e) { return; } + if (heartbeat != last_heartbeat) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号heartbeat:" + last_heartbeat + "->" + heartbeat) + .build()); + } + if (mode != last_mode) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号mode:" + last_mode + "->" + mode) + .build()); + } + if (action != last_action) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号action:" + last_action + "->" + action) + .build()); + } + if (move != last_move) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号move:" + last_move + "->" + move) + .build()); + } + if (error != last_error) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号error:" + last_error + "->" + error) + .build()); + } last_mode = mode; last_action = action; @@ -131,13 +158,10 @@ public class UnpackingConveyorDeviceDriver extends AbstractOpcDeviceDriver imple }); if (ObjectUtil.isNotEmpty(itemMap)) { this.checkcontrol(itemMap); - logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("下发多个电气信号" + itemMap) - .build(); - logDto.setLog_level(3); - luceneExecuteLogService.deviceExecuteLog(logDto); + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.getDevice().getDevice_code()) + .content("下发信号:" + itemMap) + .build()); } } @@ -145,6 +169,10 @@ public class UnpackingConveyorDeviceDriver extends AbstractOpcDeviceDriver imple Map itemMap = new HashMap<>(); itemMap.put(getToParam(commandKey), command); this.control(itemMap); + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.getDevice().getDevice_code()) + .content("下发信号:" + itemMap) + .build()); } public String getToParam(String key) { diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_machine/ItemProtocol.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_machine/ItemProtocol.java index 5a1eee5..75e9a12 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_machine/ItemProtocol.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_machine/ItemProtocol.java @@ -126,10 +126,10 @@ public class ItemProtocol { public static List getReadableItemDtos() { ArrayList list = new ArrayList<>(); // list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(item_mode, "工作模式", "DB1.B1")); - list.add(new ItemDto(item_action, "动作信号", "DB1.B3")); - list.add(new ItemDto(item_gross_weight, "毛重", "DB1.B4")); - list.add(new ItemDto(item_net_weight, "净重", "DB1.B5")); + list.add(new ItemDto(item_mode, "工作模式", "40001")); + list.add(new ItemDto(item_action, "动作信号", "40002")); +// list.add(new ItemDto(item_gross_weight, "毛重", "DB1.B4")); +// list.add(new ItemDto(item_net_weight, "净重", "DB1.B5")); return list; } @@ -139,8 +139,8 @@ public class ItemProtocol { */ public static List getWriteableItemDtos() { ArrayList list = new ArrayList<>(); - list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0")); - list.add(new ItemDto(item_to_operate, "下发操作", "DB2.W2")); + list.add(new ItemDto(item_to_command, "下发命令", "41001")); +// list.add(new ItemDto(item_to_operate, "下发操作", "DB2.W2")); return list; } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_machine/UnpackingMachineDefination.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_machine/UnpackingMachineDefination.java index 7ad7ff1..0de9ca1 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_machine/UnpackingMachineDefination.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_machine/UnpackingMachineDefination.java @@ -45,7 +45,7 @@ public class UnpackingMachineDefination implements OpcDeviceDriverDefination { @Override public List getFitDeviceTypes() { List types = new LinkedList(); - types.add(DeviceType.station); + types.add(DeviceType.conveyor); return types; } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_machine/UnpackingMachineDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_machine/UnpackingMachineDeviceDriver.java index f4bb5aa..1f7fa0d 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_machine/UnpackingMachineDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/zz_driver/unpacking_machine/UnpackingMachineDeviceDriver.java @@ -9,7 +9,6 @@ import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.config.language.LangProcess; import org.nl.config.lucene.service.LuceneExecuteLogService; @@ -32,8 +31,6 @@ public class UnpackingMachineDeviceDriver extends AbstractOpcDeviceDriver implem /** 协议 */ protected ItemProtocol itemProtocol = new ItemProtocol(this); - @Resource - private DeviceExecuteLogService logServer; @Resource private LuceneExecuteLogService luceneExecuteLogService; @@ -93,6 +90,36 @@ public class UnpackingMachineDeviceDriver extends AbstractOpcDeviceDriver implem } catch (Exception e) { return; } + if (mode != last_mode) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号mode:" + last_mode + "->" + mode) + .build()); + } + if (action != last_action) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号action:" + last_action + "->" + action) + .build()); + } + if (move != last_move) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号move:" + last_move + "->" + move) + .build()); + } + if (!gross_weight.equals(last_gross_weight)) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号gross_weight:" + last_gross_weight + "->" + gross_weight) + .build()); + } + if (!net_weight.equals(last_net_weight)) { + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(device_code) + .content("自动线程读取信号net_weight:" + last_net_weight + "->" + net_weight) + .build()); + } if (!this.itemProtocol.getIsonline()) { this.setIsonline(false); this.setIserror(true); @@ -125,13 +152,10 @@ public class UnpackingMachineDeviceDriver extends AbstractOpcDeviceDriver implem }); if (ObjectUtil.isNotEmpty(itemMap)) { this.checkcontrol(itemMap); - logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("下发多个电气信号" + itemMap) - .build(); - logDto.setLog_level(3); - luceneExecuteLogService.deviceExecuteLog(logDto); + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.getDevice().getDevice_code()) + .content("下发信号:" + itemMap) + .build()); } } @@ -140,6 +164,10 @@ public class UnpackingMachineDeviceDriver extends AbstractOpcDeviceDriver implem Map itemMap = new HashMap<>(); itemMap.put(getToParam(commandKey), command); this.control(itemMap); + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(this.getDevice().getDevice_code()) + .content("下发信号:" + itemMap) + .build()); } public String getToParam(String key) { diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/AcsUtil.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/AcsUtil.java index f8736f0..a4a8609 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/AcsUtil.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/AcsUtil.java @@ -7,9 +7,9 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.nl.acs.common.base.CommonFinalParam; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.common.exception.BadRequestException; import org.nl.config.language.LangProcess; +import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.system.service.param.ISysParamService; import org.nl.config.SpringContextHolder; import org.nl.system.service.param.impl.SysParamServiceImpl; @@ -23,7 +23,7 @@ public class AcsUtil { public static String notifyAcs(String api, W requestParam) { - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); + LuceneExecuteLogService logServer = SpringContextHolder.getBean(LuceneExecuteLogService.class); ; ISysParamService paramService = SpringContextHolder.getBean(SysParamServiceImpl.class); //判断是否连接立库WCS系统 diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/LmsUtil.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/LmsUtil.java index 1f3b511..9f983d4 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/LmsUtil.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/LmsUtil.java @@ -6,8 +6,8 @@ import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.config.SpringContextHolder; +import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.system.service.param.ISysParamService; import org.nl.system.service.param.impl.SysParamServiceImpl; @@ -18,7 +18,7 @@ import org.nl.system.service.param.impl.SysParamServiceImpl; public class LmsUtil { public static String notifyAcs(String api, W requestParam) { - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); + LuceneExecuteLogService logServer = SpringContextHolder.getBean(LuceneExecuteLogService.class); ; ISysParamService paramService = SpringContextHolder.getBean(SysParamServiceImpl.class); //判断是否连接立库WCS系统 diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java index 511beaa..3ecaa23 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java @@ -43,40 +43,13 @@ public class WmsToAcsController { return new ResponseEntity<>(wmstoacsService.crateTask(whereJson), HttpStatus.OK); } - @PostMapping("/action") - @Log(value = "WMS下发点位信号") - @SaIgnore - public ResponseEntity putAction(@RequestBody String whereJson) throws Exception { - return new ResponseEntity<>(wmstoacsService.putAction(whereJson), HttpStatus.OK); - } +// @PostMapping("/cancelTask") +// @Log(value = "WMS取消任务") +// @SaIgnore +// public ResponseEntity cancelFromWms(@RequestBody List reqs) throws Exception { +// return new ResponseEntity<>(wmstoacsService.cancelFromWms(reqs), HttpStatus.OK); +// } - @PostMapping("/querydevice") - @Log(value = "WMS查询设备状态") - @SaIgnore - public ResponseEntity queryDevice(@RequestBody String whereJson) throws Exception { - return new ResponseEntity<>(wmstoacsService.queryDevice(whereJson), HttpStatus.OK); - } - - - @PostMapping("/cancelTask") - @Log(value = "WMS取消任务") - @SaIgnore - public ResponseEntity cancelFromWms(@RequestBody List reqs) throws Exception { - return new ResponseEntity<>(wmstoacsService.cancelFromWms(reqs), HttpStatus.OK); - } - - @PostMapping("/updateDeviceGoodsFromWms") - @Log(value = "WMS修改点位状态") - public ResponseEntity updateDeviceGoodsFromWms(@RequestBody String whereJson) { - return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK); - } - - @PostMapping("/updateTask") - @Log(value = "WMS更新任务点位状态") - @SaIgnore - public ResponseEntity updateTask(@RequestBody String whereJson){ - return new ResponseEntity<>(wmstoacsService.updateTask(whereJson), HttpStatus.OK); - } @PostMapping("/areaControl") @Log(value = "区域控制") @@ -84,41 +57,8 @@ public class WmsToAcsController { return new ResponseEntity<>(wmstoacsService.areaControl(whereJson), HttpStatus.OK); } - @PostMapping("/queryDeviceDBValue") - @Log(value = "WMS查询设备DB值") - @SaIgnore - public ResponseEntity queryDeviceDBValue(@RequestBody String whereJson) { - return new ResponseEntity<>(wmstoacsService.queryDeviceDBValue(whereJson), HttpStatus.OK); - } - @PostMapping("/putPlusPullAction") - @Log(value = "WMS下发插拔轴动作") - @SaIgnore - public ResponseEntity putPlusPullAction(@RequestBody String whereJson) { - return new ResponseEntity<>(wmstoacsService.putPlusPullAction(whereJson), HttpStatus.OK); - } - - @PostMapping("/notify") - @Log("wms下发任务动作") - @SaIgnore - public ResponseEntity notify(@RequestBody JSONObject param) { - return new ResponseEntity<>(wmstoacsService.notifyAcs(param), HttpStatus.OK); - } - - @PostMapping("/getTubeMsg") - @Log("下发管芯信息") - @SaIgnore - public ResponseEntity getTubeMes(@RequestBody String whereJson) throws Exception { - return new ResponseEntity<>(wmstoacsService.getTubeMes(whereJson), HttpStatus.OK); - } - - @PostMapping("/agvReleased") - @Log("下发管芯信息") - @SaIgnore - public ResponseEntity agvReleased(@RequestBody String whereJson) throws Exception { - return new ResponseEntity<>(wmstoacsService.agvReleased(whereJson), HttpStatus.OK); - } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index 7c09f23..faf09ca 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -67,23 +67,6 @@ public interface AcsToWmsService { HttpResponse queryDoorsStatus(); - /** - * 申请捆扎、贴标 - * - * @param param - * @return - */ - ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param); - - - /** - * 输送线有货变成无货时向lms请求 - * @param param - * @return - */ - HttpResponse shipDeviceUpdate(JSONObject param); - - /** * 二期入库申请任务 * @param param @@ -98,17 +81,6 @@ public interface AcsToWmsService { */ String applySendOutTwo(JSONObject param); - - /** - * 二期发货申请捆扎、贴标 - * @param param - * @return - */ - String deviceApplyTwo(JSONObject param); - - - String applyTowToOne(JSONObject param); - /** * 反馈AGV取放货状态 * @@ -117,11 +89,6 @@ public interface AcsToWmsService { */ HttpResponse feedAgvTaskStatus(JSONArray from); - /** - * ACS向WMS申请任务 - */ - String applyTaskToWms(JSONObject jo); - /** * ACS向WMS反馈任务状态 * @param arr @@ -129,26 +96,6 @@ public interface AcsToWmsService { */ HttpResponse feedTaskStatus(JSONArray arr); - /** - * ACS向WMS反馈任务状态 - * @param request - * @return - */ - String notify(BaseRequest request); - - /** - * 向WMS申请生箔按钮任务 - * @param param - * @return - */ - ApplyGreenFoilButtonResponse applyGreenFoilButtonTask(ApplyGreenFoilButtonRequest param); - - /** - * 向WMS申请表处机下料位按钮任务 - * @param param - * @return - */ - HttpResponse applyBlankButtonTask(JSONObject param); /** * RGV工位上有货申请行架任务 @@ -157,66 +104,13 @@ public interface AcsToWmsService { */ ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param); - /** - * 向lms申请套管工位请求 - * @param param - * @return - */ - ApplyPlugPullSitResponse applyPlugPullSiteRequest(ApplyPlugPullSiteRequest param); - - /** - * 向LMS反馈子卷重量 - * @param param - * @return - */ - ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeight(ApplyfeedbackSubVolumeWeightRequest param); - - - /** - * 查询站点有无货状态 - * @param inst - * @return - */ - JSONObject queryStationState(Instruction inst); void sendDeviceStatus(JSONObject param); - String applyUpdatePointCode(JSONObject param); - - /** - * 向lms反馈废箔重量 - * @param param - * @return - */ - GetWasteFoilWeightResponse feedbackWeight(GetWasteFoilWeightRequest param); - - String getBoxInfo(JSONObject param); - - String getIsUncap(JSONObject param); - - /** - * 反馈管芯抓取位 - * @param param - * @return - */ - HttpResponse feedbackDies(JSONObject param); - - /** - * 请求密集库出气胀轴,申请行架任务 - * @param param - * @return - */ - HttpResponse callShaftFromCache(JSONObject param); String secondaryAllocationPoint(JSONObject param); - /** - * 行架-agv对接位取货完成反馈 - * @param jsonObject - */ - void actionFinishRequest2(JSONObject jsonObject); - /** * 检测料桶 * @param jsonObject @@ -238,12 +132,5 @@ public interface AcsToWmsService { */ ApplyPlugPullSitResponse actionMove(JSONObject jsonObject); - String forceMove(JSONObject param); - /** - * 向LMS申请气胀轴库点位 - * @param param - * @return - */ - ManipulatorApplyPointResponse manipulatorApplyPointRequest(ManipulatorApplyPointRequest param); } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java index 52e932b..3cb7cb7 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java @@ -2,8 +2,6 @@ package org.nl.acs.ext.wms.service; import com.alibaba.fastjson.JSONObject; -import org.nl.acs.ext.wms.data.PutWeightActionRequest; -import org.nl.acs.ext.wms.data.PutWeightActionResponse; import org.nl.acs.ext.wms.data.one.*; import java.util.List; @@ -15,40 +13,8 @@ public interface WmsToAcsService { * @param param * @return */ - org.nl.acs.ext.wms.data.CreateTaskResponse crateTask(String param); + CreateTaskResponse crateTask(String param); - /** - * 创建任务 - * - * @param reqs - * @return - */ - CreateTaskResponse crateTask(List reqs); - - /** - * 更新任务点位状态 - * - * @param whereJson 条件 - * @return Map - */ - Map updateTask(String whereJson); - - - /** - * 取消任务 - * @param reqs - * @return - * @throws Exception - */ - CancelTaskResponse cancelFromWms(List reqs) throws Exception; - - /** - * 修改设置有无货属性 - * - * @param jsonObject 条件 - * @return Map - */ - Map updateDeviceGoodsFromWms(String jsonObject); /** * 区域控制 @@ -58,58 +24,4 @@ public interface WmsToAcsService { */ Map areaControl(JSONObject jsonObject); - /** - * 下发动作 - * @param jsonObject - * @return - * @throws Exception - */ - org.nl.acs.ext.wms.data.PutActionResponse putAction(String jsonObject) throws Exception; - - /** - * 查询设备状态 - * - * @param jsonObject 条件 - * @return Map - */ - Map queryDevice(String jsonObject) throws Exception; - - /** - * 查询设备DB值 - * - * @param whereJson - * @return - */ - Map queryDeviceDBValue(String whereJson); - - - /** - * ACS系统在获取空的托盘号 - * - * @param whereJson - * @return - */ - Map querydevice(String whereJson); - - - /** - * 下发插拔轴动作 - * - * @param whereJson 条件 - * @return Map - */ - Map putPlusPullAction(String whereJson); - - - /** - * 下发wms任务动作 - * - * @param param 条件 - * @return Map - */ - JSONObject notifyAcs(JSONObject param); - - Map getTubeMes(String whereJson) throws Exception; - - JSONObject agvReleased(String whereJson); } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 095b46e..8c608e8 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -28,7 +28,6 @@ import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingResponse; import org.nl.acs.ext.wms.data.one.BaseRequest; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.domain.Instruction; -import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.config.lucene.service.LuceneExecuteLogService; @@ -62,9 +61,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Autowired TaskService taskService; - @Autowired - DeviceExecuteLogService logServer; - @Autowired private LuceneExecuteLogService luceneLogService; @@ -77,50 +73,33 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { private String log_file_type = "log_file_type"; private String log_type = "ACS请求LMS"; - - @Override - public String applyTaskToWms(JSONObject jo) { - try { - MDC.put(log_file_type, log_type); - log.info("applyTaskToWms-----输入参数{}", jo); - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyTaskToWms"); - String url = wmsurl + addressDto.getMethods_url(); - HttpResponse result2 = null; - try { - result2 = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .header("Authorization", token) - .body(String.valueOf(jo)) - .execute(); - } catch (Exception e) { - String msg = e.getMessage(); - log.info("applyTaskToWms-----输出参数{}", msg); - //网络不通 - } - if (ObjectUtil.isEmpty(result2)) { - log.info("applyTaskToWms-----输出参数{}", "返回结果为空"); - return null; - } - String type = ""; - if (result2.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - log.info("applyTaskToWms-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyTaskToWms", String.valueOf(result2.getStatus()), - JSON.toJSONString(jo), String.valueOf(result2.body()), "ACS向LMS申请生箔按钮任务"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - return result2.body(); - - } finally { - MDC.remove(log_file_type); - } - + private void interfaceStartLog(String requestUrl, String methodName, Object args) { + LuceneLogDto logDto = LuceneLogDto.builder() + .logType("接口日志") + .request_url(requestUrl) + .request_direction("ACS->WMS") + .request_param(JSON.toJSONString(args)) + .method(methodName) + .content("开始请求") + .build(); + luceneLogService.interfaceExecuteLog(logDto); } + private void interfaceResponseLog(String requestUrl, String methodName, Object args, Object result, long startTime) { + LuceneLogDto logDto = LuceneLogDto.builder() + .logType("接口日志") + .request_url(requestUrl) + .request_direction("ACS->WMS") + .request_param(JSON.toJSONString(args)) + .method(methodName) + .response_param(JSON.toJSONString(result)) + .executeTime(System.currentTimeMillis() - startTime) + .content("响应请求") + .build(); + luceneLogService.interfaceExecuteLog(logDto); + } + + @Override public HttpResponse feedbackTaskStatusToWms(JSONArray arr) { return null; @@ -152,15 +131,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return null; } - @Override - public ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param) { - return null; - } - - @Override - public HttpResponse shipDeviceUpdate(JSONObject param) { - return null; - } @Override public HttpResponse applyTwo(JSONObject param) { @@ -171,6 +141,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); AddressDto addressDto = addressService.findByCode("applyTwo"); String url = wmsurl + addressDto.getMethods_url(); + long startTime = System.currentTimeMillis(); + interfaceStartLog(url, "applyTwo", param); try { result2 = HttpRequest.post(url) .addInterceptor(tLogHutoolhttpInterceptor) @@ -184,11 +156,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { //网络不通 } log.info("applyTwo-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyTwo", String.valueOf(result2.getStatus()), - JSON.toJSONString(param), String.valueOf(result2.body()), "ACS向LMS申请" - + ("1".equals(param.getString("type")) ? "子卷装箱入库任务" : "2".equals(param.getString("type")) ? "空盘入库" : "3".equals(param.getString("type")) ? "空盘出库" : "5".equals(param.getString("type")) ? "木箱入库" : - "6".equals(param.getString("type")) ? "退货入库" : "异常处理位")); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "applyTwo", param, result2.body(), startTime); return result2; } finally { @@ -205,6 +173,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { AddressDto addressDto = addressService.findByCode("applySendOutTwo"); String url = wmsurl + addressDto.getMethods_url(); HttpResponse result2 = null; + long startTime = System.currentTimeMillis(); + interfaceStartLog(url, "applySendOutTwo", param); try { result2 = HttpRequest.post(url) .addInterceptor(tLogHutoolhttpInterceptor) @@ -228,9 +198,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { type = "error"; } log.info("applySendOutTwo-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applySendOutTwo", String.valueOf(result2.getStatus()), - JSON.toJSONString(param), String.valueOf(result2.body()), "二期发货申请任务"); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "applySendOutTwo", param, result2.body(), startTime); return result2.body(); } finally { @@ -238,93 +206,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } } - @Override - public String deviceApplyTwo(JSONObject param) { - try { - MDC.put(log_file_type, log_type); - log.info("deviceApplyTwo-----输入参数{}", param); - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("deviceApplyTwo"); - String url = wmsurl + addressDto.getMethods_url(); - HttpResponse result2 = null; - try { - result2 = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .header("Authorization", token) - .body(String.valueOf(param)) - .execute(); - } catch (Exception e) { - String msg = e.getMessage(); - log.info("deviceApplyTwo-----输出参数{}", msg); - //网络不通 - } - if (ObjectUtil.isEmpty(result2)) { - log.info("deviceApplyTwo-----输出参数{}", "返回结果为空"); - return null; - } - String type = ""; - if (result2.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - log.info("deviceApplyTwo-----输出参数{}", result2.body()); - return result2.body(); - - } finally { - MDC.remove(log_file_type); - } - } - - @Override - public String applyTowToOne(JSONObject param) { - try { - MDC.put(log_file_type, log_type); - log.info("sendProductToFirstFloor-----输入参数{}", param); - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("sendProductToFirstFloor"); - String url = wmsurl + addressDto.getMethods_url(); - HttpResponse result2 = null; - try { - result2 = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .header("Authorization", token) - .body(String.valueOf(param)) - .execute(); - } catch (Exception e) { - String msg = e.getMessage(); - log.info("sendProductToFirstFloor-----输出参数{}", msg); - //网络不通 - } - if (ObjectUtil.isEmpty(result2)) { - log.info("sendProductToFirstFloor-----输出参数{}", "返回结果为空"); - return null; - } - String type = ""; - if (result2.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - log.info("sendProductToFirstFloor-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "sendProductToFirstFloor", String.valueOf(result2.getStatus()), - JSON.toJSONString(param), String.valueOf(result2.body()), "二期发货申请捆扎、贴标"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - return result2.body(); - - } finally { - MDC.remove(log_file_type); - } - } @Override public HttpResponse feedAgvTaskStatus(JSONArray from) { return null; } - @Override public HttpResponse feedTaskStatus(JSONArray data) { //feedTaskStatus @@ -345,8 +232,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { AddressDto addressDto = addressService.findByCode("feedTaskStatus"); String methods_url = addressDto.getMethods_url(); + String url = wmsurl + methods_url; + long startTime = System.currentTimeMillis(); + interfaceStartLog(url, "feedTaskStatus", data); try { - result2 = HttpRequest.post(wmsurl + methods_url) + result2 = HttpRequest.post(url) .addInterceptor(tLogHutoolhttpInterceptor) .header(Header.USER_AGENT, "Hutool http") .header("Authorization", token).body(String.valueOf(data)) @@ -354,16 +244,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { // //System.out.println(result2); log.info("feedbackTaskStatusToWms-----执行反馈{}", result2); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "feedTaskStatus", String.valueOf(result2.getStatus()), - String.valueOf(data), String.valueOf(result2.body()), "ACS向WMS反馈任务状态"); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "feedTaskStatus", data, ObjectUtil.isEmpty(result2) ? null : result2.body(), startTime); } catch (Exception e) { String msg = e.getMessage(); //网络不通 // //System.out.println(msg); log.info("feedbackTaskStatusToWms-----输出参数{}", msg); + interfaceResponseLog(url, "feedTaskStatus", data, msg, startTime); CompletableFuture.runAsync(() -> { - retryableUtil.retryable(wmsurl + methods_url, JSON.toJSONString(data), token); + retryableUtil.retryable(url, JSON.toJSONString(data), token); }); } @@ -374,9 +263,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { type = "info"; JSONObject jo = JSONObject.parseObject(result2.body()); log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "feedTaskStatus", String.valueOf(result2.getStatus()), - String.valueOf(data), String.valueOf(result2.body()), "ACS向WMS反馈任务状态"); - luceneLogService.interfaceExecuteLog(luceneLogDto); return result2; } else { type = "error"; @@ -387,160 +273,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } } - @Override - public String notify(BaseRequest request) { - return null; - } - - @Override - public ApplyGreenFoilButtonResponse applyGreenFoilButtonTask(ApplyGreenFoilButtonRequest param) { - ApplyGreenFoilButtonResponse applyGreenFoilButtonResponse = new ApplyGreenFoilButtonResponse(); - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyGreenFoilButtonTask"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - log.info("ApplyGreenFoilButtonRequest----请求参数{}", param); - try { -// String result = ""; - String result = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .body(JSON.toJSONString(param)) - .execute().body(); - JSONObject jsonObject = JSONObject.parseObject(result); - log.info("ApplyGreenFoilButtonResponse----返回参数{}", result); - applyGreenFoilButtonResponse = JSONObject.toJavaObject(jsonObject, ApplyGreenFoilButtonResponse.class); - } catch (Exception e) { - JSONObject map = new JSONObject(); - map.put("status", 400); - map.put("message", e.getMessage()); - return JSONObject.toJavaObject(map, ApplyGreenFoilButtonResponse.class); - } - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyGreenFoilButtonTask", String.valueOf(applyGreenFoilButtonResponse.getCode()), - JSON.toJSONString(param), String.valueOf(applyGreenFoilButtonResponse.getMessage()), "ACS向LMS申请生箔按钮任务"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - } - return applyGreenFoilButtonResponse; - } - - @Override - public HttpResponse applyBlankButtonTask(JSONObject param) { - HttpResponse result = null; - try { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyButtonTask"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - log.info("applyBlankButtonTask----反馈表处按钮请求路径{}", url); - try { - result = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .header("Authorization", token) - .body(String.valueOf(param)) - .execute(); - } catch (Exception e) { - String message = e.getMessage(); - log.info("applyBlankButtonTask----反馈表处按钮请求失败{}", message); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyButtonTask", String.valueOf(result.getStatus()), - JSON.toJSONString(result), - String.valueOf(result.body()), "反馈下发表处任务报错"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - } - log.info("applyBlankButtonTask - 反馈表处按钮{}", result.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyButtonTask", String.valueOf(result.getStatus()), - JSON.toJSONString(result.body()), - String.valueOf(result.body()), "反馈下发表处任务"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - return result; - } finally { - MDC.remove(log_file_type); - - } - } - - @Override - public ApplyPlugPullSitResponse applyPlugPullSiteRequest(ApplyPlugPullSiteRequest param) { - log.info("向lms申请套管工位请求,请求参数{}", param); - String result = ""; - try { - MDC.put(log_file_type, log_type); - ApplyPlugPullSitResponse applyPlugPullSitResponse = new ApplyPlugPullSitResponse(); - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyPlugPullSiteRequest"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - log.info("A向lms申请套管工位请求----请求参数:{}", JSONObject.toJSONString(param)); - try { -// - result = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .body(JSON.toJSONString(param)) - .execute().body(); - JSONObject jsonObject = JSONObject.parseObject(result); - log.info("向lms申请套管工位请求----返回参数{}", ("1".equals(param.getType()) ? "套轴" : "2".equals(param.getType()) ? "套轴完成" : "3".equals(param.getType()) ? "拔轴完成" : - "4".equals(param.getType()) ? "拔轴" : "缓存线已满,生成行架任务")); - applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getstatus()), - JSON.toJSONString(param), String.valueOf(result), "ACS向LMS申请" - + ("1".equals(param.getType()) ? "套轴" : "2".equals(param.getType()) ? "套轴完成" : "3".equals(param.getType()) ? "拔轴完成" : - "4".equals(param.getType()) ? "拔轴" : "缓存线已满,生成行架任务")); - luceneLogService.interfaceExecuteLog(luceneLogDto); - } catch (Exception e) { - JSONObject jsonObject = JSONObject.parseObject(result); - log.info("向lms申请套管工位请求----返回参数{}", e.getMessage()); - applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getstatus()), - JSON.toJSONString(param), - String.valueOf(result), "向lms申请套管工位请求失败"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - } - } - return applyPlugPullSitResponse; - } finally { - MDC.remove(log_file_type); - } - } - - @Override - public ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeight(ApplyfeedbackSubVolumeWeightRequest param) { - log.info("向LMS反馈子卷重量,请求参数{}", param); - String result = ""; - ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeightResponse = new ApplyfeedbackSubVolumeWeightResponse(); - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyfeedbackSubVolumeWeightRequest"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - log.info("向LMS反馈子卷重量----请求参数:{}", JSONObject.toJSONString(param)); - try { -// - result = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .body(JSON.toJSONString(param)) - .execute().body(); - JSONObject jsonObject = JSONObject.parseObject(result); - log.info("向LMS反馈子卷重量----返回参数{}", result); - applyfeedbackSubVolumeWeightResponse = JSONObject.toJavaObject(jsonObject, ApplyfeedbackSubVolumeWeightResponse.class); - } catch (Exception e) { - String message = e.getMessage(); - JSONObject jsonObject = JSONObject.parseObject(result); - log.info("向LMS反馈子卷重量----返回参数{}", result); - applyfeedbackSubVolumeWeightResponse = JSONObject.toJavaObject(jsonObject, ApplyfeedbackSubVolumeWeightResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyManipulatorAction", String.valueOf(applyfeedbackSubVolumeWeightResponse.getCode()), - JSON.toJSONString(param), message, "向LMS反馈子卷重量"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - } - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyfeedbackSubVolumeWeightRequest", String.valueOf(applyfeedbackSubVolumeWeightResponse.getCode()), - JSON.toJSONString(param), String.valueOf(applyfeedbackSubVolumeWeightResponse.getMessage()), "ACS反馈LMS子卷重量"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - } - return applyfeedbackSubVolumeWeightResponse; - } @Override public ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param) { @@ -552,6 +284,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { AddressDto addressDto = addressService.findByCode("applyManipulatorAction"); String methods_url = addressDto.getMethods_url(); String url = wmsUrl + methods_url; + long startTime = System.currentTimeMillis(); + interfaceStartLog(url, "applyManipulatorAction", param); log.info("RGV工位上有货申请行架任务----请求参数:{}", JSONObject.toJSONString(param)); try { result = HttpRequest.post(url) @@ -562,145 +296,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { JSONObject jsonObject = JSONObject.parseObject(result); log.info("RGV工位上有货申请行架任务----返回参数{}", result); applyManipulatorActionResponse = JSONObject.toJavaObject(jsonObject, ApplyManipulatorActionResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyManipulatorAction", String.valueOf(applyManipulatorActionResponse.getCode()), - JSON.toJSONString(param), String.valueOf(result), "RGV工位上有货申请行架任务"); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "applyManipulatorAction", param, result, startTime); } catch (Exception e) { String message = e.getMessage(); JSONObject jsonObject = JSONObject.parseObject(result); log.info("RGV工位上有货申请行架任务----返回参数{}", result); applyManipulatorActionResponse = JSONObject.toJavaObject(jsonObject, ApplyManipulatorActionResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyManipulatorAction", String.valueOf(applyManipulatorActionResponse.getCode()), - JSON.toJSONString(param), String.valueOf(result), "RGV工位上有货申请行架任务失败"); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "applyManipulatorAction", param, result, startTime); } } return applyManipulatorActionResponse; } - @Override - public GetWasteFoilWeightResponse feedbackWeight(GetWasteFoilWeightRequest param) { - log.info("向LMS申请反馈,请求参数{}", param); - try { - MDC.put(log_file_type, log_type); - GetWasteFoilWeightResponse getWasteFoilWeightResponse = new GetWasteFoilWeightResponse(); - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("feedbackWeight"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - log.info("GetWasteFoilWeightRequest----请求参数:{}", JSONObject.toJSONString(param)); - try { -// String result = ""; - String result = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .body(JSON.toJSONString(param)) - .execute().body(); - JSONObject jsonObject = JSONObject.parseObject(result); - log.info("GetWasteFoilWeightResponse----返回参数{}", result); - getWasteFoilWeightResponse = JSONObject.toJavaObject(jsonObject, GetWasteFoilWeightResponse.class); - } catch (Exception e) { - JSONObject map = new JSONObject(); - map.put("status", 400); - map.put("message", e.getMessage()); - return JSONObject.toJavaObject(map, GetWasteFoilWeightResponse.class); - } - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "feedbackWeight", String.valueOf(getWasteFoilWeightResponse.getCode()), - JSON.toJSONString(param), String.valueOf(getWasteFoilWeightResponse), "ACS向LMS申请反馈"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - } - return getWasteFoilWeightResponse; - } finally { - MDC.remove(log_file_type); - - } - } - - @Override - public String getBoxInfo(JSONObject param) { - try { - MDC.put(log_file_type, log_type); - log.info("getBoxInfo-----输入参数{}", param); - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("getBoxInfo"); - String url = wmsurl + addressDto.getMethods_url(); - HttpResponse result2 = null; - try { - result2 = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .header("Authorization", token) - .body(String.valueOf(param)) - .execute(); - } catch (Exception e) { - String msg = e.getMessage(); - log.info("getBoxInfo-----输出参数{}", msg); - //网络不通 - } - if (ObjectUtil.isEmpty(result2)) { - log.info("getBoxInfo-----输出参数{}", "返回结果为空"); - return null; - } - String type = ""; - if (result2.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - log.info("getBoxInfo-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "getBoxInfo", String.valueOf(result2.getStatus()), - JSON.toJSONString(param), String.valueOf(result2.body()), "申请高度等级"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - return result2.body(); - - } finally { - MDC.remove(log_file_type); - } - } - - @Override - public String getIsUncap(JSONObject param) { - try { - MDC.put(log_file_type, log_type); - log.info("getIsUncap-----输入参数{}", param); - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("getIsUncap"); - String url = wmsurl + addressDto.getMethods_url(); - HttpResponse result2 = null; - try { - result2 = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .header("Authorization", token) - .body(String.valueOf(param)) - .execute(); - } catch (Exception e) { - String msg = e.getMessage(); - log.info("getIsUncap-----输出参数{}", msg); - //网络不通 - } - if (ObjectUtil.isEmpty(result2)) { - log.info("getIsUncap-----输出参数{}", "返回结果为空"); - return null; - } - String type = ""; - if (result2.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - log.info("getIsUncap-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "getIsUncap", String.valueOf(result2.getStatus()), - JSON.toJSONString(param), String.valueOf(result2.body()), "申请开盖"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - return result2.body(); - - } finally { - MDC.remove(log_file_type); - } - } - @Override public String secondaryAllocationPoint(JSONObject param) { @@ -710,6 +317,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); AddressDto addressDto = addressService.findByCode("secondaryAllocationPoint"); String url = wmsurl + addressDto.getMethods_url(); + long startTime = System.currentTimeMillis(); + interfaceStartLog(url, "secondaryAllocationPoint", param); HttpResponse result2 = null; try { result2 = HttpRequest.post(url) @@ -734,9 +343,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { type = "error"; } log.info("secondaryAllocationPoint-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "secondaryAllocationPoint", String.valueOf(result2.getStatus()), - JSON.toJSONString(param), String.valueOf(result2.body()), "追加诺宝动作块"); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "secondaryAllocationPoint", param, result2.body(), startTime); return result2.body(); } finally { @@ -745,118 +352,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } - @Override - public String forceMove(JSONObject param) { - try { - MDC.put(log_file_type, log_type); - log.info("forceMove-----输入参数{}", param); - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("forceMove"); - String url = wmsurl + addressDto.getMethods_url(); - HttpResponse result2 = null; - try { - result2 = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .header("Authorization", token) - .body(String.valueOf(param)) - .execute(); - } catch (Exception e) { - String msg = e.getMessage(); - log.info("forceMove-----输出参数{}", msg); - //网络不通 - } - if (ObjectUtil.isEmpty(result2)) { - log.info("forceMove-----输出参数{}", "返回结果为空"); - return null; - } - String type = ""; - if (result2.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - log.info("forceMove-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "forceMove", String.valueOf(result2.getStatus()), - JSON.toJSONString(param), String.valueOf(result2.body()), "追加诺宝动作块"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - return result2.body(); - - } finally { - MDC.remove(log_file_type); - } - } - - @Override - public ManipulatorApplyPointResponse manipulatorApplyPointRequest(ManipulatorApplyPointRequest param) { - log.info("向LMS申请气胀轴库点位,请求参数{}", JSONObject.toJSONString(param)); - String result = ""; - ManipulatorApplyPointResponse manipulatorApplyPointResponse = new ManipulatorApplyPointResponse(); - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("manipulatorApplyPointRequest"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - try { - result = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .body(JSON.toJSONString(param)) - .execute().body(); - JSONObject jsonObject = JSONObject.parseObject(result); - log.info("向LMS申请气胀轴库点位----返回参数{}", result); - manipulatorApplyPointResponse = JSONObject.toJavaObject(jsonObject, ManipulatorApplyPointResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "manipulatorApplyPointRequest", String.valueOf(manipulatorApplyPointResponse.getCode()), - JSON.toJSONString(param), String.valueOf(result), "向LMS申请气胀轴库" + ("1".equals(param.getType()) ? "取货点位" : "放货点位")); - luceneLogService.interfaceExecuteLog(luceneLogDto); - } catch (Exception e) { - String message = e.getMessage(); - JSONObject jsonObject = JSONObject.parseObject(result); - log.info("向LMS申请气胀轴库点位----返回参数{}", result); - manipulatorApplyPointResponse = JSONObject.toJavaObject(jsonObject, ManipulatorApplyPointResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "manipulatorApplyPointRequest", String.valueOf(manipulatorApplyPointResponse.getCode()), - JSON.toJSONString(param), String.valueOf(result), "向LMS申请气胀轴库点位失败"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - } - } - return manipulatorApplyPointResponse; - } - - @Override - public void actionFinishRequest2(JSONObject jsonObject) { - HttpResponse execute = null; - try { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("actionFinishRequest2"); - String url = wmsurl + addressDto.getMethods_url(); - try { - execute = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .body(String.valueOf(jsonObject)) - .execute(); - } catch (Exception e) { - String msg = e.getMessage(); - log.info("feedbackDie-----输出参数{}", msg); - //网络不通 - LuceneLogDto luceneLogDto1 = new LuceneLogDto(4, "actionFinishRequest2", String.valueOf(execute.getStatus()), - String.valueOf(jsonObject), - String.valueOf(execute.body()), jsonObject.getString("task_code") + "设备工位取货完成反馈失败"); - luceneLogService.interfaceExecuteLog(luceneLogDto1); - } - log.info("actionFinishRequest2 - 设备工位取货完成反馈{}", jsonObject); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "actionFinishRequest2", "", - String.valueOf(jsonObject), - "", jsonObject.getString("task_code") + "设备工位取货完成反馈"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - } catch (Exception e) { - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "actionFinishRequest2", String.valueOf(execute.getStatus()), - JSON.toJSONString(execute.body()), - String.valueOf(execute.body()), jsonObject.getString("task_code") + "设备工位取货完成反馈失败"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - } - } - @Override public ApplyPlugPullSitResponse actionCheckMaterialBucket(JSONObject param) { log.info("向lms请求校验料桶编码,请求参数{}", param); @@ -869,6 +364,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { AddressDto addressDto = addressService.findByCode("actionCheckMaterialBucket"); String methods_url = addressDto.getMethods_url(); String url = wmsUrl + methods_url; + long startTime = System.currentTimeMillis(); + interfaceStartLog(url, "actionCheckMaterialBucket", param); log.info("向lms请求校验料桶编码----请求参数:{}", JSONObject.toJSONString(param)); try { result = HttpRequest.post(url) @@ -878,17 +375,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .execute().body(); JSONObject jsonObject = JSONObject.parseObject(result); applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "actionCheckMaterialBucket", String.valueOf(applyPlugPullSitResponse.getstatus()), - JSON.toJSONString(param), String.valueOf(result), "ACS向LMS申请料桶检验"); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "actionCheckMaterialBucket", param, result, startTime); } catch (Exception e) { JSONObject jsonObject = JSONObject.parseObject(result); log.info("向lms请求校验料桶编码----返回参数{}", e.getMessage()); applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "actionCheckMaterialBucket", String.valueOf(applyPlugPullSitResponse.getstatus()), - JSON.toJSONString(param), - String.valueOf(result), "向lms请求校验料桶编码请求失败"); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "actionCheckMaterialBucket", param, result, startTime); } } return applyPlugPullSitResponse; @@ -909,6 +401,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { AddressDto addressDto = addressService.findByCode("uploadMes"); String methods_url = addressDto.getMethods_url(); String url = wmsUrl + methods_url; + long startTime = System.currentTimeMillis(); + interfaceStartLog(url, "uploadMes", param); log.info("向lms请求 ,lms向MES请求放料完成----请求参数:{}", JSONObject.toJSONString(param)); try { result = HttpRequest.post(url) @@ -918,17 +412,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .execute().body(); JSONObject jsonObject = JSONObject.parseObject(result); applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "uploadMes", String.valueOf(applyPlugPullSitResponse.getstatus()), - JSON.toJSONString(param), String.valueOf(result), "ACS向LMS发送物料已经放好"); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "uploadMes", param, result, startTime); } catch (Exception e) { JSONObject jsonObject = JSONObject.parseObject(result); log.info("向lms请求 ,lms向MES请求放料完成----返回参数{}", e.getMessage()); applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "向lms请求 ,lms向MES请求放料完成", String.valueOf(applyPlugPullSitResponse.getstatus()), - JSON.toJSONString(param), - String.valueOf(result), "ACS向LMS发送物料已经放好"); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "uploadMes", param, result, startTime); } } return applyPlugPullSitResponse; @@ -949,6 +438,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { AddressDto addressDto = addressService.findByCode("actionMove"); String methods_url = addressDto.getMethods_url(); String url = wmsUrl + methods_url; + long startTime = System.currentTimeMillis(); + interfaceStartLog(url, "actionMove", param); log.info("向lms请求横移----请求参数:{}", JSONObject.toJSONString(param)); try { result = HttpRequest.post(url) @@ -958,17 +449,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .execute().body(); JSONObject jsonObject = JSONObject.parseObject(result); applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "actionMove", String.valueOf(applyPlugPullSitResponse.getstatus()), - JSON.toJSONString(param), String.valueOf(result), "向lms请求横移"); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "actionMove", param, result, startTime); } catch (Exception e) { JSONObject jsonObject = JSONObject.parseObject(result); log.info("向lms请求校验料桶编码----返回参数{}", e.getMessage()); applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "actionMove", String.valueOf(applyPlugPullSitResponse.getstatus()), - JSON.toJSONString(param), - String.valueOf(result), "向lms请求横移请求失败"); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "actionMove", param, result, startTime); } } return applyPlugPullSitResponse; @@ -978,108 +464,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } @Override - public HttpResponse feedbackDies(JSONObject param) { - HttpResponse result2 = null; - try { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("feedbackDie"); - String url = wmsurl + addressDto.getMethods_url(); - log.info("feedbackDie - 反馈管芯请求路径{}", param); - try { - result2 = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .header("Authorization", token) - .body(String.valueOf(param)) - .execute(); - } catch (Exception e) { - String msg = e.getMessage(); - log.info("feedbackDie-----输出参数{}", msg); - //网络不通 - } - log.info("feedbackDie - 反馈管芯{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "feedbackDie", String.valueOf(result2.getStatus()), - String.valueOf(param), - String.valueOf(result2.body()), "反馈管芯抓取"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - return result2; - } catch (Exception e) { - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "feedbackDie", String.valueOf(result2.getStatus()), - JSON.toJSONString(result2.body()), - String.valueOf(result2.body()), "反馈管芯抓取报错"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - return null; - } - } - - - @Override - public HttpResponse callShaftFromCache(JSONObject param) { - HttpResponse result2 = null; - try { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("callShaftFromCache"); - String url = wmsurl + addressDto.getMethods_url(); - log.info("callShaftFromCache - 请求密集库出气胀轴,申请行架任务请求路径{}", param); - try { - result2 = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .header("Authorization", token) - .body(String.valueOf(param)) - .execute(); - } catch (Exception e) { - String msg = e.getMessage(); - log.info("callShaftFromCache-----请求密集库出气胀轴,申请行架任务输出参数{}", msg); - //网络不通 - } - log.info("callShaftFromCache - 请求密集库出气胀轴,申请行架任务{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "callShaftFromCache", String.valueOf(result2.getStatus()), - String.valueOf(param), - String.valueOf(result2.body()), "请求密集库出气胀轴,申请行架任务"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - return result2; - } catch (Exception e) { - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "callShaftFromCache", String.valueOf(result2.getStatus()), - JSON.toJSONString(result2.body()), - String.valueOf(result2.body()), "请求密集库出气胀轴,申请行架任务报错"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - return null; - } - } - - - @Override - public JSONObject queryStationState(Instruction inst) { - try { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("gccQueryStationState"); - String uri = wmsurl + addressDto.getMethods_url() + "?StartStationCode=" + inst.getStart_point_code() + "&EndStationCode=" + inst.getNext_point_code(); - - log.info("gccQueryStationState - 请求路径{}", uri); - String responseBody = HttpRequest - .get(uri) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .execute() - .body(); - log.info("gccQueryStationState - 响应参数{}", responseBody); - JSONObject jsonObject = JSONObject.parseObject(responseBody); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "gccQueryStationState", String.valueOf(jsonObject.get("code")), - JSON.toJSONString("StartStationCode=" + inst.getStart_point_code() + "&EndStationCode=" + inst.getNext_point_code()), - String.valueOf(jsonObject), "ACS查询站点有无货状态"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - return JSONObject.parseObject(responseBody); - } catch (Exception e) { - JSONObject result = new JSONObject(); - result.put("status", HttpStatus.BAD_REQUEST.value()); - result.put("message", e.getMessage()); - return result; - } - } - - @Override -// @Async public void sendDeviceStatus(JSONObject param) { try { MDC.put(log_file_type, log_type); @@ -1089,6 +473,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { AddressDto addressDto = addressService.findByCode("sendDeviceStatus"); String methods_url = addressDto.getMethods_url(); String url = wmsUrl + methods_url; + long startTime = System.currentTimeMillis(); + interfaceStartLog(url, "sendDeviceStatus", param); log.info("sendDeviceStatus - 请求参数 {}", param); HttpResponse response = HttpRequest .post(url) @@ -1097,10 +483,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .body(param.toString()) .execute(); log.info("sendDeviceStatus - 返回参数 {}", response.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "sendDeviceStatus", String.valueOf(response.getStatus()), - String.valueOf(param), - String.valueOf(response.body()), "向LMS发送设备状态"); - luceneLogService.interfaceExecuteLog(luceneLogDto); + interfaceResponseLog(url, "sendDeviceStatus", param, response.body(), startTime); } } catch (Throwable ignored) { @@ -1108,48 +491,4 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { MDC.remove(log_file_type); } } - - @Override - public String applyUpdatePointCode(JSONObject param) { - try { - MDC.put(log_file_type, log_type); - log.info("applyUpdatePointCode-----输入参数{}", param); - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("deviceApplyExceptional"); - String url = wmsurl + addressDto.getMethods_url(); - HttpResponse result2 = null; - try { - result2 = HttpRequest.post(url) - .addInterceptor(tLogHutoolhttpInterceptor) - .header(Header.USER_AGENT, "Hutool http") - .header("Authorization", token) - .body(String.valueOf(param)) - .execute(); - } catch (Exception e) { - String msg = e.getMessage(); - log.info("applyUpdatePointCode-----输出参数{}", msg); - //网络不通 - } - if (ObjectUtil.isEmpty(result2)) { - log.info("applyUpdatePointCode-----输出参数{}", "返回结果为空"); - return null; - } - String type = ""; - if (result2.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - log.info("applyUpdatePointCode-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, "deviceApplyExceptional", String.valueOf(result2.getStatus()), - JSON.toJSONString(param), String.valueOf(result2.body()), "申请更新点位"); - luceneLogService.interfaceExecuteLog(luceneLogDto); - return result2.body(); - - } finally { - MDC.remove(log_file_type); - } - } - - } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 5c747b3..ae1cdf2 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -7,36 +7,25 @@ import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.domain.Device; -import org.nl.acs.device_driver.agv.ndcone.AgvNdcOneDeviceDriver; -import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver; -import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; -import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; -import org.nl.acs.device_driver.zz_driver.unpacking_machine.UnpackingMachineDeviceDriver; import org.nl.acs.ext.wms.data.*; import org.nl.acs.ext.wms.service.WmsToAcsService; -import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.storage_cell.domain.StorageCell; import org.nl.acs.storage_cell.service.mapper.StorageCellMapper; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; -import org.nl.common.exception.BadRequestException; import org.nl.config.SpringContextHolder; import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import java.math.BigDecimal; @@ -67,18 +56,23 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { private String log_type = "LMS请求ACS"; @Override - public CreateTaskResponse crateTask(String param) { + public org.nl.acs.ext.wms.data.one.CreateTaskResponse crateTask(String param) { try { MDC.put(log_file_type, log_type); log.info("ACS接收WMS任务-----输入参数{}", param); + long startTime = System.currentTimeMillis(); + String requestUrl = "/api/wms/task"; LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("ACS接收WMS任务") - .content("ACS接收WMS任务-----输入参数:" + param) + .logType("接口日志") + .request_url(requestUrl) + .request_direction("WMS->ACS") + .request_param(JSON.toJSONString(param)) + .method("crateTask") + .content("开始请求") .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + luceneExecuteLogService.interfaceExecuteLog(logDto); JSONArray datas = JSONArray.parseArray(param); - CreateTaskResponse response = new CreateTaskResponse(); + org.nl.acs.ext.wms.data.one.CreateTaskResponse response = new org.nl.acs.ext.wms.data.one.CreateTaskResponse(); // ParamService paramService = SpringContextHolder.getBean(ParamService.class); ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); // String cancelTaskCheck = paramService.findByCode(AcsConfig.ISALLOWTASK).getValue(); @@ -261,7 +255,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } if (!StrUtil.isEmpty(vehicle_code)) { TaskDto vehicle_dto = taskserver.findByContainer(vehicle_code); - if (vehicle_dto != null) { + if (vehicle_dto != null && !StrUtil.equals(vehicle_dto.getTask_group_id(),taskGroupId)) { JSONObject json = new JSONObject(); json.put("task_code", task_code); json.put("ext_task_id", ext_task_id); @@ -321,7 +315,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("remark", remark); jo.put("params", params); jo.put("params2", params2); - jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type)); + jo.put("task_type", StrUtil.isEmpty(agv_system_type) ? 1 : Integer.parseInt(agv_system_type)); jo.put("class_type", class_type); jo.put("route_plan_code", route_plan_code); jo.put("paper_array", JSONUtil.toJsonStr(paper_array)); @@ -363,11 +357,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { response.setErrArr(errArr); } LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("ACS接收WMS任务") - .content("ACS接收WMS任务-----返回参数:" + JSON.toJSONString(response)) + .logType("接口日志") + .request_url(requestUrl) + .request_direction("WMS->ACS") + .request_param(JSON.toJSONString(param)) + .method("crateTask") + .response_param(JSON.toJSONString(response)) + .executeTime(System.currentTimeMillis() - startTime) + .content("响应请求") .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); + luceneExecuteLogService.interfaceExecuteLog(logDto1); log.info("ACS接收WMS任务--------------:输出参数:" + JSON.toJSONString(response)); return response; @@ -376,331 +375,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } } - @Override - public org.nl.acs.ext.wms.data.one.CreateTaskResponse crateTask(List reqs) { - return null; - } - - @Override - public Map updateTask(String whereJson) { - JSONArray datas = JSONArray.parseArray(whereJson); - log.info("WMS更新任务点位状态--------------:输入参数" + datas.toString()); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("WMS更新任务点位状态") - .content("WMS更新任务点位状态-----输入参数:" + whereJson) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - JSONArray errArr = new JSONArray(); - if (datas.size() > 0) { - for (int i = 0; i < datas.size(); i++) { - JSONObject jsonObject = datas.getJSONObject(i); - String device_code = jsonObject.getString("device_code"); - String task_code = jsonObject.getString("task_code"); - //1-允许取放; 2-允许离开 - String option = jsonObject.getString("option"); - Instruction inst = instructionService.findByTaskcode(task_code); - if (ObjectUtil.isEmpty(inst)) { - JSONObject jo = new JSONObject(); - jo.put("task_code", task_code); - jo.put("message", "未找到对应任务"); - errArr.add(jo); - continue; - } else { - String carNo = inst.getCarno(); - if (ObjectUtil.isEmpty(carNo)) { - JSONObject jo = new JSONObject(); - jo.put("task_code", task_code); - jo.put("message", "未找到任务对应车号"); - errArr.add(jo); - continue; - } else { - Device device = deviceAppService.findDeviceByCode(carNo); - AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver; - if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { - agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver(); - int phase = agvNdcTwoDeviceDriver.getPhase(); - if (phase == 0x03 || phase == 0x05 || phase == 0x08) { - StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - 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)); - standardOrdinarySiteDeviceDriver.setTask_code(task_code); - } - if (device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver(); - standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option)); - standardOrdinarySiteDeviceDriver.setTask_code(task_code); - } - } else { - JSONObject jo = new JSONObject(); - jo.put("task_code", task_code); - jo.put("message", "AGV未就绪无法设置"); - errArr.add(jo); - continue; - } - } - } - - } - } - } - JSONObject resultJson = new JSONObject(); - if (ObjectUtil.isEmpty(errArr)) { - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - } else { - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "操作失败"); - if (ObjectUtil.isNotEmpty(errArr)) { - resultJson.put("errArr", errArr); - } - } - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("WMS更新任务点位状态") - .content("WMS更新任务点位状态-----返回参数:" + resultJson) - .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); - return resultJson; - } - - @Override - public org.nl.acs.ext.wms.data.one.CancelTaskResponse cancelFromWms(List reqs) throws Exception { - return null; - } - - @Override - public Map updateDeviceGoodsFromWms(String jsonObject) { - return null; - } @Override public Map areaControl(JSONObject jsonObject) { return null; } - @Override - public PutActionResponse putAction(String jsonObject) throws Exception { - log.info("WMS下发点位信号--------------:输入参数" + jsonObject); - String date = new Date().toString(); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("WMS下发点位信号") - .content("WMS下发点位信号-----输入参数:" + jsonObject) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - JSONArray datas = JSONArray.parseArray(jsonObject); - PutActionResponse response = new PutActionResponse(); - JSONArray errArr = new JSONArray(); - for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - PutActionRequest request = JsonUtl.format(data, PutActionRequest.class); - String device_code = request.getDevice_code(); - String code = request.getCode(); - String value = request.getValue(); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } - BeltConveyorDeviceDriver beltConveyorDeviceDriver; - if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { - beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) device.getDeviceDriver(); - beltConveyorDeviceDriver.writing(code, value); - } - } - response.setStatus(200); - response.setMessage("success"); - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("WMS下发点位信号") - .content("WMS下发点位信号-----返回参数:" + JSON.toJSONString(response)) - .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); - log.info("WMS下发点位信号--------------:输出参数:" + JSON.toJSONString(response)); - return response; - } - - - @Override - public Map getTubeMes(String jsonObject) throws Exception { - log.info("下发管芯信息--------------:输入参数" + jsonObject); - JSONArray datas = JSONArray.parseArray(jsonObject); - Map map = new HashMap(); - JSONObject jo = (JSONObject) datas.get(0); - String deviceCode = jo.getString("device_code"); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(deviceCode) - .content("下发管芯信息-----输入参数:" + jsonObject) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code(deviceCode) - .content("下发电气信号--------------:参数" + map) - .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); - return resultJson; - } - - @Override - public JSONObject agvReleased(String jsonObject) { - log.info("下发放行AGV信息--------------:输入参数" + jsonObject); - JSONArray datas = JSONArray.parseArray(jsonObject); - JSONObject param = datas.getJSONObject(0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("ACS接收WMS任务") - .content("ACS接收WMS任务-----输入参数:" + param) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - - String device_code = param.getString("device_code"); - String task_code = param.getString("task_code"); - Instruction inst = instructionService.findByTaskcode(task_code); - JSONArray errArr = new JSONArray(); - if (ObjectUtil.isEmpty(inst)) { - JSONObject jo = new JSONObject(); - jo.put("task_code", task_code); - jo.put("message", "未找到对应任务"); - errArr.add(jo); - } else { - String carNo = inst.getCarno(); - if (ObjectUtil.isEmpty(carNo)) { - JSONObject jo = new JSONObject(); - jo.put("task_code", task_code); - jo.put("message", "未找到任务对应车号"); - errArr.add(jo); - } else { - Device device = deviceAppService.findDeviceByCode(carNo); - AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; - if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { - agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver(); - if (!agvNdcOneDeviceDriver.isAgvReleased()) { - agvNdcOneDeviceDriver.setAgvReleased(true); - } - } - } - } - - JSONObject resultJson = new JSONObject(); - if (ObjectUtil.isEmpty(errArr)) { - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - } else { - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "操作失败"); - if (ObjectUtil.isNotEmpty(errArr)) { - resultJson.put("errArr", errArr); - } - } - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("WMS更新任务点位状态") - .content("WMS更新任务点位状态-----返回参数:" + resultJson) - .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); - return resultJson; - } - - - @Override - public Map queryDevice(String jsonObject) throws Exception { - try { - MDC.put(log_file_type, log_type); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("WMS查询设备状态") - .content("WMS查询设备状态-----输入参数:" + jsonObject) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - JSONArray backja = new JSONArray(); - JSONArray datas = JSONArray.parseArray(jsonObject); - - - //标准版输送线 - BeltConveyorDeviceDriver beltConveyorDeviceDriver; - UnpackingMachineDeviceDriver unpackingMachineDeviceDriver; - - if (datas.size() == 0) { - throw new BadRequestException("缺少输入参数!"); - } - for (int i = 0; i < datas.size(); i++) { - JSONObject jo = new JSONObject(); - JSONObject data = datas.getJSONObject(i); - String parent_device_code = data.getString("device_code"); - String device_code = ""; - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(StringUtils.isNotBlank(parent_device_code), StorageCell::getParent_storage_code, parent_device_code); - StorageCell storageCell = storageCellMapper.selectOne(wrapper); - final JSONObject device_json = (JSONObject) JSON.toJSON(storageCell); - if (!ObjectUtil.isEmpty(device_json)) { - device_code = device_json.get("parent_storage_code") == null ? parent_device_code : (String) device_json.get("storage_code"); - } else { - device_code = parent_device_code; - } - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + parent_device_code); - } - if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { - beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) device.getDeviceDriver(); - jo.put("move", beltConveyorDeviceDriver.getMove()); - jo.put("mode", beltConveyorDeviceDriver.getMode()); - jo.put("device_code", parent_device_code); - } else if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) { - unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver(); - jo.put("move", unpackingMachineDeviceDriver.getMove()); - jo.put("mode", unpackingMachineDeviceDriver.getMode()); - jo.put("gross_weight", unpackingMachineDeviceDriver.getGross_weight()); - jo.put("net_weight", unpackingMachineDeviceDriver.getNet_weight()); - jo.put("device_code", parent_device_code); - } else { - jo.put("device_code", parent_device_code); - } - backja.add(jo); - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - resultJson.put("data", backja); - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("WMS查询设备状态") - .content("WMS查询设备状态-----返回参数:" + resultJson) - .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); - return resultJson; - } finally { - MDC.remove(log_file_type); - } - } - - @Override - public Map queryDeviceDBValue(String whereJson) { - return null; - } - - @Override - public Map querydevice(String whereJson) { - return null; - } - - @Override - public Map putPlusPullAction(String whereJson) { - return null; - } - - @Override - public JSONObject notifyAcs(JSONObject param) { - return null; - } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java index 75a9c70..787e8c6 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java @@ -395,6 +395,14 @@ public interface InstructionService extends CommonService { */ List findAllInstFromCache(); + /** + * 根据任务组查询内存指令 + * + * @param taskGroupId 任务组 + * @return + */ + List findByTaskGroupIdFromCache(String taskGroupId); + /** * 查询相同终点指令的数量 * diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index c73b511..afc115e 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -65,8 +65,6 @@ import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.mapper.InstructionMapper; import org.nl.common.utils.SecurityUtils; import org.nl.config.language.LangProcess; -import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.nl.common.utils.CodeUtil; import org.nl.config.SpringContextHolder; @@ -119,9 +117,6 @@ public class InstructionServiceImpl extends CommonServiceImpl instructions = new CopyOnWriteArrayList(); @@ -391,15 +386,6 @@ public class InstructionServiceImpl extends CommonServiceImpl instructionMybatis = instructionMapper.selectList(Wrappers.lambdaQuery(InstructionMybatis.class) - .eq(InstructionMybatis::getTask_code, dto.getTask_code())); - if (CollUtil.isNotEmpty(instructionMybatis) && instructionMybatis.stream().anyMatch(inst -> inst.getStart_device_code() - .equals(start_device_code))) { - return; - } - } String currentUsername = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); if (StrUtil.isEmpty(dto.getRoute_plan_code())) { @@ -417,9 +403,6 @@ public class InstructionServiceImpl extends CommonServiceImpl shortPathsList = - routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); - if (ObjectUtils.isEmpty(shortPathsList)) { - throw new Exception(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由不通"); - } - if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) { - throw new BadRequestException(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由类型不是agv类型"); - } if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) { NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); // hint ---- - ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto); - } - //判断是否是仙工AGV - if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) { - - if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { - String interactionJson = task.getInteraction_json(); - if (StrUtil.isEmpty(interactionJson)) { - throw new BadRequestException("agv叉车调整长宽参数为空"); - } - InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); - //仙工叉车 - HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto, interactionJsonDTO); - if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { - dto.setSend_status("2"); - } else { - dto.setSend_status("1"); - } - } else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { - //一楼agv任务创建运单序列 - HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto); - if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { - dto.setSend_status("2"); - } else { - dto.setSend_status("1"); - } - } + ndcAgvService.sendAgvInstToNDC(dto); } } catch (Exception e) { dto.setSend_status("2"); log.error(e.getMessage()); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("创建指令报错") - .content("任务号" + dto.getTask_code() + "报错原因:" + e.getMessage()) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); throw e; } + dto.setSend_status("1"); InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class); instructionMapper.insert(entity); instructions.add(dto); @@ -616,9 +553,9 @@ public class InstructionServiceImpl extends CommonServiceImpl 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) { @@ -648,31 +585,19 @@ public class InstructionServiceImpl extends CommonServiceImpl shortPathsList = routeLineService.getShortPathLines( dto.getStart_device_code(), dto.getNext_device_code(), dto.getRoute_plan_code()); - if (ObjectUtils.isEmpty(shortPathsList)) { - throw new Exception(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由不通"); - } - String type = shortPathsList.get(0).getType(); +// if (ObjectUtils.isEmpty(shortPathsList)) { +// throw new Exception(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由不通"); +// } + String type = ObjectUtils.isEmpty(shortPathsList) ? "0" : shortPathsList.get(0).getType(); if (!StrUtil.equals(type, "0")) { // JSONObject instcheckjson = // instwo @@ -838,6 +763,15 @@ public class InstructionServiceImpl extends CommonServiceImpl groupInstructions = this.findByTaskGroupIdFromCache(entity.getTask_group_id()); + for (Instruction groupInstruction : groupInstructions) { + if (ObjectUtil.isNotEmpty(groupInstruction.getTask_group_seq()) + && groupInstruction.getTask_group_seq().compareTo(entity.getTask_group_seq()) < 0) { + throw new BadRequestException("同组前序指令仍在缓存中,不能完成当前指令,前序指令号:" + groupInstruction.getInstruction_code()); + } + } + } String currentUsername = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); entity.setUpdate_time(now); @@ -918,11 +852,19 @@ public class InstructionServiceImpl extends CommonServiceImpl groupInstructions = this.findByTaskGroupIdFromCache(dto.getTask_group_id()); + for (Instruction groupInstruction : groupInstructions) { + if (ObjectUtil.isNotEmpty(groupInstruction.getTask_group_seq()) + && groupInstruction.getTask_group_seq().compareTo(dto.getTask_group_seq()) < 0) { + throw new BadRequestException("同组前序指令仍在缓存中,不能完成当前指令,前序指令号:" + groupInstruction.getInstruction_code()); + } + } + } String now = DateUtil.now(); dto.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex()); dto.setUpdate_time(now); @@ -974,11 +929,19 @@ public class InstructionServiceImpl extends CommonServiceImpl list = routeLineService.getShortPathLines( dto.getNext_device_code(), acsTask.getNext_device_code(), acsTask.getRoute_plan_code()); - if (ObjectUtils.isEmpty(list)) { - throw new BadRequestException(LangProcess.msg("route_isNull")); - } - RouteLineDto routeLineDto = (RouteLineDto) list.get(0); - String[] path = routeLineDto.getPath().split("->"); - List pathlist = Arrays.asList(path); - int index = 0; - for (int m = 0; m < pathlist.size(); m++) { - if (pathlist.get(m).equals(dto.getNext_device_code())) { - index = m + 1; - if (StrUtil.equals(deviceAppService.findDeviceTypeByCode(pathlist.get(index)), DeviceType.stacker.name())) { - index += 1; + String next_device_code = acsTask.getNext_device_code(); + if (ObjectUtils.isNotEmpty(list)) { + RouteLineDto routeLineDto = (RouteLineDto) list.get(0); + String[] path = routeLineDto.getPath().split("->"); + List pathlist = Arrays.asList(path); + int index = 0; + for (int m = 0; m < pathlist.size(); m++) { + if (pathlist.get(m).equals(dto.getNext_device_code())) { + index = m + 1; + if (StrUtil.equals(deviceAppService.findDeviceTypeByCode(pathlist.get(index)), DeviceType.stacker.name())) { + index += 1; + } + break; } - break; } + next_device_code = pathlist.get(index); } - String next_device_code = pathlist.get(index); String start_device_code = dto.getNext_device_code(); String start_point_code = null; String next_point_code = null; @@ -1094,12 +1061,6 @@ public class InstructionServiceImpl extends CommonServiceImpl findByTaskGroupIdFromCache(String taskGroupId) { + return Optional.ofNullable(this.instructions) + .orElse(new CopyOnWriteArrayList<>()) + .stream() + .filter(instruction -> StrUtil.equals(taskGroupId, instruction.getTask_group_id())) + .collect(Collectors.toList()); + } + @Override public Integer querySameDestinationInst(String deviceCode) { return (int) Optional diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java index ace2d51..d0eb489 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java @@ -3,23 +3,18 @@ package org.nl.acs.opc; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; import lombok.extern.slf4j.Slf4j; -import org.nl.acs.AcsConfig; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.opc.service.dto.OpcServerManageDto; import org.nl.acs.udw.UnifiedDataAccessor; import org.nl.acs.udw.UnifiedDataAccessorFactory; import org.nl.acs.udw.UnifiedDataAppService; -import org.nl.common.enums.LogTypeEnum; import org.nl.config.SpringContextHolder; import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; -import org.nl.system.service.param.ISysParamService; import org.openscada.opc.lib.da.*; import java.util.*; -import java.util.regex.Pattern; @Slf4j @@ -206,7 +201,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC if (!UnifiedDataAppService.isEquals(value, his)) { OpcItemDto itemDto = this.getItem(itemId); if (true) { - this.logItemChanged(itemId, accessor_value, value, itemDto); + this.logItemChanged(itemId, accessor_value, his, value, itemDto); } if(!ObjectUtil.isEmpty(value) || "".equals(value)){ accessor_value.setValue(itemId, value); @@ -242,7 +237,6 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC .device_code("OPC数据源") .content("OPC数据源:" + tag + "内容为:" + itemDto) .build(); - logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } ThreadUtl.sleep( 3000); @@ -269,7 +263,6 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC .device_code("OPC数据源") .content("OPC数据源:" + tag + "内容为:" + all_null) .build(); - logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); ThreadUtl.sleep((long) (5000)); break start; @@ -412,10 +405,11 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC try { Object value = OpcUtl.getValue(item, itemState); UnifiedDataAccessor accessor_value = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key); + Object his = accessor_value.getValue(itemId); accessor_value.setValue(itemId, value); log.trace("Item {} new value: {}, Timestamp: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime()}); OpcItemDto itemDto = this.getItem(itemId); - this.logItemChanged(itemId, accessor_value, value, itemDto); + this.logItemChanged(itemId, accessor_value, his, value, itemDto); } catch (Exception var7) { log.error(itemId, var7); @@ -423,9 +417,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC } - private void logItemChanged(String itemId, UnifiedDataAccessor accessor_value, Object value, OpcItemDto itemDto) { - ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); - Object his = accessor_value.getValue(itemId); + private void logItemChanged(String itemId, UnifiedDataAccessor accessor_value, Object his, Object value, OpcItemDto itemDto) { List relate_items = itemDto.getRelate_items(); if (relate_items != null && !relate_items.isEmpty()) { StringBuilder sb = new StringBuilder(); @@ -440,33 +432,23 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC && !itemDto.getItem_code().endsWith("x") && !itemDto.getItem_code().endsWith("y")) { // 存在上次点位值为null情况 则不记录日志 if(!(his instanceof Float) && !(value instanceof Float)){ - LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(),4, itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1), - String.valueOf(his), String.valueOf(value)); - luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc()); - String logLevel = paramService.findByCode(AcsConfig.LOGLEVEL).getValue(); - if(StrUtil.isNotEmpty(logLevel) && isNumeric(logLevel) && (luceneLogDto.getLog_level() >= Integer.parseInt(logLevel))){ - log.info("{}", JSON.toJSONString(luceneLogDto)); - } + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(itemDto.getDevice_code()) + .content("OPC线程读取信号" + itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1) + ":" + his + "->" + value) + .build()); } } } else { if (!itemDto.getItem_code().endsWith("heartbeat") && !itemDto.getItem_code().endsWith("time") && !itemDto.getItem_code().endsWith("consumption") && !itemDto.getItem_code().endsWith("x") && !itemDto.getItem_code().endsWith("y")) { if(!(his instanceof Float) && !(value instanceof Float)){ - LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(),4, itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1), - String.valueOf(his), String.valueOf(value)); - luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc()); - String logLevel = paramService.findByCode(AcsConfig.LOGLEVEL).getValue(); - if(StrUtil.isNotEmpty(logLevel) && isNumeric(logLevel) && (luceneLogDto.getLog_level() >= Integer.parseInt(logLevel))){ - log.info("{}", JSON.toJSONString(luceneLogDto)); - } + luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder() + .device_code(itemDto.getDevice_code()) + .content("OPC线程读取信号" + itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1) + ":" + his + "->" + value) + .build()); } } } } - public static boolean isNumeric(String str) { - return Pattern.compile("^[0-9]+$").matcher(str).matches(); - } - } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/domain/Task.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/domain/Task.java index ba81ec9..7ab4173 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/domain/Task.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/domain/Task.java @@ -241,6 +241,9 @@ public class Task extends CommonModel implements Serializable { private String oven_time; + @TableField("car_no") + private String carno; + private String interaction_json; diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java index 11d00b7..012d31f 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java @@ -484,6 +484,14 @@ public interface TaskService extends CommonService { */ List findAllTaskFromCache(); + /** + * 根据任务组查询内存任务 + * + * @param taskGroupId 任务组 + * @return + */ + List findByTaskGroupIdFromCache(String taskGroupId); + /** * 格式化任务 * diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 1ae68be..d7b1345 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -27,6 +27,7 @@ import org.nl.acs.device.service.DeviceAssignedService; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.dto.DeviceAssignedDto; import org.nl.acs.device.service.impl.DeviceServiceImpl; +import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver; import org.nl.acs.device_driver.DeviceDriverDefination; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.domain.Instruction; @@ -72,6 +73,7 @@ import org.springframework.data.domain.Pageable; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.math.BigDecimal; import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CopyOnWriteArrayList; @@ -606,7 +608,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme dto.setInteraction_json(ObjectUtil.isNotEmpty(dto.getInteractionJson()) ? dto.getInteractionJson().toJSONString() : ""); if (!StrUtil.isEmpty(dto.getVehicle_code())) { TaskDto vehicle_dto = this.findByContainer(dto.getVehicle_code()); - if (vehicle_dto != null) { + if (vehicle_dto != null && !StrUtil.equals(vehicle_dto.getTask_group_id(),dto.getTask_group_id())) { throw new BadRequestException(LangProcess.msg("task_checkExist", dto.getVehicle_code())); } } @@ -621,6 +623,12 @@ public class TaskServiceImpl extends CommonServiceImpl impleme task_code = CodeUtil.getNewCode("TASK_NO"); task_code = CommonFinalParam.HYPHEN_ + task_code; } + if (StrUtil.isEmpty(dto.getTask_group_id())) { + dto.setTask_group_id(IdUtil.simpleUUID()); + } + if (ObjectUtil.isEmpty(dto.getTask_group_seq())) { + dto.setTask_group_seq(BigDecimal.ONE); + } String start_point_code; String next_point_code = dto.getNext_point_code(); String start_device_code = dto.getStart_device_code(); @@ -644,15 +652,15 @@ public class TaskServiceImpl extends CommonServiceImpl impleme // 判断起点终点设备类型 String startDeviceType = deviceAppService.findDeviceTypeByCode(dto.getStart_device_code()); String nextDeviceType = deviceAppService.findDeviceTypeByCode(dto.getNext_device_code()); - // 同一排转库任务不做路由校验 - if (!(StrUtil.equals(DeviceType.storage.toString(), startDeviceType) && StrUtil.equals(DeviceType.storage.toString(), nextDeviceType) && StrUtil.equals(start_device_code, next_device_code))) { - if (routeLineService - .getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code) - .size() - == 0) { - throw new BadRequestException(dto.getStart_point_code() + "->" + dto.getNext_point_code() + " " + LangProcess.msg("route_isNull")); - } - } +// // 同一排转库任务不做路由校验 +// if (!(StrUtil.equals(DeviceType.storage.toString(), startDeviceType) && StrUtil.equals(DeviceType.storage.toString(), nextDeviceType) && StrUtil.equals(start_device_code, next_device_code))) { +// if (routeLineService +// .getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code) +// .size() +// == 0) { +// throw new BadRequestException(dto.getStart_point_code() + "->" + dto.getNext_point_code() + " " + LangProcess.msg("route_isNull")); +// } +// } String createTaskCheck = paramService.findByCode(AcsConfig.CREATETASKCHECK).getValue(); DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); @@ -893,6 +901,16 @@ public class TaskServiceImpl extends CommonServiceImpl impleme throw new BadRequestException(LangProcess.msg("error_sysAuth")); } + if (StrUtil.isNotEmpty(entity.getTask_group_id()) && ObjectUtil.isNotEmpty(entity.getTask_group_seq())) { + List groupTasks = this.findByTaskGroupIdFromCache(entity.getTask_group_id()); + for (TaskDto groupTask : groupTasks) { + if (ObjectUtil.isNotEmpty(groupTask.getTask_group_seq()) + && groupTask.getTask_group_seq().compareTo(entity.getTask_group_seq()) < 0) { + throw new BadRequestException("同组前序任务仍在缓存中,不能操作当前任务,前序任务号:" + groupTask.getTask_code()); + } + } + } + InstructionDto instdto = instructionService.findByTaskid(taskIdAndStatus.getTask_id(), "instruction_status <2 "); if (instdto != null) { throw new BadRequestException(LangProcess.msg("task_insHas")); @@ -925,6 +943,16 @@ public class TaskServiceImpl extends CommonServiceImpl impleme throw new BadRequestException(LangProcess.msg("error_sysAuth")); } + if (StrUtil.isNotEmpty(entity.getTask_group_id()) && ObjectUtil.isNotEmpty(entity.getTask_group_seq())) { + List groupTasks = this.findByTaskGroupIdFromCache(entity.getTask_group_id()); + for (TaskDto groupTask : groupTasks) { + if (ObjectUtil.isNotEmpty(groupTask.getTask_group_seq()) + && groupTask.getTask_group_seq().compareTo(entity.getTask_group_seq()) > 0) { + throw new BadRequestException("同组后续任务仍在缓存中,不能取消当前任务,后续任务号:" + groupTask.getTask_code()); + } + } + } + InstructionDto instdto = instructionService.findByTaskid(id, "instruction_status <2 "); if (instdto != null) { throw new BadRequestException(LangProcess.msg("task_insRun")); @@ -988,6 +1016,23 @@ public class TaskServiceImpl extends CommonServiceImpl impleme throw new BadRequestException(LangProcess.msg("error_sysAuth")); } + if (StrUtil.isNotEmpty(entity.getTask_group_id()) && ObjectUtil.isNotEmpty(entity.getTask_group_seq())) { + List groupTasks = this.findByTaskGroupIdFromCache(entity.getTask_group_id()); + for (TaskDto groupTask : groupTasks) { + if (ObjectUtil.isNotEmpty(groupTask.getTask_group_seq()) + && groupTask.getTask_group_seq().compareTo(entity.getTask_group_seq()) > 0) { + throw new BadRequestException("同组后续任务仍在缓存中,不能取消当前任务,后续任务号:" + groupTask.getTask_code()); + } + } + List groupInstructions = instructionService.findByTaskGroupIdFromCache(entity.getTask_group_id()); + for (Instruction groupInstruction : groupInstructions) { + if (ObjectUtil.isNotEmpty(groupInstruction.getTask_group_seq()) + && groupInstruction.getTask_group_seq().compareTo(entity.getTask_group_seq()) > 0) { + throw new BadRequestException("同组后续指令仍在缓存中,不能取消当前任务,后续指令号:" + groupInstruction.getInstruction_code()); + } + } + } + InstructionDto instdto = instructionService.findByTaskid(id, "instruction_status <2 "); if (instdto != null) { instructionService.cancel(instdto.getInstruction_id()); @@ -1019,12 +1064,23 @@ public class TaskServiceImpl extends CommonServiceImpl impleme if (acsTask == null) { throw new BadRequestException(LangProcess.msg("error_sysAuth")); } - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); InstructionDto inst = instructionservice.findByTaskid(ids, "instruction_status < 2 "); if (inst != null) { throw new BadRequestException(LangProcess.msg("task_insRun")); } + if (StrUtil.isNotEmpty(acsTask.getTask_group_id()) && ObjectUtil.isNotEmpty(acsTask.getTask_group_seq())) { + List groupTasks = this.findByTaskGroupIdFromCache(acsTask.getTask_group_id()); + for (TaskDto groupTask : groupTasks) { + if (ObjectUtil.isNotEmpty(groupTask.getTask_group_seq()) + && groupTask.getTask_group_seq().compareTo(acsTask.getTask_group_seq()) < 0) { + InstructionDto beforeInst = instructionservice.findByTaskid(groupTask.getTask_id(), "instruction_status < 2 "); + if (beforeInst == null) { + throw new BadRequestException("同组前序任务未创建指令,任务号:" + groupTask.getTask_code()); + } + } + } + } String taskid = acsTask.getTask_id(); String taskcode = acsTask.getTask_code(); @@ -1044,40 +1100,6 @@ public class TaskServiceImpl extends CommonServiceImpl impleme String task_type = acsTask.getTask_type(); String start_height = acsTask.getStart_height(); String next_height = acsTask.getNext_height(); - /** 开始平均分解校验 */ - String this_device_code = - this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code()); - if (StrUtil.isEmpty(this_device_code)) { - List shortPathsList = - routeLineService.getShortPathLines( - start_device_code, acsTask.getNext_device_code(), route_plan_code); - if (shortPathsList.size() == 0) { - throw new BadRequestException(start_device_code + "->" + acsTask.getNext_device_code() + "路由不存在!"); - } - Device startDevice = deviceAppService.findDeviceByCode(start_device_code); - Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); - RouteLineDto routeLineDto = shortPathsList.get(0); - String path = routeLineDto.getPath(); - String type = routeLineDto.getType(); - String[] str = path.split("->"); - List pathlist = Arrays.asList(str); - int index = 0; - for (int m = 0; m < pathlist.size(); m++) { - if (pathlist.get(m).equals(start_device_code)) { - index = m + 1; - break; - } - } - next_device_code = pathlist.get(index); - } else { - next_device_code = this_device_code; - } - if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) { - next_point_code = next_device_code + CommonFinalParam.HYPHEN_ + acsTask.getTo_y() + CommonFinalParam.HYPHEN_ + acsTask.getTo_z(); - } else { - next_point_code = next_device_code; - } - Instruction instdto = new Instruction(); instdto.setInstruction_type(task_type); instdto.setInstruction_id(IdUtil.simpleUUID()); @@ -1107,30 +1129,53 @@ public class TaskServiceImpl extends CommonServiceImpl impleme instdto.setStart_height(start_height); instdto.setNext_height(next_height); instdto.setAgv_action_type(acsTask.getAgv_action_type()); - if (StrUtil.equals(agv_system_type, CommonFinalParam.TWO)) { - // task_type - //1、生箔; Itype=1:取空,取满,放空,放满; - //2、分切 Itype=3取满、取空、放满、放空; - //3、普通任务 Itype=2:取货、放货; - //4、叉车任务 - //5、输送任务 - //6、行架 - //7、立库 - if (StrUtil.equals(task_type, CommonFinalParam.ONE)) { - instdto.setAgv_inst_type(CommonFinalParam.ONE); - } else if (StrUtil.equals(task_type, "3")) { - instdto.setAgv_inst_type("2"); - } else if (StrUtil.equals(task_type, "2")) { - instdto.setAgv_inst_type("3"); - } else if (StrUtil.equals(task_type, "8")) { - instdto.setAgv_inst_type("2"); - } else { - log.info("未找到对应的AGV指令类型,任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type()); + instdto.setAgv_inst_type(task_type); + String finalCarNo = acsTask.getCarno(); + if (AgvSystemTypeEnum.Two_NDC_System_Type.getIndex().equals(agv_system_type)) { + String canAgvCar = Optional.ofNullable(paramService.findByCode("can_agv_car")) + .map(param -> param.getValue()) + .filter(StrUtil::isNotEmpty) + .orElse("1,2"); + List canAgvCars = Arrays.stream(canAgvCar.split(",")) + .map(String::trim) + .filter(StrUtil::isNotEmpty) + .collect(Collectors.toList()); + boolean currentCarCanIssued = false; + if (StrUtil.isNotEmpty(finalCarNo) && canAgvCars.contains(finalCarNo)) { + Device currentAgv = deviceAppService.findDeviceByCode(finalCarNo); + if (ObjectUtil.isNotEmpty(currentAgv) && currentAgv.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { + AgvNdcTwoDeviceDriver currentDriver = (AgvNdcTwoDeviceDriver) currentAgv.getDeviceDriver(); + currentCarCanIssued = currentDriver.isCanIssued(); + } + } + if (!currentCarCanIssued) { + String backupCarNo = null; + for (String carNo : canAgvCars) { + if (StrUtil.equals(carNo, finalCarNo)) { + continue; + } + Device backupAgv = deviceAppService.findDeviceByCode(carNo); + if (ObjectUtil.isEmpty(backupAgv) || !(backupAgv.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver)) { + continue; + } + AgvNdcTwoDeviceDriver backupDriver = (AgvNdcTwoDeviceDriver) backupAgv.getDeviceDriver(); + if (backupDriver.isCanIssued()) { + backupCarNo = carNo; + break; + } + } + if (StrUtil.isEmpty(backupCarNo)) { + throw new BadRequestException("任务车辆不可下发,且无其它可下发车辆,任务号:" + taskcode); + } + finalCarNo = backupCarNo; + acsTask.setCarno(finalCarNo); } - } else { - instdto.setAgv_inst_type("4"); } - instructionservice.create2(instdto); + instdto.setCarno(finalCarNo); + instdto.setTask_group_id(acsTask.getTask_group_id()); + instdto.setTask_group_seq(acsTask.getTask_group_seq()); + instdto.setSend_status(CommonFinalParam.ZERO); + instructionservice.create(instdto); acsTask.setTask_status(CommonFinalParam.ONE); this.update(acsTask); return instdto; @@ -1200,6 +1245,15 @@ public class TaskServiceImpl extends CommonServiceImpl impleme return this.tasks; } + @Override + public List findByTaskGroupIdFromCache(String taskGroupId) { + return Optional.ofNullable(this.tasks) + .orElse(new CopyOnWriteArrayList<>()) + .stream() + .filter(task -> StrUtil.equals(taskGroupId, task.getTask_group_id())) + .collect(Collectors.toList()); + } + @Override public TaskDto findByContainer(String container_code) { Optional optionalTask = tasks.stream() diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/config/AsyncLuceneAppender.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/config/AsyncLuceneAppender.java index 1c11641..d5156de 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/config/AsyncLuceneAppender.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/config/AsyncLuceneAppender.java @@ -37,11 +37,7 @@ public class AsyncLuceneAppender extends AspectLogbackAsyncAppender { } MDC.clear(); } - try { - super.append(event); - }catch (Exception e){ - e.printStackTrace(); - } + super.append(event); } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/config/LuceneAppender.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/config/LuceneAppender.java index 9e9bdcd..366fd19 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/config/LuceneAppender.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/config/LuceneAppender.java @@ -95,11 +95,23 @@ public class LuceneAppender extends AppenderBase { if (ObjectUtil.isNotEmpty(luceneLogDto.getStatus_code())) { document.add(new StringField("status_code", luceneLogDto.getStatus_code(), Field.Store.YES)); } - if (ObjectUtil.isNotEmpty(luceneLogDto.getRequestparam())) { - document.add(new StringField("requestparam", luceneLogDto.getRequestparam(), Field.Store.YES)); + if (ObjectUtil.isNotEmpty(luceneLogDto.getRequest_param())) { + document.add(new StringField("request_param", luceneLogDto.getRequest_param(), Field.Store.YES)); } - if (ObjectUtil.isNotEmpty(luceneLogDto.getResponseparam())) { - document.add(new StringField("responseparam", luceneLogDto.getResponseparam(), Field.Store.YES)); + if (ObjectUtil.isNotEmpty(luceneLogDto.getResponse_param())) { + document.add(new StringField("response_param", luceneLogDto.getResponse_param(), Field.Store.YES)); + } + if (ObjectUtil.isNotEmpty(luceneLogDto.getRequest_url())) { + document.add(new StringField("request_url", luceneLogDto.getRequest_url(), Field.Store.YES)); + } + if (ObjectUtil.isNotEmpty(luceneLogDto.getDeviceLogType())) { + document.add(new StringField("deviceLogType", luceneLogDto.getDeviceLogType(), Field.Store.YES)); + } + if (ObjectUtil.isNotEmpty(luceneLogDto.getRequest_direction())) { + document.add(new StringField("request_direction", luceneLogDto.getRequest_direction(), Field.Store.YES)); + } + if (ObjectUtil.isNotEmpty(luceneLogDto.getExecuteTime())) { + document.add(new StringField("executeTime", luceneLogDto.getExecuteTime() + "", Field.Store.YES)); } document.add(new StringField("logType", luceneLogDto.getLogType(), Field.Store.YES)); document.add(new StringField("logTime", DateUtil.format(new DateTime(), "yyyy-MM-dd HH:mm:ss.SSS"), Field.Store.YES)); diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/enums/DeviceLogTypeEnum.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/enums/DeviceLogTypeEnum.java new file mode 100644 index 0000000..14d3bd3 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/enums/DeviceLogTypeEnum.java @@ -0,0 +1,19 @@ +package org.nl.config.lucene.enums; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +/** + * @Description TODO + * @Author Gengby + * @Date 2024/4/10 + */ +@Getter +@RequiredArgsConstructor +public enum DeviceLogTypeEnum { + AUTO_THREAD("auto", "设备线程线程"), + MQTT("mqtt", "OPC线程"); + + private final String code; + private final String name; +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/rest/LuceneController.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/rest/LuceneController.java index 9beeff5..7e97f1f 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/rest/LuceneController.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/rest/LuceneController.java @@ -1,10 +1,11 @@ package org.nl.config.lucene.rest; - import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.common.logging.annotation.Log; +import org.nl.config.lucene.enums.DeviceLogTypeEnum; +import org.nl.config.lucene.enums.LogTypeEnum; import org.nl.config.lucene.service.LuceneService; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; @@ -14,7 +15,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.util.Arrays; import java.util.Map; +import java.util.stream.Collectors; @RestController @@ -27,19 +30,40 @@ public class LuceneController { private final LuceneService luceneService; - @GetMapping("/getAll") @Log("日志检索") - - //@PreAuthorize("@el.check('task:list')") public ResponseEntity get(@RequestParam Map whereJson, Pageable page) { return new ResponseEntity<>(luceneService.getAll(whereJson, page), HttpStatus.OK); } - @GetMapping("/getAddressLog") - @Log("接口日志检索") - //@PreAuthorize("@el.check('task:list')") - public ResponseEntity getAddressLog(@RequestParam Map whereJson, Pageable page) { - return new ResponseEntity<>(luceneService.getAddressLog(whereJson, page), HttpStatus.OK); + @GetMapping("/getDeviceLogType") + @Log("获取设备日志类型") + public ResponseEntity getDeviceLogType() { + return new ResponseEntity<>(Arrays.stream(DeviceLogTypeEnum.values()) + .map(type -> { + Map map = new java.util.HashMap<>(); + map.put("code", type.getCode()); + map.put("name", type.getName()); + return map; + }) + .collect(Collectors.toList()), HttpStatus.OK); + } + + @GetMapping("/getLogTypes") + @Log("获取日志类型") + public ResponseEntity get(@RequestParam Map whereJson) { + + return new ResponseEntity<>(Arrays.stream(LogTypeEnum.values()).map(logType -> { + Map map = new java.util.HashMap<>(); + map.put("logType", logType.getDesc()); + return map; + }) + .collect(Collectors.toList()), HttpStatus.OK); + } + + @GetMapping("/getDeviceCodes") + @Log("获取日志设备号") + public ResponseEntity getDeviceCodes() { + return new ResponseEntity<>(luceneService.getDeviceCodes(), HttpStatus.OK); } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/LuceneService.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/LuceneService.java index 759fd5c..a8695dc 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/LuceneService.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/LuceneService.java @@ -2,6 +2,7 @@ package org.nl.config.lucene.service; import org.springframework.data.domain.Pageable; +import java.util.List; import java.util.Map; @@ -16,5 +17,5 @@ public interface LuceneService { */ Map getAll(Map whereJson, Pageable page); - Map getAddressLog(Map whereJson, Pageable page); + List getDeviceCodes(); } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java index 4cdca93..601b66c 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java @@ -4,6 +4,7 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import org.nl.config.lucene.enums.DeviceLogTypeEnum; @Data @Builder @@ -11,121 +12,80 @@ import lombok.NoArgsConstructor; @AllArgsConstructor public class LuceneLogDto { - /* 日志标识 */ - private String log_uuid; - /*日志类型*/ + /** + * 日志类型 + */ private String logType; - /*设备编号*/ + + /** + * 设备编号 + */ private String device_code; - /*内容详情*/ + + /** + * 内容详情 + */ private String content; - /* 任务编码 */ - private String task_code; - - /* 指令编码 */ - private String instruct_code; - - /* 任务标识 */ - private String task_id; - - /* 载具号 */ - private String vehicle_code; - - /* 备注 */ - private String remark; - - /* 日志类型 */ - private String log_type; /** - * 日志级别 + * 方法 */ - private Integer log_level; - - /* 方法 */ private String method; - /* 请求参数 */ - private String requestparam; + /** + * 请求参数 + */ + private String request_param; - /* 响应参数 */ - private String responseparam; + /** + * 响应参数 + */ + private String response_param; - /* 请求地址 */ - private String requesturl; + /** + * 请求路径 + */ + private String request_url; - /* 状态码 */ + + /** + * 状态码 + */ private String status_code; - /* 是否删除 1:是;0:否 */ - private String is_delete; + /** + * 设备日志类型 + */ + private String deviceLogType; - /* 创建者 */ - private String create_by; + /** + * 请求方向 + */ + private String request_direction; - /* 创建时间 YYYY-MM-DD hh:mm:ss */ - private String create_time; + /** + * 执行时间 + */ + private long executeTime; - /* 修改者 */ - private String update_by; - - /* 修改时间 */ - private String update_time; - - - public LuceneLogDto(final String opc_server_code, final String opc_plc_code,final Integer log_level, - final String device_code, final String to_home, final String last_home, - final String home) { - super(); - this.device_code = device_code; - this.log_level = log_level; - this.content = "信号 [" - + opc_server_code + "." - + opc_plc_code + "." - + device_code + "." - + to_home + "] 发生变更 " - + last_home + " -> " - + home; - } - - - //1 - - public LuceneLogDto(final Integer log_level,final String method, final String status, - final String requestparam, final String responseparam, final String content) { - super(); - this.log_level = log_level; - this.method =method; - this.requestparam = requestparam; - this.responseparam = responseparam; - this.content = content; - } - - public LuceneLogDto(final Integer log_level, final String requestparam, final String content) { - super(); - this.log_level = log_level; - this.requestparam = requestparam; - this.content = content; - } public LuceneLogDto(final String device_code, final String remark) { super(); this.device_code = device_code; + this.deviceLogType = DeviceLogTypeEnum.AUTO_THREAD.getCode(); this.content = "设备 [" + device_code + "] - " + remark; } - public LuceneLogDto(final LuceneLogDto dto) { + public LuceneLogDto(final String device_code, final String device_log_type, final String remark) { super(); this.device_code = device_code; - this.method = method; - + this.deviceLogType = device_log_type; this.content = "设备 [" + device_code + "] - " + remark; } - } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/impl/LuceneExecuteLogServiceImpl.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/impl/LuceneExecuteLogServiceImpl.java index 18421bd..fdc9d03 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/impl/LuceneExecuteLogServiceImpl.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/impl/LuceneExecuteLogServiceImpl.java @@ -1,22 +1,15 @@ package org.nl.config.lucene.service.impl; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.nl.acs.AcsConfig; -import org.nl.config.SpringContextHolder; import org.nl.config.lucene.enums.LogTypeEnum; import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; -import org.nl.system.service.param.ISysParamService; import org.slf4j.MDC; import org.springframework.stereotype.Service; -import java.util.regex.Pattern; - /** * @author jlm * @description 服务实现 @@ -27,8 +20,6 @@ import java.util.regex.Pattern; @Slf4j public class LuceneExecuteLogServiceImpl implements LuceneExecuteLogService { - - @Override public void deviceItemValue(String device_code, String key, String value) { String now = DateUtil.now(); @@ -36,26 +27,14 @@ public class LuceneExecuteLogServiceImpl implements LuceneExecuteLogService { @Override public void deviceExecuteLog(LuceneLogDto luceneLogDto) { -// ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc()); -// String logLevel = paramService.findByCode(AcsConfig.LOGLEVEL).getValue(); - if(ObjectUtil.isNotEmpty(luceneLogDto.getLog_level()) && (luceneLogDto.getLog_level() >= 3)){ - log.info("{}", JSON.toJSONString(luceneLogDto)); - } - } - - public static boolean isNumeric(String str) { - return Pattern.compile("^[0-9]+$").matcher(str).matches(); + log.info("{}", JSON.toJSONString(luceneLogDto)); } @Override public void interfaceExecuteLog(LuceneLogDto luceneLogDto) { -// ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); luceneLogDto.setLogType(LogTypeEnum.INTERFACE_LOG.getDesc()); -// String logLevel = paramService.findByCode(AcsConfig.LOGLEVEL).getValue(); - if(ObjectUtil.isNotEmpty(luceneLogDto.getLog_level()) && (luceneLogDto.getLog_level() >= 3)){ - log.info("{}", JSON.toJSONString(luceneLogDto)); - } + log.info("{}", JSON.toJSONString(luceneLogDto)); } @Override diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/impl/LuceneServiceImpl.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/impl/LuceneServiceImpl.java index 5124afc..d2c372b 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/impl/LuceneServiceImpl.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/impl/LuceneServiceImpl.java @@ -2,13 +2,15 @@ package org.nl.config.lucene.service.impl; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.lucene.document.Document; import org.apache.lucene.index.DirectoryReader; +import org.apache.lucene.index.MultiTerms; import org.apache.lucene.index.Term; +import org.apache.lucene.index.Terms; +import org.apache.lucene.index.TermsEnum; import org.apache.lucene.search.*; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.util.BytesRef; @@ -30,9 +32,6 @@ import java.util.*; @Slf4j public class LuceneServiceImpl implements LuceneService { - //日志索引目录 - - @Override public Map getAll(Map whereJson, Pageable page) { //获取要查询的路径,也就是索引所在的位置 @@ -55,48 +54,55 @@ public class LuceneServiceImpl implements LuceneService { String startDate = (String) whereJson.get("begin_time"); String endDate = (String) whereJson.get("end_time"); - if (startDate == null){ - Calendar calendar=Calendar.getInstance(); + if (startDate == null) { + Calendar calendar = Calendar.getInstance(); calendar.set(1970, 0, 1); - startDate = DateUtil.format(calendar.getTime(),"yyyy-MM-dd HH:mm:ss.SSS"); - }else{ + startDate = DateUtil.format(calendar.getTime(), "yyyy-MM-dd HH:mm:ss.SSS"); + } else { startDate = getDate(startDate); } - if (endDate == null){ - endDate = DateUtil.format(new DateTime(),"yyyy-MM-dd HH:mm:ss.SSS"); + if (endDate == null) { + endDate = DateUtil.format(new DateTime(), "yyyy-MM-dd HH:mm:ss.SSS"); } else { endDate = getDate(endDate); } TermRangeQuery termRangeQuery = new TermRangeQuery("logTime", new BytesRef(startDate), new BytesRef(endDate), true, true); booleanQueryBuilder.add(termRangeQuery, BooleanClause.Occur.MUST); - if (whereJson.get("device_code") != null){ + if (whereJson.get("logType") != null) { + Query termQuery = new TermQuery(new Term("logType", (String) whereJson.get("logType"))); + booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST); + } + if (whereJson.get("device_code") != null) { Query termQuery = new TermQuery(new Term("device_code", (String) whereJson.get("device_code"))); - booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST); + booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST); } - if (whereJson.get("method") != null){ - Query termQuery = new TermQuery(new Term("method", (String) whereJson.get("method"))); - booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST); + if (whereJson.get("deviceLogType") != null) { + Query termQuery = new TermQuery(new Term("deviceLogType", (String) whereJson.get("deviceLogType"))); + booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST); } - if (whereJson.get("status_code") != null){ - Query termQuery = new TermQuery(new Term("status_code", (String) whereJson.get("status_code"))); - booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST); + if (whereJson.get("method") != null) { + WildcardQuery termQuery = new WildcardQuery(new Term("method", "*" + (String) whereJson.get("method") + "*")); + booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST); } - if (whereJson.get("requestparam") != null){ - WildcardQuery query = new WildcardQuery(new Term("requestparam", "*"+(String) whereJson.get("requestparam")+"*")); - booleanQueryBuilder.add(query,BooleanClause.Occur.MUST); + if (whereJson.get("request_url") != null) { + WildcardQuery termQuery = new WildcardQuery(new Term("request_url", "*" + (String) whereJson.get("request_url") + "*")); + booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST); } - if (whereJson.get("responseparam") != null){ - WildcardQuery query = new WildcardQuery(new Term("responseparam", "*"+(String) whereJson.get("responseparam")+"*")); - booleanQueryBuilder.add(query,BooleanClause.Occur.MUST); + if (whereJson.get("request_direction") != null) { + Query termQuery = new TermQuery(new Term("request_direction", (String) whereJson.get("request_direction"))); + booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST); + } + if (whereJson.get("request_param") != null) { + WildcardQuery termQuery = new WildcardQuery(new Term("request_param", "*" + (String) whereJson.get("request_param") + "*")); + booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST); } if (whereJson.get("blurry") != null) { - WildcardQuery query = new WildcardQuery(new Term("fieldContent", "*"+(String) whereJson.get("blurry")+"*")); + WildcardQuery query = new WildcardQuery(new Term("fieldContent", "*" + (String) whereJson.get("blurry") + "*")); booleanQueryBuilder.add(query, BooleanClause.Occur.MUST); } - - TopFieldCollector collector = TopFieldCollector.create(new Sort(new SortField("logTime", SortField.Type.LONG,true)), 20000, 0); + TopFieldCollector collector = TopFieldCollector.create(new Sort(new SortField("logTime", SortField.Type.LONG, true)), 20000, 0); searcher.search(booleanQueryBuilder.build(), collector); - TopDocs topDocs = collector.topDocs(pageNum*pageSize, pageSize); + TopDocs topDocs = collector.topDocs(pageNum * pageSize, pageSize); int totalSize = collector.getTotalHits(); ScoreDoc[] scoreDocs = topDocs.scoreDocs; @@ -104,14 +110,18 @@ public class LuceneServiceImpl implements LuceneService { for (ScoreDoc scoreDoc : scoreDocs) { Document doc = open.document(scoreDoc.doc); JSONObject object = new JSONObject(); - object.put("content",doc.get("fieldContent")); - object.put("device_code",doc.get("device_code")); - object.put("logTime",doc.get("logTime")); - object.put("method",doc.get("method")); - object.put("status_code",doc.get("status_code")); - object.put("requestparam",doc.get("requestparam")); - object.put("responseparam",doc.get("responseparam")); - if(doc.get("fieldContent") != null) { + object.put("content", doc.get("fieldContent")); + object.put("device_code", doc.get("device_code")); + object.put("deviceLogType", doc.get("deviceLogType")); + object.put("logTime", doc.get("logTime")); + object.put("method", doc.get("method")); + object.put("request_url", doc.get("request_url")); + object.put("status_code", doc.get("status_code")); + object.put("request_param", doc.get("request_param")); + object.put("response_param", doc.get("response_param")); + object.put("request_direction", doc.get("request_direction")); + object.put("executeTime", doc.get("executeTime")); + if (doc.get("fieldContent") != null) { list.add(object); } } @@ -128,90 +138,34 @@ public class LuceneServiceImpl implements LuceneService { } @Override - public Map getAddressLog(Map whereJson, Pageable page) { - //获取要查询的路径,也就是索引所在的位置 + public List getDeviceCodes() { + List deviceCodes = new ArrayList<>(); try { Resource resource = new ClassPathResource("config/application.yml"); YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean(); yamlPropertiesFactoryBean.setResources(resource); Properties properties = yamlPropertiesFactoryBean.getObject(); - // 获取配置值 String luceneDir = properties.getProperty("lucene.index.path"); FSDirectory directory = FSDirectory.open(Paths.get(luceneDir)); DirectoryReader open = DirectoryReader.open(directory); - IndexSearcher searcher = new IndexSearcher(open); - // 实际上Lucene本身不支持分页。因此我们需要自己进行逻辑分页。我们要准备分页参数: - int pageSize = Integer.parseInt(whereJson.get("size").toString());// 每页条数 - int pageNum = Integer.parseInt(whereJson.get("page").toString());// 当前页码 - - BooleanQuery.Builder booleanQueryBuilder = new BooleanQuery.Builder(); - //时间范围查询 - String startDate = (String) whereJson.get("begin_time"); - String endDate = (String) whereJson.get("end_time"); - - if (startDate == null){ - Calendar calendar=Calendar.getInstance(); - calendar.set(1970, 0, 1); - startDate = DateUtil.format(calendar.getTime(),"yyyy-MM-dd HH:mm:ss.SSS"); - }else{ - startDate = getDate(startDate); - } - if (endDate == null){ - endDate = DateUtil.format(new DateTime(),"yyyy-MM-dd HH:mm:ss.SSS"); - } else { - endDate = getDate(endDate); - } - TermRangeQuery termRangeQuery = new TermRangeQuery("logTime", new BytesRef(startDate), new BytesRef(endDate), true, true); - booleanQueryBuilder.add(termRangeQuery, BooleanClause.Occur.MUST); - if (whereJson.get("method") != null){ - Query termQuery = new TermQuery(new Term("method", (String) whereJson.get("method"))); - booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST); - } else { - // 使用 TermRangeQuery 来检查字段是否存在和不为空 - Query rangeQuery = TermRangeQuery.newStringRange("method", null, null, false, false); - booleanQueryBuilder.add(rangeQuery, BooleanClause.Occur.MUST); - } - if (whereJson.get("requestparam") != null){ - WildcardQuery query = new WildcardQuery(new Term("requestparam", "*"+(String) whereJson.get("requestparam")+"*")); - booleanQueryBuilder.add(query,BooleanClause.Occur.MUST); - } - if (whereJson.get("responseparam") != null){ - WildcardQuery query = new WildcardQuery(new Term("responseparam", "*"+(String) whereJson.get("responseparam")+"*")); - booleanQueryBuilder.add(query,BooleanClause.Occur.MUST); - } - if (whereJson.get("blurry") != null) { - WildcardQuery query = new WildcardQuery(new Term("fieldContent", "*"+(String) whereJson.get("blurry")+"*")); - booleanQueryBuilder.add(query, BooleanClause.Occur.MUST); - } - TopFieldCollector collector = TopFieldCollector.create(new Sort(new SortField("logTime", SortField.Type.LONG,true)), 20000, 0); - searcher.search(booleanQueryBuilder.build(), collector); - TopDocs topDocs = collector.topDocs(pageNum*pageSize, pageSize); - int totalSize = collector.getTotalHits(); - ScoreDoc[] scoreDocs = topDocs.scoreDocs; - - List list = new ArrayList<>(); - for (ScoreDoc scoreDoc : scoreDocs) { - Document doc = open.document(scoreDoc.doc); - JSONObject object = new JSONObject(); - object.put("content", doc.get("fieldContent")); - object.put("logTime", doc.get("logTime") ); - object.put("method", doc.get("method")); - object.put("requestparam", doc.get("requestparam")); - object.put("responseparam", doc.get("responseparam")); - if (ObjectUtil.isNotEmpty(doc.get("fieldContent"))) { - list.add(object); + Terms terms = MultiTerms.getTerms(open, "device_code"); + if (terms != null) { + TermsEnum termsEnum = terms.iterator(); + BytesRef term; + while ((term = termsEnum.next()) != null) { + String code = term.utf8ToString(); + if (code != null && !code.trim().isEmpty()) { + deviceCodes.add(code); + } } } open.close(); directory.close(); - JSONObject jo = new JSONObject(); - jo.put("content", list); - jo.put("totalElements", totalSize); - return jo; } catch (Exception e) { - log.error("索引查询为空", e); - throw new NullPointerException("索引查询为空"); + log.error("获取日志设备号失败", e); } + Collections.sort(deviceCodes); + return deviceCodes; } public static String getDate(String timeString) throws ParseException { diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java index 61668e0..a3a7057 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java @@ -6,31 +6,22 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.ObjectUtils; -import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; -import org.nl.acs.device_driver.agv.ndcone.AgvNdcOneDeviceDriver; +import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.enums.InstructionStatusEnum; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.opc.DeviceAppServiceImpl; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.task.enums.AgvSystemTypeEnum; import org.nl.acs.task.enums.TaskStatusEnum; -import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.common.utils.CodeUtil; import org.nl.common.utils.SecurityUtils; -import org.nl.config.SpringContextHolder; -import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; -import org.nl.config.lucene.service.impl.LuceneExecuteLogServiceImpl; +import org.nl.system.service.param.ISysParamService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; import java.math.BigDecimal; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -43,28 +34,22 @@ import java.util.stream.Collectors; @Component public class AutoCreateInst { - Map carTaskCount = new ConcurrentHashMap<>(); - - @PostConstruct - public void init() { - if (carTaskCount.isEmpty()) { - carTaskCount.put("1", 0); - carTaskCount.put("2", 0); - } - } + @Autowired + private ISysParamService paramService; + @Autowired + private TaskService taskService; + @Autowired + private InstructionService instructionService; + @Autowired + private DeviceAppService deviceAppService; /** * 根据任务状态创建指令、生成下一条指令 * 创建指令前需要判断是否条件具备:起始位置是否有货、目标位置是否有货 */ public void run() throws Exception { - log.info("自动生成指令"+DateUtil.now()); - TaskService taskserver = SpringContextHolder.getBean(TaskService.class); - InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); - RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogServiceImpl.class); - List list = taskserver.queryAllByStatus("0"); + log.info("自动生成指令" + DateUtil.now()); + List list = taskService.queryAllByStatus("0"); // 根据任务组别分组 Map> groupTasks = list.stream() .collect(Collectors.groupingBy( @@ -79,33 +64,48 @@ public class AutoCreateInst { ) ) )); + String canAgvCar = Optional.ofNullable(paramService.findByCode("can_agv_car")) + .map(param -> param.getValue()) + .filter(StrUtil::isNotEmpty) + .orElse("1,2"); + List canAgvCars = Arrays.stream(canAgvCar.split(",")) + .map(String::trim) + .filter(StrUtil::isNotEmpty) + .collect(Collectors.toList()); for (String groupId : groupTasks.keySet()) { List taskDtos = groupTasks.get(groupId); - // carTaskCount根据value从小到大排序 - List> sortedEntries = new ArrayList<>(carTaskCount.entrySet()); - sortedEntries.sort(Map.Entry.comparingByValue()); - // 获取车号 - String carNo = null; - for (Map.Entry entry : sortedEntries) { - String carKey = entry.getKey(); - Device deviceByCode = appService.findDeviceByCode(carKey); - AgvNdcOneDeviceDriver deviceDriver = (AgvNdcOneDeviceDriver) deviceByCode.getDeviceDriver(); - if (deviceDriver.getStatus() == 2 || deviceDriver.getStatus() == 4) { - carNo = carKey; - carTaskCount.put(carKey, carTaskCount.get(carKey) + 1); + Map carInstCount = new ConcurrentHashMap<>(); + canAgvCars.forEach(carno -> carInstCount.put(carno, 0)); + List instructions = Optional.ofNullable(instructionService.findAllInstFromCache()).orElse(new ArrayList<>()); + for (Instruction instruction : instructions) { + String carno = instruction.getCarno(); + if (StrUtil.isNotEmpty(carno) && carInstCount.containsKey(carno)) { + carInstCount.put(carno, carInstCount.get(carno) + 1); } } - if (carNo == null) { - return; + List sortedCars = canAgvCars.stream() + .sorted(Comparator + .comparing((String carNo) -> carInstCount.getOrDefault(carNo, 0)) + .thenComparing(carNo -> carNo)) + .collect(Collectors.toList()); + String groupCarNo = null; + for (String carNo : sortedCars) { + Device agv = deviceAppService.findDeviceByCode(carNo); + if (ObjectUtil.isEmpty(agv) || !(agv.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver)) { + continue; + } + AgvNdcTwoDeviceDriver driver = (AgvNdcTwoDeviceDriver) agv.getDeviceDriver(); + if (driver.isCanIssued()) { + groupCarNo = carNo; + break; + } + } + if (StrUtil.isEmpty(groupCarNo)) { + log.info("任务组{}无可下发车辆,跳过本轮", groupId); + continue; } for (int i = 0; i < taskDtos.size(); i++) { TaskDto acsTask = taskDtos.get(i); - if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.AGV_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) { - continue; - } - if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.Truss_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) { - continue; - } String taskid = acsTask.getTask_id(); String taskcode = acsTask.getTask_code(); String task_type = acsTask.getTask_type(); @@ -142,60 +142,17 @@ public class AutoCreateInst { BigDecimal taskGroupSeq = acsTask.getTask_group_seq(); JSONObject interaction_json = JSONObject.parseObject(acsTask.getInteraction_json()); - String have_lid = interaction_json == null ? null: interaction_json.getString("have_lid"); + String have_lid = interaction_json == null ? null : interaction_json.getString("have_lid"); if (StrUtil.equals(is_send, "0")) { continue; } - //校验路由关系 - List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); - if (ObjectUtils.isEmpty(shortPathsList)) { - acsTask.setRemark("路由不通无法生成指令"); - taskserver.updateByCodeFromCache(acsTask); - continue; - } - - if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) { - continue; - } - - RouteLineDto routeLineDto = shortPathsList.get(0); - String path = routeLineDto.getPath(); - String type = routeLineDto.getType(); - String[] str = path.split("->"); - List pathlist = Arrays.asList(str); - int index = 0; - boolean flag = false; - for (int m = 0; m < pathlist.size(); m++) { - if (pathlist.get(m).equals(start_device_code)) { - if("1".equals(acsTask.getTask_type()) && !pathlist.get(m+1).equals(next_device_code)){ - flag = true; - break; - } - index = m + 1; - break; - } - } - if (flag) { - acsTask.setRemark("路由不通无法生成指令"); - taskserver.update(acsTask); - taskserver.updateByCodeFromCache(acsTask); - continue; - } - next_device_code = pathlist.get(index); - - if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) { - next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z(); - } else { - next_point_code = next_device_code; - } - Instruction instdto = new Instruction(); instdto.setInstruction_type(task_type); instdto.setInstruction_id(IdUtil.simpleUUID()); - if (acsTask.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())){ + if (acsTask.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO")); } instdto.setRoute_plan_code(route_plan_code); @@ -227,7 +184,7 @@ public class AutoCreateInst { instdto.setHave_lid(have_lid); instdto.setPriority(priority); - instdto.setCarno(carNo); + instdto.setCarno(groupCarNo); instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); instdto.setExecute_device_code(start_point_code); instdto.setVehicle_type(vehicleType); @@ -235,37 +192,22 @@ public class AutoCreateInst { instdto.setStart_height(start_height); instdto.setNext_height(next_height); instdto.setAgv_action_type(agvActionType); - //判断agv系统 - //1、1楼叉车系统 - //2、2楼1区域AGV系统 - //3、2楼2区域AGV系统 -已废弃 - - if (ObjectUtil.isEmpty(task_type)) { - log.info("未找到对应的AGV指令类型,任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type()); - continue; - } else { - instdto.setAgv_inst_type(task_type); - } + instdto.setAgv_inst_type(task_type); try { instructionService.create(instdto); } catch (Exception e) { acsTask.setRemark(e.getMessage()); - taskserver.updateByCodeFromCache(acsTask); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("定时创建指令失败") - .content(e.getMessage()) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + taskService.updateByCodeFromCache(acsTask); continue; } //创建指令后修改任务状态 acsTask.setTask_status(TaskStatusEnum.BUSY.getIndex()); + acsTask.setCarno(groupCarNo); acsTask.setUpdate_time(DateUtil.now()); acsTask.setRemark(" "); - taskserver.update(acsTask); - + taskService.update(acsTask); + break; } } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst1.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst1.java new file mode 100644 index 0000000..e1d4b40 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst1.java @@ -0,0 +1,187 @@ +package org.nl.system.service.quartz.task; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.instruction.domain.Instruction; +import org.nl.acs.instruction.enums.InstructionStatusEnum; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.opc.DeviceAppServiceImpl; +import org.nl.acs.task.enums.AgvSystemTypeEnum; +import org.nl.acs.task.enums.TaskStatusEnum; +import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.dto.TaskDto; +import org.nl.common.utils.CodeUtil; +import org.nl.common.utils.SecurityUtils; +import org.nl.config.SpringContextHolder; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; + +/** + * 自动创建指令 + */ +@Slf4j +@Component +public class AutoCreateInst1 { + + Map carTaskCount = new ConcurrentHashMap<>(); + + @PostConstruct + public void init() { + if (carTaskCount.isEmpty()) { + carTaskCount.put("1", 0); + carTaskCount.put("2", 0); + } + } + + /** + * 根据任务状态创建指令、生成下一条指令 + * 创建指令前需要判断是否条件具备:起始位置是否有货、目标位置是否有货 + */ + public void run() throws Exception { + log.info("自动生成指令"+DateUtil.now()); + TaskService taskserver = SpringContextHolder.getBean(TaskService.class); + InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); + DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + List list = taskserver.queryAllByStatus("0"); + // 根据任务组别分组 + Map> groupTasks = list.stream() + .collect(Collectors.groupingBy( + TaskDto::getTask_group_id, + Collectors.mapping( + task -> task, + Collectors.collectingAndThen( + Collectors.toList(), + tasks -> tasks.stream() + .sorted(Comparator.comparing(TaskDto::getTask_group_seq)) + .collect(Collectors.toList()) + ) + ) + )); + for (String groupId : groupTasks.keySet()) { + List taskDtos = groupTasks.get(groupId); + // carTaskCount根据value从小到大排序 + List> sortedEntries = new ArrayList<>(carTaskCount.entrySet()); + sortedEntries.sort(Map.Entry.comparingByValue()); + for (int i = 0; i < taskDtos.size(); i++) { + TaskDto acsTask = taskDtos.get(i); + String taskid = acsTask.getTask_id(); + String taskcode = acsTask.getTask_code(); + String task_type = acsTask.getTask_type(); + String vehiclecode = acsTask.getVehicle_code(); + String vehiclecode2 = acsTask.getVehicle_code2(); + String storage_task_type = acsTask.getStorage_task_type(); + String priority = acsTask.getPriority(); + String is_send = acsTask.getIs_send(); + + String start_device_code = acsTask.getStart_device_code(); + String start_point_code = acsTask.getStart_point_code(); + + String put_device_code = acsTask.getPut_device_code(); + String put_point_code = acsTask.getPut_point_code(); + + String next_device_code = acsTask.getNext_device_code(); + String next_point_code = acsTask.getNext_point_code(); + + String start_point_code2 = acsTask.getStart_point_code2(); + String start_device_code2 = acsTask.getStart_device_code2(); + + String next_point_code2 = acsTask.getNext_point_code2(); + String next_device_code2 = acsTask.getNext_device_code2(); + + String route_plan_code = acsTask.getRoute_plan_code(); + String vehicleType = acsTask.getVehicle_type(); + String agv_system_type = acsTask.getAgv_system_type(); + + String start_height = acsTask.getStart_height(); + String next_height = acsTask.getNext_height(); + Integer agvActionType = acsTask.getAgv_action_type(); + + String taskGroupId = acsTask.getTask_group_id(); + BigDecimal taskGroupSeq = acsTask.getTask_group_seq(); + JSONObject interaction_json = JSONObject.parseObject(acsTask.getInteraction_json()); + + String have_lid = interaction_json == null ? null: interaction_json.getString("have_lid"); + + if (StrUtil.equals(is_send, "0")) { + continue; + } + + + Instruction instdto = new Instruction(); + instdto.setInstruction_type(task_type); + instdto.setInstruction_id(IdUtil.simpleUUID()); + if (acsTask.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())){ + instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO")); + } + instdto.setRoute_plan_code(route_plan_code); + instdto.setRemark(acsTask.getRemark()); + instdto.setMaterial(acsTask.getMaterial()); + instdto.setQuantity(acsTask.getQuantity()); + instdto.setTask_id(taskid); + instdto.setTask_code(taskcode); + instdto.setVehicle_code(vehiclecode); + instdto.setVehicle_code2(vehiclecode2); + String now = DateUtil.now(); + instdto.setCreate_time(now); + instdto.setCreate_by(SecurityUtils.getCurrentNickName()); + + instdto.setStart_device_code(start_device_code); + instdto.setStart_point_code(start_point_code); + instdto.setPut_device_code(put_device_code); + instdto.setPut_point_code(put_point_code); + instdto.setNext_device_code(next_device_code); + instdto.setNext_point_code(next_point_code); + + instdto.setStart_point_code2(start_point_code2); + instdto.setStart_device_code2(start_device_code2); + instdto.setNext_point_code2(next_point_code2); + instdto.setNext_device_code2(next_device_code2); + + instdto.setTask_group_id(taskGroupId); + instdto.setTask_group_seq(taskGroupSeq); + instdto.setHave_lid(have_lid); + + instdto.setPriority(priority); + instdto.setCarno("2"); + instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); + instdto.setExecute_device_code(start_point_code); + instdto.setVehicle_type(vehicleType); + instdto.setAgv_system_type(agv_system_type); + instdto.setStart_height(start_height); + instdto.setNext_height(next_height); + instdto.setAgv_action_type(agvActionType); + //判断agv系统 + //1、1楼叉车系统 + //2、2楼1区域AGV系统 + //3、2楼2区域AGV系统 -已废弃 + instdto.setAgv_inst_type(task_type); + + try { + instructionService.create(instdto); + } catch (Exception e) { + acsTask.setRemark(e.getMessage()); + taskserver.updateByCodeFromCache(acsTask); + continue; + } + //创建指令后修改任务状态 + acsTask.setTask_status(TaskStatusEnum.BUSY.getIndex()); + acsTask.setUpdate_time(DateUtil.now()); + acsTask.setRemark(" "); + taskserver.update(acsTask); + + } + } + } +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/Ndcconnect.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/Ndcconnect.java index 8c10736..be713fd 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/Ndcconnect.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/Ndcconnect.java @@ -2,7 +2,7 @@ package org.nl.system.service.quartz.task; import lombok.extern.slf4j.Slf4j; import org.nl.acs.agv.server.NDCAgvService; -import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun; +import org.nl.acs.auto.run.NDCSocketConnectionAutoRun; import org.nl.config.SpringContextHolder; import org.springframework.stereotype.Component; @@ -14,6 +14,6 @@ public class Ndcconnect { byte[] data = null; NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); data = ndcAgvService.sendAgvTwoModeInst(); - TwoNDCSocketConnectionAutoRun.write(data); + NDCSocketConnectionAutoRun.write(data); } } diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/_sql/zzzw_acs.sql b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/_sql/zzzw_acs.sql index 5fb5853..51e4bb7 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/_sql/zzzw_acs.sql +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/_sql/zzzw_acs.sql @@ -222,6 +222,9 @@ CREATE TABLE `acs_instruction` ( `agv_inst_type` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT 'AGV指令类型', `agv_system_type` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT 'AGV系统类型', `agv_action_type` tinyint(0) NULL DEFAULT NULL COMMENT 'agv二次分配类型(1、普通任务 2、取货二次分配 3、防货二次分配 4、取放货二次分配)', + `task_group_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '任务组标识', + `task_group_seq` decimal(9, 0) NULL DEFAULT NULL COMMENT '任务组顺序', + `have_lid` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '是否带盖 1是 2否', `vehicle_code2` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '木箱号', PRIMARY KEY (`instruction_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_bin COMMENT = '指令表' ROW_FORMAT = Dynamic; @@ -588,6 +591,8 @@ CREATE TABLE `acs_task` ( `empty_site` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '空轴位', `agv_action_type` tinyint(0) NULL DEFAULT NULL COMMENT 'agv二次分配类型(1、普通任务 2、取货二次分配 3、防货二次分配 4、取放货二次分配)', `class_type` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL, + `task_group_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '任务组标识', + `task_group_seq` decimal(9, 0) NULL DEFAULT NULL COMMENT '任务组顺序', `vehicle_code2` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '木箱号', PRIMARY KEY (`task_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_bin COMMENT = '任务表' ROW_FORMAT = Dynamic; diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index 55fff09..c9673dc 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -3,7 +3,7 @@ server: #配置数据源 spring: messages: - basename: language/login/login,language/error/error,language/buss/buss,language/monitor/universal/universal,language/monitor/one_device/one_advice,language/monitor/two_device/two_device,language/task/task + basename: language/login/login,language/error/error,language/buss/buss,language/monitor/universal/universal,language/monitor/one_device/one_device,language/monitor/two_device/two_device,language/task/task datasource: druid: db-type: com.alibaba.druid.pool.DruidDataSource @@ -14,7 +14,7 @@ spring: username: ${DB_USER:root} # password: ${DB_PWD:P@ssw0rd.} - password: ${DB_PWD:12356} + password: ${DB_PWD:password} # 初始连接数 initial-size: 5 # 最小连接数 diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml index 872ff56..2ee7cec 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml @@ -10,9 +10,9 @@ spring: driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy # url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_acs_97}?serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + url: jdbc:log4jdbc:mysql://${DB_HOST:10.30.4.233}:${DB_PORT:3256}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true username: ${DB_USER:root} - password: ${DB_PWD:123456} + password: ${DB_PWD:cxzn(oo*} # password: ${DB_PWD:p@ssw0rd} # 初始连接数 initial-size: 20 @@ -130,7 +130,7 @@ logging: config: classpath:logback-spring.xml lucene: index: - path: /lucene + path: C:\acs\lucene\index1 # Sa-Token配置 sa-token: diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/db/migration/V2__sync_instruction_and_task_group_columns.sql b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/db/migration/V2__sync_instruction_and_task_group_columns.sql new file mode 100644 index 0000000..72ad642 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/db/migration/V2__sync_instruction_and_task_group_columns.sql @@ -0,0 +1,8 @@ +ALTER TABLE `acs_instruction` + ADD COLUMN IF NOT EXISTS `task_group_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '任务组标识', + ADD COLUMN IF NOT EXISTS `task_group_seq` decimal(9, 0) NULL DEFAULT NULL COMMENT '任务组顺序', + ADD COLUMN IF NOT EXISTS `have_lid` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '是否带盖 1是 2否'; + +ALTER TABLE `acs_task` + ADD COLUMN IF NOT EXISTS `task_group_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '任务组标识', + ADD COLUMN IF NOT EXISTS `task_group_seq` decimal(9, 0) NULL DEFAULT NULL COMMENT '任务组顺序'; diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/BMSSocketConnectionAutoRun.xml b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/BMSSocketConnectionAutoRun.xml new file mode 100644 index 0000000..386e2d2 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/BMSSocketConnectionAutoRun.xml @@ -0,0 +1,21 @@ + + + + + + + ${LOG_HOME}/BMS交互/%d{yyyy-MM-dd}.%i.log + 15 + 50MB + 2GB + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ${log.charset} + + + + + + + diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml index 4ad8c2e..f77130d 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml @@ -6,7 +6,7 @@ - ${LOG_HOME}/agv下发/%d{yyyy-MM-dd}.%i.log + ${LOG_HOME}/AGV交互/%d{yyyy-MM-dd}.%i.log 15 @@ -27,7 +27,7 @@ --> - + diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/TwoNDCSocketConnectionAutoRun.xml b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCSocketConnectionAutoRun.xml similarity index 87% rename from acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/TwoNDCSocketConnectionAutoRun.xml rename to acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCSocketConnectionAutoRun.xml index 6f9b53f..16d03b4 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/TwoNDCSocketConnectionAutoRun.xml +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCSocketConnectionAutoRun.xml @@ -6,7 +6,7 @@ - ${LOG_HOME}/二楼NDC系统/%d{yyyy-MM-dd}.%i.log + ${LOG_HOME}/NDC交互/%d{yyyy-MM-dd}.%i.log 15 @@ -27,7 +27,7 @@ --> - + diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/OneNDCSocketConnectionAutoRun.xml b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/OneNDCSocketConnectionAutoRun.xml deleted file mode 100644 index 4d8d438..0000000 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/OneNDCSocketConnectionAutoRun.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - ${LOG_HOME}/一楼NDC系统/%d{yyyy-MM-dd}.%i.log - - 15 - - 50MB - - 2GB - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - ${log.charset} - - - - - - - - - - - diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/XgAgvDeviceDriver.xml b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/XgAgvDeviceDriver.xml deleted file mode 100644 index 885cf59..0000000 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/XgAgvDeviceDriver.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - ${LOG_HOME}/XgAgvDeviceDriver/${DEVICECODE}/%d{yyyy-MM-dd}.%i.log - - 15 - - 50MB - - 2GB - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - ${log.charset} - - - - - - - - - 512 - - - - - diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/XianGongAgvServiceImpl.xml b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/XianGongAgvServiceImpl.xml deleted file mode 100644 index 02c3cf8..0000000 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/log/XianGongAgvServiceImpl.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - ${LOG_HOME}/仙工agv请求/%d{yyyy-MM-dd}.%i.log - - 15 - - 50MB - - 2GB - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n - ${log.charset} - - - - - - - - - diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml index 0b806a9..e1a5c2e 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml @@ -20,10 +20,9 @@ https://juejin.cn/post/6844903775631572999 - + - - + @@ -68,7 +67,7 @@ https://juejin.cn/post/6844903775631572999 - + diff --git a/acs/acs2/nladmin-ui/src/i18n/langs/instruction/en.js b/acs/acs2/nladmin-ui/src/i18n/langs/instruction/en.js index 4074ab7..a3aecac 100644 --- a/acs/acs2/nladmin-ui/src/i18n/langs/instruction/en.js +++ b/acs/acs2/nladmin-ui/src/i18n/langs/instruction/en.js @@ -5,7 +5,9 @@ export default { 'instruction_type': 'Instruction Type', 'task_code': 'Task Code', 'vehicle_code': 'Vehicle Code', - 'vehicle_code2': 'Box Code', + 'vehicle_code2': 'Vehicle Code 2', + 'task_group_id': 'Task Group ID', + 'task_group_seq': 'Task Group Seq', 'instruction_status': 'Instruction Status', 'send_status': 'Send Status', 'start_point_code': 'Start Device Code', @@ -22,7 +24,7 @@ export default { 'update_time': 'Update Time', 'input_taskCode_or_instCode': 'Input TaskCode Or InstCode', 'input_vehicleCode': 'Input VehicleCode', - 'input_vehicleCode2': 'Input BoxCode', + 'input_vehicleCode2': 'Input VehicleCode 2', 'material': 'Material Type', 'task_status': 'Task Status', 'input_startCode_or_nextCode': 'Input StartCode Or NextCode', diff --git a/acs/acs2/nladmin-ui/src/i18n/langs/instruction/in.js b/acs/acs2/nladmin-ui/src/i18n/langs/instruction/in.js index 5ff4fcc..2ca67d7 100644 --- a/acs/acs2/nladmin-ui/src/i18n/langs/instruction/in.js +++ b/acs/acs2/nladmin-ui/src/i18n/langs/instruction/in.js @@ -5,7 +5,9 @@ export default { 'instruction_type': 'Jenis Instruksi', 'task_code': 'Nomor Tugas', 'vehicle_code': 'Nomor Kendaraan', - 'vehicle_code2': 'Nomor kotak kayu', + 'vehicle_code2': 'Nomor Kendaraan 2', + 'task_group_id': 'ID Grup Tugas', + 'task_group_seq': 'Urutan Grup Tugas', 'instruction_status': 'Status Perintah', 'send_status': 'Status Pengiriman', 'start_point_code': 'Titik Penjemputan', @@ -22,7 +24,7 @@ export default { 'update_time': 'Ubah Waktu', 'input_taskCode_or_instCode': 'Masukkan Nomor Tugas Atau Nomor Instruksi', 'input_vehicleCode': 'Masukkan Nomor Kendaraan', - 'input_vehicleCode2': 'Masukkan Nomor kotak kayu', + 'input_vehicleCode2': 'Masukkan Nomor Kendaraan 2', 'material': 'Jenis Barang', 'task_status': 'Status Tugas', 'input_startCode_or_nextCode': 'Jenis Barang', diff --git a/acs/acs2/nladmin-ui/src/i18n/langs/instruction/zh.js b/acs/acs2/nladmin-ui/src/i18n/langs/instruction/zh.js index 0168c84..b133c38 100644 --- a/acs/acs2/nladmin-ui/src/i18n/langs/instruction/zh.js +++ b/acs/acs2/nladmin-ui/src/i18n/langs/instruction/zh.js @@ -5,7 +5,9 @@ export default { 'instruction_type': '指令类型', 'task_code': '任务号', 'vehicle_code': '载具号', - 'vehicle_code2': '木箱号', + 'vehicle_code2': '载具号2', + 'task_group_id': '任务组标识', + 'task_group_seq': '任务组顺序', 'instruction_status': '指令状态', 'send_status': '下发状态', 'start_point_code': '取货点', @@ -22,7 +24,7 @@ export default { 'update_time': '修改时间', 'input_taskCode_or_instCode': '输入任务号或指令号', 'input_vehicleCode': '输入载具号', - 'input_vehicleCode2': '输入木箱号', + 'input_vehicleCode2': '输入载具号2', 'material': '物料类型', 'task_status': '任务状态', 'input_startCode_or_nextCode': '输入起点或终点', diff --git a/acs/acs2/nladmin-ui/src/i18n/langs/task/en.js b/acs/acs2/nladmin-ui/src/i18n/langs/task/en.js index 2a76c04..5d4bad6 100644 --- a/acs/acs2/nladmin-ui/src/i18n/langs/task/en.js +++ b/acs/acs2/nladmin-ui/src/i18n/langs/task/en.js @@ -18,6 +18,9 @@ export default { 'agv_action_type': 'agv Secondary allocation type', 'Priority': 'Priority', 'Vehicle_number': 'Vehicle Number', + 'Vehicle_number2': 'Vehicle Number 2', + 'Task_group_id': 'Task Group ID', + 'Task_group_seq': 'Task Group Seq', 'Task_code': 'Task Code', 'Task': 'Task', 'start_or_end': 'Origin Or Destination', diff --git a/acs/acs2/nladmin-ui/src/i18n/langs/task/in.js b/acs/acs2/nladmin-ui/src/i18n/langs/task/in.js index 006a486..392ea70 100644 --- a/acs/acs2/nladmin-ui/src/i18n/langs/task/in.js +++ b/acs/acs2/nladmin-ui/src/i18n/langs/task/in.js @@ -18,6 +18,9 @@ export default { 'agv_action_type': 'Tipe distribusi kedua agv', 'Priority': 'Prioritas', 'Vehicle_number': 'Nomor Kendaraan', + 'Vehicle_number2': 'Nomor Kendaraan 2', + 'Task_group_id': 'ID Grup Tugas', + 'Task_group_seq': 'Urutan Grup Tugas', 'Task_code': 'Nomor Tugas', 'Task': 'Tugas', 'start_or_end': 'Asal Atau Tujuan', diff --git a/acs/acs2/nladmin-ui/src/i18n/langs/task/zh.js b/acs/acs2/nladmin-ui/src/i18n/langs/task/zh.js index b79c399..9a39f26 100644 --- a/acs/acs2/nladmin-ui/src/i18n/langs/task/zh.js +++ b/acs/acs2/nladmin-ui/src/i18n/langs/task/zh.js @@ -3,7 +3,7 @@ export default { 'txt_box': { 'Enter_task_number': '输入任务号', 'Vehicle_registration_number': '输入载具号', - 'Vehicle2_registration_number': '输入木箱号', + 'Vehicle2_registration_number': '输入载具号2', 'Material_type': '物料类型', 'Task_status': '任务状态', 'Origin_or_destination': '输入起点或终点', @@ -19,7 +19,9 @@ export default { 'agv_action_type': 'agv二次分配类型', 'Priority': '优先级', 'Vehicle_number': '载具号', - 'Vehicle_number2': '木箱号', + 'Vehicle_number2': '载具号2', + 'Task_group_id': '任务组标识', + 'Task_group_seq': '任务组顺序', 'Task_code': '任务号', 'Task': '任务', 'start_or_end': '起点或终点', diff --git a/acs/acs2/nladmin-ui/src/views/acs/device/config.vue b/acs/acs2/nladmin-ui/src/views/acs/device/config.vue index f4c0a7d..586a2be 100644 --- a/acs/acs2/nladmin-ui/src/views/acs/device/config.vue +++ b/acs/acs2/nladmin-ui/src/views/acs/device/config.vue @@ -82,6 +82,10 @@ import xg_agv from '@/views/acs/device/driver/agv/xg_agv' import xg_agv_car from '@/views/acs/device/driver/agv/xg_agv_car.vue' import standard_manipulator from '@/views/acs/device/driver/one_manipulator/standard_manipulator.vue' import unpacking_machine from '@/views/acs/device/driver/unpacking_machine.vue' +import production_line_docking_station from '@/views/acs/device/driver/production_line_docking_station.vue' +import remove_seal_cover_position from '@/views/acs/device/driver/remove_seal_cover_position.vue' +import unpacking_conveyor from '@/views/acs/device/driver/unpacking_conveyor.vue' +import elevator_door from '@/views/acs/device/driver/elevator_door.vue' export default { name: 'DeviceConfig', components: { @@ -94,7 +98,11 @@ export default { xg_agv, belt_conveyor, standard_manipulator, - xg_agv_car + xg_agv_car, + production_line_docking_station, + remove_seal_cover_position, + unpacking_conveyor, + elevator_door }, dicts: ['device_type'], mixins: [crud], diff --git a/acs/acs2/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_two.vue b/acs/acs2/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_two.vue index e69de29..867afad 100644 --- a/acs/acs2/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_two.vue +++ b/acs/acs2/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_two.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/acs/acs2/nladmin-ui/src/views/acs/device/driver/elevator_door.vue b/acs/acs2/nladmin-ui/src/views/acs/device/driver/elevator_door.vue new file mode 100644 index 0000000..a97ada6 --- /dev/null +++ b/acs/acs2/nladmin-ui/src/views/acs/device/driver/elevator_door.vue @@ -0,0 +1,413 @@ + + + + + diff --git a/acs/acs2/nladmin-ui/src/views/acs/device/driver/production_line_docking_station.vue b/acs/acs2/nladmin-ui/src/views/acs/device/driver/production_line_docking_station.vue new file mode 100644 index 0000000..a97ada6 --- /dev/null +++ b/acs/acs2/nladmin-ui/src/views/acs/device/driver/production_line_docking_station.vue @@ -0,0 +1,413 @@ + + + + + diff --git a/acs/acs2/nladmin-ui/src/views/acs/device/driver/remove_seal_cover_position.vue b/acs/acs2/nladmin-ui/src/views/acs/device/driver/remove_seal_cover_position.vue new file mode 100644 index 0000000..a97ada6 --- /dev/null +++ b/acs/acs2/nladmin-ui/src/views/acs/device/driver/remove_seal_cover_position.vue @@ -0,0 +1,413 @@ + + + + + diff --git a/acs/acs2/nladmin-ui/src/views/acs/device/driver/unpacking_conveyor.vue b/acs/acs2/nladmin-ui/src/views/acs/device/driver/unpacking_conveyor.vue new file mode 100644 index 0000000..a97ada6 --- /dev/null +++ b/acs/acs2/nladmin-ui/src/views/acs/device/driver/unpacking_conveyor.vue @@ -0,0 +1,413 @@ + + + + + diff --git a/acs/acs2/nladmin-ui/src/views/acs/device/index.vue b/acs/acs2/nladmin-ui/src/views/acs/device/index.vue index 97b98dd..d33e12a 100644 --- a/acs/acs2/nladmin-ui/src/views/acs/device/index.vue +++ b/acs/acs2/nladmin-ui/src/views/acs/device/index.vue @@ -68,6 +68,16 @@ + + 导出模板 + @@ -239,6 +250,8 @@ import pagination from '@crud/Pagination' import { get } from '@/views/system/dict/dictDetail' import UploadDialog from '@/views/acs/device/UploadDialog' import i18n from '@/i18n' +import XLSX from 'xlsx' +import { downloadFile } from '@/utils' const defaultForm = { manufacturer: null, @@ -324,6 +337,60 @@ export default { tableChanged3() { this.crud.toQuery() }, + downloadImportTemplate() { + const headers = [ + '设备编码', + '设备名称', + '印尼设备名称', + '英文设备名称', + '中文设备名称', + '设备类型', + '区域', + '序号', + '所属车间', + '描述信息' + ] + const example = [ + 'DEVICE_001', + '设备名称示例', + 'Nama perangkat', + 'Device name', + '设备中文名称', + this.getDictExample(this.device_types), + this.getDictExample(this.regions), + 1, + this.getDictExample(this.dict.area), + '备注说明' + ] + const tips = [ + ['字段', '是否必填', '填写说明'], + ['设备编码', '是', '唯一设备编码'], + ['设备名称', '是', '设备显示名称'], + ['印尼设备名称', '否', '印尼语设备名称'], + ['英文设备名称', '否', '英文设备名称'], + ['中文设备名称', '否', '中文设备名称'], + ['设备类型', '是', '请按系统设备类型字典填写'], + ['区域', '否', '请按系统区域字典填写'], + ['序号', '否', '数字,默认从 1 开始'], + ['所属车间', '否', '请按系统所属车间字典填写'], + ['描述信息', '否', '备注说明'] + ] + const workbook = XLSX.utils.book_new() + const worksheet = XLSX.utils.aoa_to_sheet([headers, example]) + const tipSheet = XLSX.utils.aoa_to_sheet(tips) + worksheet['!cols'] = headers.map(() => ({ wch: 18 })) + tipSheet['!cols'] = [{ wch: 18 }, { wch: 12 }, { wch: 32 }] + XLSX.utils.book_append_sheet(workbook, worksheet, '设备导入模板') + XLSX.utils.book_append_sheet(workbook, tipSheet, '填写说明') + const content = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' }) + downloadFile(content, '设备导入模板', 'xlsx') + }, + getDictExample(list) { + if (!list || list.length === 0) { + return '' + } + return list[0].label || list[0].value || '' + }, reload() { crudDevice.reload().then(res => { this.crud.toQuery() diff --git a/acs/acs2/nladmin-ui/src/views/acs/device/opc/index.vue b/acs/acs2/nladmin-ui/src/views/acs/device/opc/index.vue index c5d7477..332b53d 100644 --- a/acs/acs2/nladmin-ui/src/views/acs/device/opc/index.vue +++ b/acs/acs2/nladmin-ui/src/views/acs/device/opc/index.vue @@ -108,8 +108,8 @@ style="width: 100%" row-key="opc_id" border - default-expand-all - :tree-props="{children: 'children', has_children: 'has_children'}" + :default-expand-all="true" + :tree-props="{children: 'children', hasChildren: 'hasChildren'}" @select="crud.selectChange" @select-all="crud.selectAllChange" @selection-change="crud.selectionChangeHandler" @@ -232,6 +232,25 @@ export default { [CRUD.HOOK.beforeRefresh]() { return true }, + [CRUD.HOOK.afterRefresh]() { + this.crud.data = this.processTreeData(this.crud.data) + }, + processTreeData(data) { + if (!data || !Array.isArray(data)) return data + return data.map(item => { + if (item.hasOwnProperty('hasChildren')) { + item.hasChildren = item.hasChildren === '1' || item.hasChildren === 1 || item.hasChildren === true + } else if (item.children && item.children.length > 0) { + item.hasChildren = true + } else { + item.hasChildren = false + } + if (item.children && Array.isArray(item.children)) { + item.children = this.processTreeData(item.children) + } + return item + }) + }, handleClick(row, flag) { // flag为0是新增,flag为1是编辑,flag为2是删除 // 如果是父类操作 diff --git a/acs/acs2/nladmin-ui/src/views/acs/instruction/index.vue b/acs/acs2/nladmin-ui/src/views/acs/instruction/index.vue index 3d552c3..36bf401 100644 --- a/acs/acs2/nladmin-ui/src/views/acs/instruction/index.vue +++ b/acs/acs2/nladmin-ui/src/views/acs/instruction/index.vue @@ -43,7 +43,7 @@ style="width: 200px" @change="crud.toQuery" > - + @@ -57,7 +57,7 @@ style="width: 200px" @change="crud.toQuery" > - + @@ -71,7 +71,7 @@ @keyup.enter.native="crud.toQuery" /> - + @@ -98,23 +98,32 @@ > - + - + - + + + + + + + + + + - + @@ -127,61 +136,140 @@ style="width: 100%;" @selection-change="crud.selectionChangeHandler" > - - - - + + + + + + + - - - - - + - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - + @@ -219,6 +307,7 @@ import crudOperation from '@crud/CRUD.operation' import rrOperation from '@crud/RR.operation' import { getDicts } from '@/views/system/dict/dict' import pagination from '@crud/Pagination' +import deviceCrud from '@/api/acs/device/device' const defaultForm = { instruction_id: null, @@ -242,6 +331,8 @@ const defaultForm = { start_device_code: null, next_point_code: null, next_device_code: null, + task_group_id: null, + task_group_seq: null, from_x: null, from_y: null, from_z: null, @@ -279,6 +370,7 @@ export default { }, data() { return { + deviceList: [], permission: { add: ['admin', 'instruction:add'], edit: ['admin', 'instruction:edit'], @@ -310,11 +402,25 @@ export default { } }, created() { + deviceCrud.selectDeviceList().then(data => { + this.deviceList = data + }) getDicts().then(data => { this.dicts = data }) }, methods: { + formatDeviceLabel(code) { + if (!code) { + return '' + } + const device = this.deviceList.find(item => item.device_code === code) + if (!device) { + return code + } + const deviceName = device.zh_device_name || device.device_name + return deviceName ? `${code} - ${deviceName}` : code + }, // 钩子:在获取表格数据之前执行,false 则代表不获取数据 [CRUD.HOOK.beforeRefresh]() { return true diff --git a/acs/acs2/nladmin-ui/src/views/acs/task/index.vue b/acs/acs2/nladmin-ui/src/views/acs/task/index.vue index abb7c9d..80c370a 100644 --- a/acs/acs2/nladmin-ui/src/views/acs/task/index.vue +++ b/acs/acs2/nladmin-ui/src/views/acs/task/index.vue @@ -21,7 +21,7 @@ style="width: 200px" @change="crud.toQuery" > - + @@ -57,7 +57,7 @@ style="width: 200px" @change="crud.toQuery" > - + - + @@ -104,9 +104,9 @@ -
+
- + - + - + - + + + + - + -
+
- + - + - + + + + + + + + + + - + - - - - - - @@ -370,7 +376,7 @@ stripe border > - +