| | |
| | | private SlaveProperties slaveProperties; |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void execute(){ |
| | | private void execute() { |
| | | if (!enable) return; |
| | | |
| | | List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>()); |
| | | if (basCrnps.isEmpty()){ |
| | | if (basCrnps.isEmpty()) { |
| | | return; |
| | | } |
| | | Iterator<BasCrnp> iterator = basCrnps.iterator(); |
| | | while (iterator.hasNext()){ |
| | | while (iterator.hasNext()) { |
| | | BasCrnp basCrnp = iterator.next(); |
| | | if (basCrnp.getCrnNo() == 1 && !crn1){ |
| | | if (basCrnp.getCrnNo() == 1 && !crn1) { |
| | | iterator.remove(); |
| | | } |
| | | if (basCrnp.getCrnNo() == 2 && !crn2){ |
| | | if (basCrnp.getCrnNo() == 2 && !crn2) { |
| | | iterator.remove(); |
| | | } |
| | | if (basCrnp.getCrnNo() == 3 && !crn3){ |
| | | if (basCrnp.getCrnNo() == 3 && !crn3) { |
| | | iterator.remove(); |
| | | } |
| | | if (basCrnp.getCrnNo() == 4 && !crn4){ |
| | | if (basCrnp.getCrnNo() == 4 && !crn4) { |
| | | iterator.remove(); |
| | | } |
| | | if (basCrnp.getCrnNo() == 7){ |
| | | if (basCrnp.getCrnNo() == 7) { |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | if (basCrnps.isEmpty()){ |
| | | if (basCrnps.isEmpty()) { |
| | | return; |
| | | } |
| | | for (BasCrnp basCrnp:basCrnps){ |
| | | if (basCrnp.getCrnSts()!=3) continue; |
| | | for (BasCrnp basCrnp : basCrnps) { |
| | | if (basCrnp.getCrnSts() != 3) continue; |
| | | if (!basCrnp.getInEnable().equals("N") || !basCrnp.getOutEnable().equals("Y")) continue; |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("crn_no",basCrnp.getCrnNo()).eq("io_type",11)); |
| | | if (Cools.isEmpty(wrkMasts) || wrkMasts.size()==0) { |
| | | LocMast locMastStart = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts","D").eq("crn_no",basCrnp.getCrnNo()).orderBy("appe_time",true));//空板所在 |
| | | if (Cools.isEmpty(locMastStart)){ |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("crn_no", basCrnp.getCrnNo()).eq("io_type", 11)); |
| | | if (Cools.isEmpty(wrkMasts) || wrkMasts.size() == 0) { |
| | | LocMast locMastStart = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts", "D").eq("crn_no", basCrnp.getCrnNo()).orderBy("appe_time", true));//空板所在 |
| | | if (Cools.isEmpty(locMastStart)) { |
| | | continue; |
| | | } |
| | | if (!Utils.isShallowLoc(slaveProperties, locMastStart.getLocNo())){ |
| | | if (!Utils.isShallowLoc(slaveProperties, locMastStart.getLocNo())) { |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, locMastStart.getLocNo()); |
| | | LocMast locNo = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", shallowLocNo)); |
| | | if (!locNo.getLocSts().equals("O")){ |
| | | if (locNo != null && !locNo.getLocSts().equals("O")) { |
| | | locMastStart = locNo; |
| | | } |
| | | } |
| | | LocMast locMastEnd = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts","O") |
| | | .eq("crn_no",basCrnp.getCrnNo()) |
| | | .eq("loc_type1",locMastStart.getLocType1()) |
| | | .ne("modi_user",66) |
| | | .orderBy("row1",true));//目标 |
| | | if (Cools.isEmpty(locMastEnd)){ |
| | | .eq("loc_sts", "O") |
| | | .eq("crn_no", basCrnp.getCrnNo()) |
| | | .eq("loc_type1", locMastStart.getLocType1()) |
| | | .ne("modi_user", 77) |
| | | .orderBy("row1", true));//目标 |
| | | if (Cools.isEmpty(locMastEnd)) { |
| | | continue; |
| | | } |
| | | if (!Utils.isShallowLoc(slaveProperties, locMastEnd.getLocNo())){ |
| | | if (!Utils.isShallowLoc(slaveProperties, locMastEnd.getLocNo())) { |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, locMastEnd.getLocNo()); |
| | | LocMast locNo = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", shallowLocNo)); |
| | | if (locNo.getLocSts().equals("O")){ |
| | | if (locNo != null && locNo.getLocSts().equals("O")) { |
| | | |
| | | }else { |
| | | locMastEnd.setModiUser(66L); |
| | | } else { |
| | | locMastEnd.setModiUser(77L); |
| | | locMastService.updateById(locMastEnd); |
| | | continue; |
| | | } |
| | | } |
| | | // if (Cools.isEmpty(locMastStart) || Cools.isEmpty(locMastEnd)){ |
| | | |
| | | ReturnT<String> result = locMoveAllHandler.start(locMastStart,locMastEnd,basCrnp.getCrnNo()); |
| | | ReturnT<String> result = locMoveAllHandler.start(locMastStart, locMastEnd, basCrnp.getCrnNo()); |
| | | if (!result.isSuccess()) { |
| | | log.error("处理失败"); |
| | | } |