Merge branch 'dev' into dev-bms-260826
# Conflicts: # mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java # mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/facade/IReservationStockInOrderService.java # mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/mapper/ReservationStockInOrderMapper.java # mhd_oms/src/main/resources/mapper/reservationStockInOrder/ReservationStockInOrderMapper.xml # mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryPO.java # mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryDO.java # mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryDTO.java # mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
package com.mhd.wms.interfaces.assember.inboundRank;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.inboundRank.repository.todo.InboundRankDO;
|
||||
import com.mhd.wms.interfaces.dto.inboundRank.InboundRankDTO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 入库排名统计Assembler
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@Component
|
||||
public class InboundRankAssembler {
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public InboundRankDO toDO(InboundRankDTO inboundRankDTO) {
|
||||
InboundRankDO inboundRankDO = new InboundRankDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(inboundRankDTO, inboundRankDO, IgnoreNullUtil.getNullPropertyNames(inboundRankDTO));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
return inboundRankDO;
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.mhd.wms.interfaces.assember.outboundRank;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.outboundRank.repository.todo.OutboundRankDO;
|
||||
import com.mhd.wms.interfaces.dto.outboundRank.OutboundRankDTO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 出库排名统计Assembler
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@Component
|
||||
public class OutboundRankAssembler {
|
||||
|
||||
/**
|
||||
* 转换实体
|
||||
*/
|
||||
public OutboundRankDO toDO(OutboundRankDTO outboundRankDTO) {
|
||||
OutboundRankDO outboundRankDO = new OutboundRankDO();
|
||||
// 拷贝
|
||||
BeanUtils.copyProperties(outboundRankDTO, outboundRankDO, IgnoreNullUtil.getNullPropertyNames(outboundRankDTO));
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
return outboundRankDO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mhd.wms.interfaces.dto.inboundRank;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 入库排名统计入参DTO
|
||||
*
|
||||
* <p>按入仓日期区间筛选商品入库量统计排名,统计口径:入仓日期 + 仅已入库状态(5) + 明细仅取 level=1 主行;
|
||||
* 一行 = 一个物料的合计(按物料编码合并),按件数降序排名;
|
||||
* 仓单编号/客户编号/存货人/入仓日期为单据级字段仅作查询条件,返回列不含这些字段</p>
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@Data
|
||||
public class InboundRankDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("入仓日期-开始 yyyy-MM-dd(必填,按入仓单入仓日期筛选)")
|
||||
private String warehouseDateStart;
|
||||
|
||||
@ApiModelProperty("入仓日期-结束 yyyy-MM-dd(必填,按入仓单入仓日期筛选)")
|
||||
private String warehouseDateEnd;
|
||||
|
||||
@ApiModelProperty("仓单编号/入库单号(模糊)")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("客户编号(模糊)")
|
||||
private String shipperCode;
|
||||
|
||||
@ApiModelProperty("存货人/客户名称(模糊)")
|
||||
private String shipperName;
|
||||
|
||||
@ApiModelProperty("商品货号(模糊)")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("货名/商品名称(模糊)")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("仓库名称(模糊)")
|
||||
private String warehouseName;
|
||||
}
|
||||
+13
@@ -189,11 +189,17 @@ public class MaterialInventoryDTO extends MaterialBaseDTO {
|
||||
/** 为 true 时排除库存数量为 0 的行(出库分配选库存用);库存查询页不传或 false */
|
||||
@ApiModelProperty(value = "是否排除库存数量为0", example = "false")
|
||||
private Boolean excludeZeroInventoryQuantity;
|
||||
/** 为 true 时排除可用数量为 0 的行(库存数量>0 但可用数量=0 表示已被冻结/占用完,无法出库);不传或 false 不过滤 */
|
||||
@ApiModelProperty(value = "是否排除可用数量为0", example = "false")
|
||||
private Boolean excludeZeroAllocationQuantity;
|
||||
private String expiryDate;
|
||||
private String productionDate;
|
||||
/** 进货日期(yyyy-MM-dd,单日精确查询) */
|
||||
private String purchaseDate;
|
||||
private String expiryDateStr;
|
||||
private String productionDateStr;
|
||||
private String updateTimeStr;
|
||||
private String purchaseDateStr;
|
||||
|
||||
private String expiryDateStart;
|
||||
private String expiryDateEnd;
|
||||
@@ -204,6 +210,13 @@ public class MaterialInventoryDTO extends MaterialBaseDTO {
|
||||
private String updateTimeStart;
|
||||
private String updateTimeEnd;
|
||||
|
||||
private String purchaseDateStart;
|
||||
private String purchaseDateEnd;
|
||||
|
||||
/** 入库日期(库存行创建时间)区间查询 */
|
||||
private String createTimeStart;
|
||||
private String createTimeEnd;
|
||||
|
||||
@ApiModelProperty("上次计费时间")
|
||||
private Date lastBillingTime;
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.mhd.wms.interfaces.dto.outboundRank;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 出库排名统计(明细)入参DTO
|
||||
*
|
||||
* <p>按日期区间筛选出库明细列表,一行 = 仓单×货品(件数/毛重/体积按行汇总,件数降序),
|
||||
* 统计口径:出库单创建时间 + 已出库及之后状态(9,12,13) + 明细仅取 level=1 主行</p>
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@Data
|
||||
public class OutboundRankDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("出库日期-开始 yyyy-MM-dd(必填,按出库单创建时间筛选)")
|
||||
private String createTimeStart;
|
||||
|
||||
@ApiModelProperty("出库日期-结束 yyyy-MM-dd(必填,按出库单创建时间筛选)")
|
||||
private String createTimeEnd;
|
||||
|
||||
@ApiModelProperty("仓单编号/出库单号(模糊)")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("入库单号(模糊)")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("商品货号(模糊)")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("货名/商品名称(模糊)")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("线路编码(模糊)")
|
||||
private String lineCode;
|
||||
|
||||
@ApiModelProperty("线路名称(模糊)")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty("仓库名称(模糊)")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("客户名称(模糊)")
|
||||
private String customerName;
|
||||
|
||||
@ApiModelProperty("货主名称(模糊)")
|
||||
private String shipperName;
|
||||
}
|
||||
+6
@@ -311,6 +311,12 @@ public class ShelfMaterialDetailDTO extends BaseVOEntity {
|
||||
@Excel(name = "存货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date inventoryDate;
|
||||
|
||||
@ApiModelProperty("进货日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "进货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date purchaseDate;
|
||||
|
||||
@ApiModelProperty("ExtAttr3")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package com.mhd.wms.interfaces.facadeApi.inboundRank;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mhd.common.core.constant.HttpStatus;
|
||||
import com.mhd.common.core.utils.PageUtils;
|
||||
import com.mhd.common.core.utils.poi.ExcelUtil;
|
||||
import com.mhd.wms.application.service.inboundRank.InboundRankApplicationService;
|
||||
import com.mhd.wms.domain.inboundRank.repository.po.InboundMaterialRankPO;
|
||||
import com.mhd.wms.domain.inboundRank.repository.po.InboundRankTotalPO;
|
||||
import com.mhd.wms.domain.inboundRank.repository.todo.InboundRankDO;
|
||||
import com.mhd.wms.interfaces.assember.inboundRank.InboundRankAssembler;
|
||||
import com.mhd.wms.interfaces.dto.inboundRank.InboundRankDTO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 入库排名统计Api
|
||||
*
|
||||
* <p>按入仓日期区间筛选商品入库量统计排名。统计口径:入仓日期(为空的历史单按建档时间兜底) + 仅已入库状态(5),
|
||||
* 明细仅取 level=1 主行;一行 = 一个物料的合计(按物料编码合并区间内全部已入库仓单),
|
||||
* 按件数(实际上架量 SHELVES_QUANTITY)降序排名,件数为0的物料不返回。
|
||||
* 返回字段:物料编码/货名/规格型号/单位/件数/毛重(吨)/投保总额/体积(CBM);
|
||||
* 仓单编号/客户编号/存货人/入仓日期为单据级字段仅作查询条件,不返回。
|
||||
* 与出库排名(/outboundRankApi)配对,前端用 tab 页区分</p>
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/inboundRankApi")
|
||||
public class InboundRankApi {
|
||||
|
||||
@Resource
|
||||
private InboundRankAssembler inboundRankAssembler;
|
||||
|
||||
@Autowired
|
||||
private InboundRankApplicationService inboundRankApplicationService;
|
||||
|
||||
/**
|
||||
* 分页查询商品入库排名列表(含合计行)
|
||||
*/
|
||||
@ApiOperation("分页查询商品入库排名列表")
|
||||
@GetMapping("/queryMaterialRankList")
|
||||
public HashMap<String, Object> queryMaterialRankList(InboundRankDTO inboundRankDTO) {
|
||||
//转换实体
|
||||
InboundRankDO inboundRankDO = inboundRankAssembler.toDO(inboundRankDTO);
|
||||
startPage();
|
||||
List<InboundMaterialRankPO> list = inboundRankApplicationService.queryMaterialRankList(inboundRankDO);
|
||||
InboundRankTotalPO total = inboundRankApplicationService.queryMaterialRankTotal(inboundRankDO);
|
||||
return getDataTableWithTotal(list, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品入库排名Excel
|
||||
*/
|
||||
@ApiOperation("导出商品入库排名Excel")
|
||||
@GetMapping("/exportMaterialRank")
|
||||
public void exportMaterialRank(HttpServletResponse response, InboundRankDTO inboundRankDTO) throws Exception {
|
||||
//转换实体(不分页,导出全量)
|
||||
InboundRankDO inboundRankDO = inboundRankAssembler.toDO(inboundRankDTO);
|
||||
List<InboundMaterialRankPO> list = inboundRankApplicationService.exportMaterialRank(inboundRankDO);
|
||||
|
||||
String fileName = URLEncoder.encode("入库排名统计", "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
ExcelUtil<InboundMaterialRankPO> util = new ExcelUtil<>(InboundMaterialRankPO.class);
|
||||
util.exportExcel(response, list, "入库排名统计");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页结果 + 合计行:data/total/code/msg 之外追加
|
||||
* totalPieceCount/totalGrossWeightTon/totalInsureAmount/totalVolume/totalOrderCount
|
||||
*/
|
||||
private HashMap<String, Object> getDataTableWithTotal(List<?> list, InboundRankTotalPO total) {
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
result.put("data", list);
|
||||
result.put("total", new PageInfo<>(list).getTotal());
|
||||
result.put("code", HttpStatus.SUCCESS);
|
||||
result.put("msg", "查询成功");
|
||||
if (total != null) {
|
||||
result.put("totalPieceCount", total.getTotalPieceCount());
|
||||
result.put("totalGrossWeightTon", total.getTotalGrossWeightTon());
|
||||
result.put("totalInsureAmount", total.getTotalInsureAmount());
|
||||
result.put("totalVolume", total.getTotalVolume());
|
||||
result.put("totalOrderCount", total.getTotalOrderCount());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置请求分页数据
|
||||
*/
|
||||
protected void startPage() {
|
||||
PageUtils.startPage();
|
||||
}
|
||||
}
|
||||
+24
-3
@@ -55,18 +55,31 @@ public class MaterialInventoryApi extends BaseController {
|
||||
/**
|
||||
* 分页查询物料库存列表
|
||||
*/
|
||||
@ApiOperation(value = "查询物料库存列表", notes = "库存查询页不传 excludeZeroInventoryQuantity 可查出数量为0;出库分配页传 excludeZeroInventoryQuantity=true 排除库存数量为0")
|
||||
@ApiOperation(value = "查询物料库存列表", notes = "两个隐藏0库存开关(均不传或 false 不过滤,保持原行为):"
|
||||
+ "excludeZeroInventoryQuantity=true 排除库存数量为0(盘点-库存选择页\"隐藏数量为0的物料\");"
|
||||
+ "excludeZeroAllocationQuantity=true 排除可用数量为0(出库选库存,可用数量=0 表示已被冻结/占用完无法出库);"
|
||||
+ "物料编号筛选传 materialCode(精确匹配),仓库筛选传 warehouseId(下拉);"
|
||||
+ "库存查询页不传开关可查出数量为0;导出复用本接口:传 isExport=true 标识导出请求"
|
||||
+ "(导出显示:商品饮用有效期expiryDate/物料分类materialClassifyName/进货日期purchaseDate,所有查询维度均返回)")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MaterialInventoryDTO materialInventoryDTO,
|
||||
@RequestParam(value = "customerName", required = false) String customerName,
|
||||
@RequestParam(value = "excludeZeroInventoryQuantity", required = false) Boolean excludeZeroInventoryQuantity,
|
||||
@RequestParam(value = "excludeZeroAllocationQuantity", required = false) Boolean excludeZeroAllocationQuantity,
|
||||
@RequestParam(value = "expiryDateStart", required = false) String expiryDateStart,
|
||||
@RequestParam(value = "expiryDateEnd", required = false) String expiryDateEnd,
|
||||
@RequestParam(value = "orderByExpiryDate", required = false) Boolean orderByExpiryDate)
|
||||
@RequestParam(value = "purchaseDateStart", required = false) String purchaseDateStart,
|
||||
@RequestParam(value = "purchaseDateEnd", required = false) String purchaseDateEnd,
|
||||
@RequestParam(value = "orderByExpiryDate", required = false) Boolean orderByExpiryDate,
|
||||
// 导出标识:导出与查询共用本接口,isExport=true 表示本次请求为导出(导出专属排序等逻辑以此开关)
|
||||
@RequestParam(value = "isExport", required = false) Boolean isExport)
|
||||
{
|
||||
if (Boolean.TRUE.equals(excludeZeroInventoryQuantity)) {
|
||||
materialInventoryDTO.setExcludeZeroInventoryQuantity(true);
|
||||
}
|
||||
if (Boolean.TRUE.equals(excludeZeroAllocationQuantity)) {
|
||||
materialInventoryDTO.setExcludeZeroAllocationQuantity(true);
|
||||
}
|
||||
// 出库分配前端传的是客户名称 customerName,这里通过名称查询货主ID,使用精确匹配(不模糊匹配)
|
||||
String shipperName = null; // 保存查询到的货主名称
|
||||
if (StringUtils.isNotBlank(customerName) && materialInventoryDTO.getShipperId() == null) {
|
||||
@@ -93,10 +106,15 @@ public class MaterialInventoryApi extends BaseController {
|
||||
MaterialInventoryDO materialInventoryDO = materialInventoryAssembler.toDO(materialInventoryDTO);
|
||||
materialInventoryDO.setExpiryDateStr(materialInventoryDTO.getExpiryDate());
|
||||
materialInventoryDO.setProductionDateStr(materialInventoryDTO.getProductionDate());
|
||||
materialInventoryDO.setPurchaseDateStr(materialInventoryDTO.getPurchaseDate());
|
||||
materialInventoryDO.setExpiryDateStart(expiryDateStart);
|
||||
materialInventoryDO.setExpiryDateEnd(expiryDateEnd);
|
||||
materialInventoryDO.setPurchaseDateStart(purchaseDateStart);
|
||||
materialInventoryDO.setPurchaseDateEnd(purchaseDateEnd);
|
||||
// 导出场景:queryRule=wlExpiry + orderByExpiryDate=true 时 SQL 按到期日倒序分组(与 OMS 库存查询导出一致)
|
||||
materialInventoryDO.setOrderByExpiryDate(orderByExpiryDate);
|
||||
// 导出标识:isExport=true 启用导出融合排序(到期日倒序优先 → 同到期日按物料编码升序,所有维度生效)
|
||||
materialInventoryDO.setIsExport(isExport);
|
||||
Date updateTime = materialInventoryDTO.getUpdateTime();
|
||||
if (updateTime != null) {
|
||||
LocalDateTime localDateTime = updateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
@@ -169,7 +187,10 @@ public class MaterialInventoryApi extends BaseController {
|
||||
// materialDetailId 是新接口专用参数(出库单明细ID),库存 DTO 的同名字段语义是「上架单明细ID」,
|
||||
// 泄入原查询会生成错误的 a.material_detail_id 条件导致查空,进原查询前显式清除
|
||||
materialInventoryDTO.setMaterialDetailId(null);
|
||||
return list(materialInventoryDTO, customerName, excludeZeroInventoryQuantity, expiryDateStart, expiryDateEnd, orderByExpiryDate);
|
||||
// assignableList 非导出场景,isExport 传 null;excludeZeroAllocationQuantity 已随 DTO 绑定,透传保持开关生效
|
||||
return list(materialInventoryDTO, customerName, excludeZeroInventoryQuantity,
|
||||
materialInventoryDTO.getExcludeZeroAllocationQuantity(),
|
||||
expiryDateStart, expiryDateEnd, null, null, orderByExpiryDate, null);
|
||||
}
|
||||
|
||||
@ApiOperation("查询物料库存列表不分页;queryRule=hz 时按货主+物料分组(同一物料在不同货主各占一行)")
|
||||
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
package com.mhd.wms.interfaces.facadeApi.outboundRank;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mhd.common.core.constant.HttpStatus;
|
||||
import com.mhd.common.core.utils.PageUtils;
|
||||
import com.mhd.common.core.utils.poi.ExcelUtil;
|
||||
import com.mhd.wms.application.service.outboundRank.OutboundRankApplicationService;
|
||||
import com.mhd.wms.domain.outboundRank.repository.po.OutboundDetailRankTotalPO;
|
||||
import com.mhd.wms.domain.outboundRank.repository.po.OutboundLineRankPO;
|
||||
import com.mhd.wms.domain.outboundRank.repository.po.OutboundMaterialRankPO;
|
||||
import com.mhd.wms.domain.outboundRank.repository.todo.OutboundRankDO;
|
||||
import com.mhd.wms.interfaces.assember.outboundRank.OutboundRankAssembler;
|
||||
import com.mhd.wms.interfaces.dto.outboundRank.OutboundRankDTO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出库排名统计Api
|
||||
*
|
||||
* <p>按日期区间筛选出库量统计排名,按出库数量(实际复核出库量)降序。
|
||||
* 商品tab:一行 = 一个货品(货号/货名/件数/毛重(吨)/体积(CBM)/退保总额占位),跨出库单汇总,忽略线路筛选参数;
|
||||
* 线路tab:一行 = 线路×货品(线路编码/线路/货号/货名/件数/毛重(吨)/体积(CBM)/退保总额占位),按线路+物料编码合并,
|
||||
* 仅统计带线路的单,商品/线路筛选参数均生效;
|
||||
* 统计口径:出库单创建时间 + 已出库及之后状态(9,12,13),明细仅取 level=1 主行;
|
||||
* 件数 = SUM(CHECK_QUANTITY) 复核确认的实际出库量(与入库排名的实际上架量对称);
|
||||
* 退保总额后端暂无对应数据来源,恒为 null</p>
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/outboundRankApi")
|
||||
public class OutboundRankApi {
|
||||
|
||||
@Resource
|
||||
private OutboundRankAssembler outboundRankAssembler;
|
||||
|
||||
@Autowired
|
||||
private OutboundRankApplicationService outboundRankApplicationService;
|
||||
|
||||
/**
|
||||
* 分页查询商品出库排名列表(含合计行,商品tab;忽略线路筛选参数)
|
||||
*/
|
||||
@ApiOperation("分页查询商品出库排名列表")
|
||||
@GetMapping("/queryMaterialRankList")
|
||||
public HashMap<String, Object> queryMaterialRankList(OutboundRankDTO outboundRankDTO) {
|
||||
//转换实体
|
||||
OutboundRankDO outboundRankDO = outboundRankAssembler.toDO(outboundRankDTO);
|
||||
//商品tab:忽略线路筛选参数
|
||||
outboundRankDO.setLineCode(null);
|
||||
outboundRankDO.setLineName(null);
|
||||
startPage();
|
||||
List<OutboundMaterialRankPO> list = outboundRankApplicationService.queryMaterialRankList(outboundRankDO);
|
||||
OutboundDetailRankTotalPO total = outboundRankApplicationService.queryMaterialRankTotal(outboundRankDO);
|
||||
return getDataTableWithTotal(list, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询线路出库排名列表(含合计行,线路tab;一行=线路×货品,仅统计带线路的单)
|
||||
*/
|
||||
@ApiOperation("分页查询线路出库排名列表")
|
||||
@GetMapping("/queryLineRankList")
|
||||
public HashMap<String, Object> queryLineRankList(OutboundRankDTO outboundRankDTO) {
|
||||
//转换实体(线路tab:商品/线路筛选参数均生效,按线路+物料编码合并)
|
||||
OutboundRankDO outboundRankDO = outboundRankAssembler.toDO(outboundRankDTO);
|
||||
startPage();
|
||||
List<OutboundLineRankPO> list = outboundRankApplicationService.queryLineRankList(outboundRankDO);
|
||||
OutboundDetailRankTotalPO total = outboundRankApplicationService.queryLineRankTotal(outboundRankDO);
|
||||
return getDataTableWithTotal(list, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品出库排名Excel(商品tab;忽略线路筛选参数)
|
||||
*/
|
||||
@ApiOperation("导出商品出库排名Excel")
|
||||
@GetMapping("/exportMaterialRank")
|
||||
public void exportMaterialRank(HttpServletResponse response, OutboundRankDTO outboundRankDTO) throws Exception {
|
||||
//转换实体(不分页,导出全量)
|
||||
OutboundRankDO outboundRankDO = outboundRankAssembler.toDO(outboundRankDTO);
|
||||
//商品tab:忽略线路筛选参数
|
||||
outboundRankDO.setLineCode(null);
|
||||
outboundRankDO.setLineName(null);
|
||||
List<OutboundMaterialRankPO> list = outboundRankApplicationService.exportMaterialRankList(outboundRankDO);
|
||||
|
||||
String fileName = URLEncoder.encode("商品出库排名", "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
ExcelUtil<OutboundMaterialRankPO> util = new ExcelUtil<>(OutboundMaterialRankPO.class);
|
||||
util.exportExcel(response, list, "商品出库排名");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出线路出库排名Excel(线路tab;一行=线路×货品,仅统计带线路的单)
|
||||
*/
|
||||
@ApiOperation("导出线路出库排名Excel")
|
||||
@GetMapping("/exportLineRank")
|
||||
public void exportLineRank(HttpServletResponse response, OutboundRankDTO outboundRankDTO) throws Exception {
|
||||
//转换实体(不分页,导出全量;线路tab:商品/线路筛选参数均生效,按线路+物料编码合并)
|
||||
OutboundRankDO outboundRankDO = outboundRankAssembler.toDO(outboundRankDTO);
|
||||
List<OutboundLineRankPO> list = outboundRankApplicationService.exportLineRankList(outboundRankDO);
|
||||
|
||||
String fileName = URLEncoder.encode("线路出库排名", "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
ExcelUtil<OutboundLineRankPO> util = new ExcelUtil<>(OutboundLineRankPO.class);
|
||||
util.exportExcel(response, list, "线路出库排名");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页结果 + 合计行:data/total/code/msg 之外追加合计字段(商品tab含 totalOrderCount,线路tab含 totalOrderCount/totalLineCount)
|
||||
*/
|
||||
private HashMap<String, Object> getDataTableWithTotal(List<?> list, OutboundDetailRankTotalPO total) {
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
result.put("data", list);
|
||||
result.put("total", new PageInfo<>(list).getTotal());
|
||||
result.put("code", HttpStatus.SUCCESS);
|
||||
result.put("msg", "查询成功");
|
||||
if (total != null) {
|
||||
result.put("totalPieceCount", total.getTotalPieceCount());
|
||||
result.put("totalGrossWeightTon", total.getTotalGrossWeightTon());
|
||||
result.put("totalVolume", total.getTotalVolume());
|
||||
if (total.getTotalOrderCount() != null) {
|
||||
result.put("totalOrderCount", total.getTotalOrderCount());
|
||||
}
|
||||
if (total.getTotalLineCount() != null) {
|
||||
result.put("totalLineCount", total.getTotalLineCount());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置请求分页数据
|
||||
*/
|
||||
protected void startPage() {
|
||||
PageUtils.startPage();
|
||||
}
|
||||
}
|
||||
+24
-24
@@ -53,8 +53,8 @@ public class StockInOrderApi extends BaseController {
|
||||
private StockInOrderAssembler stockInOrderAssembler;
|
||||
@Resource
|
||||
private StockOutOrderAssembler stockOutOrderAssembler;
|
||||
@Autowired
|
||||
private XxlJobServiceFeign xxlJobServiceFeign;
|
||||
// @Autowired
|
||||
// private XxlJobServiceFeign xxlJobServiceFeign;
|
||||
|
||||
/**
|
||||
* 分页查询入库单列表
|
||||
@@ -353,32 +353,32 @@ public class StockInOrderApi extends BaseController {
|
||||
return stockInOrderApplicationService.batchSignature(dto);
|
||||
}
|
||||
|
||||
@GetMapping("/xxlopenfeign")
|
||||
public AjaxResult xxlopenfeign(@RequestParam String param) {
|
||||
R<Map<String, Object>> mapR = xxlJobServiceFeign.openFeignTest(param);
|
||||
return AjaxResult.success(mapR);
|
||||
}
|
||||
// @GetMapping("/xxlopenfeign")
|
||||
// public AjaxResult xxlopenfeign(@RequestParam String param) {
|
||||
// R<Map<String, Object>> mapR = xxlJobServiceFeign.openFeignTest(param);
|
||||
// return AjaxResult.success(mapR);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 1. 简单任务示例(Bean模式)
|
||||
* 这里的 demoJobHandler 必须和调度中心配置一致
|
||||
*/
|
||||
@XxlJob("demoJobHandler")
|
||||
public void demoJobHandler() {
|
||||
// 获取任务参数
|
||||
String param = XxlJobHelper.getJobParam();
|
||||
logger.info("XXL-JOB 开始执行,参数:{}", param);
|
||||
|
||||
try {
|
||||
// ========== 你的业务逻辑 ==========
|
||||
logger.info("执行若依微服务定时任务...");
|
||||
|
||||
// 设置任务执行结果
|
||||
XxlJobHelper.handleSuccess("执行成功");
|
||||
} catch (Exception e) {
|
||||
logger.error("XXL-JOB 执行失败", e);
|
||||
XxlJobHelper.handleFail("执行失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
// @XxlJob("demoJobHandler")
|
||||
// public void demoJobHandler() {
|
||||
// // 获取任务参数
|
||||
// String param = XxlJobHelper.getJobParam();
|
||||
// logger.info("XXL-JOB 开始执行,参数:{}", param);
|
||||
//
|
||||
// try {
|
||||
// // ========== 你的业务逻辑 ==========
|
||||
// logger.info("执行若依微服务定时任务...");
|
||||
//
|
||||
// // 设置任务执行结果
|
||||
// XxlJobHelper.handleSuccess("执行成功");
|
||||
// } catch (Exception e) {
|
||||
// logger.error("XXL-JOB 执行失败", e);
|
||||
// XxlJobHelper.handleFail("执行失败:" + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
+14
-1
@@ -208,6 +208,7 @@ public class StockOutOrderApi extends BaseController {
|
||||
public AjaxResult getInfoOutOrderNumber(String outOrderNumber) {
|
||||
// 根据出库单号查询出库单,再按出库单ID查询详情,保证与出库管理页面一致
|
||||
StockOutOrder stockOutOrder = stockOutOrderService.getOne(new LambdaQueryWrapper<StockOutOrder>()
|
||||
.eq(StockOutOrder::getDelFlag,1)
|
||||
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber));
|
||||
if (stockOutOrder == null) {
|
||||
return AjaxResult.error("出库单不存在");
|
||||
@@ -226,6 +227,7 @@ public class StockOutOrderApi extends BaseController {
|
||||
return AjaxResult.error("orderNumber不能为空");
|
||||
}
|
||||
StockOutOrder stockOutOrder = stockOutOrderService.getOne(new LambdaQueryWrapper<StockOutOrder>()
|
||||
.eq(StockOutOrder::getDelFlag,1)
|
||||
.eq(StockOutOrder::getOutOrderNumber, orderNumber));
|
||||
if (stockOutOrder == null) {
|
||||
return AjaxResult.error("出库单不存在");
|
||||
@@ -542,10 +544,21 @@ public class StockOutOrderApi extends BaseController {
|
||||
stockOutOrderApplicationService.omsOrderAddDetail(outMaterialDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* oms下发前库存校验:不足时返回错误,OMS据此拦截下发,避免单据落库后分配失败残留垃圾单
|
||||
*/
|
||||
@ApiOperation("oms下发前库存校验")
|
||||
@PostMapping(value = "/checkOmsAssignInventory")
|
||||
public AjaxResult checkOmsAssignInventory(@RequestBody List<OutMaterialDetail> outMaterialDetails) {
|
||||
stockOutOrderApplicationService.checkOmsAssignInventory(outMaterialDetails);
|
||||
return AjaxResult.success("库存校验通过");
|
||||
}
|
||||
|
||||
@ApiOperation("oms下发单保存")
|
||||
@PostMapping(value = "/cancelExecutionOrder")
|
||||
public void omsCancelExecutionOrder(@RequestBody StockOutOrder stockOutOrder) {
|
||||
public AjaxResult omsCancelExecutionOrder(@RequestBody StockOutOrder stockOutOrder) {
|
||||
stockOutOrderApplicationService.cancelExecutionOrder(stockOutOrder);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user