| | |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.properties.SlaveProperties; |
| | | import com.zy.common.web.param.SearchLocParam; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Resource |
| | | private LocMastMapper locMastMapper; |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | /** |
| | | * 生成工作号 |
| | |
| | | |
| | | // 入空桶库 |
| | | if (staDescId == 1 && locArea == 2) { |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "emptyBucketInCacheCount").eq("status", 1)); |
| | | if (config != null && !Cools.isEmpty(config.getValue())) { // 限制入空桶库输送线缓存任务数,避免堵塞 |
| | | int value = Integer.parseInt(config.getValue()); |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<BasDevp>().in("dev_no", 1044, 1045, 1046, 1047, 1048, 1049, 1050).ne("wrk_no", 0)); |
| | | long count = basDevps.stream().map(BasDevp::getWrkNo).distinct().count(); |
| | | log.info("入空桶库输送线缓存任务数:{}",count); |
| | | if(count >= value) { |
| | | log.error("-----入空桶库输送线缓存任务数:{},超配置缓存数:{}----",count,value); |
| | | throw new CoolException("入空桶库输送线缓存任务数:"+count+",超配置缓存数:" + value); |
| | | } |
| | | } |
| | | locMast = new LocMast(); |
| | | locMast.setCrnNo(4); |
| | | locMast.setLocNo(""); |
| | | List<WrkMast> wrkMastList = wrkMastMapper.selectLastInEmptyLoc(); // 前面入空桶库的任务(未执行堆垛机入库) |
| | | |
| | | if (wrkMastList.size() == 0) { |
| | | // if (wrkMastList.size() == 0) { |
| | | // 取新库位组的第一个库位 |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O")); |
| | | List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList()); |
| | | List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 第一个先放这两排 |
| | | if (collect.size() == 0 || collect1.size() == 0) { |
| | | if (collect.size() - wrkMastList.size() <= 0 && collect1.size() - wrkMastList.size() <= 0) { |
| | | log.error("-----空桶库无空库位----"); |
| | | throw new CoolException("空桶库无空库位"); |
| | | } |
| | | // 可用库位组 |
| | | List<LocMast> locMastList = new ArrayList<>(); |
| | | for(LocMast locMast1:collect) { |
| | | Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1()) |
| | | && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst(); |
| | | first.ifPresent(locMastList::add); |
| | | } |
| | | |
| | | if (locMastList.size() == 0) { |
| | | log.error("-----空桶库无对应空空桶组----"); |
| | | throw new CoolException("空桶库无对应空空桶组"); |
| | | } |
| | | String model = findLocNoAttributeVo.getModel(); // 当前桶类型 |
| | | if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 最上面一层只能放208L,库位剩余量不多时,如果是208L桶入库,则先从最顶层放 |
| | | locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | } else { |
| | | locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | } |
| | | locMast = locMastList.get(0); |
| | | |
| | | } else { |
| | | WrkMast wrkMast = wrkMastList.get(0); // 最后一个入空桶库任务 |
| | | // 前一个任务桶类型 |
| | | String oldModel = wrkMast.getPdcType(); |
| | | // 前一个任务尾托标识 |
| | | Integer oldCtnType = wrkMast.getCtnType(); |
| | | // 当前桶类型 |
| | | String matnr = findLocNoAttributeVo.getMatnr(); |
| | | if(findLocNoAttributeVo.getMatnr().equals(wrkMast.getPdcType())) { // 当前桶与前桶是一种类型 |
| | | // 当前桶类型的任务有几个 |
| | | long count = wrkMastList.stream().filter(wrkMast1 -> wrkMast1.getPdcType().equals(matnr)).count(); |
| | | if (count % 2 == 0) { // 偶数,取一组新库位 |
| | | // 取新库位组的第一个库位 |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O")); |
| | | List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList()); |
| | | List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 第一个先放这两排 |
| | | if (collect.size() == 0 || collect1.size() == 0) { |
| | | log.error("-----空桶库无空库位----"); |
| | | throw new CoolException("空桶库无空库位"); |
| | | } |
| | | // 可用库位组 |
| | | List<LocMast> locMastList = new ArrayList<>(); |
| | | for(LocMast locMast1:collect) { |
| | | Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1()) |
| | | && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst(); |
| | | first.ifPresent(locMastList::add); |
| | | } |
| | | |
| | | if (locMastList.size() == 0) { |
| | | log.error("-----空桶库无对应空空桶组----"); |
| | | throw new CoolException("空桶库无对应空空桶组"); |
| | | } |
| | | String model = findLocNoAttributeVo.getModel(); // 当前桶类型 |
| | | if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 最上面一层只能放208L,库位剩余量不多时,如果是208L桶入库,则先从最顶层放 |
| | | locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | } else { |
| | | locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | } |
| | | locMast = locMastList.get(0); |
| | | } else { // 奇数,取前一库位对应的空库位 |
| | | String locNo = wrkMast.getLocNo(); |
| | | int row = Integer.parseInt(locNo.substring(0, 2)); |
| | | if(row == 10 || row == 12) { |
| | | String newLocNo =(row == 10 ? "09" : "11") + locNo.substring(2); |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", newLocNo).eq("loc_sts","O")); |
| | | if (locMast == null) { |
| | | log.error("-----与前面桶类型一样,前面该桶类型任务数是奇数,10,12排,但是对应库位不为空----"); |
| | | throw new CoolException("与前面桶类型一样,前面该桶类型任务数是奇数,是10,12排,但是对应库位不为空"); |
| | | } |
| | | } else { |
| | | log.error("-----与前面桶类型一样,前面该桶类型任务数是奇数,但是不是10,12排----"); |
| | | throw new CoolException("与前面桶类型一样,前面该桶类型任务数是奇数,但是不是10,12排"); |
| | | } |
| | | } |
| | | } else { // 当前桶与前桶不是一种类型 |
| | | if(oldCtnType == 1) { // 前面是尾桶 |
| | | // 取新库位组的第一个库位 |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O")); |
| | | List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList()); |
| | | List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 第一个先放这两排 |
| | | if (collect.size() == 0 || collect1.size() == 0) { |
| | | log.error("-----空桶库无空库位----"); |
| | | throw new CoolException("空桶库无空库位"); |
| | | } |
| | | // 可用库位组 |
| | | List<LocMast> locMastList = new ArrayList<>(); |
| | | for(LocMast locMast1:collect) { |
| | | Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1()) |
| | | && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst(); |
| | | first.ifPresent(locMastList::add); |
| | | } |
| | | |
| | | if (locMastList.size() == 0) { |
| | | log.error("-----空桶库无对应空空桶组----"); |
| | | throw new CoolException("空桶库无对应空空桶组"); |
| | | } |
| | | String model = findLocNoAttributeVo.getModel(); // 当前桶类型 |
| | | if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 最上面一层只能放208L,库位剩余量不多时,如果是208L桶入库,则先从最顶层放 |
| | | locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | } else { |
| | | locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | } |
| | | locMast = locMastList.get(0); |
| | | } else { // 前面不是尾桶 |
| | | // 判断前面入空桶库任务数量(未执行堆垛机入库) |
| | | long count = wrkMastList.stream().filter(wrkMast1 -> wrkMast1.getPdcType().equals(oldModel)).count(); |
| | | if (count % 2 == 0) { // 偶数,可以入库 |
| | | // 取新库位组的第一个库位 |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O")); |
| | | List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList()); |
| | | List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 第一个先放这两排 |
| | | if (collect.size() == 0 || collect1.size() == 0) { |
| | | log.error("-----空桶库无空库位----"); |
| | | throw new CoolException("空桶库无空库位"); |
| | | } |
| | | // 可用库位组 |
| | | List<LocMast> locMastList = new ArrayList<>(); |
| | | for(LocMast locMast1:collect) { |
| | | Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1()) |
| | | && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst(); |
| | | first.ifPresent(locMastList::add); |
| | | } |
| | | |
| | | if (locMastList.size() == 0) { |
| | | log.error("-----空桶库无对应空空桶组----"); |
| | | throw new CoolException("空桶库无对应空空桶组"); |
| | | } |
| | | String model = findLocNoAttributeVo.getModel(); // 当前桶类型 |
| | | if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 最上面一层只能放208L,库位剩余量不多时,如果是208L桶入库,则先从最顶层放 |
| | | locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | } else { |
| | | locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | } |
| | | locMast = locMastList.get(0); |
| | | } else { // 奇数,不可以入库 |
| | | // 自动给前面任务补尾桶信号 |
| | | wrkMastService.updateCtnType(wrkMast); |
| | | log.error("-----与前面桶类型不一样,前面桶不是尾桶,前面该桶类型任务数不是偶数,不能入库----"); |
| | | throw new CoolException("与前面桶类型不一样,前面桶不是尾桶,前面该桶类型任务数不是偶数,不能入库"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // // 可用库位组 |
| | | // List<LocMast> locMastList = new ArrayList<>(); |
| | | // for(LocMast locMast1:collect) { |
| | | // Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1()) |
| | | // && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst(); |
| | | // first.ifPresent(locMastList::add); |
| | | // } |
| | | // |
| | | // if (locMastList.size() == 0) { |
| | | // log.error("-----空桶库无对应空空桶组----"); |
| | | // throw new CoolException("空桶库无对应空空桶组"); |
| | | // } |
| | | // String model = findLocNoAttributeVo.getModel(); // 当前桶类型 |
| | | // if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 最上面一层只能放208L,库位剩余量不多时,如果是208L桶入库,则先从最顶层放 |
| | | // locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | // } else { |
| | | // locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | // } |
| | | // locMast = locMastList.get(0); |
| | | // |
| | | // } else { |
| | | // WrkMast wrkMast = wrkMastList.get(0); // 最后一个入空桶库任务 |
| | | // // 前一个任务桶类型 |
| | | // String oldModel = wrkMast.getPdcType(); |
| | | // // 前一个任务尾托标识 |
| | | // Integer oldCtnType = wrkMast.getCtnType(); |
| | | // // 当前桶类型 |
| | | // String matnr = findLocNoAttributeVo.getMatnr(); |
| | | // if(findLocNoAttributeVo.getMatnr().equals(wrkMast.getPdcType())) { // 当前桶与前桶是一种类型 |
| | | // // 当前桶类型的任务有几个 |
| | | // long count = wrkMastList.stream().filter(wrkMast1 -> wrkMast1.getPdcType().equals(matnr)).count(); |
| | | // if (count % 2 == 0) { // 偶数,取一组新库位 |
| | | // // 取新库位组的第一个库位 |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O")); |
| | | // List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList()); |
| | | // List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 第一个先放这两排 |
| | | // if (collect.size() == 0 || collect1.size() == 0) { |
| | | // log.error("-----空桶库无空库位----"); |
| | | // throw new CoolException("空桶库无空库位"); |
| | | // } |
| | | // // 可用库位组 |
| | | // List<LocMast> locMastList = new ArrayList<>(); |
| | | // for(LocMast locMast1:collect) { |
| | | // Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1()) |
| | | // && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst(); |
| | | // first.ifPresent(locMastList::add); |
| | | // } |
| | | // |
| | | // if (locMastList.size() == 0) { |
| | | // log.error("-----空桶库无对应空空桶组----"); |
| | | // throw new CoolException("空桶库无对应空空桶组"); |
| | | // } |
| | | // String model = findLocNoAttributeVo.getModel(); // 当前桶类型 |
| | | // if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 最上面一层只能放208L,库位剩余量不多时,如果是208L桶入库,则先从最顶层放 |
| | | // locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | // } else { |
| | | // locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | // } |
| | | // locMast = locMastList.get(0); |
| | | // } else { // 奇数,取前一库位对应的空库位 |
| | | // String locNo = wrkMast.getLocNo(); |
| | | // int row = Integer.parseInt(locNo.substring(0, 2)); |
| | | // if(row == 10 || row == 12) { |
| | | // String newLocNo =(row == 10 ? "09" : "11") + locNo.substring(2); |
| | | // locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", newLocNo).eq("loc_sts","O")); |
| | | // if (locMast == null) { |
| | | // log.error("-----与前面桶类型一样,前面该桶类型任务数是奇数,10,12排,但是对应库位不为空----"); |
| | | // throw new CoolException("与前面桶类型一样,前面该桶类型任务数是奇数,是10,12排,但是对应库位不为空"); |
| | | // } |
| | | // } else { |
| | | // // 自动给前面任务补尾桶信号 |
| | | // wrkMastService.updateCtnType(wrkMast); |
| | | // log.error("-----与前面桶类型一样,前面该桶类型任务数是奇数,但是不是10,12排----"); |
| | | // throw new CoolException("与前面桶类型一样,前面该桶类型任务数是奇数,但是不是10,12排"); |
| | | // } |
| | | // } |
| | | // } else { // 当前桶与前桶不是一种类型 |
| | | // if(oldCtnType == 1) { // 前面是尾桶 |
| | | // // 取新库位组的第一个库位 |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O")); |
| | | // List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList()); |
| | | // List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 第一个先放这两排 |
| | | // if (collect.size() == 0 || collect1.size() == 0) { |
| | | // log.error("-----空桶库无空库位----"); |
| | | // throw new CoolException("空桶库无空库位"); |
| | | // } |
| | | // // 可用库位组 |
| | | // List<LocMast> locMastList = new ArrayList<>(); |
| | | // for(LocMast locMast1:collect) { |
| | | // Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1()) |
| | | // && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst(); |
| | | // first.ifPresent(locMastList::add); |
| | | // } |
| | | // |
| | | // if (locMastList.size() == 0) { |
| | | // log.error("-----空桶库无对应空空桶组----"); |
| | | // throw new CoolException("空桶库无对应空空桶组"); |
| | | // } |
| | | // String model = findLocNoAttributeVo.getModel(); // 当前桶类型 |
| | | // if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 最上面一层只能放208L,库位剩余量不多时,如果是208L桶入库,则先从最顶层放 |
| | | // locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | // } else { |
| | | // locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | // } |
| | | // locMast = locMastList.get(0); |
| | | // } else { // 前面不是尾桶 |
| | | // // 判断前面入空桶库任务数量(未执行堆垛机入库) |
| | | // long count = wrkMastList.stream().filter(wrkMast1 -> wrkMast1.getPdcType().equals(oldModel)).count(); |
| | | // if (count % 2 == 0) { // 偶数,可以入库 |
| | | // // 取新库位组的第一个库位 |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O")); |
| | | // List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList()); |
| | | // List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 第一个先放这两排 |
| | | // if (collect.size() == 0 || collect1.size() == 0) { |
| | | // log.error("-----空桶库无空库位----"); |
| | | // throw new CoolException("空桶库无空库位"); |
| | | // } |
| | | // // 可用库位组 |
| | | // List<LocMast> locMastList = new ArrayList<>(); |
| | | // for(LocMast locMast1:collect) { |
| | | // Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1()) |
| | | // && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst(); |
| | | // first.ifPresent(locMastList::add); |
| | | // } |
| | | // |
| | | // if (locMastList.size() == 0) { |
| | | // log.error("-----空桶库无对应空空桶组----"); |
| | | // throw new CoolException("空桶库无对应空空桶组"); |
| | | // } |
| | | // String model = findLocNoAttributeVo.getModel(); // 当前桶类型 |
| | | // if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 最上面一层只能放208L,库位剩余量不多时,如果是208L桶入库,则先从最顶层放 |
| | | // locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | // } else { |
| | | // locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList()); |
| | | // } |
| | | // locMast = locMastList.get(0); |
| | | // } else { // 奇数,不可以入库 |
| | | // // 自动给前面任务补尾桶信号 |
| | | // wrkMastService.updateCtnType(wrkMast); |
| | | // log.error("-----与前面桶类型不一样,前面桶不是尾桶,前面该桶类型任务数不是偶数,不能入库----"); |
| | | // throw new CoolException("与前面桶类型不一样,前面桶不是尾桶,前面该桶类型任务数不是偶数,不能入库"); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | } else if ((staDescId == 1 && locArea == 1) || staDescId == 10) { // 满板入成品库或者空板入成品库 |
| | | |
| | | // 入成品库摆放规则 判断可用堆垛机自动-无报警 按层列排顺序从下往上,从前往后排 先深库位在浅库位 最上面一层只能放208L桶(剩余库位达到一个阈值208L就先从最上面开始放,下面留给其他货物-后续优化) |
| | | |
| | | List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>().eq("crn_sts", 3).eq("crn_err", 0).in("crn_no",1,2,3)); |
| | | List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>().eq("crn_sts", 3).eq("crn_err", 0).in("crn_no",1,2,3) |
| | | .eq("in_enable","Y")); |
| | | if (basCrnps.size() == 0) { |
| | | log.error("入库请求库位失败,没有联机堆垛机或堆垛机异常"); |
| | | throw new CoolException("入库请求库位失败,没有联机堆垛机或堆垛机异常"); |
| | |
| | | basCrnpList.add(basCrnp); |
| | | } |
| | | |
| | | basCrnpList = basCrnpList.stream().sorted(Comparator.comparing(BasCrnp::getWrkNo)).collect(Collectors.toList()); |
| | | basCrnpList = basCrnpList.stream().sorted(Comparator.comparing(BasCrnp::getWrkNo).thenComparing(BasCrnp::getCrnNo,((o1, o2) -> { |
| | | // 定义 2 → 3 → 1 的优先级 |
| | | int order1 = getCustomOrder(o1); |
| | | int order2 = getCustomOrder(o2); |
| | | return Integer.compare(order1, order2); |
| | | }))).collect(Collectors.toList()); |
| | | |
| | | // 入库桶型 |
| | | String model = findLocNoAttributeVo.getModel(); |
| | |
| | | return startupDto; |
| | | } |
| | | |
| | | // 辅助方法:定义 crn_no 的排序优先级 |
| | | private static int getCustomOrder(Integer crnNo) { |
| | | switch (crnNo) { |
| | | case 2: return 1; // 2 排第一 |
| | | case 3: return 2; // 3 排第二 |
| | | case 1: return 3; // 1 排第三 |
| | | default: return 4; // 其他值排最后(如果有) |
| | | } |
| | | } |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRED) |
| | | public StartupDto getLocNo(SearchLocParam param, Integer staNo) { |
| | | |