From 149a82f3cfba46bc5a7427d16b685ea1727eba47 Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期一, 01 九月 2025 08:27:48 +0800
Subject: [PATCH] 更新最新代码,添加点胶机代码

---
 UI-Project/config.js                                                                                            |    8 
 JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineDispensing.java |  470 ++++++++++++++++++++++++++--------------------------
 UI-Project/src/utils/constants.js                                                                               |    4 
 JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/AppRunnerConfig.java                 |    8 
 UI-Project/src/views/GlueDispenser/glueDispenser.vue                                                            |    3 
 5 files changed, 247 insertions(+), 246 deletions(-)

diff --git a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/AppRunnerConfig.java b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/AppRunnerConfig.java
index bade8c2..0357a7a 100644
--- a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/AppRunnerConfig.java
+++ b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/AppRunnerConfig.java
@@ -43,7 +43,7 @@
         List<Machine> machineListFlipSlice =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"缈荤墖").eq(Machine::getState,"寮�宸�"));
         List<Machine> machineListMarking =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"鑷姩鎵撴爣鏈�").eq(Machine::getState,"寮�宸�"));
         List<Machine> machineListSilkScreen =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"鑷姩涓濆嵃鏈�").eq(Machine::getState,"寮�宸�"));
-//        List<Machine> machineDispensing =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"鑷姩鐐硅兌鏈�").eq(Machine::getState,"寮�宸�"));
+        List<Machine> machineDispensing =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"鑷姩鐐硅兌鏈�").eq(Machine::getState,"寮�宸�"));
         List<Machine> machineListRotate =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"鏃嬭浆鍙�").eq(Machine::getState,"寮�宸�"));
         List<Machine> machineListLamination =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"鑷姩璐磋啘鏈�").eq(Machine::getState,"寮�宸�"));
         for (Machine item:machineListLoad){
@@ -61,9 +61,9 @@
         for (Machine item:machineListSilkScreen){
             new MachineSilkScreen(item,machineMapper,taskingService).start();
         }
-//        for (Machine item:machineDispensing){
-//            new MachineDispensing(item,machineMapper,taskingService).start();
-//        }
+        for (Machine item:machineDispensing){
+            new MachineDispensing(item,machineMapper,taskingService).start();
+        }
         for (Machine item:machineListRotate){
             new MachineRotate(item,machineMapper,taskingService).start();
         }
diff --git a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineDispensing.java b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineDispensing.java
index 88cf2b7..cf2d6bf 100644
--- a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineDispensing.java
+++ b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineDispensing.java
@@ -1,235 +1,235 @@
-//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 MachineDispensing extends Thread {
-//
-//
-//    private MachineMapper machineMapper;
-//    private TaskingService taskingService;
-//    public static Long machineId = 16L;
-//    public List<Map> sendRecords = new ArrayList<>();
-//    public Machine thisMachine;
-//
-//    public MachineDispensing(Machine machine, MachineMapper machineMapper, TaskingService taskingService) {
-//        this.thisMachine = machine;
-//        this.machineMapper = machineMapper;
-//        this.taskingService = taskingService;
-//    }
-//
-//    public void plcStart() {
-//        Machine machine = machineMapper.selectById(thisMachine.getId());
-//        String fileName = machine.getFileName();
-//        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");//鍙戦�両D
-////        PlcParameterInfo drawingMark =plcParameterObject.getPlcParameter("drawingGlue");//鐐硅兌鍥剧焊鍦板潃
-//            PlcParameter JPZX = plcAgreement.getPlcParameter("JPZX");//绫诲瀷
-//            PlcParameter thickness = plcAgreement.getPlcParameter("thickness");//鍘�
-//            PlcParameter side1 = plcAgreement.getPlcParameter("side1");//涓嬭竟
-//            PlcParameter side2 = plcAgreement.getPlcParameter("side2");//鍙宠竟
-//            PlcParameter side3 = plcAgreement.getPlcParameter("side3");//涓婅竟
-//            PlcParameter side4 = plcAgreement.getPlcParameter("side4");//宸﹁竟
-//            PlcParameter R_angle1_1 = plcAgreement.getPlcParameter("R_angle1_1");//R瑙�1-1
-//            PlcParameter R_angle1_2 = plcAgreement.getPlcParameter("R_angle1_2");//R瑙�1-2
-//            PlcParameter R_angle2_1 = plcAgreement.getPlcParameter("R_angle2_1");//R瑙�2-1
-//            PlcParameter R_angle2_2 = plcAgreement.getPlcParameter("R_angle2_2");//R瑙�2-2
-//            PlcParameter R_angle3_1 = plcAgreement.getPlcParameter("R_angle3_1");//R瑙�3-1
-//            PlcParameter R_angle3_2 = plcAgreement.getPlcParameter("R_angle3_2");//R瑙�3-2
-//            PlcParameter R_angle4_1 = plcAgreement.getPlcParameter("R_angle4_1");//R瑙�4-1
-//            PlcParameter R_angle4_2 = plcAgreement.getPlcParameter("R_angle4_2");//R瑙�4-2
-//
-//            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, "姝e湪宸ヤ綔");
-//            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(tasking.getJPZX()) +
-//                                    HexUtil.intTo2ByteHex(tasking.getThickness().intValue()) +
-//                                    HexUtil.intTo2ByteHex(tasking.getWidth().intValue()) +   // side1 涓嬭竟 = 瀹藉害
-//                                    HexUtil.intTo2ByteHex(tasking.getLength().intValue()) +  // side2 鍙宠竟 = 闀垮害
-//                                    HexUtil.intTo2ByteHex(tasking.getWidth().intValue()) +   // side3 涓婅竟 = 瀹藉害
-//                                    HexUtil.intTo2ByteHex(tasking.getLength().intValue()) +  // side4 宸﹁竟 = 闀垮害
-//                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_1_1() != null ? tasking.getR_1_1() : 0.0) * 10))  +
-//                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_1_2() != null ? tasking.getR_1_2() : 0.0) * 10))  +
-//                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_2_1() != null ? tasking.getR_2_1() : 0.0) * 10))  +
-//                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_2_2() != null ? tasking.getR_2_2() : 0.0) * 10))  +
-//                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_3_1() != null ? tasking.getR_3_1() : 0.0) * 10))  +
-//                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_3_2() != null ? tasking.getR_3_2() : 0.0) * 10))  +
-//                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_4_1() != null ? tasking.getR_4_1() : 0.0) * 10))  +
-//                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_4_2() != null ? tasking.getR_4_2() : 0.0) * 10))  ;
-//                    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.getLength() + "-" +
-//                            tasking.getWidth() + "-" +
-//                            tasking.getThickness() + "-" +
-//                            tasking.getR_1_1() + "-" +
-//                            tasking.getR_1_2() + "-" +
-//                            tasking.getR_2_1() + "-" +
-//                            tasking.getR_2_2() + "-" +
-//                            tasking.getR_3_1() + "-" +
-//                            tasking.getR_3_2() + "-" +
-//                            tasking.getR_4_1() + "-" +
-//                            tasking.getR_4_2() + "-" +
-//                            tasking.getJPZX();
-//                    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();
-//            }
-//        }
-//    }
-//}
+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 MachineDispensing extends Thread {
+
+
+    private MachineMapper machineMapper;
+    private TaskingService taskingService;
+    public static Long machineId = 16L;
+    public List<Map> sendRecords = new ArrayList<>();
+    public Machine thisMachine;
+
+    public MachineDispensing(Machine machine, MachineMapper machineMapper, TaskingService taskingService) {
+        this.thisMachine = machine;
+        this.machineMapper = machineMapper;
+        this.taskingService = taskingService;
+    }
+
+    public void plcStart() {
+        Machine machine = machineMapper.selectById(thisMachine.getId());
+        String fileName = machine.getFileName();
+        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");//鍙戦�両D
+//        PlcParameterInfo drawingMark =plcParameterObject.getPlcParameter("drawingGlue");//鐐硅兌鍥剧焊鍦板潃
+            PlcParameter JPZX = plcAgreement.getPlcParameter("JPZX");//绫诲瀷
+            PlcParameter thickness = plcAgreement.getPlcParameter("thickness");//鍘�
+            PlcParameter side1 = plcAgreement.getPlcParameter("side1");//涓嬭竟
+            PlcParameter side2 = plcAgreement.getPlcParameter("side2");//鍙宠竟
+            PlcParameter side3 = plcAgreement.getPlcParameter("side3");//涓婅竟
+            PlcParameter side4 = plcAgreement.getPlcParameter("side4");//宸﹁竟
+            PlcParameter R_angle1_1 = plcAgreement.getPlcParameter("R_angle1_1");//R瑙�1-1
+            PlcParameter R_angle1_2 = plcAgreement.getPlcParameter("R_angle1_2");//R瑙�1-2
+            PlcParameter R_angle2_1 = plcAgreement.getPlcParameter("R_angle2_1");//R瑙�2-1
+            PlcParameter R_angle2_2 = plcAgreement.getPlcParameter("R_angle2_2");//R瑙�2-2
+            PlcParameter R_angle3_1 = plcAgreement.getPlcParameter("R_angle3_1");//R瑙�3-1
+            PlcParameter R_angle3_2 = plcAgreement.getPlcParameter("R_angle3_2");//R瑙�3-2
+            PlcParameter R_angle4_1 = plcAgreement.getPlcParameter("R_angle4_1");//R瑙�4-1
+            PlcParameter R_angle4_2 = plcAgreement.getPlcParameter("R_angle4_2");//R瑙�4-2
+
+            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, "姝e湪宸ヤ綔");
+            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(tasking.getJPZX()) +
+                                    HexUtil.intTo2ByteHex(tasking.getThickness().intValue()) +
+                                    HexUtil.intTo2ByteHex(tasking.getWidth().intValue()) +   // side1 涓嬭竟 = 瀹藉害
+                                    HexUtil.intTo2ByteHex(tasking.getLength().intValue()) +  // side2 鍙宠竟 = 闀垮害
+                                    HexUtil.intTo2ByteHex(tasking.getWidth().intValue()) +   // side3 涓婅竟 = 瀹藉害
+                                    HexUtil.intTo2ByteHex(tasking.getLength().intValue()) +  // side4 宸﹁竟 = 闀垮害
+                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_1_1() != null ? tasking.getR_1_1() : 0.0) * 10))  +
+                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_1_2() != null ? tasking.getR_1_2() : 0.0) * 10))  +
+                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_2_1() != null ? tasking.getR_2_1() : 0.0) * 10))  +
+                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_2_2() != null ? tasking.getR_2_2() : 0.0) * 10))  +
+                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_3_1() != null ? tasking.getR_3_1() : 0.0) * 10))  +
+                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_3_2() != null ? tasking.getR_3_2() : 0.0) * 10))  +
+                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_4_1() != null ? tasking.getR_4_1() : 0.0) * 10))  +
+                                    HexUtil.intTo2ByteHex((int) ((tasking.getR_4_2() != null ? tasking.getR_4_2() : 0.0) * 10))  ;
+                    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.getLength() + "-" +
+                            tasking.getWidth() + "-" +
+                            tasking.getThickness() + "-" +
+                            tasking.getR_1_1() + "-" +
+                            tasking.getR_1_2() + "-" +
+                            tasking.getR_2_1() + "-" +
+                            tasking.getR_2_2() + "-" +
+                            tasking.getR_3_1() + "-" +
+                            tasking.getR_3_2() + "-" +
+                            tasking.getR_4_1() + "-" +
+                            tasking.getR_4_2() + "-" +
+                            tasking.getJPZX();
+                    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();
+            }
+        }
+    }
+}
diff --git a/UI-Project/config.js b/UI-Project/config.js
index a653f48..2fd0f18 100644
--- a/UI-Project/config.js
+++ b/UI-Project/config.js
@@ -1,13 +1,13 @@
 export default {
 
-  serverUrl: "localhost:88/api",
-  serverUrl2: "localhost:88"
+  // serverUrl: "localhost:88/api",
+  // serverUrl2: "localhost:88"
 
   // serverUrl: "10.36.164.253:88/api",
   //  serverUrl2: "10.36.164.253:88"
 
-  // serverUrl: "10.36.164.200:88/api",
-  // serverUrl2: "10.36.164.200:88"
+  serverUrl: "10.36.164.200:88/api",
+  serverUrl2: "10.36.164.200:88"
 
     // serverUrl2: "127.0.0.1:88"npm
 
diff --git a/UI-Project/src/utils/constants.js b/UI-Project/src/utils/constants.js
index f268dae..4c965ef 100644
--- a/UI-Project/src/utils/constants.js
+++ b/UI-Project/src/utils/constants.js
@@ -1,4 +1,4 @@
- export const WebSocketHost = "localhost";
+//  export const WebSocketHost = "localhost";
 //  export const WebSocketHost = "10.36.164.253";
-//  export const WebSocketHost = "10.36.164.200";
+ export const WebSocketHost = "10.36.164.200";
  export const host = "88";
\ No newline at end of file
diff --git a/UI-Project/src/views/GlueDispenser/glueDispenser.vue b/UI-Project/src/views/GlueDispenser/glueDispenser.vue
index 580ed7e..92fe088 100644
--- a/UI-Project/src/views/GlueDispenser/glueDispenser.vue
+++ b/UI-Project/src/views/GlueDispenser/glueDispenser.vue
@@ -22,8 +22,9 @@
 const downLineTask = ref([]);
 
 const userInfo=JSON.parse(window.localStorage.getItem('userInfo'));
-const pageParams=userInfo.user.menus[0].pages[12].params;
+const pageParams=userInfo.user.menus[0].pages[8].params;
 const pageParamsJson=JSON.parse(pageParams);
+console.log(pageParams);
 console.log(userInfo.user);
 
 const machineId = pageParamsJson.machineId;//褰撳墠椤甸潰鐨勮澶嘔D

--
Gitblit v1.8.0