|
|
|
@ -134,11 +134,15 @@
|
|
|
|
|
FROM auth_warehouse aw
|
|
|
|
|
LEFT JOIN io_order a1 ON a1.fromInvCode = aw.CODE
|
|
|
|
|
LEFT JOIN io_order_detail_result a2 ON a1.billNo = a2.orderIdFk
|
|
|
|
|
LEFT JOIN basic_udirel bu on bu.id = a2.bindRlFk
|
|
|
|
|
<where>
|
|
|
|
|
a1.status = 7
|
|
|
|
|
<if test="invCode != null and invCode != ''">
|
|
|
|
|
AND a1.invCode = #{invCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="hcType != null and hcType != ''">
|
|
|
|
|
AND bu.hcType = #{hcType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="mainAction != null and mainAction != ''">
|
|
|
|
|
AND a1.mainAction = #{mainAction}
|
|
|
|
|
</if>
|
|
|
|
@ -168,6 +172,63 @@
|
|
|
|
|
group by a1.fromInvCode
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="filterOrderDeptSupList" resultType="com.glxp.api.res.inout.IoOrderDetailDeptResultResponse">
|
|
|
|
|
SELECT
|
|
|
|
|
aw.code as fromInvCode,
|
|
|
|
|
aw.name as fromInvName,
|
|
|
|
|
bc.name as fromCorpName,
|
|
|
|
|
SUM(CASE WHEN a1.mainAction = 'WareHouseOut' THEN -COALESCE(a2.price,0) * COALESCE(a2.count,0)
|
|
|
|
|
WHEN a1.mainAction = 'WareHouseIn' THEN (COALESCE(a2.price,0) * COALESCE(a2.count,0))
|
|
|
|
|
ELSE 0
|
|
|
|
|
END) AS amount,
|
|
|
|
|
|
|
|
|
|
SUM(CASE WHEN a1.mainAction = 'WareHouseOut' THEN -COALESCE(a2.count,0)
|
|
|
|
|
WHEN a1.mainAction = 'WareHouseIn' THEN (COALESCE(a2.count,0))
|
|
|
|
|
ELSE 0
|
|
|
|
|
END) AS `count`
|
|
|
|
|
|
|
|
|
|
FROM auth_warehouse aw
|
|
|
|
|
LEFT JOIN io_order a1 ON a1.invCode = aw.CODE
|
|
|
|
|
LEFT JOIN io_order_detail_result a2 ON a1.billNo = a2.orderIdFk
|
|
|
|
|
LEFT JOIN basic_udirel bu on bu.id = a2.bindRlFk
|
|
|
|
|
LEFT JOIN basic_corp bc on bc.erpId = a1.fromCorp
|
|
|
|
|
<where>
|
|
|
|
|
a1.status = 7 and a1.fromCorp is not null
|
|
|
|
|
<if test="invCode != null and invCode != ''">
|
|
|
|
|
AND a1.invCode = #{invCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="hcType != null and hcType != ''">
|
|
|
|
|
AND bu.hcType = #{hcType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="mainAction != null and mainAction != ''">
|
|
|
|
|
AND a1.mainAction = #{mainAction}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="action != null and action != ''">
|
|
|
|
|
AND a1.action = #{action}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="mainAction != null and mainAction != ''">
|
|
|
|
|
AND a1.mainAction = #{mainAction}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="fromCorp != null and fromCorp != ''">
|
|
|
|
|
AND a1.fromCorp = #{fromCorp}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="fromInvCode != null and fromInvCode != ''">
|
|
|
|
|
AND a1.fromInvCode = #{fromInvCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startAduditTime != null and startAduditTime != '' and endAduditTime != null and endAduditTime != ''">
|
|
|
|
|
AND date_format(a1.auditTime, '%Y-%m-%d') between date_format(#{startAduditTime}, '%Y-%m-%d') and
|
|
|
|
|
date_format(#{endAduditTime}, '%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="actions != null and actions.size() != 0">
|
|
|
|
|
AND a1.`action` in
|
|
|
|
|
<foreach collection="actions" index="index" item="item" open="(" close=")" separator=",">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
group by a1.fromInvCode,a1.fromCorp
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectStatDataByTime" resultType="com.glxp.api.res.inv.IoOrderDetailStatRsponse">
|
|
|
|
|
select orderIdFk,
|
|
|
|
|
bindRlFk,
|
|
|
|
|