wuyouming666
2024-05-14 1eadcf2fe21a211ba361b3cdb86a79f34b4b0479
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java
@@ -74,7 +74,7 @@
      // String G06RobotTaskRequestWord = plcParameterObject.getPlcParameter("G06RobotTaskRequestWord").getAddress();
                String taskRequestTypeValue ="1";
                String taskRequestTypeValue ="3";
        String glassIdeValue ="NG24041101C002-2-6-1-6";
        String confirmationWrodValue ="1";
        String outGlassstate="1";
@@ -112,8 +112,6 @@
        } else if ("3".equals(taskRequestTypeValue)) {
            log.info("3、进片和出片都空闲,执行出片任务");
            if (outTo( confirmationWrodAddress)) {
                inTo(glassIdeValue, confirmationWrodAddress);
@@ -157,7 +155,7 @@
        DownStorageCageDetails details = new DownStorageCageDetails();
        BeanUtils.copyProperties(glassInfo, details);
        details.setState(1);
        details.setGlassId(item.getGlassId());
        details.setGlassId(glassInfo.getGlassId());
        details.setSlot(item.getSlot());
        details.setDeviceId(item.getDeviceId());
        downStorageCageDetailsService.save(details);
@@ -165,7 +163,6 @@
            DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(glassInfo, "0", item.getSlot() + "", "1");
        //添加进片任务
        log.info("6、生成进片任务信息存入任务表{}", downGlassTask);
            downGlassTaskService.insertCacheTask(downGlassTask);
        }
@@ -182,17 +179,18 @@
     *
     */
    private Boolean outTo( String confirmationWrodAddress) {
        log.info("单片情况根据传入的设备id 查询符合按照大小出片,并且优先出满架的小片");
        List<DownStorageCageDetails> list = downStorageCageDetailsService.CacheOut(1,3);
        log.info("单片情况根据传入的料架号 查询符合按照版图id和片序出片,并且优先出满架的小片");
        List<DownStorageCageDetails> list = downStorageCageDetailsService.CacheOut1(1,3);
        List<DownStorageCageDetails> list2 = downStorageCageDetailsService.CacheOut(4,6);
        List<DownStorageCageDetails> list2 = downStorageCageDetailsService.CacheOut1(4,6);
        List<DownStorageCageDetails> list3 = downStorageCageDetailsService.CacheOut(1, 6);
        List<DownStorageCageDetails> list3 = downStorageCageDetailsService.CacheOut1(1,6);
        // 优先 超出尺寸优先人工出片 人工处理
        if (!list3.isEmpty()) {
            log.info("人工处理");
            DownStorageCageDetails item3 = list3.get(0);
            if (item3.getHeight() >= 2500 && item3.getWidth() >= 2660) {
                log.info("人工处理");
                String endcell = "7";
@@ -202,16 +200,14 @@
              return true;
            }
        }
        //如果同时前后端都空闲 优先后端出片并且优先满架
        else if (!list2.isEmpty() && !list3.isEmpty()) {
            log.info("前后端都空闲 优先后端出片并且优先满架");
            DownStorageCageDetails item3 = list2.get(0);
                DownStorageCageDetails item4 = list2.get(0);
            DownWorkstation downWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getFlowCardId, item3.getFlowCardId()));
                DownWorkstation downWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getFlowCardId, item4.getFlowCardId()));
            String endcell = String.valueOf(downWorkstation.getWorkstationId());
            DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(item3, "9", endcell, "2");
                DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(item4, "9", endcell, "2");
            downGlassTaskService.insertCacheTask(downGlassTask);
         //S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 2);
@@ -219,7 +215,7 @@
           return true;
        }
        // 按照大小符合前端出片
            // 按照版图id和片序符合前端出片
        else if (!list.isEmpty()) {
            log.info("前端出片");
            DownStorageCageDetails item = list.get(0);
@@ -232,7 +228,7 @@
            return true;
            // 按照大小符合后端出片
                // 按照版图id和片序符合后端出片
        } else if (!list2.isEmpty()) {
            log.info("后端出片");
            DownStorageCageDetails item2 = list2.get(0);
@@ -244,6 +240,9 @@
          //  S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 2);
           return true;
        }
        }
        //如果同时前后端都空闲 优先后端出片并且优先满架
        // 返回结果
        return false;
    }
@@ -252,37 +251,26 @@
//
    public void insertdownglassinfo() {
        try {
        String G06RobotTaskReply ="1";
        String G06Rack ="1";
        String G11RobotTaskReply ="1";
        String G11Rack ="1";
        List<DownGlassTask> taskdownGlassInf = downGlassTaskService.getUnloadingTaskState();
        if (taskdownGlassInf != null && !taskdownGlassInf.isEmpty()) {
            for (DownGlassTask downGlassInfo : taskdownGlassInf) {
                // 创建新的 DownGlassInfo 对象并设置相关属性
                DownGlassInfo newdownGlassInfo = new DownGlassInfo();
//                newdownGlassInfo.setId(downGlassInfo.getId());
                newdownGlassInfo.setFlowCardId(downGlassInfo.getFlowCardId());
                Integer maxSequence = downGlassInfoService.getMaxSequenceByFlowCardId(downGlassInfo.getFlowCardId());
                // 初始化顺序字段值
                int sequence = maxSequence != null ? maxSequence + 1 : 1;
//                newdownGlassInfo.setId(downGlassInfo.getId());
                newdownGlassInfo.setWidth(downGlassInfo.getWidth());
                newdownGlassInfo.setGlassId(downGlassInfo.getGlassId());
                newdownGlassInfo.setHeight(downGlassInfo.getHeight());
                newdownGlassInfo.setThickness(downGlassInfo.getThickness());
                newdownGlassInfo.setFilmsid(downGlassInfo.getFilmsid());
                BeanUtils.copyProperties(downGlassInfo, newdownGlassInfo);
                // 设置顺序字段值
                newdownGlassInfo.setSequence(sequence);
                // 插入数据到下片玻璃信息表
                downGlassInfoService.insertDownGlassInfo(newdownGlassInfo);
                log.info("插入数据到下片玻璃信息表");
                DownWorkstation downWorkstation1 = downWorkstationService.selectByFlowCardId(downGlassInfo.getFlowCardId());
                downWorkstationService.updateracksnumber(downGlassInfo.getFlowCardId(), downWorkstation1.getRacksnumber() + 1);
                log.info("更新落架数量");
                sequence++; // 递增顺序字段值