| | |
| | | @RequestMapping("/ddd/ddd") |
| | | @ManagerAuth() |
| | | public R ddd() { |
| | | int w = 64; |
| | | int w = 99999; |
| | | for (int i = 17; i <= 37; i++) { |
| | | for (int j = 1;j<=3;j++){ |
| | | // LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 7).eq("lev1", j)); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 12).eq("lev1", j)); |
| | | LocMast locMast3 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 14).eq("lev1", j)); |
| | | for (int j = 8;j<=14;j++){ |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", j).eq("lev1", 1)); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", j).eq("lev1", 2)); |
| | | LocMast locMast3 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", j).eq("lev1", 3)); |
| | | // LocMast locMast4 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", 26).eq("bay1", i).eq("lev1", 1)); |
| | | // if (locMast.getGro1() == 999){ |
| | | // continue; |
| | | // } |
| | | if (locMast.getGro1() == 999){ |
| | | continue; |
| | | } |
| | | // locMast.setGro1(w); |
| | | // locMast.setGro1(locMast.getGro1()+1000); |
| | | locMast2.setGro1(locMast2.getGro1()+10000); |
| | | locMast3.setGro1(locMast3.getGro1()+2000); |
| | | locMast2.setGro1(locMast.getGro1()+1000); |
| | | locMast3.setGro1(locMast.getGro1()+2000); |
| | | // locMast4.setGro1(w); |
| | | // locMastService.updateById(locMast); |
| | | locMastService.updateById(locMast2); |
| | |
| | | } |
| | | } |
| | | // for (int i = 17; i <=37; i++) { |
| | | // LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 14).eq("lev1", 1)); |
| | | //// LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 10).eq("lev1", 1)); |
| | | //// LocMast locMast3 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 11).eq("lev1", 1)); |
| | | // LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 3).eq("lev1", 1)); |
| | | // LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 8).eq("lev1", 1)); |
| | | // LocMast locMast3 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 13).eq("lev1", 1)); |
| | | //// LocMast locMast4 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", i).eq("bay1", 12).eq("lev1", 1)); |
| | | // locMast.setGro1(w); |
| | | //// locMast2.setGro1(w); |
| | | //// locMast3.setGro1(w); |
| | | // if (!Cools.isEmpty(locMast)) { |
| | | // locMast.setGro1(w); |
| | | // locMastService.updateById(locMast); |
| | | // } |
| | | // |
| | | // locMast2.setGro1(w); |
| | | // locMast3.setGro1(w); |
| | | //// locMast4.setGro1(w); |
| | | // locMastService.updateById(locMast); |
| | | //// locMastService.updateById(locMast2); |
| | | //// locMastService.updateById(locMast3); |
| | | // |
| | | // locMastService.updateById(locMast2); |
| | | // locMastService.updateById(locMast3); |
| | | //// locMastService.updateById(locMast4); |
| | | // w++; |
| | | //// w++; |
| | | // } |
| | | return R.ok(); |
| | | |
| | |
| | | locDetls = locDetlService.queryStockFour(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist,orderDetl.getSupp(),orderDetl.getTemp1(),orderDetl.getTemp2()); |
| | | for (LocDetl locDetl : locDetls) { |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | List<LocMast> locMasts = new ArrayList<>(); |
| | | if (locMast.getBay1() >=1 && locMast.getBay1()<=2){ |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1",locMast.getLocType1()) |
| | | .orderBy("bay1", false)); |
| | | }else if (locMast.getBay1() >=4 && locMast.getBay1()<=12){ |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1",locMast.getLocType1()) |
| | | .orderBy("bay1", true)); |
| | | }else { |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1",locMast.getLocType1()) |
| | | .orderBy("bay1", false)); |
| | | } |
| | | for (LocMast locMast1 : locMasts){ |
| | | if (locMast1.getLocSts().equals("F")){ |
| | | LocDetl locDetl1 = locDetlService.selectOne(new EntityWrapper<LocDetl>() |
| | | .eq("loc_No", locMast1.getLocNo()) |
| | | .eq("matnr", locDetl.getMatnr()).eq("batch", locDetl.getBatch())); |
| | | if (!Cools.isEmpty(locDetl1)) { |
| | | ExistDto existDto = new ExistDto(); |
| | | existDto.setLocNo(locDetl1.getLocNo()); |
| | | existDto.setMatnr(locDetl1.getMatnr()); |
| | | existDto.setBatch(locDetl1.getBatch()); |
| | | if (existDtos.add(existDto)){ |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl1.getLocNo(), locDetl1.getMatnr(), locDetl1.getMaktx(), locDetl1.getBatch(), orderDetl.getOrderNo(), |
| | | issued >= locDetl1.getAnfme() ? locDetl1.getAnfme() : issued); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl1.getLocNo(), issued >= locDetl1.getAnfme() ? 101 : 103); |
| | | List<LocDto.staListDto> maps = new ArrayList<>(); |
| | | for (Integer staNo : staNos) { |
| | | LocDto.staListDto staListDto = new LocDto.staListDto(); |
| | | staListDto.setStaNo(staNo); |
| | | staListDto.setStaName(Utils.getStaName(staNo)); |
| | | maps.add(staListDto); |
| | | } |
| | | locDto.setStaNos(maps); |
| | | locDtos.add(locDto); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | }else { |
| | | break; |
| | | if (locMast.getLocSts().equals("F")){ |
| | | LocDetl locDetl1 = locDetlService.selectOne(new EntityWrapper<LocDetl>() |
| | | .eq("loc_No", locMast.getLocNo()) |
| | | .eq("matnr", locDetl.getMatnr()).eq("batch", locDetl.getBatch())); |
| | | if (!Cools.isEmpty(locDetl1)) { |
| | | ExistDto existDto = new ExistDto(); |
| | | existDto.setLocNo(locDetl1.getLocNo()); |
| | | existDto.setMatnr(locDetl1.getMatnr()); |
| | | existDto.setBatch(locDetl1.getBatch()); |
| | | if (existDtos.add(existDto)){ |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl1.getLocNo(), locDetl1.getMatnr(), locDetl1.getMaktx(), locDetl1.getBatch(), orderDetl.getOrderNo(), |
| | | issued >= locDetl1.getAnfme() ? locDetl1.getAnfme() : issued); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl1.getLocNo(), issued >= locDetl1.getAnfme() ? 101 : 103); |
| | | List<LocDto.staListDto> maps = new ArrayList<>(); |
| | | for (Integer staNo : staNos) { |
| | | LocDto.staListDto staListDto = new LocDto.staListDto(); |
| | | staListDto.setStaNo(staNo); |
| | | staListDto.setStaName(Utils.getStaName(staNo)); |
| | | maps.add(staListDto); |
| | | } |
| | | locDto.setStaNos(maps); |
| | | locDtos.add(locDto); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | }else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); |
| | |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | locDetls = locDetlService.queryStockFour(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist,orderDetl.getSupp(),orderDetl.getTemp1(),orderDetl.getTemp2()); |
| | | for (LocDetl locDetl : locDetls) { |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | List<LocMast> locMasts = new ArrayList<>(); |
| | | if (locMast.getBay1() >=1 && locMast.getBay1()<=2){ |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1",locMast.getLocType1()) |
| | | .orderBy("bay1", false)); |
| | | }else if (locMast.getBay1() >=4 && locMast.getBay1()<=12){ |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1",locMast.getLocType1()) |
| | | .orderBy("bay1", true)); |
| | | }else { |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1",locMast.getLocType1()) |
| | | .orderBy("bay1", false)); |
| | | } |
| | | for (LocMast locMast1 : locMasts){ |
| | | if (locMast1.getLocSts().equals("F")){ |
| | | LocDetl locDetl1 = locDetlService.selectOne(new EntityWrapper<LocDetl>() |
| | | .eq("loc_No", locMast1.getLocNo()) |
| | | .eq("matnr", locDetl.getMatnr()).eq("batch", locDetl.getBatch())); |
| | | if (!Cools.isEmpty(locDetl1)) { |
| | | ExistDto existDto = new ExistDto(); |
| | | existDto.setLocNo(locDetl1.getLocNo()); |
| | | existDto.setMatnr(locDetl1.getMatnr()); |
| | | existDto.setBatch(locDetl1.getBatch()); |
| | | if (existDtos.add(existDto)){ |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl1.getLocNo(), locDetl1.getMatnr(), locDetl1.getMaktx(), locDetl1.getBatch(), orderDetl.getOrderNo(), |
| | | issued >= locDetl1.getAnfme() ? locDetl1.getAnfme() : issued); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl1.getLocNo(), issued >= locDetl1.getAnfme() ? 101 : 103); |
| | | List<LocDto.staListDto> maps = new ArrayList<>(); |
| | | for (Integer staNo : staNos) { |
| | | LocDto.staListDto staListDto = new LocDto.staListDto(); |
| | | staListDto.setStaNo(staNo); |
| | | staListDto.setStaName(Utils.getStaName(staNo)); |
| | | maps.add(staListDto); |
| | | } |
| | | locDto.setStaNos(maps); |
| | | locDtos.add(locDto); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | }else { |
| | | break; |
| | | } |
| | | } |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | if (locMast.getLocSts().equals("F")){ |
| | | LocDetl locDetl1 = locDetlService.selectOne(new EntityWrapper<LocDetl>() |
| | | .eq("loc_No", locMast.getLocNo()) |
| | | .eq("matnr", locDetl.getMatnr()).eq("batch", locDetl.getBatch())); |
| | | if (!Cools.isEmpty(locDetl1)) { |
| | | ExistDto existDto = new ExistDto(); |
| | | existDto.setLocNo(locDetl1.getLocNo()); |
| | | existDto.setMatnr(locDetl1.getMatnr()); |
| | | existDto.setBatch(locDetl1.getBatch()); |
| | | if (existDtos.add(existDto)){ |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl1.getLocNo(), locDetl1.getMatnr(), locDetl1.getMaktx(), locDetl1.getBatch(), orderDetl.getOrderNo(), |
| | | issued >= locDetl1.getAnfme() ? locDetl1.getAnfme() : issued); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl1.getLocNo(), issued >= locDetl1.getAnfme() ? 101 : 103); |
| | | List<LocDto.staListDto> maps = new ArrayList<>(); |
| | | for (Integer staNo : staNos) { |
| | | LocDto.staListDto staListDto = new LocDto.staListDto(); |
| | | staListDto.setStaNo(staNo); |
| | | staListDto.setStaName(Utils.getStaName(staNo)); |
| | | maps.add(staListDto); |
| | | } |
| | | locDto.setStaNos(maps); |
| | | locDtos.add(locDto); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | }else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/out/pakout/auth/sxk") |
| | | @ManagerAuth(memo = "订单出库") |
| | | public synchronized R pakoutSxk(@RequestBody List<LocDto> locDtos) throws InterruptedException { |
| | | if (Cools.isEmpty(locDtos)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | boolean lack = true; |
| | | for (LocDto locDto : locDtos) { |
| | | // 判断入库模式 |
| | | OutStockInterceptUtil.outStockIntercept(locDto.getStaNo()); |
| | | if (!locDto.isLack()) { |
| | | lack = false; |
| | | break; |
| | | } |
| | | } |
| | | if (lack) { |
| | | return R.error("库存不足"); |
| | | } |
| | | |
| | | Thread.sleep(1000L); |
| | | |
| | | List<TaskDto> taskDtos = new ArrayList<>(); |
| | | // 根据 (库位 & 出库站) 分组; 理想状态:一组为一次出库任务 |
| | | for (LocDto locDto : locDtos) { |
| | | if (locDto.isLack()) { continue; } |
| | | TaskDto taskDto = new TaskDto(locDto.getLocNo(), locDto.getStaNo(), locDto); |
| | | if (TaskDto.has(taskDtos, taskDto)) { |
| | | TaskDto dto = TaskDto.find(taskDtos, taskDto); |
| | | assert dto != null; |
| | | dto.getLocDtos().addAll(taskDto.getLocDtos()); |
| | | } else { |
| | | taskDtos.add(taskDto); |
| | | } |
| | | } |
| | | // ----------------------------------------------------------------------------------------------- |
| | | for (TaskDto taskDto : taskDtos) { |
| | | BasDevp staNo = basDevpService.checkSiteStatus(taskDto.getStaNo()); |
| | | workService.stockOutSxk(staNo, taskDto, getUserId()); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | void stockOut(BasDevp staNo, List<LocDetlDto> locDetls, IoWorkType ioWorkType, Long userId); |
| | | |
| | | void stockOut(BasDevp staNo, TaskDto taskDto, Long userId); |
| | | void stockOutSxk(BasDevp staNo, TaskDto taskDto, Long userId); |
| | | |
| | | /** |
| | | * 空板入库 |
| | |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.asrs.utils.VersionUtils; |
| | | import com.zy.common.model.*; |
| | | import com.zy.common.model.enums.IoWorkType; |
| | | import com.zy.common.model.enums.WorkNoType; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void stockOutSxk(BasDevp staNo, TaskDto taskDto, Long userId) { |
| | | Date now = new Date(); |
| | | List<LocDto> locDtos = taskDto.getLocDtos(); |
| | | for (LocDto locDto : locDtos) { |
| | | if (!taskDto.getLocNo().equals(locDto.getLocNo()) && !taskDto.getStaNo().equals(locDto.getStaNo())) { |
| | | throw new CoolException("订单出库异常,请联系管理员"); |
| | | } |
| | | } |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.selectById(taskDto.getLocNo()); |
| | | |
| | | List<LocMast> locMasts = new ArrayList<>(); |
| | | if ((locMast.getBay1() >=1 && locMast.getBay1()<=2) || (locMast.getBay1() >=6 && locMast.getBay1()<=7 && locMast.getRow1() !=36 && locMast.getRow1() !=29 ) || (locMast.getBay1() >=11 && locMast.getBay1()<=12)){ |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1",locMast.getLocType1()) |
| | | .orderBy("bay1", false)); |
| | | }else { |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1",locMast.getLocType1()) |
| | | .orderBy("bay1", true)); |
| | | } |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (locMast1.getLocNo().equals(taskDto.getLocNo())){ |
| | | break; |
| | | } |
| | | if (locMast1.getLocSts().equals("X")){ |
| | | throw new CoolException(taskDto.getLocNo()+"库位前方有锁定库位,禁止出库"); |
| | | } |
| | | if (locMast1.getLocSts().equals("F")) { |
| | | moveLocForDeepLoc(locMast1); |
| | | } |
| | | } |
| | | |
| | | // 获取路径 |
| | | int ioType = taskDto.isAll() ? 101 : 103; |
| | | StaDesc staDesc = staDescService.queryCrnStnAuto(ioType, locMast.getCrnNo(), staNo.getDevNo()); |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(ioType)); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(ioType); // 入出库状态 |
| | | wrkMast.setIoPri(13D); // 优先级:13 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 源站 |
| | | wrkMast.setStaNo(staDesc.getStnNo()); // 目标站 |
| | | wrkMast.setSourceLocNo(taskDto.getLocNo()); // 源库位 |
| | | wrkMast.setFullPlt("Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("N"); // 空板 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setBarcode(locMast.getBarcode()); |
| | | wrkMast.setAppeUser(userId); // 操作人员数据 |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(userId); |
| | | wrkMast.setModiTime(now); |
| | | if (!wrkMastService.insert(wrkMast)) { |
| | | throw new CoolException("保存工作档失败,出库库位号:"+taskDto.getLocNo()); |
| | | } |
| | | // 生成工作档明细 |
| | | for (LocDto locDto : taskDto.getLocDtos()) { |
| | | if (locDto.getAnfme()==null || locDto.getAnfme() <= 0.0D) { continue; } |
| | | OrderDetl orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); |
| | | if (orderDetl == null) { |
| | | orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), null); |
| | | } |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(orderDetl); |
| | | wrkDetl.setZpallet(wrkMast.getBarcode()); |
| | | wrkDetl.setIoTime(now); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setBatch(locDto.getBatch()); |
| | | wrkDetl.setOrderNo(locDto.getOrderNo()); |
| | | wrkDetl.setAnfme(locDto.getAnfme()); // 数量 |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(now); |
| | | wrkDetl.setModiUser(userId); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | | // 修改订单明细 |
| | | if (!orderDetlService.increaseWorkQty(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), locDto.getAnfme())) { |
| | | throw new CoolException("修改订单明细数量失败"); |
| | | } |
| | | orderService.updateSettle(orderDetl.getOrderId(), 2L, userId); |
| | | } |
| | | // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 |
| | | locMast = locMastService.selectById(taskDto.getLocNo()); |
| | | if (locMast.getLocSts().equals("F")) { |
| | | locMast.setLocSts(ioType==101?"R":"P"); |
| | | locMast.setModiUser(userId); |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("预约库位状态失败,库位号:"+taskDto.getLocNo()); |
| | | } |
| | | } else { |
| | | throw new CoolException(taskDto.getLocNo() + "库位不是在库状态"); |
| | | } |
| | | } |
| | | |
| | | @Transactional |
| | | public void moveLocForDeepLoc(LocMast shallowLoc) { |
| | | |
| | | try { |
| | | LocTypeDto locTypeDto = new LocTypeDto(); |
| | | locTypeDto.setLocType1(shallowLoc.getLocType1()); |
| | | locTypeDto.setLev1(shallowLoc.getLev1()); |
| | | StartupDto dto = commonService.getLocNo( 1, 31001, null,null,null, locTypeDto, false); |
| | | LocMast loc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", dto.getLocNo())); |
| | | // 获取工作号 |
| | | int workNo = commonService.getWorkNo(0); |
| | | // 保存工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(new Date()); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(11); // 入出库状态: 11.库格移载 |
| | | wrkMast.setIoPri(13D); |
| | | wrkMast.setCrnNo(7); |
| | | wrkMast.setSourceLocNo(shallowLoc.getLocNo()); // 源库位 |
| | | wrkMast.setLocNo(dto.getLocNo()); // 目标库位 |
| | | wrkMast.setFullPlt(shallowLoc.getFullPlt()); // 满板 |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk(shallowLoc.getLocSts().equals("D") ? "Y" : "N"); // 空板 |
| | | wrkMast.setBarcode(shallowLoc.getBarcode()); // 托盘码 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setAppeTime(new Date()); |
| | | wrkMast.setModiTime(new Date()); |
| | | boolean res = wrkMastService.insert(wrkMast); |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | // 工作档明细保存 |
| | | if (shallowLoc.getLocSts().equals("F")) { |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", shallowLoc.getLocNo())); |
| | | for (LocDetl locDetl : locDetls) { |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(new Date()); |
| | | wrkDetl.setAnfme(locDetl.getAnfme()); |
| | | VersionUtils.setWrkDetl(wrkDetl, locDetl); // 版本控制 |
| | | wrkDetl.setAppeTime(new Date()); |
| | | wrkDetl.setModiTime(new Date()); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | | } |
| | | } |
| | | // 修改源库位状态 |
| | | if (shallowLoc.getLocSts().equals("D") || shallowLoc.getLocSts().equals("F")) { |
| | | shallowLoc.setLocSts("R"); // R.出库预约 |
| | | shallowLoc.setModiTime(new Date()); |
| | | if (!locMastService.updateById(shallowLoc)) { |
| | | |
| | | throw new CoolException("更新源库位状态失败"); |
| | | } |
| | | } else { |
| | | throw new CoolException("源库位出库失败"); |
| | | } |
| | | // 修改目标库位状态 |
| | | if (loc.getLocSts().equals("O")) { |
| | | loc.setLocSts("S"); // S.入库预约 |
| | | loc.setModiTime(new Date()); |
| | | if (!locMastService.updateById(loc)) { |
| | | throw new CoolException("更新目标库位状态失败"); |
| | | } |
| | | } else { |
| | | |
| | | throw new CoolException("移转失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public String emptyPlateIn(Integer devpNo, Long userId) { |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | |
| | | package com.zy.asrs.utils; |
| | | |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.Mat; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.entity.result.Pakin; |
| | | import com.zy.common.model.LocTypeDto; |
| | | |
| | |
| | | */ |
| | | public class VersionUtils { |
| | | |
| | | public static void setWrkDetl(WrkDetl wrkDetl, LocDetl locDetl) { |
| | | wrkDetl.setMatnr(locDetl.getMatnr()); // 产品编号 |
| | | wrkDetl.setMaktx(locDetl.getMaktx()); // 产品描述 |
| | | wrkDetl.setSpecs(locDetl.getSpecs()); // 规格 |
| | | wrkDetl.setUnit(locDetl.getUnit()); // 单位 |
| | | // wrkDetl.setSize(locDetl.getSize()); // 尺寸 |
| | | wrkDetl.setColor(locDetl.getColor()); // 颜色 |
| | | wrkDetl.setWeight(locDetl.getWeight()); // 单重 |
| | | wrkDetl.setZpallet(locDetl.getZpallet()); // 托盘条码 |
| | | } |
| | | |
| | | /** |
| | | * 库位移转时类型检测 |
| | | * 兼容版 |
| | |
| | | @Data |
| | | public class LocTypeDto { |
| | | |
| | | private Integer lev1 = null; |
| | | |
| | | // 高低类型{0:未知,1:低库位,2:高库位} |
| | | private Short locType1; |
| | | |
| | |
| | | if (Cools.isEmpty(locMast) && crnNo != 0) { |
| | | List<LocMast> locMasts = new ArrayList<>(); |
| | | int floor = 0; |
| | | if (locTypeDto.getLocType1() == 1){ |
| | | int F1count = locMastService.selectCount(new EntityWrapper<LocMast>() |
| | | .in("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | .eq("lev1", 1)); |
| | | if (F1count <= 10) { |
| | | int F2count = locMastService.selectCount(new EntityWrapper<LocMast>() |
| | | if (locTypeDto.getLev1() == null){ |
| | | if (locTypeDto.getLocType1() == 1){ |
| | | int F1count = locMastService.selectCount(new EntityWrapper<LocMast>() |
| | | .in("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | .eq("lev1", 2)); |
| | | if (F2count <= 10) { |
| | | throw new CoolException("库位不足"); |
| | | .eq("lev1", 1)); |
| | | if (F1count <= 10) { |
| | | int F2count = locMastService.selectCount(new EntityWrapper<LocMast>() |
| | | .in("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | .eq("lev1", 2)); |
| | | if (F2count <= 10) { |
| | | throw new CoolException("库位不足"); |
| | | }else { |
| | | floor = 2; |
| | | } |
| | | }else { |
| | | floor = 2; |
| | | floor = 1; |
| | | } |
| | | }else { |
| | | floor = 1; |
| | | } |
| | | |
| | | }else if (locTypeDto.getLocType1() == 2){ |
| | | int F3count = locMastService.selectCount(new EntityWrapper<LocMast>() |
| | | .in("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | .eq("lev1", 3)); |
| | | if (F3count <= 10) { |
| | | throw new CoolException("库位不足"); |
| | | }else if (locTypeDto.getLocType1() == 2){ |
| | | int F3count = locMastService.selectCount(new EntityWrapper<LocMast>() |
| | | .in("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()) |
| | | .eq("crn_no", 7) |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | .eq("lev1", 3)); |
| | | if (F3count <= 10) { |
| | | throw new CoolException("库位不足"); |
| | | } |
| | | floor = 3; |
| | | }else { |
| | | throw new CoolException("库位高度数据异常"); |
| | | } |
| | | floor = 3; |
| | | }else { |
| | | throw new CoolException("库位高度数据异常"); |
| | | } |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("bay1", nearRow) |
| | | .in("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue()) |
| | | .eq("crn_no",7) |
| | | .eq("loc_type1",locTypeDto.getLocType1()) |
| | | .eq("lev1",floor).orderBy("row1",false));//最浅库位 |
| | | |
| | | if (locTypeDto.getLev1() != null){ |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("bay1", nearRow) |
| | | .in("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue()) |
| | | .eq("crn_no",7) |
| | | .eq("loc_type1",locTypeDto.getLocType1()) |
| | | .eq("lev1",locTypeDto.getLev1()).orderBy("row1",false));//最浅库位 |
| | | }else { |
| | | if (floor == 0){ |
| | | throw new CoolException("库位已满"); |
| | | } |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("bay1", nearRow) |
| | | .in("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue()) |
| | | .eq("crn_no",7) |
| | | .eq("loc_type1",locTypeDto.getLocType1()) |
| | | .eq("lev1",floor).orderBy("row1",false));//最浅库位 |
| | | } |
| | | |
| | | |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (locMast != null){ |
| | |
| | | // let loadIndex = layer.load(2); |
| | | notice.msg('正在生成出库任务......', {icon: 4}); |
| | | $.ajax({ |
| | | url: baseUrl + "/out/pakout/auth", |
| | | url: baseUrl + "/out/pakout/auth/sxk", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | contentType: 'application/json;charset=UTF-8', |
| | | data: JSON.stringify(tableCache), |
| | |
| | | // let loadIndex = layer.load(2); |
| | | notice.msg('正在生成出库任务......', {icon: 4}); |
| | | $.ajax({ |
| | | url: baseUrl + "/out/pakout/auth", |
| | | url: baseUrl + "/out/pakout/auth/sxk", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | contentType: 'application/json;charset=UTF-8', |
| | | data: JSON.stringify(tableCache), |