feat(oms):库存查询导出新增库存为0是否导出参数 /reservationMaterialInventoryApi/list 新增可选参数 excludeZeroInventoryQuantity,前端"库存为0是否导出"选"是"时传 true,SQL 以 HAVING IFNULL(SUM(inventory_quantity),0)>0 排除汇总库存为0的数据;所有查询维度(all/hz/wl/kw/wlkw/wlExpiry)共6条查询在 GROUP BY 后统一挂载公共片段 excludeZeroInventoryHaving,与 sort_order 对0库存的定义保持一致;不传参数时 SQL 不拼接条件,行为与原来完全一致
This commit is contained in:
+3
@@ -258,4 +258,7 @@ public class ReservationMaterialInventoryDO extends MaterialBaseDO {
|
||||
|
||||
@ApiModelProperty("导出按到期日分组排序标识:仅 queryRule=wlExpiry 时生效,true-到期日倒序(日期近的在前、空值最后、0库存靠后);不传-保持原有排序")
|
||||
private Boolean orderByExpiryDate;
|
||||
|
||||
@ApiModelProperty("导出排除库存为0标识:true-排除库存数量汇总为0的数据(所有查询维度 queryRule 均生效);不传-不过滤")
|
||||
private Boolean excludeZeroInventoryQuantity;
|
||||
}
|
||||
+5
-1
@@ -47,12 +47,13 @@ public class ReservationMaterialInventoryApi extends BaseController {
|
||||
/**
|
||||
* 分页查询物料库存列表
|
||||
*/
|
||||
@ApiOperation("查询物料库存列表")
|
||||
@ApiOperation(value = "查询物料库存列表", notes = "导出复用本接口,任意查询维度(queryRule)下:前端\"库存为0是否导出\"选\"是\"时传 excludeZeroInventoryQuantity=true 排除库存为0的数据,不传或 false 导出全部(含库存为0);orderByExpiryDate=true 时按到期日分组排序")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ReservationMaterialInventoryDTO materialInventoryDTO,
|
||||
@RequestParam(value = "customerName", required = false) String customerName,
|
||||
@RequestParam(value = "expiryDateStart", required = false) String expiryDateStart,
|
||||
@RequestParam(value = "expiryDateEnd", required = false) String expiryDateEnd,
|
||||
@RequestParam(value = "excludeZeroInventoryQuantity", required = false) Boolean excludeZeroInventoryQuantity,
|
||||
@RequestParam(value = "orderByExpiryDate", required = false) Boolean orderByExpiryDate)
|
||||
{
|
||||
// 出库分配前端传的是客户名称 customerName,这里通过名称查询货主ID,使用精确匹配(不模糊匹配)
|
||||
@@ -86,6 +87,9 @@ public class ReservationMaterialInventoryApi extends BaseController {
|
||||
// 导出场景:queryRule=wlExpiry + orderByExpiryDate=true 时 SQL 按到期日倒序分组
|
||||
// (日期近的在前、空值最后、0库存靠后、同到期日按更新时间倒序)
|
||||
materialInventoryDO.setOrderByExpiryDate(orderByExpiryDate);
|
||||
// 导出场景:前端"库存为0是否导出"选"是"时传 excludeZeroInventoryQuantity=true,
|
||||
// SQL 用 HAVING 排除汇总库存为0的数据(与 WMS 同名参数语义一致)
|
||||
materialInventoryDO.setExcludeZeroInventoryQuantity(excludeZeroInventoryQuantity);
|
||||
startPage();
|
||||
// 使用带批次属性的查询方法,批次属性值从库存表中获取
|
||||
List<ReservationMaterialInventoryPO> list = materialInventoryApplicationService.queryListWithBatchAttributes(materialInventoryDO);
|
||||
|
||||
Reference in New Issue
Block a user