| | |
| | | @RequestMapping(value = "/locRule/add/auth") |
| | | @ManagerAuth |
| | | public R add(LocRule locRule) { |
| | | if ((locRule.getRowBeg() < locRule.getRowEnd()) || locRule.getRowBeg() <= 0 || locRule.getRowEnd() <= 0) { |
| | | if ((locRule.getRowEnd() < locRule.getRowBeg()) || locRule.getRowBeg() <= 0 || locRule.getRowEnd() <= 0) { |
| | | return R.error("排区间错误"); |
| | | } |
| | | if ((locRule.getBayBeg() < locRule.getBayEnd()) || locRule.getBayBeg() <= 0 || locRule.getBayEnd() <= 0) { |
| | | if ((locRule.getBayEnd() < locRule.getBayBeg()) || locRule.getBayBeg() <= 0 || locRule.getBayEnd() <= 0) { |
| | | return R.error("列区间错误"); |
| | | } |
| | | if ((locRule.getLevBeg() < locRule.getLevEnd()) || locRule.getLevBeg() <= 0 || locRule.getLevEnd() <= 0) { |
| | | if ((locRule.getLevEnd() < locRule.getLevBeg()) || locRule.getLevBeg() <= 0 || locRule.getLevEnd() <= 0) { |
| | | return R.error("层区间错误"); |
| | | } |
| | | Date now = new Date(); |
| | |
| | | if (Cools.isEmpty(locRule) || null==locRule.getId()){ |
| | | return R.error(); |
| | | } |
| | | if ((locRule.getRowBeg() < locRule.getRowEnd()) || locRule.getRowBeg() <= 0 || locRule.getRowEnd() <= 0) { |
| | | if ((locRule.getRowEnd() < locRule.getRowBeg()) || locRule.getRowBeg() <= 0 || locRule.getRowEnd() <= 0) { |
| | | return R.error("排区间错误"); |
| | | } |
| | | if ((locRule.getBayBeg() < locRule.getBayEnd()) || locRule.getBayBeg() <= 0 || locRule.getBayEnd() <= 0) { |
| | | if ((locRule.getBayEnd() < locRule.getBayBeg()) || locRule.getBayBeg() <= 0 || locRule.getBayEnd() <= 0) { |
| | | return R.error("列区间错误"); |
| | | } |
| | | if ((locRule.getLevBeg() < locRule.getLevEnd()) || locRule.getLevBeg() <= 0 || locRule.getLevEnd() <= 0) { |
| | | if ((locRule.getLevEnd() < locRule.getLevBeg()) || locRule.getLevBeg() <= 0 || locRule.getLevEnd() <= 0) { |
| | | return R.error("层区间错误"); |
| | | } |
| | | locRule.setUpdateBy(getUserId()); |
| | |
| | | |
| | | public interface LocRuleService extends IService<LocRule> { |
| | | |
| | | LocRule find(String matnr, String batch); |
| | | LocRule find(String matnr, String batch, int startRow, int endRow); |
| | | |
| | | } |
| | |
| | | private MatService matService; |
| | | |
| | | @Override |
| | | public LocRule find(String matnr, String batch) { |
| | | public LocRule find(String matnr, String batch, int startRow, int endRow) { |
| | | if (Cools.isEmpty(matnr)) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | LocRule locRule = null; |
| | | do { |
| | | locRule = this.selectOne(new EntityWrapper<LocRule>().eq("matnr", matnr).eq("status", 1)); |
| | | locRule = this.selectOne(new EntityWrapper<LocRule>().eq("matnr", matnr).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); |
| | | if (null != locRule) { |
| | | break; |
| | | } |
| | | locRule = this.selectOne(new EntityWrapper<LocRule>().eq("specs", mat.getSpecs()).eq("status", 1)); |
| | | locRule = this.selectOne(new EntityWrapper<LocRule>().eq("specs", mat.getSpecs()).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); |
| | | if (null != locRule) { |
| | | break; |
| | | } |
| | | locRule = this.selectOne(new EntityWrapper<LocRule>().eq("model", mat.getModel()).eq("status", 1)); |
| | | locRule = this.selectOne(new EntityWrapper<LocRule>().eq("model", mat.getModel()).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); |
| | | if (null != locRule) { |
| | | break; |
| | | } |
| | | locRule = this.selectOne(new EntityWrapper<LocRule>().eq("batch", batch).eq("status", 1)); |
| | | locRule = this.selectOne(new EntityWrapper<LocRule>().eq("batch", batch).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); |
| | | if (null != locRule) { |
| | | break; |
| | | } |
| | |
| | | if (locMast == null) { |
| | | |
| | | // 库区锁定 |
| | | LocRule locRule = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0), null); |
| | | LocRule locRule = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0), null, start, end); |
| | | if (!Cools.isEmpty(locRule)) { |
| | | List<Integer> rows = Utils.getGroupLoc(locRule.getRowBeg()); |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast1(rows, rows.size(), locTypeDto.getLocType1(), inoutEveryday |