feat(wms): 添加发货单明细查询功能支持导出功能

- 在WmsDeliveryWaybillDetailMapper中新增VO查询方法
- 实现联查发货单、计划、钢卷信息的数据映射
- 更新WmsDeliveryWaybillDetailVo实体类字段结构
- 优化服务层查询逻辑并添加分页支持
- 配置MyBatis XML映射文件查询语句
- 整合多表关联数据展示完整业务信息
This commit is contained in:
2026-03-30 10:15:10 +08:00
parent 667c411997
commit cdf49ab8fe
4 changed files with 244 additions and 23 deletions

View File

@@ -1,6 +1,7 @@
package com.klp.domain.vo;
import java.math.BigDecimal;
import java.util.Date;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.klp.common.annotation.ExcelDictFormat;
@@ -24,53 +25,135 @@ public class WmsDeliveryWaybillDetailVo extends BaseEntity {
/**
* 明细唯一ID
*/
@ExcelProperty(value = "明细唯一ID")
private Long detailId;
/**
* 关联发货单主表ID
*/
@ExcelProperty(value = "关联发货单主表ID")
private Long waybillId;
/**
* 关联钢卷表ID钢卷基础信息在钢卷表中
*/
@ExcelProperty(value = "关联钢卷表ID", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "钢=卷基础信息在钢卷表中")
private Long coilId;
/**
* 计划名称
*/
@ExcelProperty(value = "计划名称")
private String planName;
// ==================== 关联的发货单主表信息 ====================
/**
* 发货单号
*/
@ExcelProperty(value = "发货单号")
private String waybillNo;
/**
* 发货单名称
*/
@ExcelProperty(value = "发货单名称")
private String waybillName;
/**
* 车牌号
*/
@ExcelProperty(value = "车牌号")
private String licensePlate;
/**
* 收货单位
*/
@ExcelProperty(value = "收货单位")
private String consigneeUnit;
/**
* 发货单位
*/
@ExcelProperty(value = "发货单位")
private String senderUnit;
/**
* 发货时间
*/
@ExcelProperty(value = "发货时间")
private Date deliveryTime;
/**
* 地磅
*/
@ExcelProperty(value = "地磅")
private String weighbridge;
/**
* 业务员
*/
@ExcelProperty(value = "业务员")
private String salesPerson;
/**
* 负责人
*/
@ExcelProperty(value = "负责人")
private String principal;
/**
* 负责人电话
*/
@ExcelProperty(value = "负责人电话")
private String principalPhone;
/**
* 发货单状态
*/
@ExcelProperty(value = "发货单状态")
private String waybillStatus;
/**
* 发货单备注
*/
@ExcelProperty(value = "发货单备注")
private String waybillRemark;
// ==================== 关联的钢卷信息 ====================
/**
* 入场钢卷号
*/
@ExcelProperty(value = "入场钢卷号")
private String enterCoilNo;
/**
* 当前钢卷号
*/
@ExcelProperty(value = "当前钢卷号")
private String currentCoilNo;
// 实际库区
@ExcelProperty(value = "实际库区")
private String actualWarehouseName;
/**
* 品名(如:冷硬钢卷、冷轧钢卷)
*/
@ExcelProperty(value = "品名", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "如=:冷硬钢卷、冷轧钢卷")
@ExcelProperty(value = "品名")
private String productName;
/**
* 切边(净边/毛边)
*/
@ExcelProperty(value = "切边", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "净=边/毛边")
@ExcelProperty(value = "切边")
private String edgeType;
/**
* 包装(裸包/简包1/精包2等
*/
@ExcelProperty(value = "包装", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "裸=包/简包1/精包2等")
@ExcelProperty(value = "包装")
private String packaging;
/**
* 结算方式(卷重/磅重)
*/
@ExcelProperty(value = "结算方式", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "卷=重/磅重")
@ExcelProperty(value = "结算方式")
private String settlementType;
/**
@@ -100,15 +183,13 @@ public class WmsDeliveryWaybillDetailVo extends BaseEntity {
/**
* 数量(件)
*/
@ExcelProperty(value = "数量", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "件=")
@ExcelProperty(value = "数量")
private Long quantity;
/**
* 重量kg
*/
@ExcelProperty(value = "重量", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "k=g")
@ExcelProperty(value = "重量")
private BigDecimal weight;
/**
@@ -123,5 +204,17 @@ public class WmsDeliveryWaybillDetailVo extends BaseEntity {
@ExcelProperty(value = "备注")
private String remark;
// ==================== 关联的发货计划信息 ====================
/**
* 计划ID
*/
private Long planId;
/**
* 计划日期
*/
private Date planDate;
}

