| | |
| | | import com.zy.common.properties.SlaveProperties; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.web.WcsController; |
| | | 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 OrderDetlPakoutMapper orderDetlPakoutMapper; |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | public void startupFullTakeStore(StockOutParam param, Long userId) { |
| | | // 目标站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); |
| | | // 判断任务目标站点是否是出库模式 |
| | | if (param.getOutSite() == 1016 || param.getOutSite() == 1043) { |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "inOrOutBoundMode").eq("status", 1)); |
| | | if (config != null && !Cools.isEmpty(config.getValue())) { |
| | | int value = Integer.parseInt(config.getValue()); |
| | | if (value != 2) { |
| | | throw new CoolException("目标站点" + param.getOutSite() + "不是出库模式,当前模式为:" + value); |
| | | } |
| | | } |
| | | } |
| | | // 获取库位明细 |
| | | List<LocDetlDto> locDetlDtos = new ArrayList<>(); |
| | | for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) { |
| | |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setSourceLocNo(locMast.getLocNo()); |
| | | wrkMast.setLocNo(locMast.getLocNo()); |
| | | wrkMast.setBarcode(locMast.getBarcode()); // 托盘码 |
| | | wrkMast.setBarcode(list.get(0).getZpallet()); // 托盘码 |
| | | wrkMast.setFullPlt("Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | |
| | | boolean deleteFlag = true; |
| | | boolean addFlag = true; |
| | | |
| | | // 库位状态是空,则添加 |
| | | // 库位状态在库,有提交数据,则修改 |
| | | // 库位状态在库,没有提交数据,则删除 |
| | | |
| | | // 修改数量 |
| | | Iterator<LocDetl> iterator = locDetls.iterator(); |
| | | while (iterator.hasNext()) { |
| | |
| | | LocDetlAdjustParam.LocDetlAdjust adjust = iterator1.next(); |
| | | if (adjust.getCount() == 0) { continue; } |
| | | if (locDetl.getMatnr().equals(adjust.getMatnr()) && Cools.eq(locDetl.getBatch(), adjust.getBatch())) { |
| | | if (!locDetl.getAnfme().equals(adjust.getCount())) { |
| | | // todo 盘点记录 |
| | | // 修改库存 |
| | | if (!locDetlService.updateAnfme(adjust.getCount(), locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(),locDetl.getBrand(), |
| | | locDetl.getStandby1(),locDetl.getStandby2(),locDetl.getStandby3(),locDetl.getBoxType1(),locDetl.getBoxType2(),locDetl.getBoxType3())) { |
| | | throw new CoolException(locDetl.getLocNo() + "库位," + locDetl.getMatnr() + "商品," + locDetl.getBatch() + "批号修改数量失败"); |
| | | } |
| | | // if (!locDetlService.updateAnfme(adjust.getCount(), locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(),locDetl.getBrand(), |
| | | // locDetl.getStandby1(),locDetl.getStandby2(),locDetl.getStandby3(),locDetl.getBoxType1(),locDetl.getBoxType2(),locDetl.getBoxType3())) { |
| | | // throw new CoolException(locDetl.getLocNo() + "库位," + locDetl.getMatnr() + "商品," + locDetl.getBatch() + "批号修改数量失败"); |
| | | // } |
| | | locDetl.setAnfme(adjust.getCount()); |
| | | locDetl.setZpallet(adjust.getZpallet()); |
| | | locDetl.setModel(adjust.getModel()); |
| | | locDetl.setManuDate(adjust.getManuDate()); |
| | | locDetl.setWeight(adjust.getWeight()); |
| | | locDetl.setManLength(adjust.getManLength()); |
| | | locDetl.setVolume(adjust.getVolume()); |
| | | locDetlService.update(locDetl,new EntityWrapper<LocDetl>().eq("loc_no",locDetl.getLocNo()).eq("matnr",locDetl.getMatnr()).eq("batch",locDetl.getBatch())); |
| | | // 保存调整记录 |
| | | AdjDetl adjDetl = new AdjDetl(); |
| | | adjDetl.setLocNo(locDetl.getLocNo()); |
| | |
| | | wrkDetl.setWrkNo(wrkMast.getWrkNo()); |
| | | wrkDetl.setIoTime(wrkMast.getIoTime()); |
| | | wrkDetl.setAnfme(adjust.getCount()); |
| | | wrkDetl.setAnfme(adjust.getCount()); |
| | | wrkDetl.setZpallet(adjust.getZpallet()); |
| | | wrkDetl.setModel(adjust.getModel()); |
| | | wrkDetl.setManuDate(adjust.getManuDate()); |
| | | wrkDetl.setWeight(adjust.getWeight()); |
| | | wrkDetl.setManLength(adjust.getManLength()); |
| | | wrkDetl.setVolume(adjust.getVolume()); |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setModiTime(now); |
| | | wrkMast.setAppeUser(userId); |
| | | wrkMast.setModiUser(userId); |
| | | if (!wrkDetlLogService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作明细失败"); |
| | | } |
| | | } |
| | | iterator.remove(); |
| | | iterator1.remove(); |
| | |
| | | locDetl.sync(mat); |
| | | locDetl.setBatch(adjust.getBatch()); |
| | | locDetl.setLocNo(locMast.getLocNo()); |
| | | locDetl.setZpallet(locMast.getBarcode()); |
| | | locDetl.setZpallet(adjust.getZpallet()); |
| | | locDetl.setAnfme(adjust.getCount()); // 数量 |
| | | locDetl.setModel(adjust.getModel()); |
| | | locDetl.setManuDate(adjust.getManuDate()); |
| | | locDetl.setWeight(adjust.getWeight()); |
| | | locDetl.setManLength(adjust.getManLength()); |
| | | locDetl.setVolume(adjust.getVolume()); |
| | | locDetl.setModiUser(userId); // 操作人员信息 |
| | | locDetl.setModiTime(now); |
| | | locDetl.setAppeUser(userId); |
| | |
| | | int count = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo())); |
| | | if (locMast.getLocSts().equals("F")) { |
| | | if (count == 0) { |
| | | locMast.setLocSts("D"); |
| | | locMast.setLocSts("O"); |
| | | } else { |
| | | locMast.setBarcode(wrkMast.getBarcode()); |
| | | } |
| | | } |
| | | if (locMast.getLocSts().equals("D") || locMast.getLocSts().equals("O")) { |
| | | if (count > 0) { |
| | | locMast.setLocSts("F"); |
| | | locMast.setBarcode(wrkMast.getBarcode()); |
| | | } |
| | | } |
| | | locMast.setModiUser(userId); |
| | |
| | | } |
| | | String locNo = ""; // 待修改目标库位 |
| | | String locSts = ""; // 待修改目标库位状态 |
| | | Long wrkSts = wrkMast.getWrkSts(); |
| | | Integer ioType = wrkMast.getIoType(); |
| | | |
| | | // 任务完成,无法取消 |
| | | if(wrkSts == 4 || wrkSts == 5 || wrkSts == 14 || wrkSts == 15 || wrkSts == 54) { |
| | | throw new CoolException(workNo+"任务已完成,无法取消"); |
| | | } |
| | | |
| | | if(ioType == 101 || ioType == 110) { |
| | | if(wrkSts == 11 || wrkSts == 12) { |
| | | |
| | | } else { |
| | | throw new CoolException(workNo+"库存信息已更新,无法取消"); |
| | | } |
| | | } |
| | | // 入库取消(修改目标库位) |
| | | // if(ioType == 1 || ioType == 10) { |
| | | // if(wrkSts == 1 || wrkSts == 2|| wrkSts == 3 || wrkSts == 9 || wrkSts == 10) { |
| | | // locNo = wrkMast.getLocNo(); |
| | | // locSts = "O"; |
| | | // } else { |
| | | // throw new CoolException(workNo+"取消失败,当前状态:" + wrkSts); |
| | | // } |
| | | // } else if(ioType == 11){ |
| | | // if(wrkSts <= 10) { |
| | | // locNo = wrkMast.getLocNo(); |
| | | // locSts = "O"; |
| | | // // 库位转移:源库位 |
| | | // LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | // if (Cools.isEmpty(locMast)) { |
| | | // throw new CoolException("取消库位转移失败,源库位不存在:"+ wrkMast.getSourceLocNo()); |
| | | // } |
| | | // locMast.setLocSts(wrkMast.getFullPlt().equalsIgnoreCase("N")?wrkMast.getEmptyMk():"F"); |
| | | // locMast.setModiTime(now); |
| | | // locMast.setModiUser(userId); |
| | | // locMastService.updateById(locMast); |
| | | // } else { |
| | | // throw new CoolException(workNo+"取消失败,当前状态:" + wrkSts); |
| | | // } |
| | | // } else if(ioType == 3) { |
| | | // |
| | | // } else if(ioType == 101) { |
| | | // |
| | | // } else if(ioType == 110) { |
| | | // |
| | | // } |
| | | if (wrkMast.getWrkSts() <= 10 && wrkMast.getIoType()!=120) { |
| | | locNo = wrkMast.getLocNo(); |
| | | locSts = "O"; |
| | |
| | | locSts = "F"; |
| | | // 空板出库 ===>> D.空桶/空栈板 |
| | | } else if (wrkMast.getIoType() == 11) { |
| | | locSts = wrkMast.getFullPlt().equalsIgnoreCase("N")?"D":"F"; |
| | | locSts = wrkMast.getFullPlt().equalsIgnoreCase("N")?wrkMast.getEmptyMk():"F"; |
| | | // 库位转移:目标库位 |
| | | LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); |
| | | if (Cools.isEmpty(locMast)) { |