huang
2025-06-30 935275e79de8415ee3ca0b9a45da548aa6a2ee34
更新最新代码,上片页面领取任务传递固定值修改为动态获取线路
15个文件已修改
1个文件已添加
417 ■■■■■ 已修改文件
JiuMuMesParent/common/servicebase/src/main/java/com/mes/service/ModbusTcp.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/AppRunnerConfig.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/controller/PrimitiveTaskController.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/KBBTJPDrawingBP.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/PrimitiveTask.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/Tasking.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/TaskingLog.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/LineConfigurationService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/KBBTJPDrawingBPServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/LineConfigurationServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineDispensing.java 235 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineEdging.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineLoad.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/KanbanDisplay2/kanbanDisplay2.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/MechanicalArm/mechanicalArm.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/MechanicalReport/mechanicalReport.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/common/servicebase/src/main/java/com/mes/service/ModbusTcp.java
@@ -2,23 +2,18 @@
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;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import static com.mes.tools.HexConversion.*;
import static com.mes.tools.HexConversion.intToBytesDesc;
@Component
@Slf4j
@@ -46,7 +41,7 @@
    public void connect(){
        try {
            this.socket=new Socket(Ip,Port);
            this.socket.setSoTimeout(1000);
            this.socket.setSoTimeout(300);
        }catch (Exception e) {
            log.info("The IP address of the host cannot be determined:{}",e.getMessage());
        }
@@ -102,7 +97,10 @@
                    bit[0]=Byte.parseByte(fontBitString[plcParameter.getAddressLength()]);
                    plcParameter.setReadByte(bit);
                }else{
                    plcParameter.setReadByte(Arrays.copyOfRange(content,plcParameter.getAddressStart(),(plcParameter.getAddressStart()+plcParameter.getAddressLength())));
                    String plcAddressBegin = plcAgreement.plcAddressBegin;
                    Integer addressIndex = plcParameter.getAddressStart();
                    int address = addressIndex -HexUtil.hexToInt(plcAddressBegin)*2;
                    plcParameter.setReadByte(Arrays.copyOfRange(content,address,(address+plcParameter.getAddressLength())));
                }
            }
            return true;
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/AppRunnerConfig.java
@@ -1,7 +1,6 @@
package com.mes;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mes.common.*;
import com.mes.md.entity.Machine;
import com.mes.md.mapper.MachineMapper;
import com.mes.md.mapper.PrimitiveTaskMapper;
@@ -17,7 +16,6 @@
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@@ -45,6 +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> 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){
@@ -62,6 +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:machineListRotate){
            new MachineRotate(item,machineMapper,taskingService).start();
        }
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/controller/PrimitiveTaskController.java
@@ -4,7 +4,9 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mes.md.entity.KBBTJPDrawingBP;
import com.mes.md.entity.PrimitiveTask;
import com.mes.md.entity.TaskingLog;
import com.mes.md.mapper.KBBTJPDrawingBPMapper;
import com.mes.md.mapper.TaskingLogMapper;
import com.mes.md.service.KBBTJPDrawingBPService;
import com.mes.md.service.PrimitiveTaskService;
import com.mes.md.service.TaskingLogService;
@@ -38,6 +40,8 @@
    KBBTJPDrawingBPMapper kBBTJPDrawingBPMapper;
    @Autowired
    TaskingLogService taskingLogService;
    @Autowired
    TaskingLogMapper taskingLogMapper;
    @ApiOperation("查询当前设备,未完工状态的线上任务")
    @PostMapping("/selectPrimitiveTask")
