集成wms服务模块
This commit is contained in:
+387
@@ -0,0 +1,387 @@
|
||||
<?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.inventoryStandingDetail.repository.mapper.InventoryStandingDetailMapper">
|
||||
|
||||
<resultMap type="com.mhd.wms.domain.inventoryStandingDetail.repository.po.InventoryStandingDetailPO" id="InventoryStandingDetailResult">
|
||||
<result property="inventoryStandingDetailId" column="inventory_standing_detail_id" />
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="materialCode" column="material_code" />
|
||||
<result property="materialBarCode" column="material_bar_code" />
|
||||
<result property="trackingNumber" column="tracking_number" />
|
||||
<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" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createByName" column="create_by_name" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectInventoryStandingDetailPo">
|
||||
select inventory_standing_detail_id, material_name, material_code, material_bar_code, tracking_number, 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_detail
|
||||
where del_flag = 1
|
||||
</sql>
|
||||
|
||||
<sql id="selectInventoryStandingDetailPo1">
|
||||
<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="materialBarCode != null and materialBarCode != ''">
|
||||
and material_bar_code = #{materialBarCode}
|
||||
</if>
|
||||
<if test="trackingNumber != null and trackingNumber != ''">
|
||||
and tracking_number = #{trackingNumber}
|
||||
</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>
|
||||
<if test="createByName != null and createByName != ''">
|
||||
and create_by_name like concat('%', #{createByName}, '%')
|
||||
</if>
|
||||
<if test="updateByName != null and updateByName != ''">
|
||||
and update_by_name like concat('%', #{updateByName}, '%')
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.wms.domain.inventoryStandingDetail.repository.todo.InventoryStandingDetailDO" resultMap="InventoryStandingDetailResult">
|
||||
<include refid="selectInventoryStandingDetailPo"/>
|
||||
<include refid="selectInventoryStandingDetailPo1"/>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<resultMap type="com.mhd.wms.domain.statementStatistics.po.WarehousingReportPO" id="queryWarehousingReportListResult">
|
||||
|
||||
<result property="shipperName" column="shipper_name" />
|
||||
<result property="materialCode" column="material_code" />
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="materialBarCode" column="material_bar_code" />
|
||||
<result property="warehouseName" column="warehouse_name" />
|
||||
<result property="materialQuantity" column="material_quantity" />
|
||||
<result property="unitName" column="unit_name" />
|
||||
<result property="packName" column="pack_name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="inventoryIncreaseDecrease" column="inventoryIncreaseDecrease" />
|
||||
<result property="changeQuantity" column="changeQuantity" />
|
||||
<result property="outboundQuantity" column="outboundQuantity" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
<select id="queryWarehousingReportList" parameterType="com.mhd.wms.domain.statementStatistics.todo.WarehousingReportDO"
|
||||
resultMap="queryWarehousingReportListResult">
|
||||
select a.warehouse_name,
|
||||
b.shipper_name,
|
||||
a.material_name,
|
||||
a.material_code,
|
||||
a.material_bar_code,
|
||||
sum(a.material_quantity) material_quantity,
|
||||
b.unit_name,
|
||||
b.pack_name,
|
||||
DATE_FORMAT(a.create_time, '%Y-%m-%d') create_time
|
||||
from inventory_standing_detail a
|
||||
left join material_base_info b on a.material_code=b.material_code
|
||||
where a.node_status=2 and a.del_flag=1
|
||||
<if test="topOrganizationId != null ">
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
|
||||
<if test="shipperName != null and shipperName != ''">
|
||||
and b.shipper_name = #{shipperName}
|
||||
</if>
|
||||
|
||||
<if test="warehouseId != null and warehouseId != '' ">
|
||||
and a.warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
|
||||
<if test="warehouseName != null and warehouseName != '' ">
|
||||
and a.warehouse_name = #{warehouseName}
|
||||
</if>
|
||||
|
||||
<if test="materialName != null and materialName != '' ">
|
||||
and a.material_name = #{materialName}
|
||||
</if>
|
||||
<if test="materialCode != null and materialCode != '' ">
|
||||
and a.material_code = #{materialCode}
|
||||
</if>
|
||||
<if test="materialBarCode != null and materialBarCode != '' ">
|
||||
and a.material_bar_code = #{materialBarCode}
|
||||
</if>
|
||||
<if test="unitName != null and unitName != '' ">
|
||||
and b.unit_name = #{unitName}
|
||||
</if>
|
||||
<if test="packName != null and packName != '' ">
|
||||
and b.pack_name = #{packName}
|
||||
</if>
|
||||
|
||||
<if test="createTimeStart != null">
|
||||
and DATE_FORMAT(a.create_time, '%Y-%m-%d')>= #{createTimeStart}
|
||||
</if>
|
||||
<if test="createTimeEnd != null ">
|
||||
and DATE_FORMAT(a.create_time, '%Y-%m-%d') <= #{createTimeEnd}
|
||||
</if>
|
||||
GROUP BY a.material_code,DATE_FORMAT(a.create_time, '%Y-%m-%d')
|
||||
<if test="materialQuantityStart != null and materialQuantityEnd != null" >
|
||||
having sum(a.material_quantity)>= #{materialQuantityStart}
|
||||
and sum(a.material_quantity)<= #{materialQuantityEnd}
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
<select id="queryOutboundReportList" parameterType="com.mhd.wms.domain.statementStatistics.todo.WarehousingReportDO"
|
||||
resultMap="queryWarehousingReportListResult">
|
||||
select a.warehouse_name,
|
||||
b.shipper_name,
|
||||
a.material_name,
|
||||
a.material_code,
|
||||
a.material_bar_code,
|
||||
sum(a.material_quantity) material_quantity,
|
||||
b.unit_name,
|
||||
b.pack_name,
|
||||
DATE_FORMAT(a.create_time, '%Y-%m-%d') create_time
|
||||
from inventory_standing_detail a
|
||||
left join material_base_info b on a.material_code=b.material_code
|
||||
where a.node_status=3 and a.del_flag=1
|
||||
<if test="topOrganizationId != null ">
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
|
||||
<if test="shipperName != null and shipperName != ''">
|
||||
and b.shipper_name = #{shipperName}
|
||||
</if>
|
||||
|
||||
<if test="warehouseId != null and warehouseId != '' ">
|
||||
and a.warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
|
||||
<if test="warehouseName != null and warehouseName != '' ">
|
||||
and a.warehouse_name = #{warehouseName}
|
||||
</if>
|
||||
|
||||
<if test="materialName != null and materialName != '' ">
|
||||
and a.material_name = #{materialName}
|
||||
</if>
|
||||
<if test="materialCode != null and materialCode != '' ">
|
||||
and a.material_code = #{materialCode}
|
||||
</if>
|
||||
<if test="materialBarCode != null and materialBarCode != '' ">
|
||||
and a.material_bar_code = #{materialBarCode}
|
||||
</if>
|
||||
<if test="unitName != null and unitName != '' ">
|
||||
and b.unit_name = #{unitName}
|
||||
</if>
|
||||
<if test="packName != null and packName != '' ">
|
||||
and b.pack_name = #{packName}
|
||||
</if>
|
||||
|
||||
<if test="createTimeStart != null and createTimeStart != '' ">
|
||||
and DATE_FORMAT(a.create_time, '%Y-%m-%d')>= #{createTimeStart}
|
||||
</if>
|
||||
<if test="createTimeEnd != null and createTimeEnd != '' ">
|
||||
and DATE_FORMAT(a.create_time, '%Y-%m-%d') <= #{createTimeEnd}
|
||||
</if>
|
||||
GROUP BY
|
||||
a.material_code,DATE_FORMAT(a.create_time, '%Y-%m-%d')
|
||||
|
||||
<if test="materialQuantityStart != null and materialQuantityEnd != null" >
|
||||
having sum(a.material_quantity)>= #{materialQuantityStart}
|
||||
and sum(a.material_quantity)<= #{materialQuantityEnd}
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
<select id="queryWarehousingAndOutboundReportList" parameterType="com.mhd.wms.domain.statementStatistics.todo.WarehousingReportDO"
|
||||
resultMap="queryWarehousingReportListResult">
|
||||
SELECT
|
||||
a.warehouse_name,
|
||||
b.shipper_name,
|
||||
a.material_name,
|
||||
a.material_code,
|
||||
a.material_bar_code,
|
||||
b.unit_name,
|
||||
b.pack_name,
|
||||
DATE_FORMAT(a.create_time, '%Y-%m-%d') create_time,
|
||||
IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 2 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d')),
|
||||
0
|
||||
) material_quantity,
|
||||
IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 3 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d') ),
|
||||
0
|
||||
) outboundQuantity,
|
||||
ABS(
|
||||
IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 2 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d')),
|
||||
0
|
||||
) - IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 3 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d')),
|
||||
0
|
||||
)
|
||||
) changeQuantity,
|
||||
(
|
||||
CASE
|
||||
|
||||
WHEN IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 2 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d') ),
|
||||
0
|
||||
)> IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 3 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d') ),
|
||||
0
|
||||
) THEN
|
||||
'增加'
|
||||
WHEN IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 2 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d')),
|
||||
0
|
||||
) < IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 3 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d') ),
|
||||
0
|
||||
) THEN
|
||||
'减少' ELSE '不变'
|
||||
END
|
||||
) inventoryIncreaseDecrease
|
||||
FROM
|
||||
inventory_standing_detail a
|
||||
LEFT JOIN material_base_info b ON a.material_code = b.material_code
|
||||
WHERE
|
||||
a.node_status IN ( 2, 3 )
|
||||
AND a.del_flag = 1
|
||||
|
||||
<if test="topOrganizationId != null ">
|
||||
and a.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="shipperName != null and shipperName != ''">
|
||||
and b.shipper_name = #{shipperName}
|
||||
</if>
|
||||
|
||||
<if test="warehouseId != null and warehouseId != '' ">
|
||||
and a.warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
|
||||
<if test="warehouseName != null and warehouseName != '' ">
|
||||
and a.warehouse_name = #{warehouseName}
|
||||
</if>
|
||||
|
||||
<if test="materialName != null and materialName != '' ">
|
||||
and a.material_name = #{materialName}
|
||||
</if>
|
||||
<if test="materialCode != null and materialCode != '' ">
|
||||
and a.material_code = #{materialCode}
|
||||
</if>
|
||||
<if test="materialBarCode != null and materialBarCode != '' ">
|
||||
and a.material_bar_code = #{materialBarCode}
|
||||
</if>
|
||||
<if test="unitName != null and unitName != '' ">
|
||||
and b.unit_name = #{unitName}
|
||||
</if>
|
||||
<if test="packName != null and packName != '' ">
|
||||
and b.pack_name = #{packName}
|
||||
</if>
|
||||
|
||||
<if test="materialQuantityStart != null">
|
||||
and IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 2 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d')),
|
||||
0
|
||||
)>= #{materialQuantityStart}
|
||||
</if>
|
||||
<if test="materialQuantityEnd != null">
|
||||
and IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 2 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d')),
|
||||
0
|
||||
) <= #{materialQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="outboundQuantityStart != null">
|
||||
and IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 3 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d') ),
|
||||
0
|
||||
)>= #{outboundQuantityStart}
|
||||
</if>
|
||||
<if test="outboundQuantityEnd != null">
|
||||
and IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 3 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d') ),
|
||||
0
|
||||
) <= #{outboundQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="changeQuantityStart != null">
|
||||
and ABS(
|
||||
IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 2 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d')),
|
||||
0
|
||||
) - IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 3 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d')),
|
||||
0
|
||||
)
|
||||
) >= #{changeQuantityStart}
|
||||
</if>
|
||||
<if test="changeQuantityEnd != null">
|
||||
and ABS(
|
||||
IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 2 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d')),
|
||||
0
|
||||
) - IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 3 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d')),
|
||||
0
|
||||
)
|
||||
) <= #{changeQuantityEnd}
|
||||
</if>
|
||||
|
||||
<if test="inventoryincreaseDecrease != null and inventoryincreaseDecrease != '' and inventoryincreaseDecrease=='增加' ">
|
||||
and IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 2 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d') ),
|
||||
0
|
||||
)> IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 3 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d') ),
|
||||
0
|
||||
)
|
||||
</if>
|
||||
<if test="inventoryincreaseDecrease != null and inventoryincreaseDecrease != '' and inventoryincreaseDecrease=='减少' ">
|
||||
and IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 2 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d')),
|
||||
0
|
||||
) < IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 3 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d') ),
|
||||
0
|
||||
)
|
||||
</if>
|
||||
<if test="inventoryincreaseDecrease != null and inventoryincreaseDecrease != '' and inventoryincreaseDecrease=='不变' ">
|
||||
and IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 2 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d')),
|
||||
0
|
||||
) = IFNULL(
|
||||
( SELECT sum( material_quantity ) FROM inventory_standing_detail c WHERE c.node_status = 3 AND DATE_FORMAT(c.create_time, '%Y-%m-%d')= DATE_FORMAT(a.create_time, '%Y-%m-%d') ),
|
||||
0
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="createTimeStart != null and createTimeStart != '' ">
|
||||
and DATE_FORMAT(a.create_time, '%Y-%m-%d')>= #{createTimeStart}
|
||||
</if>
|
||||
<if test="createTimeEnd != null and createTimeEnd != '' ">
|
||||
and DATE_FORMAT(a.create_time, '%Y-%m-%d') <= #{createTimeEnd}
|
||||
</if>
|
||||
GROUP BY
|
||||
a.material_code,DATE_FORMAT(a.create_time, '%Y-%m-%d')
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user