| | |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | 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; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | private final ISysNoticeService sysNoticeService; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final SalesQuotationMapper salesQuotationMapper; |
| | | private final StockUtils stockUtils; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final ApproveNodeMapper approveNodeMapper; |
| | |
| | | .collect(Collectors.toList()); |
| | | // 无审核人逻辑添加 |
| | | if (CollectionUtils.isEmpty(nodeIds)) { |
| | | autoPassPurchaseApproveIfNoApprover(approveProcessVO); // 采购单无审核人逻辑 |
| | | switch (approveProcessVO.getApproveType()){ |
| | | case 5: |
| | | autoPassPurchaseApproveIfNoApprover(approveProcessVO); // 采购单无审核人逻辑 |
| | | break; |
| | | case 6: |
| | | autoPassSalesApproveIfNoApprover(approveProcessVO); // 销售报价无审核人逻辑 |
| | | break; |
| | | case 7: |
| | | autoShippingApproveIfNoApprover(approveProcessVO); // 销售发货无审核人逻辑 |
| | | break; |
| | | } |
| | | return; |
| | | } |
| | | List<SysUser> sysUsers = sysUserMapper.selectUserByIds(nodeIds); |
| | |
| | | } |
| | | } |
| | | |
| | | private void autoPassSalesApproveIfNoApprover(ApproveProcessVO approveProcessVO) { |
| | | if (!StringUtils.hasText(approveProcessVO.getApproveReason())) { |
| | | return; |
| | | } |
| | | salesQuotationMapper.update(null, new LambdaUpdateWrapper<SalesQuotation>() |
| | | .eq(SalesQuotation::getQuotationNo, approveProcessVO.getApproveReason()) |
| | | .set(SalesQuotation::getStatus, "通过")); |
| | | } |
| | | |
| | | private void autoShippingApproveIfNoApprover(ApproveProcessVO approveProcessVO) { |
| | | if (!StringUtils.hasText(approveProcessVO.getApproveReason())) { |
| | | return; |
| | | } |
| | | ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>() |
| | | .eq(ShippingInfo::getShippingNo, approveProcessVO.getApproveReason()) |
| | | .last("limit 1")); |
| | | if(shippingInfo == null){ |
| | | return; |
| | | } |
| | | shippingInfoMapper.update(null, new LambdaUpdateWrapper<ShippingInfo>() |
| | | .eq(ShippingInfo::getShippingNo, approveProcessVO.getApproveReason()) |
| | | .set(ShippingInfo::getStatus, "审核通过")); |
| | | //更改出库审核状态(待确认改成待审核) |
| | | stockUtils.shipmentStatus(StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), shippingInfo.getId()); |
| | | } |
| | | |
| | | private void autoPassPurchaseApproveIfNoApprover(ApproveProcessVO approveProcessVO) { |
| | | if (!Objects.equals(approveProcessVO.getApproveType(), 5) |
| | | || !StringUtils.hasText(approveProcessVO.getApproveReason())) { |
| | | throw new RuntimeException("审核用户不存在"); |
| | | if (!StringUtils.hasText(approveProcessVO.getApproveReason())) { |
| | | return; |
| | | } |
| | | |
| | | purchaseLedgerMapper.update(null, new LambdaUpdateWrapper<PurchaseLedger>() |