| | |
| | | private DocTypeService docTypeService; |
| | | @Autowired |
| | | private MatV2Service matV2Service; |
| | | @Autowired |
| | | private BomMatService bomMatService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | waitPakin.setBrand("组件"); |
| | | } else { |
| | | waitPakin.sync(mat); |
| | | } |
| | | // 校验是否为bom入库 bom入库的数量不能超过库存原有数量 |
| | | if (!Cools.isEmpty(param.getBomCode())) { |
| | | BomMat bomMat = bomMatService.selectOne(new EntityWrapper<BomMat>().eq("unit_num", param.getBomCode()).eq("element_num", detlDto.getMatnr())); |
| | | Double bomQyt = locDetlService.getBomQyt(param.getBomCode(), detlDto.getMatnr()); |
| | | if (!Cools.isEmpty(bomQyt)) { |
| | | bomMat.setZpalletAnfme(bomMat.getZpalletAnfme() - bomQyt); |
| | | } |
| | | Double bomQty = wrkDetlService.getBomQty(param.getBomCode(), detlDto.getMatnr()); |
| | | if (!Cools.isEmpty(bomQty)) { |
| | | bomMat.setZpalletAnfme(bomMat.getZpalletAnfme() - bomQty); |
| | | } |
| | | if (bomMat.getZpalletAnfme() == 0.0D) { |
| | | throw new CoolException(detlDto.getMatnr() + "当前物料已入最大数量"); |
| | | } else { |
| | | if (bomMat.getZpalletAnfme() < detlDto.getAnfme()) { |
| | | throw new CoolException(detlDto.getMatnr() + "当前物料最多可入" + bomMat.getZpalletAnfme() + "件"); |
| | | } |
| | | } |
| | | } |
| | | waitPakin.setBatch(detlDto.getBatch()); |
| | | waitPakin.setZpallet(param.getBarcode()); // 托盘码 |
| | |
| | | if (orderDetl.getAnfme() - (jsonOrderDetl.getAnfme() + orderDetl.getWorkQty()) < 0) { |
| | | return R.error("入库数量大于可入数量"); |
| | | } |
| | | //查询平库中是否有一样的物料号,有的话直接增加数量 |
| | | //查询平库中是否有一样的品号,有的话直接增加数量 |
| | | ManLocDetl checkManLocDetl = manLocDetlService.selectInventory(jsonLocNo,orderDetl.getMatnr(),jsonOrderDetl.getBatch()); |
| | | if (checkManLocDetl == null) { |
| | | ManLocDetl manLocDetl = new ManLocDetl(); |
| | |
| | | if (jsonOrderDetl.getAnfme() > (orderDetl.getAnfme() - orderDetl.getWorkQty())) { |
| | | return R.error("出库数量大于单据可出数量"); |
| | | } |
| | | //查询平库中是否有一样的物料号 |
| | | //查询平库中是否有一样的品号 |
| | | ManLocDetl checkManLocDetl = manLocDetlService.selectInventory(jsonLocNo,orderDetl.getMatnr(),orderDetl.getBatch()); |
| | | if (checkManLocDetl == null) { |
| | | return R.error("该库位没有出库的物料信息"); |