|
@@ -2,6 +2,9 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.tld.mapper.WarehousingMapper">
|
|
<mapper namespace="com.tld.mapper.WarehousingMapper">
|
|
|
|
|
+ <sql id="field">
|
|
|
|
|
+ order_code,material_id,purchase_num,arrival_num,type,qualified_num,disqualification_num,wbs,arrival_time,measurement_id,supplier_id,entry_number,warehousing_num
|
|
|
|
|
+ </sql>
|
|
|
<!-- 查询物料库位 -->
|
|
<!-- 查询物料库位 -->
|
|
|
<select id="getMaterialClass" resultType="com.tld.model.MaterialClass">
|
|
<select id="getMaterialClass" resultType="com.tld.model.MaterialClass">
|
|
|
select * from tld_material_class where wllb_code = #{wllbCode}
|
|
select * from tld_material_class where wllb_code = #{wllbCode}
|
|
@@ -18,13 +21,13 @@
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 新增库位信息虚拟表 -->
|
|
<!-- 新增库位信息虚拟表 -->
|
|
|
<insert id="addWarehousingVirtual">
|
|
<insert id="addWarehousingVirtual">
|
|
|
- insert into tld_warehousing_virtual(unique_code,num,storage_location_code,wllb_code,supp_id,serial,type,produc_date,capacity,seq,user_id)
|
|
|
|
|
- values(#{uniqueCode},#{num},#{storageLocationCode},#{wllbCode},#{suppId},#{serial},#{type},#{producDate},#{capacity},#{seq},#{userId})
|
|
|
|
|
|
|
+ insert into tld_warehousing_virtual(unique_code,num,storage_location_code,wllb_code,supp_id,serial,type,produc_date,capacity,seq,user_id,storage_location_name)
|
|
|
|
|
+ values(#{uniqueCode},#{num},#{storageLocationCode},#{wllbCode},#{suppId},#{serial},#{type},#{producDate},#{capacity},#{seq},#{userId},#{storageLocationName})
|
|
|
</insert>
|
|
</insert>
|
|
|
<!-- 查询总数量 -->
|
|
<!-- 查询总数量 -->
|
|
|
<select id="getScanNum" resultType="java.util.Map">
|
|
<select id="getScanNum" resultType="java.util.Map">
|
|
|
SELECT
|
|
SELECT
|
|
|
- sum(a.num) + #{num} + c.amount as scanNum,
|
|
|
|
|
|
|
+ sum(a.num) + ${num} + c.amount as scanNum,
|
|
|
b.storage_location_capacity as storageLocationCapacity
|
|
b.storage_location_capacity as storageLocationCapacity
|
|
|
FROM
|
|
FROM
|
|
|
tld_warehousing_virtual a
|
|
tld_warehousing_virtual a
|
|
@@ -60,7 +63,7 @@
|
|
|
<!-- 查询采购单信息 -->
|
|
<!-- 查询采购单信息 -->
|
|
|
<select id="getReceiveGoods" resultType="com.tld.model.WarehousingVirtual">
|
|
<select id="getReceiveGoods" resultType="com.tld.model.WarehousingVirtual">
|
|
|
SELECT
|
|
SELECT
|
|
|
- a.*,b.company_number
|
|
|
|
|
|
|
+ a.*,b.company_number,b.order_number,b.source_type,b.move_type
|
|
|
FROM
|
|
FROM
|
|
|
tld_receive_goods a
|
|
tld_receive_goods a
|
|
|
JOIN tld_receive_goods_f b on a.order_code = b.order_code
|
|
JOIN tld_receive_goods_f b on a.order_code = b.order_code
|
|
@@ -69,6 +72,122 @@
|
|
|
a.supplier_id = #{suppId} and a.warehousing_num <![CDATA[<]]> a.qualified_num
|
|
a.supplier_id = #{suppId} and a.warehousing_num <![CDATA[<]]> a.qualified_num
|
|
|
ORDER BY
|
|
ORDER BY
|
|
|
a.arrival_time DESC
|
|
a.arrival_time DESC
|
|
|
- limit 2
|
|
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 修改采购单入库数量 -->
|
|
|
|
|
+ <update id="updateReceiveGood">
|
|
|
|
|
+ update tld_receive_goods
|
|
|
|
|
+ set
|
|
|
|
|
+ warehousing_num = (select warehousing_num + ${warehousingNum} from tld_receive_goods where id = #{id})
|
|
|
|
|
+ where id = #{id}
|
|
|
|
|
+ </update>
|
|
|
|
|
+ <!-- 查询物料类型 -->
|
|
|
|
|
+ <select id="getWlClass" resultType="com.tld.model.WarehousingVirtual">
|
|
|
|
|
+ select wllb_class,name as part from tld_material where code = #{wllbCode}
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 插入入库流水 -->
|
|
|
|
|
+ <insert id="addStorage">
|
|
|
|
|
+ insert into tld_storage(wllb_code,supplier_id,serial,produc_date,produc_batch,capacity,seq,type,user_id,department_id,storage_location_code,scrq,storage_code)
|
|
|
|
|
+ values
|
|
|
|
|
+ <foreach collection="list" index="index" item="item" separator=",">
|
|
|
|
|
+ (#{wllbCode},#{suppId},#{serial},#{producDate},#{producDate},#{capacity},#{seq},#{type},#{userId},#{departmentId},#{storageLocationCode},now(),#{storageCode})
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </insert>
|
|
|
|
|
+ <!-- 插入库存 -->
|
|
|
|
|
+ <insert id="addInventory">
|
|
|
|
|
+ insert into tld_inventory(storage_location_code,wllb_class,part,amount,totime,hold,amount_lock,account_sleeve,wbs,supplier_id,serial)
|
|
|
|
|
+ values
|
|
|
|
|
+ <foreach collection="list" index="index" item="item" separator=",">
|
|
|
|
|
+ (#{storageLocationCode},#{wllbClass},#{part},#{num},now(),'0','0',#{accountSleeve},#{wbs},#{suppId},#{serial})
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </insert>
|
|
|
|
|
+ <!-- 删除临时表数据 -->
|
|
|
|
|
+ <delete id="delVirtual">
|
|
|
|
|
+ delete from tld_warehousing_virtual where unique_code = #{uniqueCode}
|
|
|
|
|
+ </delete>
|
|
|
|
|
+ <!-- 查询当天质检数量 -->
|
|
|
|
|
+ <select id="getWarehousingCount" resultType="int">
|
|
|
|
|
+ select count(*) from tld_return_gs_warehousing where scrq BETWEEN CONCAT(CURDATE(),' 00:00:00') AND CONCAT(CURDATE(),' 23:59:59');
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 存入为gs穿的信息 -->
|
|
|
|
|
+ <insert id="addReturnWarehousing">
|
|
|
|
|
+ insert into tld_return_gs_warehousing(storage_code,gs_ck,source_type,move_type,entry_number,wbs,material_id,warehousing_num,receive_goods_id,scrq,order_number)
|
|
|
|
|
+ values(#{storageCode},#{gsCk},#{sourceType},#{moveType},#{entryNumber},#{wbs},#{materialId},#{warehousingNum},#{receiveGoodsId},now(),#{orderNumber});
|
|
|
|
|
+
|
|
|
|
|
+ insert into tld_receive_good_transmission_log(storage_code,gs_ck,source_type,move_type,entry_number,wbs,material_id,warehousing_num,receive_goods_id,scrq,order_number)
|
|
|
|
|
+ values(#{storageCode},#{gsCk},#{sourceType},#{moveType},#{entryNumber},#{wbs},#{materialId},#{warehousingNum},#{receiveGoodsId},now(),#{orderNumber});
|
|
|
|
|
+ </insert>
|
|
|
|
|
+ <!-- 入库回传 -->
|
|
|
|
|
+ <select id="getPlugOutWarehousing" resultType="com.tld.model.ReturnWarehousing">
|
|
|
|
|
+ select <include refid="field"/> from tld_receive_good_transmission where #{orderNumber} LIKE CONCAT('%', CONCAT(order_number, ','), '%')
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 查询入库流水 -->
|
|
|
|
|
+ <select id="warehousingFlowing" resultType="com.tld.model.Storage">
|
|
|
|
|
+ select
|
|
|
|
|
+ a.wllb_code,
|
|
|
|
|
+ h.name as supplierName,
|
|
|
|
|
+ a.serial,
|
|
|
|
|
+ a.produc_date,
|
|
|
|
|
+ a.produc_batch,
|
|
|
|
|
+ a.capacity,
|
|
|
|
|
+ a.seq,
|
|
|
|
|
+ a.type,
|
|
|
|
|
+ c.user_name as userName,
|
|
|
|
|
+ e.name as departmentName,
|
|
|
|
|
+ g.storage_location_name as storageLocationName,
|
|
|
|
|
+ a.scrq
|
|
|
|
|
+ from tld_storage a
|
|
|
|
|
+ left join tld_material b on a.wllb_code = b.code
|
|
|
|
|
+ left join tld_user c on a.user_id = c.id
|
|
|
|
|
+ left join tld_department e on a.department_id = e.tld_id
|
|
|
|
|
+ left join tld_storage_location g on a.storage_location_code = g.storage_location_code
|
|
|
|
|
+ left join tld_customer h on a.supplier_id = h.tld_id
|
|
|
|
|
+ <trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
|
|
+ <if test="wllbCode != null and wllbCode != ''">
|
|
|
|
|
+ and a.wllb_code = #{wllbCode}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and a.scrq <![CDATA[>=]]> #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and a.scrq <![CDATA[<=]]> #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </trim>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 查询虚拟入库 -->
|
|
|
|
|
+ <select id="getWarehousingVirtual" resultType="com.tld.model.WarehousingVirtual">
|
|
|
|
|
+ select * from tld_warehousing_virtual where unique_code = #{uniqueCode}
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 查询导出内容 -->
|
|
|
|
|
+ <select id="export" resultType="java.util.LinkedHashMap">
|
|
|
|
|
+ select
|
|
|
|
|
+ a.wllb_code,
|
|
|
|
|
+ h.name as supplierName,
|
|
|
|
|
+ a.serial,
|
|
|
|
|
+ a.produc_date,
|
|
|
|
|
+ a.produc_batch,
|
|
|
|
|
+ a.capacity,
|
|
|
|
|
+ a.seq,
|
|
|
|
|
+ a.type,
|
|
|
|
|
+ c.user_name as userName,
|
|
|
|
|
+ e.name as departmentName,
|
|
|
|
|
+ g.storage_location_name as storageLocationName,
|
|
|
|
|
+ a.scrq
|
|
|
|
|
+ from tld_storage a
|
|
|
|
|
+ left join tld_material b on a.wllb_code = b.code
|
|
|
|
|
+ left join tld_user c on a.user_id = c.id
|
|
|
|
|
+ left join tld_department e on a.department_id = e.tld_id
|
|
|
|
|
+ left join tld_storage_location g on a.storage_location_code = g.storage_location_code
|
|
|
|
|
+ left join tld_customer h on a.supplier_id = h.tld_id
|
|
|
|
|
+ <trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
|
|
+ <if test="wllbCode != null and wllbCode != ''">
|
|
|
|
|
+ and a.wllb_code = #{wllbCode}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
|
+ and a.scrq <![CDATA[>=]]> #{startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
|
+ and a.scrq <![CDATA[<=]]> #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </trim>
|
|
|
</select>
|
|
</select>
|
|
|
</mapper>
|
|
</mapper>
|