1、大理片笼进片逻辑调整:a、将扫描id后进生成任务信息,不执行卧转立进片命令;
b、进片车空闲扫描,如果存在卧转立有满片的直接启动,
2、下片任务新增任务向plc发送任务信息
3、对外提供手工生成人工下片任务
10个文件已修改
712 ■■■■■ 已修改文件
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/S7object.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/JsonFile/PlcCacheVerticalGlass.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/controller/DownGlassTaskController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/entity/DownGlassTask.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/DownGlassInfoService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownLoadCacheGlassTask.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcdownGlass.json 502 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/common/S7object.java
@@ -14,7 +14,7 @@
public class S7object extends Thread {
    public S7control plccontrol; // PLC通讯类实例
    private EPlcType plcType = EPlcType.S1200; // 西门子PLC类型
    private String ip = "192.168.10.1"; // plc ip地址
    private String ip = "192.168.20.100"; // plc ip地址
    private int port = 102; // plc 端口号
@@ -25,7 +25,7 @@
        if (plccontrol == null) {
            plccontrol = new S7control(plcType, ip, port, 0, 0);
            String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcCacheVerticalGlass.json").getPath();
            String PlcLoadGlass = S7object.class.getResource("/JsonFile/PlcCacheVerticalGlass.json").getPath();
            //log.info(PLCAutoMes.class.getResource("").getPath());
            PlcMesObject = InitUtil.initword(PlcLoadGlass);
        }
@@ -54,8 +54,9 @@
            }
            byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength());
            PlcMesObject.setPlcParameterList(getplcvlues);
            if (getplcvlues != null) {
                PlcMesObject.setPlcParameterList(getplcvlues);
            }
        }
    }
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
@@ -78,11 +78,11 @@
    @Value("${mes.galssGap}")
    private Integer galssGap;
    @Scheduled(fixedDelay = 5000)
    //    @Scheduled(fixedDelay = 5000)
    public void plcToHomeEdgScan() {
        PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
        String d01Id = plcParameterObject.getPlcParameter("D01ID1").getValue();
        String d02Id = plcParameterObject.getPlcParameter("D02ID1").getValue();
        String d01Id = plcParameterObject.getPlcParameter("D01ID").getValue();
        String d02Id = plcParameterObject.getPlcParameter("D02ID").getValue();
        String d03State = plcParameterObject.getPlcParameter("D03State").getValue();
        String d05State = plcParameterObject.getPlcParameter("D05State").getValue();
        String mesD03Address = plcParameterObject.getPlcParameter("MESToD03").getAddress();
@@ -98,27 +98,28 @@
            log.info("两条线卧转立均在执行任务,结束本次扫描进卧转立任务");
            return;
        }
        Boolean flag01 = Boolean.FALSE;
        Boolean flag04 = Boolean.FALSE;
