| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.production.mapper.ProductOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductWorkOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import com.ruoyi.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardMapper; |
| | |
| | | |
| | | private ProductModelMapper productModelMapper; |
| | | |
| | | private ProductionProductMainMapper productionProductMainMapper; |
| | | |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | |
| | | private ProductOrderMapper productOrderMapper; |
| | | |
| | | |
| | | @Override |
| | | public int add(QualityInspectDto qualityInspectDto) { |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | |
| | | @Override |
| | | public int submit(QualityInspect inspect) { |
| | | QualityInspect qualityInspect = qualityInspectMapper.selectById(inspect.getId()); |
| | | ProductionProductMain productionProductMain = productionProductMainMapper.selectById(qualityInspect.getProductMainId()); |
| | | |
| | | String batchNo; |
| | | String customer; |
| | | if (productionProductMain != null) { |
| | | ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectById(productionProductMain.getWorkOrderId()); |
| | | ProductOrder productOrder = productOrderMapper.selectById(productWorkOrder.getProductOrderId()); |
| | | batchNo = productOrder.getBatchNo(); |
| | | customer = "长治市轴承制造有限公司"; |
| | | } else { |
| | | batchNo = qualityInspect.getBatchNo(); |
| | | customer = qualityInspect.getSupplier(); |
| | | } |
| | | |
| | | //提交前必须判断是否合格 |
| | | if (ObjectUtils.isNull(qualityInspect.getCheckResult())) { |
| | | throw new RuntimeException("请先判断是否合格"); |
| | |
| | | qualityUnqualifiedMapper.insert(qualityUnqualified); |
| | | } else { |
| | | //合格直接入库 |
| | | stockUtils.addStock(qualityInspect.getProductModelId(), qualityInspect.getQuantity(), StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode(), qualityInspect.getId()); |
| | | stockUtils.addStock(qualityInspect.getProductModelId(), qualityInspect.getQuantity(), StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode(), |
| | | qualityInspect.getId(), batchNo, customer |
| | | ); |
| | | } |
| | | qualityInspect.setInspectState(1);//已提交 |
| | | return qualityInspectMapper.updateById(qualityInspect); |