| | |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | | |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | @Value("${wms.movePath}") |
| | |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | Short workNo = staProtocol.getWorkNo(); |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() |
| | | && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() && (workNo >= 0) |
| | | && staProtocol.isPakMk()) { |
| | | Short stano = staProtocol.getStaNo(); |
| | | |
| | | |
| | | |
| | | // 尺寸检测异常 |
| | | boolean back = false; |
| | |
| | | } |
| | | // 退回 |
| | | if (back) { |
| | | if (stano == inSta.getBackSta().shortValue()){ |
| | | continue; |
| | | } |
| | | if (workNo == 0 && stano == 0){ |
| | | continue; |
| | | } |
| | | // News.warn("扫码入库失败,{}入库站因{}异常,托盘已被退回", inSta.getStaNo(), errMsg); |
| | | staProtocol.setWorkNo(workNo); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | |
| | | } |
| | | continue; |
| | | } |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() |
| | | && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() && (workNo >= 0) |
| | | && staProtocol.isPakMk()) { |
| | | // 获取条码扫描仪信息 |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); |
| | | if (barcodeThread == null) { |
| | |
| | | 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()); |
| | |
| | | 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); |
| | |
| | | |
| | | //获取指令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)) {//修改成功后复位堆垛机 |
| | |
| | | }catch (Exception e){ |
| | | log.error("堆垛机任务完成,请求wms任务完成接口失败"); |
| | | } |
| | | apiLogService.save("堆垛机开始运行" |
| | | ,wmsUrl+"wcsManager/wcsInterface/taskStatusFeedback" |
| | | ,null |
| | | ,"127.0.0.1" |
| | | ,JSON.toJSONString(taskOverToWms) |
| | | ,response |
| | | ,true |
| | | ); |
| | | return response; |
| | | } |
| | | |