|
@@ -3,81 +3,104 @@
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.tld.mapper.QueryListMapper">
|
|
<mapper namespace="com.tld.mapper.QueryListMapper">
|
|
|
<!-- 呆滞品查询 -->
|
|
<!-- 呆滞品查询 -->
|
|
|
- <select id="dullGoods" resultType="java.util.Map">
|
|
|
|
|
- SELECT
|
|
|
|
|
- a.id as id,
|
|
|
|
|
- a.material_id as materialId,
|
|
|
|
|
- a.amount as amount,
|
|
|
|
|
- a.scrq as scrq,
|
|
|
|
|
- a.storage_location_code as storageLocationCode,
|
|
|
|
|
- b.name as materialName,
|
|
|
|
|
- c.storage_location_name as storageLocationName,
|
|
|
|
|
- b.code as wllbCode,
|
|
|
|
|
- a.wbs as wbs
|
|
|
|
|
- FROM tld_inventory a
|
|
|
|
|
- JOIN tld_material b ON a.material_id = b.tld_id
|
|
|
|
|
- LEFT JOIN tld_storage_location c ON a.storage_location_code = c.storage_location_code
|
|
|
|
|
- WHERE datediff(now(), a.scrq) <![CDATA[>]]> 90
|
|
|
|
|
|
|
+ <select id="dullGoods" resultType="java.util.Map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.id as id,
|
|
|
|
|
+ a.material_id as materialId,
|
|
|
|
|
+ a.amount as amount,
|
|
|
|
|
+ a.scrq as scrq,
|
|
|
|
|
+ a.storage_location_code as storageLocationCode,
|
|
|
|
|
+ b.name as materialName,
|
|
|
|
|
+ c.storage_location_name as storageLocationName,
|
|
|
|
|
+ b.code as wllbCode,
|
|
|
|
|
+ a.wbs as wbs,
|
|
|
|
|
+ e.name as ustomerName,
|
|
|
|
|
+ f.name as companyName
|
|
|
|
|
+ FROM tld_inventory a
|
|
|
|
|
+ JOIN tld_material b ON a.material_id = b.tld_id
|
|
|
|
|
+ LEFT JOIN tld_storage_location c ON a.storage_location_code = c.storage_location_code
|
|
|
|
|
+ LEFT JOIN tld_customer e ON a.supplier_id = e.code
|
|
|
|
|
+ LEFT JOIN tld_company f ON a.account_sleeve = f.code
|
|
|
|
|
+ WHERE datediff(now(), a.scrq) <![CDATA[>]]> 90
|
|
|
<if test="storageLocationCode != null and storageLocationCode != ''">
|
|
<if test="storageLocationCode != null and storageLocationCode != ''">
|
|
|
and a.storage_location_code = #{storageLocationCode}
|
|
and a.storage_location_code = #{storageLocationCode}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
|
|
+ and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
|
|
+ </if>
|
|
|
<if test="wllbCode != null and wllbCode != ''">
|
|
<if test="wllbCode != null and wllbCode != ''">
|
|
|
- and b.code = #{wllbCode}
|
|
|
|
|
|
|
+ and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="wbs != null and wbs != ''">
|
|
|
|
|
+ and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
|
|
|
</if>
|
|
</if>
|
|
|
- </select>
|
|
|
|
|
|
|
+ <if test="storageLocationName != null and storageLocationName != ''">
|
|
|
|
|
+ and c.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="ustomerCode != null and ustomerCode != ''">
|
|
|
|
|
+ and a.supplier_id = #{ustomerCode}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="companyCode != null and companyCode != ''">
|
|
|
|
|
+ and a.account_sleeve = #{companyCode}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
<!-- 查询所有物料 -->
|
|
<!-- 查询所有物料 -->
|
|
|
<select id="getMaterial" resultType="java.util.Map">
|
|
<select id="getMaterial" resultType="java.util.Map">
|
|
|
select
|
|
select
|
|
|
- tld_id as tldId,
|
|
|
|
|
- ifnull(min_num, 0) as minNum,
|
|
|
|
|
- ifnull(max_num, 0) as maxNum,
|
|
|
|
|
- name as name,
|
|
|
|
|
- code as code
|
|
|
|
|
|
|
+ tld_id as tldId,
|
|
|
|
|
+ ifnull(min_num, 0) as minNum,
|
|
|
|
|
+ ifnull(max_num, 0) as maxNum,
|
|
|
|
|
+ name as name,
|
|
|
|
|
+ code as code
|
|
|
from tld_material
|
|
from tld_material
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="wllbCode != null and wllbCode != ''">
|
|
<if test="wllbCode != null and wllbCode != ''">
|
|
|
- and code = #{wllbCode}
|
|
|
|
|
|
|
+ and code like CONCAT(CONCAT('%', #{wllbCode}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
|
|
+ and name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
</if>
|
|
</if>
|
|
|
</trim>
|
|
</trim>
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 物料储量预警查询 -->
|
|
<!-- 物料储量预警查询 -->
|
|
|
<select id="reserveWarning" resultType="java.util.Map" parameterType="java.util.Map">
|
|
<select id="reserveWarning" resultType="java.util.Map" parameterType="java.util.Map">
|
|
|
- SELECT
|
|
|
|
|
- ifnull(sum( a.amount ), "0" ) as amount,
|
|
|
|
|
- ${tldId} as materialId,
|
|
|
|
|
- ${minNum} as minNum,
|
|
|
|
|
- ${maxNum} as maxNum
|
|
|
|
|
|
|
+ SELECT ifnull(sum(a.amount), "0") as amount,
|
|
|
|
|
+ ${tldId} as materialId,
|
|
|
|
|
+ ${minNum} as minNum,
|
|
|
|
|
+ ${maxNum} as maxNum
|
|
|
FROM tld_inventory a
|
|
FROM tld_inventory a
|
|
|
- LEFT JOIN tld_material b ON a.material_id = b.tld_id
|
|
|
|
|
|
|
+ LEFT JOIN tld_material b ON a.material_id = b.tld_id
|
|
|
WHERE material_id = #{tldId}
|
|
WHERE material_id = #{tldId}
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 查询库位信息 -->
|
|
<!-- 查询库位信息 -->
|
|
|
<select id="storageLocation" resultType="java.util.Map">
|
|
<select id="storageLocation" resultType="java.util.Map">
|
|
|
SELECT
|
|
SELECT
|
|
|
- a.storage_location_code as storageLocationCode,
|
|
|
|
|
- a.material_id as materialId,
|
|
|
|
|
- sum( a.amount ) AS sum,
|
|
|
|
|
- a.serial,
|
|
|
|
|
- a.wbs as wbs,
|
|
|
|
|
- a.produc_batch as producBatch,
|
|
|
|
|
- a.supplier_id as supplierId,
|
|
|
|
|
- b.storage_location_name as storageLocationName ,
|
|
|
|
|
- b.warehouse_where as warehouseWhere,
|
|
|
|
|
- b.storage_location_type as storageLocationType,
|
|
|
|
|
- b.storage_location_capacity as storageLocationCapacity,
|
|
|
|
|
- b.is_not_disable as isNotDisable,
|
|
|
|
|
- b.create_time as createTime,
|
|
|
|
|
- b.is_product as isProduct,
|
|
|
|
|
- c.name as name,
|
|
|
|
|
- c.code as code,
|
|
|
|
|
- e.name as supplierName,
|
|
|
|
|
- f.name as warehouseName
|
|
|
|
|
|
|
+ a.storage_location_code as storageLocationCode,
|
|
|
|
|
+ a.material_id as materialId,
|
|
|
|
|
+ sum( a.amount ) AS sum,
|
|
|
|
|
+ a.serial,
|
|
|
|
|
+ a.wbs as wbs,
|
|
|
|
|
+ a.produc_batch as producBatch,
|
|
|
|
|
+ a.supplier_id as supplierId,
|
|
|
|
|
+ b.storage_location_name as storageLocationName ,
|
|
|
|
|
+ b.warehouse_where as warehouseWhere,
|
|
|
|
|
+ b.storage_location_type as storageLocationType,
|
|
|
|
|
+ b.storage_location_capacity as storageLocationCapacity,
|
|
|
|
|
+ b.is_not_disable as isNotDisable,
|
|
|
|
|
+ b.create_time as createTime,
|
|
|
|
|
+ b.is_product as isProduct,
|
|
|
|
|
+ c.name as name,
|
|
|
|
|
+ c.code as code,
|
|
|
|
|
+ e.name as supplierName,
|
|
|
|
|
+ f.name as warehouseName,
|
|
|
|
|
+ p.name as companyName
|
|
|
FROM
|
|
FROM
|
|
|
- tld_inventory a
|
|
|
|
|
- LEFT JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
|
|
|
|
|
- LEFT JOIN tld_material c ON a.material_id = c.tld_id
|
|
|
|
|
- LEFT JOIN tld_customer e ON a.supplier_id = e.code
|
|
|
|
|
- LEFT JOIN tld_warehouse f on b.warehouse_where = f.tld_id
|
|
|
|
|
|
|
+ tld_inventory a
|
|
|
|
|
+ LEFT JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
|
|
|
|
|
+ LEFT JOIN tld_material c ON a.material_id = c.tld_id
|
|
|
|
|
+ LEFT JOIN tld_customer e ON a.supplier_id = e.code
|
|
|
|
|
+ LEFT JOIN tld_warehouse f on b.warehouse_where = f.tld_id
|
|
|
|
|
+ LEFT JOIN tld_company p on a.account_sleeve = p.code
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="storageLocationCode != null and storageLocationCode != ''">
|
|
<if test="storageLocationCode != null and storageLocationCode != ''">
|
|
|
and a.storage_location_code = #{storageLocationCode}
|
|
and a.storage_location_code = #{storageLocationCode}
|
|
@@ -85,30 +108,48 @@
|
|
|
<if test="materialId != null and materialId != ''">
|
|
<if test="materialId != null and materialId != ''">
|
|
|
and a.material_id = #{materialId}
|
|
and a.material_id = #{materialId}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="wllbCode != null and wllbCode != ''">
|
|
|
|
|
+ and c.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
|
|
+ and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="storageLocationName != null and storageLocationName != ''">
|
|
|
|
|
+ and b.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
|
|
+ and p.name like CONCAT(CONCAT('%', #{companyName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="supplierId != null and supplierId != ''">
|
|
|
|
|
+ and a.supplier_id like CONCAT(CONCAT('%', #{supplierId}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="wbs != null and wbs != ''">
|
|
|
|
|
+ and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
|
|
|
|
|
+ </if>
|
|
|
</trim>
|
|
</trim>
|
|
|
GROUP BY
|
|
GROUP BY
|
|
|
- a.storage_location_code,
|
|
|
|
|
- a.material_id
|
|
|
|
|
|
|
+ a.storage_location_code,
|
|
|
|
|
+ a.material_id
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 查询库位信息 -->
|
|
<!-- 查询库位信息 -->
|
|
|
<select id="getQueryInventory" resultType="java.util.Map">
|
|
<select id="getQueryInventory" resultType="java.util.Map">
|
|
|
SELECT
|
|
SELECT
|
|
|
- a.storage_location_code as storageLocationCode,
|
|
|
|
|
- a.material_id as materialId,
|
|
|
|
|
- a.amount AS sum,
|
|
|
|
|
- a.serial,
|
|
|
|
|
- a.produc_batch as producBatch,
|
|
|
|
|
- a.supplier_id as supplierId,
|
|
|
|
|
- b.storage_location_name as storageLocationName ,
|
|
|
|
|
- b.warehouse_where as warehouseWhere,
|
|
|
|
|
- b.storage_location_type as storageLocationType,
|
|
|
|
|
- b.storage_location_capacity as storageLocationCapacity,
|
|
|
|
|
- b.is_not_disable as isNotDisable,
|
|
|
|
|
- b.create_time as createTime,
|
|
|
|
|
- b.is_product as isProduct,
|
|
|
|
|
- c.name as name,
|
|
|
|
|
- c.code as code,
|
|
|
|
|
- e.name as supplierName
|
|
|
|
|
|
|
+ a.storage_location_code as storageLocationCode,
|
|
|
|
|
+ a.material_id as materialId,
|
|
|
|
|
+ a.amount AS sum,
|
|
|
|
|
+ a.serial,
|
|
|
|
|
+ a.produc_batch as producBatch,
|
|
|
|
|
+ a.supplier_id as supplierId,
|
|
|
|
|
+ b.storage_location_name as storageLocationName ,
|
|
|
|
|
+ b.warehouse_where as warehouseWhere,
|
|
|
|
|
+ b.storage_location_type as storageLocationType,
|
|
|
|
|
+ b.storage_location_capacity as storageLocationCapacity,
|
|
|
|
|
+ b.is_not_disable as isNotDisable,
|
|
|
|
|
+ b.create_time as createTime,
|
|
|
|
|
+ b.is_product as isProduct,
|
|
|
|
|
+ c.name as name,
|
|
|
|
|
+ c.code as code,
|
|
|
|
|
+ e.name as supplierName
|
|
|
FROM
|
|
FROM
|
|
|
tld_inventory a
|
|
tld_inventory a
|
|
|
LEFT JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
|
|
LEFT JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
|
|
@@ -125,14 +166,20 @@
|
|
|
</select>
|
|
</select>
|
|
|
<select id="getStorageLocation" resultType="java.util.LinkedHashMap">
|
|
<select id="getStorageLocation" resultType="java.util.LinkedHashMap">
|
|
|
SELECT
|
|
SELECT
|
|
|
- c.code as code,
|
|
|
|
|
- c.name as name,
|
|
|
|
|
- b.storage_location_name as storageLocationName ,
|
|
|
|
|
- sum( a.amount ) AS sum
|
|
|
|
|
|
|
+ c.code as code,
|
|
|
|
|
+ c.name as name,
|
|
|
|
|
+ sum( a.amount ) AS sum,
|
|
|
|
|
+ b.storage_location_name as storageLocationName ,
|
|
|
|
|
+ p.name as companyName,
|
|
|
|
|
+ e.name as supplierName,
|
|
|
|
|
+ a.wbs as wbs
|
|
|
FROM
|
|
FROM
|
|
|
- tld_inventory a
|
|
|
|
|
- LEFT JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
|
|
|
|
|
- LEFT JOIN tld_material c ON a.material_id = c.tld_id
|
|
|
|
|
|
|
+ tld_inventory a
|
|
|
|
|
+ LEFT JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
|
|
|
|
|
+ LEFT JOIN tld_material c ON a.material_id = c.tld_id
|
|
|
|
|
+ LEFT JOIN tld_customer e ON a.supplier_id = e.code
|
|
|
|
|
+ LEFT JOIN tld_warehouse f on b.warehouse_where = f.tld_id
|
|
|
|
|
+ LEFT JOIN tld_company p on a.account_sleeve = p.code
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="storageLocationCode != null and storageLocationCode != ''">
|
|
<if test="storageLocationCode != null and storageLocationCode != ''">
|
|
|
and a.storage_location_code = #{storageLocationCode}
|
|
and a.storage_location_code = #{storageLocationCode}
|
|
@@ -140,6 +187,24 @@
|
|
|
<if test="materialId != null and materialId != ''">
|
|
<if test="materialId != null and materialId != ''">
|
|
|
and a.material_id = #{materialId}
|
|
and a.material_id = #{materialId}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="wllbCode != null and wllbCode != ''">
|
|
|
|
|
+ and c.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
|
|
+ and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="storageLocationName != null and storageLocationName != ''">
|
|
|
|
|
+ and b.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
|
|
+ and p.name like CONCAT(CONCAT('%', #{companyName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="supplierId != null and supplierId != ''">
|
|
|
|
|
+ and a.supplier_id like CONCAT(CONCAT('%', #{supplierId}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="wbs != null and wbs != ''">
|
|
|
|
|
+ and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
|
|
|
|
|
+ </if>
|
|
|
</trim>
|
|
</trim>
|
|
|
GROUP BY
|
|
GROUP BY
|
|
|
a.storage_location_code,
|
|
a.storage_location_code,
|
|
@@ -160,22 +225,22 @@
|
|
|
<!-- 查询生产领料要货 -->
|
|
<!-- 查询生产领料要货 -->
|
|
|
<select id="getAskGoods" resultType="com.tld.model.AskGoods">
|
|
<select id="getAskGoods" resultType="com.tld.model.AskGoods">
|
|
|
SELECT
|
|
SELECT
|
|
|
- a.id,
|
|
|
|
|
- a.ask_goods_id,
|
|
|
|
|
- a.material_id,
|
|
|
|
|
- IFNULL( a.out_num, 0 ) AS out_num,
|
|
|
|
|
- a.num,
|
|
|
|
|
- e.NAME AS materialName,
|
|
|
|
|
- e.CODE AS materialCode,
|
|
|
|
|
- b.ask_goods_code,
|
|
|
|
|
- b.company_number,
|
|
|
|
|
- b.sqrq
|
|
|
|
|
|
|
+ a.id,
|
|
|
|
|
+ a.ask_goods_id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ IFNULL( a.out_num, 0 ) AS out_num,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ e.NAME AS materialName,
|
|
|
|
|
+ e.CODE AS materialCode,
|
|
|
|
|
+ b.ask_goods_code,
|
|
|
|
|
+ b.company_number,
|
|
|
|
|
+ b.sqrq
|
|
|
FROM
|
|
FROM
|
|
|
- tld_ask_goods a
|
|
|
|
|
- JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
|
|
|
|
|
- LEFT JOIN tld_department c ON b.department = c.code
|
|
|
|
|
- JOIN tld_material e ON a.material_id = e.tld_id
|
|
|
|
|
- /* WHERE e.part_type != '半成品' and e.part_type != '产成品'*/
|
|
|
|
|
|
|
+ tld_ask_goods a
|
|
|
|
|
+ JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
|
|
|
|
|
+ LEFT JOIN tld_department c ON b.department = c.code
|
|
|
|
|
+ JOIN tld_material e ON a.material_id = e.tld_id
|
|
|
|
|
+ /* WHERE e.part_type != '半成品' and e.part_type != '产成品'*/
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="askGoodsId != null and askGoodsId != ''">
|
|
<if test="askGoodsId != null and askGoodsId != ''">
|
|
|
and b.ask_goods_code = #{askGoodsId}
|
|
and b.ask_goods_code = #{askGoodsId}
|
|
@@ -197,19 +262,19 @@
|
|
|
<!-- 查询生产领料要货 -->
|
|
<!-- 查询生产领料要货 -->
|
|
|
<select id="getAskGoodsExcel" resultType="java.util.LinkedHashMap">
|
|
<select id="getAskGoodsExcel" resultType="java.util.LinkedHashMap">
|
|
|
SELECT
|
|
SELECT
|
|
|
- a.ask_goods_id,
|
|
|
|
|
- a.material_id,
|
|
|
|
|
- a.num,
|
|
|
|
|
- IFNULL( a.out_num, 0 ) AS out_num,
|
|
|
|
|
- e.NAME AS materialName,
|
|
|
|
|
- e.CODE AS materialCode,
|
|
|
|
|
- b.ask_goods_code,
|
|
|
|
|
- b.company_number
|
|
|
|
|
|
|
+ a.ask_goods_id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ IFNULL( a.out_num, 0 ) AS out_num,
|
|
|
|
|
+ e.NAME AS materialName,
|
|
|
|
|
+ e.CODE AS materialCode,
|
|
|
|
|
+ b.ask_goods_code,
|
|
|
|
|
+ b.company_number
|
|
|
FROM
|
|
FROM
|
|
|
- tld_ask_goods a
|
|
|
|
|
- JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
|
|
|
|
|
- LEFT JOIN tld_department c ON b.department = c.code
|
|
|
|
|
- JOIN tld_material e ON a.material_id = e.tld_id
|
|
|
|
|
|
|
+ tld_ask_goods a
|
|
|
|
|
+ JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
|
|
|
|
|
+ LEFT JOIN tld_department c ON b.department = c.code
|
|
|
|
|
+ JOIN tld_material e ON a.material_id = e.tld_id
|
|
|
WHERE e.part_type != '半成品' and e.part_type != '产成品'
|
|
WHERE e.part_type != '半成品' and e.part_type != '产成品'
|
|
|
<if test="askGoodsId != null and askGoodsId != ''">
|
|
<if test="askGoodsId != null and askGoodsId != ''">
|
|
|
and a.ask_goods_id = #{askGoodsId}
|
|
and a.ask_goods_id = #{askGoodsId}
|
|
@@ -230,23 +295,23 @@
|
|
|
<!-- 查询非生产领料单 -->
|
|
<!-- 查询非生产领料单 -->
|
|
|
<select id="getInvite" resultType="com.tld.model.AskGoods">
|
|
<select id="getInvite" resultType="com.tld.model.AskGoods">
|
|
|
SELECT
|
|
SELECT
|
|
|
- a.id,
|
|
|
|
|
- a.ask_goods_id,
|
|
|
|
|
- a.material_id,
|
|
|
|
|
- IFNULL( a.out_num, 0 ) AS out_num,
|
|
|
|
|
- a.num,
|
|
|
|
|
- e.NAME AS materialName,
|
|
|
|
|
- e.CODE AS materialCode,
|
|
|
|
|
- b.ask_goods_code,
|
|
|
|
|
- b.company_number,
|
|
|
|
|
- b.sqrq
|
|
|
|
|
|
|
+ a.id,
|
|
|
|
|
+ a.ask_goods_id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ IFNULL( a.out_num, 0 ) AS out_num,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ e.NAME AS materialName,
|
|
|
|
|
+ e.CODE AS materialCode,
|
|
|
|
|
+ b.ask_goods_code,
|
|
|
|
|
+ b.company_number,
|
|
|
|
|
+ b.sqrq
|
|
|
FROM
|
|
FROM
|
|
|
- tld_invite a
|
|
|
|
|
- JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
|
|
|
|
|
- LEFT JOIN tld_department c ON b.department = c.code
|
|
|
|
|
- JOIN tld_material e ON a.material_id = e.tld_id
|
|
|
|
|
|
|
+ tld_invite a
|
|
|
|
|
+ JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
|
|
|
|
|
+ LEFT JOIN tld_department c ON b.department = c.code
|
|
|
|
|
+ JOIN tld_material e ON a.material_id = e.tld_id
|
|
|
/*WHERE*/
|
|
/*WHERE*/
|
|
|
- /*e.part_type != '半成品' and e.part_type != '产成品'*/
|
|
|
|
|
|
|
+ /*e.part_type != '半成品' and e.part_type != '产成品'*/
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="askGoodsId != null and askGoodsId != ''">
|
|
<if test="askGoodsId != null and askGoodsId != ''">
|
|
|
and b.ask_goods_code = #{askGoodsId}
|
|
and b.ask_goods_code = #{askGoodsId}
|
|
@@ -268,19 +333,19 @@
|
|
|
<!-- 导出生产领料要货 -->
|
|
<!-- 导出生产领料要货 -->
|
|
|
<select id="getInviteExcel" resultType="java.util.LinkedHashMap">
|
|
<select id="getInviteExcel" resultType="java.util.LinkedHashMap">
|
|
|
SELECT
|
|
SELECT
|
|
|
- a.ask_goods_id,
|
|
|
|
|
- a.material_id,
|
|
|
|
|
- a.num,
|
|
|
|
|
- IFNULL( a.out_num, 0 ) AS out_num,
|
|
|
|
|
- e.NAME AS materialName,
|
|
|
|
|
- e.CODE AS materialCode,
|
|
|
|
|
- b.ask_goods_code,
|
|
|
|
|
- b.company_number
|
|
|
|
|
|
|
+ a.ask_goods_id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ IFNULL( a.out_num, 0 ) AS out_num,
|
|
|
|
|
+ e.NAME AS materialName,
|
|
|
|
|
+ e.CODE AS materialCode,
|
|
|
|
|
+ b.ask_goods_code,
|
|
|
|
|
+ b.company_number
|
|
|
FROM
|
|
FROM
|
|
|
- tld_invite a
|
|
|
|
|
- JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
|
|
|
|
|
- LEFT JOIN tld_department c ON b.department = c.code
|
|
|
|
|
- JOIN tld_material e ON a.material_id = e.tld_id
|
|
|
|
|
|
|
+ tld_invite a
|
|
|
|
|
+ JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
|
|
|
|
|
+ LEFT JOIN tld_department c ON b.department = c.code
|
|
|
|
|
+ JOIN tld_material e ON a.material_id = e.tld_id
|
|
|
WHERE e.part_type != '半成品' and e.part_type != '产成品'
|
|
WHERE e.part_type != '半成品' and e.part_type != '产成品'
|
|
|
<if test="askGoodsId != null and askGoodsId != ''">
|
|
<if test="askGoodsId != null and askGoodsId != ''">
|
|
|
and a.ask_goods_id = #{askGoodsId}
|
|
and a.ask_goods_id = #{askGoodsId}
|
|
@@ -301,17 +366,17 @@
|
|
|
<!-- 查询销售单 -->
|
|
<!-- 查询销售单 -->
|
|
|
<select id="getDelivery" resultType="com.tld.model.Delivery">
|
|
<select id="getDelivery" resultType="com.tld.model.Delivery">
|
|
|
select
|
|
select
|
|
|
- a.id,
|
|
|
|
|
- a.delivery_id,
|
|
|
|
|
- a.material_id,
|
|
|
|
|
- a.wbs,
|
|
|
|
|
- a.gs_delivery_num,
|
|
|
|
|
- a.gs_cancel_num,
|
|
|
|
|
- ifnull(a.out_num, 0) as out_num,
|
|
|
|
|
- b.company_number,
|
|
|
|
|
- b.bills_time,
|
|
|
|
|
- c.name as materialName,
|
|
|
|
|
- c.code as materialCode
|
|
|
|
|
|
|
+ a.id,
|
|
|
|
|
+ a.delivery_id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ a.wbs,
|
|
|
|
|
+ a.gs_delivery_num,
|
|
|
|
|
+ a.gs_cancel_num,
|
|
|
|
|
+ ifnull(a.out_num, 0) as out_num,
|
|
|
|
|
+ b.company_number,
|
|
|
|
|
+ b.bills_time,
|
|
|
|
|
+ c.name as materialName,
|
|
|
|
|
+ c.code as materialCode
|
|
|
from tld_delivery a
|
|
from tld_delivery a
|
|
|
join tld_delivery_f b on a.delivery_id = b.delivery_id
|
|
join tld_delivery_f b on a.delivery_id = b.delivery_id
|
|
|
join tld_material c on a.material_id = c.tld_id
|
|
join tld_material c on a.material_id = c.tld_id
|
|
@@ -336,16 +401,16 @@
|
|
|
<!-- 导出销售单 -->
|
|
<!-- 导出销售单 -->
|
|
|
<select id="getDeliveryExcel" resultType="java.util.LinkedHashMap">
|
|
<select id="getDeliveryExcel" resultType="java.util.LinkedHashMap">
|
|
|
select
|
|
select
|
|
|
- a.delivery_id,
|
|
|
|
|
- a.material_id,
|
|
|
|
|
- a.wbs,
|
|
|
|
|
- a.gs_delivery_num,
|
|
|
|
|
- a.gs_cancel_num,
|
|
|
|
|
- a.out_num,
|
|
|
|
|
- b.company_number,
|
|
|
|
|
- b.bills_time,
|
|
|
|
|
- c.name as materialName,
|
|
|
|
|
- c.code as materialCode
|
|
|
|
|
|
|
+ a.delivery_id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ a.wbs,
|
|
|
|
|
+ a.gs_delivery_num,
|
|
|
|
|
+ a.gs_cancel_num,
|
|
|
|
|
+ a.out_num,
|
|
|
|
|
+ b.company_number,
|
|
|
|
|
+ b.bills_time,
|
|
|
|
|
+ c.name as materialName,
|
|
|
|
|
+ c.code as materialCode
|
|
|
from tld_delivery a
|
|
from tld_delivery a
|
|
|
join tld_delivery_f b on a.delivery_id = b.delivery_id
|
|
join tld_delivery_f b on a.delivery_id = b.delivery_id
|
|
|
join tld_material c on a.material_id = c.tld_id
|
|
join tld_material c on a.material_id = c.tld_id
|
|
@@ -370,28 +435,30 @@
|
|
|
<!-- 查询移库单 -->
|
|
<!-- 查询移库单 -->
|
|
|
<select id="getWarehouseTransfer" resultType="com.tld.model.WarehouseTransfer">
|
|
<select id="getWarehouseTransfer" resultType="com.tld.model.WarehouseTransfer">
|
|
|
select
|
|
select
|
|
|
- a.id,
|
|
|
|
|
- a.warehouse_transfer_id,
|
|
|
|
|
- a.entry_number,
|
|
|
|
|
- a.supply_warehouse_id,
|
|
|
|
|
- a.material_id,
|
|
|
|
|
- a.wbs,
|
|
|
|
|
- a.num,
|
|
|
|
|
- a.out_num,
|
|
|
|
|
- a.type,
|
|
|
|
|
- b.warehouse_transfer_code,
|
|
|
|
|
- b.ask_goods_warehouse_id,
|
|
|
|
|
- b.document_time,
|
|
|
|
|
- b.warehouse_transfer_type,
|
|
|
|
|
- c.name as materialName,
|
|
|
|
|
- c.code as materialCode,
|
|
|
|
|
- f.name as askGoodsWarehouseName,
|
|
|
|
|
- e.name as supplyWarehouseName
|
|
|
|
|
|
|
+ a.id,
|
|
|
|
|
+ a.warehouse_transfer_id,
|
|
|
|
|
+ a.entry_number,
|
|
|
|
|
+ a.supply_warehouse_id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ a.wbs,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ a.out_num,
|
|
|
|
|
+ a.type,
|
|
|
|
|
+ b.warehouse_transfer_code,
|
|
|
|
|
+ b.ask_goods_warehouse_id,
|
|
|
|
|
+ b.document_time,
|
|
|
|
|
+ b.warehouse_transfer_type,
|
|
|
|
|
+ c.name as materialName,
|
|
|
|
|
+ c.code as materialCode,
|
|
|
|
|
+ f.name as askGoodsWarehouseName,
|
|
|
|
|
+ e.name as supplyWarehouseName,
|
|
|
|
|
+ k.name as companyName
|
|
|
from tld_warehouse_transfer a
|
|
from tld_warehouse_transfer a
|
|
|
join tld_warehouse_transfer_f b on a.warehouse_transfer_id = b.warehouse_transfer_id
|
|
join tld_warehouse_transfer_f b on a.warehouse_transfer_id = b.warehouse_transfer_id
|
|
|
join tld_material c on a.material_id = c.tld_id
|
|
join tld_material c on a.material_id = c.tld_id
|
|
|
join tld_warehouse e on a.supply_warehouse_id = e.tld_id
|
|
join tld_warehouse e on a.supply_warehouse_id = e.tld_id
|
|
|
join tld_warehouse f on b.ask_goods_warehouse_id = f.tld_id
|
|
join tld_warehouse f on b.ask_goods_warehouse_id = f.tld_id
|
|
|
|
|
+ join tld_company k on a.account_sleeve = k.code
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="type != null and type != ''">
|
|
<if test="type != null and type != ''">
|
|
|
and a.type = #{type}
|
|
and a.type = #{type}
|
|
@@ -403,38 +470,48 @@
|
|
|
and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="warehouseTransferCode != null and warehouseTransferCode != ''">
|
|
<if test="warehouseTransferCode != null and warehouseTransferCode != ''">
|
|
|
- and b.warehouse_transfer_code like CONCAT(CONCAT('%', #{warehouseTransferCode}), '%')
|
|
|
|
|
|
|
+ and b.warehouse_transfer_code like CONCAT(CONCAT('%',#{warehouseTransferCode}),'%')
|
|
|
</if>
|
|
</if>
|
|
|
<if test="startTime != null and startTime != ''">
|
|
<if test="startTime != null and startTime != ''">
|
|
|
- and a.document_time <![CDATA[>=]]> #{startTime}
|
|
|
|
|
|
|
+ and b.document_time <![CDATA[>=]]> #{startTime}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="endTime != null and endTime != ''">
|
|
<if test="endTime != null and endTime != ''">
|
|
|
- and a.document_time <![CDATA[<=]]> #{endTime}
|
|
|
|
|
|
|
+ and b.document_time <![CDATA[<=]]> #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="askGoodsWarehouseId != null and askGoodsWarehouseId != ''">
|
|
|
|
|
+ and b.ask_goods_warehouse_id = #{askGoodsWarehouseId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="supplyWarehouseId != null and supplyWarehouseId != ''">
|
|
|
|
|
+ and a.supply_warehouse_id = #{supplyWarehouseId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="warehouseTransferType != null and warehouseTransferType != ''">
|
|
|
|
|
+ and b.warehouse_transfer_type like CONCAT(CONCAT('%', #{warehouseTransferType}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="companyCode != null and companyCode != ''">
|
|
|
|
|
+ and a.account_sleeve = #{companyCode}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="entryNumber != null and entryNumber != ''">
|
|
|
|
|
+ and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="wbs != null and wbs != ''">
|
|
|
|
|
+ and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
|
|
|
</if>
|
|
</if>
|
|
|
</trim>
|
|
</trim>
|
|
|
|
|
+ order by a.id desc
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 移库单导出 -->
|
|
<!-- 移库单导出 -->
|
|
|
<select id="getWarehouseTransferExcel" resultType="java.util.LinkedHashMap">
|
|
<select id="getWarehouseTransferExcel" resultType="java.util.LinkedHashMap">
|
|
|
select
|
|
select
|
|
|
- a.warehouse_transfer_id,
|
|
|
|
|
- b.warehouse_transfer_code,
|
|
|
|
|
- a.material_id,
|
|
|
|
|
- c.name as materialName,
|
|
|
|
|
- c.code as materialCode,
|
|
|
|
|
- a.wbs,
|
|
|
|
|
- a.num,
|
|
|
|
|
- a.out_num,
|
|
|
|
|
- b.ask_goods_warehouse_id,
|
|
|
|
|
- a.supply_warehouse_id,
|
|
|
|
|
- f.name as askGoodsWarehouseaName,
|
|
|
|
|
- e.name as supplyWarehouseName,
|
|
|
|
|
- b.document_time,
|
|
|
|
|
- case
|
|
|
|
|
- when a.type = '0' then
|
|
|
|
|
- '未移库'
|
|
|
|
|
- when a.type = '1' then
|
|
|
|
|
- '已移库'
|
|
|
|
|
- end as type
|
|
|
|
|
|
|
+ a.warehouse_transfer_id,
|
|
|
|
|
+ b.warehouse_transfer_code,
|
|
|
|
|
+ c.name as materialName,
|
|
|
|
|
+ c.code as materialCode,
|
|
|
|
|
+ a.wbs,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ a.out_num,
|
|
|
|
|
+ f.name as askGoodsWarehouseaName,
|
|
|
|
|
+ e.name as supplyWarehouseName,
|
|
|
|
|
+ b.document_time
|
|
|
from tld_warehouse_transfer a
|
|
from tld_warehouse_transfer a
|
|
|
join tld_warehouse_transfer_f b on a.warehouse_transfer_id = b.warehouse_transfer_id
|
|
join tld_warehouse_transfer_f b on a.warehouse_transfer_id = b.warehouse_transfer_id
|
|
|
join tld_material c on a.material_id = c.tld_id
|
|
join tld_material c on a.material_id = c.tld_id
|
|
@@ -450,13 +527,35 @@
|
|
|
<if test="materialName != null and materialName != ''">
|
|
<if test="materialName != null and materialName != ''">
|
|
|
and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="warehouseTransferCode != null and warehouseTransferCode != ''">
|
|
|
|
|
+ and b.warehouse_transfer_code like CONCAT(CONCAT('%',#{warehouseTransferCode}),'%')
|
|
|
|
|
+ </if>
|
|
|
<if test="startTime != null and startTime != ''">
|
|
<if test="startTime != null and startTime != ''">
|
|
|
- and a.document_time <![CDATA[>=]]> #{startTime}
|
|
|
|
|
|
|
+ and b.document_time <![CDATA[>=]]> #{startTime}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="endTime != null and endTime != ''">
|
|
<if test="endTime != null and endTime != ''">
|
|
|
- and a.document_time <![CDATA[<=]]> #{endTime}
|
|
|
|
|
|
|
+ and b.document_time <![CDATA[<=]]> #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="askGoodsWarehouseId != null and askGoodsWarehouseId != ''">
|
|
|
|
|
+ and b.ask_goods_warehouse_id = #{askGoodsWarehouseId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="supplyWarehouseId != null and supplyWarehouseId != ''">
|
|
|
|
|
+ and a.supply_warehouse_id = #{supplyWarehouseId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="warehouseTransferType != null and warehouseTransferType != ''">
|
|
|
|
|
+ and b.warehouse_transfer_type like CONCAT(CONCAT('%', #{warehouseTransferType}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="companyCode != null and companyCode != ''">
|
|
|
|
|
+ and a.account_sleeve = #{companyCode}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="entryNumber != null and entryNumber != ''">
|
|
|
|
|
+ and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="wbs != null and wbs != ''">
|
|
|
|
|
+ and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
|
|
|
</if>
|
|
</if>
|
|
|
</trim>
|
|
</trim>
|
|
|
|
|
+ order by a.id desc
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 查询日志信息 -->
|
|
<!-- 查询日志信息 -->
|
|
|
<select id="getLogData" resultType="com.tld.model.LogData">
|
|
<select id="getLogData" resultType="com.tld.model.LogData">
|
|
@@ -487,5 +586,94 @@
|
|
|
</trim>
|
|
</trim>
|
|
|
ORDER BY a.scrq DESC
|
|
ORDER BY a.scrq DESC
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+ <!--呆滞品导出-->
|
|
|
|
|
+ <select id="dullGoodsExport" resultType="java.util.LinkedHashMap">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ b.code as wllbCode,
|
|
|
|
|
+ b.name as materialName,
|
|
|
|
|
+ c.storage_location_name as storageLocationName,
|
|
|
|
|
+ f.name as companyName,
|
|
|
|
|
+ e.name as ustomerName,
|
|
|
|
|
+ a.wbs as wbs,
|
|
|
|
|
+ a.amount as amount,
|
|
|
|
|
+ a.scrq as scrq
|
|
|
|
|
+ FROM tld_inventory a
|
|
|
|
|
+ JOIN tld_material b ON a.material_id = b.tld_id
|
|
|
|
|
+ LEFT JOIN tld_storage_location c ON a.storage_location_code = c.storage_location_code
|
|
|
|
|
+ LEFT JOIN tld_customer e ON a.supplier_id = e.code
|
|
|
|
|
+ LEFT JOIN tld_company f ON a.account_sleeve = f.code
|
|
|
|
|
+ WHERE datediff(now(), a.scrq) <![CDATA[>]]> 90
|
|
|
|
|
+ <if test="storageLocationCode != null and storageLocationCode != ''">
|
|
|
|
|
+ and a.storage_location_code = #{storageLocationCode}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
|
|
+ and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="wllbCode != null and wllbCode != ''">
|
|
|
|
|
+ and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="wbs != null and wbs != ''">
|
|
|
|
|
+ and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="storageLocationName != null and storageLocationName != ''">
|
|
|
|
|
+ and c.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="ustomerCode != null and ustomerCode != ''">
|
|
|
|
|
+ and a.supplier_id = #{ustomerCode}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="companyCode != null and companyCode != ''">
|
|
|
|
|
+ and a.account_sleeve = #{companyCode}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!--查询物料储量预警查询-->
|
|
|
|
|
+ <select id="reserveWarnings" resultType="java.util.Map">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.NAME as materialName,
|
|
|
|
|
+ a.CODE as wllbCode,
|
|
|
|
|
+ ifnull(b.sum,0) AS amount,
|
|
|
|
|
+ ifnull(a.max_num,'0') AS maxNum,
|
|
|
|
|
+ ifnull(a.min_num,'0') AS minNum
|
|
|
|
|
+ FROM
|
|
|
|
|
+ tld_material a
|
|
|
|
|
+ LEFT JOIN ( SELECT SUM( amount ) AS sum, material_id FROM tld_inventory GROUP BY material_id ) b ON a.tld_id =
|
|
|
|
|
+ b.material_id
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ (
|
|
|
|
|
+ IF(a.max_num IS NULL,FALSE,IF( b.sum IS NULL, 0, b.sum + 0 ) <![CDATA[>]]> a.max_num)
|
|
|
|
|
+ OR
|
|
|
|
|
+ IF(a.min_num IS NULL,FALSE,IF( b.sum IS NULL, 0, b.sum + 0 ) <![CDATA[<]]> a.min_num)
|
|
|
|
|
+ )
|
|
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
|
|
+ and a.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="wllbCode != null and wllbCode != ''">
|
|
|
|
|
+ and a.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!--查询物料储量预警查询导出-->
|
|
|
|
|
+ <select id="reserveWarningsExport" resultType="java.util.LinkedHashMap">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.CODE as wllbCode,
|
|
|
|
|
+ a.NAME as materialName,
|
|
|
|
|
+ ifnull(b.sum,0) AS amount,
|
|
|
|
|
+ ifnull(a.max_num,'0') AS maxNum,
|
|
|
|
|
+ ifnull(a.min_num,'0') AS minNum
|
|
|
|
|
+ FROM
|
|
|
|
|
+ tld_material a
|
|
|
|
|
+ LEFT JOIN ( SELECT SUM( amount ) AS sum, material_id FROM tld_inventory GROUP BY material_id ) b ON a.tld_id =
|
|
|
|
|
+ b.material_id
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ (
|
|
|
|
|
+ IF(a.max_num IS NULL,FALSE,IF( b.sum IS NULL, 0, b.sum + 0 ) <![CDATA[>]]> a.max_num)
|
|
|
|
|
+ OR
|
|
|
|
|
+ IF(a.min_num IS NULL,FALSE,IF( b.sum IS NULL, 0, b.sum + 0 ) <![CDATA[<]]> a.min_num)
|
|
|
|
|
+ )
|
|
|
|
|
+ <if test="materialName != null and materialName != ''">
|
|
|
|
|
+ and a.name like CONCAT(CONCAT('%', #{materialName}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="wllbCode != null and wllbCode != ''">
|
|
|
|
|
+ and a.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|