| | |
| | | locDetl.setWeight(comb.getWeight()); |
| | | } |
| | | |
| | | public static void setLocDetl(LocDetl locDetl, Mat mat) { |
| | | locDetl.setMatnr(mat.getMatnr()); |
| | | locDetl.setMaktx(mat.getMaktx()); |
| | | locDetl.setName(mat.getName()); |
| | | locDetl.setSpecs(mat.getSpecs()); |
| | | locDetl.setModel(mat.getModel()); |
| | | locDetl.setBatch(mat.getBatch()); |
| | | locDetl.setUnit(mat.getUnit()); |
| | | locDetl.setBarcode(mat.getBarcode()); |
| | | locDetl.setDocId(mat.getDocId()); |
| | | locDetl.setDocNum(mat.getDocNum()); |
| | | locDetl.setCustName(mat.getCustName()); |
| | | locDetl.setItemNum(mat.getItemNum()); |
| | | locDetl.setCount(mat.getCount()); |
| | | locDetl.setWeight(mat.getWeight()); |
| | | } |
| | | |
| | | |
| | | public static void setPakout(Pakout pakout, Mat mat) { |
| | | pakout.setMatnr(mat.getMatnr()); |
| | | pakout.setMaktx(mat.getMaktx()); |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public R stockCheckAuditing(Long checkId, Long userId) { |
| | | Check check = checkService.selectById(checkId); |
| | | if (null == check) { |
| | | return R.error("盘点记录已失效"); |
| | | } |
| | | Date now = new Date(); |
| | | // 1.修改库存数量 |
| | | if (check.getOriQty() != 0 && check.getCekQty() != 0) { |
| | | // 更新库存明细 |
| | | if (check.getSettle() == 1) { |
| | | if (!locDetlService.incrementStock(check.getNodeId(), check.getMatnr(), Math.abs(check.getDiffQty()))) { |
| | | throw new CoolException("修改库存明细数量失败"); |
| | | } |
| | | } else if (check.getSettle() == 2) { |
| | | if (!locDetlService.reduceStock(check.getNodeId(), check.getMatnr(), Math.abs(check.getDiffQty()))) { |
| | | throw new CoolException("修改库存明细数量失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 2.删除库存 |
| | | if (check.getOriQty() != 0 && check.getCekQty() == 0) { |
| | | if (!locDetlService.delete(new EntityWrapper<LocDetl>().eq("node_id", check.getNodeId()).eq("matnr", check.getMatnr()))) { |
| | | throw new CoolException("删除库存明细数量失败"); |
| | | } |
| | | } |
| | | |
| | | // 3.新增库存 |
| | | if (check.getOriQty() == 0 && check.getCekQty() != 0) { |
| | | Mat mat = matService.selectByMatnr(check.getMatnr()); |
| | | if (mat == null) { |
| | | throw new CoolException("商品数据异常,请联系管理员"); |
| | | } |
| | | // 更新货位库存明细 |
| | | LocDetl locDetl = new LocDetl(); |
| | | locDetl.setLocNo(check.getLocNo()); |
| | | locDetl.setNodeId(check.getNodeId()); |
| | | // locDetl.setZpallet(param.getZpallet()); |
| | | locDetl.setAnfme(check.getCekQty()); |
| | | VersionUtils.setLocDetl(locDetl, mat); |
| | | locDetl.setStatus(1); |
| | | locDetl.setCreateBy(userId); |
| | | locDetl.setCreateTime(now); |
| | | locDetl.setUpdateBy(userId); |
| | | locDetl.setUpdateTime(now); |
| | | if (!locDetlService.insert(locDetl)) { |
| | | throw new CoolException("新增库存明细失败"); |
| | | } |
| | | } |
| | | |
| | | // 修改盘点记录 |
| | | check.setStatus(2); |
| | | check.setUpdateBy(userId); |
| | | check.setUpdateTime(now); |
| | | if (!checkService.updateById(check)) { |
| | | throw new CoolException("修改盘点记录状态失败"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | ,{field: 'docNum', align: 'center',title: '单据编号', hide: true} |
| | | ,{field: 'oriQty', align: 'center',title: '账面数量 (原)', style: 'font-weight: bolder'} |
| | | ,{field: 'cekQty', align: 'center',title: '实盘数量 (现)', style: 'font-weight: bolder'} |
| | | ,{field: 'diffQty', align: 'center',title: '差值', style: 'font-weight: bolder; color: blue'} |
| | | ,{field: 'settle$', align: 'center',title: '盈亏', templet: '#checkTpl', width: 100} |
| | | ,{field: 'diffQty', align: 'center',title: '差值', style: 'font-weight: bolder; color: blue'} |
| | | ,{field: 'createTime$', align: 'center',title: '盘点时间'} |
| | | ,{field: 'createBy$', align: 'center',title: '盘点人员'} |
| | | ,{field: 'status$', align: 'center',title: '状态', templet: '#statusTpl', width: 110} |