| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.Arith; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | |
| | | /** |
| | | * 生成工作号 |
| | |
| | | /** |
| | | * 检索库位号 |
| | | * @param whsType 类型 1:双深式货架 |
| | | * @param staDescId 路径ID |
| | | * @param sourceStaNo 源站 |
| | | * @return locNo 检索到的库位号 |
| | | */ |
| | | public StartupDto getLocNo(Integer whsType, Integer sourceStaNo) { |
| | | public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo) { |
| | | StartupDto startupDto = new StartupDto(); |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | if (Cools.isEmpty(rowLastno)) { |
| | |
| | | int eRow = rowLastno.geteRow(); |
| | | int crn_qty = rowLastno.getCrnQty(); |
| | | int rowCount = eRow - sRow + 1; |
| | | |
| | | // 同一天同规格货物靠近摆法规则 todo |
| | | List<String> locNos = locDetlService.getSameDetlToday("X004073XX"); |
| | | for (String locNo : locNos) { |
| | | // 获取排 |
| | | int row = Integer.parseInt(locNo.substring(0, 2)); |
| | | // 判断是否为深库位 |
| | | double remainder = Arith.remainder(row, rowCount / crn_qty); |
| | | if (remainder != 0 && remainder != 1) { |
| | | continue; |
| | | } |
| | | // 得到当前库位的外围库位 |
| | | System.out.println(); |
| | | } |
| | | |
| | | // 获取目标站所在货架排号 |
| | | Shelves shelves = new Shelves(rowCount, crn_qty); |
| | | curRow = shelves.start(curRow); |
| | |
| | | break; |
| | | } |
| | | } |
| | | BasCrnp crnp = basCrnpService.selectById(crnNo); |
| | | if (Cools.isEmpty(crnp)) { |
| | | throw new CoolException("堆垛机编号错误"); |
| | | } |
| | | if (!"Y".equals(crnp.getInEnable())) { |
| | | throw new CoolException("当前堆垛机无法入库"); |
| | | } |
| | | basCrnpService.checkSiteStatus(crnNo); |
| | | // 获取目标站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", 1) |
| | | .eq("type_no", staDescId) |
| | | .eq("stn_no", sourceStaNo) |
| | | .eq("crn_no", crnNo); |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | |
| | | startupDto.setStaNo(staNo.getDevNo()); |
| | | startupDto.setLocNo(locNo); |
| | | } else { |
| | | throw new CoolException("目标站不可用"); |
| | | throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | } |
| | | } else { |
| | | throw new CoolException(rowLastno.getWhsType()+"号库位排号分配规则不可用"); |
| | | } |
| | | return startupDto; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(Arith.remainder(1, 4)); |
| | | System.out.println("0200201".substring(0, 2)); |
| | | |
| | | } |
| | | |
| | | } |