View File

@@ -1,9 +1,12 @@
package com.klp.mapper;
import com.klp.domain.WmsDeliveryWaybillDetail;
import com.klp.domain.bo.WmsDeliveryWaybillDetailBo;
import com.klp.domain.vo.WmsCoilBindInfoVo;
import com.klp.domain.vo.WmsDeliveryWaybillDetailVo;
import com.klp.common.core.mapper.BaseMapperPlus;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
@@ -26,4 +29,14 @@ public interface WmsDeliveryWaybillDetailMapper extends BaseMapperPlus<WmsDelive
* 按钢卷ID查询绑定来源信息明细->发货单->发货计划)
*/
WmsCoilBindInfoVo selectBindInfoByCoilId(@Param("coilId") Long coilId);
/**
* 查询发货单明细列表(联查发货单、计划、钢卷信息)
*/
List<WmsDeliveryWaybillDetailVo> selectDetailVoList(@Param("bo") WmsDeliveryWaybillDetailBo bo);
/**
* 分页查询发货单明细列表(联查发货单、计划、钢卷信息)
*/
IPage<WmsDeliveryWaybillDetailVo> selectDetailVoPage(Page<WmsDeliveryWaybillDetailVo> page, @Param("bo") WmsDeliveryWaybillDetailBo bo);
}

View File

@@ -6,19 +6,19 @@ import com.klp.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.klp.common.utils.StringUtils;
import com.klp.common.exception.ServiceException;
import com.klp.common.utils.StringUtils;
import com.klp.domain.WmsDeliveryWaybill;
import com.klp.domain.WmsDeliveryWaybillDetail;
import com.klp.domain.WmsMaterialCoil;
import com.klp.mapper.WmsDeliveryWaybillDetailMapper;
import com.klp.mapper.WmsDeliveryWaybillMapper;
import com.klp.mapper.WmsMaterialCoilMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.klp.domain.bo.WmsDeliveryWaybillDetailBo;
import com.klp.domain.vo.WmsDeliveryWaybillDetailVo;
import com.klp.domain.WmsDeliveryWaybillDetail;
import com.klp.domain.vo.WmsCoilBindInfoVo;
import com.klp.mapper.WmsDeliveryWaybillDetailMapper;
import com.klp.mapper.WmsMaterialCoilMapper;
import com.klp.service.IWmsDeliveryWaybillDetailService;
import java.util.List;
@@ -78,8 +78,7 @@ public class WmsDeliveryWaybillDetailServiceImpl implements IWmsDeliveryWaybillD
*/
@Override
public List<WmsDeliveryWaybillDetailVo> queryList(WmsDeliveryWaybillDetailBo bo) {
LambdaQueryWrapper<WmsDeliveryWaybillDetail> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
return baseMapper.selectDetailVoList(bo);
}
private LambdaQueryWrapper<WmsDeliveryWaybillDetail> buildQueryWrapper(WmsDeliveryWaybillDetailBo bo) {
@@ -100,7 +99,6 @@ public class WmsDeliveryWaybillDetailServiceImpl implements IWmsDeliveryWaybillD
lqw.eq(bo.getUnitPrice() != null, WmsDeliveryWaybillDetail::getUnitPrice, bo.getUnitPrice());
return lqw;
}
/**
* 新增发货单明细
*/

View File

