| | |
| | | import com.alibaba.fastjson.JSON; |
| | | 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.*; |
| | | import com.zy.asrs.entity.result.FindLocNoAttributeVo; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.asrs.utils.VersionUtils; |
| | | import com.zy.common.model.LocTypeDto; |
| | | import com.zy.common.model.Shelves; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.properties.SlaveProperties; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.sql.rowset.WebRowSet; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | |
| | | /** |
| | | * 货架核心功能 |
| | |
| | | @Autowired |
| | | private RowLastnoService rowLastnoService; |
| | | @Autowired |
| | | private RowLastnoTypeService rowLastnoTypeService; |
| | | @Autowired |
| | | private BasCrnpService basCrnpService; |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private LocRuleService locRuleService; |
| | | /** |
| | | * 生成工作号 |
| | | * |
| | |
| | | return workNo; |
| | | } |
| | | |
| | | //拆盘机处空板扫码,驱动托盘向码垛位,不入库 |
| | | @Transactional |
| | | public StartupDto getScanBarcodeEmptyBoard() { |
| | | StartupDto startupDto = new StartupDto(); |
| | | Integer staNo = 0; |
| | | if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 201).eq("staNo", 216)) < 2) { |
| | | staNo = 216; |
| | | } |
| | | if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 201).eq("staNo", 220)) < 2) { |
| | | staNo = 220; |
| | | } |
| | | |
| | | startupDto.setStaNo(staNo); |
| | | return startupDto; |
| | | } |
| | | |
| | | /** |
| | | * 检索库位号 |
| | | * |
| | | * @param whsType 类型 1:双深式货架 |
| | | * @param staDescId 路径ID |
| | | * @param sourceStaNo 源站 |
| | | * @param matnr 物料号集合 |
| | | * @return locNo 检索到的库位号 |
| | | */ |
| | | @Transactional |
| | | public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, LocTypeDto locTypeDto) { |
| | | return getLocNoRun(whsType,staDescId,sourceStaNo,matnr,batch,grade,0,locTypeDto,0); |
| | | public StartupDto getLocNo(Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, LocTypeDto locTypeDto) { |
| | | try { |
| | | Integer whsType = Utils.GetWhsType(sourceStaNo); |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | RowLastnoType rowLastnoType = rowLastnoTypeService.selectById(rowLastno.getTypeId()); |
| | | /** |
| | | * 库型 1: 标准堆垛机库 2: 平库 3: 穿梭板 4: 四向车 5: AGV 0: 未知 |
| | | */ |
| | | switch (rowLastnoType.getType()) { |
| | | case 4: |
| | | return getLocNoRun4(whsType, staDescId, sourceStaNo, matnr, batch, grade, 4, locTypeDto, 2); |
| | | } |
| | | } catch (CoolException ex) { |
| | | log.error("入库失败,错误信息: {}", ex.getMessage(), ex); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Transactional |
| | | public StartupDto getLocNoNew(Integer staDescId, Integer sourceStaNo,FindLocNoAttributeVo findLocNoAttributeVo,LocTypeDto locTypeDto,String barcode){ |
| | | StartupDto startupDto = null; |
| | | StringBuilder builder = new StringBuilder(); |
| | | try { |
| | | startupDto = searchLocNoByCrnNo(staDescId,sourceStaNo,findLocNoAttributeVo,locTypeDto); |
| | | }catch (Exception e){ |
| | | builder.append(e.getMessage()).append(","); |
| | | } |
| | | |
| | | if (startupDto == null){ |
| | | builder.append("找不到空库位"); |
| | | throw new CoolException(builder.toString()); |
| | | } |
| | | return startupDto; |
| | | } |
| | | |
| | | @Transactional |
| | | public StartupDto searchLocNoByCrnNo(Integer staDescId,Integer sourceStaNo,FindLocNoAttributeVo findLocNoAttributeVo,LocTypeDto locTypeDto){ |
| | | LocMast locMast = null; |
| | | if (staDescId == 10){ |
| | | //搜索空托盘 |
| | | locMast = searchEmptyPallet(locTypeDto); |
| | | }else { |
| | | //满托盘 |
| | | locMast = searchMaxPallet(findLocNoAttributeVo,locTypeDto); |
| | | } |
| | | |
| | | if (locMast == null){ |
| | | throw new CoolException("找不到符合尺寸的空库位"); |
| | | } |
| | | |
| | | StartupDto startupDto = new StartupDto(); |
| | | |
| | | String locNo = locMast.getLocNo(); |
| | | //生成工作号 |
| | | int workNo = getWorkNo(0); |
| | | //返回dto |
| | | startupDto.setWorkNo(workNo); |
| | | startupDto.setCrnNo(locMast.getCrnNo()); |
| | | startupDto.setSourceStaNo(sourceStaNo); |
| | | startupDto.setLocNo(locNo); |
| | | |
| | | return startupDto; |
| | | } |
| | | |
| | | //搜索满托盘库位 |
| | | public LocMast searchMaxPallet(FindLocNoAttributeVo findLocNoAttributeVo, LocTypeDto locTypeDto){ |
| | | LocMast targetLocMast = null; |
| | | List<String> locNos = locDetlService.getSameDetlList(findLocNoAttributeVo.getMatnr()); |
| | | for (String locNo : locNos) { |
| | | //获取通道组 |
| | | List<Integer> locRowGroupDesc = Utils.getLocGroupDesc(slaveProperties,locNo); |
| | | for (Integer row : locRowGroupDesc) { |
| | | String deepLocNo = Utils.getLocNo(row,Utils.getBay(locNo),Utils.getLev(locNo)); |
| | | LocMast deepLoc = locMastService.selectById(deepLocNo); |
| | | if (deepLoc == null){ |
| | | continue; |
| | | } |
| | | |
| | | if (deepLoc.getLocSts().equals("F")){ |
| | | continue; |
| | | }else if (deepLoc.getLocSts().equals("O")){ |
| | | targetLocMast = deepLoc; |
| | | break; |
| | | }else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (targetLocMast == null){ |
| | | //相近物料匹配失败,搜索可用空库位组 |
| | | |
| | | //获取设备楼层 |
| | | // List<Integer> levList = basCrnpService.getLevList(); |
| | | // Collections.shuffle(levList); |
| | | |
| | | List<Integer> locLevList = locMastService.getLevList(); |
| | | // levList.addAll(locLevList); |
| | | |
| | | for (Integer lev : locLevList) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "O").eq("lev1", lev).orderBy("bay1", true).orderBy("row1",true)); |
| | | for (LocMast locMast : locMasts) { |
| | | String locNo = locMast.getLocNo(); |
| | | //获取通道组 |
| | | List<Integer> locRowGroupDesc = Utils.getLocGroupDesc(slaveProperties,locNo); |
| | | |
| | | boolean flag = true; |
| | | for (Integer row : locRowGroupDesc) { |
| | | String deepLocNo = Utils.getLocNo(row,Utils.getBay(locNo),Utils.getLev(locNo)); |
| | | LocMast deepLoc = locMastService.selectById(deepLocNo); |
| | | if (deepLoc == null){ |
| | | continue; |
| | | } |
| | | |
| | | if (!deepLoc.getLocSts().equals("O")){ |
| | | flag = false; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (flag){ |
| | | for (Integer row : locRowGroupDesc) { |
| | | String deepLocNo = Utils.getLocNo(row,Utils.getBay(locNo),Utils.getLev(locNo)); |
| | | LocMast deepLoc = locMastService.selectById(deepLocNo); |
| | | if (deepLoc == null){ |
| | | continue; |
| | | } |
| | | |
| | | targetLocMast = deepLoc; |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | if (targetLocMast != null){ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return targetLocMast; |
| | | } |
| | | |
| | | //搜索空托盘库位 |
| | | public LocMast searchEmptyPallet(LocTypeDto locTypeDto){ |
| | | LocMast targetLocMast = null; |
| | | List<LocMast> locMastsD = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D")); |
| | | for (LocMast locMast : locMastsD) { |
| | | String locNo = locMast.getLocNo(); |
| | | //获取通道组 |
| | | List<Integer> locGroupDesc = Utils.getLocGroupDesc(slaveProperties, locNo); |
| | | for (Integer row : locGroupDesc) { |
| | | String deepLocNo = Utils.getLocNo(row, Utils.getBay(locNo), Utils.getLev(locNo)); |
| | | LocMast deepLoc = locMastService.selectById(deepLocNo); |
| | | if (deepLoc == null){ |
| | | continue; |
| | | } |
| | | |
| | | if (deepLoc.getLocSts().equals("F")){ |
| | | continue; |
| | | }else if (deepLoc.getLocSts().equals("O")){ |
| | | targetLocMast = deepLoc; |
| | | break; |
| | | }else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (targetLocMast == null){ |
| | | //获取设备楼层 |
| | | // List<Integer> levList = basCrnpService.getLevList(); |
| | | // Collections.shuffle(levList); |
| | | |
| | | List<Integer> locLevList = locMastService.getLevList(); |
| | | // levList.addAll(locLevList); |
| | | |
| | | for (Integer lev : locLevList) { |
| | | //相近物料匹配失败,搜索可用空库位组 |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "O").eq("lev1", lev).orderBy("bay1", true).orderBy("row1",true)); |
| | | for (LocMast locMast : locMasts) { |
| | | String locNo = locMast.getLocNo(); |
| | | //获取通道组 |
| | | List<Integer> locGroupDesc = Utils.getLocGroupDesc(slaveProperties, locNo); |
| | | |
| | | boolean flag = true; |
| | | for (Integer row : locGroupDesc) { |
| | | String deepLocNo = Utils.getLocNo(row, Utils.getBay(locNo), Utils.getLev(locNo)); |
| | | LocMast deepLoc = locMastService.selectById(deepLocNo); |
| | | if (deepLoc == null){ |
| | | continue; |
| | | } |
| | | |
| | | if (!deepLoc.getLocSts().equals("O")){ |
| | | flag = false; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (flag){ |
| | | for (Integer row : locGroupDesc) { |
| | | String deepLocNo = Utils.getLocNo(row, Utils.getBay(locNo), Utils.getLev(locNo)); |
| | | LocMast deepLoc = locMastService.selectById(deepLocNo); |
| | | if (deepLoc == null){ |
| | | continue; |
| | | } |
| | | |
| | | targetLocMast = deepLoc; |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | if (targetLocMast != null){ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return targetLocMast; |
| | | } |
| | | |
| | | /** |
| | |
| | | if (Cools.isEmpty(matnr)) { //物料号 |
| | | matnr = ""; |
| | | } |
| | | if (Cools.isEmpty(batch)) { //箱号 |
| | | if (Cools.isEmpty(batch)) { //批次 |
| | | batch = ""; |
| | | } |
| | | if (Cools.isEmpty(grade)) { //备用 |
| | |
| | | |
| | | StartupDto startupDto = new StartupDto(); |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | if (Cools.isEmpty(rowLastno)) { |
| | | throw new CoolException("数据异常,请联系管理员===>库位规则未知"); |
| | | } |
| | | RowLastnoType rowLastnoType = rowLastnoTypeService.selectById(rowLastno.getTypeId()); |
| | | if (Cools.isEmpty(rowLastnoType)) { |
| | | throw new CoolException("数据异常,请联系管理员===》库位规则类型未知"); |
| | | } |
| | | int sRow = rowLastno.getsRow(); |
| | | int eRow = rowLastno.geteRow(); |
| | | int crnNumber = rowLastno.getCrnQty(); |
| | | |
| | | if (Cools.isEmpty(rowLastno)) { |
| | | throw new CoolException("数据异常,请联系管理员"); |
| | | } |
| | | |
| | | // ===============>>>> 开始执行 |
| | | curRow = rowLastno.getCurrentRow(); |
| | | |
| | | if (!Cools.isEmpty(moveCrnNo) && moveCrnNo!=0){ |
| | | if (!Cools.isEmpty(moveCrnNo) && moveCrnNo != 0) { |
| | | crnNumber = moveCrnNo; |
| | | if (times==0){ |
| | | curRow = moveCrnNo*4-1; |
| | | }else { |
| | | curRow = moveCrnNo*4-2; |
| | | if (times == 0) { |
| | | curRow = moveCrnNo * 4 - 1; |
| | | } else { |
| | | curRow = moveCrnNo * 4 - 2; |
| | | } |
| | | } |
| | | |
| | | //此程序用于优化堆垛机异常时的运行时间 |
| | | for (int i = times; i < crnNumber; i++) { |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(whsType, curRow, crnNumber); |
| | | for (int i = times; i < crnNumber * 2; i++) { |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber); |
| | | curRow = locNecessaryParameters[1]; |
| | | crnNo = locNecessaryParameters[2]; |
| | | if (basCrnpService.checkSiteError(crnNo, true)) { |
| | | rowCount = locNecessaryParameters[0]; |
| | | rowCount = locNecessaryParameters[0]; |
| | | nearRow = locNecessaryParameters[3]; |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("row1", nearRow).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | int crnCountO = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type", 100)); |
| | | if (locMasts.size() - crnCountO <= 2) { |
| | | times++; |
| | | continue; |
| | | } |
| | | break; |
| | | } else { |
| | | times++; |
| | |
| | | boolean signRule2 = false; |
| | | |
| | | |
| | | // 靠近摆放规则 --- 同天同规格物料 //分离版 |
| | | // if (!Cools.isEmpty(matnr) && (staDescId == 1)){ |
| | | // signRule1 = true; |
| | | // } |
| | | // 靠近摆放规则 --- 同天同规格物料 //互通版 |
| | | if (!Cools.isEmpty(matnr) && staDescId == 1) { |
| | | signRule2 = true; |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | // 靠近摆放规则 --- 同天同规格物料 //分离版 |
| | | if (!Cools.isEmpty(matnr) && staDescId == 1) { |
| | | signRule1 = true; |
| | | } |
| | | // 靠近摆放规则 --- 同天同规格物料 //互通版 |
| | | if (!Cools.isEmpty(matnr) && staDescId == 1) { |
| | | signRule2 = true; |
| | | } |
| | | |
| | | if (!Cools.isEmpty(matnr) && (staDescId == 11 || staDescId == 111)) { |
| | | signRule1 = true; |
| | | } |
| | | } |
| | | |
| | | if (!Cools.isEmpty(matnr) && (staDescId == 11 || staDescId == 111)) { |
| | | signRule1 = true; |
| | | } |
| | | |
| | | if (signRule1){ |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | for (LocMast locMast1:locMasts){ |
| | | if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo()); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",shallowLoc)); |
| | | if (!Cools.isEmpty(locMast2) && locMast2.getLocSts().equals("F")){ |
| | | LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMast2.getLocNo())); |
| | | if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr())) { |
| | | locMast = locMast1; |
| | | break; |
| | | if (signRule1) { |
| | | if (nearRow != curRow) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("row1", nearRow).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | for (LocMast locMast1 : locMasts) { |
| | | //获取巷道 |
| | | // List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow); |
| | | // LocMast locMastGro = locMastService.selectById(wrkMast.getLocNo()); |
| | | //获取目标库位所在巷道最浅非空库位 |
| | | LocMast locMastF = locMastService.selectLocByLocStsPakInF(curRow, nearRow, locMast1, rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("F")) { |
| | | LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMastF.getLocNo())); |
| | | if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr()) |
| | | && batch.equals(batch.isEmpty() ? "" : locDetl.getBatch()) |
| | | && grade.equals(grade.isEmpty() ? "" : locDetl.getBrand())) { |
| | | //获取目标库位所在巷道最深空库位 |
| | | locMast = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, rowLastnoType.getType().longValue()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }else if (signRule2){ |
| | | List<String> locNos = locDetlService.getSameDetlToday(matnr,batch, sRow, eRow); |
| | | } else if (signRule2) { |
| | | List<String> locNos = locDetlService.getSameDetlToday(matnr, sRow, eRow); |
| | | for (String locNo : locNos) { |
| | | if (Utils.isShallowLoc(slaveProperties, locNo)) { |
| | | continue; |
| | |
| | | } |
| | | |
| | | // // 靠近摆放规则 --- 空托 //分离版 |
| | | // if (staDescId == 10) { |
| | | // if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(whsType)) { |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | // for (LocMast locMast1:locMasts){ |
| | | // if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | |
| | | // } |
| | | |
| | | // 靠近摆放规则 --- 空托 //互通版 |
| | | if (staDescId == 10) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow)); |
| | | if (locMasts.size() > 0) { |
| | | if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow).eq("whs_type", rowLastnoType.getType().longValue())); |
| | | if (!locMasts.isEmpty()) { |
| | | for (LocMast loc : locMasts) { |
| | | if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) { |
| | | continue; |
| | |
| | | StaDesc staDesc = null; |
| | | BasDevp staNo = null; |
| | | |
| | | if (Utils.BooleanWhsTypeSta(whsType, staDescId)) { |
| | | if (Utils.BooleanWhsTypeSta(rowLastno, staDescId)) { |
| | | // 获取目标站 |
| | | wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", staDescId) |
| | |
| | | log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo); |
| | | // throw new CoolException("入库路径不存在"); |
| | | crnNo = 0; |
| | | } |
| | | staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | } else { |
| | | staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | log.error("目标站" + staDesc.getCrnStn() + "不可用"); |
| | | // throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | crnNo = 0; |
| | | crnNo = 0; |
| | | } |
| | | startupDto.setStaNo(staNo.getDevNo()); |
| | | } |
| | | startupDto.setStaNo(staNo.getDevNo()); |
| | | } |
| | | |
| | | // 更新库位排号 |
| | | if (Utils.BooleanWhsTypeSta(whsType, staDescId)) { |
| | | rowLastno.setCurrentRow(curRow); |
| | | rowLastnoService.updateById(rowLastno); |
| | | // 更新库位排号 |
| | | if (Cools.isEmpty(locMast)) { |
| | | rowLastno.setCurrentRow(curRow); |
| | | rowLastnoService.updateById(rowLastno); |
| | | } |
| | | } |
| | | |
| | | // 开始查找库位 ==============================>> |
| | | |
| | | // 1.按规则查找库位 |
| | | if (Cools.isEmpty(locMast) && crnNo != 0) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("row1", nearRow) |
| | | .eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()) |
| | | .orderBy("lev1", true).orderBy("bay1", true)); |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo()); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", shallowLoc).eq("loc_sts", "O")); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast2; |
| | | break; |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo()); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast2; |
| | | break; |
| | | } |
| | | } else { |
| | | if (!Cools.isEmpty(locMast1)) { |
| | | locMast = locMast1; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (Cools.isEmpty(locMast) && Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo()); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast2; |
| | | break; |
| | | } else { |
| | | locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "F").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast1; |
| | | break; |
| | | } else { |
| | | locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "D").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast1; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | if (!Cools.isEmpty(locMast1)) { |
| | | locMast = locMast1; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | // 递归查询 |
| | | if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("O")) { |
| | | // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 |
| | | if (times < rowCount) { |
| | | if (times < rowCount * 2) { |
| | | times = times + 1; |
| | | return getLocNoRun(1, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times); |
| | | return getLocNoRun(whsType, staDescId, sourceStaNo, matnr, batch, grade, moveCrnNo, locTypeDto, times); |
| | | } |
| | | // // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 |
| | | // if (locTypeDto.getLocType1() < 2) { |
| | |
| | | startupDto.setLocNo(locNo); |
| | | return startupDto; |
| | | } |
| | | |
| | | public StartupDto getLocNoRun4(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | int crnNo = 1;//小车编号备用 |
| | | RowLastno rowLastno = rowLastnoService.selectById(4); |
| | | LocMast locMast = null; // 目标库位 |
| | | StartupDto startupDto = new StartupDto(); |
| | | int curRow = rowLastno.getCurrentRow(); |
| | | int sRow = rowLastno.getsRow(); |
| | | int eRow = rowLastno.geteRow(); |
| | | int nearRow = 8;//特殊单排 |
| | | int orbit = 7;//轨道 |
| | | // 相似工作档案 --- 同天同规格物料 |
| | | if (!Cools.isEmpty(matnr) && (staDescId == 1 || staDescId == 11 || staDescId == 111) ) { |
| | | //查询相似工作档案 |
| | | List<WrkMast> wrkMasts = wrkMastService.selectWrkMastWrkDetlMatnrBatch(1, matnr, batch,null, crnNo); |
| | | for (WrkMast wrkMast:wrkMasts){ |
| | | if (Cools.isEmpty(wrkMast.getLocNo())){ |
| | | continue; |
| | | } |
| | | //目标排为轨道外排 |
| | | if (Utils.getRow(wrkMast.getLocNo()) == orbit || Utils.getRow(wrkMast.getLocNo()) == nearRow){ |
| | | continue; |
| | | } |
| | | //查找此库位的浅库位是否为空 |
| | | int value = Integer.valueOf(wrkMast.getLocNo().substring(0, 2)) + 1; |
| | | String loc="0"+value+wrkMast.getLocNo().substring(2); |
| | | LocMast locMast1=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no",loc) |
| | | .eq("loc_sts","O") |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | ); |
| | | if(Cools.isEmpty(locMast1)){ |
| | | continue; |
| | | } |
| | | locMast=locMast1; |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | // 靠近摆放规则 --- 同天同规格物料 |
| | | if (Cools.isEmpty(locMast)) { |
| | | List<LocDetl> locNos = locDetlService.getSameDetlToday(matnr, batch,sRow, eRow); |
| | | for (LocDetl locNo : locNos) { |
| | | //目标排为最外层排 |
| | | if (Utils.getRow(locNo.getLocNo()) == nearRow || Utils.getRow(locNo.getLocNo()) == orbit){ |
| | | continue; |
| | | } |
| | | LocMast locMast2=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no",locNo.getLocNo()) |
| | | .eq("loc_sts","F")); |
| | | if(Cools.isEmpty(locMast2)){ |
| | | continue; |
| | | } |
| | | int value = Integer.valueOf(locNo.getLocNo().substring(0, 2)) + 1; |
| | | String loc="0"+value+locNo.getLocNo().substring(2); |
| | | LocMast locMast1=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no",loc) |
| | | .eq("loc_sts","O") |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | ); |
| | | if(Cools.isEmpty(locMast1)){ |
| | | continue; |
| | | } |
| | | locMast=locMast1; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // 靠近摆放规则 --- 空托 |
| | | if (staDescId == 10) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow)); |
| | | if (locMasts.size() > 0) { |
| | | for (LocMast loc : locMasts) { |
| | | if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) { |
| | | continue; |
| | | } |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo()); |
| | | // 检测目标库位是否为空库位 |
| | | LocMast shallowLoc = locMastService.selectById(shallowLocNo); |
| | | if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { |
| | | if (shallowLoc.getLocType1()<locTypeDto.getLocType1()){ |
| | | continue; |
| | | } |
| | | if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { |
| | | locMast = shallowLoc; |
| | | crnNo = locMast.getCrnNo(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 获取目标站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", staDescId) |
| | | .eq("stn_no", sourceStaNo) |
| | | .eq("crn_no", 1); |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo); |
| | | throw new CoolException("入库路径不存在"); |
| | | } |
| | | BasDevp staNo = basDevpService.selectById(staDesc.getStnNo()); |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | } |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | if (null == locMast) { |
| | | LocMast locMast1 = new LocMast(); |
| | | if(times != 0){ |
| | | locMast1=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("row1", 1) |
| | | .eq("loc_sts","O") |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | .orderBy("lev1,bay1 ASC")); |
| | | } else { |
| | | locMast1=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("row1", 8) |
| | | .eq("loc_sts","O") |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | .orderBy("lev1,bay1 ASC")); |
| | | } |
| | | if(!Cools.isEmpty(locMast1)){ |
| | | locMast=locMast1; |
| | | } |
| | | } |
| | | // 更新库位排号 |
| | | rowLastno.setCurrentRow(curRow); |
| | | rowLastnoService.updateById(rowLastno); |
| | | |
| | | // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 |
| | | if (Cools.isEmpty(locMast)) { |
| | | times = times - 1; |
| | | if (times >= 0) { |
| | | return getLocNoRun4(whsType,staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo,locTypeDto,times); |
| | | } |
| | | log.error("系统没有空库位!!! 尺寸规格: {},", JSON.toJSONString(locTypeDto)); |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | | String locNo = locMast.getLocNo(); |
| | | // 返回找到的库位 |
| | | int workNo = getWorkNo(0); |
| | | startupDto.setWorkNo(workNo); |
| | | startupDto.setCrnNo(locMast.getCrnNo()); |
| | | startupDto.setSourceStaNo(sourceStaNo); |
| | | startupDto.setLocNo(locNo); |
| | | |
| | | return startupDto; |
| | | } |
| | | |
| | | public StartupDto getLocNoRunPick(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | int crnNo = 1;//小车编号备用 |
| | | RowLastno rowLastno = rowLastnoService.selectById(4); |
| | | LocMast locMast = null; // 目标库位 |
| | | StartupDto startupDto = new StartupDto(); |
| | | int curRow = rowLastno.getCurrentRow(); |
| | | int sRow = rowLastno.getsRow(); |
| | | int eRow = rowLastno.geteRow(); |
| | | int nearRow = 8;//特殊单排 |
| | | int orbit = 7;//轨道 |
| | | // 相似工作档案 --- 同天同规格物料 |
| | | if (!Cools.isEmpty(matnr) && (staDescId == 1 || staDescId == 11 || staDescId == 111) ) { |
| | | //查询相似工作档案 |
| | | List<WrkMast> wrkMasts = wrkMastService.selectWrkMastWrkDetlMatnrBatch(1, matnr, batch,null, crnNo); |
| | | for (WrkMast wrkMast:wrkMasts){ |
| | | if (Cools.isEmpty(wrkMast.getLocNo())){ |
| | | continue; |
| | | } |
| | | //目标排为轨道外排 |
| | | if (Utils.getRow(wrkMast.getLocNo()) == orbit || Utils.getRow(wrkMast.getLocNo()) == nearRow){ |
| | | continue; |
| | | } |
| | | //查找此库位的浅库位是否为空 |
| | | int value = Integer.valueOf(wrkMast.getLocNo().substring(0, 2)) + 1; |
| | | String loc="0"+value+wrkMast.getLocNo().substring(2); |
| | | LocMast locMast1=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no",loc) |
| | | .eq("loc_sts","O") |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | ); |
| | | if(Cools.isEmpty(locMast1)){ |
| | | continue; |
| | | } |
| | | locMast=locMast1; |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | // 靠近摆放规则 --- 同天同规格物料 |
| | | if (Cools.isEmpty(locMast)) { |
| | | List<LocDetl> locNos = locDetlService.getSameDetlToday(matnr, batch,sRow, eRow); |
| | | for (LocDetl locNo : locNos) { |
| | | //目标排为最外层排 |
| | | if (Utils.getRow(locNo.getLocNo()) == nearRow || Utils.getRow(locNo.getLocNo()) == orbit){ |
| | | continue; |
| | | } |
| | | LocMast locMast2=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no",locNo.getLocNo()) |
| | | .eq("loc_sts","F")); |
| | | if(Cools.isEmpty(locMast2)){ |
| | | continue; |
| | | } |
| | | int value = Integer.valueOf(locNo.getLocNo().substring(0, 2)) + 1; |
| | | String loc="0"+value+locNo.getLocNo().substring(2); |
| | | LocMast locMast1=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no",loc) |
| | | .eq("loc_sts","O") |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | ); |
| | | if(Cools.isEmpty(locMast1)){ |
| | | continue; |
| | | } |
| | | locMast=locMast1; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // 靠近摆放规则 --- 空托 |
| | | if (staDescId == 10) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow)); |
| | | if (locMasts.size() > 0) { |
| | | for (LocMast loc : locMasts) { |
| | | if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) { |
| | | continue; |
| | | } |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo()); |
| | | // 检测目标库位是否为空库位 |
| | | LocMast shallowLoc = locMastService.selectById(shallowLocNo); |
| | | if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { |
| | | if (shallowLoc.getLocType1()<locTypeDto.getLocType1()){ |
| | | continue; |
| | | } |
| | | if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { |
| | | locMast = shallowLoc; |
| | | crnNo = locMast.getCrnNo(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 获取目标站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", staDescId) |
| | | .eq("stn_no", sourceStaNo) |
| | | .eq("crn_no", 1); |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo); |
| | | throw new CoolException("入库路径不存在"); |
| | | } |
| | | BasDevp staNo = basDevpService.selectById(staDesc.getStnNo()); |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | } |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | if (null == locMast) { |
| | | LocMast locMast1 = new LocMast(); |
| | | if(times != 0){ |
| | | locMast1=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("row1", 1) |
| | | .eq("loc_sts","O") |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | .orderBy("lev1,bay1 ASC")); |
| | | } else { |
| | | locMast1=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("row1", 8) |
| | | .eq("loc_sts","O") |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | .orderBy("lev1,bay1 ASC")); |
| | | } |
| | | if(!Cools.isEmpty(locMast1)){ |
| | | locMast=locMast1; |
| | | } |
| | | } |
| | | // 更新库位排号 |
| | | rowLastno.setCurrentRow(curRow); |
| | | rowLastnoService.updateById(rowLastno); |
| | | |
| | | // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 |
| | | if (Cools.isEmpty(locMast)) { |
| | | times = times - 1; |
| | | if (times >= 0) { |
| | | return getLocNoRun4(whsType,staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo,locTypeDto,times); |
| | | } |
| | | log.error("系统没有空库位!!! 尺寸规格: {},", JSON.toJSONString(locTypeDto)); |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | | String locNo = locMast.getLocNo(); |
| | | // 返回找到的库位 |
| | | startupDto.setWorkNo(0); |
| | | startupDto.setCrnNo(locMast.getCrnNo()); |
| | | startupDto.setSourceStaNo(sourceStaNo); |
| | | startupDto.setLocNo(locNo); |
| | | |
| | | return startupDto; |
| | | } |
| | | |
| | | public StartupDto getLocNoRun5(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | if (Cools.isEmpty(matnr)) { //物料号 |
| | | matnr = ""; |
| | | } |
| | | if (Cools.isEmpty(batch)) { //批次 |
| | | batch = ""; |
| | | } |
| | | if (Cools.isEmpty(grade)) { //备用 |
| | | grade = ""; |
| | | } |
| | | |
| | | // 初始化参数 |
| | | int crnNo = 0; //堆垛机号 |
| | | int nearRow = 0; //最浅库位排 |
| | | int curRow = 0; //最深库位排 |
| | | int rowCount = 0; //轮询轮次 |
| | | LocMast locMast = null; // 目标库位 |
| | | |
| | | StartupDto startupDto = new StartupDto(); |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | if (Cools.isEmpty(rowLastno)) { |
| | | throw new CoolException("数据异常,请联系管理员===>库位规则未知"); |
| | | } |
| | | RowLastnoType rowLastnoType = rowLastnoTypeService.selectById(rowLastno.getTypeId()); |
| | | if (Cools.isEmpty(rowLastnoType)) { |
| | | throw new CoolException("数据异常,请联系管理员===》库位规则类型未知"); |
| | | } |
| | | int sRow = rowLastno.getsRow(); |
| | | int eRow = rowLastno.geteRow(); |
| | | int crnNumber = eRow - sRow + 1; |
| | | |
| | | // ===============>>>> 开始执行 |
| | | curRow = rowLastno.getCurrentRow(); |
| | | |
| | | if (!Cools.isEmpty(moveCrnNo) && moveCrnNo != 0) { |
| | | crnNumber = moveCrnNo; |
| | | } |
| | | |
| | | //此程序用于优化堆垛机异常时的运行时间 |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber); |
| | | curRow = locNecessaryParameters[1]; |
| | | crnNo = locNecessaryParameters[2]; |
| | | rowCount = locNecessaryParameters[0]; |
| | | nearRow = locNecessaryParameters[3]; |
| | | |
| | | Wrapper<StaDesc> wrapper = null; |
| | | StaDesc staDesc = null; |
| | | BasDevp staNo = null; |
| | | |
| | | if (Utils.BooleanWhsTypeSta(rowLastno, staDescId)) { |
| | | // 获取目标站 |
| | | wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", staDescId) |
| | | .eq("stn_no", sourceStaNo) |
| | | .eq("crn_no", crnNo); |
| | | staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo); |
| | | // throw new CoolException("入库路径不存在"); |
| | | crnNo = 0; |
| | | } else { |
| | | staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | log.error("目标站" + staDesc.getCrnStn() + "不可用"); |
| | | // throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | crnNo = 0; |
| | | } |
| | | startupDto.setStaNo(staNo.getDevNo()); |
| | | } |
| | | } |
| | | |
| | | // 更新库位排号 |
| | | if (Utils.BooleanWhsTypeSta(rowLastno, staDescId) && Cools.isEmpty(locMast)) { |
| | | rowLastno.setCurrentRow(curRow); |
| | | rowLastnoService.updateById(rowLastno); |
| | | } |
| | | |
| | | // 开始查找库位 ==============================>> |
| | | |
| | | // 1.按规则查找库位 |
| | | if (Cools.isEmpty(locMast) && crnNo != 0) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("row1", nearRow) |
| | | .eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()) |
| | | .orderBy("lev1", true).orderBy("bay1", true));//最浅库位 |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | //获取目标库位所在巷道最深空库位 |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMast2) && locMast2.getBay1() == curRow) { |
| | | locMast = locMast2; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 递归查询 |
| | | if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("O")) { |
| | | // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 |
| | | if (times < rowCount * 2) { |
| | | times = times + 1; |
| | | return getLocNoRun5(whsType, staDescId, sourceStaNo, matnr, batch, grade, moveCrnNo, locTypeDto, times); |
| | | } |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | | String locNo = locMast.getLocNo(); |
| | | |
| | | // 生成工作号 |
| | | int workNo = getWorkNo(0); |
| | | // 返回dto |
| | | startupDto.setWorkNo(workNo); |
| | | startupDto.setCrnNo(crnNo); |
| | | startupDto.setSourceStaNo(sourceStaNo); |
| | | startupDto.setLocNo(locNo); |
| | | return startupDto; |
| | | } |
| | | |
| | | public static String zerofill(String msg, Integer count) { |
| | | if (msg.length() == count) { |
| | | return msg; |
| | | } else if (msg.length() > count) { |
| | | return msg.substring(0, 16); |
| | | } else { |
| | | StringBuilder msgBuilder = new StringBuilder(msg); |
| | | for (int i = 0; i < count - msg.length(); ++i) { |
| | | msgBuilder.insert(0, "0"); |
| | | } |
| | | return msgBuilder.toString(); |
| | | } |
| | | } |
| | | |
| | | } |