| | |
| | | // 生成入库通知档 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | param.getCombMats().forEach(elem -> { |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme()); |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(),elem.getWeight()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); |
| | | assert one != null; |
| | |
| | | waitPakin.setModiTime(now); |
| | | waitPakin.setOwner(detlDto.getOwner()); |
| | | waitPakin.setUuid(uuid); |
| | | waitPakin.setWeight(detlDto.getWeight()); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | |
| | | |
| | | } |
| | | Double anfme = orderDetl.getAnfme(); |
| | | if ( anfme > (anfme - sum)) { |
| | | Double workQty = orderDetl.getWorkQty(); |
| | | if ( anfme - (workQty+sum) < 0) { |
| | | throw new CoolException("组托数量已超出订单需求量,请检查是否有其他的组托已完成"); |
| | | } |
| | | } |
| | |
| | | throw new CoolException("修改单据作业数量失败"); |
| | | } |
| | | |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(),orderDetl.getOwner()); |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(),orderDetl.getOwner(),elem.getWeight()); |
| | | detlDto.setPayment(orderDetl.getPayment()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); |
| | | assert one != null; |
| | |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | waitPakin.setOwner(detlDto.getOwner()); |
| | | waitPakin.setPayment(detlDto.getPayment()); |
| | | waitPakin.setUuid(uuid); |
| | | waitPakin.setWeight(detlDto.getWeight()); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | |
| | | |
| | | // 获取商品列表 |
| | | for(CombParam.CombMat combMat : param.getCombMats()){ |
| | | String uuid = String.valueOf(System.currentTimeMillis()); |
| | | |
| | | Mat mat = matService.selectByMatnr(combMat.getMatnr()); |
| | | if (Cools.isEmpty(mat)){ |
| | | throw new CoolException(combMat.getMatnr() + ":商品档案不存在!"); |
| | |
| | | manLocDetl.setBatch(Cools.isEmpty(combMat.getBatch()) ? "" : combMat.getBatch()); |
| | | manLocDetl.setAnfme(combMat.getAnfme()); |
| | | manLocDetl.setModiTime(now); |
| | | manLocDetl.setUuid(uuid); |
| | | manLocDetl.setOwner(1); |
| | | if (!manLocDetlService.insert(manLocDetl)) { |
| | | throw new CoolException("商品上架失败!"); |
| | |
| | | //查询平库中是否有一样的物料号,有的话直接增加数量 |
| | | ManLocDetl checkManLocDetl = manLocDetlService.selectInventory(jsonLocNo,orderDetl.getMatnr(),jsonOrderDetl.getBatch()); |
| | | if (checkManLocDetl == null) { |
| | | String uuid = String.valueOf(System.currentTimeMillis()); |
| | | |
| | | ManLocDetl manLocDetl = new ManLocDetl(); |
| | | Synchro.Copy(orderDetl, manLocDetl); |
| | | manLocDetl.setLocNo(node.getName()); |
| | |
| | | manLocDetl.setModiTime(date); |
| | | manLocDetl.setCreateTime(date); |
| | | manLocDetl.setBatch(jsonOrderDetl.getBatch()); |
| | | manLocDetl.setUuid(uuid); |
| | | manLocDetl.setOwner(orderDetl.getOwner()); |
| | | manLocDetl.setWeight(jsonOrderDetl.getWeight()); |
| | | manLocDetl.setOrderNo(jsonOrderDetl.getOrderNo()); |
| | | if(!manLocDetlService.insert(manLocDetl)){ |
| | | return R.error("修改平库物料失败!"); |
| | | return R.error("插入平库物料失败!"); |
| | | } |
| | | } else { |
| | | if(manLocDetlService.increase(checkManLocDetl.getAnfme() + jsonOrderDetl.getAnfme(), jsonOrderDetl.getOrderNo(), jsonOrderDetl.getMaktx(), jsonOrderDetl.getBatch())<=0){ |
| | | if (checkManLocDetl.getWeight() == null){ |
| | | checkManLocDetl.setWeight(0.0); |
| | | } |
| | | if(manLocDetlService.increase(checkManLocDetl.getAnfme() + jsonOrderDetl.getAnfme(), |
| | | node.getName(), |
| | | jsonOrderDetl.getMatnr(), |
| | | jsonOrderDetl.getBatch(),checkManLocDetl.getWeight()+jsonOrderDetl.getWeight() |
| | | )<=0 |
| | | ){ |
| | | return R.error("修改平库物料失败!"); |
| | | } |
| | | |
| | | } |
| | | orderDetl.setQty(orderDetl.getQty() + jsonOrderDetl.getAnfme()); |
| | | orderDetl.setWorkQty(orderDetl.getWorkQty() + jsonOrderDetl.getAnfme()); |
| | |
| | | return R.error("出库数量大于可出数量"); |
| | | } |
| | | Double finalQty = checkManLocDetl.getAnfme() - jsonOrderDetl.getAnfme(); |
| | | Double weight = checkManLocDetl.getWeight() - jsonOrderDetl.getWeight(); |
| | | checkManLocDetl.setAnfme(finalQty); |
| | | checkManLocDetl.setWeight(weight); |
| | | if (weight < 0){ |
| | | return R.error("出库重量有误!"); |
| | | } |
| | | if (finalQty < 0){ |
| | | // if(manLocDetlService.deleteDatailed(jsonLocNo, jsonOrderDetl.getMatnr(), jsonOrderDetl.getBatch())<=0) { |
| | | return R.error("数量有误!"); |
| | | // } |
| | | }else { |
| | | if(manLocDetlService.increase(finalQty, jsonLocNo, jsonOrderDetl.getMatnr(), jsonOrderDetl.getBatch())<=0){ |
| | | if(manLocDetlService.increase(finalQty, jsonLocNo, jsonOrderDetl.getMatnr(), jsonOrderDetl.getBatch(),weight)<=0){ |
| | | return R.error("修改平库物料失败!"); |
| | | } |
| | | } |