feat(wms): 新增钢卷物料导出功能
- 新增导出专用VO类WmsMaterialCoilExportVo,包含完整的钢卷字段信息 - 在IWmsMaterialCoilService接口中添加queryExportList方法定义 - 在WmsMaterialCoilServiceImpl实现类中实现导出数据查询逻辑 - 扩展WmsMaterialCoilMapper接口和XML文件,新增selectExportList查询 - 优化导出查询条件构建逻辑,支持多itemId筛选 - 更新导出接口文档注释,明确标识为完整字段版本 - 在控制器中切换导出接口使用新的导出VO类进行数据封装
This commit is contained in:
@@ -46,13 +46,13 @@ public class WmsMaterialCoilController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出钢卷物料表列表
|
||||
* 导出钢卷物料表列表(完整字段版本)
|
||||
*/
|
||||
@Log(title = "钢卷物料表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsMaterialCoilBo bo, HttpServletResponse response) {
|
||||
List<WmsMaterialCoilVo> list = iWmsMaterialCoilService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "钢卷物料表", WmsMaterialCoilVo.class, response);
|
||||
List<com.klp.domain.vo.WmsMaterialCoilExportVo> list = iWmsMaterialCoilService.queryExportList(bo);
|
||||
ExcelUtil.exportExcel(list, "钢卷物料表", com.klp.domain.vo.WmsMaterialCoilExportVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
package com.klp.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 钢卷物料导出VO
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-11-27
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsMaterialCoilExportVo {
|
||||
|
||||
/**
|
||||
* 类型(成品/原料)
|
||||
*/
|
||||
@ExcelProperty(value = "类型")
|
||||
private String itemTypeDesc;
|
||||
|
||||
/**
|
||||
* 物品ID
|
||||
*/
|
||||
@ExcelProperty(value = "物品ID")
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 逻辑库区
|
||||
*/
|
||||
@ExcelProperty(value = "逻辑库区")
|
||||
private String warehouseName;
|
||||
|
||||
/**
|
||||
* 实际库区
|
||||
*/
|
||||
@ExcelProperty(value = "实际库区")
|
||||
private String actualWarehouseName;
|
||||
|
||||
/**
|
||||
* 入场卷号
|
||||
*/
|
||||
@ExcelProperty(value = "入场卷号")
|
||||
private String enterCoilNo;
|
||||
|
||||
/**
|
||||
* 厂家卷号
|
||||
*/
|
||||
@ExcelProperty(value = "厂家卷号")
|
||||
private String supplierCoilNo;
|
||||
|
||||
/**
|
||||
* 成品卷号
|
||||
*/
|
||||
@ExcelProperty(value = "成品卷号")
|
||||
private String currentCoilNo;
|
||||
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
@ExcelProperty(value = "日期")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 重量(kg)
|
||||
*/
|
||||
@ExcelProperty(value = "重量")
|
||||
private BigDecimal netWeight;
|
||||
|
||||
/**
|
||||
* 用途
|
||||
*/
|
||||
@ExcelProperty(value = "用途")
|
||||
private String purpose;
|
||||
|
||||
/**
|
||||
* 切边要求
|
||||
*/
|
||||
@ExcelProperty(value = "切边要求")
|
||||
private String trimmingRequirement;
|
||||
|
||||
/**
|
||||
* 包装种类
|
||||
*/
|
||||
@ExcelProperty(value = "包装种类")
|
||||
private String packagingRequirement;
|
||||
|
||||
/**
|
||||
* 产品状态
|
||||
*/
|
||||
@ExcelProperty(value = "产品状态")
|
||||
private String qualityStatusDesc;
|
||||
|
||||
/**
|
||||
* 打包状态
|
||||
*/
|
||||
@ExcelProperty(value = "打包状态")
|
||||
private String packingStatusDesc;
|
||||
|
||||
/**
|
||||
* 库存状态
|
||||
*/
|
||||
@ExcelProperty(value = "库存状态")
|
||||
private String statusDesc;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ExcelProperty(value = "名称")
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@ExcelProperty(value = "规格")
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 材质
|
||||
*/
|
||||
@ExcelProperty(value = "材质")
|
||||
private String material;
|
||||
|
||||
/**
|
||||
* 厂家
|
||||
*/
|
||||
@ExcelProperty(value = "厂家")
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 表面处理
|
||||
*/
|
||||
@ExcelProperty(value = "表面处理")
|
||||
private String surfaceTreatmentDesc;
|
||||
|
||||
/**
|
||||
* 锌层
|
||||
*/
|
||||
@ExcelProperty(value = "锌层")
|
||||
private String zincLayer;
|
||||
}
|
||||
@@ -45,5 +45,13 @@ public interface WmsMaterialCoilMapper extends BaseMapperPlus<WmsMaterialCoilMap
|
||||
List<Map<String, Object>> getDistributionByActualWarehouse(@Param("itemType") String itemType, @Param("itemId") Long itemId);
|
||||
|
||||
List<Map<String, Object>> getDistributionByActualItemType(@Param("itemType")String itemType,@Param("itemId") Long itemId);
|
||||
|
||||
/**
|
||||
* 查询钢卷导出数据(包含所有关联字段)
|
||||
*
|
||||
* @param lqw 查询条件
|
||||
* @return 导出数据列表
|
||||
*/
|
||||
List<com.klp.domain.vo.WmsMaterialCoilExportVo> selectExportList(@Param("ew")QueryWrapper<WmsMaterialCoil> lqw);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,5 +88,13 @@ public interface IWmsMaterialCoilService {
|
||||
List<WmsMaterialCoilVo> getDistributionByActualWarehouse(String itemType, Long itemId);
|
||||
|
||||
List<WmsMaterialCoilVo> getDistributionByActualItemType(String itemType, Long itemId);
|
||||
|
||||
/**
|
||||
* 查询钢卷导出数据列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 导出数据列表
|
||||
*/
|
||||
List<com.klp.domain.vo.WmsMaterialCoilExportVo> queryExportList(WmsMaterialCoilBo bo);
|
||||
}
|
||||
|
||||
|
||||
@@ -1586,5 +1586,71 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
List<Map<String, Object>> mapList = baseMapper.getDistributionByActualItemType(itemType, itemId);
|
||||
return convertMapListToVoListActual(mapList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询钢卷导出数据列表
|
||||
*/
|
||||
@Override
|
||||
public List<com.klp.domain.vo.WmsMaterialCoilExportVo> queryExportList(WmsMaterialCoilBo bo) {
|
||||
QueryWrapper<WmsMaterialCoil> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectExportList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询条件
|
||||
*/
|
||||
private QueryWrapper<WmsMaterialCoil> buildQueryWrapper(WmsMaterialCoilBo bo) {
|
||||
QueryWrapper<WmsMaterialCoil> lqw = Wrappers.query();
|
||||
|
||||
// 基础字段筛选
|
||||
lqw.eq(bo.getCoilId() != null, "mc.coil_id", bo.getCoilId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getEnterCoilNo()), "mc.enter_coil_no", bo.getEnterCoilNo());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getCurrentCoilNo()), "mc.current_coil_no", bo.getCurrentCoilNo());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getSupplierCoilNo()), "mc.supplier_coil_no", bo.getSupplierCoilNo());
|
||||
lqw.eq(bo.getDataType() != null, "mc.data_type", bo.getDataType());
|
||||
lqw.eq(bo.getWarehouseId() != null, "mc.warehouse_id", bo.getWarehouseId());
|
||||
lqw.eq(bo.getActualWarehouseId() != null, "mc.actual_warehouse_id", bo.getActualWarehouseId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getItemType()), "mc.item_type", bo.getItemType());
|
||||
lqw.eq(bo.getHasMergeSplit() != null, "mc.has_merge_split", bo.getHasMergeSplit());
|
||||
// 修改itemId筛选逻辑,支持逗号分隔的多个ID查询
|
||||
if (StringUtils.isNotBlank(bo.getItemIds())) {
|
||||
String[] itemIdArray = bo.getItemIds().split(",");
|
||||
List<Long> itemIdList = new ArrayList<>();
|
||||
for (String itemIdStr : itemIdArray) {
|
||||
if (StringUtils.isNotBlank(itemIdStr)) {
|
||||
try {
|
||||
itemIdList.add(Long.parseLong(itemIdStr.trim()));
|
||||
} catch (NumberFormatException e) {
|
||||
// 忽略无效的ID格式
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!itemIdList.isEmpty()) {
|
||||
lqw.in("mc.item_id", itemIdList);
|
||||
}
|
||||
} else if (bo.getItemId() != null) {
|
||||
// 兼容原来的itemId单值查询
|
||||
lqw.eq("mc.item_id", bo.getItemId());
|
||||
}
|
||||
|
||||
lqw.eq(bo.getStatus() != null, "mc.status", bo.getStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMaterialType()), "mc.material_type", bo.getMaterialType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getQualityStatus()), "mc.quality_status", bo.getQualityStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPackingStatus()), "mc.packing_status", bo.getPackingStatus());
|
||||
|
||||
// 把team字段作为筛选条件
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTeam()), "mc.team", bo.getTeam());
|
||||
|
||||
// 根据开始时间和结束时间筛选修改时间
|
||||
lqw.ge(bo.getStartTime() != null, "mc.update_time", bo.getStartTime());
|
||||
lqw.le(bo.getEndTime() != null, "mc.update_time", bo.getEndTime());
|
||||
|
||||
// 逻辑删除
|
||||
lqw.eq("mc.del_flag", 0);
|
||||
|
||||
// 根据创建时间倒序
|
||||
lqw.orderByDesc("mc.create_time");
|
||||
|
||||
return lqw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,6 +316,93 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ORDER BY mc.item_type, mc.item_id, w.actual_warehouse_id
|
||||
</select>
|
||||
|
||||
<!-- 导出查询:包含所有需要的字段 -->
|
||||
<select id="selectExportList" resultType="com.klp.domain.vo.WmsMaterialCoilExportVo">
|
||||
SELECT
|
||||
-- 类型(中文显示)
|
||||
CASE
|
||||
WHEN mc.item_type = 'product' THEN '成品'
|
||||
WHEN mc.item_type = 'raw_material' THEN '原料'
|
||||
ELSE mc.item_type
|
||||
END AS itemTypeDesc,
|
||||
-- 物品ID
|
||||
mc.item_id AS itemId,
|
||||
-- 逻辑库区
|
||||
w.warehouse_name AS warehouseName,
|
||||
-- 实际库区
|
||||
aw.actual_warehouse_name AS actualWarehouseName,
|
||||
-- 入场卷号
|
||||
mc.enter_coil_no AS enterCoilNo,
|
||||
-- 厂家卷号
|
||||
mc.supplier_coil_no AS supplierCoilNo,
|
||||
-- 成品卷号
|
||||
mc.current_coil_no AS currentCoilNo,
|
||||
-- 日期
|
||||
mc.create_time AS createTime,
|
||||
-- 重量
|
||||
mc.net_weight AS netWeight,
|
||||
-- 用途(暂无数据源)
|
||||
NULL AS purpose,
|
||||
-- 切边要求
|
||||
mc.trimming_requirement AS trimmingRequirement,
|
||||
-- 包装种类
|
||||
mc.packaging_requirement AS packagingRequirement,
|
||||
-- 产品状态(直接展示原始值)
|
||||
mc.quality_status AS qualityStatus,
|
||||
-- 打包状态(直接展示原始值)
|
||||
mc.packing_status AS packingStatus,
|
||||
-- 库存状态(中文显示)
|
||||
CASE
|
||||
WHEN mc.status = 0 THEN '在库'
|
||||
WHEN mc.status = 1 THEN '在途'
|
||||
ELSE CAST(mc.sta tus AS CHAR)
|
||||
END AS statusDesc,
|
||||
-- 备注
|
||||
mc.remark AS remark,
|
||||
-- 名称(根据类型从不同表获取)
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.raw_material_name
|
||||
WHEN mc.item_type = 'product' THEN p.product_name
|
||||
ELSE NULL
|
||||
END AS itemName,
|
||||
-- 规格
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.specification
|
||||
WHEN mc.item_type = 'product' THEN p.specification
|
||||
ELSE NULL
|
||||
END AS specification,
|
||||
-- 材质
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.material
|
||||
WHEN mc.item_type = 'product' THEN p.material
|
||||
ELSE NULL
|
||||
END AS material,
|
||||
-- 厂家
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.manufacturer
|
||||
WHEN mc.item_type = 'product' THEN p.manufacturer
|
||||
ELSE NULL
|
||||
END AS manufacturer,
|
||||
-- 表面处理
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.surface_treatment_desc
|
||||
WHEN mc.item_type = 'product' THEN p.surface_treatment_desc
|
||||
ELSE NULL
|
||||
END AS surfaceTreatmentDesc,
|
||||
-- 锌层
|
||||
CASE
|
||||
WHEN mc.item_type = 'raw_material' THEN rm.zinc_layer
|
||||
WHEN mc.item_type = 'product' THEN p.zinc_layer
|
||||
ELSE NULL
|
||||
END AS zincLayer
|
||||
FROM wms_material_coil mc
|
||||
LEFT JOIN wms_warehouse w ON mc.warehouse_id = w.warehouse_id
|
||||
LEFT JOIN wms_actual_warehouse aw ON mc.actual_warehouse_id = aw.actual_warehouse_id
|
||||
LEFT JOIN wms_raw_material rm ON mc.item_type = 'raw_material' AND mc.item_id = rm.raw_material_id
|
||||
LEFT JOIN wms_product p ON mc.item_type = 'product' AND mc.item_id = p.product_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user