@@ -130,4 +130,121 @@
LIMIT 1
</select>
<resultMap type="com.klp.domain.vo.WmsDeliveryWaybillDetailVo" id="WmsDeliveryWaybillDetailVoResult">
<result property="detailId" column="detail_id"/>
<result property="waybillId" column="waybill_id"/>
<result property="coilId" column="coil_id"/>
<result property="productName" column="product_name"/>
<result property="edgeType" column="edge_type"/>
<result property="packaging" column="packaging"/>
<result property="settlementType" column="settlement_type"/>
<result property="rawMaterialFactory" column="raw_material_factory"/>
<result property="coilNo" column="coil_no"/>
<result property="specification" column="specification"/>
<result property="material" column="material"/>
<result property="quantity" column="quantity"/>
<result property="weight" column="weight"/>
<result property="unitPrice" column="unit_price"/>
<result property="remark" column="remark"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<!-- 钢卷信息 -->
<result property="enterCoilNo" column="enter_coil_no"/>
<result property="currentCoilNo" column="current_coil_no"/>
<result property="actualWarehouseName" column="actual_warehouse_name"/>
<!-- 发货单信息 -->
<result property="waybillNo" column="waybill_no"/>
<result property="waybillName" column="waybill_name"/>
<result property="licensePlate" column="license_plate"/>
<result property="consigneeUnit" column="consignee_unit"/>
<result property="senderUnit" column="sender_unit"/>
<result property="deliveryTime" column="delivery_time"/>
<result property="weighbridge" column="weighbridge"/>
<result property="salesPerson" column="sales_person"/>
<result property="principal" column="principal"/>
<result property="principalPhone" column="principal_phone"/>
<result property="waybillStatus" column="waybill_status"/>
<result property="waybillRemark" column="waybill_remark"/>
<!-- 发货计划信息 -->
<result property="planId" column="plan_id"/>
<result property="planName" column="plan_name"/>
<result property="planDate" column="plan_date"/>
</resultMap>
<select id="selectDetailVoList" resultMap="WmsDeliveryWaybillDetailVoResult">
SELECT
d.*,
c.enter_coil_no,
c.current_coil_no,
aw.actual_warehouse_name,
w.waybill_no,
w.waybill_name,
w.license_plate,
w.consignee_unit,
w.sender_unit,
w.delivery_time,
w.weighbridge,
w.sales_person,
w.principal,
w.principal_phone,
(CASE w.status WHEN 0 THEN '未发货' WHEN 1 THEN '已发货' WHEN 2 THEN '已打印' WHEN 3 THEN '未打印' ELSE '未知' END) AS waybill_status,
w.remark AS waybill_remark,
p.plan_id,
p.plan_name,
p.plan_date
FROM wms_delivery_waybill_detail d
LEFT JOIN wms_material_coil c ON c.coil_id = d.coil_id AND c.del_flag = 0
LEFT JOIN wms_actual_warehouse aw ON aw.actual_warehouse_id = c.actual_warehouse_id AND aw.del_flag = 0
LEFT JOIN wms_delivery_waybill w ON w.waybill_id = d.waybill_id AND w.del_flag = 0
LEFT JOIN wms_delivery_plan p ON p.plan_id = w.plan_id AND p.del_flag = 0
WHERE d.del_flag = 0
<if test="bo.waybillId != null">
AND d.waybill_id = #{bo.waybillId}
</if>
<if test="bo.coilId != null">
AND d.coil_id = #{bo.coilId}
</if>
<if test="bo.productName != null and bo.productName != ''">
AND d.product_name LIKE CONCAT('%', #{bo.productName}, '%')
</if>
<if test="bo.edgeType != null and bo.edgeType != ''">
AND d.edge_type = #{bo.edgeType}
</if>
<if test="bo.packaging != null and bo.packaging != ''">
AND d.packaging = #{bo.packaging}
</if>
<if test="bo.settlementType != null and bo.settlementType != ''">
AND d.settlement_type = #{bo.settlementType}
</if>
<if test="bo.rawMaterialFactory != null and bo.rawMaterialFactory != ''">
AND d.raw_material_factory = #{bo.rawMaterialFactory}
</if>
<if test="bo.coilNo != null and bo.coilNo != ''">
AND d.coil_no = #{bo.coilNo}
</if>
<if test="bo.specification != null and bo.specification != ''">
AND d.specification = #{bo.specification}
</if>
<if test="bo.material != null and bo.material != ''">
AND d.material = #{bo.material}
</if>
<if test="bo.quantity != null">
AND d.quantity = #{bo.quantity}
</if>
<if test="bo.weight != null">
AND d.weight = #{bo.weight}
</if>
<if test="bo.unitPrice != null">
AND d.unit_price = #{bo.unitPrice}
</if>
</select>
</mapper>