|
@@ -2,70 +2,228 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.tld.mapper.InventoryMapper">
|
|
|
- <!--添加盘点-->
|
|
|
+ <!--录入盘点-->
|
|
|
<insert id="addInventory">
|
|
|
- insert into tld_inventory(storage_location_code,wllb_class,library_type,material_id,amount,total,totime,hold,amount_lock,account_sleeve,wbs,supplier_id,serial,wllb_code,produc_date,scrq,produc_batch,attribute)
|
|
|
- values (#{storageLocationCode},#{wllbClass},#{libraryType},#{materialId},#{amount},#{total},#{totime},#{hold},#{amountLock},#{accountSleeve},#{wbs},#{supplierId},#{serial},#{wllbCode},#{producDate},#{scrq},#{producBatch},#{attribute})
|
|
|
+ insert into tld_plate(storage_location_code, amount, total, wllb_code, scrq, material_id, plate_id,
|
|
|
+ account_sleeve, supplier_id, serial, attribute, uuid)
|
|
|
+ values (#{storageLocationCode}, #{amount}, #{total}, #{wllbCode}, now(), #{materialId}, #{plateId},
|
|
|
+ #{accountSleeve}, #{supplierId}, #{serial}, #{attribute}, #{uuid})
|
|
|
</insert>
|
|
|
- <!--添加录入盘点信息-->
|
|
|
- <insert id="addInventoryLogging">
|
|
|
- insert into tld_inventory_logging(storage_location_code,wllb_class,library_type,material_id,amount,total,totime,hold,amount_lock,account_sleeve,wbs,supplier_id,serial,wllb_code,produc_date,scrq,produc_batch,attribute)
|
|
|
- values (#{storageLocationCode},#{wllbClass},#{libraryType},#{materialId},#{amount},#{total},#{totime},#{hold},#{amountLock},#{accountSleeve},#{wbs},#{supplierId},#{serial},#{wllbCode},#{producDate},#{scrq},#{producBatch},#{attribute})
|
|
|
+ <!--添加盘点主表信息-->
|
|
|
+ <insert id="addInventoryPlate">
|
|
|
+ insert into tld_plate_f(user_id, scrq, uuid, title)
|
|
|
+ values (#{modifyUser}, now(), #{uuid}, #{title})
|
|
|
</insert>
|
|
|
- <!--查询盘点-->
|
|
|
- <select id="getInventoryList" resultType="com.tld.model.MakeInventory">
|
|
|
- SELECT
|
|
|
- a.storage_location_code,
|
|
|
- a.amount,
|
|
|
- a.account_sleeve,
|
|
|
- a.wllb_code,
|
|
|
- a.supplier_id,
|
|
|
- a.produc_batch,
|
|
|
- a.material_id,
|
|
|
- c.material_id AS gsMaterialId,
|
|
|
- c.amount AS gsAmount,
|
|
|
- c.account_sleeve AS gsaccountSleeve,
|
|
|
- b.NAME
|
|
|
- FROM
|
|
|
- tld_inventory a
|
|
|
- LEFT JOIN tld_material b ON a.wllb_code = b.CODE
|
|
|
- LEFT JOIN tld_inventory_gs c ON a.material_id = c.material_id
|
|
|
+ <!--添加盘点子表信息-->
|
|
|
+ <insert id="addInventoryPlates">
|
|
|
+ insert into tld_plate_z(plate_id, material_id, wllb_code, name, amount, gs_amount)
|
|
|
+ values (#{plateId}, #{materialId}, #{wllbCode}, #{name}, #{amount}, #{gsAmount})
|
|
|
+ </insert>
|
|
|
+ <!--修改录入信息为主表id为空的添加主表uuid进行关联-->
|
|
|
+ <update id="updateInventoryPlate">
|
|
|
+ update tld_plate
|
|
|
+ set plate_id = #{uuid}
|
|
|
+ where scrq like CONCAT(CONCAT('%', #{scrq}), '%')
|
|
|
+ and (plate_id is null or plate_id = '')
|
|
|
+ </update>
|
|
|
+ <!--删除重复录入的信息-->
|
|
|
+ <delete id="delInventoryRepetition">
|
|
|
+ delete
|
|
|
+ from tld_plate
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+ <!--导出盘点数据-->
|
|
|
+ <select id="export" resultType="java.util.LinkedHashMap">
|
|
|
+ SELECT storage_location_code,
|
|
|
+ amount,
|
|
|
+ account_sleeve,
|
|
|
+ wllb_code,
|
|
|
+ supplier_id,
|
|
|
+ produc_batch,
|
|
|
+ material_id
|
|
|
+ FROM tld_inventory
|
|
|
+ </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
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
- <if test="storageLocationCode != null and storageLocationCode != ''">
|
|
|
- and a.storage_location_code = #{storageLocationCode}
|
|
|
+ <if test="wllbCodes != null and wllbCodes != ''">
|
|
|
+ and wllb_code = #{wllbCodes}
|
|
|
+ </if>
|
|
|
+ <if test="materialId != null and materialId != ''">
|
|
|
+ and material_id = #{materialId}
|
|
|
+ </if>
|
|
|
+ <if test="amount != null and amount != ''">
|
|
|
+ and amount = #{amount}
|
|
|
</if>
|
|
|
- <if test="wllbClass != null and wllbClass != ''">
|
|
|
- and a.wllb_class = #{wllbClass}
|
|
|
+ <if test="total != null and total != ''">
|
|
|
+ and total = #{total}
|
|
|
+ </if>
|
|
|
+ <if test="storageLocationCodes != null and storageLocationCodes != ''">
|
|
|
+ and storage_location_code = #{storageLocationCodes}
|
|
|
+ </if>
|
|
|
+ <if test="plateId != null and plateId != ''">
|
|
|
+ and plate_id = #{plateId}
|
|
|
</if>
|
|
|
<if test="accountSleeve != null and accountSleeve != ''">
|
|
|
- and a.account_sleeve = #{accountSleeve}
|
|
|
+ and account_sleeve = #{accountSleeve}
|
|
|
</if>
|
|
|
- <if test="id != null and id != ''">
|
|
|
- and a.id = #{id}
|
|
|
+ <if test="supplierId != null and supplierId != ''">
|
|
|
+ and supplier_id = #{supplierId}
|
|
|
</if>
|
|
|
- <if test="libraryType != null and libraryType != ''">
|
|
|
- and a.library_type = #{libraryType}
|
|
|
+ <if test="serial != null and serial != ''">
|
|
|
+ and serial = #{serial}
|
|
|
</if>
|
|
|
- <if test="wllbCode != null and wllbCode != ''">
|
|
|
- and a.wllb_code = #{wllbCode}
|
|
|
+ <if test="attribute != null and attribute != ''">
|
|
|
+ and attribute = #{attribute}
|
|
|
+ </if>
|
|
|
+ <if test="uuid != null and uuid != ''">
|
|
|
+ and uuid = #{uuid}
|
|
|
+ </if>
|
|
|
+ <if test="scrq != null and scrq != ''">
|
|
|
+ and scrq like CONCAT(CONCAT('%', #{scrq}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ and sqrq <![CDATA[>=]]> #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
+ and sqrq <![CDATA[<=]]> #{endTime}
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ order by scrq desc
|
|
|
+ </select>
|
|
|
+ <!--查询盘点主表信息-->
|
|
|
+ <select id="getInventoryDataList" resultType="com.tld.model.MakeInventory">
|
|
|
+ select
|
|
|
+ id,
|
|
|
+ user_id,
|
|
|
+ scrq,
|
|
|
+ uuid,
|
|
|
+ title
|
|
|
+ from tld_plate_f
|
|
|
+ <trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
+ and user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="uuid != null and uuid != ''">
|
|
|
+ and uuid = #{uuid}
|
|
|
+ </if>
|
|
|
+ <if test="scrq != null and scrq != ''">
|
|
|
+ and scrq like CONCAT(CONCAT('%', #{scrq}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="title != null and title != ''">
|
|
|
+ and title like CONCAT(CONCAT('%', #{title}), '%')
|
|
|
+ </if>
|
|
|
+ <if test="plateId != null and plateId != ''">
|
|
|
+ and id = #{plateId}
|
|
|
</if>
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ and sqrq <![CDATA[>=]]> #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
+ and sqrq <![CDATA[<=]]> #{endTime}
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ order by scrq desc
|
|
|
+ </select>
|
|
|
+ <!--查询盘点录入信息是否重复-->
|
|
|
+ <select id="getInventoryRepetition" 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
|
|
|
+ <trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="materialId != null and materialId != ''">
|
|
|
- and a.material_id = #{materialId}
|
|
|
+ and material_id = #{materialId}
|
|
|
+ </if>
|
|
|
+ <if test="accountSleeve != null and accountSleeve != ''">
|
|
|
+ and account_sleeve = #{accountSleeve}
|
|
|
+ </if>
|
|
|
+ <if test="supplierId != null and supplierId != ''">
|
|
|
+ and supplier_id = #{supplierId}
|
|
|
</if>
|
|
|
- <if test="name != null and name != ''">
|
|
|
- and b.name like CONCAT(CONCAT('%', #{name}), '%')
|
|
|
+ <if test="serial != null and serial != ''">
|
|
|
+ and serial = #{serial}
|
|
|
+ </if>
|
|
|
+ <if test="attribute != null and attribute != ''">
|
|
|
+ and attribute = #{attribute}
|
|
|
+ </if>
|
|
|
+ <if test="uuid != null and uuid != ''">
|
|
|
+ and uuid = #{uuid}
|
|
|
</if>
|
|
|
</trim>
|
|
|
</select>
|
|
|
- <!--导出盘点数据-->
|
|
|
- <select id="export" resultType="java.util.LinkedHashMap">
|
|
|
- SELECT storage_location_code,
|
|
|
- amount,
|
|
|
- account_sleeve,
|
|
|
- wllb_code,
|
|
|
- supplier_id,
|
|
|
- produc_batch,
|
|
|
- material_id
|
|
|
- FROM tld_inventory
|
|
|
+ <!--查询本地库存.gs库存.录入库存 数量-->
|
|
|
+ <select id="getInventoryPlate" resultType="com.tld.model.MakeInventory">
|
|
|
+ SELECT a.storage_location_code,
|
|
|
+ a.account_sleeve,
|
|
|
+ a.wllb_code,
|
|
|
+ a.supplier_id,
|
|
|
+ a.produc_batch,
|
|
|
+ a.material_id,
|
|
|
+ b.NAME,
|
|
|
+ a.amount,
|
|
|
+ c.amount AS gsAmount
|
|
|
+ FROM tld_inventory a
|
|
|
+ LEFT JOIN tld_material b ON a.wllb_code = b.CODE
|
|
|
+ INNER JOIN tld_inventory_gs c ON a.material_id = c.material_id
|
|
|
+ </select>
|
|
|
+ <!--查询是否重复-->
|
|
|
+ <select id="getInventoryPlates" resultType="com.tld.model.MakeInventory">
|
|
|
+ select *
|
|
|
+ from tld_plate_z
|
|
|
+ where material_id = #{materialId}
|
|
|
+ and plate_id = #{plateId}
|
|
|
+ and uuid = #{uuid}
|
|
|
+ </select>
|
|
|
+ <!--查询盘点子表信息-->
|
|
|
+ <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
|
|
|
+ <trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
+ <if test="materialId != null and materialId != ''">
|
|
|
+ and material_id = #{materialId}
|
|
|
+ </if>
|
|
|
+ <if test="wllbCode != null and wllbCode != ''">
|
|
|
+ and wllb_code = #{wllbCode}
|
|
|
+ </if>
|
|
|
+ <if test="uuid != null and uuid != ''">
|
|
|
+ and uuid = #{uuid}
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
</select>
|
|
|
</mapper>
|