Merge remote-tracking branch 'origin/dev_New' into dev_New
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.approve.vo.ApproveProcessVO; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.other.service.impl.TempFileServiceImpl; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationProductMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.purchase.service.impl.PurchaseLedgerServiceImpl; |
| | | import com.ruoyi.sales.mapper.*; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.SalesQuotation; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | |
| | | |
| | | @Autowired |
| | | private CommonFileServiceImpl commonFileService; |
| | | @Autowired |
| | | private StockUtils stockUtils; |
| | | @Autowired |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | |
| | | @Autowired |
| | | private PurchaseLedgerServiceImpl purchaseLedgerServiceImpl; |
| | | |
| | | |
| | | public ApproveProcess getApproveById(String id) { |
| | |
| | | if (status.equals(2)) { |
| | | // 同意 |
| | | purchaseLedger.setApprovalStatus(3); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new QueryWrapper<SalesLedgerProduct>() |
| | | .lambda().eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId()).eq(SalesLedgerProduct::getType, 2)); |
| | | for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) { |
| | | // 质检 |
| | | if (salesLedgerProduct.getIsChecked()) { |
| | | purchaseLedgerServiceImpl.addQualityInspect(purchaseLedger, salesLedgerProduct); |
| | | }else { |
| | | //直接入库 |
| | | stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), purchaseLedger.getId()); |
| | | } |
| | | } |
| | | } else if (status.equals(3)) { |
| | | // 拒绝 |
| | | purchaseLedger.setApprovalStatus(4); |
| | |
| | | @ApiModelProperty(value = "BOM编号") |
| | | @Excel(name = "BOM编号") |
| | | private String bomNo; |
| | | |
| | | @ApiModelProperty(value = "交期偏差") |
| | | private Integer deliveryDaysDiff; |
| | | } |
| | |
| | | return 1; |
| | | } |
| | | |
| | | private void addQualityInspect(PurchaseLedger purchaseLedger, SalesLedgerProduct saleProduct) { |
| | | |
| | | public void addQualityInspect(PurchaseLedger purchaseLedger, SalesLedgerProduct saleProduct) { |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setInspectType(0); |
| | | qualityInspect.setSupplier(purchaseLedger.getSupplierName()); |
| | |
| | | if (ids == null || ids.length == 0) { |
| | | throw new BaseException("请选中至少一条数据"); |
| | | } |
| | | for (Long id : ids) { |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(id); |
| | | if (purchaseLedger.getApprovalStatus().equals(3)) { |
| | | throw new BaseException(purchaseLedger.getPurchaseContractNumber()+"已经审批通过,不允许删除"); |
| | | } |
| | | } |
| | | // 批量删除关联的采购入库记录 |
| | | LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductQueryWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerProductQueryWrapper.in(SalesLedgerProduct::getSalesLedgerId, ids) |
| | |
| | | |
| | | @ApiModelProperty(value = "付款方式") |
| | | private String paymentMethod; |
| | | |
| | | @ApiModelProperty(value = "交货日期") |
| | | private LocalDate deliveryDate; |
| | | } |
| | |
| | | */ |
| | | private Long supplierId; |
| | | |
| | | private Integer approvalStatus; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "交货日期") |
| | | @TableField(value = "delivery_date") |
| | | private LocalDate deliveryDate; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "交货天数差") |
| | | private Integer deliveryDaysDiff; |
| | | } |
| | | |
| | |
| | | slp.specification_model, |
| | | ppr.process_route_code, |
| | | pb.bom_no, |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus, |
| | | DATEDIFF(sl.delivery_date, CURDATE()) AS delivery_days_diff |
| | | from product_order po |
| | | left join sales_ledger sl on po.sales_ledger_id = sl.id |
| | | left join sales_ledger_product slp on po.product_model_id = slp.id |
| | |
| | | |
| | | <select id="selectSalesLedgerList" resultType="com.ruoyi.sales.pojo.SalesLedger"> |
| | | SELECT |
| | | T1.id, |
| | | T1.sales_contract_no, |
| | | T1.customer_contract_no, |
| | | T1.project_name, |
| | | T1.entry_date, |
| | | T1.salesman, |
| | | T1.customer_id, |
| | | T1.customer_name, |
| | | T1.entry_person, |
| | | T1.remarks, |
| | | T1.attachment_materials, |
| | | T1.tenant_id, |
| | | T1.contract_amount, |
| | | T1.execution_date, |
| | | T2.nick_name AS entry_person_name, |
| | | T1.payment_method |
| | | T1.id, |
| | | T1.sales_contract_no, |
| | | T1.customer_contract_no, |
| | | T1.project_name, |
| | | T1.entry_date, |
| | | T1.salesman, |
| | | T1.customer_id, |
| | | T1.customer_name, |
| | | T1.entry_person, |
| | | T1.remarks, |
| | | T1.attachment_materials, |
| | | T1.tenant_id, |
| | | T1.contract_amount, |
| | | T1.execution_date, |
| | | T2.nick_name AS entry_person_name, |
| | | T1.payment_method, |
| | | DATEDIFF(T1.delivery_date, CURDATE()) AS delivery_days_diff |
| | | FROM |
| | | sales_ledger T1 |
| | | sales_ledger T1 |
| | | LEFT JOIN sys_user T2 ON T1.entry_person = T2.user_id |
| | | <where> |
| | | <if test="salesLedgerDto.customerName != null and salesLedgerDto.customerName != '' "> |
| | |
| | | T1.contract_amount as noInvoiceAmountTotal, |
| | | T1.execution_date, |
| | | T2.nick_name AS entry_person_name, |
| | | T1.payment_method |
| | | T1.payment_method, |
| | | T1.delivery_date, |
| | | DATEDIFF(T1.delivery_date, CURDATE()) AS delivery_days_diff |
| | | FROM |
| | | sales_ledger T1 |
| | | LEFT JOIN sys_user T2 ON T1.entry_person = T2.user_id |
| | |
| | | <if test="req.purchaseContractNumber != null and req.purchaseContractNumber != '' "> |
| | | AND sl.purchase_contract_number like concat('%',#{req.purchaseContractNumber},'%') |
| | | </if> |
| | | <if test="req.approvalStatus != null and req.approvalStatus != ''"> |
| | | and sl.approval_status = #{req.approvalStatus} |
| | | </if> |
| | | <if test="req.customerContractNo != null and req.customerContractNo != '' "> |
| | | AND sl.customer_contract_no like concat('%',#{req.customerContractNo},'%') |
| | | </if> |