|
@@ -28,9 +28,9 @@
|
|
|
select count(*) from tld_ask_goods_f where ask_goods_id = #{askGoodsId} and ask_goods_code = #{askGoodsCode}
|
|
select count(*) from tld_ask_goods_f where ask_goods_id = #{askGoodsId} and ask_goods_code = #{askGoodsCode}
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 新增要料申请单父级 -->
|
|
<!-- 新增要料申请单父级 -->
|
|
|
- <insert id="addAskGoodsNumf">
|
|
|
|
|
- insert into tld_ask_goods_f(ask_goods_id,ask_goods_code,company_number,sqrq,department,source_type,move_type)
|
|
|
|
|
- values(#{askGoodsId},#{askGoodsCode},#{companyNumber},#{sqrq},#{department},#{sourceType},#{moveType})
|
|
|
|
|
|
|
+ <insert id="addAskGoodsf">
|
|
|
|
|
+ insert into tld_ask_goods_f(ask_goods_id,ask_goods_code,company_number,sqrq,department,source_type,move_type,ask_goods_apply_type)
|
|
|
|
|
+ values(#{askGoodsId},#{askGoodsCode},#{companyNumber},#{sqrq},#{department},#{sourceType},#{moveType},#{askGoodsApplyType})
|
|
|
</insert>
|
|
</insert>
|
|
|
<!-- 查询生产领料单 -->
|
|
<!-- 查询生产领料单 -->
|
|
|
<select id="getAskGoodsfList" resultType="com.tld.model.AskGoods">
|
|
<select id="getAskGoodsfList" resultType="com.tld.model.AskGoods">
|
|
@@ -40,7 +40,7 @@
|
|
|
b.name as departmentName
|
|
b.name as departmentName
|
|
|
from tld_ask_goods_f a
|
|
from tld_ask_goods_f a
|
|
|
left join tld_department b on a.department = b.tld_id
|
|
left join tld_department b on a.department = b.tld_id
|
|
|
- order by sqrq desc
|
|
|
|
|
|
|
+ order by a.sqrq desc
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 查询指定生产单的物料 -->
|
|
<!-- 查询指定生产单的物料 -->
|
|
|
<select id="getAskGoodsMaterial" resultType="com.tld.model.AskGoods">
|
|
<select id="getAskGoodsMaterial" resultType="com.tld.model.AskGoods">
|
|
@@ -55,7 +55,7 @@
|
|
|
tld_ask_goods a
|
|
tld_ask_goods a
|
|
|
left join tld_material b on a.material_id = b.tld_id
|
|
left join tld_material b on a.material_id = b.tld_id
|
|
|
WHERE
|
|
WHERE
|
|
|
- a.ask_goods_id = #{askGoodsId} and a.num <![CDATA[>]]> a.out_num
|
|
|
|
|
|
|
+ a.ask_goods_id = #{askGoodsId} and (a.num + 0) <![CDATA[>]]> (a.out_num + 0) and b.part_type != '半成品' and b.part_type != '产成品'
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 物料库位选择 -->
|
|
<!-- 物料库位选择 -->
|
|
|
<select id="getMaterialCk" resultType="com.tld.model.Inventory">
|
|
<select id="getMaterialCk" resultType="com.tld.model.Inventory">
|
|
@@ -89,6 +89,7 @@
|
|
|
<!-- 查询指定库存内容 -->
|
|
<!-- 查询指定库存内容 -->
|
|
|
<select id="getInventory" resultType="com.tld.model.Inventory">
|
|
<select id="getInventory" resultType="com.tld.model.Inventory">
|
|
|
select
|
|
select
|
|
|
|
|
+ id,
|
|
|
storage_location_code,
|
|
storage_location_code,
|
|
|
wllb_class,
|
|
wllb_class,
|
|
|
library_type,
|
|
library_type,
|
|
@@ -105,7 +106,7 @@
|
|
|
wllb_code,
|
|
wllb_code,
|
|
|
produc_date,
|
|
produc_date,
|
|
|
scrq
|
|
scrq
|
|
|
- from tld_inventory where supplier_id = #{supplierId} and serial = #{uniqueCode} and wllb_code = #{wllbCode} and produc_date = #{producDate}
|
|
|
|
|
|
|
+ from tld_inventory where supplier_id = #{supplierId} and serial = #{serial} and wllb_code = #{wllbCode} and produc_date = #{producDate}
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 查询库存是否充足 -->
|
|
<!-- 查询库存是否充足 -->
|
|
|
<select id="getAsk" resultType="com.tld.model.AskGoods">
|
|
<select id="getAsk" resultType="com.tld.model.AskGoods">
|
|
@@ -130,8 +131,8 @@
|
|
|
<!-- 查询是否扫描 -->
|
|
<!-- 查询是否扫描 -->
|
|
|
<select id="getScanIsNot" resultType="java.util.Map">
|
|
<select id="getScanIsNot" resultType="java.util.Map">
|
|
|
select
|
|
select
|
|
|
- (select amount from tld_inventory where supplier_id = #{supplierId} and serial = #{uniqueCode} and wllb_code = #{wllbCode} and produc_date = #{producDate}) as inventoryNum,
|
|
|
|
|
- (select sum(num) from tld_ask_goods_vitrual where supplier_id = #{supplierId} and serial = #{uniqueCode} and wllb_code = #{wllbCode} and produc_date = #{producDate} and type = #{type}) as virtualNum
|
|
|
|
|
|
|
+ (select ifnull(amount,0) from tld_inventory where supplier_id = #{supplierId} and serial = #{serial} and wllb_code = #{wllbCode} and produc_date = #{producDate}) as inventoryNum,
|
|
|
|
|
+ (select ifnull(sum(num),0) from tld_ask_goods_vitrual where supplier_id = #{supplierId} and serial = #{serial} and wllb_code = #{wllbCode} and produc_date = #{producDate} and type = #{type}) as virtualNum
|
|
|
from dual
|
|
from dual
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 查询指定送货单信息 -->
|
|
<!-- 查询指定送货单信息 -->
|
|
@@ -149,15 +150,15 @@
|
|
|
FROM
|
|
FROM
|
|
|
tld_ask_goods a
|
|
tld_ask_goods a
|
|
|
join tld_material b on a.material_id = b.tld_id
|
|
join tld_material b on a.material_id = b.tld_id
|
|
|
- where a.ask_goods_id = #{askGoodsId} and b.code = #{materialCode}
|
|
|
|
|
|
|
+ where a.ask_goods_id = #{askGoodsId} and b.code = #{wllbCode}
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 查询已扫描总数 -->
|
|
<!-- 查询已扫描总数 -->
|
|
|
<select id="getAskInfoNumVitrual" resultType="int">
|
|
<select id="getAskInfoNumVitrual" resultType="int">
|
|
|
- select sum(num) from tld_ask_goods_vitrual where wllb_code = #{materialCode} and ask_goods_id = #{askGoodsId} and type = #{type}
|
|
|
|
|
|
|
+ select ifnull(sum(num), 0) from tld_ask_goods_vitrual where wllb_code = #{wllbCode} and ask_goods_id = #{askGoodsId} and type = #{type}
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 查询此库存在虚拟表里占用的数量 -->
|
|
<!-- 查询此库存在虚拟表里占用的数量 -->
|
|
|
<select id="getInventoryAlready" resultType="int">
|
|
<select id="getInventoryAlready" resultType="int">
|
|
|
- select sum(num) from tld_ask_goods_vitrual where supplier_id = #{supplierId} and serial = #{uniqueCode} and wllb_code = #{wllbCode} and produc_date = #{producDate} and type = #{type}
|
|
|
|
|
|
|
+ select ifnull(sum(num), 0) from tld_ask_goods_vitrual where supplier_id = #{supplierId} and serial = #{serial} and wllb_code = #{wllbCode} and produc_date = #{producDate} and type = #{type}
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 查询虚拟表指定pda跟状态的的数据 -->
|
|
<!-- 查询虚拟表指定pda跟状态的的数据 -->
|
|
|
<select id="getVirtualUniqueCode" resultType="com.tld.model.AskGoods">
|
|
<select id="getVirtualUniqueCode" resultType="com.tld.model.AskGoods">
|
|
@@ -194,7 +195,7 @@
|
|
|
<!-- 插入出库流水 -->
|
|
<!-- 插入出库流水 -->
|
|
|
<insert id="addRemoval">
|
|
<insert id="addRemoval">
|
|
|
insert into tld_removal(wllb_code,supplier_id,serial,num,type,user_id,storage_location_code,scrq,process,ask_goods_id,produc_date,department)
|
|
insert into tld_removal(wllb_code,supplier_id,serial,num,type,user_id,storage_location_code,scrq,process,ask_goods_id,produc_date,department)
|
|
|
- values(#{materialCode},#{supplierId},#{serial},#{num},#{type},#{userId},#{storageLocationCode},now(),#{process},#{askGoodsId},#{producDate},#{department})
|
|
|
|
|
|
|
+ values(#{wllbCode},#{supplierId},#{serial},#{num},#{type},#{userId},#{storageLocationCode},now(),#{process},#{askGoodsId},#{producDate},#{department})
|
|
|
</insert>
|
|
</insert>
|
|
|
<!-- 查询指定物料类型的id -->
|
|
<!-- 查询指定物料类型的id -->
|
|
|
<select id="getMaterialId" resultType="String">
|
|
<select id="getMaterialId" resultType="String">
|
|
@@ -235,8 +236,8 @@
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 新增返回gs数据父表信息 -->
|
|
<!-- 新增返回gs数据父表信息 -->
|
|
|
<insert id="addReturnGsRemovalF">
|
|
<insert id="addReturnGsRemovalF">
|
|
|
- insert into tld_ask_goods_f(ask_goods_id,removal_code,source_type,move_type,scrq)
|
|
|
|
|
- values(#{askGoodsId},#{removalCode},#{sourceType},#{movetype},now())
|
|
|
|
|
|
|
+ insert into tld_return_gs_removal(ask_goods_id,removal_code,source_type,move_type,scrq)
|
|
|
|
|
+ values(#{askGoodsId},#{removalCode},#{sourceType},#{moveType},now())
|
|
|
</insert>
|
|
</insert>
|
|
|
<!-- 查询当天出库数量 -->
|
|
<!-- 查询当天出库数量 -->
|
|
|
<select id="getReturnRemovalCount" resultType="int">
|
|
<select id="getReturnRemovalCount" resultType="int">
|
|
@@ -273,14 +274,14 @@
|
|
|
a.serial,
|
|
a.serial,
|
|
|
a.type,
|
|
a.type,
|
|
|
c.user_name as userName,
|
|
c.user_name as userName,
|
|
|
- e.name as departmentName,
|
|
|
|
|
|
|
+ a.department,
|
|
|
g.storage_location_name as storageLocationName,
|
|
g.storage_location_name as storageLocationName,
|
|
|
a.scrq,
|
|
a.scrq,
|
|
|
a.num
|
|
a.num
|
|
|
from tld_removal a
|
|
from tld_removal a
|
|
|
left join tld_material b on a.wllb_code = b.code
|
|
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_user c on a.user_id = c.id
|
|
|
- left join tld_department e on a.department = e.tld_id
|
|
|
|
|
|
|
+-- left join tld_department e on a.department = e.tld_id
|
|
|
left join tld_storage_location g on a.storage_location_code = g.storage_location_code
|
|
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.code
|
|
left join tld_customer h on a.supplier_id = h.code
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
@@ -297,6 +298,7 @@
|
|
|
and a.type like CONCAT(CONCAT('%', #{type}), '%')
|
|
and a.type like CONCAT(CONCAT('%', #{type}), '%')
|
|
|
</if>
|
|
</if>
|
|
|
</trim>
|
|
</trim>
|
|
|
|
|
+ order by a.id desc
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 导出 -->
|
|
<!-- 导出 -->
|
|
|
<select id="export" resultType="java.util.LinkedHashMap">
|
|
<select id="export" resultType="java.util.LinkedHashMap">
|
|
@@ -306,14 +308,14 @@
|
|
|
a.serial,
|
|
a.serial,
|
|
|
a.type,
|
|
a.type,
|
|
|
c.user_name as userName,
|
|
c.user_name as userName,
|
|
|
- e.name as departmentName,
|
|
|
|
|
|
|
+ a.department,
|
|
|
g.storage_location_name as storageLocationName,
|
|
g.storage_location_name as storageLocationName,
|
|
|
a.scrq,
|
|
a.scrq,
|
|
|
a.num
|
|
a.num
|
|
|
from tld_removal a
|
|
from tld_removal a
|
|
|
left join tld_material b on a.wllb_code = b.code
|
|
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_user c on a.user_id = c.id
|
|
|
- left join tld_department e on a.department = e.tld_id
|
|
|
|
|
|
|
+-- left join tld_department e on a.department = e.tld_id
|
|
|
left join tld_storage_location g on a.storage_location_code = g.storage_location_code
|
|
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.code
|
|
left join tld_customer h on a.supplier_id = h.code
|
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
<trim prefix="WHERE" prefixOverrides="and |or">
|
|
@@ -330,6 +332,7 @@
|
|
|
and a.type like CONCAT(CONCAT('%', #{type}), '%')
|
|
and a.type like CONCAT(CONCAT('%', #{type}), '%')
|
|
|
</if>
|
|
</if>
|
|
|
</trim>
|
|
</trim>
|
|
|
|
|
+ order by a.id desc
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 查询指定pda出库虚拟表 -->
|
|
<!-- 查询指定pda出库虚拟表 -->
|
|
|
<select id="getAskGoodsVitrual" resultType="com.tld.model.AskGoods">
|
|
<select id="getAskGoodsVitrual" resultType="com.tld.model.AskGoods">
|
|
@@ -351,7 +354,7 @@
|
|
|
</select>
|
|
</select>
|
|
|
<!-- 删除指定虚拟表数据 -->
|
|
<!-- 删除指定虚拟表数据 -->
|
|
|
<delete id="delAskGoodsVitrual">
|
|
<delete id="delAskGoodsVitrual">
|
|
|
- delete from tld_ask_goods_vitrual where id = #{id}
|
|
|
|
|
|
|
+ delete from tld_ask_goods_vitrual where id = #{id} and type = #{type}
|
|
|
</delete>
|
|
</delete>
|
|
|
<!-- 修改出库数量 -->
|
|
<!-- 修改出库数量 -->
|
|
|
<update id="updateOutNum">
|
|
<update id="updateOutNum">
|
|
@@ -364,4 +367,77 @@
|
|
|
from tld_ask_goods_vitrual
|
|
from tld_ask_goods_vitrual
|
|
|
where unique_code = #{uniqueCode} and ask_goods_id = #{askGoodsId}
|
|
where unique_code = #{uniqueCode} and ask_goods_id = #{askGoodsId}
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+ <!-- 查询半成品出库数据 -->
|
|
|
|
|
+ <select id="getGoodsHalf" resultSets="com.tld.model.AskGoods">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ b.name as materialName,
|
|
|
|
|
+ b.code as materialCode,
|
|
|
|
|
+ a.out_num,
|
|
|
|
|
+ a.ask_goods_id
|
|
|
|
|
+ FROM
|
|
|
|
|
+ tld_ask_goods a
|
|
|
|
|
+ join tld_material b on a.material_id = b.tld_id
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ (a.num + 0) <![CDATA[>]]> (a.out_num + 0) and b.part_type = #{partType}
|
|
|
|
|
+ <if test="productionCode != null and productionCode != ''">
|
|
|
|
|
+ and a.production_code = #{productionCode}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="askGoodsId != null and askGoodsId != ''">
|
|
|
|
|
+ and a.ask_goods_id = #{askGoodsId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 查询半成品出库流水 -->
|
|
|
|
|
+ <select id="getRemovalHalfProduct" resultType="com.tld.model.AskGoods">
|
|
|
|
|
+ select
|
|
|
|
|
+ a.id,
|
|
|
|
|
+ a.material_id,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ a.user_id,
|
|
|
|
|
+ a.scrq,
|
|
|
|
|
+ a.ask_goods_id,
|
|
|
|
|
+ c.name as department,
|
|
|
|
|
+ b.name as materialName,
|
|
|
|
|
+ e.user_name as userName
|
|
|
|
|
+ from tld_removal_half_product a
|
|
|
|
|
+ left join tld_material b on a.material_id = b.tld_id
|
|
|
|
|
+ left join tld_department c on a.department = c.tld_id
|
|
|
|
|
+ left join tld_user e on a.user_id = e.id
|
|
|
|
|
+ <if test="materialId != null and materialId != ''">
|
|
|
|
|
+ and a.material_id = #{materialId}
|
|
|
|
|
+ </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>
|
|
|
|
|
+ order by a.scrq desc
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!-- 查询半成品出库流水导出 -->
|
|
|
|
|
+ <select id="getRemovalHalfProductExcel" resultType="java.util.LinkedHashMap">
|
|
|
|
|
+ select
|
|
|
|
|
+ b.name as materialName,
|
|
|
|
|
+ a.num,
|
|
|
|
|
+ e.user_name as userName,
|
|
|
|
|
+ a.scrq,
|
|
|
|
|
+ a.ask_goods_id,
|
|
|
|
|
+ c.name as department
|
|
|
|
|
+ from tld_removal_half_product a
|
|
|
|
|
+ left join tld_material b on a.material_id = b.tld_id
|
|
|
|
|
+ left join tld_department c on a.department = c.tld_id
|
|
|
|
|
+ left join tld_user e on a.user_id = e.id
|
|
|
|
|
+ <if test="materialId != null and materialId != ''">
|
|
|
|
|
+ and a.material_id = #{materialId}
|
|
|
|
|
+ </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>
|
|
|
|
|
+ order by a.scrq desc
|
|
|
|
|
+ </select>
|
|
|
</mapper>
|
|
</mapper>
|