严智鑫
2024-12-03 def1eb8623e1444164ae4bce9179d011a89b8c5e
现场对接批量更新
52个文件已修改
35个文件已添加
13个文件已删除
9896 ■■■■ 已修改文件
JiuMuMesParent/JsonFile/PlcCacheGlass.json 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/JsonFile/PlcCacheVerticalGlass.json 377 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/JsonFile/PlcCleaning.json 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/JsonFile/PlcEdging.json 190 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/JsonFile/PlcFlipSlice.json 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/JsonFile/PlcLoad.json 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/JsonFile/PlcLoadGlass.json 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/JsonFile/PlcMarking.json 318 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/JsonFile/PlcRotate.json 169 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/JsonFile/PlcSilkScreen.json 183 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/JsonFile/PlcdownGlass.json 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/common/servicebase/pom.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/common/servicebase/src/main/java/com/mes/device/PlcParameterObject.java 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/common/servicebase/src/main/java/com/mes/service/ModbusTcp.java 200 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/common/servicebase/src/main/java/com/mes/service/PlcAgreement.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/common/servicebase/src/main/java/com/mes/service/PlcParameter.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/common/servicebase/src/main/java/com/mes/tools/HexConversion.java 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/common/servicebase/src/main/java/com/mes/tools/S7control.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/common/servicebase/src/main/java/com/mes/utils/HexUtil.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/common/springsecurity/src/main/resources/application-dev.yml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/common/springsecurity/src/main/resources/application-loc.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/common/springsecurity/src/main/resources/application-prod.yml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/gateway/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/gateway/target/classes/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/gateway/target/gateway-1.0-SNAPSHOT.jar.original 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/pom.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/AppRunnerConfig.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/DeviceInteractionModuleApplication.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/CommunicationProtocol.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/S7object.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/S7objectCleaning.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/S7objectFlipSlice.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/S7objectMachine.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/S7objectMarking.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/tcpIp.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/AddTask.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/MachineTask.java 164 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/MarkingTask.java 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCCleaning.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCEdging.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCFlipSlice.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCLoad.java 198 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCManualReporting.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCMechanicalArm.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCRotate.java 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCScanQRVerify.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCScanQRWorks.java 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCScanQrCodesReport.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/SilkScreenTask.java 246 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/controller/PrimitiveTaskController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/controller/TaskingController.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/KBBTJPDrawingBP.java 165 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/LineConfiguration.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/Machine.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/PrimitiveTask.java 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/Tasking.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/mapper/KBBTJPDrawingBPMapper.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/KBBTJPDrawingBPService.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/LineConfigurationService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/PrimitiveTaskService.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/ProjectService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/TaskingService.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/KBBTJPDrawingBPServiceImpl.java 154 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/LineConfigurationServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/PrimitiveTaskServiceImpl.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/ProjectServiceImpl.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/TaskingServiceImpl.java 397 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineEdging.java 313 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineFlipSlice.java 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineLoad.java 164 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineMarking.java 139 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineRotate.java 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineSilkScreen.java 211 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineThread.java 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/resources/application-prod.yml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/test/java/com/mes/DeviceInteractionModuleApplicationTest.java 214 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/target/classes/application-prod.yml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/target/deviceInteraction-1.0-SNAPSHOT.jar.original 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/config.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/package.json 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/assets/磨边机.png 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/assets/翻片台.png 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/assets/自动丝印机.png 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/lang/zh.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/router/index.js 87 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/utils/constants.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/utils/headerTB.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Edging/edging.vue 451 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/FlipSlice/flipSlice.vue 245 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/ManualReporting/manualReporting.vue 408 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Marking/marking.vue 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/MechanicalArm/mechanicalArm.vue 533 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/MechanicalArm/mechanicalArm2.vue 321 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Rotate/rotate.vue 427 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/ScanQrCodesReport/scanQrCodesReport.vue 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/SilkScreen/SilkScreen.vue 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/JsonFile/PlcCacheGlass.json
File was deleted
JiuMuMesParent/JsonFile/PlcCacheVerticalGlass.json
File was deleted
JiuMuMesParent/JsonFile/PlcCleaning.json
New file
@@ -0,0 +1,22 @@
{
   "plcAddressBegin":"DB1.8000",
   "plcAddressLenght":"84",
   "dataType":"word",
   "parameteInfor":[
       {
         "codeId": "edgSpeed",
         "addressIndex": "48",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "thinness",
         "addressIndex": "50",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       }
   ]
}
JiuMuMesParent/JsonFile/PlcEdging.json
New file
@@ -0,0 +1,190 @@
{
   "plcAddressBegin":"0000",
   "plcAddressLength":"50",
   "requestHead":"000100000006010300000032",
   "parameterInfo":[
       {
         "codeId": "plcRequest",
         "addressIndex": "0",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "plcRequestID",
         "addressIndex": "2",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "plcReport",
         "addressIndex": "10",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "plcReportID",
         "addressIndex": "12",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
     {
       "codeId": "plcReport2",
       "addressIndex": "16",
       "addressLength": "2",
       "type": "word",
       "unit": ""
     },
     {
       "codeId": "plcReportID2",
       "addressIndex": "18",
       "addressLength": "2",
       "type": "word",
       "unit": ""
     },
       {
         "codeId": "mesSend",
         "addressIndex": "20",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "mesSendID",
         "addressIndex": "22",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "length",
         "addressIndex": "24",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "width",
         "addressIndex": "26",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "thickness",
         "addressIndex": "28",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "mesConfirm",
         "addressIndex": "38",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "mesConfirmID",
         "addressIndex": "40",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
     {
       "codeId": "mesConfirm2",
       "addressIndex": "46",
       "addressLength": "2",
       "type": "word",
       "unit": ""
     },
     {
       "codeId": "mesConfirmID2",
       "addressIndex": "48",
       "addressLength": "2",
       "type": "word",
       "unit": ""
     },
       {
         "codeId": "alarmStatus",
         "addressIndex": "58",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "alarmWord1",
         "addressIndex": "60",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "alarmWord2",
         "addressIndex": "62",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "alarmWord3",
         "addressIndex": "64",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "machineStatusWord",
         "addressIndex": "68",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut2",
         "addressIndex": "70",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut3",
         "addressIndex": "72",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut4",
         "addressIndex": "74",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut5",
         "addressIndex": "76",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut6",
         "addressIndex": "78",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut7",
         "addressIndex": "80",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       }
     ]
}
JiuMuMesParent/JsonFile/PlcFlipSlice.json
New file
@@ -0,0 +1,148 @@
{
   "plcAddressBegin":"DB100.0",
   "plcAddressLenght":"568",
   "dataType":"word",
   "parameteInfor":[
       {
         "codeId": "plcRequest",
         "addressIndex": "0",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "plcRequestID",
         "addressIndex": "2",
         "addressLenght": "256",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "plcRequestType",
         "addressIndex": "258",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby20",
         "addressIndex": "260",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby21",
         "addressIndex": "262",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "plcReport",
         "addressIndex": "264",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "plcReportID",
         "addressIndex": "266",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby25",
         "addressIndex": "268",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby26",
         "addressIndex": "270",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby27",
         "addressIndex": "272",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "mesSend",
         "addressIndex": "274",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "mesSendID",
         "addressIndex": "276",
         "addressLenght": "256",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "length",
         "addressIndex": "532",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
     {
       "codeId": "width",
       "addressIndex": "534",
       "addressLenght": "2",
       "ratio": "1",
       "unit": ""
     },
     {
       "codeId": "thickness",
       "addressIndex": "536",
       "addressLenght": "2",
       "ratio": "1",
       "unit": ""
     },
     {
       "codeId": "standby28",
       "addressIndex": "538",
       "addressLenght": "2",
       "ratio": "1",
       "unit": ""
     },
       {
         "codeId": "mesSendType",
         "addressIndex": "540",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby30",
         "addressIndex": "542",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby31",
         "addressIndex": "544",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby32",
         "addressIndex": "546",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       }
   ]
}
JiuMuMesParent/JsonFile/PlcLoad.json
New file
@@ -0,0 +1,134 @@
{
   "plcAddressBegin":"0000",
   "plcAddressLength":"50",
   "requestHead":"000100000006010300000032",
   "parameterInfo":[
       {
         "codeId": "plcRequest",
         "addressIndex": "2",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "plcRequestID",
         "addressIndex": "4",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "plcReport",
         "addressIndex": "10",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "plcReportID",
         "addressIndex": "12",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "mesSend",
         "addressIndex": "20",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "mesSendCount",
         "addressIndex": "22",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "mesConfirm",
         "addressIndex": "40",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "alarmStatus",
         "addressIndex": "62",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "alarmWord1",
         "addressIndex": "64",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "alarmWord2",
         "addressIndex": "66",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "alarmWord3",
         "addressIndex": "68",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "machineStatusWord",
         "addressIndex": "70",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut2",
         "addressIndex": "72",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut3",
         "addressIndex": "74",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut4",
         "addressIndex": "76",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut5",
         "addressIndex": "78",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut6",
         "addressIndex": "80",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut7",
         "addressIndex": "82",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       }
     ]
}
JiuMuMesParent/JsonFile/PlcLoadGlass.json
File was deleted
JiuMuMesParent/JsonFile/PlcMarking.json
New file
@@ -0,0 +1,318 @@
{
   "plcAddressBegin":"DB14.0",
   "plcAddressLenght":"1096",
   "dataType":"word",
   "parameteInfor":[
       {
         "codeId": "plcRequest",
         "addressIndex": "0",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "plcRequestID",
         "addressIndex": "2",
         "addressLenght": "4",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby19",
         "addressIndex": "6",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby20",
         "addressIndex": "8",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby21",
         "addressIndex": "10",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "plcReport",
         "addressIndex": "12",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "plcReportID",
         "addressIndex": "14",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby25",
         "addressIndex": "18",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby26",
         "addressIndex": "20",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "mesSend",
         "addressIndex": "22",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "mesSend",
         "addressIndex": "24",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "mesSendID",
         "addressIndex": "26",
         "addressLenght": "4",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "drawingMark",
         "addressIndex": "30",
         "addressLenght": "256",
         "ratio": "1",
         "unit": ""
       },
     {
       "codeId": "drawingMark2",
       "addressIndex": "258",
       "addressLenght": "256",
       "ratio": "1",
       "unit": ""
     },
     {
       "codeId": "drawingMark3",
       "addressIndex": "542",
       "addressLenght": "256",
       "ratio": "1",
       "unit": ""
     },
     {
       "codeId": "drawingMark4",
       "addressIndex": "798",
       "addressLenght": "236",
       "ratio": "1",
       "unit": ""
     },
       {
         "codeId": "isMark",
         "addressIndex": "1034",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "width(OutOfService)",
         "addressIndex": "1036",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "length(OutOfService)",
         "addressIndex": "1038",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "thickness(OutOfService)",
         "addressIndex": "1040",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "sumCount(OutOfService)",
         "addressIndex": "1042",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby34",
         "addressIndex": "1044",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "markingMode",
         "addressIndex": "1046",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby36",
         "addressIndex": "1048",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "mesConfirm",
         "addressIndex": "1050",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "mesConfirmID",
         "addressIndex": "1052",
         "addressLenght": "4",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby39",
         "addressIndex": "1056",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby40",
         "addressIndex": "1058",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby41",
         "addressIndex": "1060",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby42",
         "addressIndex": "1062",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby43",
         "addressIndex": "1064",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby44",
         "addressIndex": "1066",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "MesTaskStatus",
         "addressIndex": "1068",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby46",
         "addressIndex": "1070",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "alarmStatus",
         "addressIndex": "1072",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "alarmWord1",
         "addressIndex": "1074",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "alarmWord2",
         "addressIndex": "1076",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "alarmWord3",
         "addressIndex": "1078",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "alarmWord4",
         "addressIndex": "1080",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "machineStatusWord",
         "addressIndex": "1082",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "inputOrOut2",
         "addressIndex": "1084",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "inputOrOut3",
         "addressIndex": "1086",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "inputOrOut4",
         "addressIndex": "1088",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "inputOrOut5",
         "addressIndex": "1090",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       }
   ]
}
JiuMuMesParent/JsonFile/PlcRotate.json
New file
@@ -0,0 +1,169 @@
{
   "plcAddressBegin":"DB100.0",
   "plcAddressLenght":"554",
   "dataType":"word",
   "parameteInfor":[
       {
         "codeId": "plcRequest",
         "addressIndex": "0",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "plcRequestID",
         "addressIndex": "2",
         "addressLenght": "256",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "plcRequestType",
         "addressIndex": "258",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby20",
         "addressIndex": "260",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby21",
         "addressIndex": "262",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "plcReport",
         "addressIndex": "264",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "plcReportID",
         "addressIndex": "266",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby25",
         "addressIndex": "268",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby26",
         "addressIndex": "270",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby27",
         "addressIndex": "272",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "mesSend",
         "addressIndex": "274",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "mesSendID",
         "addressIndex": "276",
         "addressLenght": "256",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "length",
         "addressIndex": "532",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
     {
       "codeId": "width",
       "addressIndex": "534",
       "addressLenght": "2",
       "ratio": "1",
       "unit": ""
     },
     {
       "codeId": "thickness",
       "addressIndex": "536",
       "addressLenght": "2",
       "ratio": "1",
       "unit": ""
     },
     {
       "codeId": "rotateType",
       "addressIndex": "538",
       "addressLenght": "2",
       "ratio": "1",
       "unit": ""
     },
       {
         "codeId": "mesSendType",
         "addressIndex": "540",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby30",
         "addressIndex": "542",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby31",
         "addressIndex": "544",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
       {
         "codeId": "standby32",
         "addressIndex": "546",
         "addressLenght": "2",
         "ratio": "1",
         "unit": ""
       },
     {
       "codeId": "mesConfirm",
       "addressIndex": "548",
       "addressLenght": "2",
       "ratio": "1",
       "unit": ""
     },
     {
       "codeId": "mesConfirmID",
       "addressIndex": "550",
       "addressLenght": "2",
       "ratio": "1",
       "unit": ""
     },
     {
       "codeId": "standby35",
       "addressIndex": "552",
       "addressLenght": "2",
       "ratio": "1",
       "unit": ""
     }
   ]
}
JiuMuMesParent/JsonFile/PlcSilkScreen.json
New file
@@ -0,0 +1,183 @@
{
   "plcAddressBegin":"0000",
   "plcAddressLength":"40",
   "requestHead":"000100000006010300000028",
   "parameterInfo":[
       {
         "codeId": "plcRequest",
         "addressIndex": "0",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "plcRequestID",
         "addressIndex": "2",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "plcReport",
         "addressIndex": "10",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "plcReportID",
         "addressIndex": "12",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "mesSend",
         "addressIndex": "20",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "mesSendID",
         "addressIndex": "22",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "length",
         "addressIndex": "24",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "width",
         "addressIndex": "26",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "thickness",
         "addressIndex": "28",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "X",
         "addressIndex": "30",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "Y",
         "addressIndex": "32",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "isSilkScreen",
         "addressIndex": "34",
         "addressLength": "2",
         "type": "word",
         "unit": ""
        },
       {
         "codeId": "mesConfirm",
         "addressIndex": "40",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "mesConfirmID",
         "addressIndex": "42",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "alarmStatus",
         "addressIndex": "60",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "alarmWord1",
         "addressIndex": "62",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "alarmWord2",
         "addressIndex": "64",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "alarmWord3",
         "addressIndex": "66",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "machineStatusWord",
         "addressIndex": "68",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut2",
         "addressIndex": "70",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut3",
         "addressIndex": "72",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut4",
         "addressIndex": "74",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut5",
         "addressIndex": "76",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut6",
         "addressIndex": "78",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       },
       {
         "codeId": "inputOrOut7",
         "addressIndex": "80",
         "addressLength": "2",
         "type": "word",
         "unit": ""
       }
     ]
}
JiuMuMesParent/JsonFile/PlcdownGlass.json
File was deleted
JiuMuMesParent/common/servicebase/pom.xml
@@ -22,6 +22,11 @@
            <artifactId>mssql-jdbc</artifactId>
            <version>6.4.0.jre8</version>
        </dependency>
        <dependency>
            <groupId>com.github.s7connector</groupId>
            <artifactId>s7connector</artifactId>
            <version>2.1</version>
        </dependency>
    </dependencies>
</project>
JiuMuMesParent/common/servicebase/src/main/java/com/mes/device/PlcParameterObject.java
@@ -1,20 +1,24 @@
package com.mes.device;
import com.github.s7connector.impl.serializer.converter.StringConverter;
import com.github.xingshuangs.iot.utils.IntegerUtil;
import com.github.xingshuangs.iot.utils.ShortUtil;
import com.mes.service.PlcAgreement;
import com.mes.service.PlcParameter;
import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.Array;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.*;
@Slf4j
public class PlcParameterObject {
    // è¯¥æ¨¡å—数据类型,数据起始位置
    private String plcAddressBegin;
    // æ•°æ®åœ°å€é•¿åº¦ï¼šç¬¬ä¸€å‚数到最后一个参数的长度
    private int plcAddressLength;
    //private ArrayList<PlcParameterInfo> plcParameterList;
    private LinkedHashMap<String,PlcParameterInfo> plcParameterMap;
@@ -61,7 +65,7 @@
     */
    public PlcParameterInfo getPlcParameter(String codeid) {
        if (plcParameterMap != null) {
                    return plcParameterMap.get(codeid);
            return plcParameterMap.get(codeid);
        } else {
            return null;
        }
@@ -163,40 +167,16 @@
                    plcParameterInfo.setValue(String.valueOf(ShortUtil.toUInt16(valueList)));
                } else if (plcParameterInfo.getAddressLength() == 4) {
                    plcParameterInfo.setValue(String.valueOf(IntegerUtil.toUInt32(valueList)));
                }
                else if (plcParameterInfo.getAddressLength() >10) {
                    plcParameterInfo.setValue((byteToHexString(valueList)));
                } else {
                }else if(plcParameterInfo.getAddressLength()==256){
                    StringConverter converter = new StringConverter();
                    String s="";
                    String extract1 = converter.extract(s.getClass(),valueList, 0, 0);
                    plcParameterInfo.setValue(extract1);
                }else {
                    plcParameterInfo.setValue((byteToHexString(valueList)));
                }
            }
        }
/*        if (plcParameterList != null) {
            for (PlcParameterInfo plcParameterInfo : plcParameterList) {
                byte[] valueList = new byte[plcParameterInfo.getAddressLength()];
//                System.out.println(plcParameterInfo.getAddressLength());
                for (int i = 0; i < plcParameterInfo.getAddressLength(); i++) {
                    Array.setByte(valueList, i, plcValueArray[plcParameterInfo.getAddressIndex() + i]);
                }
                if (plcParameterInfo.getAddressLength() == 2) {
                    plcParameterInfo.setValue(String.valueOf(byte2short(valueList)));
                } else if (plcParameterInfo.getAddressLength() == 4) {
                    plcParameterInfo.setValue(String.valueOf(byte2int(valueList)));
                }
                else if (plcParameterInfo.getAddressLength() >10) {
                    plcParameterInfo.setValue((byteToHexString(valueList)));
                } else {
                    String valuestr = new String(valueList);
                    plcParameterInfo.setValue(valuestr);
                }
            }
        }*/
    }
    /**
     * æŠŠå†™å…¥å€¼è½¬åŒ–为byte[]
JiuMuMesParent/common/servicebase/src/main/java/com/mes/service/ModbusTcp.java
@@ -2,6 +2,7 @@
import com.mes.tools.HexConversion;
import com.mes.utils.HexUtil;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -17,6 +18,8 @@
import java.util.LinkedHashMap;
import java.util.Map;
import static com.mes.tools.HexConversion.*;
@Component
@Slf4j
public class ModbusTcp {
@@ -27,73 +30,173 @@
    private int Port;
    public Socket socket =null;//通讯
    ModbusTcp(){}
    public ModbusTcp(String Ip,int Port){
    public String fileName ="";
    public ModbusTcp(){}
    public ModbusTcp(String Ip,int Port,String fileName){
        this.Ip=Ip;
        this.Port=Port;
        this.fileName=fileName;
        try {
            socket=new Socket(Ip,Port);
        }catch (UnknownHostException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
            plcAgreement.put(this.fileName,new PlcAgreement(this.fileName));
        } catch (Exception e) {
            log.info("file error:"+this.fileName+",{}",e.getMessage());
        }
    }
    //连接
    //@Scheduled(fixedDelay = 1000)
    public void a()throws Exception{
        //read();
        log.info("123");
    public void connect(){
        try {
            this.socket=new Socket(Ip,Port);
            this.socket.setSoTimeout(2000);
        }catch (Exception e) {
            log.info("The IP address of the host cannot be determined:{}",e.getMessage());
        }
    }
    //关闭连接
    public void close(){
        try {
            this.socket.close();
        }catch (Exception e) {
            //log.info("连接关闭异常:{}",e.getMessage());
        }
    }
    //返回连接状态
    public boolean isConnect(){
        try {
            this.socket.isConnected();
        }catch (Exception e) {
            log.info("Connection status exception:{}",this.socket);
        }
        return false;
    }
    //读取数据
    public void read(PlcAgreement plcAgreement)throws Exception{
        int bufSizes = 0;
        byte[] msgs = new byte[2048];
        //写入读取地址
        DataOutputStream outToServer = new DataOutputStream(socket.getOutputStream());
        outToServer.write(HexConversion.stringToInt(plcAgreement.requestHead));
        outToServer.flush();
        //读取内容
        DataInputStream in = new DataInputStream(socket.getInputStream());
        bufSizes = in.read(msgs);
        String message = HexConversion.byteToHexString(bufSizes, msgs);//十进制字节数组转十六进制字符串
        //获取参数值
        Map<String, PlcParameter> plcParameters=plcAgreement.getPlcParameters();
        for (String key:plcParameters.keySet()){
            PlcParameter plcParameter=plcParameters.get(key);
            if("bit".equals(plcParameter.getType())){
                byte font=msgs[plcParameter.getAddressStart()];
                String[] fontBitString=String.format("%8s", Integer.toBinaryString((int)font)).replace(" ", "0").split("");
                byte[] bit=new byte[1];
                bit[0]=Byte.parseByte(fontBitString[plcParameter.getAddressLength()]);
                plcParameter.setReadByte(bit);
            }else{
                plcParameter.setReadByte(Arrays.copyOfRange(msgs,plcParameter.getAddressStart(),(plcParameter.getAddressStart()+plcParameter.getAddressLength())));
    public boolean read(PlcAgreement plcAgreement){
        try {
            if (!this.socket.isConnected()){
               // log.info("通讯连接失败:{}",this.socket.isConnected());
                return false;
            }
            int bufSizes = 0;
            byte[] msgs = new byte[2048];
            byte[] content = new byte[2048];
            //写入读取地址
            DataOutputStream outToServer = new DataOutputStream(this.socket.getOutputStream());
            outToServer.write(HexConversion.stringToInt(plcAgreement.requestHead));
            outToServer.flush();
            //读取内容
            DataInputStream in = new DataInputStream(this.socket.getInputStream());
            bufSizes = in.read(msgs);
            if(bufSizes<plcAgreement.plcAddressLength+9){
                log.info("Read byte length <1:{},content:{}",bufSizes,msgs);
                return false;
            }
            content=Arrays.copyOfRange(msgs,9,2048);
            //获取参数值
            Map<String, PlcParameter> plcParameters=plcAgreement.getPlcParameters();
            for (String key:plcParameters.keySet()){
                PlcParameter plcParameter=plcParameters.get(key);
                if("bit".equals(plcParameter.getType())){
                    byte font=content[plcParameter.getAddressStart()];
                    String[] fontBitString=String.format("%8s", Integer.toBinaryString((int)font)).replace(" ", "0").split("");
                    byte[] bit=new byte[1];
                    bit[0]=Byte.parseByte(fontBitString[plcParameter.getAddressLength()]);
                    plcParameter.setReadByte(bit);
                }else{
                    plcParameter.setReadByte(Arrays.copyOfRange(content,plcParameter.getAddressStart(),(plcParameter.getAddressStart()+plcParameter.getAddressLength())));
                }
            }
            return true;
        }catch (Exception e) {
            //log.info("读取异常:{}",plcAgreement);
        }
        return false;
    }
    //写入数据
    public void write(PlcParameter plcParameter){
        try {
            if (plcParameter.getWriteValue() != null && !"".equals(plcParameter.getWriteValue())) {
                //写入发送数据
                DataOutputStream out = new DataOutputStream(socket.getOutputStream());
                out.write(HexConversion.stringToInt(plcParameter.getWriteValue().toString()));
                //写入发送数据 0000 0000 0009 0110 0024 0001 02 0006
                byte []sendByte=new byte[13+plcParameter.getAddressLength()];
                byte []sendLength=intToBytesDesc(7+plcParameter.getAddressLength(),2);
                byte []sendAddress=intToBytesDesc(plcParameter.getAddressStart()/2,2);
                byte []sendFontLength=intToBytesDesc(plcParameter.getAddressLength()/2,2);
                byte []sendContent=plcParameter.getWriteByte();
                //byte []sendContent=intToBytesDesc(Integer.parseInt(plcParameter.getWriteValue().toString()),plcParameter.getAddressLength());
                sendByte[4]=sendLength[0];
                sendByte[5]=sendLength[1];
                sendByte[6]=(byte)1;
                sendByte[7]=(byte)16;
                sendByte[8]=sendAddress[0];
                sendByte[9]=sendAddress[1];
                sendByte[10]=sendFontLength[0];
                sendByte[11]=sendFontLength[1];
                sendByte[12]=(byte)plcParameter.getAddressLength();
                for(int i=0;i<sendContent.length;i++){
                    sendByte[i+13]=sendContent[i];
                }
                log.info("sendByte:{}",sendByte);
                DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());
                out.write(sendByte);
                out.flush();
                //log.info("sendByte:{}",sendByte);
            }
        } catch (IOException e) {
            log.info("写入数据异常");
            log.info("写入数据异常:{}",plcParameter);
            throw new RuntimeException(e);
        }
    }
    //数据处理
    public void handleData(PlcParameter plcParameter){
        //写入发送数据 0000 0000 0009 0110 0024 0001 02 0006
        try {
            int sendLength=plcParameter.getAddressLength()+7;//发送长度
            byte [] addressLength=intToBytesDesc(plcParameter.getAddressLength(),1);//字节长度
            byte [] addressLengthFont=intToBytesDesc((plcParameter.getAddressLength()/2),2);//字长度
            byte start[]=intToBytesDesc(plcParameter.getAddressStart()/2,2);//起始地址
            byte content[]=intToBytesDesc(Integer.valueOf(plcParameter.getWriteValue().toString()) ,2);//起始地址
            if (sendLength>14&&
                    addressLength.length>0&&
                    addressLengthFont.length>1&&
                    start.length>1&&
                    content.length>1){
                byte head[]=new byte[]{0,0,0,(byte)sendLength,1,16,start[0],start[1],addressLengthFont[0],addressLengthFont[1],addressLength[0],content[0],content[1]};
                this.write(head);
            }else{
                log.info("发送内容不符合: å­—节长度 {},字长度:{},起始地址,{},内容:{}",addressLength,addressLengthFont,start,content);
            }
        } catch (Exception e) {
            log.info("数据处理异常: å†…容 {}",plcParameter);
        }
    }
    //写入数据
    public void write(String key,String writeValue)throws Exception{
        if (writeValue != null && !"".equals(writeValue)) {
            //写入发送数据
            DataOutputStream out = new DataOutputStream(socket.getOutputStream());
            out.write(HexConversion.stringToInt(writeValue));
            out.flush();
    public void write(byte []sendByte){
        try {
            if (sendByte != null) {
                //写入发送数据
                DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());
                out.write(sendByte);
                out.flush();
                log.info("写入成功: å†…容 {}",sendByte);
            }
        } catch (Exception e) {
            log.info("写入失败: å†…容 {}",sendByte);
        }
    }
    //写入数据String
    public void writeString(String sendString,String startAddress){
        try {
            String result=message(sendString,startAddress);
            if (result != null && !"".equals(result)) {
                //写入数据
                DataOutputStream out = new DataOutputStream(socket.getOutputStream());
                out.write(HexUtil.stringToInt(result));
                out.flush();
                log.info("写入成功:地址 {},内容 {},字节:{}",startAddress,sendString,HexUtil.stringToInt(result));
                //this.close();
            }
        } catch (Exception e) {
            log.info("写入异常:地址 {},内容 {}",startAddress,sendString);
        }
    }
    //写
@@ -108,4 +211,13 @@
    public PlcAgreement getPlcAgreement(String key){
        return plcAgreement.get(key);
    }
    public void consoleLogInfo(PlcAgreement thisPlcAgreement){
        String logInfo=this.fileName+"  ";
        Map<String,PlcParameter> plcParameterMap=thisPlcAgreement.getPlcParameters();
        for (String key:plcParameterMap.keySet()) {
            logInfo+=key+":"+plcParameterMap.get(key).getValueString()+",";
        }
        log.info(logInfo);
    }
}
JiuMuMesParent/common/servicebase/src/main/java/com/mes/service/PlcAgreement.java
@@ -24,7 +24,7 @@
    /**
     * åè®®å‚æ•°
     */
    private List<String> parameterKeys=null;
    private List<String> parameterKeys=new ArrayList<>();
    private Map<String,PlcParameter> parameters=null;
    /**
     * åè®®è·¯å¾„
@@ -40,11 +40,12 @@
    public int plcAddressLength=0;
    //类似序列号(4)+协议标志(4)+长度(4)+从站地址(2)+功能代码(2)+起始地址(4)+读取数量(4) "000100000006010300000032"
    public String requestHead=null;
    PlcAgreement(){
        jsonFilePath = System.getProperty("user.dir") + "../../JsonFile/PlcCacheGlass.json";
    private PlcAgreement(){}
    PlcAgreement(String fileName){
        //jsonFilePath = "D:/mes/JsonFile/"+fileName+".json";
        jsonFilePath = System.getProperty("user.dir") + "/JsonFile/"+fileName+".json";
        boolean initSuccess=initword();
        log.info("初始化PlcCacheGlass:"+initSuccess);
        //log.info("初始化PlcCacheGlass:"+initSuccess);
    }
    //初始化word
    public boolean initword() {
@@ -63,20 +64,20 @@
            fileReader.close();
            JSONObject jsonFile = new JSONObject(content.toString());
            //log.info("读取内容:{}",jsonFile);
            JSONArray jsonArray = jsonFile.getJSONArray("parameterInfo");
            this.plcAddressBegin=jsonFile.getStr("plcAddressBegin");//设置起始位地址
            this.plcAddressLength=Integer.valueOf(jsonFile.getStr("plcAddressLength"));//设置地址长度
            this.requestHead=jsonFile.getStr("requestHead");//设置请求头部
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONObject parameterObj = jsonArray.getJSONObject(i);
                String code = parameterObj.getStr("code");
                String code = parameterObj.getStr("codeId");
                PlcParameter plcParameter = new PlcParameter(
                        code,
                        Integer.valueOf(parameterObj.getStr("addressIndex")),
                        Integer.valueOf(parameterObj.getStr("addressLength")),""); //参数实例
                        Integer.valueOf(parameterObj.getStr("addressLength")),
                        parameterObj.getStr("type")); //参数实例
                parameterKeys.add(code);
                parameters.put(code,plcParameter);
            }
JiuMuMesParent/common/servicebase/src/main/java/com/mes/service/PlcParameter.java
@@ -13,6 +13,8 @@
import java.util.HashMap;
import java.util.Map;
import static com.mes.tools.HexConversion.*;
/**
 * Plc参数
 */
@@ -51,6 +53,11 @@
     * éœ€è¦å†™å…¥çš„值
     */
    private Object writeValue=null;
    /**
     * éœ€è¦å†™å…¥çš„值
     */
    private byte[] writeByte=null;
    PlcParameter(){
@@ -95,7 +102,18 @@
    }
    public Object getReadValue() {
        return readValue;
    }
    public String getValueString() {
        return getValueInt()+"";
    }
    public int getValueInt() {
        if(this.readByte==null||this.readByte.length<1){
            //log.info("读取内容为null: {}  :{}",this.getCodeId(),this.readByte);
            return 0;
        }
        return bytesToIntDesc(this.readByte,0);
    }
    public void setReadValue(Object readValue) {
@@ -114,7 +132,23 @@
        return writeValue;
    }
    public void setWriteValue(Object writeValue) {
        this.writeValue = writeValue;
    public byte [] setWriteValue(Object writeValue) {
        //传入值根据参数类型进行转换成字符串保存进写入 å­—节内并且返回
        byte []sendByte=new byte[13+this.addressLength];
        if ("int".equals(this.type)){
            this.writeByte=intToBytesDesc(Integer.parseInt(writeValue.toString()),this.addressLength);
            return this.writeByte;
        }else if ("word".equals(this.type)){
            this.writeByte=intToBytesDesc(Integer.parseInt(writeValue.toString()),this.addressLength);
            return this.writeByte;
        }else if("string".equals(this.type)){
        }else{
        }
        return null;
    }
    public byte [] getWriteByte() {
        return this.writeByte;
    }
}
JiuMuMesParent/common/servicebase/src/main/java/com/mes/tools/HexConversion.java
@@ -52,7 +52,35 @@
        numberHex = String.format("%2s", numberHex).replace(' ', '0');
        return numberHex;
    }
    /**
     * ä»Žbyte数组中取int数值,本方法适用于(低位在前,高位在后)的顺序,和和intToBytes()配套使用
     *
     * @param src: byte数组
     * @param offset: ä»Žæ•°ç»„的第offset位开始
     * @return int数值
     */
    public static int bytesToIntDesc(byte[] src, int offset) {
        int value=0;
        int length = src.length;
        for(int i=0;i<length;i++){
            value+=(int)((src[offset+i]&0xFF)<<(length-i-1)*8);
        }
        return value;
    }
    /**
     * å°†int数值转换为占size个字节的byte数组,本方法适用于(低位在前,高位在后)的顺序。 å’ŒbytesToInt()配套使用
     * @param value
     *            è¦è½¬æ¢çš„int值
     * @return byte数组
     */
    public static byte[] intToBytesDesc( int value,int size )
    {
        byte[] src = new byte[size];
        for(int i=0;i<size;i++){
            src[i] = (byte) ((value>>(size-i-1)*8) & 0xFF);
        }
        return src;
    }
    /**
     * ä»Žbyte数组中取int数值,本方法适用于(低位在前,高位在后)的顺序,和和intToBytes()配套使用
     *
@@ -61,11 +89,24 @@
     * @return int数值
     */
    public static int bytesToInt(byte[] src, int offset) {
        int value;
        value = (int) ((src[offset] & 0xFF)
                | ((src[offset+1] & 0xFF)<<8)
                | ((src[offset+2] & 0xFF)<<16)
                | ((src[offset+3] & 0xFF)<<24));
        int value=0;
        for(int i=0;i<src.length;i++){
            value+=(int)((src[offset+i]&0xFF)<<i*8);
        }
        return value;
    }
    /**
     * å°†int数值转换为占size个字节的byte数组,本方法适用于(低位在前,高位在后)的顺序。 å’ŒbytesToInt()配套使用
     * @param value
     *            è¦è½¬æ¢çš„int值
     * @return byte数组
     */
    public static byte[] intToBytes( int value,int size )
    {
        byte[] src = new byte[size];
        for(int i=0;i<src.length;i++){
            src[i] = (byte) ((value>>i*8) & 0xFF);
        }
        return src;
    }
}
JiuMuMesParent/common/servicebase/src/main/java/com/mes/tools/S7control.java
@@ -1,9 +1,11 @@
package com.mes.tools;
import com.github.s7connector.api.DaveArea;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite;
import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
@@ -462,4 +464,26 @@
        }
        return addresslist;
    }
    public void writeString(String addr,String data) {
        s7PLC.writeString(addr,data);
    }
    public void writeUInt16(String addr,int data) {
        s7PLC.writeUInt16(addr,data);
    }
    public void writeUInt32(String addr,int data) {
        s7PLC.writeUInt32(addr,data);
    }
    public void writeStringy(String addr,String value) {
        byte[] bytes = value.getBytes();
        s7PLC.writeByte(addr,bytes);
    }
    public String readStrings(String addr) {
        return s7PLC.readString(addr);
    }
}
JiuMuMesParent/common/servicebase/src/main/java/com/mes/utils/HexUtil.java
@@ -262,59 +262,6 @@
        return String.format("%4s", HexString).replace(' ', '0');
    }
    
    public static void main(String[] args) {
//        System.out.println(HexUtil.hexToAscii("3c5354413e48656c6c6f20576f726c64217c5468697320697320746865206669727374207369676e616c2066726f6d20646576696365213c454f463e"));
//        System.out.println(HexUtil.asciiToHex("<STA>Hello World!|This is the first signal from device!<EOF>"));
//
//        System.out.println(String.format("%4S", HexUtil.intToHex(55)).replace(' ', '0'));
//        System.out.println(HexUtil.hexToInt("00d2"));
//
//        System.out.println(HexUtil.formatHex("3c5354413e"));
        String message = "Hello World!|This is the first signal from device!";
        int length = message.length() * 2 + 10; // é•¿åº¦åŒ…括结尾的<EOF>,一个字符在信号中由两个字节表示。
        String command = HexUtil.asciiToHex("<STA>"); // æ·»åŠ å¼€å§‹æ ‡è¯†
        command += (String.format("%4s", HexUtil.intToHex(length)).replace(' ', '0')); // æ·»åŠ é•¿åº¦æ ‡è¯†
        command += "01"; // æ·»åŠ è®¾å¤‡ç±»åž‹ 0x01表示切割机,0x02表示钢化炉
        command += "0001"; // æ·»åŠ è®¾å¤‡åž‹å·ï¼Œ0x0001表示基本款,0x0002表示中级款
        command += "0000"; // åŠŸèƒ½å·ï¼Œ0x0000是下位机主动发给上位机;0x0001是上位机修改下位机RTC
        command += "00"; // åŠ å¯†æ–¹å¼ï¼Œ0x00表示不加密
        Calendar c = Calendar.getInstance();
        // æ·»åŠ æ—¶é—´ï¼Œå¹¶å°†æ—¶é—´è½¬æ¢ä¸º16进制表示
        command += (String.format("%4s", HexUtil.intToHex(c.get(Calendar.YEAR))).replace(' ', '0'));
        command += (String.format("%2s", HexUtil.intToHex(c.get(Calendar.MONTH) + 1)).replace(' ', '0'));
        command += (String.format("%2s", HexUtil.intToHex(c.get(Calendar.DAY_OF_MONTH))).replace(' ', '0'));
        command += (String.format("%2s", HexUtil.intToHex(c.get(Calendar.HOUR_OF_DAY))).replace(' ', '0'));
        command += (String.format("%2s", HexUtil.intToHex(c.get(Calendar.MINUTE))).replace(' ', '0'));
        command += (String.format("%2s", HexUtil.intToHex(c.get(Calendar.SECOND))).replace(' ', '0'));
        command += ("00000001"); // å”¯ä¸€æ ‡è¯†ï¼Œä½¿ç”¨åºåˆ—号
        command += (HexUtil.asciiToHex(message)); // æ·»åŠ ä¸»è¦ä¿¡æ¯å†…å®¹
        command += (HexUtil.asciiToHex("<EOF>")); // æ·»åŠ ç»“å°¾æ ‡è¯†
        System.out.println(command);
        System.out.println(String.format("%4s", "1"));
        Date time = new Date();
        System.out.println(new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss").format(time));
        String timeHex = timeToHex(time);
        System.out.println(timeHex);
        System.out.println(hexToTime(timeHex));
        System.out.println("3c5354413e001a00000000000000000000000000010007e0021500152800000000000000005041001d017c017c01017c3c454f463e".length());
        System.out.println(hexToBinary("0c0a"));
        System.out.println(Integer.MAX_VALUE);
    }
    public static String hexTo2Binary(String hexString) {
        String binaryString = Integer.toBinaryString(hexToInt(hexString));
        return String.format("%8s", binaryString).replace(' ', '0');
JiuMuMesParent/common/springsecurity/src/main/resources/application-dev.yml
@@ -1,15 +1,15 @@
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://10.153.19.150:3306/jiumumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false
    url: jdbc:mysql://localhost:3306/jiumumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false
    username: root
    password: beibo.123/
  cloud:
    nacos:
      discovery:
        server-addr: 10.153.19.29:8848
        server-addr: localhost:8848
  redis:
    database: 0
    host: 10.153.19.150
    host: localhost
    port: 6379
    password: 123456
JiuMuMesParent/common/springsecurity/src/main/resources/application-loc.yml
@@ -1,7 +1,7 @@
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://192.168.56.10:3306/jiumumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false
    url: jdbc:mysql://localhost:3306/jiumumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false
    username: root
    password: root
  cloud:
JiuMuMesParent/common/springsecurity/src/main/resources/application-prod.yml
@@ -1,15 +1,15 @@
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://10.153.19.150:3306/jiumumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false
    url: jdbc:mysql://localhost:3306/jiumumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false
    username: root
    password: beibo.123/
  cloud:
    nacos:
      discovery:
        server-addr: 10.153.19.29:8848
        server-addr: localhost:8848
  redis:
    database: 0
    host: 10.153.19.150
    host: localhost
    port: 6379
    password: 123456
JiuMuMesParent/gateway/src/main/resources/application.yml
@@ -6,7 +6,7 @@
  cloud:
    nacos:
      discovery:
        server-addr: 10.153.19.44:8848
        server-addr: localhost:8848
    gateway:
      discovery:
        locator:
JiuMuMesParent/gateway/target/classes/application.yml
@@ -6,7 +6,7 @@
  cloud:
    nacos:
      discovery:
        server-addr: 10.153.19.44:8848
        server-addr: localhost:8848
    gateway:
      discovery:
        locator:
JiuMuMesParent/gateway/target/gateway-1.0-SNAPSHOT.jar.original
Binary files differ
JiuMuMesParent/moduleService/DeviceInteractionModule/pom.xml
@@ -23,6 +23,11 @@
            <artifactId>jcifs</artifactId>
            <version>1.2.19</version>
        </dependency>
        <dependency>
            <groupId>com.github.s7connector</groupId>
            <artifactId>s7connector</artifactId>
            <version>2.1</version>
        </dependency>
<!--        <dependency>-->
<!--            <groupId>com.github.yulichang</groupId>-->
<!--            <artifactId>mybatis-plus-join-boot-starter</artifactId>-->
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/AppRunnerConfig.java
@@ -1,23 +1,44 @@
package com.mes;
import com.mes.common.S7object;
import com.mes.common.*;
import com.mes.job.PLCLoad;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.mapper.TaskingMapper;
import com.mes.md.service.LineConfigurationService;
import com.mes.md.service.PrimitiveTaskService;
import com.mes.md.service.TaskingService;
import com.mes.plcTaskThread.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Slf4j
@Component
@Order(1)
public class AppRunnerConfig implements ApplicationRunner {
    @Resource
    TaskingMapper taskingMapper;
    @Resource
    MachineMapper machineMapper;
    @Resource
    TaskingService taskingService;
    @Resource
    PrimitiveTaskService primitiveTaskService;
    @Resource
    LineConfigurationService lineConfigurationService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        // TODO Auto-generated method stub
        log.info("启动完成");
        S7object.getinstance().start();
//        new MachineLoad(taskingMapper,machineMapper,taskingService,primitiveTaskService,lineConfigurationService).start();
//        new MachineEdging(taskingMapper,machineMapper,taskingService,primitiveTaskService,lineConfigurationService).start();
//        new MachineFlipSlice(machineMapper,taskingService).start();
//        new MachineMarking(machineMapper,taskingService).start();
//        new MachineSilkScreen(machineMapper,taskingService).start();
//        new MachineRotate(machineMapper,taskingService).start();
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/DeviceInteractionModuleApplication.java
@@ -5,6 +5,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@@ -15,12 +16,13 @@
 */
@Slf4j
@SpringBootApplication
@MapperScan("com.mes.*.mapper")
@EnableDiscoveryClient
@EnableSwagger2
@EnableScheduling
@EnableAsync
public class DeviceInteractionModuleApplication {
    public static void main(String[] args) {
        try {
            SpringApplication.run(DeviceInteractionModuleApplication.class, args);
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/CommunicationProtocol.java
New file
@@ -0,0 +1,8 @@
package com.mes.common;
import com.mes.service.ModbusTcp;
public enum CommunicationProtocol {
     S7control(),
     ModbusTcp,
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/S7object.java
@@ -13,8 +13,8 @@
 */
public class S7object extends Thread {
    public S7control plccontrol; // PLC通讯类实例
    private EPlcType plcType = EPlcType.S1200; // è¥¿é—¨å­PLC类型
    private String ip = "192.168.10.11"; // plc ip地址
    private EPlcType plcType = EPlcType.S1500; // è¥¿é—¨å­PLC类型
    private String ip = "172.17.125.130"; // plc ip地址
    private int port = 102; // plc ç«¯å£å·
@@ -26,7 +26,6 @@
            plccontrol = new S7control(plcType, ip, port, 0, 0);
            String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcCacheGlass.json";
//            String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheGlass.json").getPath();
            System.out.println("Load Glass File: " + PlcLoadGlass);
            PlcMesObject = InitUtil.initword(PlcLoadGlass);
        }
    }
@@ -48,11 +47,9 @@
        while (this != null) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength());
            if (getplcvlues != null) {
                PlcMesObject.setPlcParameterList(getplcvlues);
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/S7objectCleaning.java
New file
@@ -0,0 +1,74 @@
package com.mes.common;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.mes.device.PlcParameterObject;
import com.mes.tools.InitUtil;
import com.mes.tools.S7control;
/**
 * @Author : yanzhixin
 * @Date: 2024/4/9 15:13
 * @Description:
 */
public class S7objectCleaning extends Thread {
    public S7control plccontrol; // PLC通讯类实例
    private EPlcType plcType = EPlcType.S200_SMART; // è¥¿é—¨å­PLC类型
    private String ip = "200.200.200.193"; // plc ip地址
    private int port = 102; // plc ç«¯å£å·
    public PlcParameterObject PlcMesObject;
    private static volatile S7objectCleaning instance = null;
    private S7objectCleaning() {
        if (plccontrol == null) {
            plccontrol = new S7control(plcType, ip, port, 0, 0);
            String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcCleaning.json";
//            String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheGlass.json").getPath();
            System.out.println("Load Glass File: " + PlcLoadGlass);
            PlcMesObject = InitUtil.initword(PlcLoadGlass);
        }
    }
    // å•例模式 èŽ·å–ç±»çš„å”¯ä¸€å®žä¾‹
    public static S7objectCleaning getinstance() {
        if (instance == null) {
            synchronized (S7objectCleaning.class) {
                if (instance == null) {
                    instance = new S7objectCleaning();
                }
            }
        }
        return instance;
    }
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            byte[] resultValues=new byte[PlcMesObject.getPlcAddressLength()];
            int maxRead=1092;
            int size=PlcMesObject.getPlcAddressLength()%maxRead==0?
                    (PlcMesObject.getPlcAddressLength()/maxRead):
                    (PlcMesObject.getPlcAddressLength()/maxRead+1);
            for (int i = 0; i <size ; i++) {
                int begin=i*maxRead;
                int length=(i==size-1?PlcMesObject.getPlcAddressLength()-begin:maxRead);
                //String s=PlcMesObject.getPlcAddressBegin().substring(PlcMesObject.getPlcAddressBegin().indexOf(".")+1);
                int defaultStart=Integer.valueOf(PlcMesObject.getPlcAddressBegin().substring(PlcMesObject.getPlcAddressBegin().indexOf(".")+1));
                String beginAddress=PlcMesObject.getPlcAddressBegin().substring(0, PlcMesObject.getPlcAddressBegin().indexOf("."))+"."+(begin+defaultStart);
                byte[] getplcvlues = plccontrol.readByte(beginAddress, length);
                System.arraycopy(getplcvlues,0,resultValues,begin,length);
            }
            if (resultValues != null) {
                PlcMesObject.setPlcParameterList(resultValues);
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/S7objectFlipSlice.java
New file
@@ -0,0 +1,75 @@
package com.mes.common;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.mes.device.PlcParameterObject;
import com.mes.tools.InitUtil;
import com.mes.tools.S7control;
/**
 * @Author : yanzhixin
 * @Date: 2024/4/9 15:13
 * @Description:
 */
public class S7objectFlipSlice extends Thread {
    public S7control plccontrol; // PLC通讯类实例
    private EPlcType plcType = EPlcType.S1200; // è¥¿é—¨å­PLC类型
    private String ip = "10.36.164.120"; // plc ip地址
    private int port = 102; // plc ç«¯å£å·
    public PlcParameterObject PlcMesObject;
    private static volatile S7objectFlipSlice instance = null;
    private S7objectFlipSlice() {
        if (plccontrol == null) {
            plccontrol = new S7control(plcType, ip, port, 0, 0);
            String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcFlipSlice.json";
//            String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheGlass.json").getPath();
            System.out.println("Load Glass File: " + PlcLoadGlass);
            PlcMesObject = InitUtil.initword(PlcLoadGlass);
        }
    }
    // å•例模式 èŽ·å–ç±»çš„å”¯ä¸€å®žä¾‹
    public static S7objectFlipSlice getinstance() {
        if (instance == null) {
            synchronized (S7objectFlipSlice.class) {
                if (instance == null) {
                    instance = new S7objectFlipSlice();
                }
            }
        }
        return instance;
    }
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            byte[] resultValues=new byte[PlcMesObject.getPlcAddressLength()];
            int maxRead=1092;
            int size=PlcMesObject.getPlcAddressLength()%maxRead==0?
                    (PlcMesObject.getPlcAddressLength()/maxRead):
                    (PlcMesObject.getPlcAddressLength()/maxRead+1);
            for (int i = 0; i <size ; i++) {
                int begin=i*maxRead;
                int length=(i==size-1?PlcMesObject.getPlcAddressLength()-begin:maxRead);
                String beginAddress=PlcMesObject.getPlcAddressBegin().substring(0, PlcMesObject.getPlcAddressBegin().indexOf("."))+"."+begin;
                byte[] getplcvlues = plccontrol.readByte(beginAddress, length);
                System.arraycopy(getplcvlues,0,resultValues,begin,length);
            }
            if (resultValues != null) {
                PlcMesObject.setPlcParameterList(resultValues);
            }
//            byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength());
//            if (getplcvlues != null) {
//                PlcMesObject.setPlcParameterList(getplcvlues);
//            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/S7objectMachine.java
New file
@@ -0,0 +1,84 @@
package com.mes.common;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.mes.device.PlcParameterInfo;
import com.mes.device.PlcParameterObject;
import com.mes.service.ModbusTcp;
import com.mes.tools.InitUtil;
import com.mes.tools.S7control;
import lombok.extern.slf4j.Slf4j;
import java.util.LinkedHashMap;
/**
 * @Author : yanzhixin
 * @Date: 2024/4/9 15:13
 * @Description:
 */
@Slf4j
public class S7objectMachine extends Thread {
    public S7control plccontrol; // PLC通讯类实例
    private EPlcType plcType = EPlcType.S1200; // è¥¿é—¨å­PLC类型
    private String ip = ""; // plc ip地址
    private int port = 102; // plc ç«¯å£å·
    private String plcFileName=""; // json名称
    public PlcParameterObject PlcMesObject;
    public S7objectMachine(String ip,int port,String plcFileName,EPlcType plcType) {
        initialize(ip,port,plcFileName,plcType);
        if (plccontrol == null) {
            plccontrol = new S7control(this.plcType, this.ip, this.port, 0, 0);
            //String plcFileUrl = System.getProperty("user.dir") + "D:/HangZhouMes/JsonFile/"+this.plcFileName+".json";
            String plcFileUrl = "D:/mes/JsonFile/"+this.plcFileName+".json";
            PlcMesObject = InitUtil.initword(plcFileUrl);
        }
    }
    public void initialize(String ip,int port,String plcFileName,EPlcType plcType){
        this.ip = ip;
        this.port = port;
        this.plcFileName = plcFileName;
        this.plcType=  plcType;
    }
    /**
     * æ‰“印参数值
     */
    public void consoleLogInfo(){
        String logInfo=this.plcFileName+" ";
        LinkedHashMap<String, PlcParameterInfo> thisPlcParameterInfo=PlcMesObject.getPlcParameterMap();
        for (String key:thisPlcParameterInfo.keySet()) {
            logInfo+=key+":"+thisPlcParameterInfo.get(key).getValue()+",";
        }
        log.info(logInfo);
    }
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            try {
                byte[] resultValues=new byte[PlcMesObject.getPlcAddressLength()];
                int maxRead=1092;
                int size=PlcMesObject.getPlcAddressLength()%maxRead==0?
                        (PlcMesObject.getPlcAddressLength()/maxRead):
                        (PlcMesObject.getPlcAddressLength()/maxRead+1);
                for (int i = 0; i <size ; i++) {
                    int begin=i*maxRead;
                    int length=(i==size-1?PlcMesObject.getPlcAddressLength()-begin:maxRead);
                    String beginAddress=PlcMesObject.getPlcAddressBegin().substring(0, PlcMesObject.getPlcAddressBegin().indexOf("."))+"."+begin;
                    byte[] getplcvlues = plccontrol.readByte(beginAddress, length);
                    System.arraycopy(getplcvlues,0,resultValues,begin,length);
                }
                if (resultValues != null) {
                    PlcMesObject.setPlcParameterList(resultValues);
                }
            } catch (Exception e) {
                //log.info("异常:ip:{},port:{}",this.ip,this.port);
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/S7objectMarking.java
New file
@@ -0,0 +1,78 @@
package com.mes.common;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.mes.device.PlcParameterObject;
import com.mes.tools.InitUtil;
import com.mes.tools.S7control;
import java.util.List;
/**
 * @Author : yanzhixin
 * @Date: 2024/4/9 15:13
 * @Description:
 */
public class S7objectMarking extends Thread {
    public S7control plccontrol; // PLC通讯类实例
    private EPlcType plcType = EPlcType.S1500; // è¥¿é—¨å­PLC类型
    private String ip = "10.36.164.40"; // plc ip地址
    private int port = 102; // plc ç«¯å£å·
    public PlcParameterObject PlcMesObject;
    private static volatile S7objectMarking instance = null;
    private S7objectMarking() {
        if (plccontrol == null) {
            plccontrol = new S7control(plcType, ip, port, 0, 0);
            String PlcLoadGlass = System.getProperty("user.dir") + "/JsonFile/PlcMarking.json";
//            String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheGlass.json").getPath();
            System.out.println("Load Glass File: " + PlcLoadGlass);
            PlcMesObject = InitUtil.initword(PlcLoadGlass);
        }
    }
    // å•例模式 èŽ·å–ç±»çš„å”¯ä¸€å®žä¾‹
    public static S7objectMarking getinstance() {
        if (instance == null) {
            synchronized (S7objectMarking.class) {
                if (instance == null) {
                    instance = new S7objectMarking();
                }
            }
        }
        return instance;
    }
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            byte[] resultValues=new byte[PlcMesObject.getPlcAddressLength()];
            int maxRead=1092;
            int size=PlcMesObject.getPlcAddressLength()%maxRead==0?
                    (PlcMesObject.getPlcAddressLength()/maxRead):
                    (PlcMesObject.getPlcAddressLength()/maxRead+1);
            for (int i = 0; i <size ; i++) {
                int begin=i*maxRead;
                int length=(i==size-1?PlcMesObject.getPlcAddressLength()-begin:maxRead);
                String beginAddress=PlcMesObject.getPlcAddressBegin().substring(0, PlcMesObject.getPlcAddressBegin().indexOf("."))+"."+begin;
                byte[] getplcvlues = plccontrol.readByte(beginAddress, length);
                System.arraycopy(getplcvlues,0,resultValues,begin,length);
            }
            if (resultValues != null) {
                PlcMesObject.setPlcParameterList(resultValues);
            }
//            byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength());
//            if (getplcvlues != null) {
//                PlcMesObject.setPlcParameterList(getplcvlues);
//            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/common/tcpIp.java
New file
@@ -0,0 +1,81 @@
package com.mes.common;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
/**
 * @Author : yanzhxiin
 * @Date: 2024/8/20 11:19
 * @Description:
 */
@Component
@Slf4j
public class tcpIp {
    //@Scheduled(fixedDelay = 1000)
    public void serverTCPSocket() {
        try {
            // åˆ›å»ºTCP服务器并绑定到指定端口
            int port = 8888;
            ServerSocket serverSocket = new ServerSocket(port);
            System.out.println("服务器已启动,等待客户端连接...");
            while (true) {
                // ç­‰å¾…客户端连接
                Socket clientSocket = serverSocket.accept();
                System.out.println("客户端连接成功");
                // åˆ›å»ºè¾“入流和输出流
                InputStream inputStream = clientSocket.getInputStream();
                OutputStream outputStream = clientSocket.getOutputStream();
                // è¯»å–客户端发送的数据
                byte[] buffer = new byte[1024];
                int bytesRead = inputStream.read(buffer);
                String receivedMessage = new String(buffer, 0, bytesRead);
                System.out.println("收到消息:" + receivedMessage);
                // å‘送响应数据给客户端
                String responseMessage = "Hello, Client!";
                outputStream.write(responseMessage.getBytes());
                // å…³é—­è¿žæŽ¥
                clientSocket.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    //@Scheduled(fixedDelay = 1000)
    public void clientTCPSocket() {
        try {
            // åˆ›å»ºTCP客户端并连接到服务器
            String serverAddress = "192.168.1.8";
            int serverPort = 2001;
            Socket clientSocket = new Socket(serverAddress, serverPort);
            // åˆ›å»ºè¾“入流和输出流
            InputStream inputStream = clientSocket.getInputStream();
            OutputStream outputStream = clientSocket.getOutputStream();
            // å‘送数据给服务器
            String message = "start";
            outputStream.write(message.getBytes());
            // è¯»å–服务器响应的数据
            byte[] buffer = new byte[1024];
            int bytesRead = inputStream.read(buffer);
            String receivedMessage = new String(buffer, 0, bytesRead);
            System.out.println("收到服务器响应:" + receivedMessage);
            String message2 = "stop";
            outputStream.write(message2.getBytes());
            // å…³é—­è¿žæŽ¥
            clientSocket.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/AddTask.java
New file
@@ -0,0 +1,61 @@
package com.mes.job;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mes.md.entity.*;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.mapper.TaskingMapper;
import com.mes.md.service.*;
import com.mes.service.ModbusTcp;
import com.mes.service.PlcAgreement;
import com.mes.service.PlcParameter;
import com.mes.tools.WebSocketServer;
import com.mes.utils.HexUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * @author SNG-010
 */
@Component
@Slf4j
public class AddTask {
    @Autowired
    ProjectService projectService;
    @Autowired
    KBBTJPDrawingBPService kBBTJPDrawingBPService;
    //@Scheduled(fixedDelay = 30000)
    public void AddTasks() {
        projectService.insertProjectStandard();
    }
    //@Scheduled(fixedDelay = 1000)
    public void notReceive() {
        JSONObject jsonObject = new JSONObject();
        List<KBBTJPDrawingBP> list =kBBTJPDrawingBPService.notReceiveKBBTJPDrawingBP();
        jsonObject.append("content", list);
        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("notReceiveTask");
        if (sendwServer != null) {
            for (WebSocketServer webserver : sendwServer) {
                if (webserver != null) {
                    webserver.sendMessage(jsonObject.toString());
                    List<String> messages = webserver.getMessages();
                    if (!messages.isEmpty()) {
                        // // å°†æœ€åŽä¸€ä¸ªæ¶ˆæ¯è½¬æ¢ä¸ºæ•´æ•°ç±»åž‹çš„列表
                        webserver.clearMessages();
                    }
                } else {
                    log.info("Home is closed");
                }
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/MachineTask.java
New file
@@ -0,0 +1,164 @@
package com.mes.job;
import cn.hutool.json.JSONObject;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.mes.common.S7objectFlipSlice;
import com.mes.common.S7objectMachine;
import com.mes.common.S7objectMarking;
import com.mes.device.PlcParameterInfo;
import com.mes.device.PlcParameterObject;
import com.mes.md.entity.Machine;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.GlassInfoMapper;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.mapper.TaskingMapper;
import com.mes.md.service.TaskingService;
import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
 * è‡ªåŠ¨æ‰“æ ‡æœº
 * @Author : yanzhxiin
 * @Date: 2024/8/20 11:19
 * @Description:
 */
@Component
@Slf4j
public class MachineTask {
    public static String engineerId = "";
    @Autowired
    TaskingMapper taskingMapper;
    @Autowired
    MachineMapper machineMapper;
    @Autowired
    TaskingService taskingService;
    @Autowired
    private GlassInfoMapper glassInfoMapper;
    public int a =1;
    public S7objectMachine s7objectMachine;
    //@Scheduled(fixedDelay = 1000)
    public void plcMachineTask() {
        Long machineId=12L;
        Machine machine=machineMapper.selectById(machineId);
        if (s7objectMachine==null){
            s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcMarking", EPlcType.S1500);
            s7objectMachine.start();
        }
        PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject;
        PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请求字
        PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请求ID
        PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//发送字
        PlcParameterInfo isMark =plcParameterObject.getPlcParameter("isMark");//发送ID【0 ä¸æ‰“标,1标准模式,2定制模式】
        PlcParameterInfo drawingMark =plcParameterObject.getPlcParameter("drawingMark");//打标图纸地址
        PlcParameterInfo lengthOutOfService =plcParameterObject.getPlcParameter("length(OutOfService)");//长
        PlcParameterInfo widthOutOfService =plcParameterObject.getPlcParameter("width(OutOfService)");//宽
        PlcParameterInfo markingMode =plcParameterObject.getPlcParameter("markingMode");//
        PlcParameterInfo plcReport =plcParameterObject.getPlcParameter("plcReport");//汇报字
        PlcParameterInfo plcReportID =plcParameterObject.getPlcParameter("plcReportID");//汇报ID
        PlcParameterInfo mesConfirm =plcParameterObject.getPlcParameter("mesConfirm");//确认字
        PlcParameterInfo mesConfirmID =plcParameterObject.getPlcParameter("mesConfirmID");//确认ID
        String str=S7objectMarking.getinstance().plccontrol.readString("DB14.30");
        //String width=S7objectMarking.getinstance().plccontrol.readWord(widthOutOfService.getAddress());
        log.info("plcRequest:{},plcRequestID:{},mesSend:{},mesSendID:{},drawingMark:{}," +
                        "plcReport:{},plcReportID:{},mesConfirm:{},mesConfirmID:{}"
                ,plcRequest.getValue(),plcRequestID.getValue(),mesSend.getValue(),isMark.getValue(),drawingMark.getValue(),
                plcReport.getValue(),plcReportID.getValue(),mesConfirm.getValue(),mesConfirmID.getValue());
        if ("0".equals(plcRequest.getValue())&&"1".equals(mesSend.getValue())) {
            //发送字置0
            log.info("1.发送字置零,清除上次发送的数据{},{},{},{},{}"
                    ,markingMode.getValue()
                    ,isMark.getValue()
                    ,lengthOutOfService.getValue()
                    ,widthOutOfService.getValue()
                    ,mesSend.getValue());
            //S7objectMarking.getinstance().plccontrol.writeString(drawingMark.getAddress(),"");
            S7objectMarking.getinstance().plccontrol.writeWord(markingMode.getAddress(), 0);
            S7objectMarking.getinstance().plccontrol.writeWord(lengthOutOfService.getAddress(), 0);
            S7objectMarking.getinstance().plccontrol.writeWord(widthOutOfService.getAddress(), 0);
            S7objectMarking.getinstance().plccontrol.writeWord(isMark.getAddress(), 0);
            S7objectMarking.getinstance().plccontrol.writeWord(mesSend.getAddress(), 0);
            return;
        }
        if ("0".equals(plcReport.getValue())&&"1".equals(mesConfirm.getValue())) {
            log.info("2.确认字置零");
            //发送字置0
            S7objectMarking.getinstance().plccontrol.writeWord(mesConfirm.getAddress(), 0);
            return;
        }
        if("1".equals(plcReport.getValue())&&"0".equals(mesConfirm.getValue())){
            int finishCount=taskingService.finishMachineTask(machine);
            log.info("3、任务完成");
            if(finishCount>0){//有任务
                S7objectMarking.getinstance().plccontrol.writeWord(mesConfirm.getAddress(), 1);
                return;
            }
        }
        if("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue())&& !plcRequestID.getValue().isEmpty()&&"开工".equals(machine.getState())){
            Tasking tasking;
            if("0".equals(plcRequestID.getValue())){
                //标准模式
                tasking=taskingService.startMachineTask(machine);
            }else{
                //定制模式
                tasking=taskingService.startMachineTask(machine,plcRequestID.getValue());
            }
            //log.info("4、发送任务  è®¾å¤‡çŠ¶æ€:{},  æ•°æ®ï¼š{},",machine,tasking);
            if(tasking!=null){
                //模式:1定制  0 æ‰¹é‡      æ˜¯å¦æ‰“标:0不打标   1打标
                int isMark_=tasking.getDrawingMarking()==null?0:1;
                int isMarkingMode_="定制".equals(tasking.getTaskType()) ?1:0;
                log.info("4、发送数据:{},{},{},{},{},{}"
                        ,tasking.getProgramId()
                        ,tasking.getLength().intValue(),tasking.getWidth().intValue(),isMark_,isMarkingMode_,1);
                if(isMark_==1){
                    S7objectMarking.getinstance().plccontrol.writeString(drawingMark.getAddress(), tasking.getProgramId());
                }
                //S7objectMarking.getinstance().plccontrol.writeUInt32 (mesSendID.getAddress(), 2);
                S7objectMarking.getinstance().plccontrol.writeWord(lengthOutOfService.getAddress(), tasking.getLength().intValue());
                S7objectMarking.getinstance().plccontrol.writeWord(widthOutOfService.getAddress(), tasking.getWidth().intValue());
                S7objectMarking.getinstance().plccontrol.writeWord(isMark.getAddress(), isMark_);
                S7objectMarking.getinstance().plccontrol.writeWord(markingMode.getAddress(), isMarkingMode_);
                S7objectMarking.getinstance().plccontrol.writeWord(mesSend.getAddress(), 1);
                return;
            }
        }
        //log.info("无可执行的条件");
    }
    //@Scheduled(fixedDelay = 1000)
    public void markingTasks() {
        JSONObject jsonObject = new JSONObject();
        Machine machine=machineMapper.selectById(11L);
        List<Tasking> taskingList=taskingService.findMachineTask(machine);
        jsonObject.append("taskingList", taskingList);
        jsonObject.append("machine", machine);
        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("marking");
        if (sendwServer != null) {
            for (WebSocketServer webserver : sendwServer) {
                if (webserver != null) {
                    webserver.sendMessage(jsonObject.toString());
                    List<String> messages = webserver.getMessages();
                    if (!messages.isEmpty()) {
                        // // å°†æœ€åŽä¸€ä¸ªæ¶ˆæ¯è½¬æ¢ä¸ºæ•´æ•°ç±»åž‹çš„列表
                        webserver.clearMessages();
                    }
                } else {
                    log.info("Home is closed");
                }
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/MarkingTask.java
File was deleted
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCCleaning.java
File was deleted
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCEdging.java
File was deleted
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCFlipSlice.java
File was deleted
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCLoad.java
New file
@@ -0,0 +1,198 @@
package com.mes.job;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mes.md.entity.*;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.mapper.PrimitiveTaskMapper;
import com.mes.md.mapper.TaskingMapper;
import com.mes.md.service.*;
import com.mes.service.ModbusTcp;
import com.mes.service.PlcAgreement;
import com.mes.service.PlcParameter;
import com.mes.tools.WebSocketServer;
import com.mes.utils.HexUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * @author SNG-010
 */
@Component
@Slf4j
public class PLCLoad {
    @Autowired
    TaskingMapper taskingMapper;
    @Autowired
    MachineMapper machineMapper;
    @Autowired
    TaskingService taskingService;
    @Autowired
    ProjectService projectService;
    @Autowired
    PrimitiveTaskService primitiveTaskService;
    @Autowired
    KBBTJPDrawingBPService kBBTJPDrawingBPService;
    @Autowired
    LineConfigurationService lineConfigurationService;
    public static Long machineId1 = 1L;
    public static Long machineId2 = 2L;
    public ModbusTcp modbusTcp2 = new ModbusTcp();
    public List<Map> sendRecords = new ArrayList<>();
    @Autowired
    private PrimitiveTaskMapper primitiveTaskMapper;
    //@Scheduled(fixedDelay = 1000)
    public void plcLoad() {
        Machine machine=machineMapper.selectById(machineId2);
        ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),"PlcLoad");
        modbusTcp1.connect();
        PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement("PlcLoad");
        try {
            if(!modbusTcp1.read(plcAgreement)){
                log.info("通讯读取新数据失败");
                modbusTcp1.close();
                return;
            }
            PlcParameter plcRequest =plcAgreement.getPlcParameter("plcRequest");//请求字
            PlcParameter mesSend =plcAgreement.getPlcParameter("mesSend");//发送字
            PlcParameter mesSendCount =plcAgreement.getPlcParameter("mesSendCount");//发送数量
            PlcParameter plcReport =plcAgreement.getPlcParameter("plcReport");//汇报字
            PlcParameter plcReportID =plcAgreement.getPlcParameter("plcReportID");//汇报ID
            PlcParameter mesConfirm =plcAgreement.getPlcParameter("mesConfirm");//确认字
            PlcParameter mesConfirmID =plcAgreement.getPlcParameter("mesConfirmID");//确认ID
            if (machine.getIsLog()>0){
                modbusTcp1.consoleLogInfo(plcAgreement);
            }
            if (0==plcRequest.getValueInt()&&1==mesSend.getValueInt()) {
                //发送字置0
                String send= HexUtil.intTo2ByteHex(0);
                modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                log.info("1.发送字置零 å‘送字 æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            if (0==plcReport.getValueInt()&&0!=mesConfirm.getValueInt()) {
                //确认字置零
                String send=HexUtil.intTo2ByteHex(0);
                modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                log.info("2.确认字置零 ä»»åŠ¡å®Œæˆ æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine);
            List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId());
            if(1==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){
                for(PrimitiveTask primitiveTask:findPrimitiveTasking){
                    log.info("机械手任务完成 åŽŸå§‹æ•°é‡ï¼š{}  æœ¬æ¬¡æ•°é‡:{}", primitiveTask.getReportCount(), plcReportID.getValueInt());
                    if (plcReportID.getValueInt()>0){
                        primitiveTask.setReportCount(primitiveTask.getReportCount()+ plcReportID.getValueInt());
                        primitiveTaskMapper.updateById(primitiveTask);
                    }
                    String send = HexUtil.intTo2ByteHex(1);
                    modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/ 2));
                    log.info("任务完成 æˆåŠŸ å†…容:{},发送起始地址:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                log.info("3、任务完成:"+plcReportID.getValueString());
                String send = HexUtil.intTo2ByteHex(1);
                modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2));
                log.info("任务完成 å¼‚常成功 å†…容:{},发送起始地址:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            if((1==plcRequest.getValueInt()&&0==mesSend.getValueInt())
                    &&"开工".equals(machine.getState())){
                int loadCount=0;
                if(machine.getMode()==1){
                    //标准模式  æ‰¾å·²é¢†å–未完成的第一条任务
                    for(PrimitiveTask primitiveTask:findPrimitiveTasking){
//                        //任务数>已上数量
//                        List<Tasking> taskingTopList=taskingMapper.selectList(new QueryWrapper<Tasking>().lambda()
//                                .eq(Tasking::getScanId,primitiveTask.getScanId())
//                        );
                        loadCount=primitiveTask.getTaskQuantity()-primitiveTask.getReportCount();
                        loadCount=(loadCount>0?loadCount:0);
                        break;
                    }
                    //loadCount=taskingCount.size();
                }else{
                    //定制模式
                    loadCount=1;
                }
                if(loadCount>0){
                    log.info("4、发送任务  ä»»åŠ¡æ•°æ®ï¼š{}, è®¾å¤‡çŠ¶æ€:{}, ",loadCount,machine);
                    String send=HexUtil.intTo2ByteHex(1)+ HexUtil.intTo2ByteHex(loadCount);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                    log.info("发送任务发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                    modbusTcp1.close();
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    String sendRecord=df.format(new Date())+"  "+"1  "+ loadCount;
                    if (sendRecords.size()>7){
                        sendRecords.remove(0);
                    }
                    Map sendContentMap=new HashMap();
                    sendContentMap.put("sendContent",sendRecord);
                    sendRecords.add(sendContentMap);
                    return;
                }
            }
        } catch (Exception e) {
            log.info("交互逻辑错误");
        }
        modbusTcp1.close();
        //log.info("无可执行的条件");
    }
    @Scheduled(fixedDelay = 1000)
    public void loadTasks() {
        JSONObject jsonObject = new JSONObject();
        Machine machine=machineMapper.selectById(machineId2);
        //标准模式  æ‰¾å·²é¢†å–未完成的第一条任务
        LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine);
        //此线路已领取的任务
        List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId());
        //此线路未领取的任务  æœ¬åœ°
        //List<PrimitiveTask> findPrimitiveTask=primitiveTaskService.findPrimitiveTaskNotFinish();
        //此线路未领取的任务  å®¢æˆ·æ•°æ®åº“
        List<KBBTJPDrawingBP> list =kBBTJPDrawingBPService.notReceiveKBBTJPDrawingBP();
        jsonObject.append("findPrimitiveTask", list);
        jsonObject.append("findPrimitiveTasking", findPrimitiveTasking);
        //jsonObject.append("findPrimitiveTask", findPrimitiveTask);
        jsonObject.append("machine", machine);
        jsonObject.append("sendRecords", sendRecords);
        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadTask");
        if (sendwServer != null) {
            for (WebSocketServer webserver : sendwServer) {
                if (webserver != null) {
                    webserver.sendMessage(jsonObject.toString());
                    List<String> messages = webserver.getMessages();
                    if (!messages.isEmpty()) {
                        // // å°†æœ€åŽä¸€ä¸ªæ¶ˆæ¯è½¬æ¢ä¸ºæ•´æ•°ç±»åž‹çš„列表
                        webserver.clearMessages();
                    }
                } else {
                    log.info("Home is closed");
                }
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCManualReporting.java
File was deleted
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCMechanicalArm.java
File was deleted
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCRotate.java
New file
@@ -0,0 +1,155 @@
package com.mes.job;
import cn.hutool.json.JSONObject;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.mes.common.S7objectMachine;
import com.mes.device.PlcParameterInfo;
import com.mes.device.PlcParameterObject;
import com.mes.md.entity.Machine;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.service.ProjectService;
import com.mes.md.service.TaskingService;
import com.mes.tools.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * @author SNG-010
 */
@Component
@Slf4j
public class PLCRotate {
    PlcParameterObject plcParameterObject =null;
    @Autowired
    TaskingService taskingService;
    @Autowired
    MachineMapper machineMapper;
    public S7objectMachine s7objectMachine;
    @Autowired
    ProjectService projectService;
    public List<Map> sendRecords = new ArrayList<>();
    //@Scheduled(fixedDelay = 1000)
    public void plcRotate() {
        //旋转台
        Long machineId=20L;
        Machine machine=machineMapper.selectById(machineId);
        if (s7objectMachine==null){
            s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcRotate", EPlcType.S1200);
            s7objectMachine.start();
        }
        PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject;
        PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请求字
        PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请求ID
        PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//发送字
        PlcParameterInfo mesSendId =plcParameterObject.getPlcParameter("mesSendID");//发送ID
        PlcParameterInfo length =plcParameterObject.getPlcParameter("length");//长
        PlcParameterInfo width =plcParameterObject.getPlcParameter("width");//宽
        PlcParameterInfo rotateType =plcParameterObject.getPlcParameter("rotateType");//旋转类型
        String scan_id="";
        if (machine.getIsLog()>0){
            s7objectMachine.consoleLogInfo();
        }
        if ("0".equals(plcRequest.getValue())&&!"0".equals(mesSend.getValue())) {
            //发送字置0
            int finishCount=taskingService.finishMachineTask(machine);
            log.info("1.发送字置零,清除上次发送的数据{},{},{},{},{}"
                    ,finishCount
                    ,length.getValue()
                    ,width.getValue()
                    ,mesSendId.getValue()
                    ,mesSend.getValue());
            s7objectMachine.plccontrol.writeWord(length.getAddress(), 0);
            s7objectMachine.plccontrol.writeWord(width.getAddress(), 0);
            s7objectMachine.plccontrol.writeWord(mesSendId.getAddress(), 0);
            s7objectMachine.plccontrol.writeWord(rotateType.getAddress(), 0);
            s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0);
            return;
        }
        List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"正在工作");
        if("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue())
                &&"开工".equals(machine.getState())
                &&taskingCount.size()<machine.getMaxTaskCount()){
            Tasking tasking;
            if(machine.getMode()==1){
                //标准模式
                tasking=taskingService.startMachineTask(machine);
            }else{
                //定制模式
                String PlcRequestID_=plcRequestID.getValue();
                scan_id= PlcRequestID_.substring(PlcRequestID_.lastIndexOf(",")+1);
                //标记当前工序 ä»¥å‰çš„玻璃 ç›´æŽ¥åˆ°å½“前工序
                tasking=taskingService.startScanIdMachineTask(machine,scan_id);//不管顺序,直接找从翻片台扫码后到旋转台的数据
            }
            if(tasking!=null){
                log.info("4、发送数据:{},{},{},{},{}"
                        ,tasking.getGlassId(),tasking.getProgramId()
                        ,tasking.getLength().intValue(),tasking.getWidth().intValue(),1);
                s7objectMachine.plccontrol.writeWord(length.getAddress(), tasking.getLength().intValue());
                s7objectMachine.plccontrol.writeWord(width.getAddress(), tasking.getWidth().intValue());
                s7objectMachine.plccontrol.writeString(mesSendId.getAddress(), tasking.getGlassId().toString());
                s7objectMachine.plccontrol.writeWord(rotateType.getAddress(), 1);
                s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1);
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                String sendRecord=df.format(new Date())+"  "+
                        tasking.getGlassId()+"-"+
                        tasking.getLength()+"-"+
                        tasking.getWidth();
                if (sendRecords.size()>7){
                    sendRecords.remove(0);
                }
                nullMachine(machine);
                Map sendContentMap=new HashMap();
                sendContentMap.put("sendContent",sendRecord);
                sendRecords.add(sendContentMap);
            }else if(!scan_id.isEmpty()){
                taskingService.scanMachineAdd(machine,scan_id);
            }
        }
    }
    public void nullMachine(Machine machine) {
        if (!"".equals(machine.getRemark())){
            machine.setRemark("");
            machineMapper.updateById(machine);
        }
    }
    @Scheduled(fixedDelay = 1000)
    public void rotateTask() {
        //获取报警状态
        JSONObject jsonObject = new JSONObject();
        Machine machine=machineMapper.selectById(20L);
        List<Tasking> taskingList=taskingService.findMachineTask(machine);
        jsonObject.append("taskingList", taskingList);
        jsonObject.append("machine", machine);
        jsonObject.append("sendRecords", sendRecords);
        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("rotate");
        if (sendwServer != null) {
            for (WebSocketServer webserver : sendwServer) {
                if (webserver != null) {
                    webserver.sendMessage(jsonObject.toString());
                    List<String> messages = webserver.getMessages();
                    if (!messages.isEmpty()) {
                        // // å°†æœ€åŽä¸€ä¸ªæ¶ˆæ¯è½¬æ¢ä¸ºæ•´æ•°ç±»åž‹çš„列表
                        webserver.clearMessages();
                    }
                } else {
                    log.info("Home is closed");
                }
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCScanQRVerify.java
File was deleted
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCScanQRWorks.java
File was deleted
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCScanQrCodesReport.java
File was deleted
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/SilkScreenTask.java
New file
@@ -0,0 +1,246 @@
package com.mes.job;
import cn.hutool.json.JSONObject;
import com.mes.common.S7object;
import com.mes.common.S7objectMarking;
import com.mes.device.PlcParameterObject;
import com.mes.md.entity.Machine;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.mapper.TaskingMapper;
import com.mes.md.service.TaskingService;
import com.mes.service.ModbusTcp;
import com.mes.service.PlcAgreement;
import com.mes.service.PlcParameter;
import com.mes.tools.WebSocketServer;
import com.mes.utils.HexUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.net.Socket;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.*;
import static cn.hutool.core.io.FileUtil.writeString;
/**
 * è‡ªåŠ¨ä¸å°æœº
 * @Author :
 * @Date: 2024/8/20 11:19
 * @Description:
 */
@Component
@Slf4j
public class SilkScreenTask {
    @Autowired
    TaskingMapper taskingMapper;
    @Autowired
    MachineMapper machineMapper;
    @Autowired
    TaskingService taskingService;
    public static Long machineId1 = 13L;
    public static Long machineId2 = 14L;
    //public ModbusTcp modbusTcp1 = null;
    public ModbusTcp modbusTcp2 = new ModbusTcp();
    public List<Map> sendRecords = new ArrayList<>();
    //@Scheduled(fixedDelay = 1000)
    public void plcSilkScreenTask() {
        Machine machine=machineMapper.selectById(machineId2);
        String fileName="PlcSilkScreen";
        ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),fileName);
        modbusTcp1.connect();
        PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement(fileName);
        try {
            //while(true){
                if(!modbusTcp1.read(plcAgreement)){
                    log.info("通讯读取新数据失败");
                    modbusTcp1.close();
                    return;
                }
                PlcParameter plcRequest =plcAgreement.getPlcParameter("plcRequest");//请求字
                PlcParameter plcRequestID =plcAgreement.getPlcParameter("plcRequestID");//请求ID
                PlcParameter mesSend =plcAgreement.getPlcParameter("mesSend");//发送字
                PlcParameter mesSendID =plcAgreement.getPlcParameter("mesSendID");//发送ID
                PlcParameter length =plcAgreement.getPlcParameter("length");//长
                PlcParameter width =plcAgreement.getPlcParameter("width");//宽
                PlcParameter thickness =plcAgreement.getPlcParameter("thickness");//厚
                PlcParameter X =plcAgreement.getPlcParameter("X");//X
                PlcParameter Y =plcAgreement.getPlcParameter("Y");//Y
                //PlcParameter isSilkScreen =plcAgreement.getPlcParameter("isSilkScreen");//是否丝印
                PlcParameter plcReport =plcAgreement.getPlcParameter("plcReport");//汇报字
                PlcParameter plcReportID =plcAgreement.getPlcParameter("plcReportID");//汇报ID
                PlcParameter mesConfirm =plcAgreement.getPlcParameter("mesConfirm");//确认字
                PlcParameter mesConfirmID =plcAgreement.getPlcParameter("mesConfirmID");//确认ID
                PlcParameter machineStatusWord =plcAgreement.getPlcParameter("machineStatusWord");
                if (machine.getIsLog()>0){
                    modbusTcp1.consoleLogInfo(plcAgreement);
                }
                if (0==plcRequest.getValueInt()&&1==mesSend.getValueInt()) {
                    log.info("1.发送字置零");
                    //发送字置0
                    String send=HexUtil.intTo2ByteHex(0);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                    log.info("发送字 æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                if (0==plcReport.getValueInt()&&0!=mesConfirm.getValueInt()) {
                    log.info("2.确认字置零");
                    //发送字置0
                    String send=HexUtil.intTo2ByteHex(0);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                    log.info("任务完成 æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                if(1==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){
                    int finishCount=taskingService.finishMachineTask(machine);
                    log.info("3、任务完成");
                    if(finishCount>0) {//有任务
                        String send = HexUtil.intTo2ByteHex(1);
                        modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2));
                        log.info("任务完成 æˆåŠŸ å†…容:{},发送起始地址:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                        modbusTcp1.close();
                        return;
                    }
                    String send = HexUtil.intTo2ByteHex(1);
                    modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2));
                    log.info("任务完成 å¼‚常成功 å†…容:{},发送起始地址:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                if(4==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){
                    int finishCount=taskingService.glassDownLineOne(machine);
                    if(finishCount>0){//有任务
                        log.info("4、人工拿走");
                        String send=HexUtil.intTo2ByteHex(4);
                        modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                        log.info("人工拿走发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                        modbusTcp1.close();
                        return;
                    }
                    String send=HexUtil.intTo2ByteHex(4);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                    log.info("人工拿走异常 å‘送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                if(2==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){
                    int finishCount=taskingService.loseMachineTask(machine);
                    if(finishCount>0){//有任务
                        log.info("2、重发");
                        String send=HexUtil.intTo2ByteHex(2);
                        modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                        log.info("重发发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                        modbusTcp1.close();
                        return;
                    }else{
                        log.info("2、异常重发");
                        String send=HexUtil.intTo2ByteHex(2);
                        modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                        log.info("异常重发发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                        modbusTcp1.close();
                        return;
                    }
                }
                if(3==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){
                    int finishCount=taskingService.finishMachineTask(machine);
                    if(finishCount>0){//有任务
                        log.info("3、设备上人工点破损");
                        String send=HexUtil.intTo2ByteHex(3);
                        modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                        log.info("人工点破损发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                        modbusTcp1.close();
                        return;
                    }else{
                        //是否自动清除破损
                        log.info("3、无效破损 ï¼ˆæ²¡æœ‰æ‰¾åˆ°æ­¤ID的玻璃)");
                        String send=HexUtil.intTo2ByteHex(3);
                        modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                        log.info("发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                        modbusTcp1.close();
                        //modbusTcp1.close();
                        return;
                    }
                }
                List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"正在工作");
                if((1==plcRequest.getValueInt()&&0==mesSend.getValueInt())
                        &&"开工".equals(machine.getState())
                        &&taskingCount.size()<machine.getMaxTaskCount()){
                    Tasking tasking=taskingService.startMachineTask(machine);
                    if(tasking!=null){
                        log.info("4、发送任务  ä»»åŠ¡æ•°æ®ï¼š{}, è®¾å¤‡çŠ¶æ€:{}, ",machine,tasking);
                        String send=
                                HexUtil.intTo2ByteHex(1)+
                                        HexUtil.intTo2ByteHex(tasking.getTaskSequence().intValue())+
                                        HexUtil.intTo2ByteHex(((Double)(tasking.getWidth()*10)).intValue())+
                                        HexUtil.intTo2ByteHex(((Double)(tasking.getLength()*10)).intValue())+
                                        HexUtil.intTo2ByteHex(tasking.getThickness().intValue())+
                                        HexUtil.intTo2ByteHex(((Double)(tasking.getSilkScreenX()*10)).intValue())+
                                        HexUtil.intTo2ByteHex(((Double)(tasking.getSilkScreenY()*10)).intValue())+
                                        HexUtil.intTo2ByteHex(tasking.getIsSilkScreen());//是否丝印: 0丝印 1不丝印
                        modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                        log.info("发送任务发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()));
                        modbusTcp1.close();
                        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        String sendRecord=df.format(new Date())+"  "+
                                tasking.getGlassId()+"-"+
                                tasking.getWidth()+"-"+
                                tasking.getLength()+"-"+
                                tasking.getThickness()+"-"+
                                tasking.getSilkScreenX()+"-"+
                                tasking.getSilkScreenX()+"-"+
                                tasking.getSilkScreenY()+"-"+
                                tasking.getIsSilkScreen();
                        if (sendRecords.size()>7){
                            sendRecords.remove(0);
                        }
                        Map sendContentMap=new HashMap();
                        sendContentMap.put("sendContent",sendRecord);
                        sendRecords.add(sendContentMap);
                        return;
                    }
                }
            //}
        } catch (Exception e) {
            log.info("交互逻辑错误");
        }
        modbusTcp1.close();
        //log.info("无可执行的条件");
    }
    @Scheduled(fixedDelay = 1000)
    public void SilkScreenTasks() {
        JSONObject jsonObject = new JSONObject();
        Machine machine=machineMapper.selectById(14L);
        List<Tasking> taskingList=taskingService.findMachineTask(machine);
        jsonObject.append("taskingList", taskingList);
        jsonObject.append("machine", machine);
        jsonObject.append("sendRecords", sendRecords);
        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("silkScreenTask");
        if (sendwServer != null) {
            for (WebSocketServer webserver : sendwServer) {
                if (webserver != null) {
                    webserver.sendMessage(jsonObject.toString());
                    List<String> messages = webserver.getMessages();
                    if (!messages.isEmpty()) {
                        // // å°†æœ€åŽä¸€ä¸ªæ¶ˆæ¯è½¬æ¢ä¸ºæ•´æ•°ç±»åž‹çš„列表
                        webserver.clearMessages();
                    }
                } else {
                    log.info("Home is closed");
                }
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/controller/PrimitiveTaskController.java
@@ -1,9 +1,11 @@
package com.mes.md.controller;
import com.mes.md.entity.KBBTJPDrawingBP;
import com.mes.md.entity.Machine;
import com.mes.md.entity.PrimitiveTask;
import com.mes.md.entity.Tasking;
import com.mes.md.service.KBBTJPDrawingBPService;
import com.mes.md.service.PrimitiveTaskService;
import com.mes.md.service.TaskingService;
import com.mes.utils.Result;
@@ -24,8 +26,12 @@
@RestController
@RequestMapping("/primitiveTask")
public class PrimitiveTaskController {
    @Autowired
    private PrimitiveTaskService primitiveTaskService;
    @Autowired
    private KBBTJPDrawingBPService kBBTJPDrawingBPService;
    @ApiOperation("查询当前设备,未完工状态的线上任务")
    @PostMapping("/selectPrimitiveTask")
    @ResponseBody
@@ -34,6 +40,21 @@
        return Result.build(200,"成功",list);
    }
    @ApiOperation("查询当前 æ ‡å‡†ï¼Œå¯é¢†å–的任务(客户表)")
    @PostMapping("/findKBBTJPDrawingBP")
    @ResponseBody
    public Result findKBBTJPDrawingBP() {
        List<KBBTJPDrawingBP> list =kBBTJPDrawingBPService.notReceiveKBBTJPDrawingBP();
        return Result.build(200,"成功",list);
    }
    @ApiOperation("领取或结束  ")
    @PostMapping("/startOrStopPrimitiveTasking")
    @ResponseBody
    public Result startOrStopPrimitiveTasking(@RequestBody PrimitiveTask primitiveTask) {
        int list =primitiveTaskService.startOrStopPrimitiveTasking(primitiveTask);
        return Result.build(200,"成功",list);
    }
    @ApiOperation("根据批次号进行手动报工")
    @PostMapping("/updatePrimitiveTask")
    @ResponseBody
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/controller/TaskingController.java
@@ -3,6 +3,8 @@
import com.mes.md.entity.Machine;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.service.ProjectService;
import com.mes.md.service.TaskingService;
import com.mes.utils.Result;
import io.swagger.annotations.ApiOperation;
@@ -24,51 +26,10 @@
    public class TaskingController {
        @Autowired
        private TaskingService taskingService;
//        @ApiOperation("切换模式")
//        @PostMapping("/updateLoadState") //切换模式"
//        @ResponseBody
//        public Result<Boolean> updateStatus(@RequestBody Integer state) {
//            if(state == 1){
//                boolean result =taskingService.updateStatus(state);
//                return Result.build(1,"定制模式",result);
//            }else {
//                boolean result =taskingService.updateStatus(state);
//                return Result.build(0,"标准模式",result);
//            }
//        }
//        @ApiOperation("点击暂停设备")
//        @PostMapping("/updateLoadStatus") //点击暂停设备
//        @ResponseBody
//        public Result<Boolean> updateLoadStatus(@RequestBody Integer state) {
//            if(state == 1){
//                boolean result =taskingService.updateLoadState(state);
//                return Result.build(1,"成功",result);
//            }else {
//                boolean result =taskingService.updateLoadState(state);
//                return Result.build(0,"成功",result);
//            }
//        }
//        @ApiOperation("点击破损")
//        @PostMapping("/updateDamage") //暂停上片任务
//        @ResponseBody
//        public Result<Tasking> updateDamage(@RequestBody Tasking tasking) {
//
//            boolean result =taskingService.updateDamage(tasking);
//            return Result.build(1,"定制模式",null);
//
//
//        }
//        @ApiOperation("查询当前模式过去的玻璃")
//        @PostMapping("/selectTasking") //暂停上片任务
//        @ResponseBody
//        public Result<List<Tasking>> selectTasking() {
//
//            List<Tasking> tasking =taskingService.selectTasking();
//            return Result.build(1,"定制模式",tasking);
//        }
        @Autowired
        private ProjectService projectService;
        @Autowired
        private MachineMapper machineMapper;
        @ApiOperation("查询当前设备,未完工状态的线上任务")
        @PostMapping("/findMachineTask")
@@ -116,10 +77,18 @@
        }
        @ApiOperation("修改当前设备 ã€ä¸Šçº¿ã€‘")
        @PostMapping("/glassTopLineList")
        @ResponseBody
        public Result glassTopLineList(@RequestBody List<Tasking> taskingList) {
            int count =taskingService.glassTopLine(taskingList);
            return Result.build(200,"修改成功:"+count,count);
        }
        @ApiOperation("修改当前设备 ã€ä¸Šçº¿ã€‘")
        @PostMapping("/glassTopLine")
        @ResponseBody
        public Result glassTopLine(@RequestBody List<Tasking> taskingList) {
            int count =taskingService.glassTopLine(taskingList);
        public Result glassTopLine(@RequestBody Tasking tasking) {
            int count =taskingService.glassTopLine(tasking);
            return Result.build(200,"修改成功:"+count,count);
        }
@@ -130,7 +99,13 @@
            int count =taskingService.glassDownLine(tasking);
            return Result.build(200,"修改成功:"+count,count);
        }
        @ApiOperation("玻璃 ã€ä¸‹çº¿ã€‘")
        @PostMapping("/glassAgainTopLine")
        @ResponseBody
        public Result glassAgainTopLine(@RequestBody Tasking tasking) {
            int count =taskingService.stopTasking(tasking);
            return Result.build(200,"修改成功:"+count,count);
        }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/KBBTJPDrawingBP.java
New file
@@ -0,0 +1,165 @@
package com.mes.md.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
 * <p>
 * åŽŸå§‹ä»»åŠ¡è¡¨
 * </p>
 *
 * @author wu
 * @since 2024-08-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "KBB_T_JPDrawing_BP")
public class KBBTJPDrawingBP implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     *  åŽŸå§‹ä»»åŠ¡è¡¨ä¸»é”®(客户提供样本)
     */
    @TableId(value = "ID", type = IdType.AUTO)
    private Long id;
    /**
     * æ‰¹æ¬¡å·
     */
    private String batchNumber;
    /**
     * æ‰«ç ID (唯一)【板件ID】
     */
    private String scanId;
    /**
     * ç¨‹åºID
     */
    private String programId;
    /**
     * ä»»åŠ¡ç±»åž‹ã€å®šåˆ¶/标准】
     */
    private String taskType;
    /**
     * ä»»åŠ¡é¡ºåº
     */
    private Integer taskSequence;
    /**
     * ä»»åŠ¡æ•°é‡
     */
    private Integer taskQuantity;
    /**
     * é•¿
     */
    private Double length;
    /**
     * å®½
     */
    private Double width;
    /**
     * åŽš
     */
    private Double thickness;
//    /**
//     * ç‚¹èƒ¶å›¾çº¸
//     */
//    private String drawingGlue;
    /**
     * æ‰“标图纸
     */
    private String drawingMarking;
    /**
     * ä¸å°X
     */
    private Double silkScreenX;
    /**
     * ä¸å°Y
     */
    private Double silkScreenY;
//    /**
//     * æ˜¯å¦æ‰“æ ‡
//     */
//    private Integer isMarking;
//
//    /**
//     * æ˜¯å¦ä¸å°
//     */
//    private Integer isSilkScreen;
    /**
     * æŠ¥å·¥æ•°é‡
     */
    private Integer reportCount;
    /**
     * R角1-1(右下角)
     */
    private Double r_1_1;
    /**
     * R角1-2(右下角)
     */
    private Double r_1_2;
    /**
     * R角2-1(右上角)
     */
    private Double r_2_1;
    /**
     * R角2-2(右上角)
     */
    private Double r_2_2;
    /**
     * R角3-1(左上角)
     */
    private Double r_3_1;
    /**
     * R角3-2(左上角)
     */
    private Double r_3_2;
    /**
     * R角4-1(左下角)
     */
    private Double r_4_1;
    /**
     * R角4-2(左下角)
     */
    private Double r_4_2;
    /**
     * æ˜¯å¦é¢†å–
     */
    private Integer isWorking;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    @TableField(value = "CreateDate")
    private Date createDate;
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/LineConfiguration.java
@@ -49,6 +49,9 @@
     * å¤‡æ³¨
     */
    private String remark;
    /**
     * æ˜¯å¦å¯ç”¨
     */
    private int isStart;
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/Machine.java
@@ -61,6 +61,16 @@
     * å¤‡æ³¨
     */
    private String remark;
    /**
     * æ˜¯å¦è¾“出参数日志
     */
    private int isLog;
    /**
     * ä»Šæ—¥å·¥ä½œæ¬¡æ•°
     */
    private Integer todayCount;
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/PrimitiveTask.java
@@ -1,8 +1,11 @@
package com.mes.md.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -105,4 +108,88 @@
     * æŠ¥å·¥æ•°é‡
     */
    private Integer reportCount;
    /**
     * R角1-1(右下角)
     */
    private Double r_1_1;
    /**
     * R角1-2(右下角)
     */
    private Double r_1_2;
    /**
     * R角2-1(右上角)
     */
    private Double r_2_1;
    /**
     * R角2-2(右上角)
     */
    private Double r_2_2;
    /**
     * R角3-1(左上角)
     */
    private Double r_3_1;
    /**
     * R角3-2(左上角)
     */
    private Double r_3_2;
    /**
     * R角4-1(左下角)
     */
    private Double r_4_1;
    /**
     * R角4-2(左下角)
     */
    private Double r_4_2;
    /**
     * æ˜¯å¦å·¥ä½œ
     */
    private Integer isWorking;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    private Date createTime;
    /**
     * é¢†å–æ—¶é—´
     */
    private Date beginTime;
    /**
     * ç»“束时间
     */
    private Date endTime;
    /**
     * ç»“束时 ä»»åŠ¡æ‰§è¡ŒçŠ¶æ€ã€ç­‰å¾…/工作/完成】
     */
    private String workState;
    /**
     * ç»“束时 æ‰€åœ¨å·¥è‰º id (线路ID)
     */
    private Long lineConfigurationId;
    /**
     * ç»“束时 ç”Ÿäº§çŠ¶æ€ã€çº¿ä¸Š/线下】
     */
    private String state;
    /**
     * ç»“束时 çŽ»ç’ƒçŠ¶æ€ã€æ­£å¸¸/破损】
     */
    private String glassState;
    /**
     * é¢†å–线路
     */
    private Integer getLine;
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/Tasking.java
@@ -126,5 +126,48 @@
     */
    private String glassState;
    /**
     * R角1-1(右下角)
     */
    private Double r_1_1;
    /**
     * R角1-2(右下角)
     */
    private Double r_1_2;
    /**
     * R角2-1(右上角)
     */
    private Double r_2_1;
    /**
     * R角2-2(右上角)
     */
    private Double r_2_2;
    /**
     * R角3-1(左上角)
     */
    private Double r_3_1;
    /**
     * R角3-2(左上角)
     */
    private Double r_3_2;
    /**
     * R角4-1(左下角)
     */
    private Double r_4_1;
    /**
     * R角4-2(左下角)
     */
    private Double r_4_2;
    /**
     * æ€»è¡¨ID
     */
    private Long primitiveTaskId;
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/mapper/KBBTJPDrawingBPMapper.java
New file
@@ -0,0 +1,19 @@
package com.mes.md.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.github.yulichang.base.MPJBaseMapper;
import com.mes.md.entity.KBBTJPDrawingBP;
import com.mes.md.entity.PrimitiveTask;
/**
 * <p>
 * åŽŸå§‹ä»»åŠ¡è¡¨ Mapper æŽ¥å£
 * </p>
 *
 * @author wu
 * @since 2024-08-28
 */
@DS("salve_JomooKBB")
public interface KBBTJPDrawingBPMapper extends MPJBaseMapper<KBBTJPDrawingBP> {
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/KBBTJPDrawingBPService.java
New file
@@ -0,0 +1,58 @@
package com.mes.md.service;
import com.github.yulichang.base.MPJBaseService;
import com.mes.md.entity.EdgeGrindingLog;
import com.mes.md.entity.KBBTJPDrawingBP;
import com.mes.md.entity.PrimitiveTask;
import com.mes.md.entity.Tasking;
import java.util.ArrayList;
import java.util.List;
/**
 * <p>
 * ç£¨è¾¹æœºè®¾å¤‡äº¤äº’记录表 æœåŠ¡ç±»
 * </p>
 *
 * @author wu
 * @since 2024-08-28
 */
public interface KBBTJPDrawingBPService extends MPJBaseService<KBBTJPDrawingBP> {
    /**
     * @param scanId å®¢æˆ·æ•°æ®ä¸­ æŸ¥è¯¢æ‰«ç ID
     * @return
     */
    List<KBBTJPDrawingBP> findScanIdKBBTJPDrawingBP(String scanId);
    /**
     * @param id
     * @param getLine
     * @return
     */
    int receiveKBBTJPDrawingBP(Long id,Integer getLine);
    /**
     * å®¢æˆ·è¡¨æœªé¢†å–的【标准】任务
     * @return
     */
    List<KBBTJPDrawingBP> notReceiveKBBTJPDrawingBP();
    /**
     * @param kBBTJPDrawingBP
     * @return
     */
    PrimitiveTask convertListPrimitiveTask(KBBTJPDrawingBP kBBTJPDrawingBP);
    /**
     * @param kBBTJPDrawingBP
     * @param LineConfigurationId
     * @return
     */
    Tasking convertListTasking(KBBTJPDrawingBP kBBTJPDrawingBP,Long LineConfigurationId);
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/LineConfigurationService.java
@@ -3,6 +3,7 @@
import com.github.yulichang.base.MPJBaseService;
import com.mes.md.entity.Line;
import com.mes.md.entity.LineConfiguration;
import com.mes.md.entity.Machine;
/**
 * <p>
@@ -13,5 +14,5 @@
 * @since 2024-08-28
 */
public interface LineConfigurationService extends MPJBaseService<LineConfiguration> {
    LineConfiguration machineLineConfiguration(Machine machine);
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/PrimitiveTaskService.java
@@ -1,8 +1,10 @@
package com.mes.md.service;
import com.github.yulichang.base.MPJBaseService;
import com.mes.md.entity.Machine;
import com.mes.md.entity.PrimitiveTask;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mes.md.entity.Tasking;
import java.util.List;
@@ -15,6 +17,25 @@
 * @since 2024-08-28
 */
public interface PrimitiveTaskService extends MPJBaseService<PrimitiveTask> {
    Tasking convertListTasking(PrimitiveTask primitiveTask, Long LineConfigurationId);
    /**
     *查询标准未完成的任务
     * @return
     */
    List<PrimitiveTask> findPrimitiveTaskNotFinish();
    /**
     *查询标准此线路已领取的任务
     * @return
     */
    List<PrimitiveTask> findPrimitiveTasking(Machine machine,Long line);
    /**
     *  æ ‡å‡†ï¼šé¢†å–任务  /结束任务
     * @return
     */
    int startOrStopPrimitiveTasking(PrimitiveTask primitiveTask);
    /**
     *扫码更新定制玻璃的报工数量
     * @return
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/ProjectService.java
@@ -1,8 +1,17 @@
package com.mes.md.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.yulichang.base.MPJBaseService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.md.entity.KBBTJPDrawingBP;
import com.mes.md.entity.Machine;
import com.mes.md.entity.PrimitiveTask;
import com.mes.md.entity.Project;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mes.md.mapper.KBBTJPDrawingBPMapper;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
 * <p>
@@ -14,4 +23,9 @@
 */
public interface ProjectService extends MPJBaseService<Project> {
    //导入工程
    boolean insertProjectStandard();
    //导入工程-扫码ID
    int insertProjectCustomization(String scan_id);
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/TaskingService.java
@@ -15,31 +15,7 @@
 * @since 2024-08-28
 */
public interface TaskingService extends MPJBaseService<Tasking> {
//    /**
//     * æ›´æ”¹ä¸Šç‰‡æ¨¡å¼
//     * @return boolean
//     */
//    boolean updateStatus(Integer state);
//    /**
//     *更改联机状态
//     * @return boolean
//     */
//    boolean updateLoadState(Integer state);
//    /**
//     * ç‚¹å‡»ç ´æŸ
//     * @return boolean
//     */
//    boolean updateDamage(Tasking tasking);
//    /**
//     * æŸ¥è¯¢å½“前模式过去的玻璃
//     * @return List<Tasking>
//     */
//    List<Tasking> selectTasking();
//    /**
//     * æ ¹æ®ä¸åŒå·¥è‰ºæŸ¥è¯¢å³å°†ä¸Šç‰‡çš„æ•°æ®
//     * @return List<Tasking>
//     */
//    Tasking selectTasking(Tasking tasking);
    /**
     * å®šåˆ¶æ¨¡å¼ä¸‹å°†æ‰«ç å‡ºæ¥id获取成玻璃数据赋值给当前最新的glassId
     * @return List<Tasking>
@@ -63,6 +39,13 @@
    boolean updateTaskingState(Tasking tasking);
    /**
     * @param machine
     * æ‰«ç è®¾å¤‡æ·»åŠ ä»»åŠ¡
     * @return
     */
    int scanMachineAdd(Machine machine, String scanId);
    /**
     * @param machine
@@ -76,18 +59,36 @@
     * @return
     */
    List<Tasking> findMachineWorkStateTask(Machine machine, String workState);
    /**
     *
     * æŸ¥è¯¢çº¿ä¸‹çš„玻璃
     * @return
     */
    List<Tasking> findDownLineTask();
    /**
     * @param machine
     * å½“前设备标记正在工作:线上等待的任务第一条   (线上/正常)
     * @return
     */
    Tasking startMachineTask(Machine machine);
    Tasking startMachineTask(Machine machine, String glassId);
    /**
     * @param machine
     * å½“前设备 çš„前全部工序 åˆ°æœ¬å·¥åºçš„ scan_id ä»»åŠ¡çŠ¶æ€ä¸ºæ­£åœ¨å·¥ä½œ
     * @return
     */
    Tasking startScanIdMachineTask(Machine machine, String scan_id);
    /**
     * @param machine
     * å½“前设备标记完成:正在工作的第一个任务   (线上/正常)   è¿”回完成数量
     * @return
     */
    int finishMachineTask(Machine machine);
    int finishMachineTask(Machine machine,Integer taskSequence);
    /**
     * @param machine
     * å½“前设备标记失败,正在工作的最后一个任务   (线上/正常)   è¿”回失败数量
@@ -101,6 +102,12 @@
     */
    int damagedTask(Tasking tasking);
    /**
     * @param machine
     * ä¿®æ”¹çŠ¶æ€ ã€ä¸‹çº¿ã€‘
     * @return
     */
    int glassDownLineOne(Machine machine);
    /**
     * @param tasking
     * ä¿®æ”¹çŠ¶æ€ ã€ä¸‹çº¿ã€‘
     * @return
@@ -112,4 +119,19 @@
     * @return
     */
    int glassTopLine(List<Tasking> taskingList);
    /**
     * @param tasking
     * æ‰¹é‡ä¿®æ”¹çŠ¶æ€ ã€ä¸Šçº¿ã€‘
     * @return
     */
    int glassTopLine(Tasking tasking);
    List<Tasking> findMachineTaskID(Machine machine,String scan_id);
    /**
     * @param tasking
     * ä»»åŠ¡ç»“æŸ
     * @return
     */
    int stopTasking(Tasking tasking);
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/KBBTJPDrawingBPServiceImpl.java
New file
@@ -0,0 +1,154 @@
package com.mes.md.service.impl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.md.entity.EdgeGrindingLog;
import com.mes.md.entity.KBBTJPDrawingBP;
import com.mes.md.entity.PrimitiveTask;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.EdgeGrindingLogMapper;
import com.mes.md.mapper.KBBTJPDrawingBPMapper;
import com.mes.md.mapper.PrimitiveTaskMapper;
import com.mes.md.service.EdgeGrindingLogService;
import com.mes.md.service.KBBTJPDrawingBPService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * <p>
 * ç£¨è¾¹æœºè®¾å¤‡äº¤äº’记录表 æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author wu
 * @since 2024-08-28
 */
@Service
public class KBBTJPDrawingBPServiceImpl extends MPJBaseServiceImpl<KBBTJPDrawingBPMapper, KBBTJPDrawingBP> implements KBBTJPDrawingBPService {
    @Autowired
    KBBTJPDrawingBPService kBBTJPDrawingBPService;
    @Autowired
    PrimitiveTaskMapper primitiveTaskMapper;
    /**
     * @param scanId å®¢æˆ·æ•°æ®ä¸­ æŸ¥è¯¢æ‰«ç ID
     * @return
     */
    @Override
    public List<KBBTJPDrawingBP> findScanIdKBBTJPDrawingBP(String scanId){
        List<KBBTJPDrawingBP> kBBTJPDrawingBP=baseMapper.selectJoinList(KBBTJPDrawingBP.class,new MPJLambdaWrapper<KBBTJPDrawingBP>()
                .selectAll(KBBTJPDrawingBP.class)
                .eq(KBBTJPDrawingBP::getScanId,scanId)
                .orderByDesc(KBBTJPDrawingBP::getCreateDate)
                .orderByAsc(KBBTJPDrawingBP::getTaskSequence));
        return kBBTJPDrawingBP;
    }
    /**
     * @param id
     * @param getLine
     * @return
     */
    @Override
    public int receiveKBBTJPDrawingBP(Long id,Integer getLine){
        KBBTJPDrawingBP addKBBTJPDrawingBP=baseMapper.selectById(id);
        addKBBTJPDrawingBP.setIsWorking(1);
        PrimitiveTask primitiveTask= kBBTJPDrawingBPService.convertListPrimitiveTask(addKBBTJPDrawingBP);
        primitiveTask.setIsWorking(addKBBTJPDrawingBP.getIsWorking());
        primitiveTask.setGetLine(getLine);
        if(primitiveTaskMapper.insert(primitiveTask)>0){
            return baseMapper.updateById(addKBBTJPDrawingBP);
        }
        return 0;
    }
    /**
     * å®¢æˆ·è¡¨æœªé¢†å–的【标准】任务
     * @return
     */
    @Override
    public List<KBBTJPDrawingBP> notReceiveKBBTJPDrawingBP(){
        List<KBBTJPDrawingBP> kBBTJPDrawingBP=baseMapper.selectJoinList(KBBTJPDrawingBP.class,new MPJLambdaWrapper<KBBTJPDrawingBP>()
                .selectAll(KBBTJPDrawingBP.class)
                .eq(KBBTJPDrawingBP::getTaskType,"标准")
                .orderByDesc(KBBTJPDrawingBP::getCreateDate)
                .orderByAsc(KBBTJPDrawingBP::getTaskSequence));
        return kBBTJPDrawingBP;
    }
    //客户表格转 æˆ‘们的数据
    @Override
    public PrimitiveTask convertListPrimitiveTask(KBBTJPDrawingBP kBBTJPDrawingBP) {
        try {
            PrimitiveTask primitiveTask=new PrimitiveTask();
            primitiveTask.setScanId(kBBTJPDrawingBP.getScanId());
            primitiveTask.setProgramId(kBBTJPDrawingBP.getProgramId());
            primitiveTask.setBatchNumber(kBBTJPDrawingBP.getBatchNumber()==null?"":kBBTJPDrawingBP.getBatchNumber());
            primitiveTask.setTaskType(kBBTJPDrawingBP.getTaskType());
            primitiveTask.setLength(kBBTJPDrawingBP.getLength());
            primitiveTask.setWidth(kBBTJPDrawingBP.getWidth());
            primitiveTask.setThickness(kBBTJPDrawingBP.getThickness());
            primitiveTask.setDrawingMarking(kBBTJPDrawingBP.getDrawingMarking());
            primitiveTask.setIsMarking((kBBTJPDrawingBP.getDrawingMarking()==null||kBBTJPDrawingBP.getDrawingMarking().isEmpty())?0:1);//是否打标:0不打标   1打标
            primitiveTask.setIsSilkScreen(((kBBTJPDrawingBP.getSilkScreenX()==null||kBBTJPDrawingBP.getSilkScreenY()==null||kBBTJPDrawingBP.getSilkScreenX()==0||kBBTJPDrawingBP.getSilkScreenY()==0)?1:0));
            primitiveTask.setSilkScreenX(kBBTJPDrawingBP.getSilkScreenX()==null?0:kBBTJPDrawingBP.getSilkScreenX());
            primitiveTask.setSilkScreenY(kBBTJPDrawingBP.getSilkScreenY()==null?0:kBBTJPDrawingBP.getSilkScreenY());
            primitiveTask.setTaskSequence(kBBTJPDrawingBP.getTaskSequence());
            primitiveTask.setTaskQuantity(kBBTJPDrawingBP.getTaskQuantity());
            primitiveTask.setR_1_1(kBBTJPDrawingBP.getR_1_1()==null?0:kBBTJPDrawingBP.getR_1_1());
            primitiveTask.setR_1_2(kBBTJPDrawingBP.getR_1_2()==null?0:kBBTJPDrawingBP.getR_1_2());
            primitiveTask.setR_2_1(kBBTJPDrawingBP.getR_2_1()==null?0:kBBTJPDrawingBP.getR_2_1());
            primitiveTask.setR_2_2(kBBTJPDrawingBP.getR_2_2()==null?0:kBBTJPDrawingBP.getR_2_2());
            primitiveTask.setR_3_1(kBBTJPDrawingBP.getR_3_1()==null?0:kBBTJPDrawingBP.getR_3_1());
            primitiveTask.setR_3_2(kBBTJPDrawingBP.getR_3_2()==null?0:kBBTJPDrawingBP.getR_3_2());
            primitiveTask.setR_4_1(kBBTJPDrawingBP.getR_4_1()==null?0:kBBTJPDrawingBP.getR_4_1());
            primitiveTask.setR_4_2(kBBTJPDrawingBP.getR_4_2()==null?0:kBBTJPDrawingBP.getR_4_2());
            primitiveTask.setCreateTime(new Date());
            return primitiveTask;
        }catch (Exception e) {
            return null;
        }
    }
    //客户表格转 æˆ‘们的任务表
    @Override
    public Tasking convertListTasking(KBBTJPDrawingBP kBBTJPDrawingBP,Long LineConfigurationId) {
        try {
            Tasking tasking=new Tasking();
            tasking.setLineConfigurationId(LineConfigurationId);
            tasking.setState("线上");
            tasking.setWorkState("等待");
            tasking.setGlassState("正常");
            tasking.setScanId(kBBTJPDrawingBP.getScanId());
            tasking.setProgramId(kBBTJPDrawingBP.getProgramId());
            tasking.setBatchNumber(kBBTJPDrawingBP.getBatchNumber()==null?"":kBBTJPDrawingBP.getBatchNumber());
            tasking.setTaskType(kBBTJPDrawingBP.getTaskType());
            tasking.setLength(kBBTJPDrawingBP.getLength());
            tasking.setWidth(kBBTJPDrawingBP.getWidth());
            tasking.setThickness(kBBTJPDrawingBP.getThickness());
            tasking.setIsMarking((kBBTJPDrawingBP.getDrawingMarking()==null||kBBTJPDrawingBP.getDrawingMarking().isEmpty())?0:1);//是否打标:0不打标   1打标
            tasking.setDrawingMarking(kBBTJPDrawingBP.getDrawingMarking());
            tasking.setIsSilkScreen(((kBBTJPDrawingBP.getSilkScreenX()==null||kBBTJPDrawingBP.getSilkScreenY()==null||kBBTJPDrawingBP.getSilkScreenX()==0||kBBTJPDrawingBP.getSilkScreenY()==0)?1:0));//是否打标:1丝印   0不丝印
            tasking.setSilkScreenX(kBBTJPDrawingBP.getSilkScreenX()==null?0:kBBTJPDrawingBP.getSilkScreenX());
            tasking.setSilkScreenY(kBBTJPDrawingBP.getSilkScreenY()==null?0:kBBTJPDrawingBP.getSilkScreenY());
            tasking.setTaskSequence(kBBTJPDrawingBP.getTaskSequence());
            tasking.setTaskQuantity(kBBTJPDrawingBP.getTaskQuantity());
            tasking.setR_1_1(kBBTJPDrawingBP.getR_1_1()==null?0:kBBTJPDrawingBP.getR_1_1());
            tasking.setR_1_2(kBBTJPDrawingBP.getR_1_2()==null?0:kBBTJPDrawingBP.getR_1_2());
            tasking.setR_2_1(kBBTJPDrawingBP.getR_2_1()==null?0:kBBTJPDrawingBP.getR_2_1());
            tasking.setR_2_2(kBBTJPDrawingBP.getR_2_2()==null?0:kBBTJPDrawingBP.getR_2_2());
            tasking.setR_3_1(kBBTJPDrawingBP.getR_3_1()==null?0:kBBTJPDrawingBP.getR_3_1());
            tasking.setR_3_2(kBBTJPDrawingBP.getR_3_2()==null?0:kBBTJPDrawingBP.getR_3_2());
            tasking.setR_4_1(kBBTJPDrawingBP.getR_4_1()==null?0:kBBTJPDrawingBP.getR_4_1());
            tasking.setR_4_2(kBBTJPDrawingBP.getR_4_2()==null?0:kBBTJPDrawingBP.getR_4_2());
            return tasking;
        }catch (Exception e) {
            return null;
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/LineConfigurationServiceImpl.java
@@ -1,13 +1,17 @@
package com.mes.md.service.impl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.md.entity.Line;
import com.mes.md.entity.LineConfiguration;
import com.mes.md.entity.Machine;
import com.mes.md.mapper.LineConfigurationMapper;
import com.mes.md.mapper.LineMapper;
import com.mes.md.service.LineConfigurationService;
import com.mes.md.service.LineService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * <p>
@@ -20,4 +24,14 @@
@Service
public class LineConfigurationServiceImpl extends MPJBaseServiceImpl<LineConfigurationMapper, LineConfiguration> implements LineConfigurationService {
    @Override
    public LineConfiguration machineLineConfiguration(Machine machine){
        List<LineConfiguration> machineLineConfiguration=baseMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>()
                .selectAll(LineConfiguration.class)
                .eq(LineConfiguration::getMachineId,machine.getId()));
        if(machineLineConfiguration.isEmpty()){
            return null;
        }
        return machineLineConfiguration.get(0);
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/PrimitiveTaskServiceImpl.java
@@ -3,12 +3,17 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.mes.md.entity.PrimitiveTask;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.md.entity.*;
import com.mes.md.mapper.PrimitiveTaskMapper;
import com.mes.md.service.KBBTJPDrawingBPService;
import com.mes.md.service.LineConfigurationService;
import com.mes.md.service.PrimitiveTaskService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
@@ -21,6 +26,55 @@
 */
@Service
public class PrimitiveTaskServiceImpl extends MPJBaseServiceImpl<PrimitiveTaskMapper, PrimitiveTask> implements PrimitiveTaskService {
    @Autowired
    LineConfigurationService lineConfigurationService;
    @Autowired
    KBBTJPDrawingBPService kBBTJPDrawingBPService;
    /**
     *查询标准未领取的任务
     * @return
     */
    @Override
    public List<PrimitiveTask> findPrimitiveTaskNotFinish(){
        return baseMapper.selectList(new QueryWrapper<PrimitiveTask>().lambda()
                .eq(PrimitiveTask::getIsWorking,0)
                .eq(PrimitiveTask::getTaskType,"标准")
                .orderByAsc(PrimitiveTask::getCreateTime)
                .orderByAsc(PrimitiveTask::getTaskSequence));
    }
    /**
     *查询标准此线路已领取的任务
     * @return
     */
    @Override
    public List<PrimitiveTask> findPrimitiveTasking(Machine machine,Long line){
        return baseMapper.selectList(new MPJLambdaWrapper<PrimitiveTask>()
                .eq(PrimitiveTask::getIsWorking,1)
                .eq(PrimitiveTask::getGetLine,line)
                .eq(PrimitiveTask::getTaskType,"标准")
                .orderByAsc(PrimitiveTask::getBeginTime));
    }
    /**
     *  æ ‡å‡†ï¼šé¢†å–任务  /结束任务
     * @return
     */
    @Override
    public int startOrStopPrimitiveTasking(PrimitiveTask primitiveTask){
        if (primitiveTask.getIsWorking()==1){//领取
            return kBBTJPDrawingBPService.receiveKBBTJPDrawingBP(primitiveTask.getId(),primitiveTask.getGetLine());
        }else if (primitiveTask.getIsWorking()==2){//完工
            PrimitiveTask thisPrimitiveTask=baseMapper.selectById(primitiveTask);
            thisPrimitiveTask.setIsWorking(primitiveTask.getIsWorking());
            thisPrimitiveTask.setEndTime(new Date());
            return baseMapper.updateById(thisPrimitiveTask);
        }
        return 0;
    }
    @Override
    public boolean updateReportCount(String scanId) {
@@ -45,4 +99,42 @@
        //查询报工数据
        return list(new QueryWrapper<>(task)) ;
    }
    //客户表格转 æˆ‘们的任务表
    @Override
    public Tasking convertListTasking(PrimitiveTask primitiveTask, Long LineConfigurationId) {
        try {
            Tasking tasking=new Tasking();
            tasking.setLineConfigurationId(LineConfigurationId);
            tasking.setState("线上");
            tasking.setWorkState("等待");
            tasking.setGlassState("正常");
            tasking.setScanId(primitiveTask.getScanId());
            tasking.setProgramId(primitiveTask.getProgramId());
            tasking.setBatchNumber(primitiveTask.getBatchNumber()==null?"":primitiveTask.getBatchNumber());
            tasking.setTaskType(primitiveTask.getTaskType());
            tasking.setLength(primitiveTask.getLength());
            tasking.setWidth(primitiveTask.getWidth());
            tasking.setThickness(primitiveTask.getThickness());
            tasking.setIsMarking((primitiveTask.getDrawingMarking()==null||primitiveTask.getDrawingMarking().isEmpty())?0:1);
            tasking.setDrawingMarking(primitiveTask.getDrawingMarking());
            tasking.setIsSilkScreen(((primitiveTask.getSilkScreenX()==null||primitiveTask.getSilkScreenY()==null||primitiveTask.getSilkScreenX()==0||primitiveTask.getSilkScreenY()==0)?1:0));
            tasking.setSilkScreenX(primitiveTask.getSilkScreenX()==null?0:primitiveTask.getSilkScreenX());
            tasking.setSilkScreenY(primitiveTask.getSilkScreenY()==null?0:primitiveTask.getSilkScreenY());
            tasking.setTaskSequence(primitiveTask.getTaskSequence());
            tasking.setTaskQuantity(primitiveTask.getTaskQuantity());
            tasking.setR_1_1(primitiveTask.getR_1_1()==null?0:primitiveTask.getR_1_1());
            tasking.setR_1_2(primitiveTask.getR_1_2()==null?0:primitiveTask.getR_1_2());
            tasking.setR_2_1(primitiveTask.getR_2_1()==null?0:primitiveTask.getR_2_1());
            tasking.setR_2_2(primitiveTask.getR_2_2()==null?0:primitiveTask.getR_2_2());
            tasking.setR_3_1(primitiveTask.getR_3_1()==null?0:primitiveTask.getR_3_1());
            tasking.setR_3_2(primitiveTask.getR_3_2()==null?0:primitiveTask.getR_3_2());
            tasking.setR_4_1(primitiveTask.getR_4_1()==null?0:primitiveTask.getR_4_1());
            tasking.setR_4_2(primitiveTask.getR_4_2()==null?0:primitiveTask.getR_4_2());
            return tasking;
        }catch (Exception e) {
            return null;
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/ProjectServiceImpl.java
@@ -1,11 +1,17 @@
package com.mes.md.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.mes.md.entity.Project;
import com.mes.md.mapper.ProjectMapper;
import com.mes.md.service.ProjectService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.md.entity.*;
import com.mes.md.mapper.*;
import com.mes.md.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
 * <p>
@@ -18,4 +24,72 @@
@Service
public class ProjectServiceImpl extends MPJBaseServiceImpl<ProjectMapper, Project> implements ProjectService {
    @Autowired
    KBBTJPDrawingBPMapper kBBTJPDrawingBPMapper;
    @Autowired
    PrimitiveTaskService primitiveTaskService;
    @Autowired
    TaskingService taskingService;
    @Autowired
    PrimitiveTaskMapper primitiveTaskMapper;
    @Autowired
    TaskingMapper taskingMapper;
    @Autowired
    KBBTJPDrawingBPService kBBTJPDrawingBPService;
    @Autowired
    LineConfigurationService lineConfigurationService;
    //标准导入工程 æ•°æ®
    @Override
    public boolean insertProjectStandard() {
        //
        try {
            //获取最新本地未添加的数据
            List<KBBTJPDrawingBP> kBBTJPDrawingBP=kBBTJPDrawingBPMapper.selectJoinList(KBBTJPDrawingBP.class,new MPJLambdaWrapper<KBBTJPDrawingBP>()
                    .selectAll(KBBTJPDrawingBP.class)
                    .eq(KBBTJPDrawingBP::getIsWorking,0)
                    .eq(KBBTJPDrawingBP::getTaskType,"标准")
                    .orderByAsc(KBBTJPDrawingBP::getCreateDate)
                    .orderByAsc(KBBTJPDrawingBP::getTaskSequence));
            List<PrimitiveTask> list=new ArrayList();
            for (KBBTJPDrawingBP item:kBBTJPDrawingBP){
                PrimitiveTask primitiveTask= kBBTJPDrawingBPService.convertListPrimitiveTask(item);
                if(primitiveTask!=null){
                    //primitiveTaskMapper.insert(primitiveTask);
                    list.add(primitiveTask);
                }
            }
            if(list.size()>0){
                primitiveTaskService.saveBatch(list);
            }
        }catch (Exception e){
            return false;
        }
        return true;
    }
    /**
     * æ‰«ç çš„玻璃添加到数据到本地
     * @param scan_id
     * @return
     */
    @Override
    public int insertProjectCustomization(String scan_id) {
        //查询扫码数据  æ·»åŠ åˆ°åŽŸæ•°æ®
        try {
            List<KBBTJPDrawingBP> kBBTJPDrawingBP=kBBTJPDrawingBPService.findScanIdKBBTJPDrawingBP(scan_id);
            for (KBBTJPDrawingBP item:kBBTJPDrawingBP){
                PrimitiveTask primitiveTask= kBBTJPDrawingBPService.convertListPrimitiveTask(item);
                return primitiveTaskMapper.insert(primitiveTask);
            }
        }catch (Exception e){
            return 0;
        }
        return 0;
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/TaskingServiceImpl.java
@@ -4,20 +4,15 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.common.S7object;
import com.mes.device.PlcParameterObject;
import com.mes.md.entity.GlassInfo;
import com.mes.md.entity.LineConfiguration;
import com.mes.md.entity.Machine;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.GlassInfoMapper;
import com.mes.md.mapper.TaskingMapper;
import com.mes.md.service.GlassInfoService;
import com.mes.md.service.TaskingService;
import com.mes.md.entity.*;
import com.mes.md.mapper.*;
import com.mes.md.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -29,12 +24,27 @@
 * @author wu
 * @since 2024-08-28
 */
@Slf4j
@Service
public class TaskingServiceImpl extends MPJBaseServiceImpl<TaskingMapper, Tasking> implements TaskingService {
    @Resource
    GlassInfoMapper glassInfoMapper;
    @Resource
    LineConfigurationMapper lineConfigurationMapper;
    @Autowired
    GlassInfoService glassInfoService;
    @Autowired
    private PrimitiveTaskService primitiveTaskService;
    @Autowired
    private ProjectService projectService;
    @Autowired
    private PrimitiveTaskMapper primitiveTaskMapper;
    @Autowired
    private MachineMapper machineMapper;
    @Autowired
    private LineConfigurationService lineConfigurationService;
    /**
     * @param machine
@@ -56,9 +66,70 @@
    }
    /**
     * @param machine
     * æŸ¥è¯¢æ­¤çº¿çº¿ä¸Šæœªå®Œå·¥çš„任务   (线上/正常)  çš„æŒ‰æ‰«ç ID查询
     * @return
     */
    @Override
    public List<Tasking> findMachineTaskID(Machine machine,String scan_id) {
        List<LineConfiguration> machineLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>()
                .selectAll(LineConfiguration.class)
                .eq(LineConfiguration::getMachineId,machine.getId()));
        if(!machineLineConfiguration.isEmpty()){
            //此设备线路未完工的 çš„任务
            List<Tasking> list=baseMapper.selectJoinList(Tasking.class,new MPJLambdaWrapper<Tasking>()
                    .selectAll(Tasking.class)
                    .innerJoin(LineConfiguration.class,LineConfiguration::getId,Tasking::getLineConfigurationId)
                    .eq(LineConfiguration::getLineId,machineLineConfiguration.get(0).getLineId())
                    .eq(Tasking::getScanId,scan_id)
                    .eq(Tasking::getGlassState,"正常")
                    .eq(Tasking::getState,"线上")
                    .ne(Tasking::getWorkState,"完工")
                    .orderByAsc(Tasking::getTaskSequence));
            return list;
        }else{
            log.info("此任务ID存在但条件不满足:{}",scan_id);
        }
        return null;
    }
    /**
     * @param tasking
     * ä»»åŠ¡ç»“æŸ
     * @return
     */
    @Override
    public int stopTasking(Tasking tasking){
        //1.标记总表任务结束    2.删除tasking è¡¨
        tasking.setWorkState("完工");
        baseMapper.updateById(tasking);
        //完工     /破损/拿走的玻璃
        List<Tasking> taskingList=baseMapper.selectList(new QueryWrapper<Tasking>().lambda()
                .eq(Tasking::getScanId,tasking.getScanId())
                        .and(wrapper->wrapper
                                .eq(Tasking::getWorkState,"完工")
                                .ne(Tasking::getState,"线下")
                                .ne(Tasking::getGlassState,"破损"))
        );
        if(!taskingList.isEmpty()){
            List<PrimitiveTask> primitiveTask=primitiveTaskMapper.selectList(new QueryWrapper<PrimitiveTask>().lambda()
                    .eq(PrimitiveTask::getScanId,tasking.getScanId())
                    .orderByDesc(PrimitiveTask::getId));
            for(PrimitiveTask task:primitiveTask){
                if (taskingList.size()==task.getTaskQuantity()){
                    task.setReportCount(taskingList.size());
                    task.setEndTime(new Date());
                    primitiveTaskMapper.updateById(task);
                    return baseMapper.delete(new QueryWrapper<Tasking>().lambda().eq(Tasking::getScanId,tasking.getScanId()));
                }
            }
        }
        return 0;
    }
    /**
     * @param machine,workState
     * æŸ¥è¯¢å½“前设备,线上【等待/工作/完工】的任务 å‡åº   (线上/正常)
     * @return
     * @return List<Tasking>
     */
    @Override
    public List<Tasking> findMachineWorkStateTask(Machine machine, String workState) {
@@ -73,7 +144,20 @@
                .orderByAsc(Tasking::getTaskSequence));
        return list;
    }
    /**
     *
     * æŸ¥è¯¢çº¿ä¸‹æ­£å¸¸çš„玻璃
     * @return List<Tasking> findDownLineTask();
     */
    @Override
    public List<Tasking> findDownLineTask() {
        List<Tasking> list=baseMapper.selectJoinList(Tasking.class,new MPJLambdaWrapper<Tasking>()
                .selectAll(Tasking.class)
                .eq(Tasking::getGlassState,"正常")
                .eq(Tasking::getState,"线下")
                .orderByAsc(Tasking::getTaskSequence));
        return list;
    }
    /**
     * @param machine
@@ -92,6 +176,114 @@
        }
        return null;
    }
    /**
     * @param machine
     * å½“前设备标记正在工作:验证第此ID是否是 çº¿ä¸Šç­‰å¾…的任务第一条
     * @return
     */
    @Override
    public Tasking startMachineTask(Machine machine, String scan_id) {
        List<Tasking> list=this.findMachineWorkStateTask(machine,"等待");
        if(!list.isEmpty()){
            Tasking tasking=list.get(0);
            if(scan_id.equals(tasking.getScanId())){
                tasking.setWorkState("正在工作");
                if(baseMapper.updateById(tasking)>0){
                    return tasking;
                };
            }
        }
        return null;
    }
    /**
     * @param machine
     * å½“前 æ‰«ç ID  æ˜¯å¦åœ¨å½“前设备以前存在  å­˜åœ¨åˆ™ç›´æŽ¥è·³åˆ°å½“前设备  å¹¶ä¸”标记工作
     * @return
     */
    @Override
    public Tasking startScanIdMachineTask(Machine machine, String scan_id) {
        //找当前设备线路
        List<LineConfiguration> machineLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>()
                .selectAll(LineConfiguration.class)
                .eq(LineConfiguration::getMachineId,machine.getId()));
        if(!machineLineConfiguration.isEmpty()){
            //此设备线路未完工的 çš„任务
            List<Tasking> list=baseMapper.selectJoinList(Tasking.class,new MPJLambdaWrapper<Tasking>()
                    .selectAll(Tasking.class)
                    .innerJoin(LineConfiguration.class,LineConfiguration::getId,Tasking::getLineConfigurationId)
                    .eq(LineConfiguration::getLineId,machineLineConfiguration.get(0).getLineId())
                    .eq(Tasking::getScanId,scan_id)
                    .eq(Tasking::getGlassState,"正常")
                    .eq(Tasking::getState,"线上")
                    .le(LineConfiguration::getProcessSequence,machineLineConfiguration.get(0).getProcessSequence())
                    .orderByAsc(Tasking::getTaskSequence));
            if(!list.isEmpty()){
                Tasking tasking=list.get(0);
                Integer taskSequence=1;
                if (machine.getTodayCount()>0&&machine.getTodayCount()<5000){
                    taskSequence=machine.getTodayCount()+1;
                }else{
                    taskSequence=1;
                }
                machine.setTodayCount(taskSequence);
                machineMapper.updateById(machine);
                tasking.setTaskSequence(taskSequence);
                tasking.setWorkState("正在工作");
                tasking.setLineConfigurationId(machineLineConfiguration.get(0).getId());
                if(baseMapper.updateById(tasking)>0){
                    finishMachineTask(machine);
                    return tasking;
                }
            }
        }
        return null;
    }
    /**
     * @param machine
     * å½“前设备标记完成:正在工作的第一个任务   (线上/正常)   è¿”回完成数量
     * @return
     */
    @Override
    public int finishMachineTask(Machine machine,Integer taskSequence) {
        List<Tasking> list=baseMapper.selectJoinList(Tasking.class,new MPJLambdaWrapper<Tasking>()
                .selectAll(Tasking.class)
                .innerJoin(LineConfiguration.class,LineConfiguration::getId,Tasking::getLineConfigurationId)
                .innerJoin(Machine.class,Machine::getId,LineConfiguration::getMachineId)
                .eq(LineConfiguration::getMachineId,machine.getId())
                .eq(Tasking::getGlassState,"正常")
                .eq(Tasking::getState,"线上")
                .eq(Tasking::getTaskSequence,taskSequence)
                .eq(Tasking::getWorkState,"正在工作")
                .orderByAsc(Tasking::getTaskSequence));
        //当前设备的线路配置
        List<LineConfiguration> machineLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>()
                .selectAll(LineConfiguration.class)
                .eq(LineConfiguration::getMachineId,machine.getId()));
        if(!machineLineConfiguration.isEmpty()){
            List<LineConfiguration> listLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>()
                    .selectAll(LineConfiguration.class)
                    .eq(LineConfiguration::getLineId,machineLineConfiguration.get(0).getLineId())
                    .eq(LineConfiguration::getIsStart,1)
                    .gt(LineConfiguration::getProcessSequence,machineLineConfiguration.get(0).getProcessSequence())
                    .orderByAsc(LineConfiguration::getProcessSequence)
                    .orderByAsc(LineConfiguration::getPrioritySequence)
            );
            if(!list.isEmpty()){
                Tasking tasking=list.get(0);
                if (!listLineConfiguration.isEmpty()){
                    tasking.setLineConfigurationId(listLineConfiguration.get(0).getId());
                    tasking.setWorkState("等待");
                    return baseMapper.updateById(tasking);
                }else{
                    return this.stopTasking(tasking);
                }
            }
        }
        return 0;
    }
    /**
     * @param machine
@@ -101,10 +293,30 @@
    @Override
    public int finishMachineTask(Machine machine) {
        List<Tasking> list=this.findMachineWorkStateTask(machine,"正在工作");
        if(!list.isEmpty()){
            Tasking tasking=list.get(0);
            tasking.setWorkState("完工");
            return baseMapper.updateById(tasking);
        //当前设备的线路配置
        List<LineConfiguration> machineLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>()
                .selectAll(LineConfiguration.class)
                .eq(LineConfiguration::getMachineId,machine.getId()));
        if(!machineLineConfiguration.isEmpty()){
            List<LineConfiguration> listLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>()
                    .selectAll(LineConfiguration.class)
                    .eq(LineConfiguration::getLineId,machineLineConfiguration.get(0).getLineId())
                    .eq(LineConfiguration::getIsStart,1)
                    .gt(LineConfiguration::getProcessSequence,machineLineConfiguration.get(0).getProcessSequence())
                    .orderByAsc(LineConfiguration::getProcessSequence)
                    .orderByAsc(LineConfiguration::getPrioritySequence)
            );
            if(!list.isEmpty()){
                Tasking tasking=list.get(0);
                if (!listLineConfiguration.isEmpty()){
                    tasking.setLineConfigurationId(listLineConfiguration.get(0).getId());
                    tasking.setWorkState("等待");
                    return baseMapper.updateById(tasking);
                }else{
                    return this.stopTasking(tasking);
                }
            }
        }
        return 0;
    }
@@ -131,7 +343,24 @@
        }
        return 0;
    }
    @Override
    public int glassDownLineOne(Machine machine){
        List<Tasking> list=baseMapper.selectJoinList(Tasking.class,new MPJLambdaWrapper<Tasking>()
                .selectAll(Tasking.class)
                .innerJoin(LineConfiguration.class,LineConfiguration::getId,Tasking::getLineConfigurationId)
                .innerJoin(Machine.class,Machine::getId,LineConfiguration::getMachineId)
                .eq(LineConfiguration::getMachineId,machine.getId())
                .eq(Tasking::getGlassState,"正常")
                .eq(Tasking::getState,"线上")
                .eq(Tasking::getWorkState,"正在工作")
                .orderByDesc(Tasking::getTaskSequence));
        if(!list.isEmpty()){
            Tasking tasking=list.get(0);
            tasking.setState("线下");
            return baseMapper.updateById(tasking);
        }
        return 0;
    }
    /**
     * @param tasking
     * ç ´æŸçŽ»ç’ƒï¼Œ  (线上/正常)   è¿”回破损数量
@@ -155,7 +384,7 @@
    public int glassDownLine(Tasking tasking) {
        Tasking oldTasking=baseMapper.selectById(tasking);
        if (!Objects.isNull(oldTasking)){
            oldTasking.setState(tasking.getState());
            oldTasking.setState("线下");
            return baseMapper.updateById(oldTasking);
        }
        return 0;
@@ -179,62 +408,85 @@
        return resultCount;
    }
    public int test(List<Tasking> taskingList) {
        int resultCount=0;
        //
        return resultCount;
    /**
     * @param taskingList
     * æ‰¹é‡ä¿®æ”¹çŠ¶æ€ ã€ä¸Šçº¿ã€‘
     * @return
     */
    @Override
    public int glassTopLine(Tasking taskingList) {
        //当前设备的线路配置
        Long machineId=taskingList.getLineConfigurationId();
        List<LineConfiguration> machineLineConfiguration=lineConfigurationMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>()
                .selectAll(LineConfiguration.class)
                .eq(LineConfiguration::getMachineId,machineId));
        if(!machineLineConfiguration.isEmpty()){
            Tasking oldTasking=baseMapper.selectById(taskingList);
            if (!Objects.isNull(oldTasking)){
                oldTasking.setLineConfigurationId(machineLineConfiguration.get(0).getId());
                oldTasking.setState("线上");
                oldTasking.setWorkState("等待");
                oldTasking.setGlassState("正常");
                return baseMapper.updateById(oldTasking);
            }
        }
        return 0;
    }
//
//    @Override
//    public boolean updateStatus(Integer state) {
//        //更改上片模式
//        //向设备发送选择的状态
//        S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("Status").getAddress(), state);
//        //发送后重新读取判断是否更改成功
//        String loadStatus = plcParameterObject.getPlcParameter("Status").getValue();
//        return state == Integer.parseInt(loadStatus);
//
//    }
//
//    /**
//     * @param state
//     * @return
//     */
//    @Override
//    public boolean updateLoadState(Integer state) {
//        //更改联机状态
//        //向设备发送选择的状态
//        S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("loadState").getAddress(), state);
//        //发送后重新读取判断是否更改成功
//        String loadState = plcParameterObject.getPlcParameter("loadState").getValue();
//        return state == Integer.parseInt(loadState);
//
//    }
//
//    @Override
//    public boolean updateDamage(Tasking tasking) {
//        UpdateWrapper<Tasking> queryWrapper = new UpdateWrapper<>();
//        queryWrapper.eq("glass_id",tasking.getGlassId())
//                .set("work_state",tasking.getWorkState());
//        return this.update(queryWrapper);
//    }
//
//    @Override
//    public List<Tasking> selectTasking() {
//        QueryWrapper<Tasking> queryWrapper = new QueryWrapper<>();
//        queryWrapper.orderByDesc("task_sequence");
//        return list(queryWrapper);
//    }
//    @Override
//    public Tasking selectTasking(Tasking tasking) {
//        QueryWrapper<Tasking> queryWrapper = new QueryWrapper<>();
//        queryWrapper.eq("line_configuration_id",tasking.getLineConfigurationId())
//                .eq("state",tasking.getState())
//                .eq("work_state",tasking.getWorkState())
//                .orderByAsc("glass_id");
//        return getOne(queryWrapper);
//    }
    /**
     * @param machine
     * æ‰«ç è®¾å¤‡ æ·»åŠ ä»»åŠ¡
     * æŸ¥çœ‹PrimitiveTask表是否存在此扫码数据
     * å­˜åœ¨åˆ™æ ¹æ® å†…容 åˆ›å»º tasking任务 å¹¶æŽ’序
     * ä¸å­˜åœ¨åˆ™ æŸ¥è¯¢ä¹ç‰§æ•°æ®åº“添加 PrimitiveTask表
     *
     * @return
     */
    @Override
    public int scanMachineAdd(Machine machine, String scanId){
        String errorStr="";
        if(!Objects.isNull(scanId)){
            List<PrimitiveTask> primitiveTaskList=primitiveTaskMapper.selectList(new QueryWrapper<PrimitiveTask>().lambda()
                    .eq(PrimitiveTask::getScanId,scanId));
            if(!primitiveTaskList.isEmpty()){
                PrimitiveTask primitiveTask=primitiveTaskList.get(0);
                LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine);
                List<Tasking> listTasking=baseMapper.selectList(new QueryWrapper<Tasking>().lambda()
                        .eq(Tasking::getScanId,scanId)
                        .ne(Tasking::getState,"线下")
                        .ne(Tasking::getGlassState,"破损"));
                if(listTasking.size()<primitiveTaskList.get(0).getTaskQuantity()){
                    Tasking tasking=primitiveTaskService.convertListTasking(primitiveTask,lineConfiguration.getId());
                    Integer taskSequence=1;
                    if (machine.getTodayCount()>0&&machine.getTodayCount()<5000){
                        taskSequence=machine.getTodayCount()+1;
                    }else{
                        taskSequence=1;
                    }
                    machine.setTodayCount(taskSequence);
                    tasking.setTaskSequence(taskSequence);
                    machineMapper.updateById(machine);
                    return baseMapper.insert(tasking);
                }
                errorStr="扫码ID:"+scanId+" çº¿ä¸ŠçŽ»ç’ƒå·²è¾¾åˆ°ä¸‹å‘ä¸Šçº¿ ä¸‹å‘任务数:"+primitiveTaskList.get(0).getTaskQuantity()+" äº§çº¿ä»»åŠ¡æ•°:"+listTasking.size();
                if (!errorStr.equals(machine.getRemark())){
                    machine.setRemark(errorStr);
                    machineMapper.updateById(machine);
                }
            }else{
                int insertCount=projectService.insertProjectCustomization(scanId);
                errorStr="扫码ID:"+scanId+" ä¹ç‰§IT数据库未下发";
                if (insertCount<1&&!errorStr.equals(machine.getRemark())){
                    machine.setRemark(errorStr);
                    machineMapper.updateById(machine);
                }
            }
        }
        return 0;
    }
    @Override
    public Boolean insertTasking(String status) {
        Tasking tasking = new Tasking();
@@ -271,6 +523,7 @@
        return save(tasking);
    }
    @Override
    public boolean updateTasking(String scanId) {
        Tasking glass=new Tasking();
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineEdging.java
New file
@@ -0,0 +1,313 @@
package com.mes.plcTaskThread;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mes.md.entity.LineConfiguration;
import com.mes.md.entity.Machine;
import com.mes.md.entity.PrimitiveTask;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.mapper.TaskingMapper;
import com.mes.md.service.LineConfigurationService;
import com.mes.md.service.PrimitiveTaskService;
import com.mes.md.service.TaskingService;
import com.mes.service.ModbusTcp;
import com.mes.service.PlcAgreement;
import com.mes.service.PlcParameter;
import com.mes.utils.HexUtil;
import lombok.extern.slf4j.Slf4j;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
public class MachineEdging extends Thread{
    TaskingMapper taskingMapper;
    MachineMapper machineMapper;
    TaskingService taskingService;
    PrimitiveTaskService primitiveTaskService;
    LineConfigurationService lineConfigurationService;
    public static int thinness = 40;
    public static int edgSpeed = 40;
    public static Long machineId = 6L;
    public List<Map> sendRecords = new ArrayList<>();
    public MachineEdging(TaskingMapper taskingMapper, MachineMapper machineMapper, TaskingService taskingService, PrimitiveTaskService primitiveTaskService, LineConfigurationService lineConfigurationService){
        this.taskingMapper = taskingMapper;
        this.machineMapper = machineMapper;
        this.taskingService = taskingService;
        this.primitiveTaskService = primitiveTaskService;
        this.lineConfigurationService = lineConfigurationService;
    }
    public void plcStart() {
        Machine machine=machineMapper.selectById(machineId);
        ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),"PlcEdging");
        try {
            modbusTcp1.connect();
            PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement("PlcEdging");
            if(!modbusTcp1.read(plcAgreement)){
                log.info("通讯读取新数据失败");
                modbusTcp1.close();
                return;
            }
            PlcParameter inputOrOut2 =plcAgreement.getPlcParameter("inputOrOut2");
            edgSpeed=inputOrOut2.getValueInt();
            PlcParameter plcRequest =plcAgreement.getPlcParameter("plcRequest");//请求字
            PlcParameter mesSend =plcAgreement.getPlcParameter("mesSend");//发送字
            PlcParameter plcReport =plcAgreement.getPlcParameter("plcReport");//汇报字
            PlcParameter plcReportID =plcAgreement.getPlcParameter("plcReportID");//汇报ID
            PlcParameter plcReport2 =plcAgreement.getPlcParameter("plcReport2");//手动汇报字
            PlcParameter plcReportID2 =plcAgreement.getPlcParameter("plcReportID2");//手动汇报ID
            PlcParameter mesConfirm =plcAgreement.getPlcParameter("mesConfirm");//确认字
            PlcParameter mesConfirmID =plcAgreement.getPlcParameter("mesConfirmID");//确认ID
            PlcParameter mesConfirm2 =plcAgreement.getPlcParameter("mesConfirm2");//手动确认字
            PlcParameter mesConfirmID2 =plcAgreement.getPlcParameter("mesConfirmID2");//手动确认ID
            if (machine.getIsLog()>0){
                modbusTcp1.consoleLogInfo(plcAgreement);
            }
            if (0==plcRequest.getValueInt()&&1==mesSend.getValueInt()) {
                log.info("1.发送字置零");
                //发送字置0
                String send= HexUtil.intTo2ByteHex(0);
                modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                log.info("发送字 æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            if (0==plcReport.getValueInt()&&0!=mesConfirm.getValueInt()) {
                log.info("2.确认字置零");
                //发送字置0
                String send=HexUtil.intTo2ByteHex(0);
                modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                log.info("任务完成 æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            if (0==plcReport2.getValueInt()&&0!=mesConfirm2.getValueInt()) {
                log.info("2.确认字置零");
                //发送字置0
                String send=HexUtil.intTo2ByteHex(0);
                modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2));
                log.info("任务完成 æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            if(1==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){
                int finishCount=taskingService.finishMachineTask(machine);
                log.info("3、任务完成");
                if(finishCount>0) {//有任务
                    String send = HexUtil.intTo2ByteHex(1);
                    modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2));
                    log.info("任务完成 æˆåŠŸ å†…容:{},发送起始地址:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                String send = HexUtil.intTo2ByteHex(1);
                modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2));
                log.info("任务完成 å¼‚常成功 å†…容:{},发送起始地址:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            if(4==plcReport2.getValueInt()&&0==mesConfirm2.getValueInt()){
                int finishCount=taskingService.glassDownLineOne(machine);
                if(finishCount>0){//有任务
                    log.info("4、人工拿走");
                    String send=HexUtil.intTo2ByteHex(4);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2));
                    log.info("人工拿走发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                String send=HexUtil.intTo2ByteHex(4);
                modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2));
                log.info("人工拿走异常 å‘送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            if(2==plcReport2.getValueInt()&&0==mesConfirm2.getValueInt()){
                int finishCount=taskingService.loseMachineTask(machine);
                if(finishCount>0){//有任务
                    log.info("2、重发");
                    String send=HexUtil.intTo2ByteHex(2);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2));
                    log.info("重发发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }else{
                    log.info("2、异常重发");
                    String send=HexUtil.intTo2ByteHex(2);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2));
                    log.info("异常重发发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
            }
            if(3==plcReport2.getValueInt()&&0==mesConfirm2.getValueInt()){
                int finishCount=taskingService.finishMachineTask(machine);
                if(finishCount>0){//有任务
                    log.info("3、设备上人工点破损");
                    String send=HexUtil.intTo2ByteHex(3);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2));
                    log.info("人工点破损发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }else{
                    //是否自动清除破损
                    log.info("3、无效破损 ï¼ˆæ²¡æœ‰æ‰¾åˆ°æ­¤ID的玻璃)");
                    String send=HexUtil.intTo2ByteHex(3);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()/2));
                    log.info("发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm2.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
            }
            List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"正在工作");
            if((1==plcRequest.getValueInt()&&0==mesSend.getValueInt())
                    &&"开工".equals(machine.getState())
                    &&taskingCount.size()<machine.getMaxTaskCount()){
                Machine loadMachine=machineMapper.selectById(2L);
                Tasking tasking;
                String scan_id="";
                if(loadMachine.getMode()==1){
                    //标准模式  æ‰¾å·²é¢†å–未完成的第一条任务
                    LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine);
                    List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId());
                    //添加数据:
                    for(PrimitiveTask primitiveTask:findPrimitiveTasking){
                        List<Tasking> taskingTopList=taskingMapper.selectList(new QueryWrapper<Tasking>().lambda()
                                .eq(Tasking::getScanId,primitiveTask.getScanId())
                        );
                        //任务数>已上数量
                        if(taskingTopList.size()<primitiveTask.getTaskQuantity()){
                            Tasking taskingAdd=primitiveTaskService.convertListTasking(primitiveTask,lineConfiguration.getId());
                            Integer taskSequence=1;
                            if (machine.getTodayCount()>0&&machine.getTodayCount()<5000){
                                taskSequence=machine.getTodayCount()+1;
                            }else{
                                taskSequence=1;
                            }
                            machine.setTodayCount(taskSequence);
                            taskingAdd.setTaskSequence(taskSequence);
                            machineMapper.updateById(machine);
                            taskingMapper.insert(taskingAdd);
                        }
                        break;
                    }
                    tasking=taskingService.startMachineTask(machine);
                }else{
                    //定制模式
                    String PlcRequestID_=clientTCPSocket();
                    //String PlcRequestID_=",,46607221";
                    if (PlcRequestID_==null||PlcRequestID_.lastIndexOf(",")<0){
                        modbusTcp1.close();
                        errorMachine(machine,("扫不到码:"+PlcRequestID_));
                        return;
                    }
                    scan_id= PlcRequestID_.substring(PlcRequestID_.lastIndexOf(",")+1);
                    tasking=taskingService.startMachineTask(machine,scan_id);
                }
                if(tasking!=null){
                    log.info("4、发送任务  ä»»åŠ¡æ•°æ®ï¼š{}, è®¾å¤‡çŠ¶æ€:{}, ",machine,tasking);
                    String send=
                            HexUtil.intTo2ByteHex(1)+
                                    HexUtil.intTo2ByteHex(tasking.getGlassId().intValue())+
                                    HexUtil.intTo2ByteHex(((Double)(tasking.getLength()*10)).intValue())+
                                    HexUtil.intTo2ByteHex(((Double)(tasking.getWidth()*10)).intValue())+
                                    HexUtil.intTo2ByteHex(((Double)(tasking.getThickness()*10)).intValue());
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                    log.info("发送任务发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()));
                    modbusTcp1.close();
                    errorMachine(machine,"");
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    String sendRecord=df.format(new Date())+"  "+
                            tasking.getGlassId()+"-"+
                            tasking.getWidth()+"-"+
                            tasking.getLength()+"-"+
                            tasking.getThickness();
                    if (sendRecords.size()>7){
                        sendRecords.remove(0);
                    }
                    Map sendContentMap=new HashMap();
                    sendContentMap.put("sendContent",sendRecord);
                    sendRecords.add(sendContentMap);
                    return;
                }else if(!scan_id.isEmpty()){
                    taskingService.scanMachineAdd(machine,scan_id);
                    modbusTcp1.close();
                    return;
                }
            }
            //}
        } catch (Exception e) {
            log.info("交互逻辑错误");
        }
        modbusTcp1.close();
        //log.info("无可执行的条件");
    }
    public void errorMachine(Machine machine,String error) {
        if (!error.equals(machine.getRemark())){
            machine.setRemark(error);
            machineMapper.updateById(machine);
        }
    }
    public String clientTCPSocket() {
        try {
            Machine machine=machineMapper.selectById(4L);
            Socket clientSocket = new Socket(machine.getIp(), machine.getPort());
            try {
                clientSocket.setSoTimeout(1000);
                // åˆ›å»ºè¾“入流和输出流
                InputStream inputStream = clientSocket.getInputStream();
                OutputStream outputStream = clientSocket.getOutputStream();
                // å‘送启动命令
                String message = "start";
                outputStream.write(message.getBytes());
                // è¯»å–服务器响应的数据
                byte[] buffer = new byte[1024];
                int bytesRead = inputStream.read(buffer);
                String receivedMessage = new String(buffer, 0, bytesRead);
                System.out.println("收到扫码枪返回内容:" + receivedMessage);
                // å…³é—­è¿žæŽ¥
                String message2 = "stop";
                outputStream.write(message2.getBytes());
                clientSocket.close();
                return receivedMessage;
            } catch (Exception e) {
                e.printStackTrace();
            }
            clientSocket.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(1000);
                plcStart();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineFlipSlice.java
New file
@@ -0,0 +1,144 @@
package com.mes.plcTaskThread;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.mes.common.S7objectMachine;
import com.mes.device.PlcParameterInfo;
import com.mes.device.PlcParameterObject;
import com.mes.md.entity.Machine;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.service.TaskingService;
import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
public class MachineFlipSlice extends Thread{
    private MachineMapper machineMapper;
    private TaskingService taskingService;
    private S7objectMachine s7objectMachine;
    public static int thinness = 40;
    public static int edgSpeed = 40;
    public static Long machineId = 6L;
    public List<Map> sendRecords = new ArrayList<>();
    public MachineFlipSlice(MachineMapper machineMapper, TaskingService taskingService){
        this.machineMapper = machineMapper;
        this.taskingService = taskingService;
    }
    public void plcStart() {
        Long machineId=26L;
        Machine machine=machineMapper.selectById(machineId);
        if (s7objectMachine==null){
            s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcFlipSlice", EPlcType.S1200);
            s7objectMachine.start();
        }
        PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject;
        PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请求字
        PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请求ID
        PlcParameterInfo plcRequestType =plcParameterObject.getPlcParameter("plcRequestType");//PLC请求
        PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//发送字
        PlcParameterInfo mesSendId =plcParameterObject.getPlcParameter("mesSendID");//发送ID
        PlcParameterInfo length =plcParameterObject.getPlcParameter("length");//长
        PlcParameterInfo width =plcParameterObject.getPlcParameter("width");//宽
        PlcParameterInfo mesSendType =plcParameterObject.getPlcParameter("mesSendType");//  æ‰«ç 1   ä¸æ‰«ç 2
        String scan_id="";
        if (machine.getIsLog()>0){
            s7objectMachine.consoleLogInfo();
        }
        if ("0".equals(plcRequestType.getValue())&&!"0".equals(mesSendType.getValue())) {
            //发送字置0
            log.info("1.发送类型字置零,清除上次发送的类型数据{}->0",mesSendType.getValue());
            s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), 0);
            return;
        }
        if ("0".equals(plcRequest.getValue())&&!"0".equals(mesSend.getValue())) {
            //发送字置0
            int finishCount=taskingService.finishMachineTask(machine);
            log.info("2.发送字置零,清除上次发送的数据{},{},{},{},{}"
                    ,finishCount
                    ,length.getValue()
                    ,width.getValue()
                    ,mesSendId.getValue()
                    ,mesSend.getValue());
            s7objectMachine.plccontrol.writeWord(length.getAddress(), 0);
            s7objectMachine.plccontrol.writeWord(width.getAddress(), 0);
            s7objectMachine.plccontrol.writeWord(mesSendId.getAddress(), 0);
            s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0);
            return;
        }
        if ("1".equals(plcRequestType.getValue())&&"0".equals(mesSendType.getValue())) {
            //发送类型   1扫码  2不扫码
            int type=machine.getMode()==1?2:1;
            log.info("3.发送类型数据0->{}",mesSendType.getValue());
            s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), type);
            return;
        }
        List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"正在工作");
        if(("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue())
                &&"开工".equals(machine.getState())
                &&taskingCount.size()<machine.getMaxTaskCount())){
            Tasking tasking;
            if(machine.getMode()==1){
                //标准模式
                tasking=taskingService.startMachineTask(machine);
            }else{
                //定制模式
                String PlcRequestID_=plcRequestID.getValue();
                //String PlcRequestID_=",,46403118";
                scan_id= PlcRequestID_.substring(PlcRequestID_.lastIndexOf(",")+1);
                tasking=taskingService.startScanIdMachineTask(machine,scan_id);//不管顺序,直接找从磨边机扫码后到翻片台的数据
            }
            if(tasking!=null){
                log.info("4、发送数据:{},{},{},{},{}"
                        ,tasking.getGlassId(),tasking.getProgramId()
                        ,tasking.getLength().intValue(),tasking.getWidth().intValue(),1);
                s7objectMachine.plccontrol.writeWord(length.getAddress(), tasking.getLength().intValue());
                s7objectMachine.plccontrol.writeWord(width.getAddress(), tasking.getWidth().intValue());
                s7objectMachine.plccontrol.writeString(mesSendId.getAddress(), tasking.getGlassId().toString());
                s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1);
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                String sendRecord=df.format(new Date())+"  "+
                        tasking.getGlassId()+"-"+
                        tasking.getLength()+"-"+
                        tasking.getWidth();
                if (sendRecords.size()>7){
                    sendRecords.remove(0);
                }
                Map sendContentMap=new HashMap();
                sendContentMap.put("sendContent",sendRecord);
                sendRecords.add(sendContentMap);
                nullMachine(machine);
                return;
            }else if(!scan_id.isEmpty()){
                taskingService.scanMachineAdd(machine,scan_id);
            }
        }
    }
    public void nullMachine(Machine machine) {
        if (!"".equals(machine.getRemark())){
            machine.setRemark("");
            machineMapper.updateById(machine);
        }
    }
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(1000);
                plcStart();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineLoad.java
New file
@@ -0,0 +1,164 @@
package com.mes.plcTaskThread;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mes.md.entity.LineConfiguration;
import com.mes.md.entity.Machine;
import com.mes.md.entity.PrimitiveTask;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.mapper.PrimitiveTaskMapper;
import com.mes.md.mapper.TaskingMapper;
import com.mes.md.service.LineConfigurationService;
import com.mes.md.service.PrimitiveTaskService;
import com.mes.md.service.TaskingService;
import com.mes.service.ModbusTcp;
import com.mes.service.PlcAgreement;
import com.mes.service.PlcParameter;
import com.mes.utils.HexUtil;
import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
public class MachineLoad extends Thread{
    TaskingMapper taskingMapper;
    MachineMapper machineMapper;
    TaskingService taskingService;
    PrimitiveTaskService primitiveTaskService;
    PrimitiveTaskMapper primitiveTaskMapper;
    LineConfigurationService lineConfigurationService;
    public Long machineId = 2L;
    public List<Map> sendRecords = new ArrayList<>();
    public MachineLoad(TaskingMapper taskingMapper, MachineMapper machineMapper, TaskingService taskingService, PrimitiveTaskService primitiveTaskService, LineConfigurationService lineConfigurationService){
        this.taskingMapper = taskingMapper;
        this.machineMapper = machineMapper;
        this.taskingService = taskingService;
        this.primitiveTaskService = primitiveTaskService;
        this.lineConfigurationService = lineConfigurationService;
    }
    public void plcStart() {
        Machine machine=machineMapper.selectById(machineId);
        ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),"PlcLoad");
        modbusTcp1.connect();
        PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement("PlcLoad");
        try {
            if(!modbusTcp1.read(plcAgreement)){
                log.info("通讯读取新数据失败");
                modbusTcp1.close();
                return;
            }
            PlcParameter plcRequest =plcAgreement.getPlcParameter("plcRequest");//请求字
            PlcParameter mesSend =plcAgreement.getPlcParameter("mesSend");//发送字
            PlcParameter mesSendCount =plcAgreement.getPlcParameter("mesSendCount");//发送数量
            PlcParameter plcReport =plcAgreement.getPlcParameter("plcReport");//汇报字
            PlcParameter plcReportID =plcAgreement.getPlcParameter("plcReportID");//汇报ID
            PlcParameter mesConfirm =plcAgreement.getPlcParameter("mesConfirm");//确认字
            PlcParameter mesConfirmID =plcAgreement.getPlcParameter("mesConfirmID");//确认ID
            if (machine.getIsLog()>0){
                modbusTcp1.consoleLogInfo(plcAgreement);
            }
            if (0==plcRequest.getValueInt()&&1==mesSend.getValueInt()) {
                //发送字置0
                String send= HexUtil.intTo2ByteHex(0);
                modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                log.info("1.发送字置零 å‘送字 æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            if (0==plcReport.getValueInt()&&0!=mesConfirm.getValueInt()) {
                //确认字置零
                String send=HexUtil.intTo2ByteHex(0);
                modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                log.info("2.确认字置零 ä»»åŠ¡å®Œæˆ æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            if(1==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){
                int finishCount=plcReportID.getValueInt();
                if(finishCount>0) {//有任务
                    if(machine.getMode()==1){
                        //标准模式  æ‰¾å·²é¢†å–未完成的第一条任务
                        LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine);
                        List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId());
                        for(PrimitiveTask primitiveTask:findPrimitiveTasking){
                            primitiveTask.setReportCount(primitiveTask.getReportCount()+plcReportID.getValueInt());
                            primitiveTaskMapper.updateById(primitiveTask);
                            break;
                        }
                    }
                    String send = HexUtil.intTo2ByteHex(1);
                    modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/ 2));
                    log.info("任务完成 æˆåŠŸ å†…容:{},发送起始地址:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                String send = HexUtil.intTo2ByteHex(1);
                modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2));
                log.info("任务完成 å¼‚常成功 å†…容:{},发送起始地址:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            if((1==plcRequest.getValueInt()&&0==mesSend.getValueInt())
                    &&"开工".equals(machine.getState())){
                int loadCount=0;
                if(machine.getMode()==1){
                    //标准模式  æ‰¾å·²é¢†å–未完成的第一条任务
                    LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine);
                    List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId());
                    for(PrimitiveTask primitiveTask:findPrimitiveTasking){
                        //任务数>已上数量
                        List<Tasking> taskingTopList=taskingMapper.selectList(new QueryWrapper<Tasking>().lambda()
                                .eq(Tasking::getScanId,primitiveTask.getScanId())
                        );
                        loadCount=primitiveTask.getTaskQuantity()-taskingTopList.size();
                        loadCount=(loadCount>0?loadCount:0);
                        break;
                    }
                }else{
                    //定制模式
                    loadCount=1;
                }
                if(loadCount>0){
                    log.info("4、发送任务  ä»»åŠ¡æ•°æ®ï¼š{}, è®¾å¤‡çŠ¶æ€:{}, ",loadCount,machine);
                    String send=HexUtil.intTo2ByteHex(1)+ HexUtil.intTo2ByteHex(loadCount);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                    log.info("发送任务发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                    modbusTcp1.close();
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    String sendRecord=df.format(new Date())+"  "+"1  "+ loadCount;
                    if (sendRecords.size()>7){
                        sendRecords.remove(0);
                    }
                    Map sendContentMap=new HashMap();
                    sendContentMap.put("sendContent",sendRecord);
                    sendRecords.add(sendContentMap);
                    return;
                }
            }
        } catch (Exception e) {
            log.info("交互逻辑错误");
        }
        modbusTcp1.close();
    }
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(1000);
                plcStart();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineMarking.java
New file
@@ -0,0 +1,139 @@
package com.mes.plcTaskThread;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.mes.common.S7objectMachine;
import com.mes.device.PlcParameterInfo;
import com.mes.device.PlcParameterObject;
import com.mes.md.entity.Machine;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.service.TaskingService;
import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
public class MachineMarking extends Thread{
    private MachineMapper machineMapper;
    private TaskingService taskingService;
    private S7objectMachine s7objectMachine;
    public static int thinness = 40;
    public static int edgSpeed = 40;
    public static Long machineId = 6L;
    public List<Map> sendRecords = new ArrayList<>();
    public MachineMarking(MachineMapper machineMapper, TaskingService taskingService){
        this.machineMapper = machineMapper;
        this.taskingService = taskingService;
    }
    public void plcStart() {
            Long machineId=12L;
            Machine machine=machineMapper.selectById(machineId);
            if (s7objectMachine==null){
                s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcMarking", EPlcType.S1500);
                s7objectMachine.start();
            }
            PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject;
            PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请求字
            PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请求ID
            PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//发送字
            PlcParameterInfo isMark =plcParameterObject.getPlcParameter("isMark");//发送ID【0 ä¸æ‰“标,1标准模式,2定制模式】
            PlcParameterInfo drawingMark =plcParameterObject.getPlcParameter("drawingMark");//打标图纸地址
            PlcParameterInfo lengthOutOfService =plcParameterObject.getPlcParameter("length(OutOfService)");//长
            PlcParameterInfo widthOutOfService =plcParameterObject.getPlcParameter("width(OutOfService)");//宽
            PlcParameterInfo markingMode =plcParameterObject.getPlcParameter("markingMode");//
            PlcParameterInfo plcReport =plcParameterObject.getPlcParameter("plcReport");//汇报字
            PlcParameterInfo plcReportID =plcParameterObject.getPlcParameter("plcReportID");//汇报ID
            PlcParameterInfo mesConfirm =plcParameterObject.getPlcParameter("mesConfirm");//确认字
            PlcParameterInfo mesConfirmID =plcParameterObject.getPlcParameter("mesConfirmID");//确认ID
            if (machine.getIsLog()>0){
                s7objectMachine.consoleLogInfo();
            }
            if ("0".equals(plcRequest.getValue())&&"1".equals(mesSend.getValue())) {
                //发送字置0
                log.info("1.发送字置零,清除上次发送的数据{},{},{},{},{}"
                        ,markingMode.getValue()
                        ,isMark.getValue()
                        ,lengthOutOfService.getValue()
                        ,widthOutOfService.getValue()
                        ,mesSend.getValue());
                //S7objectMarking.getinstance().plccontrol.writeString(drawingMark.getAddress(),"");
                s7objectMachine.plccontrol.writeWord(markingMode.getAddress(), 0);
                s7objectMachine.plccontrol.writeWord(lengthOutOfService.getAddress(), 0);
                s7objectMachine.plccontrol.writeWord(widthOutOfService.getAddress(), 0);
                s7objectMachine.plccontrol.writeWord(isMark.getAddress(), 0);
                s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0);
                return;
            }
            if ("0".equals(plcReport.getValue())&&"1".equals(mesConfirm.getValue())) {
                log.info("2.确认字置零");
                //发送字置0
                s7objectMachine.plccontrol.writeWord(mesConfirm.getAddress(), 0);
                return;
            }
            if("1".equals(plcReport.getValue())&&"0".equals(mesConfirm.getValue())){
                int finishCount=taskingService.finishMachineTask(machine);
                log.info("3、任务完成");
                if(finishCount>0){//有任务
                    s7objectMachine.plccontrol.writeWord(mesConfirm.getAddress(), 1);
                    return;
                }
                return;
            }
            List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"正在工作");
            if("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue())&& !plcRequestID.getValue().isEmpty()
                    &&"开工".equals(machine.getState())
                    &&taskingCount.size()<machine.getMaxTaskCount()){
                Tasking tasking=taskingService.startMachineTask(machine);
                if(tasking!=null){
                    //模式:1定制  0 æ‰¹é‡      æ˜¯å¦æ‰“标:0不打标   1打标
                    int isMark_=(tasking.getDrawingMarking()==null||tasking.getDrawingMarking().isEmpty())?0:1;
                    int isMarkingMode_="定制".equals(tasking.getTaskType()) ?1:0;
                    log.info("4、发送数据:{},{},{},{},{},{}"
                            ,tasking.getProgramId()
                            ,tasking.getLength().intValue(),tasking.getWidth().intValue(),isMark_,isMarkingMode_,1);
                    if(isMark_==1){
                        s7objectMachine.plccontrol.writeString(drawingMark.getAddress(), tasking.getProgramId());
                    }
                    s7objectMachine.plccontrol.writeWord(lengthOutOfService.getAddress(), tasking.getLength().intValue());
                    s7objectMachine.plccontrol.writeWord(widthOutOfService.getAddress(), tasking.getWidth().intValue());
                    s7objectMachine.plccontrol.writeWord(isMark.getAddress(), isMark_);
                    s7objectMachine.plccontrol.writeWord(markingMode.getAddress(), isMarkingMode_);
                    s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1);
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    String sendRecord=df.format(new Date())+"  "+
                            tasking.getScanId()+"-"+
                            tasking.getProgramId()+"-"+
                            tasking.getLength()+"-"+
                            tasking.getWidth()+"-"+
                            isMark_+"-"+
                            isMarkingMode_;
                    if (sendRecords.size()>7){
                        sendRecords.remove(0);
                    }
                    Map sendContentMap=new HashMap();
                    sendContentMap.put("sendContent",sendRecord);
                    sendRecords.add(sendContentMap);
                    return;
                }
            }
        }
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(1000);
                plcStart();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineRotate.java
New file
@@ -0,0 +1,143 @@
package com.mes.plcTaskThread;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.mes.common.S7objectMachine;
import com.mes.device.PlcParameterInfo;
import com.mes.device.PlcParameterObject;
import com.mes.md.entity.Machine;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.service.TaskingService;
import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
public class MachineRotate extends Thread{
    private MachineMapper machineMapper;
    private TaskingService taskingService;
    private S7objectMachine s7objectMachine;
    public static Long machineId = 6L;
    public List<Map> sendRecords = new ArrayList<>();
    public MachineRotate(MachineMapper machineMapper, TaskingService taskingService){
        this.machineMapper = machineMapper;
        this.taskingService = taskingService;
    }
    public void plcStart() {
        //旋转台
        Long machineId=20L;
        Machine machine=machineMapper.selectById(machineId);
        if (s7objectMachine==null){
            s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcRotate", EPlcType.S1200);
            s7objectMachine.start();
        }
        PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject;
        PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请求字
        PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请求ID
        PlcParameterInfo plcRequestType =plcParameterObject.getPlcParameter("plcRequestType");//PLC请求
        PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//发送字
        PlcParameterInfo mesSendId =plcParameterObject.getPlcParameter("mesSendID");//发送ID
        PlcParameterInfo length =plcParameterObject.getPlcParameter("length");//长
        PlcParameterInfo width =plcParameterObject.getPlcParameter("width");//宽
        PlcParameterInfo rotateType =plcParameterObject.getPlcParameter("rotateType");//旋转类型
        PlcParameterInfo mesSendType =plcParameterObject.getPlcParameter("mesSendType");//  æ‰«ç 1   ä¸æ‰«ç 2
        String scan_id="";
        if (machine.getIsLog()>0){
            s7objectMachine.consoleLogInfo();
        }
        if ("0".equals(plcRequestType.getValue())&&!"0".equals(mesSendType.getValue())) {
            //发送字置0
            log.info("1.发送类型字置零,清除上次发送的类型数据{}->0",mesSendType.getValue());
            s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), 0);
            return;
        }
        if ("0".equals(plcRequest.getValue())&&!"0".equals(mesSend.getValue())) {
            //发送字置0
            int finishCount=taskingService.finishMachineTask(machine);
            log.info("1.发送字置零,清除上次发送的数据{},{},{},{},{}"
                    ,finishCount
                    ,length.getValue()
                    ,width.getValue()
                    ,mesSendId.getValue()
                    ,mesSend.getValue());
            s7objectMachine.plccontrol.writeWord(length.getAddress(), 0);
            s7objectMachine.plccontrol.writeWord(width.getAddress(), 0);
            s7objectMachine.plccontrol.writeWord(mesSendId.getAddress(), 0);
            s7objectMachine.plccontrol.writeWord(rotateType.getAddress(), 0);
            s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0);
            return;
        }
        if ("1".equals(plcRequestType.getValue())&&"0".equals(mesSendType.getValue())) {
            //发送类型   1扫码  2不扫码
            int type=machine.getMode()==1?2:1;
            log.info("3.发送类型数据0->{}",mesSendType.getValue());
            s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), type);
            return;
        }
        List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"正在工作");
        if("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue())
                &&"开工".equals(machine.getState())
                &&taskingCount.size()<machine.getMaxTaskCount()){
            Tasking tasking;
            if(machine.getMode()==1){
                //标准模式
                tasking=taskingService.startMachineTask(machine);
            }else{
                //定制模式
                String PlcRequestID_=plcRequestID.getValue();
                scan_id= PlcRequestID_.substring(PlcRequestID_.lastIndexOf(",")+1);
                //标记当前工序 ä»¥å‰çš„玻璃 ç›´æŽ¥åˆ°å½“前工序
                tasking=taskingService.startScanIdMachineTask(machine,scan_id);//不管顺序,直接找从翻片台扫码后到旋转台的数据
            }
            if(tasking!=null){
                log.info("4、发送数据:{},{},{},{},{}"
                        ,tasking.getGlassId(),tasking.getProgramId()
                        ,tasking.getLength().intValue(),tasking.getWidth().intValue(),1);
                s7objectMachine.plccontrol.writeWord(length.getAddress(), tasking.getLength().intValue());
                s7objectMachine.plccontrol.writeWord(width.getAddress(), tasking.getWidth().intValue());
                s7objectMachine.plccontrol.writeString(mesSendId.getAddress(), tasking.getGlassId().toString());
                s7objectMachine.plccontrol.writeWord(rotateType.getAddress(), 1);
                s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1);
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                String sendRecord=df.format(new Date())+"  "+
                        tasking.getGlassId()+"-"+
                        tasking.getLength()+"-"+
                        tasking.getWidth();
                if (sendRecords.size()>7){
                    sendRecords.remove(0);
                }
                nullMachine(machine);
                Map sendContentMap=new HashMap();
                sendContentMap.put("sendContent",sendRecord);
                sendRecords.add(sendContentMap);
            }else if(!scan_id.isEmpty()){
                taskingService.scanMachineAdd(machine,scan_id);
            }
        }
    }
    public void nullMachine(Machine machine) {
        if (!"".equals(machine.getRemark())){
            machine.setRemark("");
            machineMapper.updateById(machine);
        }
    }
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(1000);
                plcStart();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineSilkScreen.java
New file
@@ -0,0 +1,211 @@
package com.mes.plcTaskThread;
import com.mes.md.entity.Machine;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.service.TaskingService;
import com.mes.service.ModbusTcp;
import com.mes.service.PlcAgreement;
import com.mes.service.PlcParameter;
import com.mes.utils.HexUtil;
import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
public class MachineSilkScreen extends Thread{
    private MachineMapper machineMapper;
    private TaskingService taskingService;
    public static Long machineId = 14L;
    public List<Map> sendRecords = new ArrayList<>();
    public MachineSilkScreen(MachineMapper machineMapper, TaskingService taskingService){
        this.machineMapper = machineMapper;
        this.taskingService = taskingService;
    }
    public void plcStart() {
            Machine machine=machineMapper.selectById(machineId);
            String fileName="PlcSilkScreen";
            ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),fileName);
            modbusTcp1.connect();
            PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement(fileName);
            try {
                if(!modbusTcp1.read(plcAgreement)){
                    log.info("通讯读取新数据失败");
                    modbusTcp1.close();
                    return;
                }
                PlcParameter plcRequest =plcAgreement.getPlcParameter("plcRequest");//请求字
                PlcParameter plcRequestID =plcAgreement.getPlcParameter("plcRequestID");//请求ID
                PlcParameter mesSend =plcAgreement.getPlcParameter("mesSend");//发送字
                PlcParameter mesSendID =plcAgreement.getPlcParameter("mesSendID");//发送ID
                PlcParameter length =plcAgreement.getPlcParameter("length");//长
                PlcParameter width =plcAgreement.getPlcParameter("width");//宽
                PlcParameter thickness =plcAgreement.getPlcParameter("thickness");//厚
                PlcParameter X =plcAgreement.getPlcParameter("X");//X
                PlcParameter Y =plcAgreement.getPlcParameter("Y");//Y
                //PlcParameter isSilkScreen =plcAgreement.getPlcParameter("isSilkScreen");//是否丝印
                PlcParameter plcReport =plcAgreement.getPlcParameter("plcReport");//汇报字
                PlcParameter plcReportID =plcAgreement.getPlcParameter("plcReportID");//汇报ID
                PlcParameter mesConfirm =plcAgreement.getPlcParameter("mesConfirm");//确认字
                PlcParameter mesConfirmID =plcAgreement.getPlcParameter("mesConfirmID");//确认ID
                PlcParameter machineStatusWord =plcAgreement.getPlcParameter("machineStatusWord");
                if (machine.getIsLog()>0){
                    modbusTcp1.consoleLogInfo(plcAgreement);
                }
                if (0==plcRequest.getValueInt()&&1==mesSend.getValueInt()) {
                    log.info("1.发送字置零");
                    //发送字置0
                    String send= HexUtil.intTo2ByteHex(0);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                    log.info("发送字 æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                if (0==plcReport.getValueInt()&&0!=mesConfirm.getValueInt()) {
                    log.info("2.确认字置零");
                    //发送字置0
                    String send=HexUtil.intTo2ByteHex(0);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                    log.info("任务完成 æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                if(1==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){
                    int finishCount=taskingService.finishMachineTask(machine);
                    log.info("3、任务完成");
                    if(finishCount>0) {//有任务
                        String send = HexUtil.intTo2ByteHex(1);
                        modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2));
                        log.info("任务完成 æˆåŠŸ å†…容:{},发送起始地址:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                        modbusTcp1.close();
                        return;
                    }
                    String send = HexUtil.intTo2ByteHex(1);
                    modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2));
                    log.info("任务完成 å¼‚常成功 å†…容:{},发送起始地址:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                if(4==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){
                    int finishCount=taskingService.glassDownLineOne(machine);
                    if(finishCount>0){//有任务
                        log.info("4、人工拿走");
                        String send=HexUtil.intTo2ByteHex(4);
                        modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                        log.info("人工拿走发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                        modbusTcp1.close();
                        return;
                    }
                    String send=HexUtil.intTo2ByteHex(4);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                    log.info("人工拿走异常 å‘送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                if(2==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){
                    int finishCount=taskingService.loseMachineTask(machine);
                    if(finishCount>0){//有任务
                        log.info("2、重发");
                        String send=HexUtil.intTo2ByteHex(2);
                        modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                        log.info("重发发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                        modbusTcp1.close();
                        return;
                    }else{
                        log.info("2、异常重发");
                        String send=HexUtil.intTo2ByteHex(2);
                        modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                        log.info("异常重发发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                        modbusTcp1.close();
                        return;
                    }
                }
                if(3==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){
                    int finishCount=taskingService.finishMachineTask(machine);
                    if(finishCount>0){//有任务
                        log.info("3、设备上人工点破损");
                        String send=HexUtil.intTo2ByteHex(3);
                        modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                        log.info("人工点破损发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                        modbusTcp1.close();
                        return;
                    }else{
                        //是否自动清除破损
                        log.info("3、无效破损 ï¼ˆæ²¡æœ‰æ‰¾åˆ°æ­¤ID的玻璃)");
                        String send=HexUtil.intTo2ByteHex(3);
                        modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                        log.info("发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                        modbusTcp1.close();
                        //modbusTcp1.close();
                        return;
                    }
                }
                List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"正在工作");
                if((1==plcRequest.getValueInt()&&0==mesSend.getValueInt())
                        &&"开工".equals(machine.getState())
                        &&taskingCount.size()<machine.getMaxTaskCount()){
                    Tasking tasking=taskingService.startMachineTask(machine);
                    if(tasking!=null){
                        log.info("4、发送任务  ä»»åŠ¡æ•°æ®ï¼š{}, è®¾å¤‡çŠ¶æ€:{}, ",machine,tasking);
                        String send=
                                HexUtil.intTo2ByteHex(1)+
                                        HexUtil.intTo2ByteHex(tasking.getTaskSequence().intValue())+
                                        HexUtil.intTo2ByteHex(((Double)(tasking.getWidth()*10)).intValue())+
                                        HexUtil.intTo2ByteHex(((Double)(tasking.getLength()*10)).intValue())+
                                        HexUtil.intTo2ByteHex(tasking.getThickness().intValue())+
                                        HexUtil.intTo2ByteHex(((Double)(tasking.getSilkScreenX()*10)).intValue())+
                                        HexUtil.intTo2ByteHex(((Double)(tasking.getSilkScreenY()*10)).intValue())+
                                        HexUtil.intTo2ByteHex(tasking.getIsSilkScreen());//是否丝印: 0丝印 1不丝印
                        modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                        log.info("发送任务发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()));
                        modbusTcp1.close();
                        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        String sendRecord=df.format(new Date())+"  "+
                                tasking.getGlassId()+"-"+
                                tasking.getWidth()+"-"+
                                tasking.getLength()+"-"+
                                tasking.getThickness()+"-"+
                                tasking.getSilkScreenX()+"-"+
                                tasking.getSilkScreenX()+"-"+
                                tasking.getSilkScreenY()+"-"+
                                tasking.getIsSilkScreen();
                        if (sendRecords.size()>7){
                            sendRecords.remove(0);
                        }
                        Map sendContentMap=new HashMap();
                        sendContentMap.put("sendContent",sendRecord);
                        sendRecords.add(sendContentMap);
                        return;
                    }
                }
                //}
            } catch (Exception e) {
                log.info("交互逻辑错误");
            }
            modbusTcp1.close();
            //log.info("无可执行的条件");
        }
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(1000);
                plcStart();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineThread.java
New file
@@ -0,0 +1,159 @@
package com.mes.plcTaskThread;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mes.md.entity.LineConfiguration;
import com.mes.md.entity.Machine;
import com.mes.md.entity.PrimitiveTask;
import com.mes.md.entity.Tasking;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.mapper.TaskingMapper;
import com.mes.md.service.*;
import com.mes.service.ModbusTcp;
import com.mes.service.PlcAgreement;
import com.mes.service.PlcParameter;
import com.mes.utils.HexUtil;
import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
public class MachineThread extends Thread{
    TaskingMapper taskingMapper;
    MachineMapper machineMapper;
    TaskingService taskingService;
    PrimitiveTaskService primitiveTaskService;
    LineConfigurationService lineConfigurationService;
    public MachineThread(TaskingMapper taskingMapper, MachineMapper machineMapper, TaskingService taskingService, PrimitiveTaskService primitiveTaskService, LineConfigurationService lineConfigurationService){
        this.taskingMapper = taskingMapper;
        this.machineMapper = machineMapper;
        this.taskingService = taskingService;
        this.primitiveTaskService = primitiveTaskService;
        this.lineConfigurationService = lineConfigurationService;
    }
    public Long machineId = 2L;
    public List<Map> sendRecords = new ArrayList<>();
    public void plcStart() {
        Machine machine=machineMapper.selectById(machineId);
        ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),"PlcLoad");
        modbusTcp1.connect();
        PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement("PlcLoad");
        try {
            if(!modbusTcp1.read(plcAgreement)){
                log.info("通讯读取新数据失败");
                modbusTcp1.close();
                return;
            }
            PlcParameter plcRequest =plcAgreement.getPlcParameter("plcRequest");//请求字
            PlcParameter mesSend =plcAgreement.getPlcParameter("mesSend");//发送字
            PlcParameter mesSendCount =plcAgreement.getPlcParameter("mesSendCount");//发送数量
            PlcParameter plcReport =plcAgreement.getPlcParameter("plcReport");//汇报字
            PlcParameter plcReportID =plcAgreement.getPlcParameter("plcReportID");//汇报ID
            PlcParameter mesConfirm =plcAgreement.getPlcParameter("mesConfirm");//确认字
            PlcParameter mesConfirmID =plcAgreement.getPlcParameter("mesConfirmID");//确认ID
            if (machine.getIsLog()>0){
                modbusTcp1.consoleLogInfo(plcAgreement);
            }
            if (0==plcRequest.getValueInt()&&1==mesSend.getValueInt()) {
                //发送字置0
                String send= HexUtil.intTo2ByteHex(0);
                modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                log.info("1.发送字置零 å‘送字 æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            if (0==plcReport.getValueInt()&&0!=mesConfirm.getValueInt()) {
                //确认字置零
                String send=HexUtil.intTo2ByteHex(0);
                modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/2));
                log.info("2.确认字置零 ä»»åŠ¡å®Œæˆ æ¸…空成功;内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            if(1==plcReport.getValueInt()&&0==mesConfirm.getValueInt()){
                int finishCount=taskingService.finishMachineTask(machine);
                log.info("3、任务完成:"+plcReportID.getValueString());
                if(finishCount>0) {//有任务
                    String send = HexUtil.intTo2ByteHex(1);
                    modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()/ 2));
                    log.info("任务完成 æˆåŠŸ å†…容:{},发送起始地址:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                    modbusTcp1.close();
                    return;
                }
                String send = HexUtil.intTo2ByteHex(1);
                modbusTcp1.writeString(send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart() / 2));
                log.info("任务完成 å¼‚常成功 å†…容:{},发送起始地址:{}", send, HexUtil.intTo2ByteHex(mesConfirm.getAddressStart()));
                modbusTcp1.close();
                return;
            }
            List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"正在工作");
            if((1==plcRequest.getValueInt()&&0==mesSend.getValueInt())
                    &&"开工".equals(machine.getState())){
                int loadCount=0;
                if(machine.getMode()==1){
                    //标准模式  æ‰¾å·²é¢†å–未完成的第一条任务
                    LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine);
                    List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId());
                    for(PrimitiveTask primitiveTask:findPrimitiveTasking){
                        //任务数>已上数量
                        List<Tasking> taskingTopList=taskingMapper.selectList(new QueryWrapper<Tasking>().lambda()
                                .eq(Tasking::getScanId,primitiveTask.getScanId())
                        );
                        loadCount=primitiveTask.getTaskQuantity()-taskingTopList.size();
                        loadCount=(loadCount>0?loadCount:0);
                        break;
                    }
                    //loadCount=taskingCount.size();
                }else{
                    //定制模式
                    loadCount=1;
                }
                if(loadCount>0){
                    log.info("4、发送任务  ä»»åŠ¡æ•°æ®ï¼š{}, è®¾å¤‡çŠ¶æ€:{}, ",loadCount,machine);
                    String send=HexUtil.intTo2ByteHex(1)+ HexUtil.intTo2ByteHex(loadCount);
                    modbusTcp1.writeString(send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                    log.info("发送任务发送报文内容:{},发送起始地址:{}",send,HexUtil.intTo2ByteHex(mesSend.getAddressStart()/2));
                    modbusTcp1.close();
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    String sendRecord=df.format(new Date())+"  "+"1  "+ loadCount;
                    if (sendRecords.size()>7){
                        sendRecords.remove(0);
                    }
                    Map sendContentMap=new HashMap();
                    sendContentMap.put("sendContent",sendRecord);
                    sendRecords.add(sendContentMap);
                    return;
                }
            }
        } catch (Exception e) {
            log.info("交互逻辑错误");
        }
        modbusTcp1.close();
    }
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(1000);
                log.info("111");
                plcStart();
                //plcStart();
//                if ("开工".equals(machine.getState()) ){
//
//                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/resources/application-prod.yml
@@ -5,18 +5,28 @@
      strict: false #设置严格模式,默认false不启动. å¯åŠ¨åŽåœ¨æœªåŒ¹é…åˆ°æŒ‡å®šæ•°æ®æºæ—¶å€™å›žæŠ›å‡ºå¼‚å¸¸,不启动会使用默认数据源.
      datasource:
        jiumumes:
          url: jdbc:mysql://10.153.19.150:3306/jiumumes?serverTimezone=GMT%2b8
          url: jdbc:mysql://localhost:3306/jiumumes?serverTimezone=GMT%2b8&rewriteBatchedStatements=true
          username: root
          password: beibo.123/
          driver-class-name: com.mysql.cj.jdbc.Driver
        salve_JomooKBB:
          url: jdbc:sqlserver://localhost:1433;databasename=JomooKBB
          username: sa
          password: beibo.123/
          driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
#        salve_JomooKBB:
#          url: jdbc:sqlserver://172.18.19.85:1433;databasename=JomooKBB
#          username: thok
#          password: jomoo@123
#          driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
  cloud:
    nacos:
      discovery:
        server-addr: 10.153.19.44:8848
        server-addr: localhost:8848
  application:
    name: deviceInteraction
  redis:
    database: 0
    host: 10.153.19.44
    host: localhost
    port: 6379
    password: 123456
JiuMuMesParent/moduleService/DeviceInteractionModule/src/test/java/com/mes/DeviceInteractionModuleApplicationTest.java
@@ -1,15 +1,34 @@
package com.mes;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.md.entity.*;
import com.mes.md.mapper.AccountMapper;
import com.mes.md.mapper.KBBTJPDrawingBPMapper;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.mapper.PrimitiveTaskMapper;
import com.mes.md.service.AccountService;
import com.mes.md.service.PrimitiveTaskService;
import com.mes.md.service.ProjectService;
import com.mes.md.service.TaskingService;
import com.mes.tools.HexConversion;
import com.mes.utils.HexUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -31,6 +50,117 @@
    @Autowired
    AccountService accountService;
    @Autowired
    KBBTJPDrawingBPMapper kBBTJPDrawingBPMapper;
    @Autowired
    PrimitiveTaskMapper primitiveTaskMapper;
    @Autowired
    PrimitiveTaskService primitiveTaskService;
    @Autowired
    TaskingService taskingService;
    @Autowired
    ProjectService projectService;
    @Autowired
    MachineMapper machineMapper;
    @Test
    public void testStr() {
        String str=new String("4、发送任务  ä»»åŠ¡æ•°æ®ï¼š{}, ".getBytes(),StandardCharsets.UTF_8);
        int a=1;
        log.info(str,1);
    }
    @Test
    public void testSaoMa3() {
        try {
// åˆ›å»ºTCP客户端并连接到服务器
            String serverAddress = "192.168.1.8";
            int serverPort = 2001;
            Socket clientSocket = new Socket(serverAddress, serverPort);
            // åˆ›å»ºè¾“入流和输出流
            InputStream inputStream = clientSocket.getInputStream();
            OutputStream outputStream = clientSocket.getOutputStream();
            // å‘送数据给服务器
            String message = "start";
            outputStream.write(message.getBytes());
            // è¯»å–服务器响应的数据
            byte[] buffer = new byte[1024];
            int bytesRead = inputStream.read(buffer);
            String receivedMessage = new String(buffer, 0, bytesRead);
            System.out.println("收到服务器响应:" + receivedMessage);
            // å…³é—­è¿žæŽ¥
            clientSocket.close();
        }catch (Exception e){
            log.info("扫码异常");
        }
    }
    @Test
    public void testSaoMa() {
        try {
// åˆ›å»ºTCP客户端并连接到服务器
            String serverAddress = "192.168.1.8";
            int serverPort = 2001;
            Socket clientSocket = new Socket(serverAddress, serverPort);
            // åˆ›å»ºè¾“入流和输出流
            InputStream inputStream = clientSocket.getInputStream();
            OutputStream outputStream = clientSocket.getOutputStream();
            // å‘送数据给服务器
            String message = "start";
            outputStream.write(message.getBytes());
            // è¯»å–服务器响应的数据
            byte[] buffer = new byte[1024];
            int bytesRead = inputStream.read(buffer);
            String receivedMessage = new String(buffer, 0, bytesRead);
            System.out.println("收到服务器响应:" + receivedMessage);
            // å‘送数据给服务器
            String message2 = "stop";
            outputStream.write(message2.getBytes());
            // å…³é—­è¿žæŽ¥
            clientSocket.close();
        }catch (Exception e){
            log.info("扫码异常");
        }
    }
    @Test
    public void conncet(){
        try {
            int bufSizes = 0;
            byte[] msgs = new byte[2048];
            //创建连接  172.17.125.200  192.168.10.101
            Socket socket = new Socket("10.36.164.100", 1099);
            try {
                socket.setSoTimeout(3000);
                //写入需要数据
                DataOutputStream outToServer = new DataOutputStream(socket.getOutputStream());
                outToServer.write(HexUtil.stringToInt("000100000006010300000028"));
                outToServer.flush();
                //读取数据
                DataInputStream in = new DataInputStream(socket.getInputStream());
                bufSizes = in.read(msgs);
                String message = HexUtil.byteToHexString(bufSizes, msgs);
                System.out.println(message);
            } catch (Exception e) {
                System.out.println("读取失败");
                try {
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
                } catch (Exception e2) {
                    // TODO: handle exception
                }
            }
            socket.close();
        } catch (Exception e) {
            System.out.println("异常");
        }
    }
    @Test
    public void testFindPath() {
        //String url = getClass().getResource("").getPath();
@@ -64,6 +194,90 @@
        log.info("{}",Account);
    }
    //连接客户表
    @Test
    public void testInput() {
        Machine machine=machineMapper.selectById(14);
        taskingService.scanMachineAdd(machine, "46594135");
        log.info("内容{}",2);
    }
    //连接客户表
    @Test
    public void testSqlServerInput() {
        boolean is=projectService.insertProjectStandard();
        log.info("内容{}",is);
    }
    //连接客户表
    @Test
    public void testMachineFinsh() {
        Machine machine=machineMapper.selectById(14);
        int a=taskingService.finishMachineTask(machine);
        log.info("内容{}",a);
    }
    //定制查找任务
    @Test
    public void testSqlServer() {
        Machine machine=machineMapper.selectById(26);
        String scan_id="";
        List<Tasking> taskingList=taskingService.findMachineTask(machine);
        if(!taskingList.isEmpty()){
            Tasking tasking=taskingList.get(0);
            if (scan_id.equals(tasking.getScanId())){
            }else{
                List<Tasking> isExist=taskingService.findMachineTaskID(machine,scan_id);
                if(isExist.isEmpty()){
                    //读取客户数据库
                    projectService.insertProjectCustomization(scan_id);
                }
            }
        }
//        insertProjectCustomization();
        log.info("内容{}",taskingList);
    }
    //定制查找任务
    @Test
    public void testSqlServeraa() {
        Machine machine=machineMapper.selectById(12);
        String scan_id="46399819";
        projectService.insertProjectCustomization(scan_id);
        log.info("内容{}",machine);
    }
    //修改客户表
    @Test
    public void testSqlServerUpdate() {
        UpdateWrapper updateWrapper=new UpdateWrapper();
        KBBTJPDrawingBP kBBTJPDrawingBPs=new KBBTJPDrawingBP();
        kBBTJPDrawingBPMapper.update(kBBTJPDrawingBPs,updateWrapper);
        List<KBBTJPDrawingBP> kBBTJPDrawingBP=kBBTJPDrawingBPMapper.selectJoinList(KBBTJPDrawingBP.class,new MPJLambdaWrapper<KBBTJPDrawingBP>()
                .selectAll(KBBTJPDrawingBP.class)
                .eq(KBBTJPDrawingBP::getScanId,"011045108661010000")
                .orderByAsc(KBBTJPDrawingBP::getCreateDate)
                .orderByAsc(KBBTJPDrawingBP::getTaskSequence));
        kBBTJPDrawingBP.get(0).setIsWorking(1);
        kBBTJPDrawingBPMapper.updateById(kBBTJPDrawingBP.get(0));
        //kBBTJPDrawingBPMapper.update(kBBTJPDrawingBP,new QueryWrapper<>());
//        log.info("内容{}",KBBTJPDrawingBP);
    }
    //修改客户表
    @Test
    public void testSqlServerUpdate2() {
        UpdateWrapper<KBBTJPDrawingBP> updateWrapper=new UpdateWrapper<KBBTJPDrawingBP>();
        updateWrapper.lambda().eq(KBBTJPDrawingBP::getScanId,"011045108661010000");
        KBBTJPDrawingBP kBBTJPDrawingBPs=new KBBTJPDrawingBP();
        kBBTJPDrawingBPs.setIsWorking(2);
        kBBTJPDrawingBPMapper.update(kBBTJPDrawingBPs,updateWrapper);
//        log.info("内容{}",KBBTJPDrawingBP);
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/target/classes/application-prod.yml
@@ -5,18 +5,28 @@
      strict: false #设置严格模式,默认false不启动. å¯åŠ¨åŽåœ¨æœªåŒ¹é…åˆ°æŒ‡å®šæ•°æ®æºæ—¶å€™å›žæŠ›å‡ºå¼‚å¸¸,不启动会使用默认数据源.
      datasource:
        jiumumes:
          url: jdbc:mysql://10.153.19.150:3306/jiumumes?serverTimezone=GMT%2b8
          url: jdbc:mysql://localhost:3306/jiumumes?serverTimezone=GMT%2b8&rewriteBatchedStatements=true
          username: root
          password: beibo.123/
          driver-class-name: com.mysql.cj.jdbc.Driver
        salve_JomooKBB:
          url: jdbc:sqlserver://localhost:1433;databasename=JomooKBB
          username: sa
          password: beibo.123/
          driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
#        salve_JomooKBB:
#          url: jdbc:sqlserver://172.18.19.85:1433;databasename=JomooKBB
#          username: thok
#          password: jomoo@123
#          driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
  cloud:
    nacos:
      discovery:
        server-addr: 10.153.19.44:8848
        server-addr: localhost:8848
  application:
    name: deviceInteraction
  redis:
    database: 0
    host: 10.153.19.44
    host: localhost
    port: 6379
    password: 123456
JiuMuMesParent/moduleService/DeviceInteractionModule/target/deviceInteraction-1.0-SNAPSHOT.jar.original
Binary files differ
JiuMuMesParent/moduleService/DeviceInteractionModule/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -1,36 +1,45 @@
com\mes\md\mapper\TaskingMapper.class
com\mes\md\entity\Machine.class
com\mes\md\mapper\RoleMapper.class
com\mes\md\service\impl\ProjectServiceImpl.class
com\mes\job\PLCRinse.class
com\mes\md\service\impl\OrderOriginalPieceServiceImpl.class
com\mes\md\service\AccountService.class
com\mes\DeviceInteractionModuleApplication.class
com\mes\job\PLCScanQRVerify.class
com\mes\md\service\ProjectService.class
com\mes\md\service\WorkTaskDetailService.class
com\mes\common\S7objectMachine.class
com\mes\md\service\impl\EquipmentLogServiceImpl.class
com\mes\job\PLCRotate.class
com\mes\md\controller\WorkTaskDetailController.class
com\mes\md\controller\MenuController.class
com\mes\md\entity\OrderOriginalPiece.class
com\mes\md\service\MenuService.class
com\mes\md\mapper\KBBTJPDrawingBPMapper.class
com\mes\md\controller\GlassInfoController.class
com\mes\job\PLCTurn.class
com\mes\md\mapper\PageMapper.class
com\mes\md\service\ProjectLogService.class
com\mes\md\entity\Project.class
com\mes\md\mapper\PrimitiveTaskMapper.class
com\mes\md\service\impl\EdgeGrindingLogServiceImpl.class
com\mes\job\AddTask.class
com\mes\md\entity\LineConfiguration.class
com\mes\edgstoragecage\controller\EdgStorageCageController.class
com\mes\edgstoragecage\entity\EdgStorageCage.class
com\mes\md\mapper\RoleMenuMapper.class
com\mes\md\mapper\TaskLogMapper.class
com\mes\md\service\impl\AccountServiceImpl.class
com\mes\edgstoragecage\service\EdgStorageCageService.class
com\mes\common\CommunicationProtocol.class
com\mes\md\entity\Line.class
com\mes\plcTaskThread\MachineEdging.class
com\mes\md\entity\EdgeGrindingLog.class
com\mes\md\service\OrderOriginalPieceService.class
com\mes\md\service\impl\GlassInfoServiceImpl.class
com\mes\plcTaskThread\MachineSilkScreen.class
com\mes\md\entity\EquipmentLog.class
com\mes\md\service\KBBTJPDrawingBPService.class
com\mes\plcTaskThread\MachineRotate.class
com\mes\md\controller\PrimitiveTaskController.class
com\mes\md\controller\RoleMenuController.class
com\mes\md\entity\WorkTaskDetail.class
@@ -40,12 +49,17 @@
com\mes\md\service\impl\WorkTaskDetailServiceImpl.class
com\mes\md\service\impl\TaskLogServiceImpl.class
com\mes\md\controller\EdgeGrindingLogController.class
com\mes\md\service\LineConfigurationService.class
com\mes\md\entity\GlassInfo.class
com\mes\md\service\GlassInfoService.class
com\mes\md\entity\Page.class
com\mes\job\PLCCleaning.class
com\mes\md\controller\RoleController.class
com\mes\job\MarkingTask.class
com\mes\md\mapper\MachineMapper.class
com\mes\md\mapper\AccountMapper.class
com\mes\common\S7objectCleaning.class
com\mes\common\tcpIp.class
com\mes\md\service\EquipmentLogService.class
com\mes\md\service\impl\PrimitiveTaskServiceImpl.class
com\mes\md\controller\OrderOriginalPieceController.class
@@ -53,44 +67,63 @@
com\mes\md\entity\ProjectLog.class
com\mes\md\service\EdgeGrindingLogService.class
com\mes\AppRunnerConfig.class
com\mes\job\PLCFlipSlice.class
com\mes\plcTaskThread\MachineFlipSlice.class
com\mes\md\controller\TaskingController.class
com\mes\md\controller\AccountController.class
com\mes\md\service\TaskLogService.class
com\mes\job\PLCScanQR.class
com\mes\job\SilkScreenTask.class
com\mes\md\service\PrimitiveTaskService.class
com\mes\plcTaskThread\MachineLoad.class
com\mes\md\entity\Account.class
com\mes\job\PLCScanQRWorks.class
com\mes\md\service\impl\MenuServiceImpl.class
com\mes\md\controller\PageController.class
com\mes\md\entity\TaskLog.class
com\mes\md\mapper\LineConfigurationMapper.class
com\mes\md\mapper\EquipmentLogMapper.class
com\mes\job\PLCMechanicalArm.class
com\mes\md\entity\RoleMenu.class
com\mes\md\controller\TaskLogController.class
com\mes\md\service\impl\TaskingServiceImpl.class
com\mes\md\service\impl\KBBTJPDrawingBPServiceImpl.class
com\mes\md\mapper\ProjectMapper.class
com\mes\job\PLCScanQrCodesReport.class
com\mes\md\controller\EquipmentLogController.class
com\mes\common\SmbTool.class
com\mes\md\mapper\ProjectLogMapper.class
com\mes\job\PLCManualReporting.class
com\mes\plcTaskThread\MachineMarking.class
com\mes\md\mapper\OrderOriginalPieceMapper.class
com\mes\edgstoragecage\entity\EdgStorageCageDetails.class
com\mes\md\service\impl\RoleServiceImpl.class
com\mes\md\controller\MachineController.class
com\mes\md\entity\Role.class
com\mes\md\entity\KBBTJPDrawingBP.class
com\mes\md\service\impl\LineServiceImpl.class
com\mes\md\mapper\LineMapper.class
com\mes\md\mapper\EdgeGrindingLogMapper.class
com\mes\common\S7objectMarking.class
com\mes\md\entity\PrimitiveTask.class
com\mes\job\MachineTask.class
com\mes\md\entity\Menu.class
com\mes\md\service\impl\LineConfigurationServiceImpl.class
com\mes\common\S7object.class
com\mes\md\mapper\MenuMapper.class
com\mes\md\service\RoleMenuService.class
com\mes\edgstoragecage\service\impl\EdgStorageCageServiceImpl.class
com\mes\common\S7objectFlipSlice.class
com\mes\edgstoragecage\mapper\EdgStorageCageMapper.class
com\mes\md\service\impl\ProjectLogServiceImpl.class
com\mes\md\service\impl\RoleMenuServiceImpl.class
com\mes\md\service\TaskingService.class
com\mes\plcTaskThread\MachineThread.class
com\mes\md\service\RoleService.class
com\mes\md\service\MachineService.class
com\mes\md\service\PageService.class
com\mes\md\controller\ProjectLogController.class
com\mes\job\PLCEdging.class
com\mes\job\PLCLoad.class
com\mes\md\mapper\GlassInfoMapper.class
com\mes\md\entity\Tasking.class
com\mes\md\service\impl\MachineServiceImpl.class
JiuMuMesParent/moduleService/DeviceInteractionModule/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -1,9 +1,8 @@
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCMechanicalArm.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\LineConfiguration.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\mapper\EdgStorageCageMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\LineMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\CommunicationProtocol.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\DeviceInteractionModuleApplication.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCEdging.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\ProjectLog.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\MarkingTask.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Role.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Tasking.java
@@ -11,86 +10,120 @@
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\PageMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\MenuController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\ProjectLogMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\PageService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\GlassInfoServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\WorkTaskDetailController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\MachineTask.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineThread.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\WorkTaskDetailServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\TaskLog.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\GlassInfo.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\OrderOriginalPieceMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\AccountService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\RoleController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\WorkTaskDetailService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCScanQRWorks.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\KBBTJPDrawingBPMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\AccountServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\RoleService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\MenuServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\RoleMenuServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\entity\EdgStorageCage.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCTurn.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\LineConfigurationServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Project.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\PrimitiveTaskMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\PrimitiveTaskServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\service\EdgStorageCageService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCScanQR.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\EdgeGrindingLogController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\EdgeGrindingLog.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Account.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\TaskingController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\EdgeGrindingLogService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\TaskLogServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\PrimitiveTaskService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\TaskingServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCLoad.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\LineConfigurationService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\AppRunnerConfig.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7object.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\AccountMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\EdgeGrindingLogServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\SilkScreenTask.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\ProjectMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\ProjectServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\TaskingService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\PageController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\ProjectController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\GlassInfoMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\WorkTaskDetailMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\OrderOriginalPieceService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\RoleMenuMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Line.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\EquipmentLogMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\EquipmentLog.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\MachineMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\EdgeGrindingLogMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\LineServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\PrimitiveTaskController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\PageServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\controller\EdgStorageCageController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\MenuMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\KBBTJPDrawingBPService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\SmbTool.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\AccountController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\MenuService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Menu.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCRotate.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Page.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\LineService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\RoleMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\EquipmentLogService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7objectFlipSlice.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineLoad.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCCleaning.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\ProjectLogService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\RoleMenuController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineSilkScreen.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCScanQRVerify.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\GlassInfoController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\OrderOriginalPieceServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\MachineController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\entity\EdgStorageCageDetails.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\ProjectService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\ProjectLogServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\TaskingMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineFlipSlice.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\ProjectLogController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\OrderOriginalPieceController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7objectMarking.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\WorkTaskDetail.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCRinse.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\TaskLogController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\TaskLogService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\PrimitiveTask.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\EquipmentLogController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\RoleServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\RoleMenu.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\GlassInfoService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\OrderOriginalPiece.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\TaskLogMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\EquipmentLogServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\RoleMenuService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\AddTask.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCMechanicalArm.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\LineMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\ProjectLog.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\KBBTJPDrawingBP.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\PageService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineMarking.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\TaskLog.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\GlassInfo.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\OrderOriginalPieceMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\RoleController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\tcpIp.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\WorkTaskDetailService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\RoleService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\MachineServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\entity\EdgStorageCage.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\PrimitiveTaskMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\MachineService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\EdgeGrindingLogController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Account.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineRotate.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\EdgeGrindingLogService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\PrimitiveTaskService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7object.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\EdgeGrindingLogServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\ProjectServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\KBBTJPDrawingBPServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\PageController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\ProjectController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\OrderOriginalPieceService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\RoleMenuMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\EquipmentLogMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCFlipSlice.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\EquipmentLog.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\LineConfigurationMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\LineServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCScanQrCodesReport.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\AccountController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\MenuService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Menu.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\LineService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\RoleMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\EquipmentLogService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\RoleMenuController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7objectMachine.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Machine.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\GlassInfoController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\OrderOriginalPieceServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\ProjectService.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\ProjectLogServiceImpl.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\TaskingMapper.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\OrderOriginalPieceController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7objectCleaning.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCManualReporting.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineEdging.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\PrimitiveTask.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\EquipmentLogController.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\RoleServiceImpl.java
JiuMuMesParent/moduleService/DeviceInteractionModule/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
@@ -1,2 +1 @@
com\mes\DeviceInteractionModuleApplicationTest.class
com\mes\TaskingModuleApplicationTest.class
JiuMuMesParent/moduleService/DeviceInteractionModule/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
@@ -1,2 +1 @@
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\test\java\com\mes\TaskingModuleApplicationTest.java
D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\test\java\com\mes\DeviceInteractionModuleApplicationTest.java
UI-Project/config.js
@@ -1,11 +1,11 @@
export default {
//  serverUrl: "10.153.19.29:88/api",
 serverUrl: "10.153.19.44:88/api",
//  serverUrl: "192.168.1.199:88/api",
 //serverUrl: "10.36.164.201:88/api",
  serverUrl: "localhost:88/api",
//  serverUrl: "127.0.0.1:88/api",
  // serverUrl2: "10.153.19.29:88"
  serverUrl2: "10.153.19.44:88"
  // serverUrl2: "192.168.1.199:88"
  //serverUrl2: "10.36.164.201:88"
   serverUrl2: "localhost:88"
    // serverUrl2: "127.0.0.1:88"
  //serverUrl:"res.abeim.cn"
UI-Project/package.json
@@ -3,9 +3,9 @@
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  "dev": "vite --host 0.0.0.0",
  "build": "vite build",
  "serve": "vite preview --host 0.0.0.0"
  },
  "dependencies": {
    "@element-plus/icons-vue": "^2.3.1",
UI-Project/src/assets/Ä¥±ß»ú.png
UI-Project/src/assets/·­Æ¬Ì¨.png

UI-Project/src/assets/×Ô¶¯Ë¿Ó¡»ú.png
UI-Project/src/lang/zh.js
@@ -139,14 +139,17 @@
        silkScreenY: '丝印Y',
        isMarking: '是否打标',
        isSilkScreen: '是否丝印',
        isWorking: '领取状态',
        workState: '任务状态',
        lineConfigurationId: '所在位置',
        state: '生产状态',
        glassState: '玻璃状态',
        reportCount: '报工数量',
        sendTime: '发送时间',
        sendContent: '发送内容',
    },
    machine: {
        upperSlice:'自动上片机',
        mechanicalArm:'自动上片机',
        scanQrCodesIdentify:'扫码识别',
        scanQredging:'扫码磨边',
        edging:'磨边机',
@@ -168,15 +171,20 @@
        tips:'是否确认?',
        yes:'是',
        sure :'确认',
        sureStart :'确认补单',
        cancel :'取消',
        canceled :'失败',
        anew :'重发',
        finish :'完工',
        stopTask :'结束任务',
        lose :'破损',
        downLine :'下线',
        topLine :'上线',
        getTask :'领取',
        start :'开工',
        stop :'暂停',
        modeD :'定制',
        modeB :'标准',
        bound:'绑定',
        reporting:'报工',
        reportingcount:'报工数量',
UI-Project/src/router/index.js
@@ -114,32 +114,32 @@
        //     }
        //   ]
        // },
        // {
        //   /*----------- è‡ªåŠ¨æ‰“æ ‡æœº ----------------*/
        //   path: 'Marking',
        //   name: 'marking',
        //   component: () => import('../views/Marking/marking.vue'),
        //   children: [
        //     {
        //       path: '/Marking/marking',
        //       name: 'marking',
        //       component: () => import('../views/Marking/marking.vue'),
        //     }
        //   ]
        // },
        // {
        //   /*----------- è‡ªåŠ¨ä¸å°æœº ----------------*/
        //   path: 'SilkScreen',
        //   name: 'silkScreen',
        //   component: () => import('../views/SilkScreen/silkScreen.vue'),
        //   children: [
        //     {
        //       path: '/SilkScreen/silkScreen',
        //       name: 'silkScreen',
        //       component: () => import('../views/SilkScreen/silkScreen.vue'),
        //     }
        //   ]
        // },
        {
          /*----------- è‡ªåŠ¨æ‰“æ ‡æœº ----------------*/
          path: 'Marking',
          name: 'marking',
          component: () => import('../views/Marking/marking.vue'),
          children: [
            {
              path: '/Marking/marking',
              name: 'marking',
              component: () => import('../views/Marking/marking.vue'),
            }
          ]
        },
        {
          /*----------- è‡ªåŠ¨ä¸å°æœº ----------------*/
          path: 'SilkScreen',
          name: 'silkScreen',
          component: () => import('../views/SilkScreen/silkScreen.vue'),
          children: [
            {
              path: '/SilkScreen/silkScreen',
              name: 'silkScree',
              component: () => import('../views/SilkScreen/silkScreen.vue'),
            }
          ]
        },
        // {
        //   /*----------- è‡ªåŠ¨ç‚¹èƒ¶æœº ----------------*/
        //   path: 'GlueDispenser',
@@ -166,19 +166,19 @@
        //     }
        //   ]
        // },
        // {
        //   /*----------- æ—‹è½¬å° ----------------*/
        //   path: 'Rotate',
        //   name: 'rotate',
        //   component: () => import('../views/Rotate/rotate.vue'),
        //   children: [
        //     {
        //       path: '/Rotate/rotate',
        //       name: 'rotate',
        //       component: () => import('../views/Rotate/rotate.vue'),
        //     }
        //   ]
        // },
        {
          /*----------- æ—‹è½¬å° ----------------*/
          path: 'Rotate',
          name: 'rotate',
          component: () => import('../views/Rotate/rotate.vue'),
          children: [
            {
              path: '/Rotate/rotate',
              name: 'rotate',
              component: () => import('../views/Rotate/rotate.vue'),
            }
          ]
        },
        // {
        //   /*----------- è‡ªåŠ¨è´´è†œæœº ----------------*/
        //   path: 'Lamination',
@@ -251,11 +251,14 @@
            }
          ]
        },
        {
          path: '',
          redirect: '/User/userlist'
        }
          redirect: '/MechanicalArm/mechanicalArm'//登陆成功后默认进入界面
        },
        // {
        //   path: '',
        //   redirect: '/User/userlist'//登陆成功后默认进入界面
        // }
      ]
    },
    {
UI-Project/src/utils/constants.js
@@ -1,5 +1,5 @@
//  export const WebSocketHost = "192.168.1.199";
export const WebSocketHost = "10.153.19.44";
  export const WebSocketHost = "localhost";
//export const WebSocketHost = "10.36.164.201";
// export const WebSocketHost = "10.153.19.29";
// export const WebSocketHost = "127.0.0.1";
export const host = "88";
UI-Project/src/utils/headerTB.vue
New file
@@ -0,0 +1,7 @@
<template>
    <FancyButton>
        Click me!
    </FancyButton>
</template>
UI-Project/src/views/Edging/edging.vue
@@ -1,10 +1,10 @@
<!--  æ‰“标机  -->
<!--  ç£¨è¾¹æœº  -->
<script setup>
import request from "@/utils/request";
import { ElMessage, ElMessageBox } from "element-plus";
import { reactive, ref, onMounted, onBeforeUnmount,onUnmounted } from 'vue'
import { reactive, ref, onMounted, onBeforeUnmount, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { WebSocketHost ,host} from '@/utils/constants'
import { WebSocketHost, host } from '@/utils/constants'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
let language = ref(localStorage.getItem('lang') || 'zh')
const { t } = useI18n()
@@ -12,21 +12,54 @@
  account: '',
  password: '',
});
const blind = ref(false)
const errorInfo = ref(true)
const loadData = ref([]);
const findMachine = ref([]);
const machineId=5;//当前页面的设备ID
const sendRecords = ref([]);
const downLineTask = ref([]);
const machineId = 6;//当前页面的设备ID
var errorScanId;
var errorOpen=false;
//使用WebSocket方式展示数据
let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/edging`;
let socketDownLineTask = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/edgingTask`;
const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`;
// å®šä¹‰æ¶ˆæ¯å¤„理函数,更新 receivedData å˜é‡
const handleMessage = (data) => {
  // æ›´æ–° tableData çš„æ•°æ®
  loadData.value = data.taskingList[0];
  findMachine.value = data.machine[0];
  sendRecords.value = data.sendRecords[0].reverse();
  if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){
    //有数据就弹窗
    if(errorOpen){
      ElMessageBox.close();
    }
    errorScanId=findMachine.value.remark.toString();
    errorInfoFuntion(findMachine.value.remark.toString());
    errorOpen=true;
  }else if(findMachine.value.remark.toString()==""&&errorOpen){
    ElMessageBox.close();
    errorOpen=false;
  }
};
// å®šä¹‰æ¶ˆæ¯å¤„理函数,更新 receivedData å˜é‡
const handleMessage2 = (data) => {
  downLineTask.value = data.downLineTask[0];
  // console.log(data);
};
onUnmounted(() => {
  if (socket) {
    closeWebSocket(socket);
  }
  if (socketDownLineTask) {
    closeWebSocket(socketDownLineTask);
  }
});
onBeforeUnmount(() => {
@@ -37,230 +70,291 @@
onMounted(async () => {
  //使用WebSocket方式展示数据
  socket = initializeWebSocket(socketUrl, handleMessage);// åˆå§‹åŒ– WebSocket,并传递消息处理函数
  //使用接口方式展示数据
  //load();
  //使用WebSocket方式展示数据
  socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// åˆå§‹åŒ– WebSocket,并传递消息处理函数
});
// //获取数据
// const load = async() => {
//   //获取设备任务数据
//   try {
//     const response = await request.post('/deviceInteraction/tasking/findMachineTask',
//     {
//       "id": 11
//     }); // æ›¿æ¢ä¸ºä½ çš„API端点
//     if (response.code === 200) {
//       loadData.value.findTaskingData= response.data;
//     } else {
//       ElMessage.warning(res.msg)
//     }
//   } catch (error) {
//     // console.error('Error fetching rects :', error);
//   }
//   //获取设备状态
//   try {
//     const response = await request.post('/deviceInteraction/machine/findMachine',
//     {
//       "id": 11
//     }); // æ›¿æ¢ä¸ºä½ çš„API端点
//     if (response.code === 200) {
//       findMachine.value= response.data;
//     } else {
//       ElMessage.warning(res.msg)
//     }
//   } catch (error) {
//     // console.error('Error fetching rects :', error);
//   }
// }
//报警提示
const errorInfoFuntion = async (info) => {
  let infoScancode=info;
  ElMessageBox.confirm(
    infoScancode,
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//修改工作状态 ã€å¤±è´¥/正在工作/完工】
const workStatus = async(row,state) => {
const workStatus = async (row, state) => {
  let url;
  if(state=="重发"){
    url="/deviceInteraction/tasking/loseMachineTask";
  }else if(state=="正在工作"){
    url="/deviceInteraction/tasking/startMachineTask";
  }else if(state=="完工"){
    url="/deviceInteraction/tasking/finishMachineTask";
  }else{
  if (state == "重发") {
    url = "/deviceInteraction/tasking/loseMachineTask";
  } else if (state == "正在工作") {
    url = "/deviceInteraction/tasking/startMachineTask";
  } else if (state == "完工") {
    url = "/deviceInteraction/tasking/finishMachineTask";
  } else {
    return;
  }
  ElMessageBox.confirm(
        t('marking.tips'),
        t('delivery.prompt'),
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //开始修改
      request.post(url,
        {
          confirmButtonText: t('marking.sure'),
          cancelButtonText: t('marking.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //开始修改
          request.post(url,
            {
              "id": machineId
            }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
              } else {
                ElMessage.warning(res.message)
              }
            })
          "id": machineId
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('marking.cancel'),
          })
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//开工/暂停
const machineStatus = async(state) => {
const machineStatus = async (state) => {
  ElMessageBox.confirm(
        t('marking.tips'),
        t('delivery.prompt'),
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/machine/updateMachineState",
        {
          confirmButtonText: t('marking.sure'),
          cancelButtonText: t('marking.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/machine/updateMachineState",
            {
              "id": machineId,
              "state": state
            }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
              } else {
                ElMessage.warning(res.message)
              }
            })
          "id": machineId,
          "state": state
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('marking.cancel'),
          })
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//破损
const damagedTask = async(row) => {
const damagedTask = async (row) => {
  ElMessageBox.confirm(
        t('marking.tips'),
        t('delivery.prompt'),
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/tasking/damagedTask",
        {
          confirmButtonText: t('marking.sure'),
          cancelButtonText: t('marking.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/tasking/damagedTask",
            {
              "glassId": row.glassId
            }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
              } else {
                ElMessage.warning(res.message)
              }
            })
          "glassId": row.glassId
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('marking.cancel'),
          })
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//下线(拿走)
const glassDownLine = async(row) => {
const glassDownLine = async (row) => {
  ElMessageBox.confirm(
        t('marking.tips'),
        t('delivery.prompt'),
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/tasking/glassDownLine",
        {
          confirmButtonText: t('marking.sure'),
          cancelButtonText: t('marking.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/tasking/glassDownLine",
            {
              "glassId": row.glassId,
            }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
              } else {
                ElMessage.warning(res.message)
              }
            })
          "glassId": row.glassId,
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('marking.cancel'),
          })
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
const topLineShow = async () => {
  blind.value = true;
}
//上线
const topLine = async() => {
const topLine = async (row) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //上线接口
      request.post("/deviceInteraction/tasking/glassTopLine",
        {
          "glassId": row.glassId,
          "lineConfigurationId": machineId
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {n
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
const handleDialogClose = () => {
}
</script>
<template>
  <div ref="content" style="padding:0 20px;">
    <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;">
      {{$t('machine.edging')}}
      {{ $t('machine.edging') }}
    </div>
    <el-dialog v-model="blind" top="30vh" style="text-align: center;" @close="handleDialogClose">
        <!-- çº¿ä¸‹çŽ»ç’ƒ -->
      <el-table :data="downLineTask" stripe style="height:260px" :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" />
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" />
        <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" />
        <el-table-column prop="length" :label="$t('glassInfo.length')" />
        <el-table-column prop="width" :label="$t('glassInfo.width')" />
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" />
        <el-table-column prop="workState" :label="$t('glassInfo.workState')" />
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="70">
          <template #default="scope">
            <el-button size="mini" link type="primary" plain @click="topLine(scope.row)">{{
              $t('functionState.topLine') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <hr />
    <br>
    <div id="search" >
    <div id="search">
      <!-- åŠŸèƒ½ -->
      <el-button type="primary" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='暂停'?'开工':'暂停'))">{{findMachine['state']=='开工'?$t('functionState.start'):$t('functionState.stop')}}</el-button>
      <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button>
      <el-button :type="(findMachine['state'] == '暂停' ? 'danger' : 'success')" id="ButtonMachineStatus"
        @click="machineStatus((findMachine['state'] == '暂停' ? '开工' : '暂停'))">{{ findMachine['state'] == '开工' ?
          $t('functionState.start') : $t('functionState.stop') }}</el-button>
      <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.topLine') }}</el-button>
      <!-- <el-button type="primary" id="searchButton" @click="downLine('下线')">下线</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('破损')">破损</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('完工')">完工</el-button> -->
    </div>
    <div id="main-body" style="min-height:240px;">
      <!-- è¡¨æ ¼å†…容 -->
      <el-table :data="loadData" stripe
      <el-table :data="loadData" stripe style="height:260px"
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/>
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/>
        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/>
        <el-table-column prop="length" :label="$t('glassInfo.length')"/>
        <el-table-column prop="width" :label="$t('glassInfo.width')"/>
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/>
        <el-table-column prop="workState" :label="$t('glassInfo.workState')"/>
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" />
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" />
        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')" />
        <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" />
        <el-table-column prop="length" :label="$t('glassInfo.length')" />
        <el-table-column prop="width" :label="$t('glassInfo.width')" />
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" />
        <el-table-column prop="workState" :label="$t('glassInfo.workState')" />
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270">
          <template #default="scope">
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '重发')" >{{$t('functionState.anew')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">{{$t('functionState.finish')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{$t('functionState.lose')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{$t('functionState.downLine')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '重发')">{{
              $t('functionState.anew') }}</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">{{
              $t('functionState.finish') }}</el-button>
            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{ $t('functionState.lose')
              }}</el-button>
            <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{
              $t('functionState.downLine') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div id="main-body"
      style="width: 50%; height: 460px; margin: auto;background-image: url(../../src/assets/扫码识别.png) ;background-size: 100% 100%;">
      <!-- ç”»å›¾å†…容 -->
      <div style="width: 150px; height: 100px; background-color: red; position: relative; top: 171px; left: 328px">
    <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;">
      <!-- <div style="width: 70%;min-width: 900px; height: 460px;float: left;">
        <img src="../../assets/磨边机.png">
      </div>  -->
      <img style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../assets/磨边机.png">
      <!-- <img style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../src/assets/磨边机.png" /> -->
      <!-- <el-image style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../src/assets/磨边机.png"></el-image> -->
      <!-- <div style="width: 70%;min-width: 900px; height: 460px;background-image: url(../../src/assets/磨边机.png) ;background-size: 100% 100%;float: left;">
      </div> -->
      <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;">
        <el-table :data="sendRecords" stripe
          :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center', height: '30px' }"
          :cell-style="{ textAlign: 'center' }">
          <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')" />
        </el-table>
      </div>
      <div style="clear:both"></div>
    </div>
  </div>
</template>
@@ -295,4 +389,11 @@
  border: none;
  cursor: pointer;
}
.dotClass {
  width:10px;
  height:10px;
  border-radius: 50%;
  display: block;
  margin-left: 10px;
}
</style>
UI-Project/src/views/FlipSlice/flipSlice.vue
@@ -12,22 +12,52 @@
  account: '',
  password: '',
});
const blind = ref(false)
const errorInfo = ref(true)
const loadData = ref([]);
const findMachine = ref([]);
const machineId = 25;//当前页面的设备ID
const sendRecords = ref([]);
const downLineTask = ref([]);
const machineId = 26;//当前页面的设备ID
var errorScanId;
var errorOpen=false;
//使用WebSocket方式展示数据
let socket = null;
let socketDownLineTask = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/flipSlice`;
const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`;
// å®šä¹‰æ¶ˆæ¯å¤„理函数,更新 receivedData å˜é‡
const handleMessage = (data) => {
  // æ›´æ–° tableData çš„æ•°æ®
  loadData.value = data.taskingList[0];
  findMachine.value = data.machine[0];
  sendRecords.value = data.sendRecords[0].reverse();
  if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){
    //有数据就弹窗
    if(errorOpen){
      ElMessageBox.close();
    }
    errorScanId=findMachine.value.remark.toString();
    errorInfoFuntion(findMachine.value.remark.toString());
    errorOpen=true;
  }else if(findMachine.value.remark.toString()==""&&errorOpen){
    ElMessageBox.close();
    errorOpen=false;
  }
};
// å®šä¹‰æ¶ˆæ¯å¤„理函数,更新 receivedData å˜é‡
const handleMessage2 = (data) => {
  downLineTask.value = data.downLineTask[0];
  // console.log(data);
};
onUnmounted(() => {
  if (socket) {
    closeWebSocket(socket);
  }
  if (socketDownLineTask) {
    closeWebSocket(socketDownLineTask);
  }
});
onBeforeUnmount(() => {
@@ -38,43 +68,30 @@
onMounted(async () => {
  //使用WebSocket方式展示数据
  socket = initializeWebSocket(socketUrl, handleMessage);// åˆå§‹åŒ– WebSocket,并传递消息处理函数
  //使用接口方式展示数据
  //load();
  //使用WebSocket方式展示数据
  socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// åˆå§‹åŒ– WebSocket,并传递消息处理函数
});
// //获取数据
// const load = async() => {
//   //获取设备任务数据
//   try {
//     const response = await request.post('/deviceInteraction/tasking/findMachineTask',
//     {
//       "id": 11
//     }); // æ›¿æ¢ä¸ºä½ çš„API端点
//     if (response.code === 200) {
//       loadData.value.findTaskingData= response.data;
//     } else {
//       ElMessage.warning(res.msg)
//     }
//   } catch (error) {
//     // console.error('Error fetching rects :', error);
//   }
//   //获取设备状态
//   try {
//     const response = await request.post('/deviceInteraction/machine/findMachine',
//     {
//       "id": 11
//     }); // æ›¿æ¢ä¸ºä½ çš„API端点
//     if (response.code === 200) {
//       findMachine.value= response.data;
//     } else {
//       ElMessage.warning(res.msg)
//     }
//   } catch (error) {
//     // console.error('Error fetching rects :', error);
//   }
// }
//报警提示
const errorInfoFuntion = async (info) => {
  let infoScancode=info;
  ElMessageBox.confirm(
    infoScancode,
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sureStart'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//修改工作状态 ã€å¤±è´¥/正在工作/完工】
const workStatus = async (row, state) => {
  let url;
@@ -135,6 +152,38 @@
        {
          "id": machineId,
          "state": state
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//定制/标准
const machineMode = async (mode) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/machine/toggleModeMachine",
        {
          "id": machineId,
          "mode": mode
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点  
          if (res.code === 200) {
            ElMessage.success(res.message);
@@ -212,31 +261,90 @@
      })
    })
}
//上线
const topLine = async () => {
const topLineShow = async () => {
  blind.value = true;
}
//上线
const topLine = async (row) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //上线接口
      request.post("/deviceInteraction/tasking/glassTopLine",
        {
          "glassId": row.glassId,
          "lineConfigurationId": machineId
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {n
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
const handleDialogClose = () => {
}
</script>
<template>
  <div ref="content" style="padding:0 20px;">
    <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;">
      {{ $t('machine.flipSlice') }}
    </div>
    <el-dialog v-model="blind" top="30vh" style="text-align: center;" @close="handleDialogClose">
        <!-- çº¿ä¸‹çŽ»ç’ƒ -->
      <el-table :data="downLineTask" stripe :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" />
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" />
        <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" />
        <el-table-column prop="length" :label="$t('glassInfo.length')" />
        <el-table-column prop="width" :label="$t('glassInfo.width')" />
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" />
        <el-table-column prop="workState" :label="$t('glassInfo.workState')" />
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="70">
          <template #default="scope">
            <el-button size="mini" link type="primary" plain @click="topLine(scope.row)">{{
              $t('functionState.topLine') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <hr />
    <br>
    <div id="search">
      <!-- åŠŸèƒ½ -->
      <el-button :type="(findMachine['state'] == '暂停' ? 'danger' : 'success')" id="ButtonMachineStatus"
        @click="machineStatus((findMachine['state'] == '暂停' ? '开工' : '暂停'))">{{ findMachine['state'] == '开工' ? $t('functionState.start') : $t('functionState.stop') }}</el-button>
      <el-button type="primary" id="ButtonTopLine" @click="topLine">{{ $t('functionState.topLine') }}</el-button>
        @click="machineStatus((findMachine['state'] == '暂停' ? '开工' : '暂停'))">{{ findMachine['state'] == '开工' ?
          $t('functionState.start') : $t('functionState.stop') }}</el-button>
      <el-button :type="(findMachine['mode'] == '定制' ? 'danger' : 'success')" id="ButtonMachineMode"
        @click="machineMode((findMachine['mode'] == 0 ? 1 : 0))">{{ findMachine['mode'] == 0 ?
         $t('functionState.modeD') : $t('functionState.modeB') }}</el-button>
      <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.topLine') }}</el-button>
      <!-- <el-button type="primary" id="searchButton" @click="downLine('下线')">下线</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('破损')">破损</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('完工')">完工</el-button> -->
    </div>
    <div id="main-body" style="min-height:240px;">
    <div id="main-body">
      <!-- è¡¨æ ¼å†…容 -->
      <el-table :data="loadData" stripe
      <el-table :data="loadData" stripe style="height:260px"
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
@@ -244,29 +352,41 @@
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" />
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" />
        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')" />
        <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" />
        <el-table-column prop="length" :label="$t('glassInfo.length')" />
        <el-table-column prop="width" :label="$t('glassInfo.width')" />
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" />
        <el-table-column prop="workState" :label="$t('glassInfo.workState')" />
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270">
          <template #default="scope">
            <el-button size="mini" link type="primary" plain
              @click="workStatus(scope.row, '重发')">{{ $t('functionState.anew') }}</el-button>
            <el-button size="mini" link type="primary" plain
              @click="workStatus(scope.row, '完工')">{{ $t('functionState.finish') }}</el-button>
            <el-button size="mini" link type="primary" plain
              @click="damagedTask(scope.row)">{{ $t('functionState.lose') }}</el-button>
            <el-button size="mini" link type="primary" plain
              @click="glassDownLine(scope.row)">{{ $t('functionState.downLine') }}</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '重发')">{{
              $t('functionState.anew') }}</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">{{
              $t('functionState.finish') }}</el-button>
            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{ $t('functionState.lose')
              }}</el-button>
            <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{
              $t('functionState.downLine') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div id="main-body"
      style="width: 70%; height: 400px;margin:20px auto;background-image: url(../../src/assets/翻片台.png) ;background-size: 100% 100%;">
    <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;">
      <el-image style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../src/assets/翻片台.png"></el-image>
      <!-- <div style="width: 70%;min-width: 900px; height: 460px;background-image: url(../../src/assets/翻片台.png) ;background-size: 100% 100%;float: left;">
      </div> -->
      <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;">
        <el-table :data="sendRecords" stripe
          :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center', height: '30px' }"
          :cell-style="{ textAlign: 'center' }">
          <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')" />
        </el-table>
      </div>
      <div style="clear:both"></div>
      <!-- ç”»å›¾å†…容 -->
      <div :style="{
      <!-- <div :style="{
        width: loadData.length > 0 ? loadData[0]['length'] + 'px' : '200px',
        height: loadData.length > 0 ? loadData[0]['width'] + 'px' : '100px',
        backgroundColor: 'red',
@@ -279,7 +399,7 @@
        <p v-if="loadData.length > 0">
          {{ loadData[0]['length'] }} * {{ loadData[0]['width'] }}
        </p>
        <p v-else>暂无数据</p> <!-- å¯é€‰ï¼šæ˜¾ç¤ºé»˜è®¤æ¶ˆæ¯ -->
        <p v-else>暂无数据</p>
      </div>
      <div :style="{
        width: loadData.length > 0 ? loadData[1]['length'] + 'px' : '200px',
@@ -294,8 +414,8 @@
        <p v-if="loadData.length > 0">
          {{ loadData[1]['length'] }} * {{ loadData[1]['width'] }}
        </p>
        <p v-else>暂无数据</p> <!-- å¯é€‰ï¼šæ˜¾ç¤ºé»˜è®¤æ¶ˆæ¯ -->
      </div>
        <p v-else>暂无数据</p>
      </div> -->
    </div>
  </div>
</template>
@@ -330,4 +450,11 @@
  border: none;
  cursor: pointer;
}
.dotClass {
  width:10px;
  height:10px;
  border-radius: 50%;
  display: block;
  margin-left: 10px;
}
</style>
UI-Project/src/views/ManualReporting/manualReporting.vue
New file
@@ -0,0 +1,408 @@
searcheh<!--  ä¸Šç‰‡æœº  -->
<script setup>
import request from "@/utils/request";
import { ElMessage, ElMessageBox } from "element-plus";
import { reactive, ref, onMounted, onBeforeUnmount, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { WebSocketHost, host } from '@/utils/constants'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
let language = ref(localStorage.getItem('lang') || 'zh')
const { t } = useI18n()
const requestData = reactive({
  account: '',
  password: '',
});
const blind = ref(false)
const errorInfo = ref(true)
const loadData = ref([]);
const findMachine = ref([]);
const sendRecords = ref([]);
const downLineTask = ref([]);
const scanCode = ref([]);
const scanCodeOld = ref([]);
const searcheh = ref();
const machineId = 2;//当前页面的设备ID
var errorScanId;
//使用WebSocket方式展示数据
let socket = null;
let socketDownLineTask = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/manualReporting`;
const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`;
// å®šä¹‰æ¶ˆæ¯å¤„理函数,更新 receivedData å˜é‡
const handleMessage = (data) => {
  // æ›´æ–° tableData çš„æ•°æ®
  loadData.value = data.taskingList[0];
  findMachine.value = data.machine[0];
  scanCode.value = data.scanCode[0];
  sendRecords.value = data.sendRecords[0].reverse();
  if(scanCode.value.length>0&&scanCode.value[0].scanId.toString()!=errorScanId){
    //有数据就弹窗
    errorScanId=scanCode.value[0].scanId.toString();
    errorInfoFuntion(scanCode.value[0]);
  }
};
// å®šä¹‰æ¶ˆæ¯å¤„理函数,更新 receivedData å˜é‡
const handleMessage2 = (data) => {
  downLineTask.value = data.downLineTask[0];
  // console.log(data);
};
onUnmounted(() => {
  if (socket) {
    closeWebSocket(socket);
  }
  if (socketDownLineTask) {
    closeWebSocket(socketDownLineTask);
  }
});
onBeforeUnmount(() => {
  console.log("关闭了")
  closeWebSocket();
});
onMounted(async () => {
  //使用WebSocket方式展示数据
  socket = initializeWebSocket(socketUrl, handleMessage);// åˆå§‹åŒ– WebSocket,并传递消息处理函数
  //使用WebSocket方式展示数据
  socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// åˆå§‹åŒ– WebSocket,并传递消息处理函数
});
//报警提示
const errorInfoFuntion = async (info) => {
  let infoScancode='扫码ID:'+info.scanId+'  '+info.scanCode;
  ElMessageBox.confirm(
    infoScancode,
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sureStart'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //重新补单
      request.post("/deviceInteraction/tasking/glassAgainTopLine",
        {
          "scanId": info.scanId,
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//修改工作状态 ã€å¤±è´¥/正在工作/完工】
const workStatus = async (row, state) => {
  let url;
  if (state == "重发") {
    url = "/deviceInteraction/tasking/loseMachineTask";
  } else if (state == "正在工作") {
    url = "/deviceInteraction/tasking/startMachineTask";
  } else if (state == "完工") {
    url = "/deviceInteraction/tasking/finishMachineTask";
  } else {
    return;
  }
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //开始修改
      request.post(url,
        {
          "id": machineId
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//开工/暂停
const machineStatus = async (state) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/machine/updateMachineState",
        {
          "id": machineId,
          "state": state
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//破损
const damagedTask = async (row) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/tasking/damagedTask",
        {
          "glassId": row.glassId
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//下线(拿走)
const glassDownLine = async (row) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/tasking/glassDownLine",
        {
          "glassId": row.glassId,
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
const topLineShow = async () => {
  blind.value = true;
}
const fetchData = async () => {
  //扫码回车提交
  alert(searcheh.value);
  searcheh.value="";
}
//上线
const topLine = async (row) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //上线接口
      request.post("/deviceInteraction/tasking/glassTopLine",
        {
          "glassId": row.glassId,
          "lineConfigurationId": machineId
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {n
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
const handleDialogClose = () => {
}
</script>
<template>
  <div ref="content" style="padding:0 20px;">
    <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;">
      {{ $t('machine.manualReporting') }}
    </div>
    <el-dialog v-model="blind" top="30vh" style="text-align: center;" @close="handleDialogClose">
        <!-- å·²æŠ¥å·¥ -->
    </el-dialog>
    <hr />
    <br>
    <div id="search" style="height:35px;line-height: 35px;">
      <!-- åŠŸèƒ½ -->
      <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.reporting') }}</el-button>
      <el-input v-model="searcheh" type="primary" id="ReportSubmission" @keyup.enter="fetchData"
      style="width:1000px;height:35px;line-height: 35px;font-size: 35px;float: right;"></el-input>
    </div>
    <div id="main-body" style="min-height:240px;">
      <!-- è¡¨æ ¼å†…容 -->
      <el-table :data="loadData" stripe
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" />
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" >
          <template #header>
            <div>
              <div>{{ $t('glassInfo.taskType') }}
                <el-icon @click="fetchData"><CaretTop /></el-icon>
                <el-icon @click="fetchData"><CaretBottom /></el-icon>
                <el-icon color="#409efc"><Filter /></el-icon>
              </div>
              <!-- <el-input size="small" placeholder="Type to search" /> -->
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" />
        <el-table-column prop="taskQuantity" :label="$t('glassInfo.taskQuantity')" />
        <el-table-column prop="reportCount" :label="$t('glassInfo.reportCount')" />
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270">
          <template #default="scope">
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">{{
              $t('functionState.finish') }}</el-button>
            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{ $t('functionState.lose')
              }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;">
      <!-- è¡¨æ ¼å†…容详情 -->
      <el-table :data="loadData" stripe
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" />
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" />
        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')" />
        <el-table-column prop="length" :label="$t('glassInfo.length')" />
        <el-table-column prop="width" :label="$t('glassInfo.width')" />
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" />
        <el-table-column prop="workState" :label="$t('glassInfo.workState')" />
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270">
          <template #default="scope">
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">{{
              $t('functionState.finish') }}</el-button>
            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{ $t('functionState.lose')
              }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>
<style scoped>
table {
  text-align: center;
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}
table td {
  text-align: center;
}
#main-body {
  width: 100%;
  height: 100%;
  border: 1px solid #ccc;
  margin-top: 25px;
}
#searchButton {
  width: 100px;
  height: 40px;
  font-size: 16px;
  border-radius: 5px;
  background-color: #409EFF;
  color: #fff;
  border: none;
  cursor: pointer;
}
.dotClass {
  width:10px;
  height:10px;
  border-radius: 50%;
  display: block;
  margin-left: 10px;
}
</style>
UI-Project/src/views/Marking/marking.vue
@@ -15,7 +15,8 @@
});
const loadData = ref([]);
const findMachine = ref([]);
const machineId=11;//当前页面的设备ID
const sendRecords = ref([]);
const machineId=12;//当前页面的设备ID
//使用WebSocket方式展示数据
let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/marking`;
@@ -24,6 +25,7 @@
  // æ›´æ–° tableData çš„æ•°æ®
  loadData.value = data.taskingList[0];
  findMachine.value = data.machine[0];
  sendRecords.value = data.sendRecords[0];
};
onUnmounted(() => {
  if (socket) {
@@ -199,9 +201,9 @@
      <el-button type="primary" id="searchButton" @click="workStatus('破损')">破损</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('完工')">完工</el-button> -->
    </div>
    <div id="main-body" style="min-height:240px;">
    <div id="main-body">
      <!-- è¡¨æ ¼å†…容 -->
      <el-table :data="loadData" stripe
      <el-table :data="loadData" stripe style="height:260px"
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
@@ -210,6 +212,7 @@
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/>
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/>
        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/>
        <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" />
        <el-table-column prop="length" :label="$t('glassInfo.length')"/>
        <el-table-column prop="width" :label="$t('glassInfo.width')"/>
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/>
@@ -225,11 +228,21 @@
      </el-table>
    </div>
    <div id="main-body"
      style="width: 100%; height: 460px;background-image: url(../../src/assets/自动打标机.png) ;background-size: 100% 100%;">
      <!-- ç”»å›¾å†…容 -->
      <div style="width: 100px; height: 100px; background-color: red; position: relative; top: 171px; left: 218px">
    <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;">
      <el-image style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../src/assets/自动打标机.png"></el-image>
      <!-- <div style="width: 70%;min-width: 900px; height: 460px;background-image: url('../../src/assets/自动打标机.png') ;background-size: 100% 100%;float: left;">
      </div> -->
      <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;">
          <!-- <div style="text-align: center;height: 30px;line-height: 30px;font-size: 20px;padding: 20px;">数据交互记录</div> -->
          <el-table :data="sendRecords" stripe :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center',height:'30px'}" :cell-style="{ textAlign: 'center' }">
        <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')"/>
      </el-table>
      </div>
      <div style="clear:both"></div>
      <!-- ç”»å›¾å†…容
      <div style="width: 100px; height: 100px; background-color: red; position: relative; top: 171px; left: 218px">
      </div>-->
    </div>
  </div>
</template>
UI-Project/src/views/MechanicalArm/mechanicalArm.vue
@@ -1,10 +1,10 @@
<!--  æ‰“标机  -->
<!--  ä¸Šç‰‡æœº  -->
<script setup>
import request from "@/utils/request";
import { ElMessage, ElMessageBox } from "element-plus";
import { reactive, ref, onMounted, onBeforeUnmount,onUnmounted } from 'vue'
import { computed,reactive, ref, onMounted, onBeforeUnmount, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { WebSocketHost ,host} from '@/utils/constants'
import { WebSocketHost, host } from '@/utils/constants'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
let language = ref(localStorage.getItem('lang') || 'zh')
const { t } = useI18n()
@@ -12,22 +12,41 @@
  account: '',
  password: '',
});
const blind = ref(false)
const errorInfo = ref(true)
const loadData = ref([]);
const findMachine = ref([]);
const machineId=1;//当前页面的设备ID
const sendRecords = ref([]);
const downLineTask = ref([]);
const findPrimitiveTask = ref([]);
const scanCodeOld = ref([]);
const searchs = ref();
const machineId = 2;//当前页面的设备ID
var errorScanId;
//使用WebSocket方式展示数据
let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/mechanicalArm`;
let socketDownLineTask = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/loadTask`;
const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`;
// å®šä¹‰æ¶ˆæ¯å¤„理函数,更新 receivedData å˜é‡
const handleMessage = (data) => {
  // æ›´æ–° tableData çš„æ•°æ®
  loadData.value = data.taskingList[0];
  loadData.value = data.findPrimitiveTasking[0];
  findPrimitiveTask.value = data.findPrimitiveTask[0];
  findMachine.value = data.machine[0];
  sendRecords.value = data.sendRecords[0].reverse();
};
// å®šä¹‰æ¶ˆæ¯å¤„理函数,更新 receivedData å˜é‡
const handleMessage2 = (data) => {
  downLineTask.value = data.downLineTask[0];
  // console.log(data);
};
onUnmounted(() => {
  if (socket) {
    closeWebSocket(socket);
  }
  if (socketDownLineTask) {
    closeWebSocket(socketDownLineTask);
  }
});
onBeforeUnmount(() => {
@@ -38,257 +57,362 @@
onMounted(async () => {
  //使用WebSocket方式展示数据
  socket = initializeWebSocket(socketUrl, handleMessage);// åˆå§‹åŒ– WebSocket,并传递消息处理函数
  //使用接口方式展示数据
  //load();
  //使用WebSocket方式展示数据
  socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// åˆå§‹åŒ– WebSocket,并传递消息处理函数
});
// //获取数据
// const load = async() => {
//   //获取设备任务数据
//   try {
//     const response = await request.post('/deviceInteraction/tasking/findMachineTask',
//     {
//       "id": 11
//     }); // æ›¿æ¢ä¸ºä½ çš„API端点
//     if (response.code === 200) {
//       loadData.value.findTaskingData= response.data;
//     } else {
//       ElMessage.warning(res.msg)
//     }
//   } catch (error) {
//     // console.error('Error fetching rects :', error);
//   }
//   //获取设备状态
//   try {
//     const response = await request.post('/deviceInteraction/machine/findMachine',
//     {
//       "id": 11
//     }); // æ›¿æ¢ä¸ºä½ çš„API端点
//     if (response.code === 200) {
//       findMachine.value= response.data;
//     } else {
//       ElMessage.warning(res.msg)
//     }
//   } catch (error) {
//     // console.error('Error fetching rects :', error);
//   }
// }
//报警提示
const errorInfoFuntion = async (info) => {
  let infoScancode='扫码ID:'+info.scanId+'  '+info.scanCode;
  ElMessageBox.confirm(
    infoScancode,
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sureStart'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //重新补单
      request.post("/deviceInteraction/tasking/glassAgainTopLine",
        {
          "scanId": info.scanId,
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//修改工作状态 ã€å¤±è´¥/正在工作/完工】
const workStatus = async(row,state) => {
const workStatus = async (row, state) => {
  let url;
  if(state=="重发"){
    url="/deviceInteraction/tasking/loseMachineTask";
  }else if(state=="正在工作"){
    url="/deviceInteraction/tasking/startMachineTask";
  }else if(state=="完工"){
    url="/deviceInteraction/tasking/finishMachineTask";
  }else{
  if (state == "重发") {
    url = "/deviceInteraction/tasking/loseMachineTask";
  } else if (state == "正在工作") {
    url = "/deviceInteraction/tasking/startMachineTask";
  } else if (state == "完工") {
    url = "/deviceInteraction/tasking/finishMachineTask";
  } else {
    return;
  }
  ElMessageBox.confirm(
        t('functionState.tips'),
        t('delivery.prompt'),
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //开始修改
      request.post(url,
        {
          confirmButtonText: t('functionState.sure'),
          cancelButtonText: t('functionState.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //开始修改
          request.post(url,
            {
              "id": machineId
            }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
              } else {
                ElMessage.warning(res.message)
              }
            })
          "id": machineId
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('functionState.cancel'),
          })
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//开工/暂停
const machineStatus = async(state) => {
//定制/标准
const machineMode = async (mode) => {
  ElMessageBox.confirm(
        t('functionState.tips'),
        t('delivery.prompt'),
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/machine/toggleModeMachine",
        {
          confirmButtonText: t('functionState.sure'),
          cancelButtonText: t('functionState.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/machine/updateMachineState",
            {
              "id": machineId,
              "state": state
            }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
              } else {
                ElMessage.warning(res.message)
              }
            })
          "id": machineId,
          "mode": mode
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('functionState.cancel'),
          })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//开工/暂停
const machineStatus = async (state) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/machine/updateMachineState",
        {
          "id": machineId,
          "state": state
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//破损
const damagedTask = async(row) => {
const damagedTask = async (row) => {
  ElMessageBox.confirm(
        t('functionState.tips'),
        t('delivery.prompt'),
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/tasking/damagedTask",
        {
          confirmButtonText: t('functionState.sure'),
          cancelButtonText: t('functionState.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/tasking/damagedTask",
            {
              "glassId": row.glassId
            }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
              } else {
                ElMessage.warning(res.message)
              }
            })
          "glassId": row.glassId
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('functionState.cancel'),
          })
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//下线(拿走)
const glassDownLine = async(row) => {
const glassDownLine = async (row) => {
  ElMessageBox.confirm(
        t('functionState.tips'),
        t('delivery.prompt'),
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/tasking/glassDownLine",
        {
          confirmButtonText: t('functionState.sure'),
          cancelButtonText: t('functionState.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/tasking/glassDownLine",
            {
              "glassId": row.glassId,
            }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
              } else {
                ElMessage.warning(res.message)
              }
            })
          "glassId": row.glassId,
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('functionState.cancel'),
          })
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//上线
const topLine = async() => {
const topLineShow = async () => {
  blind.value = true;
}
//领取任务/结束任务
const startOrStopTask = async (row,line,isWorking) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //领取任务
      request.post("/deviceInteraction/primitiveTask/startOrStopPrimitiveTasking",
        {
          "id": row.id,
          "getLine": line,
          "isWorking": isWorking
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {n
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
const handleDialogClose = () => {
}
const fetchData = async () => {
  //扫码回车提交
  alert(searchs.value);
  searchs.value="";
}
const filterTableData = computed(() =>
  loadData.value.filter(
    (data) =>
      !searchs.value ||data.scanId.toLowerCase().includes(searchs.value.toLowerCase())
  )
)
</script>
<template>
  <div ref="content" style="padding:0 20px;">
    <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;">
      {{$t('machine.upperSlice')}}
      {{ $t('machine.mechanicalArm') }}
    </div>
    <el-dialog v-model="blind" top="30vh" style="text-align: center;" @close="handleDialogClose">
        <!-- æœªé¢†å–的标准任务 -->
      <el-table :data="findPrimitiveTask" stripe style="height:260px" :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" />
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" />
        <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" />
        <el-table-column prop="length" :label="$t('glassInfo.length')" />
        <el-table-column prop="width" :label="$t('glassInfo.width')" />
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" />
        <el-table-column prop="taskQuantity" :label="$t('glassInfo.taskQuantity')" />
        <el-table-column prop="reportCount" :label="$t('glassInfo.reportCount')" />
        <el-table-column prop="workState" :label="$t('glassInfo.workState')" />
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="70">
          <template #default="scope">
            <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row,2,1)">{{
              $t('functionState.getTask') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <hr />
    <br>
    <div id="search" >
    <div id="search">
      <!-- åŠŸèƒ½ -->
      <el-button :type="(findMachine['state']=='暂停'?'danger':'success')" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='暂停'?'开工':'暂停'))">{{findMachine['state']=='开工'?$t('functionState.start'):$t('functionState.stop')}}</el-button>
      <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button>
      <!-- <el-button type="primary" id="searchButton" @click="downLine('下线')">下线</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('破损')">破损</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('完工')">完工</el-button> -->
      <el-button :type="(findMachine['state'] == '暂停' ? 'danger' : 'success')" id="ButtonMachineStatus"
        @click="machineStatus((findMachine['state'] == '暂停' ? '开工' : '暂停'))">{{ findMachine['state'] == '开工' ?
          $t('functionState.start') : $t('functionState.stop') }}</el-button>
      <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.getTask') }}</el-button>
      <el-button :type="(findMachine['mode'] == '定制' ? 'danger' : 'success')" id="ButtonMachineMode"
        @click="machineMode((findMachine['mode'] == 0 ? 1 : 0))">{{ findMachine['mode'] == 0 ?
         $t('functionState.modeD') : $t('functionState.modeB') }}</el-button>
    </div>
    <div id="main-body" style="min-height:240px;">
      <!-- è¡¨æ ¼å†…容 -->
      <el-table :data="loadData" stripe
      <el-table :data="filterTableData" stripe style="height:260px"
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/>
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/>
        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/>
        <el-table-column prop="length" :label="$t('glassInfo.length')"/>
        <el-table-column prop="width" :label="$t('glassInfo.width')"/>
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/>
        <el-table-column prop="workState" :label="$t('glassInfo.workState')"/>
        <el-table-column prop="batchNumber" sortable :label="$t('glassInfo.batchNumber')" />
        <el-table-column prop="taskType" sortable :label="$t('glassInfo.taskType')" />
        <el-table-column prop="scanId" sortable :label="$t('glassInfo.scanId')" >
        <template #header>
            <div>
              <div>{{ $t('glassInfo.taskType') }}
                <el-icon @click="fetchData"><CaretTop /></el-icon>
                <el-icon @click="fetchData"><CaretBottom /></el-icon>
                <el-icon color="#409efc"><Filter /></el-icon>
              </div>
              <el-input v-model="searchs" type="primary" id="ReportSubmission" @keyup.enter="fetchData"></el-input>
              <!-- <el-input size="small" placeholder="Type to search" /> -->
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="length" sortable :label="$t('glassInfo.length')" />
        <el-table-column prop="width" sortable :label="$t('glassInfo.width')" />
        <el-table-column prop="thickness" sortable :label="$t('glassInfo.thickness')" />
        <el-table-column prop="taskQuantity" sortable :label="$t('glassInfo.taskQuantity')" />
        <el-table-column prop="isWorking" sortable :label="$t('glassInfo.isWorking')" />
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270">
          <template #default="scope">
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '重发')" >{{$t('functionState.anew')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">{{$t('functionState.finish')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{$t('functionState.lose')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{$t('functionState.downLine')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row,2,2)">{{
              $t('functionState.stopTask') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div id="main-body"
      style="width: 45%; height: 400px;margin: 50px 0 0 50px;background-image: url(../../src/assets/上片机.png) ;background-size: 100% 100%;">
      <!-- ç”»å›¾å†…容 -->
      <div style="width: 200px; height: 100px; background-color: red; position: relative; top: 271px; left: 158px">
        <div style="width: 500px; height: 300px; position: relative; top: -250PX; left: 800px">
          <el-table :data="loadData" stripe class="custom-table"
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center',height: '80px'}"
        :cell-style="{ textAlign: 'center',height: '80px'}">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="55" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/>
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/>
        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')" />
        <el-table-column prop="length" :label="$t('glassInfo.length')" min-width="55"/>
        <el-table-column prop="width" :label="$t('glassInfo.width')" min-width="55"/>
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/>
        <el-table-column prop="workState" :label="$t('glassInfo.workState')"/>
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="100">
          <template #default="scope">
            <el-button size="mini" style="min-width: 100px;" link type="primary" plain @click="workStatus(scope.row, '绑定')" >{{$t('functionState.bound')}}</el-button>
          </template>
        </el-table-column>
      </el-table>
        </div>
    <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;">
      <el-image style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../src/assets/扫码识别.png"></el-image>
      <!-- <div style="width: 70%;min-width: 900px; height: 460px;background-image: url(../../src/assets/扫码识别.png) ;background-size: 100% 100%;float: left;">
      </div> -->
      <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;">
        <el-table :data="sendRecords" stripe
          :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center', height: '30px' }"
          :cell-style="{ textAlign: 'center' }">
          <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')" />
        </el-table>
      </div>
      <div style="clear:both"></div>
    </div>
  </div>
</template>
<style scoped>
table {
  text-align: center;
  width: 100%;
@@ -318,4 +442,11 @@
  border: none;
  cursor: pointer;
}
.dotClass {
  width:10px;
  height:10px;
  border-radius: 50%;
  display: block;
  margin-left: 10px;
}
</style>
UI-Project/src/views/MechanicalArm/mechanicalArm2.vue
New file
@@ -0,0 +1,321 @@
<!--  æ‰“标机  -->
<script setup>
import request from "@/utils/request";
import { ElMessage, ElMessageBox } from "element-plus";
import { reactive, ref, onMounted, onBeforeUnmount,onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { WebSocketHost ,host} from '@/utils/constants'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
let language = ref(localStorage.getItem('lang') || 'zh')
const { t } = useI18n()
const requestData = reactive({
  account: '',
  password: '',
});
const loadData = ref([]);
const findMachine = ref([]);
const machineId=1;//当前页面的设备ID
//使用WebSocket方式展示数据
let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/mechanicalArm`;
// å®šä¹‰æ¶ˆæ¯å¤„理函数,更新 receivedData å˜é‡
const handleMessage = (data) => {
  // æ›´æ–° tableData çš„æ•°æ®
  loadData.value = data.taskingList[0];
  findMachine.value = data.machine[0];
  // console.log(data);
};
onUnmounted(() => {
  if (socket) {
    closeWebSocket(socket);
  }
});
onBeforeUnmount(() => {
  console.log("关闭了")
  closeWebSocket();
});
onMounted(async () => {
  //使用WebSocket方式展示数据
  socket = initializeWebSocket(socketUrl, handleMessage);// åˆå§‹åŒ– WebSocket,并传递消息处理函数
  //使用接口方式展示数据
  //load();
});
// //获取数据
// const load = async() => {
//   //获取设备任务数据
//   try {
//     const response = await request.post('/deviceInteraction/tasking/findMachineTask',
//     {
//       "id": 11
//     }); // æ›¿æ¢ä¸ºä½ çš„API端点
//     if (response.code === 200) {
//       loadData.value.findTaskingData= response.data;
//     } else {
//       ElMessage.warning(res.msg)
//     }
//   } catch (error) {
//     // console.error('Error fetching rects :', error);
//   }
//   //获取设备状态
//   try {
//     const response = await request.post('/deviceInteraction/machine/findMachine',
//     {
//       "id": 11
//     }); // æ›¿æ¢ä¸ºä½ çš„API端点
//     if (response.code === 200) {
//       findMachine.value= response.data;
//     } else {
//       ElMessage.warning(res.msg)
//     }
//   } catch (error) {
//     // console.error('Error fetching rects :', error);
//   }
// }
//修改工作状态 ã€å¤±è´¥/正在工作/完工】
const workStatus = async(row,state) => {
  let url;
  if(state=="重发"){
    url="/deviceInteraction/tasking/loseMachineTask";
  }else if(state=="正在工作"){
    url="/deviceInteraction/tasking/startMachineTask";
  }else if(state=="完工"){
    url="/deviceInteraction/tasking/finishMachineTask";
  }else{
    return;
  }
  ElMessageBox.confirm(
        t('functionState.tips'),
        t('delivery.prompt'),
        {
          confirmButtonText: t('functionState.sure'),
          cancelButtonText: t('functionState.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //开始修改
          request.post(url,
            {
              "id": machineId
            }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
              } else {
                ElMessage.warning(res.message)
              }
            })
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('functionState.cancel'),
          })
        })
}
//开工/暂停
const machineStatus = async(state) => {
  ElMessageBox.confirm(
        t('functionState.tips'),
        t('delivery.prompt'),
        {
          confirmButtonText: t('functionState.sure'),
          cancelButtonText: t('functionState.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/machine/updateMachineState",
            {
              "id": machineId,
              "state": state
            }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
              } else {
                ElMessage.warning(res.message)
              }
            })
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('functionState.cancel'),
          })
        })
}
//破损
const damagedTask = async(row) => {
  ElMessageBox.confirm(
        t('functionState.tips'),
        t('delivery.prompt'),
        {
          confirmButtonText: t('functionState.sure'),
          cancelButtonText: t('functionState.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/tasking/damagedTask",
            {
              "glassId": row.glassId
            }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
              } else {
                ElMessage.warning(res.message)
              }
            })
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('functionState.cancel'),
          })
        })
}
//下线(拿走)
const glassDownLine = async(row) => {
  ElMessageBox.confirm(
        t('functionState.tips'),
        t('delivery.prompt'),
        {
          confirmButtonText: t('functionState.sure'),
          cancelButtonText: t('functionState.cancel'),
          type: 'warning',
        }
      )
        .then(() => {
          //下线接口
          request.post("/deviceInteraction/tasking/glassDownLine",
            {
              "glassId": row.glassId,
            }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
              if (res.code === 200) {
                ElMessage.success(res.message);
              } else {
                ElMessage.warning(res.message)
              }
            })
        })
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('functionState.cancel'),
          })
        })
}
//上线
const topLine = async() => {
}
</script>
<template>
  <div ref="content" style="padding:0 20px;">
    <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;">
      {{$t('machine.upperSlice')}}
    </div>
    <hr />
    <br>
    <div id="search" >
      <!-- åŠŸèƒ½ -->
      <el-button :type="(findMachine['state']=='暂停'?'danger':'success')" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='暂停'?'开工':'暂停'))">{{findMachine['state']=='开工'?$t('functionState.start'):$t('functionState.stop')}}</el-button>
      <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button>
      <!-- <el-button type="primary" id="searchButton" @click="downLine('下线')">下线</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('破损')">破损</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('完工')">完工</el-button> -->
    </div>
    <div id="main-body" style="min-height:240px;">
      <!-- è¡¨æ ¼å†…容 -->
      <el-table :data="loadData" stripe
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/>
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/>
        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/>
        <el-table-column prop="length" :label="$t('glassInfo.length')"/>
        <el-table-column prop="width" :label="$t('glassInfo.width')"/>
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/>
        <el-table-column prop="workState" :label="$t('glassInfo.workState')"/>
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270">
          <template #default="scope">
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '重发')" >{{$t('functionState.anew')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">{{$t('functionState.finish')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{$t('functionState.lose')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{$t('functionState.downLine')}}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div id="main-body"
      style="width: 45%; height: 400px;margin: 50px 0 0 50px;background-image: url(../../src/assets/上片机.png) ;background-size: 100% 100%;">
      <!-- ç”»å›¾å†…容 -->
      <div style="width: 200px; height: 100px; background-color: red; position: relative; top: 271px; left: 158px">
        <div style="width: 500px; height: 300px; position: relative; top: -250PX; left: 800px">
          <el-table :data="loadData" stripe class="custom-table"
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center',height: '80px'}"
        :cell-style="{ textAlign: 'center',height: '80px'}">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="55" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/>
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/>
        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')" />
        <el-table-column prop="length" :label="$t('glassInfo.length')" min-width="55"/>
        <el-table-column prop="width" :label="$t('glassInfo.width')" min-width="55"/>
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/>
        <el-table-column prop="workState" :label="$t('glassInfo.workState')"/>
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="100">
          <template #default="scope">
            <el-button size="mini" style="min-width: 100px;" link type="primary" plain @click="workStatus(scope.row, '绑定')" >{{$t('functionState.bound')}}</el-button>
          </template>
        </el-table-column>
      </el-table>
        </div>
      </div>
    </div>
  </div>
</template>
<style scoped>
table {
  text-align: center;
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}
table td {
  text-align: center;
}
#main-body {
  width: 100%;
  height: 100%;
  border: 1px solid #ccc;
  margin-top: 25px;
}
#searchButton {
  width: 100px;
  height: 40px;
  font-size: 16px;
  border-radius: 5px;
  background-color: #409EFF;
  color: #fff;
  border: none;
  cursor: pointer;
}
</style>
UI-Project/src/views/Rotate/rotate.vue
New file
@@ -0,0 +1,427 @@
<!--  æ—‹è½¬å°  -->
<script setup>
import request from "@/utils/request";
import { ElMessage, ElMessageBox } from "element-plus";
import { reactive, ref, onMounted, onBeforeUnmount, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { WebSocketHost, host } from '@/utils/constants'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
let language = ref(localStorage.getItem('lang') || 'zh')
const { t } = useI18n()
const requestData = reactive({
  account: '',
  password: '',
});
const blind = ref(false)
const loadData = ref([]);
const findMachine = ref([]);
const sendRecords = ref([]);
const downLineTask = ref([]);
const machineId = 20;//当前页面的设备ID
var errorScanId;
var errorOpen=false;
//使用WebSocket方式展示数据
let socket = null;
let socketDownLineTask = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/rotate`;
const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`;
// å®šä¹‰æ¶ˆæ¯å¤„理函数,更新 receivedData å˜é‡
const handleMessage = (data) => {
  // æ›´æ–° tableData çš„æ•°æ®
  loadData.value = data.taskingList[0];
  findMachine.value = data.machine[0];
  sendRecords.value = data.sendRecords[0].reverse();
  if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){
    //有数据就弹窗
    if(errorOpen){
      ElMessageBox.close();
    }
    errorScanId=findMachine.value.remark.toString();
    errorInfoFuntion(findMachine.value.remark.toString());
    errorOpen=true;
  }else if(findMachine.value.remark.toString()==""&&errorOpen){
    ElMessageBox.close();
    errorOpen=false;
  }
};
// å®šä¹‰æ¶ˆæ¯å¤„理函数,更新 receivedData å˜é‡
const handleMessage2 = (data) => {
  downLineTask.value = data.downLineTask[0];
  // console.log(data);
};
onUnmounted(() => {
  if (socket) {
    closeWebSocket(socket);
  }
  if (socketDownLineTask) {
    closeWebSocket(socketDownLineTask);
  }
});
onBeforeUnmount(() => {
  console.log("关闭了")
  closeWebSocket();
});
onMounted(async () => {
  //使用WebSocket方式展示数据
  socket = initializeWebSocket(socketUrl, handleMessage);// åˆå§‹åŒ– WebSocket,并传递消息处理函数
  //使用WebSocket方式展示数据
  socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// åˆå§‹åŒ– WebSocket,并传递消息处理函数
});
//报警提示
const errorInfoFuntion = async (info) => {
  let infoScancode=info;
  ElMessageBox.confirm(
    infoScancode,
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sureStart'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//修改工作状态 ã€å¤±è´¥/正在工作/完工】
const workStatus = async (row, state) => {
  let url;
  if (state == "重发") {
    url = "/deviceInteraction/tasking/loseMachineTask";
  } else if (state == "正在工作") {
    url = "/deviceInteraction/tasking/startMachineTask";
  } else if (state == "完工") {
    url = "/deviceInteraction/tasking/finishMachineTask";
  } else {
    return;
  }
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //开始修改
      request.post(url,
        {
          "id": machineId
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//开工/暂停
const machineStatus = async (state) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/machine/updateMachineState",
        {
          "id": machineId,
          "state": state
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//定制/标准
const machineMode = async (mode) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/machine/toggleModeMachine",
        {
          "id": machineId,
          "mode": mode
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//破损
const damagedTask = async (row) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/tasking/damagedTask",
        {
          "glassId": row.glassId
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
//下线(拿走)
const glassDownLine = async (row) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //下线接口
      request.post("/deviceInteraction/tasking/glassDownLine",
        {
          "glassId": row.glassId,
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
const topLineShow = async () => {
  blind.value = true;
}
//上线
const topLine = async (row) => {
  ElMessageBox.confirm(
    t('functionState.tips'),
    t('delivery.prompt'),
    {
      confirmButtonText: t('functionState.sure'),
      cancelButtonText: t('functionState.cancel'),
      type: 'warning',
    }
  )
    .then(() => {
      //上线接口
      request.post("/deviceInteraction/tasking/glassTopLine",
        {
          "glassId": row.glassId,
          "lineConfigurationId": machineId
        }).then((res) => { // æ›¿æ¢ä¸ºä½ çš„API端点
          if (res.code === 200) {
            ElMessage.success(res.message);
          } else {n
            ElMessage.warning(res.message)
          }
        })
    })
    .catch(() => {
      ElMessage({
        type: 'info',
        message: t('functionState.cancel'),
      })
    })
}
const handleDialogClose = () => {
}
</script>
<template>
  <div ref="content" style="padding:0 20px;">
    <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;">
      {{ $t('machine.rotate') }}
    </div>
    <el-dialog v-model="blind" top="30vh" style="text-align: center;" @close="handleDialogClose">
        <!-- çº¿ä¸‹çŽ»ç’ƒ -->
      <el-table :data="downLineTask" stripe style="height:260px" :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" />
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" />
        <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" />
        <el-table-column prop="length" :label="$t('glassInfo.length')" />
        <el-table-column prop="width" :label="$t('glassInfo.width')" />
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" />
        <el-table-column prop="workState" :label="$t('glassInfo.workState')" />
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="70">
          <template #default="scope">
            <el-button size="mini" link type="primary" plain @click="topLine(scope.row)">{{
              $t('functionState.topLine') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <hr />
    <br>
    <div id="search">
      <!-- åŠŸèƒ½ -->
      <el-button :type="(findMachine['state'] == '暂停' ? 'danger' : 'success')" id="ButtonMachineStatus"
        @click="machineStatus((findMachine['state'] == '暂停' ? '开工' : '暂停'))">{{ findMachine['state'] == '开工' ?
          $t('functionState.start') : $t('functionState.stop') }}</el-button>
      <el-button :type="(findMachine['mode'] == '定制' ? 'danger' : 'success')" id="ButtonMachineMode"
        @click="machineMode((findMachine['mode'] == 0 ? 1 : 0))">{{ findMachine['mode'] == 0 ?
         $t('functionState.modeD') : $t('functionState.modeB') }}</el-button>
      <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.topLine') }}</el-button>
      <!-- <el-button type="primary" id="searchButton" @click="downLine('下线')">下线</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('破损')">破损</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('完工')">完工</el-button> -->
    </div>
    <div id="main-body" style="min-height:240px;">
      <!-- è¡¨æ ¼å†…容 -->
      <el-table :data="loadData" stripe style="height:680px"
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" />
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" />
        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')" />
        <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" />
        <el-table-column prop="length" :label="$t('glassInfo.length')" />
        <el-table-column prop="width" :label="$t('glassInfo.width')" />
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" />
        <el-table-column prop="workState" :label="$t('glassInfo.workState')" />
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270">
          <template #default="scope">
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '重发')">{{
              $t('functionState.anew') }}</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">{{
              $t('functionState.finish') }}</el-button>
            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{ $t('functionState.lose')
              }}</el-button>
            <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{
              $t('functionState.downLine') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
<!--
    <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;">
      <div style="width: 70%;min-width: 900px; height: 460px;background-size: 100% 100%;float: left;">
      </div>
      <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;">
        <el-table :data="sendRecords" stripe
          :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center', height: '30px' }"
          :cell-style="{ textAlign: 'center' }">
          <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')" />
        </el-table>
      </div>
      <div style="clear:both"></div>
    </div> -->
  </div>
</template>
<style scoped>
table {
  text-align: center;
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}
table td {
  text-align: center;
}
#main-body {
  width: 100%;
  height: 100%;
  border: 1px solid #ccc;
  margin-top: 25px;
}
#searchButton {
  width: 100px;
  height: 40px;
  font-size: 16px;
  border-radius: 5px;
  background-color: #409EFF;
  color: #fff;
  border: none;
  cursor: pointer;
}
.dotClass {
  width:10px;
  height:10px;
  border-radius: 50%;
  display: block;
  margin-left: 10px;
}
</style>
UI-Project/src/views/ScanQrCodesReport/scanQrCodesReport.vue
@@ -44,37 +44,6 @@
  //load();
});
// //获取数据
// const load = async() => {
//   //获取设备任务数据
//   try {
//     const response = await request.post('/deviceInteraction/tasking/findMachineTask',
//     {
//       "id": 11
//     }); // æ›¿æ¢ä¸ºä½ çš„API端点
//     if (response.code === 200) {
//       loadData.value.findTaskingData= response.data;
//     } else {
//       ElMessage.warning(res.msg)
//     }
//   } catch (error) {
//     // console.error('Error fetching rects :', error);
//   }
//   //获取设备状态
//   try {
//     const response = await request.post('/deviceInteraction/machine/findMachine',
//     {
//       "id": 11
//     }); // æ›¿æ¢ä¸ºä½ çš„API端点
//     if (response.code === 200) {
//       findMachine.value= response.data;
//     } else {
//       ElMessage.warning(res.msg)
//     }
//   } catch (error) {
//     // console.error('Error fetching rects :', error);
//   }
// }
//修改工作状态 ã€å¤±è´¥/正在工作/完工】
const workStatus = async(row,state) => {
  let url;
UI-Project/src/views/SilkScreen/SilkScreen.vue
@@ -15,15 +15,17 @@
});
const loadData = ref([]);
const findMachine = ref([]);
const machineId=13;//当前页面的设备ID
const sendRecords = ref([]);
const machineId=14;//当前页面的设备ID
//使用WebSocket方式展示数据
let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/silkScreen`;
const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/silkScreenTask`;
// å®šä¹‰æ¶ˆæ¯å¤„理函数,更新 receivedData å˜é‡
const handleMessage = (data) => {
  // æ›´æ–° tableData çš„æ•°æ®
  loadData.value = data.taskingList[0];
  findMachine.value = data.machine[0];
  sendRecords.value = data.sendRecords[0];
};
onUnmounted(() => {
  if (socket) {
@@ -195,9 +197,9 @@
      {{findMachine['state']=='开工'?$t('functionState.start'):$t('functionState.stop')}}</el-button>
      <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button>
    </div>
    <div id="main-body" style="min-height:240px;">
    <div id="main-body" style="height:240px; min-height:240px;">
      <!-- è¡¨æ ¼å†…容 -->
      <el-table :data="loadData" stripe
      <el-table :data="loadData" stripe style="height:680px"
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
@@ -206,6 +208,7 @@
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/>
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/>
        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/>
        <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" />
        <el-table-column prop="length" :label="$t('glassInfo.length')"/>
        <el-table-column prop="width" :label="$t('glassInfo.width')"/>
        <el-table-column prop="silkScreenX" :label="$t('glassInfo.silkScreenX')"/>
@@ -221,13 +224,7 @@
        </el-table-column>
      </el-table>
    </div>
    <div id="main-body"
      style="width: 100%; height: 460px;background-image: url(../../src/assets/a.png) ;background-size: 100% 100%;">
      <!-- ç”»å›¾å†…容 -->
      <div style="width: 100px; height: 100px; background-color: red; position: relative; top: 171px; left: 218px">
      </div>
    </div>
  </div>
</template>