| | |
| | | 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.entity.result.KeyValueVo; |
| | | 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 java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | |
| | | return workNo; |
| | | } |
| | | |
| | | //拆盘机处空板扫码,驱动托盘向码垛位,不入库 |
| | | // 拆盘机处空板扫码,驱动托盘向码垛位,不入库 |
| | | @Transactional |
| | | public StartupDto getScanBarcodeEmptyBoard() { |
| | | StartupDto startupDto = new StartupDto(); |
| | |
| | | * |
| | | * @param staDescId 路径ID |
| | | * @param sourceStaNo 源站 |
| | | * @param whsType |
| | | * @param findLocNoAttributeVo 属性 |
| | | * @param locTypeDto 类型 |
| | | * @return locNo 检索到的库位号 |
| | | */ |
| | | @Transactional |
| | | public StartupDto getLocNo(Integer staDescId, Integer sourceStaNo, FindLocNoAttributeVo findLocNoAttributeVo, LocTypeDto locTypeDto) { |
| | | public StartupDto getLocNo(Integer staDescId, Integer sourceStaNo, Integer whsType, FindLocNoAttributeVo findLocNoAttributeVo, |
| | | LocTypeDto locTypeDto) { |
| | | try { |
| | | Integer whsType = Utils.GetWhsType(sourceStaNo); |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | RowLastnoType rowLastnoType = rowLastnoTypeService.selectById(rowLastno.getTypeId()); |
| | | // Integer whsType = Utils.GetWhsType(sourceStaNo); |
| | | // RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | // RowLastnoType rowLastnoType = rowLastnoTypeService.selectById(rowLastno.getTypeId()); |
| | | /** |
| | | * 库型 1: 标准堆垛机库 2: 平库 3: 穿梭板 4: 四向车 5: AGV 0: 未知 |
| | | * 库型 1: 标准堆垛机库 2: 平库 3: 穿梭板 4: 四向车 5: AGV 0: 未知 |
| | | */ |
| | | return getLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 0, locTypeDto, 0); |
| | | return getLocNoRun(staDescId, whsType, sourceStaNo, findLocNoAttributeVo, 0, locTypeDto, 0); |
| | | |
| | | // switch (rowLastnoType.getType()) { |
| | | // case 1: |
| | | // return getLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 0, locTypeDto, 0); |
| | | //// case 2: |
| | | //// log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | //// break; |
| | | //// case 3: |
| | | //// log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | //// break; |
| | | //// case 4: |
| | | //// return getLocNoRun4(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 4, locTypeDto, 0); |
| | | //// case 5: |
| | | //// return getLocNoRun5(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 0, locTypeDto, 0); |
| | | //// default: |
| | | //// log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | //// break; |
| | | // } |
| | | // switch (rowLastnoType.getType()) { |
| | | // case 1: |
| | | // return getLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 0, |
| | | // locTypeDto, 0); |
| | | //// case 2: |
| | | //// log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | //// break; |
| | | //// case 3: |
| | | //// log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | //// break; |
| | | //// case 4: |
| | | //// return getLocNoRun4(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, |
| | | // 4, locTypeDto, 0); |
| | | //// case 5: |
| | | //// return getLocNoRun5(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, |
| | | // 0, locTypeDto, 0); |
| | | //// default: |
| | | //// log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | //// break; |
| | | // } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | |
| | | * @return locNo 检索到的库位号 |
| | | */ |
| | | @Transactional |
| | | public StartupDto getLocNoRun(Integer whsType, Integer staDescId, Integer sourceStaNo, FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | public StartupDto getLocNoRun( Integer staDescId, Integer whsType, Integer sourceStaNo, |
| | | FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | staDescId = 1; |
| | | // 初始化参数 |
| | | int crnNo = 0; //堆垛机号 |
| | | int nearRow = 0; //最浅库位排 |
| | | LocMast locMast = null; // 目标库位 |
| | | int crnNo = 0; // 堆垛机号 |
| | | int nearRow = 0; // 最浅库位排 |
| | | LocMast locMast = null; // 目标库位 |
| | | |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | if (Cools.isEmpty(rowLastno)) { |
| | | throw new CoolException("数据异常,请联系管理员===>库位规则未知"); |
| | | } |
| | | |
| | | // 均衡分布堆垛机 |
| | | int minCount = Integer.MAX_VALUE; |
| | | for (int i = rowLastno.getsCrnNo(); i <= rowLastno.geteCrnNo(); i++) { |
| | | int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", i)); |
| | | if (count < minCount) { |
| | | minCount = count; |
| | | crnNo = i; |
| | | } |
| | | } |
| | | StartupDto startupDto = new StartupDto(); |
| | | //TODO 需要区分207,217, 239站点,滤芯和中件需要区分开 |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .ge("row1", rowLastno.getsRow()) |
| | | .le("row1", rowLastno.geteRow()) |
| | | .eq("crn_no", crnNo) |
| | | .eq("loc_sts", "O") |
| | | .orderAsc(Arrays.asList("row1", "bay1", "lev1"))); |
| | | // int crnCountO = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type", 100)); |
| | | .orderAsc(Arrays.asList("lev1", "row1", "bay1"))); |
| | | // int crnCountO = wrkMastService.selectCount(new |
| | | // EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type", 100)); |
| | | |
| | | // 生成工作号 |
| | | int workNo = getWorkNo(0); |
| | |
| | | return startupDto; |
| | | } |
| | | |
| | | public StartupDto getLocNoRun4(Integer whsType, Integer staDescId, Integer sourceStaNo, FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | public StartupDto getLocNoRun4(Integer whsType, Integer staDescId, Integer sourceStaNo, |
| | | FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | |
| | | // 初始化参数 |
| | | int crnNo = 0; //堆垛机号 |
| | | int nearRow = 0; //最浅库位排 |
| | | int curRow = 0; //最深库位排 |
| | | int rowCount = 0; //轮询轮次 |
| | | LocMast locMast = null; // 目标库位 |
| | | 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(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 * 2; i++) { |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber); |
| | | rowCount = locNecessaryParameters[0]; |
| | |
| | | throw new CoolException("无可用库位"); |
| | | } |
| | | |
| | | |
| | | // 相似工作档案 --- 同天同规格物料 |
| | | if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && (staDescId == 1 || staDescId == 11 || staDescId == 111)) { |
| | | //查询相似工作档案 |
| | | if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) |
| | | && (staDescId == 1 || staDescId == 11 || staDescId == 111)) { |
| | | // 查询相似工作档案 |
| | | List<WrkMast> wrkMasts = wrkMastService.selectWrkMastWrkDetl(staDescId, findLocNoAttributeVo, crnNo); |
| | | int nearbay = 0; //相似工作档案 目标库位列 |
| | | int nearlev = 0; //相似工作档案 目标库位层 |
| | | int nearbay = 0; // 相似工作档案 目标库位列 |
| | | int nearlev = 0; // 相似工作档案 目标库位层 |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | int curRowW = curRow; //相似工作档案 最深库位排 |
| | | int nearRowW = nearRow; //相似工作档案 最浅库位排 |
| | | int curRowW = curRow; // 相似工作档案 最深库位排 |
| | | int nearRowW = nearRow; // 相似工作档案 最浅库位排 |
| | | if (Cools.isEmpty(wrkMast.getLocNo())) { |
| | | continue; |
| | | } |
| | | //目标排为最外层排 |
| | | // 目标排为最外层排 |
| | | if (Utils.getRow(wrkMast.getLocNo()) == nearRow) { |
| | | continue; |
| | | } |
| | | //起始站不一致 |
| | | // 起始站不一致 |
| | | if (!wrkMast.getSourceStaNo().equals(sourceStaNo)) { |
| | | continue; |
| | | } |
| | | //相同列、层过滤 |
| | | // 相同列、层过滤 |
| | | if (Utils.getBay(wrkMast.getLocNo()) == nearbay && Utils.getLev(wrkMast.getLocNo()) == nearlev) { |
| | | continue; |
| | | } else { |
| | |
| | | nearlev = Utils.getLev(wrkMast.getLocNo()); |
| | | } |
| | | |
| | | //获取目标库位所在巷道并排序 |
| | | // List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow); |
| | | // 获取目标库位所在巷道并排序 |
| | | // List<String> groupOutsideLocCrn = |
| | | // Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow); |
| | | LocMast locMastGro = locMastService.selectById(wrkMast.getLocNo()); |
| | | |
| | | for (int i = 0; i < crnNumber * 2; i++) { |
| | | if (!(Utils.getRow(locMastGro.getLocNo()) > nearRowW && Utils.getRow(locMastGro.getLocNo()) <= curRowW) && !(Utils.getRow(locMastGro.getLocNo()) < nearRowW && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) { |
| | | if (!(Utils.getRow(locMastGro.getLocNo()) > nearRowW |
| | | && Utils.getRow(locMastGro.getLocNo()) <= curRowW) |
| | | && !(Utils.getRow(locMastGro.getLocNo()) < nearRowW |
| | | && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) { |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber); |
| | | curRowW = locNecessaryParameters[1]; |
| | | nearRowW = locNecessaryParameters[3]; |
| | |
| | | } |
| | | } |
| | | |
| | | //获取目标库位所在巷道最浅非空库位 |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW, nearRowW, locMastGro, rowLastnoType.getType().longValue()); |
| | | // 获取目标库位所在巷道最浅非空库位 |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW, nearRowW, locMastGro, |
| | | rowLastnoType.getType().longValue()); |
| | | |
| | | //目标库位所在巷道最浅非空库位存在&&非最外侧库位&&入库状态 |
| | | if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo()) != nearRowW && (locMast2.getLocSts().equals("S") || locMast2.getLocSts().equals("Q"))) { |
| | | //获取库存明细 |
| | | WrkDetl wrkDetl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo())); |
| | | //判断同规格物料 |
| | | // 目标库位所在巷道最浅非空库位存在&&非最外侧库位&&入库状态 |
| | | if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo()) != nearRowW |
| | | && (locMast2.getLocSts().equals("S") || locMast2.getLocSts().equals("Q"))) { |
| | | // 获取库存明细 |
| | | WrkDetl wrkDetl = wrkDetlService |
| | | .selectOne(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo())); |
| | | // 判断同规格物料 |
| | | if (!Cools.isEmpty(wrkDetl) && findLocNoAttributeVo.beSimilar(wrkDetl)) { |
| | | int row2 = 0; |
| | | if (Utils.getRow(locMast2.getLocNo()) > nearRowW) { |
| | |
| | | row2 = Utils.getRow(locMast2.getLocNo()) + 1; |
| | | } |
| | | String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2); |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", targetLocNo).eq("loc_sts", "O")); |
| | | locMast = locMastService |
| | | .selectOne(new EntityWrapper<LocMast>().eq("loc_no", targetLocNo).eq("loc_sts", "O")); |
| | | if (Cools.isEmpty(locMast)) { |
| | | continue; |
| | | } |
| | |
| | | |
| | | // 相似工作档 --- 空托 |
| | | if (Cools.isEmpty(locMast) && staDescId == 10) { |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("io_type", 10).eq("crn_no", crnNo).eq("whs_type", rowLastnoType.getType().longValue())); |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("io_type", 10) |
| | | .eq("crn_no", crnNo).eq("whs_type", rowLastnoType.getType().longValue())); |
| | | int nearbay = 0; |
| | | int nearlev = 0; |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | int curRowW = curRow; //相似工作档案 最深库位排 |
| | | int nearRowW = nearRow; //相似工作档案 最浅库位排 |
| | | int curRowW = curRow; // 相似工作档案 最深库位排 |
| | | int nearRowW = nearRow; // 相似工作档案 最浅库位排 |
| | | if (Cools.isEmpty(wrkMast.getLocNo())) { |
| | | continue; |
| | | } |
| | | if (Utils.getRow(wrkMast.getLocNo()) == nearRow) { |
| | | continue; |
| | | } |
| | | //起始站不一致 |
| | | // 起始站不一致 |
| | | if (!wrkMast.getSourceStaNo().equals(sourceStaNo)) { |
| | | continue; |
| | | } |
| | |
| | | nearbay = Utils.getBay(wrkMast.getLocNo()); |
| | | nearlev = Utils.getLev(wrkMast.getLocNo()); |
| | | } |
| | | // List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow); |
| | | // List<String> groupOutsideLocCrn = |
| | | // Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow); |
| | | LocMast locMastGro = locMastService.selectById(wrkMast.getLocNo()); |
| | | |
| | | for (int i = 0; i < crnNumber * 2; i++) { |
| | | if (!(Utils.getRow(locMastGro.getLocNo()) > nearRowW && Utils.getRow(locMastGro.getLocNo()) <= curRowW) && !(Utils.getRow(locMastGro.getLocNo()) < nearRowW && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) { |
| | | if (!(Utils.getRow(locMastGro.getLocNo()) > nearRowW |
| | | && Utils.getRow(locMastGro.getLocNo()) <= curRowW) |
| | | && !(Utils.getRow(locMastGro.getLocNo()) < nearRowW |
| | | && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) { |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber); |
| | | curRowW = locNecessaryParameters[1]; |
| | | nearRowW = locNecessaryParameters[3]; |
| | |
| | | } |
| | | } |
| | | |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW, nearRowW, locMastGro, rowLastnoType.getType().longValue()); |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW, nearRowW, locMastGro, |
| | | rowLastnoType.getType().longValue()); |
| | | |
| | | if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo()) != nearRowW && locMast2.getLocSts().equals("S")) { |
| | | if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo()) != nearRowW |
| | | && locMast2.getLocSts().equals("S")) { |
| | | int row2 = 0; |
| | | if (Utils.getRow(locMast2.getLocNo()) > nearRowW) { |
| | | row2 = Utils.getRow(locMast2.getLocNo()) - 1; |
| | |
| | | row2 = Utils.getRow(locMast2.getLocNo()) + 1; |
| | | } |
| | | String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2); |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", targetLocNo).eq("loc_sts", "O")); |
| | | locMast = locMastService |
| | | .selectOne(new EntityWrapper<LocMast>().eq("loc_no", targetLocNo).eq("loc_sts", "O")); |
| | | if (Cools.isEmpty(locMast)) { |
| | | continue; |
| | | } |
| | |
| | | boolean signRule1 = false; |
| | | boolean signRule2 = false; |
| | | |
| | | |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | // 靠近摆放规则 --- 同天同规格物料 //分离版 |
| | | if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && staDescId == 1) { |
| | | // signRule1 = true; |
| | | // signRule1 = true; |
| | | } |
| | | // 靠近摆放规则 --- 同天同规格物料 //互通版 |
| | | if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && staDescId == 1) { |
| | |
| | | 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 locMastF = locMastService.selectLocByLocStsPakInF(curRow, nearRow, locMast1, rowLastnoType.getType().longValue()); |
| | | // 获取巷道 |
| | | // List<String> groupOutsideLocCrn = |
| | | // Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow); |
| | | // 获取目标库位所在巷道最浅非空库位 |
| | | 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())); |
| | | LocDetl locDetl = locDetlService |
| | | .selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMastF.getLocNo())); |
| | | if (!Cools.isEmpty(locDetl) && findLocNoAttributeVo.beSimilar(locDetl)) { |
| | | //获取目标库位所在巷道最深空库位 |
| | | locMast = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, rowLastnoType.getType().longValue()); |
| | | // 获取目标库位所在巷道最深空库位 |
| | | locMast = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, |
| | | rowLastnoType.getType().longValue()); |
| | | break; |
| | | } |
| | | } |
| | |
| | | int nearbay = 0; |
| | | int nearlev = 0; |
| | | for (String locNo : locNos) { |
| | | int curRowW = curRow; //相似工作档案 最深库位排 |
| | | int nearRowW = nearRow; //相似工作档案 最浅库位排 |
| | | int curRowW = curRow; // 相似工作档案 最深库位排 |
| | | int nearRowW = nearRow; // 相似工作档案 最浅库位排 |
| | | if (Cools.isEmpty(locNo)) { |
| | | continue; |
| | | } |
| | |
| | | nearbay = Utils.getBay(locNo); |
| | | nearlev = Utils.getLev(locNo); |
| | | } |
| | | // List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow); |
| | | // List<String> groupOutsideLocCrn = |
| | | // Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow); |
| | | LocMast locMastGro = locMastService.selectById(locNo); |
| | | |
| | | for (int i = 0; i < crnNumber * 2; i++) { |
| | | if (!(Utils.getRow(locMastGro.getLocNo()) > nearRowW && Utils.getRow(locMastGro.getLocNo()) <= curRowW) && !(Utils.getRow(locMastGro.getLocNo()) < nearRowW && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) { |
| | | if (!(Utils.getRow(locMastGro.getLocNo()) > nearRowW |
| | | && Utils.getRow(locMastGro.getLocNo()) <= curRowW) |
| | | && !(Utils.getRow(locMastGro.getLocNo()) < nearRowW |
| | | && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) { |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber); |
| | | curRowW = locNecessaryParameters[1]; |
| | | nearRowW = locNecessaryParameters[3]; |
| | |
| | | } |
| | | } |
| | | |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW, nearRowW, locMastGro, rowLastnoType.getType().longValue()); |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW, nearRowW, locMastGro, |
| | | rowLastnoType.getType().longValue()); |
| | | |
| | | if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo()) != nearRowW && locMast2.getLocSts().equals("S")) { |
| | | if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo()) != nearRowW |
| | | && locMast2.getLocSts().equals("S")) { |
| | | int row2 = 0; |
| | | if (Utils.getRow(locMast2.getLocNo()) > nearRowW) { |
| | | row2 = Utils.getRow(locMast2.getLocNo()) - 1; |
| | |
| | | row2 = Utils.getRow(locMast2.getLocNo()) + 1; |
| | | } |
| | | String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2); |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", targetLocNo).eq("loc_sts", "O")); |
| | | locMast = locMastService |
| | | .selectOne(new EntityWrapper<LocMast>().eq("loc_no", targetLocNo).eq("loc_sts", "O")); |
| | | if (Cools.isEmpty(locMast)) { |
| | | continue; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // // 靠近摆放规则 --- 空托 //分离版 |
| | | // if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | // for (LocMast locMast1:locMasts){ |
| | | // //获取巷道 |
| | | //// List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow); |
| | | // //获取目标库位所在巷道最浅非空库位 |
| | | // LocMast locMastF = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMast1,rowLastnoType.getType().longValue()); |
| | | // if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("D")){ |
| | | // //获取目标库位所在巷道最浅非空库位 |
| | | // locMast = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue()); |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // // 靠近摆放规则 --- 空托 //分离版 |
| | | // if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | // List<LocMast> locMasts = locMastService.selectList(new |
| | | // EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | // for (LocMast locMast1:locMasts){ |
| | | // //获取巷道 |
| | | //// List<String> groupOutsideLocCrn = |
| | | // Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow); |
| | | // //获取目标库位所在巷道最浅非空库位 |
| | | // LocMast locMastF = |
| | | // locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMast1,rowLastnoType.getType().longValue()); |
| | | // if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("D")){ |
| | | // //获取目标库位所在巷道最浅非空库位 |
| | | // locMast = |
| | | // locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue()); |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // 靠近摆放规则 --- 空托 //互通版 |
| | | if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow)); |
| | | List<LocMast> locMasts = locMastService |
| | | .selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow)); |
| | | int nearbay = 0; |
| | | int nearlev = 0; |
| | | for (LocMast locMastSign : locMasts) { |
| | | int curRowW = curRow; //相似工作档案 最深库位排 |
| | | int nearRowW = nearRow; //相似工作档案 最浅库位排 |
| | | int curRowW = curRow; // 相似工作档案 最深库位排 |
| | | int nearRowW = nearRow; // 相似工作档案 最浅库位排 |
| | | if (Cools.isEmpty(locMastSign.getLocNo())) { |
| | | continue; |
| | | } |
| | | if (Utils.getRow(locMastSign.getLocNo()) == nearRow) { |
| | | continue; |
| | | } |
| | | if (Utils.getBay(locMastSign.getLocNo()) == nearbay && Utils.getLev(locMastSign.getLocNo()) == nearlev) { |
| | | if (Utils.getBay(locMastSign.getLocNo()) == nearbay |
| | | && Utils.getLev(locMastSign.getLocNo()) == nearlev) { |
| | | continue; |
| | | } else { |
| | | nearbay = Utils.getBay(locMastSign.getLocNo()); |
| | | nearlev = Utils.getLev(locMastSign.getLocNo()); |
| | | } |
| | | // List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow); |
| | | // List<String> groupOutsideLocCrn = |
| | | // Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow); |
| | | LocMast locMastGro = locMastService.selectById(locMastSign.getLocNo()); |
| | | |
| | | for (int i = 0; i < crnNumber * 2; i++) { |
| | | if (!(Utils.getRow(locMastGro.getLocNo()) > nearRowW && Utils.getRow(locMastGro.getLocNo()) <= curRowW) && !(Utils.getRow(locMastGro.getLocNo()) < nearRowW && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) { |
| | | if (!(Utils.getRow(locMastGro.getLocNo()) > nearRowW |
| | | && Utils.getRow(locMastGro.getLocNo()) <= curRowW) |
| | | && !(Utils.getRow(locMastGro.getLocNo()) < nearRowW |
| | | && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) { |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber); |
| | | curRowW = locNecessaryParameters[1]; |
| | | nearRowW = locNecessaryParameters[3]; |
| | |
| | | } |
| | | } |
| | | |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW, nearRowW, locMastGro, rowLastnoType.getType().longValue()); |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW, nearRowW, locMastGro, |
| | | rowLastnoType.getType().longValue()); |
| | | |
| | | if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo()) != nearRowW && locMast2.getLocSts().equals("S")) { |
| | | if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo()) != nearRowW |
| | | && locMast2.getLocSts().equals("S")) { |
| | | int row2 = 0; |
| | | if (Utils.getRow(locMast2.getLocNo()) > nearRowW) { |
| | | row2 = Utils.getRow(locMast2.getLocNo()) - 1; |
| | |
| | | row2 = Utils.getRow(locMast2.getLocNo()) + 1; |
| | | } |
| | | String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2); |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", targetLocNo).eq("loc_sts", "O")); |
| | | locMast = locMastService |
| | | .selectOne(new EntityWrapper<LocMast>().eq("loc_no", targetLocNo).eq("loc_sts", "O")); |
| | | if (Cools.isEmpty(locMast)) { |
| | | continue; |
| | | } |
| | |
| | | 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));//最浅库位 |
| | | .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()); |
| | | // 获取目标库位所在巷道最深空库位 |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, |
| | | rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMast2) && locMast2.getBay1() == curRow) { |
| | | locMast = locMast2; |
| | | break; |
| | |
| | | } |
| | | } |
| | | |
| | | //未找到 允许混料 |
| | | // 未找到 允许混料 |
| | | if (Cools.isEmpty(locMast) && Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | //获取目标库位所在巷道并排序 |
| | | // List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow); |
| | | // 获取目标库位所在巷道并排序 |
| | | // List<String> groupOutsideLocCrn = |
| | | // Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow); |
| | | |
| | | //获取目标库位所在巷道最浅非空库位 |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRow, nearRow, locMast1, rowLastnoType.getType().longValue()); |
| | | // 获取目标库位所在巷道最浅非空库位 |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRow, nearRow, locMast1, |
| | | rowLastnoType.getType().longValue()); |
| | | if (Cools.isEmpty(locMast2)) { |
| | | LocMast locMast3 = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, rowLastnoType.getType().longValue()); |
| | | LocMast locMast3 = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, |
| | | rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMast3)) { |
| | | locMast = locMast3; |
| | | break; |
| | | } |
| | | } else { |
| | | if ((locMast2.getLocSts().equals("F") && staDescId == 1) || (locMast2.getLocSts().equals("D") && staDescId == 10)) { |
| | | LocMast locMast3 = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, rowLastnoType.getType().longValue()); |
| | | if ((locMast2.getLocSts().equals("F") && staDescId == 1) |
| | | || (locMast2.getLocSts().equals("D") && staDescId == 10)) { |
| | | LocMast locMast3 = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, |
| | | rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMast3)) { |
| | | locMast = locMast3; |
| | | break; |
| | |
| | | // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 |
| | | if (times < rowCount * 2) { |
| | | times = times + 1; |
| | | return getLocNoRun4(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, moveCrnNo, locTypeDto, times); |
| | | return getLocNoRun4(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, moveCrnNo, locTypeDto, |
| | | times); |
| | | } |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | throw new CoolException("没有空库位"); |
| | |
| | | return startupDto; |
| | | } |
| | | |
| | | public StartupDto getLocNoRun5(Integer whsType, Integer staDescId, Integer sourceStaNo, FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | public StartupDto getLocNoRun5(Integer whsType, Integer staDescId, Integer sourceStaNo, |
| | | FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | |
| | | // 初始化参数 |
| | | int crnNo = 0; //堆垛机号 |
| | | int nearRow = 0; //最浅库位排 |
| | | int curRow = 0; //最深库位排 |
| | | int rowCount = 0; //轮询轮次 |
| | | LocMast locMast = null; // 目标库位 |
| | | int crnNo = 0; // 堆垛机号 |
| | | int nearRow = 0; // 最浅库位排 |
| | | int curRow = 0; // 最深库位排 |
| | | int rowCount = 0; // 轮询轮次 |
| | | LocMast locMast = null; // 目标库位 |
| | | |
| | | StartupDto startupDto = new StartupDto(); |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | |
| | | crnNumber = moveCrnNo; |
| | | } |
| | | |
| | | //此程序用于优化堆垛机异常时的运行时间 |
| | | // 此程序用于优化堆垛机异常时的运行时间 |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber); |
| | | curRow = locNecessaryParameters[1]; |
| | | crnNo = locNecessaryParameters[2]; |
| | |
| | | staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo); |
| | | // throw new CoolException("入库路径不存在"); |
| | | // 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()+"不可用"); |
| | | // throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | crnNo = 0; |
| | | } |
| | | startupDto.setStaNo(staNo.getDevNo()); |
| | |
| | | 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));//最浅库位 |
| | | .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()); |
| | | // 获取目标库位所在巷道最深空库位 |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, |
| | | rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMast2) && locMast2.getBay1() == curRow) { |
| | | locMast = locMast2; |
| | | break; |
| | |
| | | // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 |
| | | if (times < rowCount * 2) { |
| | | times = times + 1; |
| | | return getLocNoRun5(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, moveCrnNo, locTypeDto, times); |
| | | return getLocNoRun5(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, moveCrnNo, locTypeDto, |
| | | times); |
| | | } |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | throw new CoolException("没有空库位"); |