| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.BaseRes; |
| | |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.EmptyPlateOutParam; |
| | | import com.zy.asrs.entity.param.FullStoreParam; |
| | | import com.zy.asrs.entity.param.LocDetlAdjustParam; |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.*; |
| | |
| | | // 检索库位 |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | List<String> matnrs = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatnr).distinct().collect(Collectors.toList()); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matnrs, locTypeDto); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matnrs, locTypeDto, 0); |
| | | // 生成工作号 |
| | | int workNo = dto.getWorkNo(); |
| | | // 生成工作档 |
| | |
| | | locs.add(one.getLocNo()); |
| | | } |
| | | |
| | | //出库时,如果当前库位组有相同的物料,则先出外侧物料 |
| | | for (StockOutParam.LocDetl locDetl : param.getLocDetls()) { |
| | | List<String> outerSingleLoc = Utils.getGroupOuterSingleLoc(locDetl.getLocNo()); |
| | | outerSingleLoc.add(locDetl.getLocNo()); |
| | | boolean flag = false; |
| | | Double useCount = 0D; |
| | | for (String locNo : outerSingleLoc) { |
| | | if(locs.contains(locNo)) continue; |
| | | for (LocDetl locDetl0 : locDetlService.selectByLocNo(locNo)) { |
| | | if (!locDetl0.getMatnr().equals(locDetl.getMatnr())) { |
| | | //不是相同物料 |
| | | continue; |
| | | for (String loc : locs) { |
| | | List<LocDetl> detls = locDetlService.selectByLocNo(loc); |
| | | for (LocDetl detl : detls) { |
| | | for (StockOutParam.LocDetl paramDetls : param.getLocDetls()) { |
| | | if (paramDetls.getMatnr().equals(detl.getMatnr()) && paramDetls.getBatch().equals(detl.getBatch()) && paramDetls.getLocNo().equals(detl.getLocNo())) { |
| | | locDetls.add(new StockOutParam.LocDetl(detl.getLocNo(), detl.getMatnr(), detl.getBatch(), paramDetls.getCount())); |
| | | } |
| | | double lastCount = locDetl.getCount() - useCount;//剩余所需数量 |
| | | double realCount = 0;//实际提供数量 |
| | | if (lastCount==0){ |
| | | continue; |
| | | } |
| | | if (locDetl0.getAnfme() >= lastCount) {//实际数量大于所需数量,按所需数量提供 |
| | | realCount = lastCount; |
| | | } else { |
| | | //实际小于所需数量,按实际数量提供 |
| | | realCount = locDetl0.getAnfme(); |
| | | } |
| | | useCount += realCount;//已使用的数量 |
| | | } |
| | | |
| | | locDetls.add(new StockOutParam.LocDetl(locDetl0.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), realCount)); |
| | | flag = true; |
| | | if (useCount >= locDetl.getCount()) { |
| | | //找到的库存 >= 所需库存,满足条件 |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | // 目标站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); |
| | | // 获取库位明细 |
| | | List<LocDetlDto> locDetlDtos = new ArrayList<>(); |
| | | for (StockOutParam.LocDetl paramLocDetl : locDetls) { |
| | | if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) { |
| | | LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getBatch()); |
| | | if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount())); |
| | | } |
| | | } |
| | | for (LocDetlDto locDetlDto:locDetlDtos){ |
| | | if (locs.contains(locDetlDto.getLocDetl().getLocNo())){ |
| | | locDetlDto.setSign(true); |
| | | } |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo())); |
| | | if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D") ){ |
| | | // 启动出库开始 101.出库 |
| | | stockOut2(staNo, locDetlDtos, null, userId); |
| | | }else { |
| | | throw new CoolException("所选库位存在状态不为F、D的库位,库位号:"+locMast.getLocNo()+" 、当前状态:"+locMast.getLocSts()+"-"+locMast.getLocSts$()); |
| | | } |
| | | } else { |
| | | throw new CoolException("库存不存在"); |
| | | } |
| | | } |
| | | |
| | | // 备份之前 startupFullTakeStore 方法 |
| | | @Override |
| | | @Transactional |
| | | public void startupFullTakeStore2(StockOutParam param, Long userId) { |
| | | List<StockOutParam.LocDetl> locDetls = new ArrayList<>(); |
| | | List<String> locs = new ArrayList<>(); |
| | | for(StockOutParam.LocDetl one : param.getLocDetls()){ |
| | | locs.add(one.getLocNo()); |
| | | } |
| | | |
| | | List<StockOutParam.LocDetl> stockOutParamLocDetlSort = Utils.getStockOutParamLocDetlSort(param.getLocDetls()); |
| | | boolean sign = true; |
| | | boolean isfull = false; // 是否够数量 |
| | | Double isOut = 0.0; |
| | | List<String> locNoWeighting = new ArrayList<>(); |
| | | for (StockOutParam.LocDetl locDetl : stockOutParamLocDetlSort) { |
| | | if (Cools.isEmpty(locNoWeighting)){ |
| | | locNoWeighting.add(locDetl.getLocNo()); |
| | | }else { |
| | | if (!Utils.getLocNoWeighting(locNoWeighting,locDetl.getLocNo())){ |
| | | locNoWeighting.add(locDetl.getLocNo()); |
| | | sign = true; |
| | | } |
| | | } |
| | | if (sign){ |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | //获取同一库位组的外侧库位号 |
| | | List<String> groupOuterSingleLoc = Utils.getGroupOuterSingleLoc(locDetl.getLocNo()); |
| | | if (locMast.getLocType2().equals((short)3)){ |
| | | groupOuterSingleLoc = Utils.getGroupOuterSingleLocLowFrequency(locDetl.getLocNo()); |
| | | sign = false; |
| | | } |
| | | for (String locNo : groupOuterSingleLoc) { |
| | | //每个库位的库位明细 |
| | | if(locs.contains(locNo)) continue; |
| | | LocMast mast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locNo)); |
| | | if (mast.getLocSts().equals("P") || mast.getLocSts().equals("Q")){ |
| | | throw new CoolException("当前库位的浅库位状态为" + mast.getLocSts() + "暂不支持出库!"); |
| | | } |
| | | for (LocDetl detl : locDetlService.selectByLocNo(locNo)) { |
| | | if (!detl.getMatnr().equals(locDetl.getMatnr())) { |
| | | //不是相同物料 |
| | | if (!sign){ |
| | | locDetls.add(new StockOutParam.LocDetl(detl.getLocNo(), detl.getMatnr(), detl.getBatch(), detl.getAnfme())); |
| | | } |
| | | continue; |
| | | } |
| | | if (!param.getOutSite().equals(214) && !param.getOutSite().equals(114)){ |
| | | if (detl.getAnfme() >= locDetl.getCount()) { |
| | | locDetls.add(new StockOutParam.LocDetl(detl.getLocNo(), detl.getMatnr(), detl.getBatch(), locDetl.getCount())); |
| | | isOut = locDetl.getCount(); |
| | | isfull = true; |
| | | break; |
| | | } else { |
| | | locDetls.add(new StockOutParam.LocDetl(detl.getLocNo(), detl.getMatnr(), detl.getBatch(), detl.getAnfme())); |
| | | isOut = detl.getAnfme(); |
| | | } |
| | | } else { |
| | | //强制不是相同物料 |
| | | locDetls.add(new StockOutParam.LocDetl(detl.getLocNo(), detl.getMatnr(), detl.getBatch(), detl.getAnfme())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (!isfull) { |
| | | |
| | | if (!flag) { |
| | | locDetls.add(locDetl); |
| | | locDetls.add(new StockOutParam.LocDetl(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), locDetl.getCount() - isOut)); |
| | | // locDetls.add(locDetl); |
| | | } |
| | | |
| | | } |
| | | //出库时,如果当前库位组有相同的物料,则先出外侧物料 6.30日 注释 |
| | | //for (StockOutParam.LocDetl locDetl : param.getLocDetls()) { |
| | | // List<String> outerSingleLoc = Utils.getGroupOuterSingleLoc(locDetl.getLocNo()); |
| | | // boolean flag = false; |
| | | // Double useCount = 0D; |
| | | // for (String locNo : outerSingleLoc) { |
| | | // if(locs.contains(locNo)) continue; |
| | | // for (LocDetl locDetl0 : locDetlService.selectByLocNo(locNo)) { |
| | | // if (!locDetl0.getMatnr().equals(locDetl.getMatnr())) { |
| | | // //不是相同物料 |
| | | // continue; |
| | | // } |
| | | // double lastCount = locDetl.getCount() - useCount;//剩余所需数量 |
| | | // double realCount = 0;//实际提供数量 |
| | | // if (lastCount==0){ |
| | | // continue; |
| | | // } |
| | | // if (locDetl0.getAnfme() >= lastCount) {//实际数量大于所需数量,按所需数量提供 |
| | | // realCount = lastCount; |
| | | // } else { |
| | | // //实际小于所需数量,按实际数量提供 |
| | | // realCount = locDetl0.getAnfme(); |
| | | // } |
| | | // useCount += realCount;//已使用的数量 |
| | | // |
| | | // locDetls.add(new StockOutParam.LocDetl(locDetl0.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), realCount)); |
| | | // flag = true; |
| | | // if (useCount >= locDetl.getCount()) { |
| | | // //找到的库存 >= 所需库存,满足条件 |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // if (!flag) { |
| | | // locDetls.add(locDetl); |
| | | // } |
| | | // |
| | | //} |
| | | |
| | | // TODO: 2023/6/28 等李薇确认是否使用 |
| | | // ---------------------------------------------- |
| | | //for(StockOutParam.LocDetl one : param.getLocDetls()){ |
| | | // List<String> outerSingleLoc = Utils.getGroupOuterSingleLoc(one.getLocNo()); |
| | | // for (String s : outerSingleLoc) { |
| | | // if (!locs.contains(s)) { |
| | | // throw new CoolException("浅库位有相同物料不支持出库"); |
| | | // } |
| | | // } |
| | | //} |
| | | // ---------------------------------------------- |
| | | |
| | | // ArrayList<String> locNos = new ArrayList<>(); |
| | | // for (StockOutParam.LocDetl locDetl:param.getLocDetls()){ |
| | |
| | | if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount())); |
| | | } |
| | | } |
| | | for (LocDetlDto locDetlDto:locDetlDtos){ |
| | | if (locs.contains(locDetlDto.getLocDetl().getLocNo())){ |
| | | locDetlDto.setSign(true); |
| | | } |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo())); |
| | | if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D") ){ |
| | | // 启动出库开始 101.出库 |
| | | stockOut(staNo, locDetlDtos, null, userId); |
| | | stockOut2(staNo, locDetlDtos, null, userId); |
| | | }else { |
| | | throw new CoolException("所选库位存在状态不为F、D的库位,库位号:"+locMast.getLocNo()+" 、当前状态:"+locMast.getLocSts()+"-"+locMast.getLocSts$()); |
| | | } |
| | |
| | | double realCount = 0;//实际提供数量 |
| | | if (detl.getAnfme() >= lastCount) {//实际数量大于所需数量,按所需数量提供 |
| | | realCount = lastCount; |
| | | }else { |
| | | } else { |
| | | //实际小于所需数量,按实际数量提供 |
| | | realCount = detl.getAnfme(); |
| | | } |
| | |
| | | double realCount = 0;//实际提供数量 |
| | | if (locDetl0.getAnfme() >= lastCount) {//实际数量大于所需数量,按所需数量提供 |
| | | realCount = lastCount; |
| | | }else { |
| | | } else { |
| | | //实际小于所需数量,按实际数量提供 |
| | | realCount = locDetl0.getAnfme(); |
| | | } |
| | |
| | | double realCount = 0;//实际提供数量 |
| | | if (locDetl0.getAnfme() >= lastCount) {//实际数量大于所需数量,按所需数量提供 |
| | | realCount = lastCount; |
| | | }else { |
| | | } else { |
| | | //实际小于所需数量,按实际数量提供 |
| | | realCount = locDetl0.getAnfme(); |
| | | } |
| | |
| | | @Override |
| | | @Transactional |
| | | public void stockOut(BasDevp staNo, List<LocDetlDto> locDetlDtos, IoWorkType ioWorkType, Long userId) { |
| | | Integer basDevp = staNo.getDevNo(); |
| | | Date now = new Date(); |
| | | // 合并同类项 |
| | | Set<String> locNos = new HashSet<>(); |
| | | ArrayList<String> locNos2 = new ArrayList<String>(); |
| | | List<OutLocDto> dtos = new ArrayList<>(); |
| | | for (LocDetlDto locDetlDto : locDetlDtos) { |
| | | String locNo = locDetlDto.getLocDetl().getLocNo(); |
| | | if (locNos.contains(locNo)) { |
| | | for (OutLocDto dto : dtos) { |
| | | if (dto.getLocNo().equals(locNo)) { |
| | | dto.getLocDetlDtos().add(locDetlDto); |
| | | break; |
| | | locNos2.add(locNo); |
| | | //if (locNos.contains(locNo)) { |
| | | //for (OutLocDto dto : dtos) { |
| | | // if (dto.getLocNo().equals(locNo)) { |
| | | // dto.getLocDetlDtos().add(locDetlDto); |
| | | // break; |
| | | // } |
| | | //} |
| | | //} else { |
| | | //locNos.add(locNo); |
| | | |
| | | //dtos.add(new OutLocDto(locNo, locDetlDto)); |
| | | //} |
| | | } |
| | | List<String> innermostSideLoc = Utils.getInnermostSideLoc(locNos2, true); |
| | | System.out.println(innermostSideLoc); |
| | | for (LocDetlDto locDetlDto : locDetlDtos) { |
| | | String locNo = locDetlDto.getLocDetl().getLocNo(); |
| | | if (innermostSideLoc.contains(locNo)) { |
| | | if (locNos.contains(locNo)) { |
| | | for (OutLocDto dto : dtos) { |
| | | if (dto.getLocNo().equals(locNo)) { |
| | | dto.getLocDetlDtos().add(locDetlDto); |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | locNos.add(locNo); |
| | | dtos.add(new OutLocDto(locNo, locDetlDto)); |
| | | } |
| | | } else { |
| | | locNos.add(locNo); |
| | | dtos.add(new OutLocDto(locNo, locDetlDto)); |
| | | //dtos.add(new OutLocDto(locNo,locDetlDto)); |
| | | } |
| | | } |
| | | |
| | | Integer ioType = null; |
| | | List<String> excludeLocNos = dtos.stream().map(OutLocDto::getLocNo).distinct().collect(Collectors.toList()); |
| | | // 生成工作档 |
| | |
| | | } |
| | | |
| | | List<String> outerLocs = Utils.getGroupOuterSingleLoc(locNo); |
| | | LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", dto.getLocNo())); |
| | | if (locMast1.getLocType2().equals((short) 3)) { |
| | | outerLocs = Utils.getGroupOuterSingleLocLowFrequency(locMast1.getLocNo()); |
| | | } |
| | | Double wrkPri = 15D; |
| | | for (String outerLoc : outerLocs) { |
| | | LocMast locMast = locMastService.selectById(outerLoc); |
| | |
| | | if (!locMast.getLocSts().equals("F")) { |
| | | continue; |
| | | } |
| | | |
| | | //if (locMast.getLocSts().equals("F")) { |
| | | // throw new CoolException("浅库位在库不支持此任务"); |
| | | //} |
| | | boolean flag = false; |
| | | for (LocDetl locDetl : locDetlService.selectByLocNo(locMast.getLocNo())) { |
| | | if (!locDetl.getMatnr().equals(matnr)) { |
| | | flag = true; |
| | | break; |
| | | }else if (ioWorkType.equals(IoWorkType.CHECK_OUT)){ |
| | | } else if (!Cools.isEmpty(ioWorkType) && ioWorkType.equals(IoWorkType.CHECK_OUT)) { |
| | | flag = true; |
| | | break; |
| | | } |
| | |
| | | if (flag) { |
| | | //当前巷道存在不同规格的物料,需要进行101全板出库 |
| | | // 获取路径 |
| | | StaDesc staDesc = staDescService.queryCrnStn(101, locMast.getCrnNo(), locMast.getCrnNo()==1? 100:200 , locMast.getRow1()); |
| | | if(staDesc == null){ |
| | | StaDesc staDesc = staDescService.queryCrnStn(101, locMast.getCrnNo(), locMast.getCrnNo() == 1 ? 100 : 200, locMast.getRow1()); |
| | | if (staDesc == null) { |
| | | throw new CoolException("出库路径不存在"); |
| | | } |
| | | |
| | |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(101); // 入出库状态101全板出库 |
| | | wrkPri += 2D; |
| | | wrkMast.setIoPri(wrkPri); // 优先级 |
| | | |
| | | wrkMast.setIoPri(Utils.getIoPri(locMast.getLocNo())); // 优先级 |
| | | wrkMast.setOutMost(0); |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 源站 |
| | | wrkMast.setStaNo(locMast.getCrnNo()==1? 100:200); // 目标站 |
| | | wrkMast.setStaNo(locMast.getCrnNo() == 1 ? 100 : 200); // 目标站 |
| | | wrkMast.setSourceLocNo(locMast.getLocNo()); // 源库位 |
| | | wrkMast.setFullPlt("Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | |
| | | Mat mat = matService.selectByMatnr(locDetl.getMatnr()); |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(locDetl.getMatnr() + "商品档案不存在"); |
| | | } |
| | | int zpallet = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", locDetl.getZpallet()).ne("loc_no", locDetl.getLocNo())); |
| | | if (zpallet > 0) { |
| | | throw new CoolException(locDetl.getZpallet() + "入库通知档中已存在"); |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | |
| | | //-----------------2023.6.2出库兼容代码----------------------- |
| | | if (ioType!=107){ |
| | | if (ioType != 107) { |
| | | List<LocDetl> locDetls = locDetlService.selectByLocNo(locMast.getLocNo()); |
| | | if (locMast.getLocType2() == 1 && locDetls.size() > 1) { |
| | | //单品区域出库物料大于1种,强制变成101全板出库 |
| | | ioType = 101; |
| | | if (staNo.getDevNo()==300){ |
| | | staNo.setDevNo(200); |
| | | //if (locMast.getLocType2() == 1 && locDetls.size() > 1) { |
| | | // //单品区域出库物料大于1种,强制变成101全板出库 |
| | | // ioType = 101; |
| | | // if (staNo.getDevNo()==300){ |
| | | // staNo.setDevNo(200); |
| | | // } |
| | | //} |
| | | if (ioType == 101) { |
| | | if (staNo.getDevNo() == 300) { |
| | | if (locMast.getCrnNo() == 1) { |
| | | staNo.setDevNo(100); |
| | | } else { |
| | | staNo.setDevNo(200); |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | staNo.setDevNo(basDevp); |
| | | } |
| | | |
| | | |
| | | } |
| | | //-----------------2023.6.2出库兼容代码end----------------------- |
| | | |
| | | // 获取路径 |
| | | StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), staNo.getDevNo(), locMast.getRow1()); |
| | | if(staDesc == null){ |
| | | if (staDesc == null) { |
| | | throw new CoolException("出库路径不存在"); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void stockOut2(BasDevp staNo, List<LocDetlDto> locDetlDtos, IoWorkType ioWorkType, Long userId) { |
| | | Integer basDevp = staNo.getDevNo(); |
| | | Date now = new Date(); |
| | | // 合并同类项 |
| | | Set<String> locNos = new HashSet<>(); |
| | | List<OutLocDto> dtos = new ArrayList<>(); |
| | | for (LocDetlDto locDetlDto : locDetlDtos) { |
| | | String locNo = locDetlDto.getLocDetl().getLocNo(); |
| | | if (locNos.contains(locNo)) { |
| | | for (OutLocDto dto : dtos) { |
| | | if (dto.getLocNo().equals(locNo)) { |
| | | boolean signDto = false; |
| | | for (LocDetlDto locDetlDto1 : dto.getLocDetlDtos()) { |
| | | if (locDetlDto1.getLocDetl().getBatch().equals(locDetlDto.getLocDetl().getBatch()) |
| | | && locDetlDto1.getLocDetl().getMatnr().equals(locDetlDto.getLocDetl().getMatnr()) |
| | | && locDetlDto1.getLocDetl().getLocNo().equals(locDetlDto.getLocDetl().getLocNo())) { |
| | | signDto = true; |
| | | } |
| | | } |
| | | if (!signDto) { |
| | | dto.getLocDetlDtos().add(locDetlDto); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | locNos.add(locNo); |
| | | dtos.add(new OutLocDto(locNo, locDetlDto)); |
| | | } |
| | | } |
| | | Integer ioType = null; |
| | | // 生成工作档 |
| | | for (OutLocDto dto : dtos) { |
| | | // 如果为深库位,且对应浅库位为X.禁用,则略过此库位 |
| | | if (Utils.isDeepLoc(slaveProperties, dto.getLocNo())) { |
| | | String shallowLoc = Utils.getShallowLoc(slaveProperties, dto.getLocNo()); |
| | | if (locMastService.selectById(shallowLoc).getLocSts().equals("X")) { |
| | | continue; |
| | | } |
| | | } |
| | | //-----------------2023.5.31上架区域版本兼容代码----------------------- |
| | | //判断当前库位组是否均为同一种物料,如不是,则认定需要执行兼容代码 |
| | | //需要将待出库库位前侧库位(不包含最外侧高频库位)执行101全板出库 |
| | | String locNo = dto.getLocNo(); |
| | | String matnr = null; |
| | | for (LocDetlDto locDetlDto : dto.getLocDetlDtos()) { |
| | | LocDetl locDetl = locDetlDto.getLocDetl(); |
| | | if (locDetl.getLocNo().equals(locNo)) { |
| | | matnr = locDetl.getMatnr(); |
| | | } |
| | | } |
| | | |
| | | List<String> outerLocs = new ArrayList<>(); |
| | | if (!dto.isSign()) { |
| | | outerLocs.add(dto.getLocNo()); |
| | | } |
| | | Double wrkPri = 15D; |
| | | for (String outerLoc : outerLocs) { |
| | | if (!dto.isSign()) { |
| | | // 生成工作档明细 |
| | | for (LocDetl locDetl : locDetlService.selectByLocNo(outerLoc)) { |
| | | |
| | | Mat mat = matService.selectByMatnr(locDetl.getMatnr()); |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(locDetl.getMatnr() + "商品档案不存在"); |
| | | } |
| | | int zpallet = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", locDetl.getZpallet()).ne("loc_no", locDetl.getLocNo())); |
| | | if (zpallet > 0) { |
| | | throw new CoolException(locDetl.getZpallet() + "入库通知档中已存在"); |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | //waitPakin.setBatch(""); |
| | | waitPakin.setZpallet(locDetl.getZpallet()); // 托盘码 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | | waitPakin.setAnfme(locDetl.getAnfme()); // 数量 |
| | | waitPakin.setStatus("Y"); // 状态 |
| | | waitPakin.setAppeUser(userId); |
| | | waitPakin.setAppeTime(now); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | waitPakin.setMemo(locDetl.getMemo()); |
| | | waitPakin.setFrozen(0); // 是否冻结 |
| | | waitPakin.setManu(locDetl.getManu()); |
| | | waitPakin.setMatType(mat.getMatType());//物料类型 |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //-----------------2023.5.31上架区域版本兼容代码end----------------------- |
| | | |
| | | // 判断入出库类型:101.全板出库 or 103.拣料出库 |
| | | if (ioWorkType == null) { |
| | | ioType = dto.isAll() ? 101 : 103; |
| | | } else if (ioWorkType.equals(IoWorkType.CHECK_OUT)) { |
| | | ioType = 107; |
| | | // if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) { |
| | | // throw new CoolException("只能存在一笔盘点任务"); |
| | | // } |
| | | } |
| | | if (ioType != 101) { |
| | | if (basDevp == 114 || basDevp == 214) { |
| | | throw new CoolException("2楼只允许全板出库,请选择全部物料"); |
| | | } |
| | | } |
| | | |
| | | assert ioType != null; |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | |
| | | //-----------------2023.6.2出库兼容代码----------------------- |
| | | if (ioType != 107) { |
| | | List<LocDetl> locDetls = locDetlService.selectByLocNo(locMast.getLocNo()); |
| | | //if (locMast.getLocType2() == 1 && locDetls.size() > 1) { |
| | | // //单品区域出库物料大于1种,强制变成101全板出库 |
| | | // ioType = 101; |
| | | // if (staNo.getDevNo()==300){ |
| | | // staNo.setDevNo(200); |
| | | // } |
| | | //} |
| | | if (ioType == 101) { |
| | | if (basDevp == 300) { |
| | | if (locMast.getCrnNo() == 1) { |
| | | staNo.setDevNo(100); |
| | | } else { |
| | | staNo.setDevNo(200); |
| | | } |
| | | } else if (basDevp == 114) { |
| | | if (!dto.isSign()) { |
| | | staNo.setDevNo(100); |
| | | } else { |
| | | staNo.setDevNo(basDevp); |
| | | } |
| | | } else if (basDevp == 214) { |
| | | if (!dto.isSign()) { |
| | | staNo.setDevNo(200); |
| | | } else { |
| | | staNo.setDevNo(basDevp); |
| | | } |
| | | } else { |
| | | if (locMast.getCrnNo() == 1) { |
| | | staNo.setDevNo(100); |
| | | } else { |
| | | staNo.setDevNo(200); |
| | | } |
| | | } |
| | | } else { |
| | | staNo.setDevNo(basDevp); |
| | | } |
| | | |
| | | |
| | | } |
| | | //-----------------2023.6.2出库兼容代码end----------------------- |
| | | |
| | | // 获取路径 |
| | | StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), staNo.getDevNo(), locMast.getRow1()); |
| | | if (staDesc == null) { |
| | | throw new CoolException("出库路径不存在"); |
| | | } |
| | | |
| | | // 生成工作号 |
| | | 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); // 入出库状态 |
| | | Double ioPri = wrkMastService.getIoPri(ioType, dto.getLocNo()); |
| | | wrkMast.setIoPri(15D); // 优先级:13 |
| | | wrkMast.setOutMost(locMastService.isOutMost(dto.getLocNo(), false) ? 1 : 0); |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 源站 |
| | | wrkMast.setStaNo(staDesc.getStnNo()); // 目标站 |
| | | wrkMast.setSourceLocNo(dto.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("保存工作档失败,出库库位号:" + dto.getLocNo()); |
| | | } else { |
| | | log.info("出库插入工作主档成功===>>" + JSON.toJSONString(wrkMast)); |
| | | } |
| | | |
| | | // 生成工作档明细 |
| | | |
| | | for (LocDetlDto detlDto : dto.getLocDetlDtos()) { |
| | | log.info("开始插入工作明细===>>工作号:" + workNo + "明细:" + JSON.toJSONString(detlDto)); |
| | | if (detlDto.getCount() == null || detlDto.getCount() <= 0.0D) { |
| | | continue; |
| | | } |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(detlDto.getLocDetl()); |
| | | wrkDetl.setOrderNo(""); // 手动出库不需要带出库存中的单据编号 |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(now); |
| | | Double anfme = ioType == 101 ? detlDto.getLocDetl().getAnfme() : detlDto.getCount(); |
| | | wrkDetl.setAnfme(anfme); // 数量 |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(now); |
| | | wrkDetl.setModiUser(userId); |
| | | wrkDetl.setSpecs(detlDto.getLocDetl().getSpecs()); |
| | | wrkDetl.setMatType(detlDto.getLocDetl().getMatType()); |
| | | wrkDetl.setZpallet(locMast.getBarcode()); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("stockOut2:保存工作档明细失败===>>" + JSON.toJSONString(wrkDetl)); |
| | | } else { |
| | | log.info("出库插入工作明细成功===>>" + JSON.toJSONString(wrkDetl)); |
| | | } |
| | | } |
| | | // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 |
| | | locMast = locMastService.selectById(dto.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("预约库位状态失败,库位号:" + dto.getLocNo()); |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo() + "库位不是在库状态"); |
| | | } |
| | | // locMastService.breakUp(dto.getLocNo(), excludeLocNos); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void stockOut(BasDevp staNo, TaskDto taskDto, Long userId) { |
| | | Date now = new Date(); |
| | | if (Cools.isEmpty(taskDto.getLocDtos()) || taskDto.getLocDtos().size() == 0) { |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.selectById(taskDto.getLocNo()); |
| | | // 获取路径 |
| | | int ioType = locMast.getLocSts().equals("D") ? 110 : 101; |
| | | 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); // 入出库状态 |
| | | Double ioPri = wrkMastService.getIoPri(ioType, taskDto.getLocNo()); |
| | | wrkMast.setIoPri(ioPri); // 优先级:13 |
| | | wrkMast.setOutMost(locMastService.isOutMost(taskDto.getLocNo(), false) ? 1 : 0); |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 源站 |
| | | wrkMast.setStaNo(staDesc.getStnNo()); // 目标站 |
| | | wrkMast.setSourceLocNo(taskDto.getLocNo()); // 源库位 |
| | | wrkMast.setFullPlt(ioType == 110 ? "N" : "Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk(ioType == 110 ? "Y" : "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()); |
| | | } |
| | | // 修改库位状态: F、D.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 |
| | | locMast = locMastService.selectById(taskDto.getLocNo()); |
| | | if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D")) { |
| | | locMast.setLocSts("R"); |
| | | locMast.setModiUser(userId); |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("预约库位状态失败,库位号:" + taskDto.getLocNo()); |
| | | } |
| | | } else { |
| | | throw new CoolException(taskDto.getLocNo() + "库位不是在库状态"); |
| | | } |
| | | return; |
| | | } |
| | | List<LocDto> locDtos = taskDto.getLocDtos(); |
| | | for (LocDto locDto : locDtos) { |
| | | if (!taskDto.getLocNo().equals(locDto.getLocNo()) && !taskDto.getStaNo().equals(locDto.getStaNo())) { |
| | |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | | // 修改订单明细 |
| | | if (!BaseController.isJSON(locDto.getOrderNo())) { |
| | | String[] orderNos = GetOrderNo(locDto.getOrderNo()); |
| | | if (!Cools.isEmpty(orderNos)){ |
| | | Double anfme = locDto.getAnfme(); |
| | | for (String orderNo : orderNos) { |
| | | OrderDetl orderDetl = orderDetlService.selectItem(orderNo, locDto.getMatnr(), locDto.getBatch()); |
| | | if (orderDetl == null) { |
| | | orderDetl = orderDetlService.selectItem(orderNo, locDto.getMatnr(), null); |
| | | if (!wrkDetl.getOrderNo().equals("伴生出库")) { |
| | | // 修改订单明细 |
| | | if (!BaseController.isJSON(locDto.getOrderNo())) { |
| | | String[] orderNos = GetOrderNo(locDto.getOrderNo()); |
| | | if (!Cools.isEmpty(orderNos) && orderNos.length != 0) { |
| | | Double anfme = locDto.getAnfme(); |
| | | for (String orderNo : orderNos) { |
| | | OrderDetl orderDetl = orderDetlService.selectItem(orderNo, locDto.getMatnr(), locDto.getBatch()); |
| | | if (orderDetl == null) { |
| | | orderDetl = orderDetlService.selectItem(orderNo, locDto.getMatnr(), null); |
| | | } |
| | | if (orderDetl.getAnfme() <= anfme) { |
| | | if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getAnfme())) { |
| | | throw new CoolException("修改订单明细数量失败"); |
| | | } |
| | | anfme = anfme - orderDetl.getAnfme(); |
| | | } else { |
| | | if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), anfme)) { |
| | | throw new CoolException("修改订单明细数量失败"); |
| | | } |
| | | } |
| | | orderService.updateSettle(orderDetl.getOrderId(), 2L, userId); |
| | | } |
| | | if (orderDetl.getAnfme() <= anfme) { |
| | | if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getAnfme())) { |
| | | throw new CoolException("修改订单明细数量失败"); |
| | | } |
| | | anfme = anfme - orderDetl.getAnfme(); |
| | | } else { |
| | | if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), anfme)) { |
| | | throw new CoolException("修改订单明细数量失败"); |
| | | } |
| | | } else { |
| | | OrderDetl orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); |
| | | if (orderDetl == null) { |
| | | orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), null); |
| | | } |
| | | if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), locDto.getAnfme())) { |
| | | throw new CoolException("修改订单明细数量失败"); |
| | | } |
| | | orderService.updateSettle(orderDetl.getOrderId(), 2L, userId); |
| | | } |
| | | }else { |
| | | OrderDetl orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); |
| | | if (orderDetl == null) { |
| | | orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), null); |
| | | } |
| | | if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), locDto.getAnfme())) { |
| | | throw new CoolException("修改订单明细数量失败"); |
| | | } |
| | | orderService.updateSettle(orderDetl.getOrderId(), 2L, userId); |
| | | } |
| | | } else { |
| | | // 订单合并出库 |
| | | List<OrderDto> orderDtoList = JSON.parseArray(locDto.getOrderNo(), OrderDto.class); |
| | | } else { |
| | | // 订单合并出库 |
| | | List<OrderDto> orderDtoList = JSON.parseArray(locDto.getOrderNo(), OrderDto.class); |
| | | |
| | | for (OrderDto orderDto : orderDtoList) { |
| | | OrderDetl orderDetl = orderDetlService.selectItem(orderDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); |
| | | if (orderDetl == null) { |
| | | orderDetl = orderDetlService.selectItem(orderDto.getOrderNo(), locDto.getMatnr(), null); |
| | | for (OrderDto orderDto : orderDtoList) { |
| | | OrderDetl orderDetl = orderDetlService.selectItem(orderDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); |
| | | if (orderDetl == null) { |
| | | orderDetl = orderDetlService.selectItem(orderDto.getOrderNo(), locDto.getMatnr(), null); |
| | | } |
| | | if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), orderDto.getAnfme())) { |
| | | throw new CoolException("修改订单明细数量失败"); |
| | | } |
| | | orderService.updateSettle(orderDetl.getOrderId(), 2L, userId); |
| | | } |
| | | if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), orderDto.getAnfme())) { |
| | | throw new CoolException("修改订单明细数量失败"); |
| | | } |
| | | orderService.updateSettle(orderDetl.getOrderId(), 2L, userId); |
| | | } |
| | | } else {//自动组托 |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setBatch(wrkDetl.getBatch()); |
| | | waitPakin.setZpallet(wrkDetl.getZpallet()); // 托盘码 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | | waitPakin.setAnfme(wrkDetl.getAnfme()); // 数量 |
| | | waitPakin.setStatus("Y"); // 状态 |
| | | waitPakin.setAppeUser(userId); |
| | | waitPakin.setAppeTime(now); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | waitPakin.setMemo(wrkDetl.getMemo()); |
| | | waitPakin.setFrozen(wrkDetl.getFrozen()); // 是否冻结 |
| | | waitPakin.setManu(wrkDetl.getManu()); |
| | | waitPakin.setMatType(mat.getMatType());//物料类型 |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | } |
| | | } |
| | |
| | | private String[] GetOrderNo(String orderNo) { |
| | | String[] s3 = orderNo.split("\""); |
| | | String[] s = new String[(s3.length - 1) / 6]; |
| | | if (!Cools.isEmpty(s3)){ |
| | | if (!Cools.isEmpty(s3)) { |
| | | int i = 0; |
| | | int j = 0; |
| | | for (String ss : s3) { |
| | |
| | | } |
| | | j++; |
| | | } |
| | | }else { |
| | | s=null; |
| | | } else { |
| | | s = null; |
| | | } |
| | | return s; |
| | | } |
| | |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | // 检索库位 |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null, locTypeDto); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null, locTypeDto, 0); |
| | | int workNo = dto.getWorkNo(); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException(locNo + "库位不存在"); |
| | | } |
| | | if (!locMast.getLocSts().equals("D")){ |
| | | throw new CoolException("所选库位存在状态不为D的库位,库位号:"+locMast.getLocNo()+" 、当前状态:"+locMast.getLocSts()+"-"+locMast.getLocSts$()); |
| | | if (!locMast.getLocSts().equals("D")) { |
| | | throw new CoolException("所选库位存在状态不为D的库位,库位号:" + locMast.getLocNo() + " 、当前状态:" + locMast.getLocSts() + "-" + locMast.getLocSts$()); |
| | | } |
| | | // 获取源站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | |
| | | @Override |
| | | @Transactional |
| | | public void locCheckOut(StockOutParam param, Long userId) { |
| | | // if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) { |
| | | // throw new CoolException("只能存在一笔盘点任务"); |
| | | // } |
| | | // if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) { |
| | | // throw new CoolException("只能存在一笔盘点任务"); |
| | | // } |
| | | // 目标站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); |
| | | // 获取库位明细 |
| | |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo())); |
| | | if (locMast.getLocSts().equals("F")){ |
| | | if (locMast.getLocSts().equals("F")) { |
| | | // 启动出库开始 107.盘点出库 |
| | | stockOut(staNo, locDetlDtos, IoWorkType.CHECK_OUT, userId); |
| | | }else { |
| | | throw new CoolException("所选库位存在状态不为F的库位,库位号:"+locMast.getLocNo()+" 、当前状态:"+locMast.getLocSts()+"-"+locMast.getLocSts$()); |
| | | } else { |
| | | throw new CoolException("所选库位存在状态不为F的库位,库位号:" + locMast.getLocNo() + " 、当前状态:" + locMast.getLocSts() + "-" + locMast.getLocSts$()); |
| | | } |
| | | |
| | | } else { |
| | |
| | | if (Cools.isEmpty(loc)) { |
| | | throw new CoolException("未找到库位"); |
| | | } |
| | | if (!loc.getLocSts().equals("O")||(!sourceLoc.getLocSts().equals("F") && !sourceLoc.getLocSts().equals("D"))){ |
| | | if (!loc.getLocSts().equals("O") || (!sourceLoc.getLocSts().equals("F") && !sourceLoc.getLocSts().equals("D"))) { |
| | | throw new CoolException("库位状态已改变"); |
| | | } |
| | | if (!sourceLoc.getCrnNo().equals(loc.getCrnNo())) { |
| | |
| | | AdjDetl adjDetl = new AdjDetl(); |
| | | adjDetl.setLocNo(locDetl.getLocNo()); |
| | | adjDetl.setMatnr(locDetl.getMatnr()); |
| | | adjDetl.setSpecs(locDetl.getSpecs()); |
| | | adjDetl.setBatch(locDetl.getBatch()); |
| | | adjDetl.setOriQty(locDetl.getAnfme()); |
| | | adjDetl.setAdjQty(adjust.getCount()); |
| | |
| | | } else if (wrkMast.getIoType() == 110) { |
| | | locSts = "D"; |
| | | // 库位转移 ===>> D.空桶/空栈板 |
| | | } else if (wrkMast.getIoType() == 11) { |
| | | if (wrkMast.getWrkSts() > 11){ |
| | | } else if (wrkMast.getIoType() == 11 || wrkMast.getIoType() == 111) { |
| | | if (wrkMast.getWrkSts() > 11) { |
| | | throw new CoolException("移库任务已在执行中,不能取消"); |
| | | } |
| | | locSts = wrkMast.getFullPlt().equalsIgnoreCase("N") ? "D" : "F"; |
| | |
| | | // 订单关联 |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | if (!Cools.isEmpty(wrkDetl.getOrderNo())){ |
| | | if (!Cools.isEmpty(wrkDetl.getOrderNo())) { |
| | | String[] orderNos = GetOrderNo(wrkDetl.getOrderNo()); |
| | | if (!Cools.isEmpty(orderNos)){ |
| | | if (!Cools.isEmpty(orderNos) && orderNos.length != 0) { |
| | | String[] anfmes = GetAnfme(wrkDetl.getOrderNo()); |
| | | int i = 0; |
| | | for (String orderNo : orderNos) { |
| | |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | } else { |
| | | if (!BaseController.isJSON(wrkDetl.getOrderNo())) { |
| | | if (!orderDetlService.decrease(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme())) { |
| | | throw new CoolException("订单数据回滚失败"); |
| | |
| | | if (!wrkMastRes || !locMastRes) { |
| | | throw new CoolException("保存数据失败"); |
| | | } |
| | | waitPakinService.delete(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode())); |
| | | } |
| | | |
| | | @Override |