@@ -161,5 +165,68 @@
        }
        return Result.build(200,"成功",resultDate);
    }
    @ApiOperation("查询 完成量 m² 片数")
    @PostMapping("/findFinishQuantity")
    @ResponseBody
    public Result findFinishQuantity(@RequestBody Map<String, String> map) {
        Calendar cal = Calendar.getInstance();
        //设置当前时间
        cal.setTime(new Date());
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        //cal.add(Calendar.DATE, 1-dayCount);
        cal.set(Calendar.DAY_OF_MONTH, 1);
        Date startDate = cal.getTime();
        // 获取当月最后一天
        Calendar lastDayCal = (Calendar) cal.clone();
        lastDayCal.add(Calendar.MONTH, 1);
        lastDayCal.add(Calendar.DATE, -1);
        Date endDate = lastDayCal.getTime();
        // 获取当月天数
        int dayCount = lastDayCal.get(Calendar.DAY_OF_MONTH);
        QueryWrapper<TaskingLog> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("CAST(operation_record_time AS DATE) AS CreateDate,ifNull(sum(task_quantity),0) as task_quantity_sum,ifNull(sum(length*width*task_quantity)/1000000,0) as area_sum")
                .ge("operation_record_time",startDate).le("operation_record_time",endDate).eq("work_state","完工").groupBy("CAST(operation_record_time AS DATE)")
                .orderByAsc("CAST(operation_record_time AS DATE)");;
        List<Map> list=taskingLogMapper.selectMaps((QueryWrapper)queryWrapper);
        List<Map> resultDate=new ArrayList<>();
        // 重置日历到当月第一天
        cal.setTime(startDate);
         for (int i=0;i<dayCount;i++){
            Date thisdate=cal.getTime();
            cal.add(Calendar.DATE, 1);
            Map thisMap=new HashMap<>();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String dateString = sdf.format(thisdate);
            thisMap.put("CreateDate",dateString);
//            if(list.size()>0){
//                log.info("对比:{},{},{}",list.get(0).get("CreateDate"),dateString,list.get(0).get("CreateDate").toString().equals(dateString));
//            }
            if (list.size()>0&&list.get(0).get("CreateDate").toString().equals(dateString)){
                thisMap.put("task_quantity_sum",list.get(0).get("task_quantity_sum"));
                thisMap.put("area_sum",list.get(0).get("area_sum"));
                list.remove(0);
            }else{
                thisMap.put("task_quantity_sum",0);
                thisMap.put("area_sum",0);
            }
            resultDate.add(thisMap);
        }
        return Result.build(200,"成功",resultDate);
    }
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/KBBTJPDrawingBP.java
@@ -4,7 +4,6 @@
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;
@@ -175,6 +174,12 @@
    @TableField(value = "OrderNo")
    private String OrderNo;
    /**
     * 产品类型
     */
    @TableField(value = "JPZX")
    private Integer JPZX;
//
//    @TableField(value = "report_line")
//    private int reportLine;
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/PrimitiveTask.java
@@ -3,11 +3,11 @@
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;
import java.io.Serializable;
import java.util.Date;
/**
 * <p>
@@ -182,4 +182,9 @@
     */
    private Integer loadCount;
    /**
     * 产品类型
     */
    @TableField(value = "JPZX")
    private Integer JPZX;
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/Tasking.java
@@ -1,12 +1,13 @@
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;
import java.io.Serializable;
import java.util.Date;
/**
 * <p>
@@ -191,4 +192,10 @@
     */
    private String warehouse;
    /**
     * 产品类型
     */
    @TableField(value = "JPZX")
    private Integer JPZX;
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/entity/TaskingLog.java
@@ -1,7 +1,6 @@
package com.mes.md.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -186,4 +185,10 @@
     */
    private Integer isSend;
    /**
     * 产品类型
     */
    @TableField(value = "JPZX")
    private Integer JPZX;
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/LineConfigurationService.java
@@ -1,7 +1,6 @@
package com.mes.md.service;
import com.github.yulichang.base.MPJBaseService;
import com.mes.md.entity.Line;
import com.mes.md.entity.LineConfiguration;
import com.mes.md.entity.Machine;
@@ -16,5 +15,6 @@
public interface LineConfigurationService extends MPJBaseService<LineConfiguration> {
    LineConfiguration machineLineConfiguration(Machine machine);
    LineConfiguration machineLineConfigurationBefore(Machine machine);
    LineConfiguration machineLineConfigurationBeforeEdg(Machine machine);
    LineConfiguration machineLineConfigurationAfter(Machine machine);
}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/KBBTJPDrawingBPServiceImpl.java
@@ -2,19 +2,15 @@
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;
@@ -99,6 +95,7 @@
            primitiveTask.setSilkScreenY(kBBTJPDrawingBP.getSilkScreenY()==null?0:kBBTJPDrawingBP.getSilkScreenY());
            primitiveTask.setTaskSequence(kBBTJPDrawingBP.getTaskSequence());
            primitiveTask.setTaskQuantity(kBBTJPDrawingBP.getTaskQuantity());
            primitiveTask.setJPZX(kBBTJPDrawingBP.getJPZX());
            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());
