| | |
| | | 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.service.*; |
| | | import com.zy.common.model.LocDetlDto; |
| | |
| | | private StaDescService staDescService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private MatCodeService matCodeService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | } |
| | | // 生成工作档明细 |
| | | for (LocDetlDto detlDto : dto.getLocDetlDtos()) { |
| | | if (detlDto.getCount() <= 0.0D) {continue;} |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(new Date()); |
| | |
| | | wrkDetl.setIoTime(new Date()); |
| | | wrkDetl.setMatnr(locDetl.getMatnr()); |
| | | wrkDetl.setAnfme(locDetl.getAnfme()); |
| | | wrkDetl.setZmatid(locDetl.getZmatid()); |
| | | wrkDetl.setTbpos(locDetl.getTbpos()); |
| | | wrkDetl.setTbnum(locDetl.getTbnum()); |
| | | wrkDetl.setLgnum(locDetl.getLgnum()); |
| | | wrkDetl.setAltme(locDetl.getAltme()); |
| | | wrkDetl.setBname(locDetl.getBname()); |
| | | wrkDetl.setMaktx(locDetl.getMaktx()); |
| | | wrkDetl.setAppeTime(new Date()); |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(new Date()); |
| | |
| | | throw new CoolException("更新目标库位状态失败"); |
| | | } |
| | | } else { |
| | | throw new CoolException("预约目标库位入库失败,状态:"+loc.getLocType$()); |
| | | throw new CoolException("移转失败,目标库位状态:"+loc.getLocType$()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void adjustLocDetl(LocDetlAdjustParam param, Long userId) { |
| | | LocMast locMast = locMastService.selectById(param.getLocNo()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("库位不存在"); |
| | | } |
| | | for (LocDetlAdjustParam.LocDetlAdjust adjust : param.getList()) { |
| | | LocDetl sqlParam = new LocDetl(); |
| | | sqlParam.setLocNo(locMast.getLocNo()); |
| | | sqlParam.setMatnr(adjust.getMatNo()); |
| | | LocDetl one = locDetlService.selectOne(new EntityWrapper<>(sqlParam)); |
| | | // 保存新库存明细 |
| | | if (Cools.isEmpty(one)) { |
| | | MatCode matCode = matCodeService.selectById(adjust.getMatNo()); |
| | | LocDetl locDetl = new LocDetl(); |
| | | locDetl.setLocNo(locMast.getLocNo()); |
| | | locDetl.setMatnr(matCode.getMatNo()); |
| | | locDetl.setMaktx(matCode.getMatName()); // 物料描述 |
| | | locDetl.setAnfme(adjust.getCount()); // 数量 |
| | | locDetl.setAltme(matCode.getStr1()); // 单位 |
| | | // todo:luxiaoao |
| | | locDetl.setModiUser(userId); // 操作人员信息 |
| | | locDetl.setModiTime(new Date()); |
| | | locDetl.setAppeUser(userId); |
| | | locDetl.setAppeTime(new Date()); |
| | | if (!locDetlService.insert(locDetl)) { |
| | | throw new CoolException("保存库存明细失败"); |
| | | } |
| | | // 修改原库存明细 |
| | | } else { |
| | | // 如果数量修改,则更新库存明细 |
| | | if (!adjust.getCount().equals(one.getAnfme())) { |
| | | // 当数量被修改为 0 时,直接清除库存明细 |
| | | if (adjust.getCount() == 0) { |
| | | if (!locDetlService.delete(new EntityWrapper<>(one))) { |
| | | throw new CoolException("清除库存明细失败"); |
| | | } |
| | | } else { |
| | | one.setAnfme(adjust.getCount()); |
| | | one.setModiTime(new Date()); |
| | | one.setModiUser(userId); |
| | | if (!locDetlService.updateById(one)) { |
| | | throw new CoolException("修改库存明细失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void cancelWrkMast(String workNo, Long userId) { |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | if (Cools.isEmpty(wrkMast)){ |