| | |
| | | qualityInspect.setQuantity(saleProduct.getQuantity()); |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0,null); |
| | | if (qualityTestStandard.size()>0){ |
| | | if (!qualityTestStandard.isEmpty()) { |
| | | qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId()); |
| | | qualityInspectMapper.updateById(qualityInspect); |
| | | qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery() |
| | |
| | | |
| | | for (PurchaseLedgerProductImportDto salesLedgerProductImportDto : salesLedgerProductImportDtos) { |
| | | SalesLedgerProduct salesLedgerProduct = new SalesLedgerProduct(); |
| | | // 查询产品 |
| | | Product product = productMapper.selectOne(new LambdaQueryWrapper<Product>() |
| | | .eq(Product::getProductName, salesLedgerProductImportDto.getProductCategory())); |
| | | if (product == null) { |
| | | throw new RuntimeException("请维护产品:" + salesLedgerProductImportDto.getProductCategory()); |
| | | } |
| | | // 查询产品型号 |
| | | ProductModel productModel = productModelMapper.selectOne(new LambdaQueryWrapper<ProductModel>() |
| | | .eq(ProductModel::getProductId, product.getId()) |
| | | .eq(ProductModel::getModel, salesLedgerProductImportDto.getSpecificationModel()) |
| | | .eq(ProductModel::getUidNo, salesLedgerProductImportDto.getUidNo())); |
| | | if (productModel == null) { |
| | | throw new RuntimeException("请维护产品【" + salesLedgerProductImportDto.getProductCategory() + "】的型号【" |
| | | + salesLedgerProductImportDto.getSpecificationModel() + "】和UID码【" |
| | | + salesLedgerProductImportDto.getUidNo() + "】"); |
| | | } |
| | | salesLedgerProduct.setProductModelId(productModel.getId()); |
| | | salesLedgerProduct.setProductId(product.getId()); |
| | | BeanUtils.copyProperties(salesLedgerProductImportDto, salesLedgerProduct); |
| | | salesLedgerProduct.setSalesLedgerId(salesLedger.getId()); |
| | | salesLedgerProduct.setType(2); |
| | |
| | | salesLedgerProduct.setApproveStatus(0); |
| | | salesLedgerProduct.setPendingTicketsTotal(salesLedgerProductImportDto.getTaxInclusiveTotalPrice()); |
| | | // 是否质检判断 |
| | | if (salesLedgerProductImportDto.getIsChecked() == null) { |
| | | throw new RuntimeException("请填写是否质检!"); |
| | | } |
| | | salesLedgerProduct.setIsChecked(salesLedgerProductImportDto.getIsChecked() == 1); |
| | | if(salesLedgerProductImportDto.getIsChecked() == 1){ |
| | | addQualityInspect(salesLedger, salesLedgerProduct); |
| | | } else { |
| | | //直接入库 |
| | | stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), |
| | | salesLedger.getId(), salesLedgerProduct.getBatchNo(), salesLedger.getSupplierName(), LocalDate.now()); |
| | | } |
| | | salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | } |
| | | // 采购审核 |
| | | addApproveByPurchase(loginUser,salesLedger); |
| | | } |
| | | |
| | | return AjaxResult.success("导入成功"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e.getMessage()); |
| | | } |
| | | return AjaxResult.success("导入失败"); |
| | | } |
| | | |
| | | @Override |