| | |
| | | throw new CoolException(e); |
| | | } |
| | | } else if (waitPakin.getWeight() == null) { |
| | | WrkMastSta wrkMastSta = wrkMastStaService.selectOne(new EntityWrapper<WrkMastSta>().eq("wrk_no", staProtocol.getWorkNo().intValue())); |
| | | if (Cools.isEmpty(wrkMastSta)){ |
| | | wrkMastSta = wrkMastStaService.selectOne(new EntityWrapper<WrkMastSta>().eq("wrk_no2", staProtocol.getWorkNo().intValue())); |
| | | if (Cools.isEmpty(wrkMastSta)){ |
| | | throw new CoolException("未找到对应的任务信息"); |
| | | try { |
| | | LocTypeDto locTypeDto = new LocTypeDto(staProtocol); |
| | | SearchLocParam param = new SearchLocParam(); |
| | | param.setBarcode(barcode); |
| | | param.setIoType(105); |
| | | param.setSourceStaNo(inSta.getStaNo()); |
| | | param.setLocType1(locTypeDto.getLocType1()); |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/process/in/loc/v1") |
| | | .setJson(JSON.toJSONString(param)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | |
| | | barcodeThread.setBarcode(""); |
| | | staProtocol.setWorkNo(dto.getWorkNo().shortValue()); |
| | | staProtocol.setStaNo(dto.getStaNo().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | ledThread.errorReset(); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | } else if(jsonObject.getInteger("code").equals(700)) { |
| | | log.error(barcode + "托盘识别异常,请先进行组托!"); |
| | | // led 异常显示 |
| | | ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | String errorMsg = barcode + "托盘识别异常,请先进行组托!"; |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/process/in/loc/v1", JSON.toJSONString(param), response); |
| | | } |
| | | waitPakin.setWeight(wrkMastSta.getWeight2()); |
| | | }else { |
| | | waitPakin.setWeight(wrkMastSta.getWeight()); |
| | | |
| | | } catch (Exception e) { |
| | | log.error(""+e); |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | waitPakinService.update(waitPakin,new EntityWrapper<WaitPakin>().eq("zpallet", barcode).eq("io_status", "N")); |
| | | } else { |
| | | try { |
| | | LocTypeDto locTypeDto = new LocTypeDto(staProtocol); |