|
@@ -62,6 +62,7 @@
|
|
|
<result property="fUnits" column="f_units"/>
|
|
|
<result property="fStoreEnv" column="f_store_env"/>
|
|
|
<result property="fIsfilles" column="f_isfilles"/>
|
|
|
+ <result property="fAllotWarehouseid" column="f_allot_warehouseid" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectTWarehousebillsfeesVo">
|
|
@@ -121,7 +122,8 @@
|
|
|
f_valid,
|
|
|
f_units,
|
|
|
f_store_env,
|
|
|
- f_isfilles
|
|
|
+ f_isfilles,
|
|
|
+ f_allot_warehouseid
|
|
|
from t_warehousebillsfees
|
|
|
</sql>
|
|
|
|
|
@@ -341,6 +343,7 @@
|
|
|
<if test="fUnits != null">f_units,</if>
|
|
|
<if test="fStoreEnv != null">f_store_env,</if>
|
|
|
<if test="fIsfilles != null">f_isfilles,</if>
|
|
|
+ <if test="fAllotWarehouseid != null">f_allot_warehouseid,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="fPid != null">#{fPid},</if>
|
|
@@ -399,6 +402,7 @@
|
|
|
<if test="fUnits != null">#{fUnits},</if>
|
|
|
<if test="fStoreEnv != null">#{fStoreEnv},</if>
|
|
|
<if test="fIsfilles != null">#{fIsfilles},</if>
|
|
|
+ <if test="fAllotWarehouseid != null">#{fAllotWarehouseid},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
@@ -460,6 +464,7 @@
|
|
|
<if test="fUnits != null">f_units = #{fUnits},</if>
|
|
|
<if test="fStoreEnv != null">f_store_env = #{fStoreEnv},</if>
|
|
|
<if test="fIsfilles != null">f_isfilles = #{fIsfilles},</if>
|
|
|
+ <if test="fAllotWarehouseid != null">f_allot_warehouseid = #{fAllotWarehouseid},</if>
|
|
|
</trim>
|
|
|
where f_id = #{fId}
|
|
|
</update>
|
|
@@ -948,7 +953,8 @@
|
|
|
tw.f_isfilles,
|
|
|
si.dict_label AS fUnitsName,
|
|
|
st.dict_label AS fStoreEnvName,
|
|
|
- sti.dict_label AS fIsfillesName
|
|
|
+ sti.dict_label AS fIsfillesName,
|
|
|
+ tw.f_allot_warehouseid
|
|
|
from t_warehousebillsfees tw
|
|
|
LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
|
|
|
LEFT JOIN t_warehouse th ON tw.f_warehouseid = th.f_id
|
|
@@ -1031,6 +1037,8 @@
|
|
|
|
|
|
WHEN tw.f_billtype = 'CK' THEN
|
|
|
'出库'
|
|
|
+ WHEN tw.f_billtype = 'DB' THEN
|
|
|
+ '调拨'
|
|
|
WHEN tw.f_billtype = 'RK' THEN
|
|
|
'入库'
|
|
|
END AS fBilltypeName,/*出入库类型*/
|
|
@@ -1381,21 +1389,21 @@
|
|
|
/*库区*/
|
|
|
th.f_warehouse_information AS fWarehouseName,
|
|
|
/*库区中文名*/
|
|
|
- ifnull(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ) - sum(
|
|
|
+ ifnull(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ) + IFNULL( de.fQty, 0 ) - IFNULL( df.fQty, 0 ) - sum(
|
|
|
CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ),0) AS fBeginQty,
|
|
|
/*期初数量*/
|
|
|
ROUND(
|
|
|
IFNULL((
|
|
|
- sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ) - sum(
|
|
|
+ sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_amount ELSE 0 END )+ IFNULL( de.fAmount, 0 )- IFNULL( df.fAmount, 0 ) - sum(
|
|
|
CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ))/(
|
|
|
- sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ) - sum( CASE
|
|
|
+ sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ) + IFNULL( de.fQty, 0 ) - IFNULL( df.fQty, 0 ) - sum( CASE
|
|
|
WHEN tf.f_billtype='CK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_qty ELSE 0 END )),
|
|
|
0
|
|
|
),
|
|
|
2
|
|
|
) AS fBeginUnitprice,
|
|
|
/*期初单价*/
|
|
|
- IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ) -
|
|
|
+ IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_amount ELSE 0 END )+ IFNULL( de.fAmount, 0 )- IFNULL( df.fAmount, 0 ) -
|
|
|
sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ),0) AS
|
|
|
fBeginAmount,
|
|
|
/*期初金额*/
|
|
@@ -1411,25 +1419,35 @@
|
|
|
IFNULL(sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate>=#{timeInterval[0]} AND tf.f_bsdate<=#{timeInterval[1]}
|
|
|
THEN tf.f_amount ELSE 0 END ),0) AS cfAmount,
|
|
|
/*出库金额*/
|
|
|
- IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<=#{timeInterval[1]} THEN tf.f_qty ELSE 0 END ) -
|
|
|
+ IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<=#{timeInterval[1]} THEN tf.f_qty ELSE 0 END ) + IFNULL( dr.fQty, 0 ) - IFNULL( dc.fQty, 0 ) + IFNULL( de.fQty, 0 ) - IFNULL( df.fQty, 0 ) -
|
|
|
sum( CASE WHEN tf.f_billtype = 'CK' AND tf.f_bsdate<=#{timeInterval[1]} THEN tf.f_qty ELSE 0 END ),0) AS
|
|
|
fAfterQty,
|
|
|
/*结余数量*/
|
|
|
ROUND(
|
|
|
IFNULL((
|
|
|
- sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<=#{timeInterval[1]} THEN tf.f_amount ELSE 0 END ) - sum(
|
|
|
+ sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<=#{timeInterval[1]} THEN tf.f_amount ELSE 0 END ) + IFNULL( dr.fAmount, 0 )- IFNULL( dc.fAmount, 0 ) + IFNULL( de.fAmount, 0 )- IFNULL( df.fAmount, 0 ) - sum(
|
|
|
CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<=#{timeInterval[1]} THEN tf.f_amount ELSE 0 END ))/(
|
|
|
- sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<= #{timeInterval[1]} THEN tf.f_qty ELSE 0 END ) - sum( CASE
|
|
|
+ sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<= #{timeInterval[1]} THEN tf.f_qty ELSE 0 END ) + IFNULL( dr.fQty, 0 ) - IFNULL( dc.fQty, 0 ) + IFNULL( de.fQty, 0 ) - IFNULL( df.fQty, 0 ) - sum( CASE
|
|
|
WHEN tf.f_billtype='CK' AND tf.f_bsdate<=#{timeInterval[1]} THEN tf.f_qty ELSE 0 END )),
|
|
|
0
|
|
|
),
|
|
|
2
|
|
|
) AS fAfterUnitprice,
|
|
|
/*结余单价*/
|
|
|
- IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<= #{timeInterval[1]} THEN tf.f_amount ELSE 0 END ) -
|
|
|
+ IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate<= #{timeInterval[1]} THEN tf.f_amount ELSE 0 END )+ IFNULL( dr.fAmount, 0 ) - IFNULL( dc.fAmount, 0 ) + IFNULL( de.fAmount, 0 )- IFNULL( df.fAmount, 0 )-
|
|
|
sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate<= #{timeInterval[1]} THEN tf.f_amount ELSE 0 END ),0) AS
|
|
|
- fAfterAmount /*结余金额*/
|
|
|
-
|
|
|
+ fAfterAmount, /*结余金额*/
|
|
|
+ IFNULL( dr.fQty, 0 ) AS foldQty,
|
|
|
+ /*调入数量*/
|
|
|
+ IFNULL( dr.fUnitprice, 0 ) AS foldUnitprice,
|
|
|
+ /*调入单价*/
|
|
|
+ IFNULL( dr.fAmount, 0 ) AS foldAmount,
|
|
|
+ /*调入金额*/
|
|
|
+ IFNULL( dc.fQty, 0 ) AS calloutQty,
|
|
|
+ /*调出数量*/
|
|
|
+ IFNULL( dc.fUnitprice, 0 ) AS calloutUnitprice,
|
|
|
+ /*调出单价*/
|
|
|
+ IFNULL( dc.fAmount, 0 ) AS calloutAmount /*调出金额*/
|
|
|
FROM
|
|
|
t_warehousebillsfees tf
|
|
|
LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
|
|
@@ -1440,6 +1458,97 @@
|
|
|
AND sc.dict_type = 'data_unitfees'
|
|
|
LEFT JOIN sys_dict_data si ON si.dict_value = te.f_feetype
|
|
|
AND si.dict_type = 'data_cost_attribute'
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ tf.f_corpid fCorpid,
|
|
|
+ tf.f_feeid fFeeid,
|
|
|
+ tf.f_feeUnitid fFeeUnitid,
|
|
|
+ IFNULL(SUM(tf.f_qty),0) fQty,
|
|
|
+ IFNULL(SUM(tf.f_unitprice),0) fUnitprice,
|
|
|
+ IFNULL(SUM(tf.f_amount),0) fAmount,
|
|
|
+ tf.f_allot_warehouseid fAllotWarehouseid
|
|
|
+ FROM
|
|
|
+ t_warehousebillsfees tf
|
|
|
+ LEFT JOIN t_warehousebills tw ON tw.f_id = tf.f_pid
|
|
|
+ WHERE
|
|
|
+ tf.f_billtype = 'DB'
|
|
|
+ AND tf.del_flag = '0'
|
|
|
+ AND tw.f_billstatus = 6
|
|
|
+ AND tf.f_bsdate>=#{timeInterval[0]}
|
|
|
+ AND tf.f_bsdate<=#{timeInterval[1]}
|
|
|
+ GROUP BY tf.f_corpid,tf.f_feeid,tf.f_feeUnitid,tf.f_allot_warehouseid
|
|
|
+ ) dr ON tf.f_corpid = dr.fCorpid
|
|
|
+ AND tf.f_feeid = dr.fFeeid
|
|
|
+ AND tf.f_feeUnitid = dr.fFeeUnitid
|
|
|
+ AND tf.f_warehouseid = dr.fAllotWarehouseid
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ tf.f_corpid fCorpid,
|
|
|
+ tf.f_feeid fFeeid,
|
|
|
+ tf.f_feeUnitid fFeeUnitid,
|
|
|
+ IFNULL(SUM(tf.f_qty),0) fQty,
|
|
|
+ IFNULL(SUM(tf.f_unitprice),0) fUnitprice,
|
|
|
+ IFNULL(SUM(tf.f_amount),0) fAmount,
|
|
|
+ tf.f_warehouseid fwarehouseid
|
|
|
+ FROM
|
|
|
+ t_warehousebillsfees tf
|
|
|
+ LEFT JOIN t_warehousebills tw ON tw.f_id = tf.f_pid
|
|
|
+ WHERE
|
|
|
+ tf.f_billtype = 'DB'
|
|
|
+ AND tf.del_flag = '0'
|
|
|
+ AND tw.f_billstatus = 6
|
|
|
+ AND tf.f_bsdate>=#{timeInterval[0]}
|
|
|
+ AND tf.f_bsdate<=#{timeInterval[1]}
|
|
|
+ GROUP BY tf.f_corpid,tf.f_feeid,tf.f_feeUnitid,tf.f_warehouseid
|
|
|
+ ) dc ON tf.f_corpid = dc.fCorpid
|
|
|
+ AND tf.f_feeid = dc.fFeeid
|
|
|
+ AND tf.f_feeUnitid = dc.fFeeUnitid
|
|
|
+ AND tf.f_warehouseid = dc.fwarehouseid
|
|
|
+
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ tf.f_corpid fCorpid,
|
|
|
+ tf.f_feeid fFeeid,
|
|
|
+ tf.f_feeUnitid fFeeUnitid,
|
|
|
+ IFNULL(SUM(tf.f_qty),0) fQty,
|
|
|
+ IFNULL(SUM(tf.f_unitprice),0) fUnitprice,
|
|
|
+ IFNULL(SUM(tf.f_amount),0) fAmount,
|
|
|
+ tf.f_allot_warehouseid fAllotWarehouseid
|
|
|
+ FROM
|
|
|
+ t_warehousebillsfees tf
|
|
|
+ LEFT JOIN t_warehousebills tw ON tw.f_id = tf.f_pid
|
|
|
+ WHERE
|
|
|
+ tf.f_billtype = 'DB'
|
|
|
+ AND tf.del_flag = '0'
|
|
|
+ AND tw.f_billstatus = 6
|
|
|
+ AND tf.f_bsdate<=#{timeInterval[0]}
|
|
|
+ GROUP BY tf.f_corpid,tf.f_feeid,tf.f_feeUnitid,tf.f_allot_warehouseid
|
|
|
+ ) de ON tf.f_corpid = de.fCorpid
|
|
|
+ AND tf.f_feeid = de.fFeeid
|
|
|
+ AND tf.f_feeUnitid = de.fFeeUnitid
|
|
|
+ AND tf.f_warehouseid = de.fAllotWarehouseid
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ tf.f_corpid fCorpid,
|
|
|
+ tf.f_feeid fFeeid,
|
|
|
+ tf.f_feeUnitid fFeeUnitid,
|
|
|
+ IFNULL(SUM(tf.f_qty),0) fQty,
|
|
|
+ IFNULL(SUM(tf.f_unitprice),0) fUnitprice,
|
|
|
+ IFNULL(SUM(tf.f_amount),0) fAmount,
|
|
|
+ tf.f_warehouseid fwarehouseid
|
|
|
+ FROM
|
|
|
+ t_warehousebillsfees tf
|
|
|
+ LEFT JOIN t_warehousebills tw ON tw.f_id = tf.f_pid
|
|
|
+ WHERE
|
|
|
+ tf.f_billtype = 'DB'
|
|
|
+ AND tf.del_flag = '0'
|
|
|
+ AND tw.f_billstatus = 6
|
|
|
+ AND tf.f_bsdate<=#{timeInterval[0]}
|
|
|
+ GROUP BY tf.f_corpid,tf.f_feeid,tf.f_feeUnitid,tf.f_warehouseid
|
|
|
+ ) df ON tf.f_corpid = df.fCorpid
|
|
|
+ AND tf.f_feeid = df.fFeeid
|
|
|
+ AND tf.f_feeUnitid = df.fFeeUnitid
|
|
|
+ AND tf.f_warehouseid = df.fwarehouseid
|
|
|
WHERE
|
|
|
tf.f_billtype IN ( 'RK', 'CK' )
|
|
|
AND tf.del_flag = '0'
|
|
@@ -1669,5 +1778,298 @@
|
|
|
</if>
|
|
|
td.fCorpid DESC
|
|
|
</select>
|
|
|
+ <select id="anPinAllotList" parameterType="TWarehousebillsfees"
|
|
|
+ resultMap="TWarehousebillsfeesResult">
|
|
|
+ select tw.f_id,
|
|
|
+ tw.f_pid,
|
|
|
+ tw.f_lineno,
|
|
|
+ tw.f_corpid,
|
|
|
+ tw.f_feeid,
|
|
|
+ tf.f_name AS feeName,
|
|
|
+ tf.f_currency AS fCurrencyName,
|
|
|
+ tw.f_feeUnitid,
|
|
|
+ sc.dict_label AS fFeeunitName,
|
|
|
+ tw.f_qty,
|
|
|
+ tw.f_unitprice,
|
|
|
+ tw.f_amount,
|
|
|
+ tw.f_currency,
|
|
|
+ tw.f_exrate,
|
|
|
+ tw.f_taxrate,
|
|
|
+ tw.f_dc,
|
|
|
+ tw.f_billstatus,
|
|
|
+ CASE
|
|
|
+
|
|
|
+ WHEN tw.f_billstatus = '1' THEN
|
|
|
+ '保存'
|
|
|
+ WHEN tw.f_billstatus = '2' THEN
|
|
|
+ '暂存'
|
|
|
+ WHEN tw.f_billstatus = '3' THEN
|
|
|
+ '审批驳回'
|
|
|
+ WHEN tw.f_billstatus = '4' THEN
|
|
|
+ '提交审核'
|
|
|
+ WHEN tw.f_billstatus = '5' THEN
|
|
|
+ '审核中'
|
|
|
+ WHEN tw.f_billstatus = '6' THEN
|
|
|
+ '审核完成'
|
|
|
+ END AS fBillstatusName,
|
|
|
+ tw.f_review_date,
|
|
|
+ tw.f_statement_no,
|
|
|
+ tw.f_accamount,
|
|
|
+ tw.f_stlamount,
|
|
|
+ tw.f_accamount_date,
|
|
|
+ tw.f_invnos,
|
|
|
+ tw.f_invamount,
|
|
|
+ tw.f_stlamount_no,
|
|
|
+ tw.f_askamount,
|
|
|
+ tw.f_status,
|
|
|
+ tw.f_stlamount_date,
|
|
|
+ tw.del_flag,
|
|
|
+ tw.create_by,
|
|
|
+ tw.create_time,
|
|
|
+ tw.update_by,
|
|
|
+ tw.update_time,
|
|
|
+ tw.remark,
|
|
|
+ tw.src_id,
|
|
|
+ tw.src_bill_no,
|
|
|
+ tw.f_mblno,
|
|
|
+ tw.f_product_name,
|
|
|
+ tw.f_marks,
|
|
|
+ tw.f_chargedate,
|
|
|
+ tw.f_billing_deadline,
|
|
|
+ tw.f_inventory_days,
|
|
|
+ tw.f_amt,
|
|
|
+ tw.f_billing_days,
|
|
|
+ tw.f_billing_qty,
|
|
|
+ tw.f_billtype,
|
|
|
+ tw.f_billingway,
|
|
|
+ tw.f_bsdate,
|
|
|
+ tw.f_originalbilldate,
|
|
|
+ tw.f_stltypeid,
|
|
|
+ sd.dict_label AS fBillingwayName,
|
|
|
+ tw.f_business_type,
|
|
|
+ tw.f_src_type_id,
|
|
|
+ tw.f_warehouseid,
|
|
|
+ th.f_warehouse_information AS fWarehouseName,
|
|
|
+ tw.f_purchase,
|
|
|
+ tw.t_productdate,
|
|
|
+ tw.f_lotno,
|
|
|
+ tw.f_valid,
|
|
|
+ tw.f_units,
|
|
|
+ tw.f_store_env,
|
|
|
+ tw.f_isfilles,
|
|
|
+ si.dict_label AS fUnitsName,
|
|
|
+ st.dict_label AS fStoreEnvName,
|
|
|
+ sti.dict_label AS fIsfillesName,
|
|
|
+ tw.f_allot_warehouseid,
|
|
|
+ te.f_warehouse_information AS fAllotWarehouseName,
|
|
|
+ IFNULL(tl.f_grossweightblc,0) AS fGrossweightblc,
|
|
|
+ IFNULL(tl.f_volumnblc,0) AS fVolumnblc,
|
|
|
+ IFNULL(tl.f_netweightblc,0) AS fNetweightblc,
|
|
|
+ tc.f_name AS corpName
|
|
|
+ from t_warehousebillsfees tw
|
|
|
+ LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
|
|
|
+ LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
|
|
|
+ LEFT JOIN t_warehouse th ON tw.f_warehouseid = th.f_id
|
|
|
+ LEFT JOIN t_warehouse te ON tw.f_allot_warehouseid = te.f_id
|
|
|
+ LEFT JOIN sys_dict_data sc ON sc.dict_value = tw.f_feeUnitid AND sc.dict_type = 'data_unitfees'
|
|
|
+ LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_stltypeid AND sd.dict_type = 'f_paymode'
|
|
|
+ LEFT JOIN sys_dict_data si ON si.dict_value = tw.f_units AND si.dict_type = 'f_floatunit'
|
|
|
+ LEFT JOIN sys_dict_data st ON st.dict_value = tw.f_store_env AND st.dict_type = 'f_StorageEnvironment'
|
|
|
+ LEFT JOIN sys_dict_data sti ON sti.dict_value = tw.f_isfilles AND sti.dict_type = 'f_evidence'
|
|
|
+ LEFT JOIN t_warehousebills ti ON ti.f_id = tw.f_pid
|
|
|
+ LEFT JOIN t_whgenleg tl ON tl.f_corpid = tw.f_corpid AND tl.f_goodsid = tw.f_feeid
|
|
|
+ AND tl.f_billingway = tw.f_feeUnitid AND tl.f_warehouse_locationid = tw.f_warehouseid
|
|
|
+ <where>
|
|
|
+ <if test="fPid != null ">and tw.f_pid = #{fPid}</if>
|
|
|
+ <if test="fLineno != null ">and tw.f_lineno = #{fLineno}</if>
|
|
|
+ <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
|
|
|
+ <if test="fFeeid != null ">and tw.f_feeid = #{fFeeid}</if>
|
|
|
+ <if test="fFeeunitid != null ">and tw.f_feeUnitid = #{fFeeunitid}</if>
|
|
|
+ <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
|
|
|
+ <if test="fUnitprice != null ">and tw.f_unitprice = #{fUnitprice}</if>
|
|
|
+ <if test="fAmount != null ">and tw.f_amount = #{fAmount}</if>
|
|
|
+ <if test="fCurrency != null and fCurrency != ''">and tw.f_currency = #{fCurrency}</if>
|
|
|
+ <if test="fExrate != null ">and tw.f_exrate = #{fExrate}</if>
|
|
|
+ <if test="fTaxrate != null ">and tw.f_taxrate = #{fTaxrate}</if>
|
|
|
+ <if test="fDc != null and fDc != ''">and tw.f_dc = #{fDc}</if>
|
|
|
+ <if test="fBillstatus != null and fBillstatus != ''">and tw.f_billstatus = #{fBillstatus}</if>
|
|
|
+ <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
|
|
|
+ <if test="fStatementNo != null and fStatementNo != ''">and tw.f_statement_no = #{fStatementNo}</if>
|
|
|
+ <if test="fAccamount != null ">and tw.f_accamount = #{fAccamount}</if>
|
|
|
+ <if test="fStlamount != null ">and tw.f_stlamount = #{fStlamount}</if>
|
|
|
+ <if test="fAccamountDate != null ">and tw.f_accamount_date = #{fAccamountDate}</if>
|
|
|
+ <if test="fInvnos != null and fInvnos != ''">and tw.f_invnos = #{fInvnos}</if>
|
|
|
+ <if test="fInvamount != null ">and tw.f_invamount = #{fInvamount}</if>
|
|
|
+ <if test="fStlamountNo != null and fStlamountNo != ''">and tw.f_stlamount_no = #{fStlamountNo}</if>
|
|
|
+ <if test="fAskamount != null ">and tw.f_askamount = #{fAskamount}</if>
|
|
|
+ <if test="fStatus != null and fStatus != ''">and tw.f_status = #{fStatus}</if>
|
|
|
+ <if test="delFlag != null">and tw.del_flag = #{delFlag}</if>
|
|
|
+ <if test="fStlamountDate != null ">and tw.f_stlamount_date = #{fStlamountDate}</if>
|
|
|
+ <if test="srcId != null ">and tw.src_id = #{srcId}</if>
|
|
|
+ <if test="srcBillNo != null and srcBillNo != ''">and tw.src_bill_no = #{srcBillNo}</if>
|
|
|
+ <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
|
|
|
+ <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
|
|
|
+ #{fProductName},
|
|
|
+ '%')
|
|
|
+ </if>
|
|
|
+ <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
|
|
|
+ <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
|
|
|
+ <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
|
|
|
+ <if test="fInventoryDays != null ">and tw.f_inventory_days = #{fInventoryDays}</if>
|
|
|
+ <if test="fAmt != null ">and tw.f_amt = #{fAmt}</if>
|
|
|
+ <if test="fBillingDays != null ">and tw.f_billing_days = #{fBillingDays}</if>
|
|
|
+ <if test="fBillingQty != null ">and tw.f_billing_qty = #{fBillingQty}</if>
|
|
|
+ <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
|
|
|
+ <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
|
|
|
+ <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
|
|
|
+ <if test="fOriginalbilldate != null ">and tw.f_originalbilldate = #{fOriginalbilldate}</if>
|
|
|
+ <if test="fStltypeid != null">and tw.f_stltypeid = #{fStltypeid},</if>
|
|
|
+ <if test="fSrcTypeId != null">and tw.f_src_type_id = #{fSrcTypeId},</if>
|
|
|
+ <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
|
|
|
+ <if test="fPurchase != null ">and tw.f_purchase = #{fPurchase}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <!--安品调入统计-->
|
|
|
+ <select id="selectTWarehouseFold" parameterType="TWarehousebillsfees"
|
|
|
+ resultType="com.ruoyi.anpin.WarhousrExcel">
|
|
|
+ SELECT ti.f_bsdate AS fBsdate,/*进货时间*/
|
|
|
+ tf.f_name AS feeName,/*物资名称*/
|
|
|
+ tf.f_currency AS fCurrencyName,/*物资规格*/
|
|
|
+ tw.f_qty AS fQty,/*实际数量*/
|
|
|
+ tw.f_amount AS fAmount,/*金额*/
|
|
|
+ tw.f_unitprice AS fUnitprice,/*单价*/
|
|
|
+ tc.f_name AS corpName,/*供货商*/
|
|
|
+ tc.f_manage AS fManage,/*联系人*/
|
|
|
+ tc.f_tel AS fTel,/*联系电话*/
|
|
|
+ tw.t_productdate AS tProductdate,/*生产日期*/
|
|
|
+ tw.f_lotno AS fLotno,/*批次号*/
|
|
|
+ CONCAT(tw.f_valid,si.dict_label) AS quality,/*保值期限*/
|
|
|
+ st.dict_label AS fStoreEnvName,/*储存环境中文名*/
|
|
|
+ sti.dict_label AS fIsfillesName,/*索证索票*/
|
|
|
+ std.dict_label AS fFeetype,/*物资类别*/
|
|
|
+ sr.user_name AS purchaseName,/*采购人*/
|
|
|
+ tp.f_name AS projectName,/*项目名称*/
|
|
|
+ CASE
|
|
|
+
|
|
|
+ WHEN tw.f_billtype = 'CK' THEN
|
|
|
+ '出库'
|
|
|
+ WHEN tw.f_billtype = 'DB' THEN
|
|
|
+ '调拨'
|
|
|
+ WHEN tw.f_billtype = 'RK' THEN
|
|
|
+ '入库'
|
|
|
+ END AS fBilltypeName,/*出入库类型*/
|
|
|
+ ti.f_sbu AS fSbu,/*开票公司ID*/
|
|
|
+ ts.f_name AS fSbuName,/*开票公司名称*/
|
|
|
+ sc.dict_label As feeUnitName/*计量单位中文名*/
|
|
|
+ FROM t_warehousebillsfees tw
|
|
|
+ LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
|
|
|
+ LEFT JOIN t_warehouse th ON tw.f_warehouseid = th.f_id
|
|
|
+ LEFT JOIN sys_dict_data sc ON sc.dict_value = tw.f_feeUnitid
|
|
|
+ AND sc.dict_type = 'data_unitfees'
|
|
|
+ LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_stltypeid
|
|
|
+ AND sd.dict_type = 'f_paymode'
|
|
|
+ LEFT JOIN sys_dict_data si ON si.dict_value = tw.f_units
|
|
|
+ AND si.dict_type = 'f_floatunit'
|
|
|
+ LEFT JOIN sys_dict_data st ON st.dict_value = tw.f_store_env
|
|
|
+ AND st.dict_type = 'f_StorageEnvironment'
|
|
|
+ LEFT JOIN sys_dict_data sti ON sti.dict_value = tw.f_isfilles
|
|
|
+ AND sti.dict_type = 'f_evidence'
|
|
|
+ LEFT JOIN t_warehousebills ti ON tw.f_pid = ti.f_id
|
|
|
+ LEFT JOIN t_project tp ON ti.f_goodsid = tp.f_id
|
|
|
+ LEFT JOIN t_corps tc ON ti.f_corpid = tc.f_id
|
|
|
+ LEFT JOIN t_corps ts ON ti.f_sbu = ts.f_id
|
|
|
+ LEFT JOIN sys_user sr ON sr.user_id = ti.f_purchase
|
|
|
+ LEFT JOIN sys_dict_data std ON std.dict_value = tf.f_feetype
|
|
|
+ AND std.dict_type = 'data_cost_attribute'
|
|
|
+ <where>
|
|
|
+ tw.del_flag = '0'
|
|
|
+ and ti.del_flag = '0'
|
|
|
+ and tw.f_billtype = 'DB'
|
|
|
+ <if test="fBillstatus != null and fBillstatus == 1">and tw.f_billstatus = 6</if>
|
|
|
+ <if test="fBillstatus != null and fBillstatus == 2">and tw.f_billstatus != 6</if>
|
|
|
+ <if test="fCorpid != null ">and ti.f_corpid = #{fCorpid}</if>
|
|
|
+ <if test="fGoodsid != null ">and ti.f_goodsid = #{fGoodsid}</if>
|
|
|
+ <if test="fFeeid != null ">and tw.f_feeid = #{fFeeid}</if>
|
|
|
+ <if test="fFeeType != null ">and tf.f_feetype = #{fFeeType}</if>
|
|
|
+ <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
|
|
|
+ and ti.f_bsdate >= #{cLoadDate[0]}
|
|
|
+ </if>
|
|
|
+ <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
|
|
|
+ and ti.f_bsdate <= #{cLoadDate[1]}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY tw.f_id DESC
|
|
|
+ </select>
|
|
|
+ <!--安品调出统计-->
|
|
|
+ <select id="selectTWarehouseCallout" parameterType="TWarehousebillsfees"
|
|
|
+ resultType="com.ruoyi.anpin.WarhousrExcel">
|
|
|
+ SELECT ti.f_bsdate AS fBsdate,/*进货时间*/
|
|
|
+ tf.f_name AS feeName,/*物资名称*/
|
|
|
+ tf.f_currency AS fCurrencyName,/*物资规格*/
|
|
|
+ tw.f_qty AS fQty,/*实际数量*/
|
|
|
+ tw.f_amount AS fAmount,/*金额*/
|
|
|
+ tw.f_unitprice AS fUnitprice,/*单价*/
|
|
|
+ tc.f_name AS corpName,/*供货商*/
|
|
|
+ tc.f_manage AS fManage,/*联系人*/
|
|
|
+ tc.f_tel AS fTel,/*联系电话*/
|
|
|
+ tw.t_productdate AS tProductdate,/*生产日期*/
|
|
|
+ tw.f_lotno AS fLotno,/*批次号*/
|
|
|
+ CONCAT(tw.f_valid,si.dict_label) AS quality,/*保值期限*/
|
|
|
+ st.dict_label AS fStoreEnvName,/*储存环境中文名*/
|
|
|
+ sti.dict_label AS fIsfillesName,/*索证索票*/
|
|
|
+ std.dict_label AS fFeetype,/*物资类别*/
|
|
|
+ sr.user_name AS purchaseName,/*采购人*/
|
|
|
+ tp.f_name AS projectName,/*项目名称*/
|
|
|
+ CASE
|
|
|
+
|
|
|
+ WHEN tw.f_billtype = 'CK' THEN
|
|
|
+ '出库'
|
|
|
+ WHEN tw.f_billtype = 'DB' THEN
|
|
|
+ '调拨'
|
|
|
+ WHEN tw.f_billtype = 'RK' THEN
|
|
|
+ '入库'
|
|
|
+ END AS fBilltypeName,/*出入库类型*/
|
|
|
+ ti.f_sbu AS fSbu,/*开票公司ID*/
|
|
|
+ ts.f_name AS fSbuName,/*开票公司名称*/
|
|
|
+ sc.dict_label As feeUnitName/*计量单位中文名*/
|
|
|
+ FROM t_warehousebillsfees tw
|
|
|
+ LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
|
|
|
+ LEFT JOIN t_warehouse th ON tw.f_allot_warehouseid = th.f_id
|
|
|
+ LEFT JOIN sys_dict_data sc ON sc.dict_value = tw.f_feeUnitid
|
|
|
+ AND sc.dict_type = 'data_unitfees'
|
|
|
+ LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_stltypeid
|
|
|
+ AND sd.dict_type = 'f_paymode'
|
|
|
+ LEFT JOIN sys_dict_data si ON si.dict_value = tw.f_units
|
|
|
+ AND si.dict_type = 'f_floatunit'
|
|
|
+ LEFT JOIN sys_dict_data st ON st.dict_value = tw.f_store_env
|
|
|
+ AND st.dict_type = 'f_StorageEnvironment'
|
|
|
+ LEFT JOIN sys_dict_data sti ON sti.dict_value = tw.f_isfilles
|
|
|
+ AND sti.dict_type = 'f_evidence'
|
|
|
+ LEFT JOIN t_warehousebills ti ON tw.f_pid = ti.f_id
|
|
|
+ LEFT JOIN t_project tp ON ti.f_project = tp.f_id
|
|
|
+ LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
|
|
|
+ LEFT JOIN t_corps ts ON ti.f_sbu = ts.f_id
|
|
|
+ LEFT JOIN sys_user sr ON sr.user_id = ti.f_purchase
|
|
|
+ LEFT JOIN sys_dict_data std ON std.dict_value = tf.f_feetype
|
|
|
+ AND std.dict_type = 'data_cost_attribute'
|
|
|
+ <where>
|
|
|
+ tw.del_flag = '0'
|
|
|
+ and ti.del_flag = '0'
|
|
|
+ and tw.f_billtype = 'DB'
|
|
|
+ <if test="fBillstatus != null and fBillstatus == 1">and tw.f_billstatus = 6</if>
|
|
|
+ <if test="fBillstatus != null and fBillstatus == 2">and tw.f_billstatus != 6</if>
|
|
|
+ <if test="fCorpid != null ">and ti.f_corpid = #{fCorpid}</if>
|
|
|
+ <if test="fGoodsid != null ">and ti.f_goodsid = #{fGoodsid}</if>
|
|
|
+ <if test="fFeeid != null ">and tw.f_feeid = #{fFeeid}</if>
|
|
|
+ <if test="fFeeType != null ">and tf.f_feetype = #{fFeeType}</if>
|
|
|
+ <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
|
|
|
+ and ti.f_bsdate >= #{cLoadDate[0]}
|
|
|
+ </if>
|
|
|
+ <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
|
|
|
+ and ti.f_bsdate <= #{cLoadDate[1]}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY tw.f_id DESC
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|