超市
This commit is contained in:
1 parent
aa8f739381
commit
b134b8d539
11 files changed
+458
-21
No files matched your search
+6
@@ -34,4 +34,10 @@ public class InventoryDetailQueryDTO {
|
||||
*/
|
||||
@Schema(description="订单类型:1=入库,2=出库")
|
||||
private Integer orderType;
|
||||
|
||||
/**
|
||||
* 单据类型:1=采购申请,2=采购订单,3=采购入库,4=采购退货,5=零售出库,6=零售退货,7=库存盘点
|
||||
*/
|
||||
@Schema(description="单据类型:3=采购入库,6=零售退货")
|
||||
private String inventoryType;
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.report;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Schema(description = "进销存报表返回数据(按商品汇总)")
|
||||
public class InventoryInOutReportVO {
|
||||
|
||||
@Schema(description = "商品ID")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "商品编码")
|
||||
private String productCode;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String productName;
|
||||
|
||||
@Schema(description = "分类ID")
|
||||
private Long categoryId;
|
||||
|
||||
@Schema(description = "分类名称")
|
||||
private String categoryName;
|
||||
|
||||
@Schema(description = "单位(基础单位)")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "期初数量(基础单位)")
|
||||
private Double openingQty;
|
||||
|
||||
@Schema(description = "入库数量(基础单位)")
|
||||
private Double inQty;
|
||||
|
||||
@Schema(description = "出库数量(基础单位)")
|
||||
private Double outQty;
|
||||
|
||||
@Schema(description = "期末数量(基础单位)")
|
||||
private Double closingQty;
|
||||
|
||||
@Schema(description = "入库金额(元)")
|
||||
private BigDecimal inAmount;
|
||||
|
||||
@Schema(description = "出库金额(元)")
|
||||
private BigDecimal outAmount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.report;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 进销存报表汇总数据
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2024-10-15
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "进销存报表汇总数据")
|
||||
public class InventoryInOutSummaryVO {
|
||||
|
||||
@Schema(description = "统计商品总数")
|
||||
private Integer totalProducts;
|
||||
|
||||
@Schema(description = "有发生额的商品数量")
|
||||
private Integer changedProducts;
|
||||
|
||||
@Schema(description = "总期初库存数量")
|
||||
private Double totalOpeningQty;
|
||||
|
||||
@Schema(description = "总入库数量")
|
||||
private Double totalInQty;
|
||||
|
||||
@Schema(description = "总出库数量")
|
||||
private Double totalOutQty;
|
||||
|
||||
@Schema(description = "总期末库存数量")
|
||||
private Double totalClosingQty;
|
||||
|
||||
@Schema(description = "总入库金额(元)")
|
||||
private BigDecimal totalInAmount;
|
||||
|
||||
@Schema(description = "总出库金额(元)")
|
||||
private BigDecimal totalOutAmount;
|
||||
|
||||
@Schema(description = "库存周转率(出库数量/平均库存)")
|
||||
private BigDecimal turnoverRate;
|
||||
|
||||
@Schema(description = "平均单价(总金额/总数量)")
|
||||
private BigDecimal avgPrice;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.report;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 进销存报表VO
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2025-10-16
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "进销存报表VO")
|
||||
public class InventoryReportVO {
|
||||
|
||||
@Schema(description = "商品ID")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "商品编码")
|
||||
private String productCode;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String productName;
|
||||
|
||||
@Schema(description = "分类名称")
|
||||
private String categoryName;
|
||||
|
||||
@Schema(description = "规格")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "单位")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "装数")
|
||||
private Integer packageNum;
|
||||
|
||||
@Schema(description = "参考进价(元)")
|
||||
private BigDecimal purchasePrice;
|
||||
|
||||
@Schema(description = "零售价(元)")
|
||||
private BigDecimal retailPrice;
|
||||
|
||||
@Schema(description = "期初库存")
|
||||
private Double openingQty;
|
||||
|
||||
@Schema(description = "期初金额(元)")
|
||||
private BigDecimal openingAmount;
|
||||
|
||||
@Schema(description = "采购入库数量")
|
||||
private Double purchaseInQty;
|
||||
|
||||
@Schema(description = "采购入库金额(元)")
|
||||
private BigDecimal purchaseInAmount;
|
||||
|
||||
@Schema(description = "采购退货数量")
|
||||
private Double purchaseReturnQty;
|
||||
|
||||
@Schema(description = "采购退货金额(元)")
|
||||
private BigDecimal purchaseReturnAmount;
|
||||
|
||||
@Schema(description = "销售数量")
|
||||
private Double salesQty;
|
||||
|
||||
@Schema(description = "销售金额(元)")
|
||||
private BigDecimal salesAmount;
|
||||
|
||||
@Schema(description = "销售退货数量")
|
||||
private Double salesReturnQty;
|
||||
|
||||
@Schema(description = "销售退货金额(元)")
|
||||
private BigDecimal salesReturnAmount;
|
||||
|
||||
@Schema(description = "实际销售数量")
|
||||
private Double actualSalesQty;
|
||||
|
||||
@Schema(description = "实际销售金额(元)")
|
||||
private BigDecimal actualSalesAmount;
|
||||
|
||||
@Schema(description = "销售成本(元)")
|
||||
private BigDecimal salesCost;
|
||||
|
||||
@Schema(description = "期末数量")
|
||||
private Double closingQty;
|
||||
|
||||
@Schema(description = "期末库存金额(元)")
|
||||
private BigDecimal closingAmount;
|
||||
|
||||
@Schema(description = "期末库存售额(元)")
|
||||
private BigDecimal closingRetailAmount;
|
||||
|
||||
@Schema(description = "销售毛利(元)")
|
||||
private BigDecimal grossProfit;
|
||||
|
||||
@Schema(description = "首次进货日")
|
||||
private LocalDate firstPurchaseDate;
|
||||
}
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.report;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Schema(description = "盘存报表返回数据(按商品汇总)")
|
||||
public class InventoryStocktakeReportVO {
|
||||
|
||||
@Schema(description = "商品ID")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "商品编码")
|
||||
private String productCode;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String productName;
|
||||
|
||||
@Schema(description = "分类ID")
|
||||
private Long categoryId;
|
||||
|
||||
@Schema(description = "分类名称")
|
||||
private String categoryName;
|
||||
|
||||
@Schema(description = "单位(基础单位)")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "账面数量(基础单位)")
|
||||
private Double bookQty;
|
||||
|
||||
@Schema(description = "实盘数量(基础单位)")
|
||||
private Double physicalQty;
|
||||
|
||||
@Schema(description = "差异数量(基础单位,实盘-账面)")
|
||||
private Double diffQty;
|
||||
|
||||
@Schema(description = "差异金额(元)")
|
||||
private BigDecimal diffAmount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.report;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 毛利报表VO
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2025-10-16
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "毛利报表VO")
|
||||
public class ProfitReportVO {
|
||||
|
||||
@Schema(description = "商品ID")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "商品编码")
|
||||
private String productCode;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String productName;
|
||||
|
||||
@Schema(description = "分类名称")
|
||||
private String categoryName;
|
||||
|
||||
@Schema(description = "规格")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "单位")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "销售数量")
|
||||
private Double salesQty;
|
||||
|
||||
@Schema(description = "销售金额(元)")
|
||||
private BigDecimal salesAmount;
|
||||
|
||||
@Schema(description = "销售单价(元)")
|
||||
private BigDecimal salesPrice;
|
||||
|
||||
@Schema(description = "成本单价(元)")
|
||||
private BigDecimal costPrice;
|
||||
|
||||
@Schema(description = "销售成本(元)")
|
||||
private BigDecimal salesCost;
|
||||
|
||||
@Schema(description = "销售毛利(元)")
|
||||
private BigDecimal grossProfit;
|
||||
|
||||
@Schema(description = "毛利率(%)")
|
||||
private BigDecimal profitMargin;
|
||||
|
||||
@Schema(description = "销售笔数")
|
||||
private Integer salesCount;
|
||||
}
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.report;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 销售报表VO
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2025-10-16
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "销售报表VO")
|
||||
public class SalesReportVO {
|
||||
|
||||
@Schema(description = "商品ID")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "商品编码")
|
||||
private String productCode;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String productName;
|
||||
|
||||
@Schema(description = "分类名称")
|
||||
private String categoryName;
|
||||
|
||||
@Schema(description = "规格")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "单位")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "销售数量")
|
||||
private Double salesQty;
|
||||
|
||||
@Schema(description = "销售金额(元)")
|
||||
private BigDecimal salesAmount;
|
||||
|
||||
@Schema(description = "销售单价(元)")
|
||||
private BigDecimal salesPrice;
|
||||
|
||||
@Schema(description = "销售笔数")
|
||||
private Integer salesCount;
|
||||
|
||||
@Schema(description = "退货数量")
|
||||
private Double returnQty;
|
||||
|
||||
@Schema(description = "退货金额(元)")
|
||||
private BigDecimal returnAmount;
|
||||
|
||||
@Schema(description = "实际销售数量")
|
||||
private Double actualSalesQty;
|
||||
|
||||
@Schema(description = "实际销售金额(元)")
|
||||
private BigDecimal actualSalesAmount;
|
||||
}
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package com.bsd.pjcloud.supermarket.vo.report;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 盘存报表VO
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2025-10-16
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "盘存报表VO")
|
||||
public class StocktakeReportVO {
|
||||
|
||||
@Schema(description = "盘点单号")
|
||||
private String stocktakeCode;
|
||||
|
||||
@Schema(description = "盘点日期")
|
||||
private LocalDate stocktakeDate;
|
||||
|
||||
@Schema(description = "商品ID")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "商品编码")
|
||||
private String productCode;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String productName;
|
||||
|
||||
@Schema(description = "分类名称")
|
||||
private String categoryName;
|
||||
|
||||
@Schema(description = "规格")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "单位")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "账面数量")
|
||||
private Double bookQty;
|
||||
|
||||
@Schema(description = "实盘数量")
|
||||
private Double physicalQty;
|
||||
|
||||
@Schema(description = "差异数量(实盘-账面)")
|
||||
private Double diffQty;
|
||||
|
||||
@Schema(description = "差异金额(元)")
|
||||
private BigDecimal diffAmount;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
||||
|
||||
+2
@@ -11,6 +11,7 @@ import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
* @author pjcloud
|
||||
* @date 2025-01-27 10:00:00
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/realtimeSalesReport")
|
||||
|
||||
+24
-21
@@ -1287,36 +1287,39 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
|
||||
@Override
|
||||
public List<InventoryDetailExcelDTO> exportInventoryDetail(InventoryDetailQueryDTO inventoryDetailQueryDTO) {
|
||||
// 查询明细数据(不分页)
|
||||
Page<InventoryRecordPageVo> page = new Page<>(1, 10000);
|
||||
// 查询出入库明细数据
|
||||
Page<InventoryRecordPageVo> page = new Page<>(1, 100000); // 设置一个较大的分页值以获取所有数据
|
||||
Page<InventoryRecordPageVo> pageData = baseMapper.getInventoryDetailPageByScope(page, inventoryDetailQueryDTO, DataScope.of());
|
||||
|
||||
List<InventoryRecordPageVo> records = pageData.getRecords();
|
||||
|
||||
// 转换为导出DTO
|
||||
return records.stream().map(vo -> {
|
||||
InventoryDetailExcelDTO dto = new InventoryDetailExcelDTO();
|
||||
dto.setInventoryCode(vo.getInventoryCode());
|
||||
dto.setInventoryDate(vo.getInventoryDate());
|
||||
dto.setProductName(vo.getProductName());
|
||||
dto.setSpec(vo.getSpec());
|
||||
dto.setUnit(vo.getUnit());
|
||||
dto.setPackageNum(vo.getPackageNum());
|
||||
dto.setQuantity(vo.getQuantity());
|
||||
// 转换为Excel DTO
|
||||
List<InventoryDetailExcelDTO> excelList = new ArrayList<>();
|
||||
for (InventoryRecordPageVo record : records) {
|
||||
InventoryDetailExcelDTO excelDTO = new InventoryDetailExcelDTO();
|
||||
excelDTO.setInventoryCode(record.getInventoryCode());
|
||||
excelDTO.setInventoryDate(record.getInventoryDate());
|
||||
excelDTO.setProductName(record.getProductName());
|
||||
excelDTO.setSpec(record.getSpec());
|
||||
excelDTO.setUnit(record.getUnit());
|
||||
excelDTO.setPackageNum(record.getPackageNum());
|
||||
excelDTO.setQuantity(record.getQuantity());
|
||||
|
||||
// 金额从分转换为元
|
||||
if (vo.getUnitPrice() != null) {
|
||||
dto.setUnitPrice(BigDecimal.valueOf(vo.getUnitPrice()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP));
|
||||
// 类型转换:Integer(分) → BigDecimal(元)
|
||||
if (record.getUnitPrice() != null) {
|
||||
excelDTO.setUnitPrice(new BigDecimal(record.getUnitPrice()).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (vo.getTotalAmount() != null) {
|
||||
dto.setTotalAmount(BigDecimal.valueOf(vo.getTotalAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP));
|
||||
if (record.getTotalAmount() != null) {
|
||||
excelDTO.setTotalAmount(new BigDecimal(record.getTotalAmount()).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP));
|
||||
}
|
||||
|
||||
dto.setSupplierName(vo.getSupplierName());
|
||||
dto.setRemark(vo.getRemark());
|
||||
excelDTO.setSupplierName(record.getSupplierName());
|
||||
excelDTO.setRemark(record.getRemark());
|
||||
|
||||
return dto;
|
||||
}).collect(Collectors.toList());
|
||||
excelList.add(excelDTO);
|
||||
}
|
||||
|
||||
return excelList;
|
||||
}
|
||||
|
||||
}
|
||||
+3
@@ -63,6 +63,9 @@
|
||||
<if test="inventoryDetailQueryDTO.orderType != null and inventoryDetailQueryDTO.orderType != ''">
|
||||
and r.order_type = #{inventoryDetailQueryDTO.orderType}
|
||||
</if>
|
||||
<if test="inventoryDetailQueryDTO.inventoryType != null and inventoryDetailQueryDTO.inventoryType != ''">
|
||||
and r.inventory_type = #{inventoryDetailQueryDTO.inventoryType}
|
||||
</if>
|
||||
<if test="inventoryDetailQueryDTO.startDate != null">
|
||||
and r.inventory_date >= #{inventoryDetailQueryDTO.startDate}
|
||||
</if>
|
||||
|
||||
Reference in new issue
Block a user