| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean addProductMain(ProductionProductMainDto dto) { |
| | | SysUser user = userMapper.selectUserById(dto.getUserId()); |
| | | ProductionProductMain productionProductMain = new ProductionProductMain(); |
| | |
| | | Long modelId = drawMaterial.getProductModelId(); |
| | | BigDecimal reportQty = drawMaterial.getReportQty(); |
| | | |
| | | if (reportQty != null && reportQty.compareTo(new BigDecimal(0)) == 0) { |
| | | throw new RuntimeException("产品" + drawMaterial.getProductName() + "- 型号" + drawMaterial.getModel() + |
| | | "- 批次号=" + drawMaterial.getBatchNo() + "的料已用完,请重新领料"); |
| | | |
| | | } |
| | | |
| | | String key = drawMaterial.getProductModelId() + "_" + |
| | | (drawMaterial.getBatchNo() == null ? "" : drawMaterial.getBatchNo()) + "_" + |
| | | (drawMaterial.getCustomer() == null ? "" : drawMaterial.getCustomer()); |
| | |
| | | order.setDrawMaterials(JSON.toJSONString(existingMaterialList)); |
| | | productOrderMapper.updateById(order); |
| | | } |
| | | }else { |
| | | throw new RuntimeException("请领取投入材料"); |
| | | } |
| | | /*新增报工产出表*/ |
| | | ProductionProductOutput productionProductOutput = new ProductionProductOutput(); |
| | |
| | | if (productOrder == null) { |
| | | throw new RuntimeException("生产订单不存在"); |
| | | } |
| | | |
| | | |
| | | Product product = productMapper.selectById(productModel.getProductId()); |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | |
| | | //直接入库 |
| | | String customer = "长治市轴承制造有限公司"; |
| | | stockUtils.addStock(productProcessRouteItem.getProductModelId(), productionProductOutput.getQuantity().subtract(productionProductOutput.getScrapQty()), |
| | | StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(), productionProductMain.getId(),order.getBatchNo(),customer |
| | | StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(), productionProductMain.getId(),order.getBatchNo(),customer,null |
| | | ); |
| | | } |
| | | /*更新工单和生产订单*/ |