@@ -138,6 +135,7 @@
            tasking.setSilkScreenY(kBBTJPDrawingBP.getSilkScreenY()==null?0:kBBTJPDrawingBP.getSilkScreenY());
            tasking.setTaskSequence(kBBTJPDrawingBP.getTaskSequence());
            tasking.setTaskQuantity(kBBTJPDrawingBP.getTaskQuantity());
            tasking.setJPZX(kBBTJPDrawingBP.getJPZX());
            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());
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/service/impl/LineConfigurationServiceImpl.java
@@ -2,13 +2,10 @@
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;
@@ -63,6 +60,33 @@
        return null;
    }
    /**
     * 磨边识别上片设备配置
     * @param machine
     * @return
     */
    @Override
    public LineConfiguration machineLineConfigurationBeforeEdg(Machine machine){
        List<LineConfiguration> machineLineConfiguration=baseMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>()
                .selectAll(LineConfiguration.class)
                .eq(LineConfiguration::getMachineId,machine.getId()));
        if(!machineLineConfiguration.isEmpty()){
            List<LineConfiguration> machineLineConfigurationBefore=baseMapper.selectJoinList(LineConfiguration.class,new MPJLambdaWrapper<LineConfiguration>()
                    .selectAll(LineConfiguration.class)
                    .eq(LineConfiguration::getLineId,machineLineConfiguration.get(0).getLineId())
                    .eq(LineConfiguration::getIsStart,1)
                    .lt(LineConfiguration::getProcessSequence,machineLineConfiguration.get(0).getProcessSequence())
                    .orderByDesc(LineConfiguration::getProcessSequence));
            if (!machineLineConfigurationBefore.isEmpty()){
                return machineLineConfigurationBefore.get(1);
            }
        }
        return null;
    }
    /**
     * @param machine 当前设备的下一设备配置
     * @return
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineDispensing.java
New file
@@ -0,0 +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");//发送ID
////        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, "正在工作");
//            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();
//            }
//        }
//    }
//}
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineEdging.java
@@ -196,7 +196,7 @@
                    &&"开工".equals(machine.getState())
                    &&taskingCount.size()<machine.getMaxTaskCount())){
                //Machine loadMachine=machineMapper.selectById(2L);
                LineConfiguration lineConfigurationBefore=lineConfigurationService.machineLineConfigurationBefore(machine);
                LineConfiguration lineConfigurationBefore=lineConfigurationService.machineLineConfigurationBeforeEdg(machine);
                Machine loadMachine=machineMapper.selectById(lineConfigurationBefore.getMachineId());
                Tasking tasking;
                String scan_id="";
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/plcTaskThread/MachineLoad.java
@@ -1,10 +1,8 @@
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;
@@ -17,8 +15,9 @@
import com.mes.utils.HexUtil;
import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Slf4j
public class MachineLoad extends Thread{
@@ -50,7 +49,7 @@
        Machine machine=machineMapper.selectById(thisMachine.getId());
        ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),machine.getFileName());
        modbusTcp1.connect();
        PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement("PlcLoad");
        PlcAgreement plcAgreement=modbusTcp1.getPlcAgreement(machine.getFileName());
        try {
            if(!modbusTcp1.read(plcAgreement)){
                log.info("通讯读取新数据失败");
UI-Project/src/views/KanbanDisplay2/kanbanDisplay2.vue
@@ -98,7 +98,7 @@
// 计划量数据
const loadPlannedData = async () => {
  try {
    const res = await request.post('/deviceInteraction/primitiveTask/findPlannedQuantity', {});
    const res = await request.post('/deviceInteraction/primitiveTask/findFinishQuantity', {});
    if (res.code === 200) {
      // 确保数据存在
      if (res.data && Array.isArray(res.data)) {
UI-Project/src/views/MechanicalArm/mechanicalArm.vue
@@ -87,6 +87,7 @@
  socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数
  //使用WebSocket方式展示数据
  socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数
});
//报警提示
const errorInfoFuntion = async (info) => {
@@ -429,7 +430,7 @@
        <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)">{{
            <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row, findMachine.id, 1)">{{
              $t('functionState.getTask') }}</el-button>
          </template>
        </el-table-column>
UI-Project/src/views/MechanicalReport/mechanicalReport.vue
@@ -201,7 +201,6 @@
  return time.getTime() > oneMonthLater.getTime()
}
// 限制开始日期不能离结束日期超过一个月
const disabledStartDate = (time) => {
  if (!filterForm.value.endDate) {
    return false