- 在WmsDeliveryWaybillDetailVo中新增exportTime字段用于实际发货时间 - 将deliveryTime字段的Excel导出标签从发货时间改为配卷时间 - 在数据库映射文件中添加exportTime字段的映射关系 - 在查询语句中加入export_time字段以支持实际发货时间数据获取
275 lines
12 KiB
XML
275 lines
12 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.klp.mapper.WmsDeliveryWaybillDetailMapper">
|
|
|
|
<resultMap type="com.klp.domain.WmsDeliveryWaybillDetail" id="WmsDeliveryWaybillDetailResult">
|
|
<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="delFlag" column="del_flag"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
</resultMap>
|
|
|
|
<resultMap type="com.klp.domain.vo.WmsCoilBindInfoVo" id="WmsCoilBindInfoResult">
|
|
<result property="coilId" column="coil_id"/>
|
|
<result property="detailId" column="detail_id"/>
|
|
|
|
<!-- 发货计划 -->
|
|
<result property="planId" column="plan_id"/>
|
|
<result property="planName" column="plan_name"/>
|
|
<result property="planDate" column="plan_date"/>
|
|
|
|
<!-- 发货单主表 -->
|
|
<result property="waybillId" column="waybill_id"/>
|
|
<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="status"/>
|
|
<result property="waybillRemark" column="remark"/>
|
|
|
|
<!-- 发货单明细补充字段 -->
|
|
<result property="detailSettlementType" column="settlement_type"/>
|
|
<result property="detailUnitPrice" column="unit_price"/>
|
|
</resultMap>
|
|
|
|
<select id="selectBindInfoByCoilIds" resultMap="WmsCoilBindInfoResult">
|
|
SELECT
|
|
d.coil_id,
|
|
d.detail_id,
|
|
|
|
-- 发货单主表
|
|
w.waybill_id,
|
|
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,
|
|
w.status,
|
|
w.remark,
|
|
|
|
-- 发货计划
|
|
p.plan_id,
|
|
p.plan_name,
|
|
p.plan_date,
|
|
|
|
-- 发货单明细补充字段
|
|
d.settlement_type,
|
|
d.unit_price
|
|
FROM wms_delivery_waybill_detail d
|
|
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
|
|
AND d.coil_id IN
|
|
<foreach collection="coilIds" item="id" open="(" close=")" separator=",">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id="selectBindInfoByCoilId" resultMap="WmsCoilBindInfoResult">
|
|
SELECT
|
|
d.coil_id,
|
|
d.detail_id,
|
|
|
|
-- 发货单主表
|
|
w.waybill_id,
|
|
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,
|
|
w.status,
|
|
w.remark,
|
|
|
|
-- 发货计划
|
|
p.plan_id,
|
|
p.plan_name,
|
|
p.plan_date,
|
|
|
|
-- 发货单明细补充字段
|
|
d.settlement_type,
|
|
d.unit_price
|
|
FROM wms_delivery_waybill_detail d
|
|
INNER JOIN wms_delivery_waybill w ON w.waybill_id = d.waybill_id AND w.del_flag = 0
|
|
INNER JOIN wms_delivery_plan p ON p.plan_id = w.plan_id AND p.del_flag = 0
|
|
WHERE d.del_flag = 0
|
|
AND d.coil_id = #{coilId}
|
|
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="exportTime" column="export_time"/>
|
|
|
|
<!-- 发货单信息 -->
|
|
<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"/>
|
|
|
|
<!-- 原材料/产品信息 -->
|
|
<result property="itemName" column="item_name"/>
|
|
<result property="itemSpecification" column="item_specification"/>
|
|
<result property="itemMaterial" column="item_material"/>
|
|
<result property="manufacturer" column="item_manufacturer"/>
|
|
<result property="itemSurfaceTreatmentDesc" column="item_surface_treatment_desc"/>
|
|
<result property="itemZincLayer" column="item_zinc_layer"/>
|
|
</resultMap>
|
|
|
|
<select id="selectDetailVoList" resultMap="WmsDeliveryWaybillDetailVoResult">
|
|
SELECT
|
|
d.*,
|
|
|
|
c.enter_coil_no,
|
|
c.current_coil_no,
|
|
c.export_time,
|
|
aw.actual_warehouse_name,
|
|
(CASE c.status WHEN 0 THEN '在库' WHEN 1 THEN '在途' WHEN 2 THEN '已出库' ELSE CAST(c.status AS CHAR) END) AS status_desc,
|
|
|
|
(CASE WHEN c.item_type = 'raw_material' THEN rm.raw_material_name WHEN c.item_type = 'product' THEN pdt.product_name ELSE NULL END) AS item_name,
|
|
(CASE WHEN c.item_type = 'raw_material' THEN rm.specification WHEN c.item_type = 'product' THEN pdt.specification ELSE NULL END) AS item_specification,
|
|
(CASE WHEN c.item_type = 'raw_material' THEN rm.material WHEN c.item_type = 'product' THEN pdt.material ELSE NULL END) AS item_material,
|
|
(CASE WHEN c.item_type = 'raw_material' THEN rm.manufacturer WHEN c.item_type = 'product' THEN pdt.manufacturer ELSE NULL END) AS item_manufacturer,
|
|
(CASE WHEN c.item_type = 'raw_material' THEN rm.surface_treatment_desc WHEN c.item_type = 'product' THEN pdt.surface_treatment_desc ELSE NULL END) AS item_surface_treatment_desc,
|
|
(CASE WHEN c.item_type = 'raw_material' THEN rm.zinc_layer WHEN c.item_type = 'product' THEN pdt.zinc_layer ELSE NULL END) AS item_zinc_layer,
|
|
|
|
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_raw_material rm ON c.item_type = 'raw_material' AND c.item_id = rm.raw_material_id AND rm.del_flag = 0
|
|
LEFT JOIN wms_product pdt ON c.item_type = 'product' AND c.item_id = pdt.product_id AND pdt.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>
|
|
<if test="bo.planId != null">
|
|
AND w.plan_id = #{bo.planId}
|
|
</if>
|
|
</select>
|
|
|
|
|
|
</mapper>
|