Merge remote-tracking branch 'origin/bfasrs' into bfasrs
| | |
| | | public R query(String condition) { |
| | | EntityWrapper<DocType> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("doc_name", condition); |
| | | Page<DocType> page = docTypeService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<DocType> page = docTypeService.selectPage(new Page<>(0, 100), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (DocType docType : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | , @Param("rowsLen") Integer rowsLen, @Param("locType1") Short locType1, @Param("inoutEveryday") Boolean inoutEveryday |
| | | , @Param("rowBeg") Integer rowBeg, @Param("rowEnd") Integer rowEnd, @Param("bayBeg") Integer bayBeg |
| | | , @Param("bayEnd") Integer bayEnd, @Param("levBeg") Integer levBeg, @Param("levEnd") Integer levEnd); |
| | | List<LocMast> queryFreeLocMast2(@Param("locType1") Short locType1 |
| | | , @Param("rowBeg") Integer rowBeg, @Param("rowEnd") Integer rowEnd, @Param("bayBeg") Integer bayBeg |
| | | , @Param("bayEnd") Integer bayEnd, @Param("levBeg") Integer levBeg, @Param("levEnd") Integer levEnd); |
| | | |
| | | List<LocMast> queryFreeLocMastEnd(@Param("row") Integer row, @Param("locType1") Short locType1); |
| | | List<LocMast> queryFreeLocMastEnd0(@Param("bay") Integer bay,@Param("lev") Integer lev,@Param("row1") Integer row, @Param("locType1") Short locType1); |
| | | |
| | | List<LocMast> queryFreeLocMastEnd1(@Param("row") Integer row, @Param("locType1") Short locType1, @Param("inoutEveryday") Boolean inoutEveryday); |
| | | |
| | | @Select("select loc_no from asr_loc_mast where 1=1 and loc_sts = 'O' and crn_no = #{crnNo}") |
| | | List<String> queryGroupEmptyStock(Integer crnNo); |
| | | |
| | |
| | | , Integer rowBeg, Integer rowEnd, Integer bayBeg, Integer bayEnd, Integer levBeg, Integer levEnd); |
| | | List<LocMast> queryFreeLocMastEnd(Integer row, Short locType1); |
| | | List<LocMast> queryFreeLocMastEnd0(Integer bay,Integer lev,Integer row, Short locType1); |
| | | List<LocMast> queryFreeLocMastEnd1(Integer row, Short locType1,Boolean inoutEveryday); |
| | | |
| | | List<LocMast> queryFreeLocMast2(Short locType1, Integer rowBeg, Integer rowEnd, Integer bayBeg, Integer bayEnd, Integer levBeg, Integer levEnd); |
| | | |
| | | /** |
| | | * 获取同组货架的空库位 |
| | |
| | | * @param locMast |
| | | * @return |
| | | */ |
| | | Boolean checkEmptyCount(LocMast locMast); |
| | | Boolean checkEmptyCount(LocMast locMast, int quaOfBlank); |
| | | |
| | | /** |
| | | * 当前库存明细是否为整托 |
| | |
| | | import com.zy.asrs.service.RowLastnoService; |
| | | import com.zy.asrs.service.WorkService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service("locMastService") |
| | | public class LocMastServiceImpl extends ServiceImpl<LocMastMapper, LocMast> implements LocMastService { |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> queryFreeLocMastEnd1(Integer row, Short locType1,Boolean inoutEveryday){ |
| | | return this.baseMapper.queryFreeLocMastEnd1(row, locType1,inoutEveryday); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> queryFreeLocMast2(Short locType1, Integer rowBeg, Integer rowEnd, Integer bayBeg, Integer bayEnd, Integer levBeg, Integer levEnd) { |
| | | return this.baseMapper.queryFreeLocMast2(locType1, rowBeg, rowEnd, bayBeg, bayEnd, levBeg, levEnd); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<String> queryGroupEmptyStock(String sourceLocNo) { |
| | | if (Cools.isEmpty(sourceLocNo)) { |
| | | return null; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkEmptyCount(LocMast locMast) { |
| | | public Boolean checkEmptyCount(LocMast locMast, int quaOfBlank) { |
| | | if (locMast == null) { |
| | | return false; |
| | | } |
| | | return this.baseMapper.selectEmptyLocCount(locMast.getLocType1(), locMast.getCrnNo()) > 1; |
| | | boolean res = this.baseMapper.selectEmptyLocCount(locMast.getLocType1(), locMast.getCrnNo()) > quaOfBlank; |
| | | if (!res) { |
| | | log.warn("{}号堆垛机库位不足,因滞留空库位{}个", locMast.getCrnNo(), quaOfBlank); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | @Override |
| | |
| | | rows = locNos.stream().map(item -> Integer.parseInt(item.substring(0, 2))).distinct().collect(Collectors.toList()); |
| | | } |
| | | |
| | | // if (!rows.retainAll(new ArrayList<Integer>() {{ add(1);add(2);add(3);}}) |
| | | // || !rows.retainAll(new ArrayList<Integer>() {{ add(8);add(9);add(10);add(11);}}) |
| | | // || !rows.retainAll(new ArrayList<Integer>() {{ add(15);add(16);add(17);add(18);}}) |
| | | // ) { |
| | | // locNos.sort(Comparator.comparingInt(o -> Integer.parseInt(o.substring(0, 2)))); |
| | | // } else if (!rows.retainAll(new ArrayList<Integer>() {{ add(4);add(5);add(6);add(7);}}) |
| | | // || !rows.retainAll(new ArrayList<Integer>() {{ add(12);add(13);add(14);}}) |
| | | // || !rows.retainAll(new ArrayList<Integer>() {{ add(19);add(20);add(21);}}) |
| | | // ) { |
| | | // locNos.sort((o1, o2) -> Integer.parseInt(o2.substring(0, 2)) - Integer.parseInt(o1.substring(0, 2))); |
| | | // plan first |
| | | // for (int i = 0; i<locNos.size(); i++) { |
| | | // LocMast locMast = this.selectById(locNos.get(i)); |
| | | // if (locMast.getLocSts().equals("O")) { |
| | | // if (i == 0) { |
| | | // return locMast; |
| | | // } else { |
| | | // LocMast lastLoc = this.selectById(locNos.get(i - 1)); |
| | | // if (lastLoc.getLocSts().equals("F") || lastLoc.getLocSts().equals("D") || lastLoc.getLocSts().equals("X")) { |
| | | // return locMast; |
| | | // } else { |
| | | // break; |
| | | // } |
| | | for (int i = 0; i<locNos.size(); i++) { |
| | | LocMast locMast = this.selectById(locNos.get(i)); |
| | | // } |
| | | // } |
| | | // } |
| | | // return null; |
| | | |
| | | // plan second |
| | | LocMast finalRes = null; |
| | | for (String locNo : locNos) { |
| | | LocMast locMast = this.selectById(locNo); |
| | | if (locMast.getLocSts().equals("O")) { |
| | | if (i == 0) { |
| | | return locMast; |
| | | if (finalRes == null) { |
| | | finalRes = locMast; |
| | | } |
| | | } else { |
| | | LocMast lastLoc = this.selectById(locNos.get(i - 1)); |
| | | if (lastLoc.getLocSts().equals("F") || lastLoc.getLocSts().equals("D") || lastLoc.getLocSts().equals("X")) { |
| | | return locMast; |
| | | } else { |
| | | if (finalRes != null) { |
| | | log.error("{}库位异常:{}库位状态为O.空库位,但{}库位状态为{}", finalRes.getLocNo(), finalRes.getLocNo(), locMast.getLocNo(), locMast.getLocSts()); |
| | | finalRes = null; |
| | | break; |
| | | } |
| | | if (locMast.getLocSts().equals("R") || locMast.getLocSts().equals("P")) { |
| | | finalRes = null; |
| | | break; |
| | | } |
| | | finalRes = null; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | return finalRes; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/8/27 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public Map<Integer, List<Integer>> getRowSeqHasSortOfPakin(int start, int end) { |
| | | Map<Integer, List<Integer>> result = new HashMap<>(); |
| | | for (int i = start ; i <= end; i++) { |
| | | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |
| | |
| | | if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) { |
| | | // 浅库位对应堆垛机必须可用且无异常 |
| | | if (basCrnpService.checkSiteError(locMast0.getCrnNo(), true)) { |
| | | // 因库位移转、需预留空库位 |
| | | if (locMastService.checkEmptyCount(locMast0, 10)) { |
| | | crnNo = locMast0.getCrnNo(); |
| | | locMast = locMast0; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) { |
| | | // 浅库位对应堆垛机必须可用且无异常 |
| | | if (basCrnpService.checkSiteError(locMast0.getCrnNo(), true)) { |
| | | // 因库位移转、需预留空库位 |
| | | if (locMastService.checkEmptyCount(locMast0, 10)) { |
| | | crnNo = locMast0.getCrnNo(); |
| | | locMast = locMast0; |
| | | break; |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 库区锁定 |
| | | if (Cools.isEmpty(locMast)) { |
| | | LocRule locRule = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0), null, start, end); |
| | | if (!Cools.isEmpty(locRule)) { |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1() |
| | | , locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd()); |
| | | for (LocMast one : locMasts) { |
| | | List<String> groupLoc = Utils.getGroupLoc(one.getLocNo()); |
| | | LocMast locMast0 = locMastService.findOutMost(groupLoc); |
| | | if (null != locMast0) { |
| | | // 浅库位符合尺寸检测 |
| | | if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) { |
| | | // 浅库位对应堆垛机必须可用且无异常 |
| | | if (basCrnpService.checkSiteError(locMast0.getCrnNo(), true)) { |
| | | // 因库位移转、需预留空库位 |
| | | if (locMastService.checkEmptyCount(locMast0, 10)) { |
| | | crnNo = locMast0.getCrnNo(); |
| | | locMast = locMast0; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | |
| | | int currentRow = 1; |
| | | if (null == locMast) { |
| | | Shelves shelves = new Shelves(rowCount, crn_qty); |
| | |
| | | // 开始查找库位 ==============================>> |
| | | |
| | | // 1.当检索库排为浅库位排时,优先寻找当前库排的深库位排 |
| | | if (locMast == 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 |
| | | , locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd()); |
| | | if (!Cools.isEmpty(locMasts)) { |
| | | Integer innermostRow = Utils.getInnermostRow(locMasts.get(0).getLocNo()); |
| | | for (LocMast one : locMasts) { |
| | | if (one.getRow1().equals(innermostRow)) { |
| | | locMast = one; |
| | | crnNo = locMast.getCrnNo(); |
| | | 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("入库路径不存在, staDescId={}, sourceStaNo={}, crnNo={}", staDescId, sourceStaNo, crnNo); |
| | | throw new CoolException("入库路径不存在"); |
| | | } |
| | | // 检测目标站 |
| | | staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 高低频管控、库位组全部为O |
| | | if (locMast == null) { |
| | | List<Integer> rows = Utils.getGroupLoc(curRow); |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast0(rows, rows.size(), locTypeDto.getLocType1(), inoutEveryday); |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // LocMast locMast0 = locMastService.findOutMost(locMasts.stream().map(LocMast::getLocNo).distinct().collect(Collectors.toList())); |
| | | // if (!Cools.isEmpty(locMast0)) { |
| | | // locMast = locMast0; |
| | | // } |
| | | // 因库位移转、需预留空库位 todo:luxiaotao |
| | | // if (!locMastService.checkEmptyCount(locMast)) { |
| | | // locMast = null; |
| | | // } |
| | | |
| | | // 因库位移转、需预留空库位 |
| | | if (!locMastService.checkEmptyCount(locMast, 10)) { locMast = null; } |
| | | } |
| | | |
| | | // 2.无库位时,无视区域锁定,重新查找库位 |
| | | |
| | | |
| | | // 2.1 高低频管控、库位组无需全部为O,找到库位对应深库位不能为P R |
| | | if (Cools.isEmpty(locMast)) { |
| | | int sign = curRow; |
| | | while (sign != 0 && Cools.isEmpty(locMast)) { |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMastEnd(sign, locTypeDto.getLocType1()); |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMastEnd1(sign, locTypeDto.getLocType1(), inoutEveryday); |
| | | for (LocMast loc : locMasts) { |
| | | // 同库位组对应其钱库位是否为 O.空库位 |
| | | boolean success = true; |
| | | List<String> outerLoc = Utils.getGroupOuterLoc(loc.getLocNo()); |
| | | for (String outerLocNo : outerLoc) { |
| | | if (!locMastService.selectById(outerLocNo).getLocSts().equals("O")) { |
| | | // 浅库位 |
| | | List<String> outerLocList = Utils.getGroupOuterLoc(loc.getLocNo()); |
| | | for (String outerLocNo : outerLocList) { |
| | | LocMast outerLoc = locMastService.selectById(outerLocNo); |
| | | if (Cools.isEmpty(outerLoc)) { |
| | | continue; |
| | | } |
| | | if (!outerLoc.getLocSts().equals("O")) { |
| | | success = false; break; |
| | | } |
| | | } |
| | | // 深库位 |
| | | List<String> insideLocList = Utils.getGroupInsideLoc(loc.getLocNo()); |
| | | for (String insideLocNo : insideLocList) { |
| | | LocMast insideLoc = locMastService.selectById(insideLocNo); |
| | | if (Cools.isEmpty(insideLoc)) { |
| | | continue; |
| | | } |
| | | if (insideLoc.getLocSts().equals("R") || insideLoc.getLocSts().equals("P")) { |
| | | success = false; break; |
| | | } |
| | | } |
| | | // 因库位移转、需预留空库位 |
| | | if (!locMastService.checkEmptyCount(loc, 10)) { |
| | | success = false; |
| | | } |
| | | if (success) { |
| | | locMast = loc; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // if (Cools.isEmpty(locMast)){ |
| | | // List<LocMast> locMasts = locMastService.queryFreeLocMastEnd(curRow, locTypeDto.getLocType1()); |
| | | // int sign=curRow; |
| | | // while (true){ |
| | | // if (locMasts.size()==0){ |
| | | // sign = getCurRow(sign); |
| | | // if (sign != 0){ |
| | | // locMasts = locMastService.queryFreeLocMastEnd(sign, locTypeDto.getLocType1()); |
| | | // }else { |
| | | // break; |
| | | // } |
| | | // }else { |
| | | // break; |
| | | // } |
| | | // } |
| | | // for (LocMast locMast1 : locMasts){ |
| | | // List<LocMast> locMasts1 = locMastService.queryFreeLocMastEnd0(locMast1.getBay1(), locMast1.getLev1(),locMast1.getRow1(), locTypeDto.getLocType1()); |
| | | // Integer innermostRow = Utils.getInnermostRow(locMasts1.get(0).getLocNo()); |
| | | // for (LocMast locMast2:locMasts1){ |
| | | // if (locMast2.getLocSts().equals("O")){ |
| | | // locMast = locMast2; |
| | | // break; |
| | | // }else if (!locMast2.getLocSts().equals("F")){ |
| | | // break; |
| | | // } |
| | | // } |
| | | // if (!Cools.isEmpty(locMast)){ |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // 2.无库位时,无视区域锁定,重新查找库位 |
| | | if (Cools.isEmpty(locMast)) { |
| | | int sign = curRow; |
| | | while (sign != 0 && Cools.isEmpty(locMast)) { |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMastEnd(sign, locTypeDto.getLocType1()); |
| | | for (LocMast loc : locMasts) { |
| | | // 同库位组对应其钱库位是否为 O.空库位 |
| | | boolean success = true; |
| | | // 浅库位 |
| | | List<String> outerLocList = Utils.getGroupOuterLoc(loc.getLocNo()); |
| | | for (String outerLocNo : outerLocList) { |
| | | LocMast outerLoc = locMastService.selectById(outerLocNo); |
| | | if (Cools.isEmpty(outerLoc)) { |
| | | continue; |
| | | } |
| | | if (!outerLoc.getLocSts().equals("O")) { |
| | | success = false; break; |
| | | } |
| | | } |
| | | // 深库位 |
| | | List<String> insideLocList = Utils.getGroupInsideLoc(loc.getLocNo()); |
| | | for (String insideLocNo : insideLocList) { |
| | | LocMast insideLoc = locMastService.selectById(insideLocNo); |
| | | if (Cools.isEmpty(insideLoc)) { |
| | | continue; |
| | | } |
| | | if (insideLoc.getLocSts().equals("R") || insideLoc.getLocSts().equals("P")) { |
| | | success = false; break; |
| | | } |
| | | } |
| | | // 因库位移转、需预留空库位 |
| | | if (!locMastService.checkEmptyCount(loc, 10)) { |
| | | success = false; |
| | | } |
| | | if (success) { |
| | | locMast = loc; |
| | | break; |
| | | } |
| | | } |
| | | sign = getCurRow(sign); |
| | | } |
| | | } |
| | | |
| | | // 3.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 |
| | | if (Cools.isEmpty(locMast)) { |
| | |
| | | server: |
| | | port: 8081 |
| | | port: 8080 |
| | | servlet: |
| | | context-path: /@pom.build.finalName@ |
| | | |
| | |
| | | enabled: false |
| | | datasource: |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | url: jdbc:sqlserver://10.10.10.100:1433;databasename=bfasrs |
| | | # url: jdbc:sqlserver://localhost:1433;databasename=bfasrs |
| | | # url: jdbc:sqlserver://10.10.10.100:1433;databasename=bfasrs |
| | | url: jdbc:sqlserver://192.168.4.15:1433;databasename=bfasrs |
| | | username: sa |
| | | # password: Zoneyung@zy56$ |
| | | password: sa@123 |
| | |
| | | order by loc_sts desc ,lev1 asc,bay1 asc |
| | | </select> |
| | | |
| | | <select id="queryFreeLocMastEnd1" resultMap="BaseResultMap"> |
| | | select * |
| | | from asr_loc_mast |
| | | where row1=#{row} |
| | | and loc_sts='O' |
| | | <if test="locType1 != null"> |
| | | and loc_type1 = #{locType1} |
| | | </if> |
| | | <choose> |
| | | <when test="inoutEveryday != null and inoutEveryday"> |
| | | AND bay1 < 11 </when> |
| | | <otherwise> |
| | | AND bay1 >= 11 |
| | | </otherwise> |
| | | </choose> |
| | | and loc_no not in ('0100101', '0200101', '0300101', '1200701', '1300701', '1400701', '1900401', '2000401', '2100401') |
| | | order by loc_sts desc ,lev1 asc,bay1 asc |
| | | </select> |
| | | |
| | | <select id="queryFreeLocMastEnd0" resultMap="BaseResultMap"> |
| | | select * |
| | | from asr_loc_mast |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="queryFreeLocMast2" resultMap="BaseResultMap"> |
| | | select * |
| | | from asr_loc_mast |
| | | where 1=1 |
| | | and loc_sts='O' |
| | | <if test="locType1 != null"> |
| | | and loc_type1 = #{locType1} |
| | | </if> |
| | | |
| | | <if test="rowBeg != null"> |
| | | and row1 >= #{rowBeg} |
| | | </if> |
| | | <if test="rowEnd != null"> |
| | | and row1 <= #{rowEnd} |
| | | </if> |
| | | <if test="bayBeg != null"> |
| | | and bay1 >= #{bayBeg} |
| | | </if> |
| | | <if test="bayEnd != null"> |
| | | and bay1 <= #{bayEnd} |
| | | </if> |
| | | <if test="levBeg != null"> |
| | | and lev1 >= #{levBeg} |
| | | </if> |
| | | <if test="levEnd != null"> |
| | | and lev1 <= #{levEnd} |
| | | </if> |
| | | and loc_no not in ('0100101', '0200101', '0300101', '1200701', '1300701', '1400701', '1900401', '2000401', '2100401') |
| | | order by loc_sts desc ,lev1 asc,bay1 asc |
| | | </select> |
| | | |
| | | </mapper> |