//        Boolean flag01 = Boolean.FALSE;
//        Boolean flag04 = Boolean.FALSE;
        //按照线路及玻璃id获取相邻两块玻璃 卧转立上的玻璃
        if (StringUtils.isBlank(d01Id) && !REQUEST_WORD.equals(d03State)) {
            flag01 = judgeGlassTypeStatus(d01Id, Const.A09_OUT_TARGET_POSITION, mesD03Address);
        if (StringUtils.isNotBlank(d01Id) && !REQUEST_WORD.equals(d03State)) {
            judgeGlassTypeStatus(d01Id, Const.A09_OUT_TARGET_POSITION, mesD03Address);
        }
        if (StringUtils.isBlank(d02Id) && !REQUEST_WORD.equals(d05State)) {
            flag04 = judgeGlassTypeStatus(d02Id, Const.A10_OUT_TARGET_POSITION, mesD05Address);
        if (StringUtils.isNotBlank(d02Id) && !REQUEST_WORD.equals(d05State)) {
            judgeGlassTypeStatus(d02Id, Const.A10_OUT_TARGET_POSITION, mesD05Address);
        }
        if (flag01 && flag04) {
            //比较最早一片任务的版图id及版序 求出卧转立的线路
            Integer startLine = getStartLine();
            //计算目标格子,发送启动任务
            computeTargetByLine(startLine);
        } else if (flag01 || flag04) {
            Integer startLine = flag01.equals(Boolean.TRUE) ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
            //计算目标格子,发送启动任务
            computeTargetByLine(startLine);
        } else {
            log.info("两条线未收到进片任务,结束本次扫描进卧转立任务");
        }
        log.info("结束扫码任务");
//        if (flag01 && flag04) {
//            //比较最早一片任务的版图id及版序 求出卧转立的线路
//            Integer startLine = getStartLine();
//            //计算目标格子,发送启动任务
//            computeTargetByLine(startLine);
//        } else if (flag01 || flag04) {
//            Integer startLine = flag01.equals(Boolean.TRUE) ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION;
//            //计算目标格子,发送启动任务
//            computeTargetByLine(startLine);
//        } else {
//            log.info("两条线未收到进片任务,结束本次扫描进卧转立任务");
//        }
    }
    @Scheduled(fixedDelay = 5000)
@@ -129,10 +130,24 @@
            log.info("进片大车非空闲");
            return;
        }
        String d01Id = plcParameterObject.getPlcParameter("D01ID1").getValue();
        String d02Id = plcParameterObject.getPlcParameter("D02ID1").getValue();
        List<BigStorageCageFeedTask> feedTaskList = bigStorageCageFeedTaskService.list(new LambdaQueryWrapper<BigStorageCageFeedTask>()
                .eq(BigStorageCageFeedTask::getTaskType, Const.BIG_STORAGE_IN_RUN)
                .eq(BigStorageCageFeedTask::getTaskState, Const.BIG_STORAGE_IN_UP));
        if (CollectionUtils.isNotEmpty(feedTaskList)) {
            if (feedTaskList.size() == 1) {
                computeTargetByLine(feedTaskList.get(0).getLine());
                return;
            } else {
                //比较最早一片任务的版图id及版序 求出卧转立的线路
                Integer startLine = getStartLine();
//            //计算目标格子,发送启动任务
                computeTargetByLine(startLine);
                return;
            }
        }
        String d01Id = plcParameterObject.getPlcParameter("D01ID").getValue();
        String d02Id = plcParameterObject.getPlcParameter("D02ID").getValue();
        log.info("1、获取d01Id扫描ID为:{};获取d02Id扫描ID为:{};", d01Id, d02Id);
        ;
        //两条线都有进卧转立任务,直接结束
        if (StringUtils.isNotBlank(d01Id) && StringUtils.isNotBlank(d02Id)) {
            log.info("两条线都存在进片任务,结束任务");
@@ -168,7 +183,7 @@
        computeTargetByLine(outLine);
    }
    @Scheduled(fixedDelay = 5000)
    //    @Scheduled(fixedDelay = 5000)
    public void plcToHomeEdgOutTask() {
        List<BigStorageCageOutTask> outingList = bigStorageCageOutTaskService.list(new LambdaQueryWrapper<BigStorageCageOutTask>().eq(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_OUT_NEW));
@@ -253,17 +268,19 @@
            remainWidth = sitToUpRemainWidth.getWidth();
            glassCount = sitToUpRemainWidth.getGlassCount();
        }
        Boolean flag = Boolean.TRUE;
        //2、获取卧转立
        Integer widthFirst = edgGlassTaskInfoList.get(0).getWidth();
        if (edgGlassTaskInfoList.size() == 1) {
            if (remainWidth >= widthFirst) {
                if (glassCount <= 5) {
                    addFeedTask(glassId, line, Const.BIG_STORAGE_IN_WAIT, widthFirst);
                    return Boolean.FALSE;
                } else {
                    addFeedTask(glassId, line, Const.BIG_STORAGE_IN_RUN, widthFirst);
                    return Boolean.TRUE;
                }
            } else {
                flag = Boolean.FALSE;
            }
        } else {
            Integer widthSecond = edgGlassTaskInfoList.get(1).getWidth();
@@ -271,20 +288,22 @@
                if (remainWidth - widthFirst - galssGap >= widthSecond) {
                    if (glassCount <= carMaxSize - 1) {
                        addFeedTask(glassId, line, Const.BIG_STORAGE_IN_WAIT, widthFirst);
                        return Boolean.FALSE;
                    } else {
                        addFeedTask(glassId, line, Const.BIG_STORAGE_IN_RUN, widthFirst);
                        return Boolean.TRUE;
                    }
                } else {
                    addFeedTask(glassId, line, Const.BIG_STORAGE_IN_RUN, widthFirst);
                }
            } else {
                flag = Boolean.FALSE;
            }
        }
        //向plc发送进片确认
        S7object.getinstance().plccontrol.writeWord(mesAddress, (short) 1);
        if (flag) {
            S7object.getinstance().plccontrol.writeWord(mesAddress, (short) 1);
        }
        //记录无法放下玻璃,后续判断启动
        return Boolean.TRUE;
        return flag;
    }
    /**
@@ -332,7 +351,7 @@
        //2、去笼子内查找是否可以继续存放的笼子
        List<String> glassIds = taskList.stream().map(BigStorageCageFeedTask::getGlassId).collect(Collectors.toList());
        List<GlassInfo> glassInfos = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>().in(GlassInfo::getGlassId, glassIds));
        return computeIsTemperingTargetByLine(glassInfos, taskList, line) && computeIsTemperingTargetByLine(glassInfos, taskList, line);
        return computeIsTemperingTargetByLine(glassInfos, taskList, line);
    }
    /**
@@ -368,7 +387,6 @@
            cageDetails.setState(Const.GLASS_STATE_IN);
            bigStorageCageDetailsService.save(cageDetails);
        }
        //todo:按照进片信息向打车发送进车数据
        sendTaskListToPLC(taskList, line);
        return Boolean.TRUE;
    }
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/JsonFile/PlcCacheVerticalGlass.json
@@ -1,6 +1,6 @@
{
    "plcAddressBegin": "DB14.0",
    "plcAddressLenght": "894",
    "plcAddressLenght": "938",
    "dataType": "word",
    "parameteInfor": [{
            "codeId": "D01ID",
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/controller/DownGlassTaskController.java
@@ -1,9 +1,12 @@
package com.mes.downglassinfo.controller;
import io.swagger.annotations.Api;
import com.mes.downglassinfo.service.DownGlassInfoService;
import com.mes.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -20,5 +23,14 @@
@RequestMapping("/downGlassTask")
public class DownGlassTaskController {
    @Autowired
    DownGlassInfoService downGlassInfoService;
    @PostMapping("/generateOutGlassTask")
    @ApiOperation(value = "生成出片任务", notes = "生成出片任务")
    public Result<Boolean> generateOutGlassTask(@RequestBody String glassId) {
        return Result.success(downGlassInfoService.generateOutGlassTask(glassId));
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/entity/DownGlassTask.java
@@ -73,6 +73,10 @@
     * 流程卡号
     */
    private String flowCardId;
    /**
     * 层号
     */
    private int layer;
    /**
     * 任务状态 0 未开始  1正在进行   2完成
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/DownGlassInfoService.java
@@ -13,7 +13,7 @@
     * @param flowCardId
     * @return // 根据流程卡号查询最大序号
     */
    Integer getMaxSequenceByFlowCardId(String flowCardId);
    Integer getMaxSequenceByFlowCardId(String flowCardId, int layer);
    /**
     * @param downGlassInfo 插入下片信息
@@ -32,4 +32,12 @@
     * @return
     */
    List<DownGlassInfoDTO> queryWorkStationIsIn(Boolean isDownload);
    /**
     * 生成出片任务
     *
     * @param glassId
     * @return
     */
    boolean generateOutGlassTask(String glassId);
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java
@@ -1,12 +1,20 @@
package com.mes.downglassinfo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.common.config.Const;
import com.mes.downglassinfo.entity.DownGlassInfo;
import com.mes.downglassinfo.mapper.DownGlassInfoMapper;
import com.mes.downglassinfo.service.DownGlassInfoService;
import com.mes.downstorage.entity.DownStorageCageDetails;
import com.mes.downstorage.service.DownStorageCageDetailsService;
import com.mes.downworkstation.entity.dto.DownGlassInfoDTO;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.job.DownLoadCacheGlassTask;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -14,13 +22,20 @@
@Service
public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService {
    @Autowired
    DownLoadCacheGlassTask downLoadCacheGlassTask;
    @Autowired
    DownStorageCageDetailsService downStorageCageDetailsService;
    /**
     * 根据流程卡号查询最大序号
     */
    @Override
    public Integer getMaxSequenceByFlowCardId(String flowCardId) {
    public Integer getMaxSequenceByFlowCardId(String flowCardId, int layer) {
        LambdaQueryWrapper<DownGlassInfo> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(DownGlassInfo::getFlowCardId, flowCardId)
                .eq(DownGlassInfo::getLayer, flowCardId)
                .select(DownGlassInfo::getSequence)
                .orderByDesc(DownGlassInfo::getSequence)
                .last("LIMIT 1");
@@ -48,4 +63,23 @@
    public List<DownGlassInfoDTO> queryWorkStationIsIn(Boolean isDownload) {
        return baseMapper.queryWorkStationIsIn(isDownload);
    }
    @Override
    public boolean generateOutGlassTask(String glassId) {
        //更新卧式理片笼内玻璃状态
        downStorageCageDetailsService.update(new LambdaUpdateWrapper<DownStorageCageDetails>()
                .set(DownStorageCageDetails::getState, Const.GLASS_STATE_OUT).eq(DownStorageCageDetails::getGlassId, glassId));
        DownStorageCageDetails details = downStorageCageDetailsService.getOne(new LambdaQueryWrapper<DownStorageCageDetails>()
                .eq(DownStorageCageDetails::getGlassId, glassId));
        //生成下片信息
        DownGlassInfo downGlassInfo = new DownGlassInfo();
        BeanUtils.copyProperties(details, downGlassInfo);
        //获取当前流程卡最大片序
        downGlassInfo.setSequence(this.getMaxSequenceByFlowCardId(details.getFlowCardId(), details.getLayer()) + 1);
        this.save(downGlassInfo);
        //生成任务信息 并向plc发送出片任务
        GlassInfo glassInfo = new GlassInfo();
        BeanUtils.copyProperties(details, glassInfo);
        return downLoadCacheGlassTask.initDownGlassTask(glassInfo, details.getSlot(), 3001, 2);
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java
@@ -17,7 +17,6 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
@@ -52,7 +51,7 @@
    //    @Value("${mes.threshold}")
    private int threshold;
    @Scheduled(fixedDelay = 1000)
//    @Scheduled(fixedDelay = 1000)
    public void autoBindRack() {
        log.info("根据缓存中已经进片的玻璃种数量最多的流程卡号自动绑定一个启用状态的空架子");
@@ -277,7 +276,7 @@
                    // 创建新的 DownGlassInfo 对象并设置相关属性
                    DownGlassInfo newdownGlassInfo = new DownGlassInfo();
                    Integer maxSequence = downGlassInfoService.getMaxSequenceByFlowCardId(downGlassInfo.getFlowCardId());
                    Integer maxSequence = downGlassInfoService.getMaxSequenceByFlowCardId(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer());
                    // 初始化顺序字段值
                    int sequence = maxSequence != null ? maxSequence + 1 : 1;
                    BeanUtils.copyProperties(downGlassInfo, newdownGlassInfo);
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownLoadCacheGlassTask.java
@@ -20,6 +20,7 @@
import com.mes.downworkstation.service.DownWorkstationService;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.tools.S7control;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
@@ -75,16 +76,18 @@
    public void plcHomeEdgTask() {
        PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
        String requestWord = plcParameterObject.getPlcParameter("RequestWord").getValue();
        String glassIdeValue = plcParameterObject.getPlcParameter("G04ID").getValue();
        String confirmationWrodValue = plcParameterObject.getPlcParameter("MES_confirmation_word").getValue();
        String glassIdeValue = plcParameterObject.getPlcParameter("requestID").getValue();
        //A08  A09表示线路相同  可做等价  无数据转int异常
        String out08Glassstate = plcParameterObject.getPlcParameter("A08_glass_status").getValue();
        String out10Glassstate = plcParameterObject.getPlcParameter("A10_glass_status").getValue();
        String confirmationWrodAddress = plcParameterObject.getPlcParameter("MES_confirmation_word").getAddress();
        String currentSlot = plcParameterObject.getPlcParameter("Current_slot").getValue();
        String out06Glassstate = plcParameterObject.getPlcParameter("glassStatus06").getValue();
        String out08Glassstate = plcParameterObject.getPlcParameter("glassStatus08").getValue();
        String out11Glassstate = plcParameterObject.getPlcParameter("glassStatus11").getValue();
        String out13Glassstate = plcParameterObject.getPlcParameter("glassStatus13").getValue();
        String confirmationWrodValue = plcParameterObject.getPlcParameter("confirmationWord").getValue();
        String confirmationWrodAddress = plcParameterObject.getPlcParameter("confirmationWord").getAddress();
        String currentSlot = plcParameterObject.getPlcParameter("currentCell").getValue();
        log.info("1、获取到的请求字为:{},获取到的扫描ID为:{},获取到的确认字为:{},获取到的出片状态分别为:A09:{}、A10:{},当前格子号为:{}",
                requestWord, glassIdeValue, confirmationWrodValue, out08Glassstate, out10Glassstate, currentSlot);
        log.info("1、获取到的请求字为:{},获取到的扫描ID为:{},获取到的确认字为:{},获取到的出片状态分别为:g06:{}、g08:{}、g11:{}、g13:{},当前格子号为:{}",
                requestWord, glassIdeValue, confirmationWrodValue, out06Glassstate, out08Glassstate, out11Glassstate, out13Glassstate, currentSlot);
        if ("0".equals(requestWord)) {
            if ("0".equals(confirmationWrodValue)) {
@@ -208,9 +211,6 @@
        downStorageCageDetailsService.save(downStorageCageDetails);
//        生成进片任务
        initDownGlassTask(glassInfo, 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN);
        //log.info("5、生成进片任务信息存入任务表是否完成:{}", taskCache);
//        S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 1);
//        log.info("6、发送确认字完成");
    }
    public Boolean outTo(String glassStatus06, String glassStatus11, String glassStatus13, String glassId) {
@@ -419,7 +419,7 @@
        }
    }
    private Boolean generateDownGlassOutTask(String glassId, Integer taskType, Boolean isBind, DownStorageCageDetails cageDetails) {
    public Boolean generateDownGlassOutTask(String glassId, Integer taskType, Boolean isBind, DownStorageCageDetails cageDetails) {
        //按玻璃id获取玻璃信息
        DownStorageCageDetails downStorageCageDetails = null;
        if (glassId.equals(cageDetails.getGlassId())) {
@@ -468,7 +468,7 @@
        return initDownGlassTask(glassInfo, downStorageCageDetails.getSlot(), endCell, taskType);
    }
    private Boolean initDownGlassTask(GlassInfo glassInfo, Integer startCell, Integer endCell, Integer taskType) {
    public Boolean initDownGlassTask(GlassInfo glassInfo, Integer startCell, Integer endCell, Integer taskType) {
        log.info("玻璃{}生成进片任务", glassInfo.getGlassId());
        DownGlassTask downGlassTask = new DownGlassTask();
        downGlassTask.setStartCell(startCell);
@@ -480,6 +480,22 @@
        downGlassTask.setFlowCardId(glassInfo.getFlowCardId());
        downGlassTask.setTaskStauts(0);
        downGlassTask.setCreateTime(new Date());
        return downGlassTaskService.save(downGlassTask);
        downGlassTaskService.save(downGlassTask);
        //向plc发送命令
        return sendMessageToPlc((int) glassInfo.getWidth(), (int) glassInfo.getHeight(), (int) glassInfo.getThickness(),
                startCell, endCell, taskType);
    }
    private Boolean sendMessageToPlc(int width, int height, int thickness, int startCell, int endCell, int taskType) {
        S7control s7control = S7object.getinstance().plccontrol;
        PlcParameterObject plcMesObject = S7object.getinstance().PlcMesObject;
        s7control.writeWord(plcMesObject.getPlcParameter("Glass_width").getAddress(), (short) width * 10);
        s7control.writeWord(plcMesObject.getPlcParameter("Glass_height").getAddress(), (short) height * 10);
        s7control.writeWord(plcMesObject.getPlcParameter("Glass_thickness").getAddress(), (short) thickness * 10);
        s7control.writeWord(plcMesObject.getPlcParameter("Start_cell").getAddress(), (short) startCell);
        s7control.writeWord(plcMesObject.getPlcParameter("End_cell").getAddress(), (short) endCell);
        s7control.writeWord(plcMesObject.getPlcParameter("task_type").getAddress(), (short) taskType);
        s7control.writeWord(plcMesObject.getPlcParameter("confirmationWord").getAddress(), (short) 1);
        return Boolean.TRUE;
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcdownGlass.json
@@ -1,362 +1,144 @@
{
  "plcAddressBegin": "DB100.0",
  "plcAddressLenght": "230",
  "dataType": "word",
  "parameteInfor": [
    {
      "codeId": "RequestWord",
      "addressIndex": "0",
      "addressLenght": "2"
    },
    {
      "codeId": "G04ID",
      "addressIndex": "30",
      "addressLenght": "30"
    },
    {
      "codeId": "G06RobotTaskRequestWord",
      "addressIndex": "32",
      "addressLenght": "2"
    },
    {
      "codeId": "G06ID",
      "addressIndex": "62",
      "addressLenght": "30"
    },
    {
      "codeId": "G11RobotTaskRequestWord",
      "addressIndex": "64",
      "addressLenght": "2"
    },
    {
      "codeId": "G011ID",
      "addressIndex": "94",
      "addressLenght": "30"
    },
    {
      "codeId": "spare",
      "addressIndex": "96",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "98",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "100",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "102",
      "addressLenght": "2"
    },
    {
      "codeId": "MESSendingWord",
      "addressIndex": "104",
      "addressLenght": "2"
    },
    {
      "codeId": "InputGrid",
      "addressIndex": "106",
      "addressLenght": "2"
    },
    {
      "codeId": "OutputGrid",
      "addressIndex": "108",
      "addressLenght": "2"
    },
    {
      "codeId": "OutputID",
      "addressIndex": "110",
      "addressLenght": "2"
    },
    {
      "codeId": "FrontOrRearLowerSlice",
      "addressIndex": "112",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "114",
      "addressLenght": "2"
    },
    {
      "codeId": "G06RobotTaskReply",
      "addressIndex": "116",
      "addressLenght": "2"
    },
    {
      "codeId": "G06Rack",
      "addressIndex": "118",
      "addressLenght": "2"
    },
    {
      "codeId": "G11RobotTaskReply",
      "addressIndex": "120",
      "addressLenght": "2"
    },
    {
      "codeId": "G11Rack",
      "addressIndex": "122",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "124",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "126",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "128",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "130",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "132",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "134",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "136",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "138",
      "addressLenght": "2"
    },
    {
      "codeId": "MESTaskState",
      "addressIndex": "140",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "142",
      "addressLenght": "2"
    },
    {
      "codeId": "AlarmState",
      "addressIndex": "144",
      "addressLenght": "2"
    },
    {
      "codeId": "Alarm1",
      "addressIndex": "146",
      "addressLenght": "2"
    },
    {
      "codeId": "Alarm2",
      "addressIndex": "148",
      "addressLenght": "2"
    },
    {
      "codeId": "Alarm3",
      "addressIndex": "150",
      "addressLenght": "2"
    },
    {
      "codeId": "Alarm4",
      "addressIndex": "152",
      "addressLenght": "2"
    },
    {
      "codeId": "neirong",
      "addressIndex": "154",
      "addressLenght": "2"
    },
    {
      "codeId": "device",
      "addressIndex": "156",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "158",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "160",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut1",
      "addressIndex": "162",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut2",
      "addressIndex": "164",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut3",
      "addressIndex": "166",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut4",
      "addressIndex": "168",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut5",
      "addressIndex": "170",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut6",
      "addressIndex": "172",
      "addressLenght": "2"
    },
    {
      "codeId": "InOut7",
      "addressIndex": "174",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "176",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "178",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "180",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "182",
      "addressLenght": "2"
    },
    {
      "codeId": "spare",
      "addressIndex": "184",
      "addressLenght": "2"
    },
    {
      "codeId": "G04ActionState",
      "addressIndex": "186",
      "addressLenght": "2"
    },
    {
      "codeId": "G05ActionState",
      "addressIndex": "190",
      "addressLenght": "2"
    },
    {
      "codeId": "G06ActionState",
      "addressIndex": "192",
      "addressLenght": "2"
    },
    {
      "codeId": "G07ActionState",
      "addressIndex": "194",
      "addressLenght": "2"
    },
    {
      "codeId": "G08ActionState",
      "addressIndex": "196",
      "addressLenght": "2"
    },
    {
      "codeId": "G09ActionState",
      "addressIndex": "200",
      "addressLenght": "2"
    },
    {
      "codeId": "G10ActionState",
      "addressIndex": "202",
      "addressLenght": "2"
    },
    {
      "codeId": "G11ActionState",
      "addressIndex": "204",
      "addressLenght": "2"
    },
    {
      "codeId": "G12ActionState",
      "addressIndex": "206",
      "addressLenght": "2"
    },
    {
      "codeId": "G13ActionState",
      "addressIndex": "208",
      "addressLenght": "2"
    },
    {
      "codeId": "G04IDS",
      "addressIndex": "210",
      "addressLenght": "2"
    },
    {
      "codeId": "G05IDS",
      "addressIndex": "212",
      "addressLenght": "2"
    },
    {
      "codeId": "G06IDS",
      "addressIndex": "214",
      "addressLenght": "2"
    },
    {
      "codeId": "G07IDS",
      "addressIndex": "216",
      "addressLenght": "2"
    },
    {
      "codeId": "G08IDS",
      "addressIndex": "218",
      "addressLenght": "2"
    },
    {
      "codeId": "G09IDS",
      "addressIndex": "220",
      "addressLenght": "2"
    },
    {
      "codeId": "G10IDS",
      "addressIndex": "222",
      "addressLenght": "2"
    },
    {
      "codeId": "G11IDS",
      "addressIndex": "224",
      "addressLenght": "2"
    },
    {
      "codeId": "G12IDS",
      "addressIndex": "226",
      "addressLenght": "2"
    },
    {
      "codeId": "G13ID",
      "addressIndex": "230",
      "addressLenght": "2"
    }
  ]
    "plcAddressBegin": "DB100.0",
    "plcAddressLenght": "100",
    "dataType": "word",
    "parameteInfor": [
        {
            "codeId": "requestWord",
            "addressIndex": "0",
            "addressLenght": "2"
        },
        {
            "codeId": "requestID",
            "addressIndex": "2",
            "addressLenght": "30"
        },
        {
            "codeId": "currentCell",
            "addressIndex": "32",
            "addressLenght": "2"
        },
        {
            "codeId": "glassStatus08",
            "addressIndex": "36",
            "addressLenght": "2"
        },
        {
            "codeId": "G06_glass_status",
            "addressIndex": "40",
            "addressLenght": "2"
        },
        {
            "codeId": "G11_glass_status",
            "addressIndex": "42",
            "addressLenght": "2"
        },
        {
            "codeId": "G13_glass_status",
            "addressIndex": "44",
            "addressLenght": "2"
        },
        {
            "codeId": "G04_error_status",
            "addressIndex": "48",
            "addressLenght": "2"
        },
        {
            "codeId": "G05_error_status",
            "addressIndex": "50",
            "addressLenght": "2"
        },
        {
            "codeId": "G06_error_status",
            "addressIndex": "52",
            "addressLenght": "2"
        },
        {
            "codeId": "robot_error_status",
            "addressIndex": "54",
            "addressLenght": "2"
        },
        {
            "codeId": "G08_error_status",
            "addressIndex": "56",
            "addressLenght": "2"
        },
        {
            "codeId": "G09_error_status",
            "addressIndex": "58",
            "addressLenght": "2"
        },
        {
            "codeId": "G10_error_status",
            "addressIndex": "60",
            "addressLenght": "2"
        },
        {
            "codeId": "G11_error_status",
            "addressIndex": "62",
            "addressLenght": "2"
        },
        {
            "codeId": "robot_error_status",
            "addressIndex": "64",
            "addressLenght": "2"
        },
        {
            "codeId": "G13_error_status",
            "addressIndex": "66",
            "addressLenght": "2"
        },
        {
            "codeId": "confirmationWord",
            "addressIndex": "72",
            "addressLenght": "2"
        },
        {
            "codeId": "G06_prohibit_film_production",
            "addressIndex": "74",
            "addressLenght": "2"
        },
        {
            "codeId": "G11_prohibit_film_production",
            "addressIndex": "76",
            "addressLenght": "2"
        },
        {
            "codeId": "G13_prohibit_film_production",
            "addressIndex": "78",
            "addressLenght": "2"
        },
        {
            "codeId": "Glass_width",
            "addressIndex": "82",
            "addressLenght": "4"
        },
        {
            "codeId": "Glass_height",
            "addressIndex": "86",
            "addressLenght": "4"
        },
        {
            "codeId": "Glass_thickness",
            "addressIndex": "90",
            "addressLenght": "4"
        },
        {
            "codeId": "Start_cell",
            "addressIndex": "94",
            "addressLenght": "2"
        },
        {
            "codeId": "End_cell",
            "addressIndex": "96",
            "addressLenght": "2"
        },
        {
            "codeId": "task_type",
            "addressIndex": "98",
            "addressLenght": "2"
        }
    ]
}