集成wms服务模块
This commit is contained in:
+285
@@ -0,0 +1,285 @@
|
||||
<?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.mhd.wms.domain.inventoryStandingReport.repository.mapper.InventoryStandingReportMapper">
|
||||
|
||||
<resultMap type="com.mhd.wms.domain.inventoryStandingReport.repository.po.InventoryStandingReportPO" id="InventoryStandingReportResult">
|
||||
<result property="materialCode" column="material_code" />
|
||||
<result property="barCode" column="bar_code" />
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="shipperId" column="shipper_id" />
|
||||
<result property="shipperName" column="shipper_name" />
|
||||
<result property="warehouseId" column="warehouse_id" />
|
||||
<result property="warehouseCode" column="warehouse_code" />
|
||||
<result property="warehouseName" column="warehouse_name" />
|
||||
<result property="nodeStatus" column="node_status" />
|
||||
<result property="materialQuantity" column="material_quantity" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.mhd.wms.domain.inventoryStandingReport.repository.po.InventoryStandingDetailReportPO" id="InventoryStandingDetailReportResult">
|
||||
<result property="businessNo" column="business_no" />
|
||||
<result property="sourceNo" column="source_no" />
|
||||
<result property="quantity" column="quantity" />
|
||||
<result property="workQuantity" column="work_quantity" />
|
||||
<result property="abnormal" column="abnormal" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInventoryStandingReportPo">
|
||||
select inventory_standing_id, material_name, material_code, bar_code, shipper_id, shipper_name, warehouse_id, warehouse_code, warehouse_name, node_status, material_quantity, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from inventory_standing_report
|
||||
where del_flag = 1
|
||||
</sql>
|
||||
|
||||
<sql id="selectInventoryStandingReportPo2">
|
||||
SELECT
|
||||
material_base_info_id,
|
||||
bar_code,
|
||||
material_code,
|
||||
material_name,
|
||||
shipper_id,
|
||||
shipper_name,
|
||||
warehouse_id,
|
||||
warehouse_code,
|
||||
warehouse_name,
|
||||
organization_id,
|
||||
top_organization_id,
|
||||
node_status,
|
||||
node_name,
|
||||
material_quantity
|
||||
FROM
|
||||
(
|
||||
(
|
||||
SELECT
|
||||
rmd.material_base_info_id,
|
||||
rmd.bar_code,
|
||||
rmd.material_code,
|
||||
rmd.material_name,
|
||||
sio1.shipper_id,
|
||||
sio1.shipper_name,
|
||||
sio1.warehouse_id,
|
||||
sio1.warehouse_code,
|
||||
sio1.warehouse_name,
|
||||
sio1.organization_id,
|
||||
sio1.top_organization_id,
|
||||
1 AS node_status,
|
||||
"收货" AS node_name,
|
||||
SUM( rmd.quantity ) AS material_quantity
|
||||
FROM
|
||||
receipt_material_detail rmd
|
||||
LEFT JOIN stock_receipt_order sro1 ON sro1.receipt_order_number = rmd.receipt_order_number
|
||||
LEFT JOIN stock_in_order sio1 ON sro1.in_order_number = sio1.in_order_number
|
||||
WHERE
|
||||
rmd.receipt_status IN ( 1, 2 )
|
||||
GROUP BY
|
||||
rmd.material_base_info_id,
|
||||
sio1.shipper_id,
|
||||
sio1.warehouse_id
|
||||
) UNION ALL
|
||||
(
|
||||
SELECT
|
||||
smd.material_base_info_id,
|
||||
smd.bar_code,
|
||||
smd.material_code,
|
||||
smd.material_name,
|
||||
sio2.shipper_id,
|
||||
sio2.shipper_name,
|
||||
sio2.warehouse_id,
|
||||
sio2.warehouse_code,
|
||||
sio2.warehouse_name,
|
||||
sio2.organization_id,
|
||||
sio2.top_organization_id,
|
||||
2 AS node_status,
|
||||
"上架" AS node_name,
|
||||
SUM( smd.quantity ) AS material_quantity
|
||||
FROM
|
||||
shelf_material_detail smd
|
||||
LEFT JOIN stock_shelf_order sso ON sso.shelf_order_number = smd.shelf_order_number
|
||||
LEFT JOIN stock_in_order sio2 ON sso.in_order_number = sio2.in_order_number
|
||||
WHERE
|
||||
smd.shelves_status IN ( 1, 2 )
|
||||
GROUP BY
|
||||
smd.material_base_info_id,
|
||||
sio2.shipper_id,
|
||||
sio2.warehouse_id
|
||||
) UNION ALL
|
||||
(
|
||||
SELECT
|
||||
pmd.material_base_info_id,
|
||||
pmd.bar_code,
|
||||
pmd.material_code,
|
||||
pmd.material_name,
|
||||
po.shipper_id,
|
||||
po.shipper_name,
|
||||
po.warehouse_id,
|
||||
po.warehouse_code,
|
||||
po.warehouse_name,
|
||||
po.organization_id,
|
||||
po.top_organization_id,
|
||||
3 AS node_status,
|
||||
"拣货" AS node_name,
|
||||
SUM( pmd.quantity ) AS material_quantity
|
||||
FROM
|
||||
picking_material_detail pmd
|
||||
LEFT JOIN picking_order po ON po.picking_order_number = pmd.picking_order_number
|
||||
WHERE
|
||||
po.STATUS IN ( 1, 2 )
|
||||
GROUP BY
|
||||
pmd.material_base_info_id,
|
||||
po.shipper_id,
|
||||
po.warehouse_id
|
||||
) UNION ALL
|
||||
(
|
||||
SELECT
|
||||
omd.material_base_info_id,
|
||||
omd.bar_code,
|
||||
omd.material_code,
|
||||
omd.material_name,
|
||||
soo.shipper_id,
|
||||
soo.shipper_name,
|
||||
soo.warehouse_id,
|
||||
soo.warehouse_code,
|
||||
soo.warehouse_name,
|
||||
soo.organization_id,
|
||||
soo.top_organization_id,
|
||||
4 AS node_status,
|
||||
"复核" AS node_name,
|
||||
SUM( omd.quantity ) AS material_quantity
|
||||
FROM
|
||||
out_material_detail omd
|
||||
LEFT JOIN stock_out_order soo ON soo.out_order_number = omd.out_order_number
|
||||
WHERE
|
||||
soo.STATUS IN ( 7, 8 )
|
||||
GROUP BY
|
||||
omd.material_base_info_id,
|
||||
soo.shipper_id,
|
||||
soo.warehouse_id
|
||||
)
|
||||
) AS a
|
||||
where 1 = 1
|
||||
</sql>
|
||||
|
||||
<sql id="selectInventoryStandingReportPo1">
|
||||
<if test="organizationId != null ">
|
||||
and a.organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="topOrganizationId != null ">
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="materialName != null and materialName != ''">
|
||||
and material_name like concat('%', #{materialName}, '%')
|
||||
</if>
|
||||
<if test="materialCode != null and materialCode != ''">
|
||||
and material_code = #{materialCode}
|
||||
</if>
|
||||
<if test="barCode != null and barCode != ''">
|
||||
and bar_code = #{barCode}
|
||||
</if>
|
||||
<if test="shipperId != null ">
|
||||
and shipper_id = #{shipperId}
|
||||
</if>
|
||||
<if test="shipperName != null and shipperName != ''">
|
||||
and shipper_name like concat('%', #{shipperName}, '%')
|
||||
</if>
|
||||
<if test="warehouseId != null ">
|
||||
and warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
and warehouse_code = #{warehouseCode}
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
and warehouse_name like concat('%', #{warehouseName}, '%')
|
||||
</if>
|
||||
<if test="nodeStatus != null ">
|
||||
and node_status = #{nodeStatus}
|
||||
</if>
|
||||
<if test="materialQuantity != null ">
|
||||
and material_quantity = #{materialQuantity}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.wms.domain.inventoryStandingReport.repository.todo.InventoryStandingReportDO" resultMap="InventoryStandingReportResult">
|
||||
<include refid="selectInventoryStandingReportPo"/>
|
||||
<include refid="selectInventoryStandingReportPo1"/>
|
||||
</select>
|
||||
|
||||
<select id="queryListForRealTime" parameterType="com.mhd.wms.domain.inventoryStandingReport.repository.todo.InventoryStandingReportDO" resultMap="InventoryStandingReportResult">
|
||||
<include refid="selectInventoryStandingReportPo2"/>
|
||||
<include refid="selectInventoryStandingReportPo1"/>
|
||||
ORDER BY
|
||||
material_base_info_id
|
||||
</select>
|
||||
|
||||
<select id="getInfoForReceipt" parameterType="com.mhd.wms.domain.inventoryStandingReport.repository.todo.InventoryStandingReportDO" resultMap="InventoryStandingDetailReportResult">
|
||||
SELECT
|
||||
rmd.receipt_order_number AS business_no,
|
||||
sio.in_order_number AS source_no,
|
||||
rmd.quantity,
|
||||
rmd.receipt_quantity AS work_quantity,
|
||||
sro.abnormal
|
||||
FROM
|
||||
receipt_material_detail rmd
|
||||
LEFT JOIN stock_receipt_order sro ON sro.receipt_order_number = rmd.receipt_order_number
|
||||
LEFT JOIN stock_in_order sio ON sro.in_order_number = sio.in_order_number
|
||||
WHERE
|
||||
sro.status IN ( 1, 2 )
|
||||
<include refid="whereForGetInfo"/>
|
||||
</select>
|
||||
|
||||
<sql id="whereForGetInfo">
|
||||
<if test="materialCode != null and materialCode != ''">
|
||||
and rmd.material_code = #{materialCode}
|
||||
</if>
|
||||
<if test="shipperId != null and shipperId != ''">
|
||||
and sio.shipper_id = #{shipperId}
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
and sio.warehouse_code = #{warehouseCode}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getInfoForShelf" parameterType="com.mhd.wms.domain.inventoryStandingReport.repository.todo.InventoryStandingReportDO" resultMap="InventoryStandingDetailReportResult">
|
||||
SELECT
|
||||
rmd.shelf_order_number AS business_no,
|
||||
sso.in_order_number AS source_no,
|
||||
rmd.quantity,
|
||||
rmd.shelves_quantity AS work_quantity,
|
||||
sso.abnormal
|
||||
FROM
|
||||
shelf_material_detail rmd
|
||||
LEFT JOIN stock_shelf_order sso ON sso.shelf_order_number = rmd.shelf_order_number
|
||||
LEFT JOIN stock_in_order sio ON sso.in_order_number = sio.in_order_number
|
||||
WHERE
|
||||
sso.STATUS IN (
|
||||
1,
|
||||
2
|
||||
)
|
||||
<include refid="whereForGetInfo"/>
|
||||
</select>
|
||||
|
||||
<select id="getInfoForPick" parameterType="com.mhd.wms.domain.inventoryStandingReport.repository.todo.InventoryStandingReportDO" resultMap="InventoryStandingDetailReportResult">
|
||||
SELECT
|
||||
rmd.picking_order_number AS business_no,
|
||||
sio.order_number AS source_no,
|
||||
rmd.quantity,
|
||||
rmd.picking_quantity AS work_quantity,
|
||||
sio.abnormal
|
||||
FROM
|
||||
picking_material_detail rmd
|
||||
LEFT JOIN picking_order sio ON sio.picking_order_number = rmd.picking_order_number
|
||||
WHERE
|
||||
sio.STATUS IN ( 1, 2 )
|
||||
<include refid="whereForGetInfo"/>
|
||||
</select>
|
||||
<select id="getInfoForReCheck" parameterType="com.mhd.wms.domain.inventoryStandingReport.repository.todo.InventoryStandingReportDO" resultMap="InventoryStandingDetailReportResult">
|
||||
SELECT
|
||||
rmd.out_order_number AS business_no,
|
||||
rmd.quantity,
|
||||
rmd.check_quantity AS work_quantity
|
||||
FROM
|
||||
out_material_detail rmd
|
||||
LEFT JOIN stock_out_order sio ON sio.out_order_number = rmd.out_order_number
|
||||
WHERE
|
||||
sio.STATUS IN ( 7, 8 )
|
||||
<include refid="whereForGetInfo"/>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user