| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | |
| | | public Integer wrkNo = 10000; |
| | | @Autowired |
| | | private ConfigMapper configMapper; |
| | | |
| | | /** |
| | | * 组托 |
| | | * 入库站,根据条码扫描生成入库工作档,工作状态 2 |
| | | */ |
| | | public synchronized void generateStoreWrkFile(Integer mark) { |
| | | public synchronized void generateStoreWrkFile3(Integer mark) { |
| | | String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); |
| | | StaProtocol staProtocolIn = devpThread.getStation().get(inSta.getStaNo() -1); |
| | | if (staProtocolIn == null) { |
| | | continue; |
| | | } else { |
| | | staProtocolIn = staProtocolIn.clone(); |
| | | } |
| | | if (barcodeThread == null) { |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | |
| | | if (barcodeThread == null) { |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | // 尺寸检测异常 |
| | | boolean back = false; |
| | | String errMsg = ""; |
| | |
| | | // |
| | | // } |
| | | News.error(barcode + "条码已存在状态为( 2.设备上走 )的数据,请查看WCS输送线界面,工作号={}", wrkMast.getWrkNo()); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, barcode + "条码已存在状态为( 2.设备上走 )的任务,工作号=" + wrkMast.getWrkNo())); |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, barcode + "条码已存在状态为( 2.设备上走 )的任务,工作号=" + wrkMast.getWrkNo())); |
| | | continue; |
| | | // barcodeThread.setBarcode(""); |
| | | // staProtocol.setWorkNo(wrkMast.getWrkNo()); |
| | |
| | | } |
| | | } else { |
| | | if (jsonObject.getString("msg").equals("工作档已存在")) { |
| | | |
| | | //工作档已存在 再次进去 |
| | | // wrkMast = wrkMastMapper.selectPakInStepBarcode(barcode); |
| | | // if (wrkMast != null) { |
| | | // barcodeThread.setBarcode(""); |
| | | // staProtocol.setWorkNo(9999); |
| | | // //staProtocol.setWorkNo(wrkMast.getWrkNo()); |
| | | // //staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(),dto.getSourceStaNo())); |
| | | // staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // log.error("输送线下发2:" + wrkMast.getWrkNo() + "," + wrkMast.getStaNo()); |
| | | // ledThread.errorReset(); |
| | | // log.error("组托请求后LED错误清除"); |
| | | // if (!result) { |
| | | // News.error(methodName + ":更新plc站点信息失败"); |
| | | // |
| | | // throw new CoolException("更新plc站点信息失败"); |
| | | // } |
| | | // } |
| | | |
| | | continue; |
| | | } |
| | | staProtocol.setWorkNo(wrkNo); |
| | |
| | | // News.infoNoLog(""+mark+" - 0"+" - 组托 ===》执行完成"); |
| | | |
| | | } |
| | | /** |
| | | * 组托 |
| | | * 入库站,根据条码扫描生成入库工作档,工作状态 2 |
| | | */ |
| | | // public synchronized void generateStoreWrkFile(Integer mark) { |
| | | // String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); |
| | | // // 根据输送线plc遍历 |
| | | // for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // // 遍历入库口 |
| | | // for (DevpSlave.Sta inSta : devp.getInSta()) { |
| | | // // 获取条码扫描仪信息 |
| | | // BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); |
| | | // LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | // SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | // StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); |
| | | // StaProtocol staProtocolIn = devpThread.getStation().get(inSta.getStaNo() -1); |
| | | // if (staProtocolIn == null) { |
| | | // continue; |
| | | // } else { |
| | | // staProtocolIn = staProtocolIn.clone(); |
| | | // } |
| | | // if (barcodeThread == null) { |
| | | // continue; |
| | | // } |
| | | // String barcode = barcodeThread.getBarcode(); |
| | | // if(staProtocolIn.getStamp() == 1 && barcode!=null && !barcode.isEmpty()) { |
| | | // log.error("生成任务中"); |
| | | // |
| | | // WrkMast checkPick = wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | // .eq("barcode", barcode) |
| | | // .in("io_type", 107, 103, 57)); |
| | | // if (!Cools.isEmpty(checkPick)) { |
| | | // continue; |
| | | // } |
| | | // try { |
| | | // LocTypeDto locTypeDto = new LocTypeDto(staProtocol); |
| | | // |
| | | // SearchLocParam param = new SearchLocParam(); |
| | | // locTypeDto.setLocType1((short) 1); |
| | | // param.setBarcode(barcode); |
| | | // param.setIoType(1); |
| | | // param.setSourceStaNo(inSta.getStaNo()); |
| | | // param.setLocType1(locTypeDto.getLocType1()); |
| | | // param.setWeight(staProtocol.getWeight()); |
| | | // String response = new HttpHandler.Builder() |
| | | // .setTimeout(30, TimeUnit.SECONDS) |
| | | // .setUri(wmsUrl) |
| | | // .setPath("/rpc/pakin/loc/v1") |
| | | // .setJson(JSON.toJSONString(param)) |
| | | // .build() |
| | | // .doPost(); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // if (jsonObject.getInteger("code").equals(200)) { |
| | | // StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | // barcodeThread.setBarcode(""); |
| | | // staProtocolIn.setWorkNo(dto.getWorkNo()); |
| | | //// //staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(),dto.getSourceStaNo())); |
| | | //// staProtocol.setStaNo(dto.getStaNo().shortValue()); |
| | | // devpThread.setPakMk(staProtocolIn.getSiteId(), false); |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocolIn)); |
| | | // log.error("工作号下发2:" + dto.getWorkNo() + "," + dto.getStaNo()); |
| | | // ledThread.errorReset(); |
| | | // log.error("组托请求后LED错误清除"); |
| | | // if (!result) { |
| | | // News.error(methodName + ":更新plc站点信息失败"); |
| | | // |
| | | // throw new CoolException("更新plc站点信息失败"); |
| | | // } |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // } |
| | | // }else{ |
| | | // if (staProtocol == null) { |
| | | // continue; |
| | | // } else { |
| | | // staProtocol = staProtocol.clone(); |
| | | // } |
| | | // |
| | | // // 尺寸检测异常 |
| | | // boolean back = false; |
| | | // String errMsg = ""; |
| | | // if (staProtocol.isFrontErr()) { |
| | | // errMsg = "前超限"; |
| | | // back = true; |
| | | // } |
| | | // if (!back && staProtocol.isBackErr()) { |
| | | // errMsg = "后超限"; |
| | | // back = true; |
| | | // } |
| | | // if (!back && staProtocol.isHighErr()) { |
| | | // errMsg = "高超限"; |
| | | // back = true; |
| | | // } |
| | | // if (!back && staProtocol.isLeftErr()) { |
| | | // errMsg = "左超限"; |
| | | // back = true; |
| | | // } |
| | | // if (!back && staProtocol.isRightErr()) { |
| | | // errMsg = "右超限"; |
| | | // back = true; |
| | | // } |
| | | // if (!back && staProtocol.getWeight() > 1000) { |
| | | // errMsg = "超重或未读取"; |
| | | // back = true; |
| | | // } |
| | | // if (!back && staProtocol.isBarcodeErr()) { |
| | | // errMsg = "扫码失败"; |
| | | // back = true; |
| | | // } |
| | | // |
| | | // // 退回 |
| | | // if (back) { |
| | | // log.info("errmsg: " + errMsg); |
| | | //// News.warn("扫码入库失败,{}入库站因{}异常,托盘已被退回", inSta.getStaNo(), errMsg); |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg)); |
| | | // |
| | | // if (!staProtocol.isLoading()) { |
| | | // continue; |
| | | // } |
| | | // if (!staProtocol.isPakMk()) { |
| | | // continue; |
| | | // } |
| | | // staProtocol.setWorkNo(wrkNo); |
| | | // News.info("{}PLC入库回退:{},任务号:{}", inSta.getStaNo(), errMsg, wrkNo); |
| | | // wrkNo++; |
| | | // staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // log.error("输送线下发1:" + wrkNo + "," + inSta.getBackSta()); |
| | | // } |
| | | // |
| | | // // 判断是否满足入库条件 |
| | | // if (staProtocol.isAutoing() |
| | | // && staProtocol.isLoading() |
| | | // && staProtocol.isInEnable() |
| | | // && !staProtocol.isEmptyMk() |
| | | // && staProtocol.isPakMk()) { |
| | | // if (Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) { |
| | | // News.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | // |
| | | // staProtocol.setWorkNo(wrkNo); |
| | | // News.info("{}barcode入库回退:{},任务号:{}", inSta.getStaNo(), errMsg, wrkNo); |
| | | // wrkNo++; |
| | | // staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // log.error("输送线下发1:" + wrkNo + "," + inSta.getBackSta()); |
| | | // continue; |
| | | // } |
| | | // // 判断重复工作档 |
| | | // WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode); |
| | | // if (wrkMast != null) { |
| | | // News.error(barcode + "条码已存在状态为( 2.设备上走 )的数据,请查看WCS输送线界面,工作号={}", wrkMast.getWrkNo()); |
| | | // continue; |
| | | // } |
| | | // WrkMast checkPick = wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | // .eq("barcode", barcode) |
| | | // .in("io_type", 107, 103, 57)); |
| | | // if (!Cools.isEmpty(checkPick)) { |
| | | // continue; |
| | | // } |
| | | // try { |
| | | // LocTypeDto locTypeDto = new LocTypeDto(staProtocol); |
| | | // |
| | | // SearchLocParam param = new SearchLocParam(); |
| | | // locTypeDto.setLocType1((short) 1); |
| | | // param.setBarcode(barcode); |
| | | // param.setIoType(1); |
| | | // param.setSourceStaNo(inSta.getStaNo()); |
| | | // param.setLocType1(locTypeDto.getLocType1()); |
| | | // param.setWeight(staProtocol.getWeight()); |
| | | // String response = new HttpHandler.Builder() |
| | | // .setTimeout(30,TimeUnit.SECONDS) |
| | | // .setUri(wmsUrl) |
| | | // .setPath("/rpc/pakin/loc/v1") |
| | | // .setJson(JSON.toJSONString(param)) |
| | | // .build() |
| | | // .doPost(); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // if (jsonObject.getInteger("code").equals(200)) { |
| | | // StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | // barcodeThread.setBarcode(""); |
| | | // staProtocol.setWorkNo(dto.getWorkNo()); |
| | | // //staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(),dto.getSourceStaNo())); |
| | | // staProtocol.setStaNo(dto.getStaNo().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // log.error("输送线下发2:" + dto.getWorkNo() + "," + dto.getStaNo()); |
| | | // |
| | | // ledThread.errorReset(); |
| | | // log.error("组托请求后LED错误清除"); |
| | | // |
| | | // if (!result) { |
| | | // News.error(methodName + ":更新plc站点信息失败"); |
| | | // |
| | | // throw new CoolException("更新plc站点信息失败"); |
| | | // } |
| | | // } else { |
| | | // if (jsonObject.getString("msg").equals("工作档已存在")) { |
| | | // continue; |
| | | // } |
| | | // staProtocol.setWorkNo(wrkNo); |
| | | // wrkNo++; |
| | | // staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // log.error("输送线下发2:" + staProtocol.getWorkNo() + "," + staProtocol.getStaNo()); |
| | | // |
| | | // String errorMsg = jsonObject.getString("msg"); |
| | | // if (!Cools.isEmpty(errorMsg)) { |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | // } |
| | | // } |
| | | // |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | public synchronized void generateStoreWrkFile(Integer mark) { |
| | | String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); |
| | | final Set<String> INVALID_BARCODES = new HashSet<>(Arrays.asList("NG", "NoRead", "00000000")); |
| | | |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | for (DevpSlave.Sta inSta : devp.getInSta()) { |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | |
| | | StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); |
| | | StaProtocol staProtocolIn = devpThread.getStation().get(inSta.getStaNo() - 1); |
| | | |
| | | if (staProtocolIn == null || barcodeThread == null) continue; |
| | | staProtocolIn = staProtocolIn.clone(); |
| | | String barcode = barcodeThread.getBarcode(); |
| | | |
| | | // 如果前工位有货 + 扫码器有条码 |
| | | if (staProtocolIn.getStamp() == 1 && barcode != null && !barcode.isEmpty()) { |
| | | if (wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | .eq("barcode", barcode) |
| | | .in("io_type", 107, 103, 57)) != null) { |
| | | continue; |
| | | } |
| | | |
| | | try { |
| | | SearchLocParam param = new SearchLocParam(); |
| | | param.setBarcode(barcode); |
| | | param.setIoType(1); |
| | | param.setSourceStaNo(inSta.getStaNo()); |
| | | param.setLocType1((short) 1); |
| | | param.setWeight(staProtocolIn.getWeight()); |
| | | |
| | | String response = new HttpHandler.Builder() |
| | | .setTimeout(30, TimeUnit.SECONDS) |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/pakin/loc/v1") |
| | | .setJson(JSON.toJSONString(param)) |
| | | .build() |
| | | .doPost(); |
| | | |
| | | JSONObject json = JSON.parseObject(response); |
| | | if (json.getInteger("code").equals(200)) { |
| | | StartupDto dto = json.getObject("data", StartupDto.class); |
| | | barcodeThread.setBarcode(""); |
| | | staProtocolIn.setWorkNo(dto.getWorkNo()); |
| | | devpThread.setPakMk(staProtocolIn.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocolIn)); |
| | | ledThread.errorReset(); |
| | | log.error("工作号下发2:" + dto.getWorkNo() + "," + dto.getStaNo()); |
| | | |
| | | if (!result) { |
| | | News.error(methodName + ":更新plc站点信息失败"); |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("组托任务异常:", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | |
| | | continue; |
| | | } |
| | | |
| | | // 尺寸/重量/扫码异常检测 |
| | | if (staProtocol == null) continue; |
| | | staProtocol = staProtocol.clone(); |
| | | boolean back = false; |
| | | String errMsg = ""; |
| | | |
| | | if (staProtocol.isFrontErr()) { errMsg = "前超限"; back = true; } |
| | | else if (staProtocol.isBackErr()) { errMsg = "后超限"; back = true; } |
| | | else if (staProtocol.isHighErr()) { errMsg = "高超限"; back = true; } |
| | | else if (staProtocol.isLeftErr()) { errMsg = "左超限"; back = true; } |
| | | else if (staProtocol.isRightErr()) { errMsg = "右超限"; back = true; } |
| | | else if (staProtocol.getWeight() > 1000) { errMsg = "超重或未读取"; back = true; } |
| | | else if (staProtocol.isBarcodeErr()) { errMsg = "扫码失败"; back = true; } |
| | | |
| | | // 尺寸异常回退 |
| | | if (back) { |
| | | log.info("errmsg: " + errMsg); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg)); |
| | | |
| | | if (!staProtocol.isLoading() || !staProtocol.isPakMk()) continue; |
| | | staProtocol.setWorkNo(wrkNo++); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | log.error("输送线下发1:" + wrkNo + "," + inSta.getBackSta()); |
| | | continue; |
| | | } |
| | | |
| | | // 入库条件满足,开始请求入库地址 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() |
| | | && staProtocol.isInEnable() && !staProtocol.isEmptyMk() && staProtocol.isPakMk()) { |
| | | |
| | | if (Cools.isEmpty(barcode) || INVALID_BARCODES.contains(barcode)) { |
| | | News.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | staProtocol.setWorkNo(wrkNo++); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | log.error("输送线下发1:{} , {}", wrkNo, inSta.getBackSta()); |
| | | continue; |
| | | } |
| | | |
| | | if (wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode) != null || |
| | | wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | .eq("barcode", barcode) |
| | | .in("io_type", 107, 103, 57)) != null) { |
| | | News.error(barcode + "条码已存在状态为(2.设备上走)的数据,请查看WCS输送线界面"); |
| | | continue; |
| | | } |
| | | |
| | | try { |
| | | SearchLocParam param = new SearchLocParam(); |
| | | param.setBarcode(barcode); |
| | | param.setIoType(1); |
| | | param.setSourceStaNo(inSta.getStaNo()); |
| | | param.setLocType1((short) 1); |
| | | param.setWeight(staProtocol.getWeight()); |
| | | |
| | | String response = new HttpHandler.Builder() |
| | | .setTimeout(30, TimeUnit.SECONDS) |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/pakin/loc/v1") |
| | | .setJson(JSON.toJSONString(param)) |
| | | .build() |
| | | .doPost(); |
| | | |
| | | JSONObject json = JSON.parseObject(response); |
| | | if (json.getInteger("code").equals(200)) { |
| | | StartupDto dto = json.getObject("data", StartupDto.class); |
| | | barcodeThread.setBarcode(""); |
| | | staProtocol.setWorkNo(dto.getWorkNo()); |
| | | staProtocol.setStaNo(dto.getStaNo().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | ledThread.errorReset(); |
| | | log.error("输送线下发2:" + dto.getWorkNo() + "," + dto.getStaNo()); |
| | | |
| | | if (!result) { |
| | | News.error(methodName + ":更新plc站点信息失败"); |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | } else { |
| | | String msg = json.getString("msg"); |
| | | if (!"工作档已存在".equals(msg)) { |
| | | staProtocol.setWorkNo(wrkNo++); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | log.error("输送线下发2:" + staProtocol.getWorkNo() + "," + staProtocol.getStaNo()); |
| | | if (!Cools.isEmpty(msg)) { |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, msg)); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("组托任务异常:", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * wms入库 |
| | |
| | | if (crnProtocol.getBay() == 121) { |
| | | return; |
| | | } |
| | | int x=1; |
| | | switch (crnProtocol.getCrnNo()){ |
| | | case 1: x =1; break; |
| | | case 2: x =3; break; |
| | | case 3: x =5; break; |
| | | case 4: x =7; break; |
| | | } |
| | | |
| | | // 已经存在吊车执行任务时,则过滤3,12 |
| | | if (wrkMastMapper.selectWorking(crnProtocol.getCrnNo()) != null) { |
| | |
| | | } |
| | | |
| | | //输送线没有入库任务,过滤2 |
| | | if (wrkMastMapper.selectDevWorking(crnProtocol.getCrnNo()) == null) { |
| | | if (wrkMastMapper.selectDevWorking(crnProtocol.getCrnNo()) != null) { |
| | | return; |
| | | } |
| | | News.info("堆垛机召回原点==>>" + crnProtocol.getCrnNo() + "号堆垛机有入库任务,召回原点"); |
| | |
| | | crnCommand.setTaskNo((short) 9999); // 工作号 |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.X_MOVE); // 任务模式: 回原点 |
| | | crnCommand.setSourcePosX((short) 1); // 源库位排 |
| | | crnCommand.setSourcePosX((short) x); // 源库位排 |
| | | crnCommand.setSourcePosY((short) 121); // 源库位列 |
| | | crnCommand.setSourcePosZ((short) 1); // 源库位层 |
| | | crnCommand.setSourcePosZ((short) 2); // 源库位层 |
| | | crnCommand.setDestinationPosX((short) 0); // 目标库位排 |
| | | crnCommand.setDestinationPosY((short) 0); // 目标库位列 |
| | | crnCommand.setDestinationPosZ((short) 0); // 目标库位层 |
| | |
| | | } |
| | | } else { |
| | | int y = 1; // 默认列 |
| | | int x=1; |
| | | switch (crnProtocol.getCrnNo()){ |
| | | case 1: x =1; break; |
| | | case 2: x =3; break; |
| | | case 3: x =5; break; |
| | | case 4: x =7; break; |
| | | } |
| | | int staNoInt = Integer.parseInt(staNo); |
| | | |
| | | int z = staNoInt / 100; // 层 |
| | |
| | | return; |
| | | } |
| | | |
| | | // 输送线没有入库任务 |
| | | if (wrkMastMapper.selectDevWorking(crnProtocol.getCrnNo()) == null) { |
| | | return; |
| | | } |
| | | |
| | | News.info("堆垛机召回原点==>>" + crnProtocol.getCrnNo() + "号堆垛机有入库任务,召回原点"); |
| | | // 命令下发 |
| | |
| | | crnCommand.setTaskNo((short) 9999); |
| | | crnCommand.setAckFinish((short) 0); |
| | | crnCommand.setTaskMode(CrnTaskModeType.X_MOVE); |
| | | crnCommand.setSourcePosX((short) 1); // 默认排始终为1 |
| | | crnCommand.setSourcePosX((short) x); // 默认排始终为1 |
| | | crnCommand.setSourcePosY((short) y); // 动态列 |
| | | crnCommand.setSourcePosZ((short) z); // 动态层 |
| | | crnCommand.setDestinationPosX((short) 0); |