自动化立体仓库 - WCS系统
#
zjj
2023-12-16 7b854444d9b272fcaf1abc369e0b8e3871a3c344
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -89,6 +89,9 @@
    @Autowired
    private StaDescService staDescService;
    @Autowired
    private ApiLogService apiLogService;
    @Value("${wms.url}")
    private String wmsUrl;
    @Value("${wms.movePath}")
@@ -189,15 +192,18 @@
                            continue;
                        }
                        //StaDesc staDesc1 = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("stn_no",inSta.getBackSta()));
                        if (taskWrk.getTargetPoint() != null && taskWrk.getStartPoint() != null && taskWrk.getWrkNo() != null && taskWrk.getWrkNo().shortValue() != workNo){
                        if (taskWrk.getTargetPoint() != null && taskWrk.getStartPoint() != null){
                            if ( taskWrk.getWrkNo() != null && taskWrk.getWrkNo().shortValue() == workNo ){
                                continue;
                            }
                            //获取堆垛机站点
                            StaDesc staDesc = new StaDesc();
                            if (devp.getId() <= 1){
                                staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                                        .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).lt("crn_stn", 200));
                                        .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).lt("stn_no", 200));
                            }else {
                                staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                                        .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).ge("crn_stn", 200));
                                        .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).lt("stn_no", 400).ge("stn_no", 250));
                            }
                            staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue());
                            staProtocol.setStaNo(staDesc.getCrnStn().shortValue());
@@ -223,6 +229,14 @@
                                log.error("wms通讯失败,"+e.getMessage());
                                continue;
                            }
                            apiLogService.save("wms请求入库货位接口"
                                    ,wmsUrl+"wcsManager/wcsInterface/inboundTaskApply"
                                    ,null
                                    ,"127.0.0.1"
                                    ,JSON.toJSONString(toWmsDTO)
                                    ,response
                                    ,true
                            );
                            JSONObject jsonObject = JSON.parseObject(response);
                            if (jsonObject.getInteger("code").equals(200)) {
                                GetWmsDto getWmsDto = JSON.parseObject(jsonObject.get("data").toString(), GetWmsDto.class);
@@ -720,12 +734,23 @@
                //获取指令ID
                Integer commandId = crnProtocol.getCommandId();
                CommandInfo commandInfo = commandInfoService.selectById(commandId);
                CommandInfo commandInfo = new CommandInfo();
                if (Cools.isEmpty(commandId)){
                    commandInfo = commandInfoService.selectOne(new EntityWrapper<CommandInfo>()
                            .eq("wrk_no",crnProtocol.getTaskNo())
                            .eq("device","Crn"));
                }else {
                    commandInfo = commandInfoService.selectById(commandId);
                }
                if (commandInfo == null) {
                    //指令不存在
                    continue;
                }
                if (commandInfo.getCommandStatus() == 3){
                    continue;
                }
                commandInfo.setCommandStatus(CommandStatusType.COMPLETE.id);//指令完成
                commandInfo.setCompleteTime(new Date());//指令完成时间
                if (commandInfoService.updateById(commandInfo)) {//修改成功后复位堆垛机
@@ -1023,6 +1048,14 @@
        }catch (Exception e){
            log.error("堆垛机任务完成,请求wms任务完成接口失败");
        }
        apiLogService.save("堆垛机开始运行"
                ,wmsUrl+"wcsManager/wcsInterface/taskStatusFeedback"
                ,null
                ,"127.0.0.1"
                ,JSON.toJSONString(taskOverToWms)
                ,response
                ,true
        );
        return response;
    }