|
@@ -16,8 +16,11 @@
|
|
|
</insert>
|
|
|
<!--添加盘点子表信息-->
|
|
|
<insert id="addInventoryPlates">
|
|
|
- insert into tld_plate_z( material_id, wllb_code, name, amount, gs_amount,uuid)
|
|
|
- values (#{materialId}, #{wllbCode}, #{name}, #{amount}, #{gsAmount},#{uuid})
|
|
|
+ insert into tld_plate_z(material_id, wllb_code, name, amount, gs_amount, uuid, account_sleeve)
|
|
|
+ values
|
|
|
+ <foreach collection="inventory" index="index" item="item" separator=",">
|
|
|
+ (#{item.materialId}, #{item.wllbCode}, #{item.name}, #{item.amount}, #{item.gsAmount}, #{item.uuid},#{item.accountSleeve})
|
|
|
+ </foreach>
|
|
|
</insert>
|
|
|
<!--修改录入信息为主表id为空的添加主表uuid进行关联-->
|
|
|
<update id="updateInventoryPlate">
|
|
@@ -35,126 +38,148 @@
|
|
|
<!--导出盘点数据-->
|
|
|
<select id="export" resultType="java.util.LinkedHashMap">
|
|
|
select
|
|
|
- id,
|
|
|
- material_id,
|
|
|
- wllb_code,
|
|
|
- name,
|
|
|
- amount,
|
|
|
- gs_amount,
|
|
|
- if(plate_amount = '', null , plate_amount),
|
|
|
- uuid
|
|
|
- from tld_plate_z
|
|
|
+ a.material_id,
|
|
|
+ a.wllb_code,
|
|
|
+ a.name,
|
|
|
+ a.amount,
|
|
|
+ a.gs_amount,
|
|
|
+ c.plateAmount,
|
|
|
+ b.name as accountName
|
|
|
+ from tld_plate_z a
|
|
|
+ left join tld_company b on a.account_sleeve = b.code
|
|
|
+ left join (select sum(amount) as plateAmount,material_id,uuid from tld_plate GROUP BY material_id,uuid) c on a.material_id = c.material_id and a.uuid = c.uuid
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="materialId != null and materialId != ''">
|
|
|
- and material_id = #{materialId}
|
|
|
+ and a.material_id = #{materialId}
|
|
|
</if>
|
|
|
<if test="wllbCode != null and wllbCode != ''">
|
|
|
- and wllb_code = #{wllbCode}
|
|
|
+ and a.wllb_code = #{wllbCode}
|
|
|
</if>
|
|
|
<if test="uuid != null and uuid != ''">
|
|
|
- and uuid = #{uuid}
|
|
|
+ and a.uuid = #{uuid}
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- and name like CONCAT(CONCAT('%', #{name}), '%')
|
|
|
+ and a.name like CONCAT(CONCAT('%', #{name}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="accountSleeve != null and accountSleeve != ''">
|
|
|
+ and a.account_sleeve = #{accountSleeve}
|
|
|
</if>
|
|
|
</trim>
|
|
|
</select>
|
|
|
<!--查询录入盘点信息-->
|
|
|
<select id="getInventory" resultType="com.tld.model.MakeInventory">
|
|
|
select
|
|
|
- id,
|
|
|
- storage_location_code,
|
|
|
- amount,
|
|
|
- total,
|
|
|
- wllb_code,
|
|
|
- scrq,
|
|
|
- material_id,
|
|
|
- plate_id,
|
|
|
- account_sleeve,
|
|
|
- supplier_id,
|
|
|
- serial,
|
|
|
- attribute,
|
|
|
- uuid
|
|
|
- from tld_plate
|
|
|
+ a.id,
|
|
|
+ a.storage_location_code,
|
|
|
+ a.amount,
|
|
|
+ a.total,
|
|
|
+ a.wllb_code,
|
|
|
+ a.scrq,
|
|
|
+ a.material_id,
|
|
|
+ a.plate_id,
|
|
|
+ a.account_sleeve,
|
|
|
+ a.supplier_id,
|
|
|
+ a.serial,
|
|
|
+ a.attribute,
|
|
|
+ a.uuid,
|
|
|
+ b.name as name ,
|
|
|
+ c.storage_location_name as storageLocationName
|
|
|
+ from tld_plate a
|
|
|
+ left join tld_material b on a.wllb_code = b.code
|
|
|
+ left join tld_storage_location c on a.storage_location_code = c.storage_location_code
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="wllbCodes != null and wllbCodes != ''">
|
|
|
- and wllb_code = #{wllbCodes}
|
|
|
+ and a.wllb_code like CONCAT(CONCAT('%', #{wllbCodes}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and b.name like CONCAT(CONCAT('%', #{name}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="storageLocationName != null and storageLocationName != ''">
|
|
|
+ and c.storageLocationName like CONCAT(CONCAT('%', #{storageLocationName}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="wllbCodes != null and wllbCodes != ''">
|
|
|
+ and a.wllb_code like CONCAT(CONCAT('%', #{wllbCodes}), '%')
|
|
|
</if>
|
|
|
<if test="materialId != null and materialId != ''">
|
|
|
- and material_id = #{materialId}
|
|
|
+ and a.material_id = #{materialId}
|
|
|
</if>
|
|
|
<if test="amount != null and amount != ''">
|
|
|
- and amount = #{amount}
|
|
|
+ and a.amount = #{amount}
|
|
|
</if>
|
|
|
<if test="total != null and total != ''">
|
|
|
- and total = #{total}
|
|
|
+ and a.total = #{total}
|
|
|
</if>
|
|
|
<if test="storageLocationCodes != null and storageLocationCodes != ''">
|
|
|
- and storage_location_code = #{storageLocationCodes}
|
|
|
+ and a.storage_location_code like CONCAT(CONCAT('%', #{storageLocationCodes}), '%')
|
|
|
</if>
|
|
|
<if test="plateId != null and plateId != ''">
|
|
|
- and plate_id = #{plateId}
|
|
|
+ and a.plate_id = #{plateId}
|
|
|
</if>
|
|
|
<if test="accountSleeve != null and accountSleeve != ''">
|
|
|
- and account_sleeve = #{accountSleeve}
|
|
|
+ and a.account_sleeve = #{accountSleeve}
|
|
|
</if>
|
|
|
<if test="supplierId != null and supplierId != ''">
|
|
|
- and supplier_id = #{supplierId}
|
|
|
+ and a.supplier_id = #{supplierId}
|
|
|
</if>
|
|
|
<if test="serial != null and serial != ''">
|
|
|
- and serial = #{serial}
|
|
|
+ and a.serial = #{serial}
|
|
|
</if>
|
|
|
<if test="attribute != null and attribute != ''">
|
|
|
- and attribute = #{attribute}
|
|
|
+ and a.attribute = #{attribute}
|
|
|
</if>
|
|
|
<if test="uuid != null and uuid != ''">
|
|
|
- and uuid = #{uuid}
|
|
|
+ and a.uuid = #{uuid}
|
|
|
</if>
|
|
|
<if test="scrq != null and scrq != ''">
|
|
|
- and scrq like CONCAT(CONCAT('%', #{scrq}), '%')
|
|
|
+ and a.scrq like CONCAT(CONCAT('%', #{scrq}), '%')
|
|
|
</if>
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
- and sqrq <![CDATA[>=]]> #{startTime}
|
|
|
+ and a.sqrq <![CDATA[>=]]> #{startTime}
|
|
|
</if>
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
- and sqrq <![CDATA[<=]]> #{endTime}
|
|
|
+ and a.sqrq <![CDATA[<=]]> #{endTime}
|
|
|
</if>
|
|
|
</trim>
|
|
|
- order by scrq desc
|
|
|
+ order by a.scrq desc
|
|
|
</select>
|
|
|
<!--查询盘点主表信息-->
|
|
|
<select id="getInventoryDataList" resultType="com.tld.model.MakeInventory">
|
|
|
select
|
|
|
- id,
|
|
|
- user_id,
|
|
|
- scrq,
|
|
|
- uuid,
|
|
|
- title
|
|
|
- from tld_plate_f
|
|
|
+ a.id,
|
|
|
+ a.user_id,
|
|
|
+ a.scrq,
|
|
|
+ a.uuid,
|
|
|
+ a.title,
|
|
|
+ b.user_name as userName
|
|
|
+ from tld_plate_f a
|
|
|
+ left join tld_user b on a.user_id = b.id
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="userId != null and userId != ''">
|
|
|
- and user_id = #{userId}
|
|
|
+ and a.user_id = #{userId}
|
|
|
</if>
|
|
|
<if test="uuid != null and uuid != ''">
|
|
|
- and uuid = #{uuid}
|
|
|
+ and a.uuid = #{uuid}
|
|
|
</if>
|
|
|
<if test="scrq != null and scrq != ''">
|
|
|
- and scrq like CONCAT(CONCAT('%', #{scrq}), '%')
|
|
|
+ and a.scrq like CONCAT(CONCAT('%', #{scrq}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="userName != null and userName != ''">
|
|
|
+ and b.user_name like CONCAT(CONCAT('%', #{userName}), '%')
|
|
|
</if>
|
|
|
<if test="title != null and title != ''">
|
|
|
- and title like CONCAT(CONCAT('%', #{title}), '%')
|
|
|
+ and a.title like CONCAT(CONCAT('%', #{title}), '%')
|
|
|
</if>
|
|
|
<if test="plateId != null and plateId != ''">
|
|
|
- and id = #{plateId}
|
|
|
+ and a.id = #{plateId}
|
|
|
</if>
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
- and sqrq <![CDATA[>=]]> #{startTime}
|
|
|
+ and a.scrq <![CDATA[>=]]> #{startTime}
|
|
|
</if>
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
- and sqrq <![CDATA[<=]]> #{endTime}
|
|
|
+ and a.scrq <![CDATA[<=]]> #{endTime}
|
|
|
</if>
|
|
|
</trim>
|
|
|
- order by scrq desc
|
|
|
+ order by a.scrq desc
|
|
|
</select>
|
|
|
<!--查询盘点录入信息是否重复-->
|
|
|
<select id="getInventoryRepetition" resultType="com.tld.model.MakeInventory">
|
|
@@ -218,29 +243,75 @@
|
|
|
<!--查询盘点子表信息-->
|
|
|
<select id="getInventoryPlatesList" resultType="com.tld.model.MakeInventory">
|
|
|
select
|
|
|
- id,
|
|
|
- plate_id,
|
|
|
- material_id,
|
|
|
- wllb_code,
|
|
|
- name,
|
|
|
- amount,
|
|
|
- gs_amount,
|
|
|
- plate_amount,
|
|
|
- uuid
|
|
|
- from tld_plate_z
|
|
|
+ a.id,
|
|
|
+ a.plate_id,
|
|
|
+ a.material_id,
|
|
|
+ a.wllb_code,
|
|
|
+ a.amount,
|
|
|
+ a.gs_amount,
|
|
|
+ e.plateAmount,
|
|
|
+ a.uuid,
|
|
|
+ b.name as name,
|
|
|
+ a.account_sleeve,
|
|
|
+ c.name as accountName
|
|
|
+ from tld_plate_z a
|
|
|
+ left join tld_material b on a.wllb_code = b.code
|
|
|
+ left join tld_company c on a.account_sleeve = c.code
|
|
|
+ left join (select sum(amount) as plateAmount,material_id,uuid from tld_plate GROUP BY material_id,uuid) e on a.material_id = e.material_id and a.uuid = e.uuid
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="materialId != null and materialId != ''">
|
|
|
- and material_id = #{materialId}
|
|
|
+ and a.material_id = #{materialId}
|
|
|
</if>
|
|
|
<if test="wllbCode != null and wllbCode != ''">
|
|
|
- and wllb_code = #{wllbCode}
|
|
|
+ and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
|
|
|
</if>
|
|
|
<if test="uuid != null and uuid != ''">
|
|
|
- and uuid = #{uuid}
|
|
|
+ and a.uuid = #{uuid}
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- and name like CONCAT(CONCAT('%', #{name}), '%')
|
|
|
+ and b.name like CONCAT(CONCAT('%', #{name}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="accountSleeve != null and accountSleeve != ''">
|
|
|
+ and a.account_sleeve = #{accountSleeve}
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </select>
|
|
|
+ <!--查询本地库存.gs库存.录入库存 数量-->
|
|
|
+ <select id="getInventoryLocality" resultType="java.util.Map">
|
|
|
+ SELECT a.wllb_code AS wllbCode,
|
|
|
+ a.material_id AS materialId,
|
|
|
+ b.amount AS gsAmount,
|
|
|
+ SUM(a.amount) AS amount,
|
|
|
+ b.material_id AS bId,
|
|
|
+ c.NAME AS name,
|
|
|
+ a.account_sleeve as accountSleeve,
|
|
|
+ ${uuid} AS uuid
|
|
|
+ FROM tld_inventory a
|
|
|
+ LEFT JOIN tld_inventory_gs b ON a.material_id = b.material_id
|
|
|
+ LEFT JOIN tld_material c ON a.wllb_code = c.CODE
|
|
|
+ <trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
+ <if test="accountSleeve != null and accountSleeve != ''">
|
|
|
+ and a.account_sleeve = #{accountSleeve}
|
|
|
</if>
|
|
|
</trim>
|
|
|
+ GROUP BY a.material_id
|
|
|
+ </select>
|
|
|
+ <!--查询本地库存.gs库存.录入库存 数量 中 没有连接到的gs的数据-->
|
|
|
+ <select id="getInventoryLocalityGs" resultType="java.util.Map">
|
|
|
+ select
|
|
|
+ c.code AS wllbCode,
|
|
|
+ a.material_id AS materialId,
|
|
|
+ a.amount AS gsAmount,
|
|
|
+ 0 AS amount,
|
|
|
+ c.NAME AS name,
|
|
|
+ a.account_sleeve as accountSleeve
|
|
|
+ from tld_inventory_gs a
|
|
|
+ LEFT JOIN tld_material c ON a.material_id = c.tld_id
|
|
|
+ where material_id not in
|
|
|
+ <foreach collection="list" index="index" item="item" separator="," close=")" open="(">
|
|
|
+ <if test="item.bId != null and item.bId != ''">
|
|
|
+ #{item.bId}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
</select>
|
|
|
</mapper>
|