|
|
@@ -27,12 +27,12 @@
|
|
|
<!-- 查询总数量 -->
|
|
|
<select id="getScanNum" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
- sum(a.num) + ${num} + c.amount as scanNum,
|
|
|
+ (ifnull(sum(a.num), 0) + ${num} + ifnull(c.amount, 0)) as scanNum,
|
|
|
b.storage_location_capacity as storageLocationCapacity
|
|
|
FROM
|
|
|
tld_warehousing_virtual a
|
|
|
join tld_storage_location b on a.storage_location_code = b.storage_location_code
|
|
|
- join tld_inventory c on a.storage_location_code = c.storage_location_code
|
|
|
+ left join tld_inventory c on a.storage_location_code = c.storage_location_code
|
|
|
where a.storage_location_code = #{storageLocationCode}
|
|
|
</select>
|
|
|
<!-- 查询 -->
|
|
|
@@ -54,22 +54,23 @@
|
|
|
</select>
|
|
|
<!-- 删除虚拟表 -->
|
|
|
<delete id="delWarehousingVirtual">
|
|
|
- delete from tld_warehousing_virtual where serial = #{serial} and wllb_code = #{wllbCode}
|
|
|
+ delete from tld_warehousing_virtual where serial = #{serial} and wllb_code = #{wllbCode} and produc_date = #{producDate} and supp_id = #{suppId}
|
|
|
</delete>
|
|
|
<!-- 查询虚拟表数据进行入库 -->
|
|
|
<select id="getVirtual" resultType="com.tld.model.WarehousingVirtual">
|
|
|
select * from tld_warehousing_virtual where unique_code = #{uniqueCode}
|
|
|
</select>
|
|
|
<!-- 查询采购单信息 -->
|
|
|
- <select id="getReceiveGoods" resultType="com.tld.model.WarehousingVirtual">
|
|
|
+ <select id="getReceiveGoods" resultType="com.tld.model.ReceiveGoods">
|
|
|
SELECT
|
|
|
- a.*,b.company_number,b.order_number,b.source_type,b.move_type
|
|
|
+ a.*,b.company_number,b.order_number,b.source_type,b.move_type,f.name as supplierName
|
|
|
FROM
|
|
|
tld_receive_goods a
|
|
|
- JOIN tld_receive_goods_f b on a.order_code = b.order_code
|
|
|
- JOIN tld_material c on a.material_id = c.tld_id and c.code = #{wllbCode}
|
|
|
+ LEFT JOIN tld_receive_goods_f b on a.order_code = b.order_code
|
|
|
+ LEFT JOIN tld_material c on a.material_id = c.tld_id and c.code = #{wllbCode}
|
|
|
+ LEFT JOIN tld_customer f on a.supplier_id = f.tld_id
|
|
|
WHERE
|
|
|
- a.supplier_id = #{suppId} and a.warehousing_num <![CDATA[<]]> a.qualified_num
|
|
|
+ a.supplier_id = #{suppId} and IFNULL(a.warehousing_num, 0 ) <![CDATA[<]]> a.qualified_num
|
|
|
ORDER BY
|
|
|
a.arrival_time DESC
|
|
|
</select>
|
|
|
@@ -77,27 +78,29 @@
|
|
|
<update id="updateReceiveGood">
|
|
|
update tld_receive_goods
|
|
|
set
|
|
|
- warehousing_num = (select warehousing_num + ${warehousingNum} from tld_receive_goods where id = #{id})
|
|
|
+ warehousing_num = (
|
|
|
+ select a.result from (select (warehousing_num + ${warehousingNum}) as result from tld_receive_goods where id = #{id}) a
|
|
|
+ )
|
|
|
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 wllb_class,tld_id as materialId 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)
|
|
|
+ insert into tld_storage(wllb_code,supplier_id,serial,produc_date,produc_batch,capacity,seq,type,user_id,department_id,storage_location_code,scrq)
|
|
|
values
|
|
|
<foreach collection="list" index="index" item="item" separator=",">
|
|
|
- (#{wllbCode},#{suppId},#{serial},#{producDate},#{producDate},#{capacity},#{seq},#{type},#{userId},#{departmentId},#{storageLocationCode},now(),#{storageCode})
|
|
|
+ (#{item.wllbCode},#{item.suppId},#{item.serial},#{item.producDate},#{item.producDate},#{item.num},#{item.seq},#{item.type},#{item.userId},#{item.departmentId},#{item.storageLocationCode},now())
|
|
|
</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)
|
|
|
+ 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)
|
|
|
values
|
|
|
<foreach collection="list" index="index" item="item" separator=",">
|
|
|
- (#{storageLocationCode},#{wllbClass},#{part},#{num},now(),'0','0',#{accountSleeve},#{wbs},#{suppId},#{serial})
|
|
|
+ (#{item.storageLocationCode},#{item.wllbClass},#{item.materialId},#{item.num},now(),'0','0',#{item.accountSleeve},#{item.wbs},#{item.suppId},#{item.serial},#{item.wllbCode},#{item.producDate})
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
<!-- 删除临时表数据 -->
|
|
|
@@ -112,17 +115,15 @@
|
|
|
<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 * from tld_return_gs_warehousing where #{orderNumber} LIKE CONCAT('%', CONCAT(order_number, ','), '%')
|
|
|
</select>
|
|
|
<!-- 查询入库流水 -->
|
|
|
<select id="warehousingFlowing" resultType="com.tld.model.Storage">
|
|
|
select
|
|
|
+ a.id,
|
|
|
a.wllb_code,
|
|
|
h.name as supplierName,
|
|
|
a.serial,
|
|
|
@@ -140,7 +141,7 @@
|
|
|
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
|
|
|
+ left join tld_customer h on a.supplier_id = h.code
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="wllbCode != null and wllbCode != ''">
|
|
|
and a.wllb_code = #{wllbCode}
|
|
|
@@ -177,7 +178,7 @@
|
|
|
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
|
|
|
+ left join tld_customer h on a.supplier_id = h.code
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
|
<if test="wllbCode != null and wllbCode != ''">
|
|
|
and a.wllb_code = #{wllbCode}
|
|
|
@@ -190,4 +191,11 @@
|
|
|
</if>
|
|
|
</trim>
|
|
|
</select>
|
|
|
+ <!-- 查询是否扫描 -->
|
|
|
+ <select id="getScanIsNot" resultType="java.util.Map">
|
|
|
+ select
|
|
|
+ (select count(*) from tld_inventory where supplier_id = #{suppId} and serial = #{unique} and wllb_code = #{wllbCode} and produc_date = #{producDate}) as inventoryCount,
|
|
|
+ (select count(*) from tld_warehousing_virtual where supp_id = #{suppId} and serial = #{unique} and wllb_code = #{wllbCode} and produc_date = #{producDate}) as virtualCount
|
|
|
+ from dual
|
|
|
+ </select>
|
|
|
</mapper>
|