| | |
| | | private MatnrCodeService matnrCodeService; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | |
| | | log.error(staProtocol.getStaNo()+"站点,空桶,非法目标站!!!!!!"+staProtocol.getStaNoEnd().toString()); |
| | | continue; |
| | | } |
| | | 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) { |
| | | // 判断是否满足入库条件 |
| | | 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()); |
| | | 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站点信息失败"); |
| | | 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; |
| | | } |
| | | |
| | |
| | | // 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; |
| | |
| | | short sta1 = 0; |
| | | short souSta2 = 0; |
| | | short sta2 = 0; |
| | | Integer matnr = 0; |
| | | Integer matnr2 = 0; |
| | | String matnr = "0"; |
| | | String matnr2 = "0"; |
| | | String batch = ""; |
| | | String batch2 = ""; |
| | | short type = 0; |
| | |
| | | sta1 = Utils.getRgvEndStaNo(rgvSlave.getId(),wrkMast.getStaNo()); |
| | | Integer staNo = Utils.getStaNo(rgvSlave.getId(), (int) sta1); |
| | | BasDevp devp = basDevpService.selectById(staNo); |
| | | if (devp.getWrkNo()!=0 || devp.getLoading().equals("Y")){ |
| | | if (devp.getWrkNo()!=0 || Cools.isEmpty(devp.getLoading()) || devp.getLoading().equals("Y")){ |
| | | continue; |
| | | } |
| | | work1 = true; |
| | |
| | | } |
| | | Integer staNo = Utils.getStaNo(rgvSlave.getId(), (int) sta1); |
| | | BasDevp devp = basDevpService.selectById(staNo); |
| | | if (devp.getWrkNo()!=0 || devp.getLoading().equals("Y")){ |
| | | if (devp.getWrkNo()!=0 || Cools.isEmpty(devp.getLoading()) || devp.getLoading().equals("Y")){ |
| | | continue; |
| | | } |
| | | workNo1 = commonService.getWorkNo(3); |
| | |
| | | } |
| | | Integer staNo = Utils.getStaNo(rgvSlave.getId(), (int) sta1); |
| | | BasDevp devp = basDevpService.selectById(staNo); |
| | | if (devp.getWrkNo()!=0 || devp.getLoading().equals("Y")){ |
| | | 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 = Cools.isEmpty(staProtocol.getAnfme()) ? anfme:staProtocol.getAnfme().shortValue(); |
| | | anfme = (Cools.isEmpty(staProtocol.getAnfme()) || staProtocol.getAnfme()==0) ? anfme:staProtocol.getAnfme().shortValue(); |
| | | weight11 = staProtocol.getWeight1(); |
| | | weight = weight11; |
| | | String memoBool = staProtocol.isBan()? "存在":"不存在"; |
| | |
| | | sta2 = Utils.getRgvEndStaNo(rgvSlave.getId(),wrkMast.getStaNo()); |
| | | Integer staNo = Utils.getStaNo(rgvSlave.getId(), (int) sta2); |
| | | BasDevp devp2 = basDevpService.selectById(staNo); |
| | | if (devp2.getWrkNo()!=0 || devp2.getLoading().equals("Y")){ |
| | | if (devp2.getWrkNo()!=0 || Cools.isEmpty(devp2.getLoading()) || devp2.getLoading().equals("Y")){ |
| | | continue; |
| | | } |
| | | |
| | |
| | | } |
| | | Integer staNo = Utils.getStaNo(rgvSlave.getId(), (int) sta2); |
| | | BasDevp devp2 = basDevpService.selectById(staNo); |
| | | if (devp2.getWrkNo()!=0 || devp2.getLoading().equals("Y")){ |
| | | if (devp2.getWrkNo()!=0 || Cools.isEmpty(devp2.getLoading()) || devp2.getLoading().equals("Y")){ |
| | | continue; |
| | | } |
| | | workNo2 = commonService.getWorkNo(3); |
| | |
| | | } |
| | | Integer staNo = Utils.getStaNo(rgvSlave.getId(), (int) sta2); |
| | | BasDevp devp2 = basDevpService.selectById(staNo); |
| | | if (devp2.getWrkNo()!=0 || devp2.getLoading().equals("Y")){ |
| | | if (devp2.getWrkNo()!=0 || Cools.isEmpty(devp2.getLoading()) || devp2.getLoading().equals("Y")){ |
| | | continue; |
| | | } |
| | | |
| | |
| | | if (inStn.getSourcePlcId() == 4){ |
| | | matnr2 = staProtocol.getMatnr(); |
| | | batch2 = staProtocol.getBatch(); |
| | | anfme2 = Cools.isEmpty(staProtocol.getAnfme2()) ? anfme2:staProtocol.getAnfme2().shortValue(); |
| | | anfme2 = (Cools.isEmpty(staProtocol.getAnfme2()) || staProtocol.getAnfme2()==0) ? anfme2:staProtocol.getAnfme2().shortValue(); |
| | | |
| | | weight11 = staProtocol.getWeight1(); |
| | | weight2 = weight11; |
| | | String memoBool = staProtocol.isBan()? "存在":"不存在"; |
| | |
| | | wrkMast.setWrkSts(14L); |
| | | wrkMast.setModiTime(date); |
| | | wrkMastService.updateById(wrkMast); |
| | | } else if (wrkMast.getIoType()==199){ |
| | | } else if (wrkMast.getIoType()==199 && rgvSlave.getId()==3 && (wrkMast.getStaNo()==3007 || wrkMast.getStaNo()==3012)){ |
| | | Date date = new Date(); |
| | | wrkMast.setWrkSts(105L); |
| | | wrkMast.setModiTime(date); |
| | |
| | | WaitPakin waitPakin = waitPakinService.selectOne(new EntityWrapper<WaitPakin>().eq("zpallet", barcode).eq("io_status", "N")); |
| | | if (Cools.isEmpty(waitPakin)) { |
| | | try { |
| | | CreateComb(barcode, staProtocol.getMatnr(),staProtocol.getWorkNo().intValue(),staProtocol.getBatch(),inSta); |
| | | CreateComb(barcode, staProtocol.getMatnr().toString(),staProtocol.getWorkNo().intValue(),staProtocol.getBatch(),inSta); |
| | | }catch (IOException e) { |
| | | throw new CoolException(e); |
| | | } |
| | |
| | | } |
| | | |
| | | } 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 { |
| | | public void CreateComb(String barcode,String code,Integer wrkNo,String batch,DevpSlave.Sta inSta) throws IOException { |
| | | Double anfme = 0d; |
| | | Double weight = 0d; |
| | | String memo = ""; |
| | |
| | | if (Cools.isEmpty(wrkMastSta)){ |
| | | wrkMastSta = wrkMastStaService.selectOne(new EntityWrapper<WrkMastSta>().eq("wrk_no2", wrkNo)); |
| | | if (Cools.isEmpty(wrkMastSta)){ |
| | | if (code >0 && !Cools.isEmpty(batch)){ |
| | | if (!Cools.isEmpty(batch)){ |
| | | anfme = 1d; |
| | | }else { |
| | | throw new CoolException("未找到对应的任务信息"); |
| | |
| | | weight = wrkMastSta.getWeight(); |
| | | memo = wrkMastSta.getMemo(); |
| | | } |
| | | MatnrCode matnrCode = matnrCodeService.selectByCode(code); |
| | | if (Cools.isEmpty(matnrCode)){ |
| | | //// |
| | | // MatnrCode matnrCode = matnrCodeService.selectByCode(code); |
| | | Mat mat = matService.selectByCode(code); |
| | | if (Cools.isEmpty(mat)){ |
| | | throw new CoolException("未找到对应的物料信息"); |
| | | } |
| | | CombParam combParam = new CombParam(); |
| | | ArrayList<CombParam.CombMat> combMats = new ArrayList<>(); |
| | | CombParam.CombMat combMat = new CombParam.CombMat(); |
| | | combParam.setBarcode(barcode); |
| | | combMat.setMatnr(matnrCode.getMatnr()); |
| | | combMat.setMatnr(mat.getMatnr()); |
| | | combMat.setBatch(batch); |
| | | combMat.setAnfme(anfme); |
| | | combMat.setWeight(weight); |