| | |
| | | if(status.equals(2)){ |
| | | shippingInfo.setStatus("审核通过"); |
| | | }else if(status.equals(3)){ |
| | | shippingInfo.setType("审核拒绝"); |
| | | shippingInfo.setStatus("审核拒绝"); |
| | | }else if(status.equals(1)){ |
| | | shippingInfo.setStatus("审核中"); |
| | | } |
| | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("发货信息列表") |
| | | public AjaxResult listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfo> listPage = shippingInfoService.listPage(page,req); |
| | | IPage<ShippingInfoDto> listPage = shippingInfoService.listPage(page,req); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "发货信息管理", businessType = BusinessType.UPDATE) |
| | | public AjaxResult deductStock(@RequestBody ShippingInfoDto req) throws IOException { |
| | | |
| | | |
| | | return shippingInfoService.deductStock( req) ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | * @date : 2025/10/22 9:32 |
| | | */ |
| | | public interface ShippingInfoMapper extends BaseMapper<ShippingInfo> { |
| | | IPage<ShippingInfo> listPage(Page page,@Param("req") ShippingInfo req); |
| | | IPage<ShippingInfoDto> listPage(Page page, @Param("req") ShippingInfo req); |
| | | |
| | | List<ShippingInfo> listAll(); |
| | | } |
| | |
| | | * @date : 2025/10/22 9:33 |
| | | */ |
| | | public interface ShippingInfoService extends IService<ShippingInfo>{ |
| | | IPage<ShippingInfo> listPage(Page page, ShippingInfo req); |
| | | IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req); |
| | | |
| | | boolean deductStock(ShippingInfoDto req) throws IOException; |
| | | |
| | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | public List<CommonFile> getFileListByBusinessId(Long businessId,Integer type) { |
| | | return commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, businessId) |
| | | .eq(CommonFile::getType, type)); |
| | | } |
| | | |
| | | public void deleteByBusinessId(Long businessId,Integer type) { |
| | | commonFileMapper.delete(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, businessId) |
| | | .eq(CommonFile::getType, type)); |
| | |
| | | if(ObjectUtils.isEmpty(invoiceRegistrationProductDto)){ |
| | | throw new RuntimeException("产品开票台账查找失败"); |
| | | } |
| | | List<InvoiceRegistrationProduct> invoiceRegistrationProducts = invoiceRegistrationProductMapper.selectList(new LambdaQueryWrapper<InvoiceRegistrationProduct>() |
| | | .eq(InvoiceRegistrationProduct::getSalesLedgerProductId, invoiceRegistrationProductDto.getSalesLedgerProductId())); |
| | | if(CollectionUtils.isNotEmpty(invoiceRegistrationProducts)){ |
| | | invoiceRegistrationProductDto.setNoInvoiceNum(invoiceRegistrationProductDto.getQuantity() |
| | | .subtract(invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getInvoiceNum).reduce(BigDecimal.ZERO, BigDecimal::add))); |
| | | invoiceRegistrationProductDto.setNoInvoiceAmount(invoiceRegistrationProductDto.getTaxInclusiveTotalPrice() |
| | | .subtract(invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getInvoiceAmount).reduce(BigDecimal.ZERO, BigDecimal::add))); |
| | | } |
| | | // 查询附件 |
| | | QueryWrapper<InvoiceLedgerFile> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("invoice_ledger_id", invoiceRegistrationProductDto.getInvoiceLedgerId()); |
| | |
| | | private ApproveProcessServiceImpl approveProcessService; |
| | | |
| | | @Override |
| | | public IPage<ShippingInfo> listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfo> listPage = shippingInfoMapper.listPage(page, req); |
| | | |
| | | public IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfoDto> listPage = shippingInfoMapper.listPage(page, req); |
| | | listPage.getRecords().forEach(item ->{ |
| | | item.setCommonFileList(commonFileService.getFileListByBusinessId(item.getId(), FileNameType.SHIP.getValue())); |
| | | }); |
| | | return listPage; |
| | | } |
| | | |
| | |
| | | if (byId == null) { |
| | | throw new RuntimeException("发货信息不存在"); |
| | | } |
| | | //扣减库存 |
| | | if(!"已发货".equals(byId.getStatus())){ |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(byId.getSalesLedgerProductId()); |
| | | stockUtils.substractStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId()); |
| | | } |
| | | byId.setExpressNumber(req.getExpressNumber()); |
| | | byId.setExpressCompany(req.getExpressCompany()); |
| | | byId.setStatus("已发货"); |
| | | byId.setShippingCarNumber(req.getShippingCarNumber()); |
| | | boolean update = this.updateById(req); |
| | | //扣减库存 |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(req.getSalesLedgerProductId()); |
| | | stockUtils.substractStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId()); |
| | | // 迁移文件 |
| | | if(CollectionUtils.isNotEmpty(req.getTempFileIds())){ |
| | | tempFileService.migrateTempFilesToFormal(req.getId(), req.getTempFileIds(), FileNameType.SHIP.getValue()); |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.sales.mapper.ShippingInfoMapper"> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.sales.pojo.ShippingInfo"> |
| | | <select id="listPage" resultType="com.ruoyi.sales.dto.ShippingInfoDto"> |
| | | SELECT |
| | | s.id, |
| | | s.sales_ledger_id, |