skyouc
2025-07-11 e2ef58086619bf43d323f7f0f60cd15b91942493
zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/services/Impl/WcsApiServiceImpl.java
@@ -61,9 +61,10 @@
    @Autowired
    private PlatformService platformService;
    @Resource
    private SystemProperties systemProperties;
    @Autowired
    private MobileService mobileService;
    /**
@@ -107,36 +108,7 @@
        } else {
            if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_ARRIVED.id
                    || task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.id) {
                // 到达拣选位,控制播种墙亮灯
                CacheSite cacheSite = cacheSiteService.getOne(new LambdaQueryWrapper<CacheSite>()
                        .eq(CacheSite::getChannel, task.getTargetSite())
                        .isNull(CacheSite::getOrderId).orderByAsc(CacheSite::getId), false);
//                List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>()
//                            .eq(CacheSite::getBarcode, task.getBarcode()));
                if (Objects.isNull(cacheSite)) {
                    log.error("条码:{},未找到播种墙亮灯", task.getBarcode());
                    throw new CoolException("未找到播种墙");
                }
                // 获取任务明细数量
                List<TaskDetl> taskDetlByTaskId = taskDetlService.getTaskDetlByTaskId(task.getId());
                int sum = (int) taskDetlByTaskId.stream().mapToDouble(TaskDetl::getAnfme).sum();
                SlapLightControlParam slapLightControlParam = new SlapLightControlParam();
                slapLightControlParam
                        .setControllerCode(cacheSite.getMemo())
                        .setTagCode(cacheSite.getSiteNo())
                        .setColor("GREEN")
                        .setIndex(cacheSite.getIndex())
                        .setMode("LIGHT")
                        .setDisplay(sum + "");
                // 发起亮灯请求
                log.info("任务{}到达拣选位,播种墙亮灯下发", task.getTaskNo(), JSONObject.toJSONString(slapLightControlParam));
                CommonReponse response = HttpEssUtils.post("到达拣选位,播种墙亮灯", HttpEssUtils.PLT_SEND_COMMAND, slapLightControlParam);
                if (response.getCode().equals(0)) {
                    log.info("任务{}到达拣选位,播种墙{}亮灯成功", task.getTaskNo(), cacheSite.getSiteNo());
                } else {
                    log.info("任务{}到达拣选位,播种墙{}亮灯失败", task.getTaskNo(), cacheSite.getSiteNo());
                }
                boolean update = taskService.update(new LambdaUpdateWrapper<Task>()
                        .set(Task::getTaskSts, TaskStsType.WAVE_SEED.id)
@@ -378,14 +350,12 @@
//            List<OrderDetl> detlList = orderDetls.stream().filter(detl -> {
//                return detl.getPickStatus() == OrderPickStatus.ORDER_PICK_STATUS_DONE.val;
//            }).collect(Collectors.toList());
            //判断数量是否与订单明细的需求量相同,相同则订单完成
            List<WaveSeed> seeds = waveSeedService.list(new LambdaQueryWrapper<WaveSeed>().eq(WaveSeed::getOrderNo, orderNo));
            if (Objects.isNull(seeds)) {
                throw new CoolException("数据错误:播种数据不存在!!");
            }
            Double tolAnfme = seeds.stream().mapToDouble(WaveSeed::getAnfme).sum();
            Double toDouble = seeds.stream().mapToDouble(WaveSeed::getWorkQty).sum();
            if (toDouble.compareTo(tolAnfme) >= 0) {
@@ -407,6 +377,14 @@
                        }
                    }
                }
                //订单完成,灭灯
                mobileService.sowLightMange(siteNo, one, "DARK");
                log.info("完成灭灯请求地址:{},请求参数:{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam));
            } else {
                //订单未完成,继续亮灯
                mobileService.sowLightMange(siteNo, one, "LIGHT");
                log.info("继续亮灯请求地址:{},请求参数:{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam));
            }
            params.add("params", JSONObject.toJSONString(slapParam));
            log.info("完成灭灯请求地址:{},请求参数:{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam));