|
@@ -27,8 +27,8 @@
|
|
|
</select>
|
|
|
<!-- 新增库位信息虚拟表 -->
|
|
|
<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,storage_location_name)
|
|
|
- values(#{uniqueCode},#{num},#{storageLocationCode},#{wllbCode},#{suppId},#{serial},#{type},#{producDate},#{capacity},#{seq},#{userId},#{storageLocationName})
|
|
|
+ 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,attribute,notice_id)
|
|
|
+ values(#{uniqueCode},#{num},#{storageLocationCode},#{wllbCode},#{suppId},#{serial},#{type},#{producDate},#{capacity},#{seq},#{userId},#{storageLocationName},#{attribute},#{noticeId})
|
|
|
</insert>
|
|
|
<!-- 查询总数量 -->
|
|
|
<select id="getScanNum" resultType="java.util.Map">
|
|
@@ -93,11 +93,12 @@
|
|
|
a.capacity,
|
|
|
a.seq,
|
|
|
a.user_id,
|
|
|
+ a.attribute,
|
|
|
a.storage_location_name,
|
|
|
b.user_name
|
|
|
from tld_warehousing_virtual a
|
|
|
left join tld_user b on a.user_id = b.id
|
|
|
- where a.unique_code = #{uniqueCode}
|
|
|
+ where a.unique_code = #{uniqueCode} and a.type = #{type}
|
|
|
</select>
|
|
|
<!-- 查询采购单信息 -->
|
|
|
<select id="getReceiveGoods" resultType="com.tld.model.ReceiveGoods">
|
|
@@ -152,10 +153,10 @@
|
|
|
</insert>
|
|
|
<!-- 插入库存 -->
|
|
|
<insert id="addInventory">
|
|
|
- insert into tld_inventory(storage_location_code,wllb_class,material_id,amount,totime,hold,amount_lock,account_sleeve,wbs,supplier_id,serial,wllb_code,produc_date,scrq)
|
|
|
+ insert into tld_inventory(storage_location_code,wllb_class,material_id,amount,totime,hold,amount_lock,account_sleeve,wbs,supplier_id,serial,wllb_code,produc_date,scrq,produc_batch)
|
|
|
values
|
|
|
<foreach collection="list" index="index" item="item" separator=",">
|
|
|
- (#{item.storageLocationCode},#{item.wllbClass},#{item.materialId},#{item.num},now(),'0','0',#{item.accountSleeve},#{item.wbs},#{item.suppId},#{item.serial},#{item.wllbCode},#{item.producDate}, now())
|
|
|
+ (#{item.storageLocationCode},#{item.wllbClass},#{item.materialId},#{item.num},now(),'0','0',#{item.accountSleeve},#{item.wbs},#{item.suppId},#{item.serial},#{item.wllbCode},#{item.producDate}, now(),#{item.producDate}, '0')
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
<!-- 删除临时表数据 -->
|
|
@@ -296,16 +297,19 @@
|
|
|
a.num,
|
|
|
a.type,
|
|
|
a.warehousing_num,
|
|
|
- a.company_number,
|
|
|
+ b.company_number,
|
|
|
c.name as materialName,
|
|
|
c.wllb_class as wllbClass
|
|
|
from tld_notice a
|
|
|
join tld_notice_f b on a.notice_id = b.notice_id
|
|
|
- left join tld_material c on a.material_id = c.tld_id
|
|
|
+ join tld_material c on a.material_id = c.tld_id
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="type != null and type != ''">
|
|
|
and a.type = #{type}
|
|
|
</if>
|
|
|
+ <if test="materialCode != null and materialCode != ''">
|
|
|
+ and c.code = #{materialCode}
|
|
|
+ </if>
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
and b.notice_time <![CDATA[>=]]> #{startTime}
|
|
|
</if>
|
|
@@ -330,57 +334,62 @@
|
|
|
b.wllb_class,
|
|
|
c.source_type,
|
|
|
c.move_type,
|
|
|
- b.code as materialCode
|
|
|
+ b.code as materialCode,
|
|
|
c.notice_time as noticeTime
|
|
|
from tld_notice a
|
|
|
join tld_notice_f c on a.notice_id = c.notice_id
|
|
|
left join tld_material b on a.material_id = b.tld_id
|
|
|
where a.notice_id = #{noticeId} and a.material_id = #{materialId}
|
|
|
</select>
|
|
|
- <!-- 半成品跟部分产成品入虚拟库存 -->
|
|
|
+ <!-- 半成品跟部分产成品入库存 -->
|
|
|
<insert id="addInventoryNotice">
|
|
|
insert into
|
|
|
- tld_inventory(storage_location_code,material_id,amount,hold,amount_lock,account_sleeve,wbs,produc_date,scrq,wllb_class)
|
|
|
- value('000000',#{materialId},#{warehousingNum},'0','0',#{companyNumber},#{wbs},now(),now(),#{wllbClass});
|
|
|
- update tld_notice set warehousing_num = warehousing_num + #{num},type = '1' where notice_id = #{noticeId} and material_id = #{materialId}
|
|
|
+ tld_inventory(storage_location_code,material_id,amount,hold,amount_lock,account_sleeve,wbs,produc_date,scrq,wllb_class,produc_batch,attribute)
|
|
|
+ value(#{storageLocationCode},#{materialId},#{warehousingNum},'0','0',#{companyNumber},#{wbs},now(),now(),#{wllbClass},#{producBatch},#{attribute});
|
|
|
+ update tld_notice set warehousing_num = #{warehousingNum},type = '1' where notice_id = #{noticeId} and material_id = #{materialId}
|
|
|
</insert>
|
|
|
<!-- 查询库存里是否存在半成品虚拟库位 -->
|
|
|
<select id="getInventoryNotice" resultType="int">
|
|
|
- select count(0) from tld_inventory where storage_location_code = '000000' and material_id = #{materialId}
|
|
|
+ select count(0) from tld_inventory where storage_location_code = #{storageLocationCode} and material_id = #{materialId}
|
|
|
</select>
|
|
|
- <!-- 增加半成品虚拟库位数量 -->
|
|
|
+ <!-- 增加半成品/产成品虚拟库位数量 -->
|
|
|
<update id="updateInventoryNotice">
|
|
|
- update tld_inventory set amount = amount + #{warehousingNum} where storage_location_code = '000000';
|
|
|
- update tld_notice set warehousing_num = warehousing_num + #{warehousingNum},type = '1' where notice_id = #{noticeId} and material_id = #{materialId}
|
|
|
+ update tld_inventory set amount = amount + #{warehousingNum} where storage_location_code = #{storageLocationCode};
|
|
|
+ update tld_notice set warehousing_num = #{warehousingNum},type = '1' where notice_id = #{noticeId} and material_id = #{materialId}
|
|
|
</update>
|
|
|
<!-- 半成品出库库存查询 -->
|
|
|
- <select id="getHalfInventory" resultType="com.tld.model.Notice">
|
|
|
- select storage_location_code,wllb_class,material_id,amount from tld_inventory where storage_location_code = '000000' and material_id = #{materialId}
|
|
|
+ <select id="getHalfInventory" resultType="com.tld.model.Inventory">
|
|
|
+ select storage_location_code,wllb_class,material_id,amount from tld_inventory where storage_location_code = #{storageLocationCode} and material_id = #{materialId}
|
|
|
</select>
|
|
|
<!-- 删除库存信息 -->
|
|
|
<delete id="delInventoryNotice">
|
|
|
- delete from tld_inventory where storage_location_code = '000000' and material_id = #{materialId}
|
|
|
+ delete from tld_inventory where storage_location_code = #{storageLocationCode} and material_id = #{materialId}
|
|
|
</delete>
|
|
|
<!-- 删减库存 -->
|
|
|
<update id="updateInventoryNoticeNum">
|
|
|
- update tld_inventory set amount = amount - #{num} where storage_location_code = '000000' and material_id = #{materialId}
|
|
|
+ update tld_inventory set amount = amount - #{warehousingNum} where storage_location_code = #{storageLocationCode} and material_id = #{materialId}
|
|
|
</update>
|
|
|
<!-- 新增半成品入库流水 -->
|
|
|
<insert id="addProduct">
|
|
|
insert into tld_half_product(wllb_code,produc_date,produc_batch,capacity,user_id,storage_location_code,scrq)
|
|
|
- value(#{wllbCode},#{producDate},#{producBatch},#{producBatch},#{num},#{userId},#{storageLocationCode},now())
|
|
|
+ value(#{wllbCode},#{producDate},#{producDate},#{num},#{userId},#{storageLocationCode},now())
|
|
|
</insert>
|
|
|
<!-- 查询半成品入库流水-->
|
|
|
<select id="getProduct" resultType="com.tld.model.Notice">
|
|
|
select
|
|
|
+ a.id,
|
|
|
a.wllb_code,
|
|
|
a.produc_date,
|
|
|
a.produc_batch,
|
|
|
- a.capacity,
|
|
|
+ a.capacity as warehousingNum,
|
|
|
a.user_id,
|
|
|
+ c.user_name,
|
|
|
a.storage_location_code,
|
|
|
- a.scrq
|
|
|
+ a.scrq,
|
|
|
+ b.name as materialName
|
|
|
from tld_half_product a
|
|
|
+ left join tld_material b on a.wllb_code = b.code
|
|
|
+ left join tld_user c on a.user_id = c.id
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="wllbCode != null and wllbCode != ''">
|
|
|
and a.wllb_code = #{wllbCode}
|
|
@@ -394,17 +403,17 @@
|
|
|
</trim>
|
|
|
order by a.scrq desc
|
|
|
</select>
|
|
|
-
|
|
|
<!-- 查询半成品入库流水-->
|
|
|
<select id="productExcel" resultType="java.util.LinkedHashMap">
|
|
|
select
|
|
|
- b.name,
|
|
|
- a.produc_date,
|
|
|
- a.capacity,
|
|
|
- a.user_id,
|
|
|
- a.scrq
|
|
|
+ b.name,
|
|
|
+ a.produc_date,
|
|
|
+ a.capacity,
|
|
|
+ c.user_name,
|
|
|
+ a.scrq
|
|
|
from tld_half_product a
|
|
|
- right join tld_material b on a.wllb_code = b.tld_id
|
|
|
+ left join tld_material b on a.wllb_code = b.code
|
|
|
+ left join tld_user c on a.user_id = c.id
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="wllbCode != null and wllbCode != ''">
|
|
|
and a.wllb_code = #{wllbCode}
|
|
@@ -430,18 +439,95 @@
|
|
|
a.out_num,
|
|
|
a.entry_number,
|
|
|
b.source_type,
|
|
|
- b.move_type
|
|
|
+ b.move_type,
|
|
|
+ c.code as wllbCode,
|
|
|
+ a.type,
|
|
|
+ b.department
|
|
|
from tld_ask_goods a
|
|
|
join tld_ask_goods_f b on a.ask_goods_id = b. ask_goods_id
|
|
|
+ left join tld_material c on a.material_id = c.tld_id
|
|
|
where a.ask_goods_id = #{askGoodsId} and a.material_id = #{materialId}
|
|
|
</select>
|
|
|
<!-- 修改要货单出库数量 -->
|
|
|
<update id="updateAskGoodsHalf">
|
|
|
- update tld_ask_goods set out_num = out_num + #{warehousingNum} where id = #{id}
|
|
|
+ update tld_ask_goods set out_num = out_num + #{warehousingNum},type = '1' where id = #{id}
|
|
|
</update>
|
|
|
<!-- 新增半成品流水 -->
|
|
|
<insert id="addRemovalHalfProduct">
|
|
|
- insert into tld_removal_half_product(material_id,num,user_id,scrq,ask_goods_id,department)
|
|
|
- value(#{materialId},#{num},#{userId},now(),#{askGoodsId},#{department})
|
|
|
+ insert into tld_removal_half_product(wllb_code,num,user_id,scrq,ask_goods_id,department)
|
|
|
+ value(#{wllbCode},#{num},#{userId},now(),#{askGoodsId},#{department})
|
|
|
</insert>
|
|
|
+ <!-- 查询指定物料内容 -->
|
|
|
+ <select id="getMaterial" resultType="com.tld.model.MaterialClass">
|
|
|
+ select
|
|
|
+ code as wllbCode,
|
|
|
+ name as wllbName,
|
|
|
+ tld_id,
|
|
|
+ specification_and_model,
|
|
|
+ unit_of_measurement,
|
|
|
+ size,
|
|
|
+ wllb_class,
|
|
|
+ is_not_disable,
|
|
|
+ is_recommend,
|
|
|
+ part_type
|
|
|
+ from tld_material where tld_id = #{materialId}
|
|
|
+ <trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
+ <if test="materialId != null and materialId != ''">
|
|
|
+ and tld_id = #{materialId}
|
|
|
+ </if>
|
|
|
+ <if test="materialCode != null and materialCode != ''">
|
|
|
+ and wllb_code = #{materialCode}
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </select>
|
|
|
+ <!-- 查询库存信息 -->
|
|
|
+ <select id="getInventoryInfo" resultType="com.tld.model.Inventory">
|
|
|
+ select
|
|
|
+ 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
|
|
|
+ from tld_inventory where storage_location_code = #{storageLocationCode}
|
|
|
+ </select>
|
|
|
+ <!-- 产成品入库 -->
|
|
|
+ <insert id="addHalf">
|
|
|
+ insert into tld_half(wllb_code,produc_date,produc_batch,capacity,user_id,storage_location_code,scrq,serial,seq,attribute)
|
|
|
+ value(#{wllbCode},#{producDate},#{producDate},#{num},#{userId},#{storageLocationCode},now(),#{scrq},#{serial},#{seq},#{attribute})
|
|
|
+ </insert>
|
|
|
+ <!-- 查询虚拟表数据进行入库 -->
|
|
|
+ <select id="getVirtual" resultType="com.tld.model.WarehousingVirtual">
|
|
|
+ select
|
|
|
+ a.id,
|
|
|
+ a.unique_code,
|
|
|
+ a.num,
|
|
|
+ a.storage_location_code,
|
|
|
+ a.wllb_code,
|
|
|
+ a.supp_id,
|
|
|
+ a.serial,
|
|
|
+ a.type,
|
|
|
+ a.produc_date,
|
|
|
+ a.capacity,
|
|
|
+ a.seq,
|
|
|
+ a.user_id,
|
|
|
+ a.attribute,
|
|
|
+ a.storage_location_name,
|
|
|
+ b.user_name
|
|
|
+ from tld_warehousing_virtual a
|
|
|
+ left join tld_user b on a.user_id = b.id
|
|
|
+ where a.unique_code = #{uniqueCode} and a.type = #{type} and a.notice_id = #{noticeId}
|
|
|
+ </select>
|
|
|
</mapper>
|