| | |
| | | |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.zy.common.utils.RandomValidateCodeUtil.code; |
| | |
| | | param.setSourceStaNo(inSta.getStaNo()); |
| | | param.setLocType1(locTypeDto.getLocType1()); |
| | | String response = new HttpHandler.Builder() |
| | | .setTimeout(30, TimeUnit.SECONDS) |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/pakin/loc/v1") |
| | | .setJson(JSON.toJSONString(param)) |
| | |
| | | } |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | String errorMsg = barcode + jsonObject.get("msg"); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | param.setSourceStaNo(inSta.getStaNo()); |
| | | param.setLocType1(locTypeDto.getLocType1()); |
| | | String response = new HttpHandler.Builder() |
| | | .setTimeout(30,TimeUnit.SECONDS) |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/pakin/loc/v1") |
| | | .setJson(JSON.toJSONString(param)) |
| | |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | } else { |
| | | ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | String errorMsg = jsonObject.getString("msg"); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | } |
| | | |
| | |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | } else { |
| | | ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, emptyInSta.getLed()); |
| | | if (ledThread != null) { |
| | | String errorMsg = jsonObject.getString("msg"); |
| | | MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | command.setWeight2(weight2); |
| | | |
| | | if (workNo1 == 0 && workNo2 !=0){ |
| | | if("0".equals(matnr2) || "".equals(batch2) ){ |
| | | log.error("源站"+souSta2+"工位一任务缺少信息,物料代码:"+matnr+",batch:"+batch); |
| | | continue; |
| | | } |
| | | command.setTaskMode(RgvTaskModeType.FETCH_PUT2); // 任务模式: 2取放货 |
| | | } else if (workNo1 != 0 && workNo2 ==0) { |
| | | if("0".equals(matnr) || "".equals(batch) ){ |
| | | log.error("源站"+souSta1+"工位二任务缺少信息,物料代码:"+matnr+",batch:"+batch); |
| | | continue; |
| | | } |
| | | command.setTaskMode(RgvTaskModeType.FETCH_PUT1); // 任务模式: 1取放货 |
| | | }else { |
| | | if("0".equals(matnr) || "".equals(batch) ){ |
| | | log.error("源站"+souSta1+"工位一任务缺少信息,物料代码:"+matnr+",batch:"+batch); |
| | | continue; |
| | | } |
| | | if("0".equals(matnr2) || "".equals(batch2) ){ |
| | | log.error("源站"+souSta2+"工位二任务缺少信息,物料代码:"+matnr+",batch:"+batch); |
| | | continue; |
| | | } |
| | | command.setTaskMode(RgvTaskModeType.FETCH_PUT_ALL); // 任务模式: all取放货 |
| | | } |
| | | command.setCommand(false); |
| | |
| | | param.setSourceStaNo(inSta.getStaNo()); |
| | | param.setLocType1(locTypeDto.getLocType1()); |
| | | String response = new HttpHandler.Builder() |
| | | .setTimeout(30,TimeUnit.SECONDS) |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/process/in/loc/v1") |
| | | .setJson(JSON.toJSONString(param)) |
| | |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | } else { |
| | | ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | String errorMsg = jsonObject.getString("msg"); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/process/in/loc/v1", JSON.toJSONString(param), response); |
| | | } |
| | | |
| | |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | |
| | | log.error(barcode + "生成任务成功,"+dto); |
| | | barcodeThread.setBarcode(""); |
| | | staProtocol.setWorkNo(dto.getWorkNo().shortValue()); |
| | | staProtocol.setStaNo(dto.getStaNo().shortValue()); |
| | |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | } else { |
| | | ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | String errorMsg = jsonObject.getString("msg"); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | } |
| | | |
| | |
| | | // MatnrCode matnrCode = matnrCodeService.selectByCode(code); |
| | | Mat mat = matService.selectByCode(code); |
| | | if (Cools.isEmpty(mat)){ |
| | | //zc 添加显示屏信息,输出物料无法或别等情况 |
| | | // led 异常显示 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | String errorMsg = code + "未找到对应的物料信息!"; |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | throw new CoolException("未找到对应的物料信息"); |
| | | } |
| | | CombParam combParam = new CombParam(); |