| | |
| | | } |
| | | |
| | | } |
| | | public synchronized void generateStoreWrkFile7() { |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历入库口 |
| | | for (DevpSlave.Sta inSta : devp.getInSta7()) { |
| | | |
| | | // 获取入库站信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | |
| | | // 获取条码扫描仪信息 |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); |
| | | if (barcodeThread == null) { |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | |
| | | // 尺寸检测异常 |
| | | boolean back = false; |
| | | String errMsg = "异常:"; |
| | | if (staProtocol.isFrontErr()) { |
| | | errMsg = errMsg+"前超限;"; |
| | | back = true; |
| | | } |
| | | if (staProtocol.isBackErr()) { |
| | | errMsg = errMsg+"后超限"; |
| | | back = true; |
| | | } |
| | | if (staProtocol.isHighErr()) { |
| | | errMsg = errMsg+"高超限"; |
| | | back = true; |
| | | } |
| | | if (staProtocol.isLeftErr()) { |
| | | errMsg = errMsg+"左超限"; |
| | | back = true; |
| | | } |
| | | if (staProtocol.isRightErr()) { |
| | | errMsg = errMsg+"右超限"; |
| | | back = true; |
| | | } |
| | | if (staProtocol.isWeightErr()) { |
| | | errMsg = errMsg+"超重"; |
| | | back = true; |
| | | } |
| | | |
| | | if (staProtocol.isBan()){ |
| | | |
| | | // 退回 |
| | | if (back) { |
| | | // led 异常显示 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg)); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | if (staProtocol.getStaNoEnd() != 2001){ |
| | | log.error(staProtocol.getStaNo()+"站点,空桶,非法目标站!!!!!!"+staProtocol.getStaNoEnd().toString()); |
| | | continue; |
| | | } |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() |
| | | && staProtocol.isLoading() |
| | | && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() |
| | | && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990) |
| | | && staProtocol.isPakMk()) { |
| | | Integer workNo1 = commonService.getWorkNo(3); |
| | | Date now = new Date(); |
| | | // 保存工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo1); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(101L); // 工作状态:101.初始 |
| | | wrkMast.setIoType(199); // 入出库状态: 199.转移 |
| | | wrkMast.setIoPri(15D); |
| | | wrkMast.setCrnNo(0); |
| | | wrkMast.setSourceStaNo(staProtocol.getStaNo().intValue()); // 源站 |
| | | wrkMast.setStaNo(staProtocol.getStaNoEnd().intValue()); // 目标站 |
| | | wrkMast.setFullPlt("N"); // 满板 |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("Y"); // 空板 |
| | | wrkMast.setBarcode("KB888888"); // 托盘码 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setCtnNo("Y"); // 入库阻塞库位移转标记 |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiTime(now); |
| | | int res = wrkMastMapper.insert(wrkMast); |
| | | if (res == 0) { |
| | | // throw new CoolException(""); |
| | | log.error(staProtocol.getStaNo()+"站点,空桶,保存工作档主档失败!!!!!!"+now.toString()); |
| | | continue; |
| | | } |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | |
| | | // StaProtocol staProtocol1 = new StaProtocol(); |
| | | staProtocol.setWorkNo(workNo1.shortValue()); |
| | | staProtocol.setStaNo((short)3001); |
| | | 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站点信息失败"); |
| | | } |
| | | } |
| | | |
| | | continue; |
| | | } |
| | | |
| | | if (staProtocol.isBarcodeErr()) { |
| | | errMsg = errMsg+"扫码失败"; |
| | | back = true; |
| | | } |
| | | // 退回 |
| | | if (back) { |
| | | // led 异常显示 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg)); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | if (!Cools.isEmpty(barcode)) { |
| | | log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | continue; |
| | | } |
| | | } else { |
| | | // led 异常显示 |
| | | // LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | // if (ledThread != null) { |
| | | // String errorMsg = "扫码失败,请重试"; |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | // } |
| | | continue; |
| | | } |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() |
| | | && staProtocol.isLoading() |
| | | && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() |
| | | && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990) |
| | | && staProtocol.isPakMk()) { |
| | | |
| | | if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | //条码为空或者不符合,退库到 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | String errorMsg = "扫码失败,请重试"; |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | // staProtocol.setWorkNo((short)9999); |
| | | // staProtocol.setStaNo((short)(staProtocol.getStaNo()-1)); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // if (!result) { |
| | | // throw new CoolException("更新plc站点信息失败"); |
| | | // } |
| | | continue; |
| | | } |
| | | |
| | | // 判断重复工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | if (barcode.length() == 8) { |
| | | wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode); |
| | | if (wrkMast != null) { |
| | | log.error("工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo()); |
| | | continue; |
| | | } |
| | | } |
| | | // 获取入库通知档 |
| | | // List<WaitPakin> waitPakins = waitPakinMapper.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode).eq("io_status", "N")); |
| | | // if (waitPakins.isEmpty()) { |
| | | // log.error("无此入库条码数据。条码号={}", barcode); |
| | | // continue; |
| | | // } |
| | | |
| | | try { |
| | | LocTypeDto locTypeDto = new LocTypeDto(staProtocol); |
| | | SearchLocParam param = new SearchLocParam(); |
| | | param.setBarcode(barcode); |
| | | param.setIoType(1); |
| | | param.setSourceStaNo(inSta.getStaNo()); |
| | | param.setLocType1(locTypeDto.getLocType1()); |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/pakin/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)) { |
| | | // staProtocol.setWorkNo((short) 9999); |
| | | // staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // // led 异常显示 |
| | | // if (ledThread != null) { |
| | | // String errorMsg = barcode + "托盘识别异常,请先进行组托!"; |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | // } |
| | | 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/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * wms入库 |
| | |
| | | // WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(slave.getId(), crnStn.getStaNo()); |
| | | List<WrkMast> wrkMasts = wrkMastMapper.selectPakOutStep11(slave.getId(), crnStn.getStaNo()); |
| | | // 获取工作状态为14的工作档 |
| | | WrkMast wrkMast1 = wrkMastMapper.selectPakOutStep14(slave.getId(), crnStn.getStaNo()); |
| | | if ( wrkMast1 !=null) { |
| | | continue; |
| | | } |
| | | // WrkMast wrkMast1 = wrkMastMapper.selectPakOutStep14(slave.getId(), crnStn.getStaNo()); |
| | | // if ( wrkMast1 !=null) { |
| | | // continue; |
| | | // } |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | if (wrkMast == null) { |
| | | continue; |
| | |
| | | String batch2 = ""; |
| | | short type = 0; |
| | | short type2 = 0; |
| | | short anfme = 1; |
| | | short anfme2 = 1; |
| | | short anfme = 4; |
| | | short anfme2 = 4; |
| | | Double weight = 0d; |
| | | Double weight2 = 0d; |
| | | Double weight11 = 0d; |
| | | String memo = ""; |
| | | String memo2 = ""; |
| | | |
| | | List<RgvSlave.Sta> inStn1 = rgvSlave.getInStn(); |
| | | if (rgvProtocol.getColumnNumber()>4){ |
| | | short rgvStaNo = Utils.getRgvStaNo(rgvSlave.getId(), inStn1.get(0).getSourceStaNo()); |
| | | if (rgvStaNo<5){ |
| | | Collections.reverse(inStn1); |
| | | } |
| | | } |
| | | //工位一任务 |
| | | for (RgvSlave.Sta inStn : rgvSlave.getInStn()){ |
| | | for (RgvSlave.Sta inStn : inStn1){ |
| | | work1 = false; |
| | | workNo1 = 0; |
| | | souSta1 = 0; |
| | | sta1 = 0; |
| | | type = 0; |
| | | if (rgvSlave.getId() == 1 && inStn.getSourceStaNo() == 2114){ |
| | | continue; |
| | | } |
| | |
| | | workNo1 = wrkMast.getWrkNo(); |
| | | souSta1 = Utils.getRgvStaNo(rgvSlave.getId(),staProtocol.getSiteId()); |
| | | sta1 = Utils.getRgvEndStaNo(rgvSlave.getId(),wrkMast.getStaNo()); |
| | | Integer staNo = Utils.getStaNo(rgvSlave.getId(), (int) sta1); |
| | | BasDevp devp = basDevpService.selectById(staNo); |
| | | if (devp.getWrkNo()!=0 || Cools.isEmpty(devp.getLoading()) || devp.getLoading().equals("Y")){ |
| | | continue; |
| | | } |
| | | work1 = true; |
| | | devpThread.setPakMk(inStn.getSourceStaNo(),false); |
| | | break; |
| | |
| | | sta1 = Utils.getRgvStaNo(rgvSlave.getId(),2103); |
| | | } else if (inStn.getSourceStaNo() == 4007 && staProtocol.getTongType() == 2) { |
| | | sta1 = Utils.getRgvStaNo(rgvSlave.getId(),2002); |
| | | } else if (inStn.getSourceStaNo() == 4007 && staProtocol.getTongType() == 4) { |
| | | if (staProtocol.getStaNoEnd() == 3007 || staProtocol.getStaNoEnd() == 3012){ |
| | | sta1 = Utils.getRgvStaNo(rgvSlave.getId(),2103); |
| | | } else if (staProtocol.getStaNoEnd() == 2001 ){ |
| | | sta1 = Utils.getRgvStaNo(rgvSlave.getId(),2002); |
| | | } else { |
| | | log.error("4007站点,桶型4,非法目标站!!!!!!"+staProtocol.getStaNoEnd().toString()); |
| | | continue; |
| | | } |
| | | Integer staNo = Utils.getStaNo(rgvSlave.getId(), (int) sta1); |
| | | BasDevp devp = basDevpService.selectById(staNo); |
| | | if (devp.getWrkNo()!=0 || Cools.isEmpty(devp.getLoading()) || devp.getLoading().equals("Y")){ |
| | | continue; |
| | | } |
| | | workNo1 = commonService.getWorkNo(3); |
| | | Date now = new Date(); |
| | | // 保存工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo1); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(101L); // 工作状态:101.初始 |
| | | wrkMast.setIoType(199); // 入出库状态: 199.转移 |
| | | wrkMast.setIoPri(15D); |
| | | wrkMast.setCrnNo(0); |
| | | wrkMast.setSourceStaNo(4007); // 源站 |
| | | wrkMast.setStaNo(staProtocol.getStaNoEnd().intValue()); // 目标站 |
| | | wrkMast.setFullPlt("N"); // 满板 |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("Y"); // 空板 |
| | | wrkMast.setBarcode("KB888888"); // 托盘码 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setCtnNo("Y"); // 入库阻塞库位移转标记 |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiTime(now); |
| | | int res = wrkMastMapper.insert(wrkMast); |
| | | if (res == 0) { |
| | | // throw new CoolException(""); |
| | | log.error("4007站点,桶型4,保存工作档主档失败!!!!!!"+now.toString()); |
| | | continue; |
| | | } |
| | | type = 2; |
| | | } else if (inStn.getSourceStaNo() == 2102 && staProtocol.isFullPlt()) { |
| | | sta1 = Utils.getRgvStaNo(rgvSlave.getId(),2301); |
| | | } else { |
| | |
| | | if(inStn.getSourceStaNo() == 2102){ |
| | | weight = staProtocol.getWeight().doubleValue()/10; |
| | | } |
| | | |
| | | Integer staNo = Utils.getStaNo(rgvSlave.getId(), (int) sta1); |
| | | BasDevp devp = basDevpService.selectById(staNo); |
| | | if (devp.getWrkNo()!=0 || Cools.isEmpty(devp.getLoading()) || devp.getLoading().equals("Y")){ |
| | | continue; |
| | | } |
| | | work1 = true; |
| | | if (inStn.getSourcePlcId() == 4 || inStn.getSourcePlcId() ==5){ //灌装站需要获取输送线物料代码 |
| | | matnr = staProtocol.getMatnr(); |
| | | batch = staProtocol.getBatch(); |
| | | anfme = staProtocol.getAnfme().shortValue(); |
| | | anfme2 = staProtocol.getAnfme2().shortValue(); |
| | | weight = staProtocol.getWeight1(); |
| | | weight2 = staProtocol.getWeight2(); |
| | | anfme = (Cools.isEmpty(staProtocol.getAnfme()) || staProtocol.getAnfme()==0) ? anfme:staProtocol.getAnfme().shortValue(); |
| | | weight11 = staProtocol.getWeight1(); |
| | | weight = weight11; |
| | | String memoBool = staProtocol.isBan()? "存在":"不存在"; |
| | | memo = memoBool+"半桶"; |
| | | } |
| | | |
| | | devpThread.setPakMk(inStn.getSourceStaNo(),false); |
| | | break; |
| | | |
| | | } |
| | | } |
| | | |
| | | if (rgvSlave.getId() != 3){ |
| | | //工位二任务 |
| | | for (RgvSlave.Sta inStn : rgvSlave.getInStn()){ |
| | | work2 = false; |
| | | workNo2 = 0; |
| | | souSta2 = 0; |
| | | sta2 = 0; |
| | | type2 = 0; |
| | | if (souSta1 == inStn.getSourceStaNo()){ |
| | | continue; |
| | | } |
| | |
| | | workNo2 = wrkMast.getWrkNo(); |
| | | souSta2 = Utils.getRgvStaNo(rgvSlave.getId(),staProtocol.getSiteId()); |
| | | sta2 = Utils.getRgvEndStaNo(rgvSlave.getId(),wrkMast.getStaNo()); |
| | | Integer staNo = Utils.getStaNo(rgvSlave.getId(), (int) sta2); |
| | | BasDevp devp2 = basDevpService.selectById(staNo); |
| | | if (devp2.getWrkNo()!=0 || Cools.isEmpty(devp2.getLoading()) || devp2.getLoading().equals("Y")){ |
| | | continue; |
| | | } |
| | | |
| | | work2 = true; |
| | | devpThread.setPakMk(inStn.getSourceStaNo(),false); |
| | | break; |
| | |
| | | sta2 = Utils.getRgvStaNo(rgvSlave.getId(),2103); |
| | | } else if (inStn.getSourceStaNo() == 4007 && staProtocol.getTongType() == 2) { |
| | | sta2 = Utils.getRgvStaNo(rgvSlave.getId(),2002); |
| | | }else if (inStn.getSourceStaNo() == 2102 && staProtocol.isFullPlt()) { |
| | | } else if (inStn.getSourceStaNo() == 4007 && staProtocol.getTongType() == 4) { |
| | | if (staProtocol.getStaNoEnd() == 3007 || staProtocol.getStaNoEnd() == 3012){ |
| | | sta2 = Utils.getRgvStaNo(rgvSlave.getId(),2103); |
| | | } else if (staProtocol.getStaNoEnd() == 2001 ){ |
| | | sta2 = Utils.getRgvStaNo(rgvSlave.getId(),2002); |
| | | } else { |
| | | log.error("4007站点,桶型4,非法目标站!!!!!!"+staProtocol.getStaNoEnd().toString()); |
| | | continue; |
| | | } |
| | | Integer staNo = Utils.getStaNo(rgvSlave.getId(), (int) sta2); |
| | | BasDevp devp2 = basDevpService.selectById(staNo); |
| | | if (devp2.getWrkNo()!=0 || Cools.isEmpty(devp2.getLoading()) || devp2.getLoading().equals("Y")){ |
| | | continue; |
| | | } |
| | | workNo2 = commonService.getWorkNo(3); |
| | | Date now = new Date(); |
| | | // 保存工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo2); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(101L); // 工作状态:101.初始 |
| | | wrkMast.setIoType(199); // 入出库状态: 199.转移 |
| | | wrkMast.setIoPri(15D); |
| | | wrkMast.setCrnNo(0); |
| | | wrkMast.setSourceStaNo(4007); // 源站 |
| | | wrkMast.setStaNo(staProtocol.getStaNoEnd().intValue()); // 目标站 |
| | | wrkMast.setFullPlt("N"); // 满板 |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("Y"); // 空板 |
| | | wrkMast.setBarcode("KB888888"); // 托盘码 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setCtnNo("Y"); // 入库阻塞库位移转标记 |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiTime(now); |
| | | int res = wrkMastMapper.insert(wrkMast); |
| | | if (res == 0) { |
| | | // throw new CoolException(""); |
| | | log.error("4007站点,桶型4,保存工作档主档失败!!!!!!"+now.toString()); |
| | | continue; |
| | | } |
| | | type2 = 2; |
| | | } else if (inStn.getSourceStaNo() == 2102 && staProtocol.isFullPlt()) { |
| | | sta2 = Utils.getRgvStaNo(rgvSlave.getId(),2301); |
| | | } else { |
| | | sta2 = Utils.getRgvStaNo(rgvSlave.getId(),inStn.getStaNo()); |
| | |
| | | if(inStn.getSourceStaNo() == 2102){ |
| | | weight2 = staProtocol.getWeight().doubleValue()/10; |
| | | } |
| | | Integer staNo = Utils.getStaNo(rgvSlave.getId(), (int) sta2); |
| | | BasDevp devp2 = basDevpService.selectById(staNo); |
| | | if (devp2.getWrkNo()!=0 || Cools.isEmpty(devp2.getLoading()) || devp2.getLoading().equals("Y")){ |
| | | continue; |
| | | } |
| | | |
| | | work2 = true; |
| | | if (inStn.getSourcePlcId() == 4){ |
| | | matnr2 = staProtocol.getMatnr(); |
| | | batch2 = staProtocol.getBatch(); |
| | | anfme2 = (Cools.isEmpty(staProtocol.getAnfme2()) || staProtocol.getAnfme2()==0) ? anfme2:staProtocol.getAnfme2().shortValue(); |
| | | |
| | | weight11 = staProtocol.getWeight1(); |
| | | weight2 = weight11; |
| | | String memoBool = staProtocol.isBan()? "存在":"不存在"; |
| | | memo2 = memoBool+"半桶"; |
| | | } |
| | | devpThread.setPakMk(inStn.getSourceStaNo(),false); |
| | | break; |
| | |
| | | command.setTaskMode(RgvTaskModeType.FETCH_PUT_ALL); // 任务模式: all取放货 |
| | | } |
| | | command.setCommand(false); |
| | | rgvTaskSave(command); |
| | | rgvTaskSave(command,memo,memo2); |
| | | MessageQueue.offer(SlaveType.Rgv, rgvSlave.getId(), new Task(2, command)); |
| | | log.info("rgv任务下发:"+JSON.toJSONString(command)); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | WrkMast wrkMast = wrkMastService.selectByworkNo(rgvProtocol.getTaskNo1()); |
| | | if (Cools.isEmpty(wrkMast)){ |
| | | log.error("完成{}号车工位一任务未找到对应rgv任务,{}",rgvProtocol.getRgvNo(),rgvProtocol.getTaskNo1()); |
| | | }else { |
| | | } else { |
| | | if (wrkMast.getIoType() == 110 || wrkMast.getIoType() == 101){ |
| | | Date date = new Date(); |
| | | wrkMast.setWrkSts(14L); |
| | | wrkMast.setModiTime(date); |
| | | wrkMastService.updateById(wrkMast); |
| | | } else if (wrkMast.getIoType()==199 && rgvSlave.getId()==3 && (wrkMast.getStaNo()==3007 || wrkMast.getStaNo()==3012)){ |
| | | Date date = new Date(); |
| | | wrkMast.setWrkSts(105L); |
| | | wrkMast.setModiTime(date); |
| | | wrkMastService.updateById(wrkMast); |
| | | } |
| | |
| | | staProtocol.setWorkNo(wrkMastSta.getWrkNo().shortValue()); |
| | | if (wrkMastSta.getType() == 1){ |
| | | staProtocol.setStaNo((short) 9999); |
| | | }else { |
| | | } else if (wrkMastSta.getType() == 2){//转运 |
| | | staProtocol.setStaNo((short) 2114); |
| | | } else { |
| | | staProtocol.setStaNo((short) 2106); |
| | | } |
| | | staProtocol.setMatnr(wrkMastSta.getMatnr1()); |
| | |
| | | staProtocol.setWorkNo(wrkMastSta.getWrkNo2().shortValue()); |
| | | if (wrkMastSta.getType2() == 1){ |
| | | staProtocol.setStaNo((short) 9999); |
| | | }else { |
| | | } else if (wrkMastSta.getType() == 2){//转运 |
| | | staProtocol.setStaNo((short) 2114); |
| | | } else { |
| | | staProtocol.setStaNo((short) 2106); |
| | | } |
| | | |
| | |
| | | if (wrkMast.getIoType() == 110 || wrkMast.getIoType() == 101){ |
| | | Date date = new Date(); |
| | | wrkMast.setWrkSts(14L); |
| | | wrkMast.setModiTime(date); |
| | | wrkMastService.updateById(wrkMast); |
| | | } else if (wrkMast.getIoType()==199 && wrkMast.getStaNo()==2001){ |
| | | Date date = new Date(); |
| | | wrkMast.setWrkSts(105L); |
| | | wrkMast.setModiTime(date); |
| | | wrkMastService.updateById(wrkMast); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public boolean rgvTaskSave(RgvCommand command){ |
| | | public boolean rgvTaskSave(RgvCommand command,String memo,String memo2){ |
| | | // Wrapper<WrkMastSta> wrkMastStaWrapper = new EntityWrapper<WrkMastSta>().eq("wrk_crn", command.getRgvNo()).eq("wrk_no", command.getTaskNo1()); |
| | | if (command.getTaskNo1() > 0){ |
| | | List<WrkMastSta> wrkMastSta1 = wrkMastStaService.selectBywrkNoHistoricalTasks(command.getRgvNo(),command.getTaskNo1()); |
| | |
| | | wrkMastSta.setAnfme2(command.getAnfme2().intValue()); |
| | | wrkMastSta.setWeight(command.getWeight()); |
| | | wrkMastSta.setWeight2(command.getWeight2()); |
| | | wrkMastSta.setMemo(memo); |
| | | wrkMastSta.setMemo2(memo2); |
| | | |
| | | return wrkMastStaService.insert(wrkMastSta); |
| | | } |
| | |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error(""+e); |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | |
| | | public void CreateComb(String barcode,Integer code,Integer wrkNo,String batch,DevpSlave.Sta inSta) throws IOException { |
| | | Double anfme = 0d; |
| | | Double weight = 0d; |
| | | String memo = ""; |
| | | |
| | | WrkMastSta wrkMastSta = wrkMastStaService.selectOne(new EntityWrapper<WrkMastSta>().eq("wrk_no", wrkNo)); |
| | | if (Cools.isEmpty(wrkMastSta)){ |
| | |
| | | anfme = wrkMastSta.getAnfme2().doubleValue(); |
| | | code = wrkMastSta.getMatnr2(); |
| | | weight = wrkMastSta.getWeight2(); |
| | | memo = wrkMastSta.getMemo2(); |
| | | } |
| | | }else { |
| | | batch = wrkMastSta.getBatch(); |
| | | anfme = wrkMastSta.getAnfme().doubleValue(); |
| | | code = wrkMastSta.getMatnr1(); |
| | | weight = wrkMastSta.getWeight(); |
| | | memo = wrkMastSta.getMemo(); |
| | | } |
| | | MatnrCode matnrCode = matnrCodeService.selectByCode(code); |
| | | if (Cools.isEmpty(matnrCode)){ |
| | |
| | | combMat.setMatnr(matnrCode.getMatnr()); |
| | | combMat.setBatch(batch); |
| | | combMat.setAnfme(anfme); |
| | | combMat.setWeight(weight); |
| | | combMat.setMemo(memo); |
| | | |
| | | combMats.add(combMat); |
| | | combParam.setCombMats(combMats); |
| | |
| | | }else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/mobile/comb/auth", JSON.toJSONString(combParam), response); |
| | | // log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | //条码为空或者不符合,退库到 |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | if (ledThread != null) { |
| | | String errorMsg = "扫码失败,请重试"; |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); |
| | | } |
| | | //条码为空或者不符合,退库信号下发 |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, 2, new Task(3, null)); |
| | | } |
| | | } |
| | | |