1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ruoyi.warehouseBusiness.mapper.TWarehousebillsfeesMapper">
- <resultMap type="TWarehousebillsfees" id="TWarehousebillsfeesResult">
- <result property="fId" column="f_id"/>
- <result property="fPid" column="f_pid"/>
- <result property="fLineno" column="f_lineno"/>
- <result property="fCorpid" column="f_corpid"/>
- <result property="fShipper" column="f_shipper"/>
- <result property="fFeeid" column="f_feeid"/>
- <result property="fFeeunitid" column="f_feeUnitid"/>
- <result property="fWarehouseid" column="f_warehouseid"/>
- <result property="fQty" column="f_qty"/>
- <result property="fUnitprice" column="f_unitprice"/>
- <result property="fAmount" column="f_amount"/>
- <result property="fCurrency" column="f_currency"/>
- <result property="fExrate" column="f_exrate"/>
- <result property="fTaxrate" column="f_taxrate"/>
- <result property="fTaxrateStr" column="f_taxratestr"/>
- <result property="fDc" column="f_dc"/>
- <result property="fBillstatus" column="f_billstatus"/>
- <result property="fReviewDate" column="f_review_date"/>
- <result property="fAccamount" column="f_accamount"/>
- <result property="fStatementNo" column="f_statement_no"/>
- <result property="fStlamount" column="f_stlamount"/>
- <result property="fInvnos" column="f_invnos"/>
- <result property="fAccamountDate" column="f_accamount_date"/>
- <result property="fInvamount" column="f_invamount"/>
- <result property="fInvoicingDate" column="f_invoicing_date"/>
- <result property="fStlamountNo" column="f_stlamount_no"/>
- <result property="fAskamount" column="f_askamount"/>
- <result property="fStatus" column="f_status"/>
- <result property="fStlamountDate" column="f_stlamount_date"/>
- <result property="delFlag" column="del_flag"/>
- <result property="createBy" column="create_by"/>
- <result property="createTime" column="create_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="updateTime" column="update_time"/>
- <result property="remark" column="remark"/>
- <result property="srcId" column="src_id"/>
- <result property="srcBillNo" column="src_bill_no"/>
- <result property="fMblno" column="f_mblno"/>
- <result property="fProductName" column="f_product_name"/>
- <result property="fMarks" column="f_marks"/>
- <result property="fChargedate" column="f_chargedate"/>
- <result property="fBillingDeadline" column="f_billing_deadline"/>
- <result property="fInventoryDays" column="f_inventory_days"/>
- <result property="fAmt" column="f_amt"/>
- <result property="fBillingDays" column="f_billing_days"/>
- <result property="fBillingQty" column="f_billing_qty"/>
- <result property="fBilltype" column="f_billtype"/>
- <result property="fBillingway" column="f_billingway"/>
- <result property="fBsdate" column="f_bsdate"/>
- <result property="priceDateRemarks" column="price_date_remarks"/>
- <result property="fOriginalbilldate" column="f_originalbilldate"/>
- <result property="fStltypeid" column="f_stltypeid"/>
- <result property="fBusinessType" column="f_business_type"/>
- <result property="fSrcTypeId" column="f_src_type_id"/>
- <result property="fSrcBillno" column="src_bill_no"/>
- <result property="fAddress" column="f_address"/>
- <result property="fAddressName" column="f_address_name"/>
- </resultMap>
- <sql id="selectTWarehousebillsfeesVo">
- select f_id,
- f_pid,
- f_lineno,
- f_corpid,
- f_feeid,
- f_warehouseid,
- f_feeUnitid,
- f_qty,
- f_unitprice,
- f_amount,
- f_currency,
- f_exrate,
- f_taxrate,
- CASE
- WHEN f_taxrate = 0 THEN '0.00%'
- WHEN f_taxrate != 0 THEN CONCAT(f_taxrate,'%')
- END as f_taxratestr,
- f_dc,
- f_billstatus,
- f_review_date,
- f_statement_no,
- f_accamount,
- f_stlamount,
- f_accamount_date,
- f_invnos,
- f_invamount,
- f_invoicing_date,
- f_stlamount_no,
- f_askamount,
- f_status,
- f_stlamount_date,
- del_flag,
- create_by,
- create_time,
- update_by,
- update_time,
- remark,
- src_id,
- src_bill_no,
- f_mblno,
- f_product_name,
- f_marks,
- f_chargedate,
- f_billing_deadline,
- f_inventory_days,
- f_amt,
- f_billing_days,
- f_billing_qty,
- f_billtype,
- f_billingway,
- f_bsdate,
- f_originalbilldate,
- f_stltypeid,
- f_business_type,
- f_src_type_id,
- price_date_remarks,
- f_address_name,
- f_address
- from t_warehousebillsfees
- </sql>
- <select id="selectTWarehousebillsfeesList" parameterType="TWarehousebillsfees"
- resultMap="TWarehousebillsfeesResult">
- <include refid="selectTWarehousebillsfeesVo"/>
- <where>
- del_flag = '0'
- <if test="fPid != null ">and f_pid = #{fPid}</if>
- <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
- <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
- <if test="fFeeid != null ">and f_feeid = #{fFeeid}</if>
- <if test="fFeeunitid != null ">and f_feeUnitid = #{fFeeunitid}</if>
- <if test="fQty != null ">and f_qty = #{fQty}</if>
- <if test="fUnitprice != null ">and f_unitprice = #{fUnitprice}</if>
- <if test="fAmount != null ">and f_amount = #{fAmount}</if>
- <if test="fCurrency != null and fCurrency != ''">and f_currency = #{fCurrency}</if>
- <if test="fExrate != null ">and f_exrate = #{fExrate}</if>
- <if test="fTaxrate != null ">and f_taxrate = #{fTaxrate}</if>
- <if test="fDc != null and fDc != ''">and f_dc = #{fDc}</if>
- <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
- <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
- <if test="fStatementNo != null and fStatementNo != ''">and f_statement_no = #{fStatementNo}</if>
- <if test="fAccamount != null ">and f_accamount = #{fAccamount}</if>
- <if test="fStlamount != null ">and f_stlamount = #{fStlamount}</if>
- <if test="fAccamountDate != null ">and f_accamount_date = #{fAccamountDate}</if>
- <if test="fInvnos != null and fInvnos != ''">and f_invnos = #{fInvnos}</if>
- <if test="fInvamount != null ">and f_invamount = #{fInvamount}</if>
- <if test="fInvoicingDate != null ">and f_invoicing_date = #{fInvoicingDate}</if>
- <if test="fStlamountNo != null and fStlamountNo != ''">and f_stlamount_no = #{fStlamountNo}</if>
- <if test="fAskamount != null ">and f_askamount = #{fAskamount}</if>
- <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
- <if test="fStlamountDate != null ">and f_stlamount_date = #{fStlamountDate}</if>
- <if test="srcId != null ">and src_id = #{srcId}</if>
- <if test="srcBillNo != null and srcBillNo != ''">and src_bill_no = #{srcBillNo}</if>
- <if test="fMblno != null and fMblno != ''">and f_mblno = #{fMblno}</if>
- <if test="fProductName != null and fProductName != ''">and f_product_name like concat('%', #{fProductName},
- '%')
- </if>
- <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
- <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
- <if test="fBillingDeadline != null ">and f_billing_deadline = #{fBillingDeadline}</if>
- <if test="fInventoryDays != null ">and f_inventory_days = #{fInventoryDays}</if>
- <if test="fAmt != null ">and f_amt = #{fAmt}</if>
- <if test="fBillingDays != null ">and f_billing_days = #{fBillingDays}</if>
- <if test="fBillingQty != null ">and f_billing_qty = #{fBillingQty}</if>
- <if test="fBilltype != null and fBilltype != ''">and f_billtype = #{fBilltype}</if>
- <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
- <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
- <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
- <if test="fStltypeid != null">and f_stltypeid = #{fStltypeid},</if>
- <if test="fSrcTypeId != null">and f_src_type_id = #{fSrcTypeId},</if>
- <if test="fAddress != null">and f_address = #{fAddress}</if>
- <if test="fAddressName != null and fAddressName != ''">and f_address_name = #{fAddressName}</if>
- </where>
- </select>
- <select id="selectTWarehousebillsfeesById" parameterType="Long" resultMap="TWarehousebillsfeesResult">
- <include refid="selectTWarehousebillsfeesVo"/>
- where f_id = #{fId} and del_flag = 0
- </select>
- <select id="selectTWarehousebillsfeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
- select f_id, f_pid, f_billing_deadline, src_bill_no,f_billstatus
- from t_warehousebillsfees
- where f_pid = #{fId}
- and f_billtype = 'SJCK'
- and del_flag = '0'
- </select>
- <select id="selectWarehousebillsfeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
- <include refid="selectTWarehousebillsfeesVo"/>
- where f_pid = #{fId} and del_flag = '0'
- </select>
- <select id="selectReconciliation" resultType="java.lang.Integer">
- SELECT COUNT(d.f_id)
- FROM t_fee_do d
- LEFT JOIN t_fee f ON d.f_pid = f.f_id
- WHERE d.f_srcpid = #{fId}
- AND f.f_billtype = 'DZ'
- </select>
- <select id="selectCharge" resultType="java.lang.Integer">
- SELECT COUNT(d.f_id)
- FROM t_fee_do d
- LEFT JOIN t_fee f ON d.f_pid = f.f_id
- WHERE d.f_srcpid = #{fId}
- AND f.f_billtype = 'SF'
- </select>
- <select id="selectPay" resultType="java.lang.Integer">
- SELECT COUNT(d.f_id)
- FROM t_fee_do d
- LEFT JOIN t_fee f ON d.f_pid = f.f_id
- WHERE d.f_srcpid = #{fId}
- AND f.f_billtype = 'FF'
- </select>
- <select id="selectFleetExcelMonthList" parameterType="TWarehousebillsfees"
- resultType="com.ruoyi.finance.excel.FleetExcel">
- SELECT
- CONCAT( MONTH ( s.f_bsdate ), '月份小计:' ) feelMonthName,
- CONCAT(
- YEAR ( s.f_bsdate ),
- '-',
- MONTH ( s.f_bsdate )) feelMonth,
- sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
- sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
- sum( s.f_amount ) totalAmount,
- sum( s.f_invamount ) invamount,
- ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
- FROM
- t_warehousebillsfees s
- LEFT JOIN t_corps c ON s.f_corpid = c.f_id
- LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
- WHERE
- s.f_dc = 'D'
- AND s.del_flag = '0'
- <if test='fMonth != null and fMonth[0] != null and fMonth[0]!= ""'>
- and s.f_bsdate >= #{fMonth[0]}
- </if>
- <if test='fMonth != null and fMonth[1] != null and fMonth[1]!= ""'>
- and s.f_bsdate <= #{fMonth[1]}
- </if>
- GROUP BY
- CONCAT(
- YEAR ( f_bsdate ),
- '-',
- MONTH ( f_bsdate ))
- </select>
- <select id="selectFleetExcelList" parameterType="TWarehousebillsfees"
- resultType="com.ruoyi.finance.excel.FleetExcel">
- SELECT
- #{createBy} userName,
- CONCAT(
- YEAR ( s.f_bsdate ),
- '-',
- MONTH ( s.f_bsdate )) feelMonth,
- c.f_name corpName,
- sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
- sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
- sum( s.f_amount ) totalAmount,
- IF
- ( f_invamount = 0, 'F', 'T' ) isInvoice,
- sum( s.f_invamount ) invamount,
- ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
- FROM
- t_warehousebillsfees s
- LEFT JOIN t_corps c ON s.f_corpid = c.f_id
- LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
- WHERE
- s.f_dc = 'D'
- and s.del_flag = '0'
- <if test='fMonth != null and fMonth[0] != null and fMonth[0]!= ""'>
- and s.f_bsdate >= #{fMonth[0]}
- </if>
- <if test='fMonth != null and fMonth[1] != null and fMonth[1]!= ""'>
- and s.f_bsdate <= #{fMonth[1]}
- </if>
- GROUP BY CONCAT( YEAR ( f_bsdate ), '-', MONTH ( f_bsdate )), s.f_corpid, c.f_name
- </select>
- <insert id="insertTWarehousebillsfees" parameterType="TWarehousebillsfees" useGeneratedKeys="true"
- keyProperty="fId">
- insert into t_warehousebillsfees
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="fId != null">f_id,</if>
- <if test="fPid != null">f_pid,</if>
- <if test="fLineno != null">f_lineno,</if>
- <if test="fCorpid != null">f_corpid,</if>
- <if test="fFeeid != null">f_feeid,</if>
- <if test="fWarehouseid != null">f_warehouseid,</if>
- <if test="fFeeunitid != null">f_feeUnitid,</if>
- <if test="fQty != null">f_qty,</if>
- <if test="fUnitprice != null">f_unitprice,</if>
- <if test="fAmount != null">f_amount,</if>
- <if test="fCurrency != null">f_currency,</if>
- <if test="fExrate != null">f_exrate,</if>
- <if test="fTaxrate != null">f_taxrate,</if>
- <if test="fDc != null">f_dc,</if>
- <if test="fBillstatus != null">f_billstatus,</if>
- <if test="fReviewDate != null">f_review_date,</if>
- <if test="fStatementNo != null">f_statement_no,</if>
- <if test="fAccamount != null">f_accamount,</if>
- <if test="fStlamount != null">f_stlamount,</if>
- <if test="fAccamountDate != null">f_accamount_date,</if>
- <if test="fInvnos != null">f_invnos,</if>
- <if test="fInvamount != null">f_invamount,</if>
- <if test="fInvoicingDate != null ">f_invoicing_date,</if>
- <if test="fStlamountNo != null">f_stlamount_no,</if>
- <if test="fAskamount != null">f_askamount,</if>
- <if test="fStatus != null">f_status,</if>
- <if test="fStlamountDate != null">f_stlamount_date,</if>
- <if test="delFlag != null">del_flag,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="remark != null">remark,</if>
- <if test="srcId != null">src_id,</if>
- <if test="srcBillNo != null">src_bill_no,</if>
- <if test="fMblno != null">f_mblno,</if>
- <if test="fProductName != null">f_product_name,</if>
- <if test="fMarks != null">f_marks,</if>
- <if test="fChargedate != null">f_chargedate,</if>
- <if test="fBillingDeadline != null">f_billing_deadline,</if>
- <if test="fInventoryDays != null">f_inventory_days,</if>
- <if test="fAmt != null">f_amt,</if>
- <if test="fBillingDays != null">f_billing_days,</if>
- <if test="fBillingQty != null">f_billing_qty,</if>
- <if test="fBilltype != null">f_billtype,</if>
- <if test="fBillingway != null">f_billingway,</if>
- <if test="fBsdate != null">f_bsdate,</if>
- <if test="fOriginalbilldate != null">f_originalbilldate,</if>
- <if test="fStltypeid != null">f_stltypeid,</if>
- <if test="fBusinessType != null">f_business_type,</if>
- <if test="fSrcTypeId != null">f_src_type_id,</if>
- <if test="priceDateRemarks != null">price_date_remarks,</if>
- <if test="fAddress != null">f_address,</if>
- <if test="fAddressName != null">f_address_name,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="fId != null">#{fId},</if>
- <if test="fPid != null">#{fPid},</if>
- <if test="fLineno != null">#{fLineno},</if>
- <if test="fCorpid != null">#{fCorpid},</if>
- <if test="fFeeid != null">#{fFeeid},</if>
- <if test="fWarehouseid != null">#{fWarehouseid},</if>
- <if test="fFeeunitid != null">#{fFeeunitid},</if>
- <if test="fQty != null">#{fQty},</if>
- <if test="fUnitprice != null">#{fUnitprice},</if>
- <if test="fAmount != null">#{fAmount},</if>
- <if test="fCurrency != null">#{fCurrency},</if>
- <if test="fExrate != null">#{fExrate},</if>
- <if test="fTaxrate != null">#{fTaxrate},</if>
- <if test="fDc != null">#{fDc},</if>
- <if test="fBillstatus != null">#{fBillstatus},</if>
- <if test="fReviewDate != null">#{fReviewDate},</if>
- <if test="fStatementNo != null">#{fStatementNo},</if>
- <if test="fAccamount != null">#{fAccamount},</if>
- <if test="fStlamount != null">#{fStlamount},</if>
- <if test="fAccamountDate != null">#{fAccamountDate},</if>
- <if test="fInvnos != null">#{fInvnos},</if>
- <if test="fInvamount != null">#{fInvamount},</if>
- <if test="fInvoicingDate != null ">#{fInvoicingDate},</if>
- <if test="fStlamountNo != null">#{fStlamountNo},</if>
- <if test="fAskamount != null">#{fAskamount},</if>
- <if test="fStatus != null">#{fStatus},</if>
- <if test="fStlamountDate != null">#{fStlamountDate},</if>
- <if test="delFlag != null">#{delFlag},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="remark != null">#{remark},</if>
- <if test="srcId != null">#{srcId},</if>
- <if test="srcBillNo != null">#{srcBillNo},</if>
- <if test="fMblno != null">#{fMblno},</if>
- <if test="fProductName != null">#{fProductName},</if>
- <if test="fMarks != null">#{fMarks},</if>
- <if test="fChargedate != null">#{fChargedate},</if>
- <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
- <if test="fInventoryDays != null">#{fInventoryDays},</if>
- <if test="fAmt != null">#{fAmt},</if>
- <if test="fBillingDays != null">#{fBillingDays},</if>
- <if test="fBillingQty != null">#{fBillingQty},</if>
- <if test="fBilltype != null">#{fBilltype},</if>
- <if test="fBillingway != null">#{fBillingway},</if>
- <if test="fBsdate != null">#{fBsdate},</if>
- <if test="fOriginalbilldate != null">#{fOriginalbilldate},</if>
- <if test="fStltypeid != null">#{fStltypeid},</if>
- <if test="fBusinessType != null">#{fBusinessType},</if>
- <if test="fSrcTypeId != null">#{fSrcTypeId},</if>
- <if test="priceDateRemarks != null">#{priceDateRemarks},</if>
- <if test="fAddress != null">#{fAddress},</if>
- <if test="fAddressName != null">#{fAddressName},</if>
- </trim>
- </insert>
- <update id="updateTWarehousebillsfees" parameterType="TWarehousebillsfees">
- update t_warehousebillsfees
- <trim prefix="SET" suffixOverrides=",">
- <if test="fPid != null">f_pid = #{fPid},</if>
- <if test="fLineno != null">f_lineno = #{fLineno},</if>
- <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
- <if test="fFeeid != null">f_feeid = #{fFeeid},</if>
- <if test="fFeeunitid != null">f_feeUnitid = #{fFeeunitid},</if>
- <if test="fQty != null">f_qty = #{fQty},</if>
- <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
- <if test="fUnitprice != null">f_unitprice = #{fUnitprice},</if>
- <if test="fAmount != null">f_amount = #{fAmount},</if>
- <if test="fCurrency != null">f_currency = #{fCurrency},</if>
- <if test="fExrate != null">f_exrate = #{fExrate},</if>
- <if test="fTaxrate != null">f_taxrate = #{fTaxrate},</if>
- <if test="fDc != null">f_dc = #{fDc},</if>
- <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
- <if test="fReviewDate != null || fReviewDate == null">f_review_date = #{fReviewDate},</if>
- <if test="fStatementNo != null">f_statement_no = #{fStatementNo},</if>
- <if test="fAccamount != null">f_accamount = #{fAccamount},</if>
- <if test="fStlamount != null">f_stlamount = #{fStlamount},</if>
- <if test="fAccamountDate != null">f_accamount_date = #{fAccamountDate},</if>
- <if test="fInvnos != null">f_invnos = #{fInvnos},</if>
- <if test="fInvamount != null">f_invamount = #{fInvamount},</if>
- <if test="fInvoicingDate != null ">f_invoicing_date = #{fInvoicingDate},</if>
- <if test="fStlamountNo != null">f_stlamount_no = #{fStlamountNo},</if>
- <if test="fAskamount != null">f_askamount = #{fAskamount},</if>
- <if test="fStatus != null">f_status = #{fStatus},</if>
- <if test="fStlamountDate != null">f_stlamount_date = #{fStlamountDate},</if>
- <if test="delFlag != null">del_flag = #{delFlag},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="remark != null">remark = #{remark},</if>
- <if test="srcId != null">src_id = #{srcId},</if>
- <if test="srcBillNo != null">src_bill_no = #{srcBillNo},</if>
- <if test="fMblno != null">f_mblno = #{fMblno},</if>
- <if test="fProductName != null">f_product_name = #{fProductName},</if>
- <if test="fMarks != null">f_marks = #{fMarks},</if>
- <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
- <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
- <if test="fInventoryDays != null">f_inventory_days = #{fInventoryDays},</if>
- <if test="fAmt != null">f_amt = #{fAmt},</if>
- <if test="fBillingDays != null">f_billing_days = #{fBillingDays},</if>
- <if test="fBillingQty != null">f_billing_qty = #{fBillingQty},</if>
- <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
- <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
- <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
- <if test="fOriginalbilldate != null">f_originalbilldate = #{fOriginalbilldate},</if>
- <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
- <if test="priceDateRemarks != null">price_date_remarks = #{priceDateRemarks},</if>
- <if test="fSrcTypeId != null">f_src_type_id = #{fSrcTypeId},</if>
- <if test="fAddress != null">f_address = #{fAddress},</if>
- <if test="fAddressName != null">f_address_name = #{fAddressName},</if>
- </trim>
- where f_id = #{fId}
- </update>
- <delete id="deleteTWarehousebillsfeesById" parameterType="Long">
- delete
- from t_warehousebillsfees
- where f_id = #{fId}
- </delete>
- <delete id="deleteByFPid" parameterType="Long">
- update
- t_warehousebillsfees
- set del_flag = '1'
- where f_pid = #{fId}
- </delete>
- <delete id="deleteTWarehousebillsfeesByIds" parameterType="String">
- update
- t_warehousebillsfees
- set del_flag = '1'
- where f_id in
- <foreach item="fId" collection="array" open="(" separator="," close=")">
- #{fId}
- </foreach>
- </delete>
- <update id="warehouseFeesFollowUpdate">
- update
- t_warehousebillsfees
- <trim prefix="SET" suffixOverrides=",">
- <if test="fettle != null">f_billstatus = #{fettle},</if>
- <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
- <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
- </trim>
- where f_pid = #{fPid} and f_accamount <= 0 and f_stlamount <= 0 and f_invamount <= 0
- </update>
- <update id="warehouseFeesFollowUpdateById">
- update
- t_warehousebillsfees
- <trim prefix="SET" suffixOverrides=",">
- <if test="fettle != null">f_billstatus = #{fettle},</if>
- <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
- <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
- </trim>
- where f_id = #{fPid} and f_accamount <= 0 and f_stlamount <= 0 and f_invamount <= 0
- </update>
- <update id="updateTWarehousebillsfee" parameterType="Map">
- update t_warehousebillsfees
- <trim prefix="SET" suffixOverrides=",">
- /*判断确认对账*/
- <if test="map.billType == 'DZ'">
- f_statement_no = #{map.tFee.fBillno},
- f_accamount = f_accamount + #{map.tFeeDo.fAmt},
- f_accamount_date = #{map.tFee.fAccbilldate}
- </if>
- /*判断撤销对账*/
- <if test="map.billType == 'DZRevoke'">
- f_statement_no = "",
- f_accamount = f_accamount - #{map.tFeeDo.fAmt},
- f_accamount_date = null
- </if>
- /*判断收付款*/
- <if test="map.billType == 'DC'">
- f_stlamount_no = #{map.tFee.fBillno},
- f_stlamount = f_stlamount + #{map.tFeeDo.fAmt},
- f_stlamount_date =#{map.tFee.fAccbilldate}
- </if>
- /*判断撤销收付款*/
- <if test="map.billType == 'DCRevoke'">
- f_stlamount_no = #{map.tFee.fBillno},
- f_stlamount = f_stlamount - #{map.tFeeDo.fAmt},
- f_stlamount_date =#{map.tFee.fAccbilldate}
- </if>
- /*判断开发票款*/
- <if test="map.billType == 'invoiceFP'">
- f_invamount = f_invamount + #{map.tFeeDo.fAmt},
- f_stlamount_date =#{map.tFee.fAccbilldate}
- </if>
- <if test="map.billType == 'DZinvoiceFP'">
- f_invamount = f_invamount - #{map.tFeeDo.fAmt},
- f_stlamount_date =#{map.tFee.fAccbilldate}
- </if>
- /*判断申请发票款*/
- <if test="map.billType == 'ApplyFP'">
- f_askamount = f_askamount + #{map.tFeeDo.fAmt},
- f_stlamount_date =#{map.tFee.fAccbilldate}
- </if>
- <if test="map.billType == 'DZApplyFP'">
- f_askamount = f_askamount - #{map.tFeeDo.fAmt},
- f_stlamount_date =#{map.tFee.fAccbilldate}
- </if>
- /*判断确认对账*/
- <if test="map.billType == 'KHDZ'">
- f_statement_no = #{map.tFee.fBillno},
- f_accamount = f_accamount + #{map.tFeeDo.fAmt},
- f_accamount_date = #{map.tFee.fAccbilldate}
- </if>
- /*判断撤销对账*/
- <if test="map.billType == 'KHDZRevoke'">
- f_statement_no = "",
- f_accamount = f_accamount - #{map.tFeeDo.fAmt},
- f_accamount_date = null
- </if>
- /*判断确认仓库发票*/
- <if test="map.billType == 'FP'">
- f_invnos = #{map.tFee.invoiceNo},
- f_invamount = f_invamount + #{map.tFeeDo.fAmt},
- f_invoicing_date = #{map.tFee.fAccbilldate}
- </if>
- /*判断撤销仓库发票*/
- <if test="map.billType == 'FPRevoke'">
- f_invnos = #{map.tFee.invoiceNo},
- f_invamount = f_invamount - #{map.tFeeDo.fAmt},
- f_invoicing_date = #{map.tFee.fAccbilldate}
- </if>
- </trim>
- where f_id = #{map.tFeeDo.fSrcid}
- </update>
- <update id="updateByPid">
- update t_warehousebillsfees set f_bsdate = #{fChargedate} where f_pid = #{fId}
- </update>
- <select id="selectFeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
- SELECT
- tw.f_id,
- tw.f_pid,
- tw.f_lineno,
- tw.f_corpid,
- tc.f_name corpName,
- tw.f_feeid,
- tf.f_name feeName,
- tw.f_feeUnitid,
- 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.price_date_remarks,
- 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,
- tw.f_business_type,
- tw.f_src_type_id,
- tw.f_address,
- tw.f_address_name
- 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
- where tw.f_pid = #{fPid}
- and tw.del_flag = '0'
- and tw.f_billtype = 'KHDD'
- <if test="fDc != null and fDc != ''">and tw.f_dc = #{fDc}</if>
- </select>
- <select id="voyageFeeDetails" resultType="map">
- SELECT
- tf.f_name feeName,
- SUM(tw.f_unitprice) fUnitprice,
- SUM(tw.f_amount) fAmount
- FROM
- t_warehousebillsfees tw
- LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
- WHERE
- tw.f_pid = #{fPid}
- and tw.del_flag = '0'
- AND tw.f_billtype = 'KHDD'
- <if test="fDc != null and fDc != ''">AND tw.f_dc = #{fDc}</if>
- GROUP BY feeName;
- </select>
- <select id="selectSubItemsFeeDetails" resultType="map">
- select tf.f_name feeName,
- tw.f_unitprice fUnitprice,
- tw.f_amount fAmount
- from t_warehousebillsfees tw
- LEFT JOIN t_fees tf on tw.f_feeid = tf.f_id
- where
- tw.del_flag = '0'
- <if test="fPid != null and fPid != ''">and tw.f_pid = #{fPid}</if>
- <if test="fDc != null and fDc != ''">and tw.f_dc = #{fDc}</if>
- </select>
- <delete id="deleteFessByFPid" parameterType="object">
- delete
- from t_warehousebillsfees
- where f_pid = #{fPid}
- <if test="fDc != null and fDc != ''">and f_dc = #{fDc}</if>
- </delete>
- <!--网页版查询对账-->
- <select id="webVersionReconciliation" parameterType="TAccount" resultType="map">
- SELECT
- tb.f_billno AS fBillno,
- /**运单号*/
- tv.f_name AS vesselName,
- /**船名*/
- ty.f_no AS voyageName,
- /**航次*/
- tc.f_name AS invoice,
- /**收费单位*/
- tc.f_name AS drawee,
- /**受票单位*/
- tp.f_name AS corpName,
- /**货权方*/
- pro.dict_label AS fPaymode,
- /**付款方式*/
- te.f_name AS payment,
- /**费用名称*/
- ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmtdr,
- /**原始金额*/
- ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmt,
- /**本次金额*/
- ta.f_name AS fLoadportidName,
- /**始发港*/
- tr.f_name AS fDestportidName,
- /**目的港*/
- pr.dict_label AS fServiceitems,
- /**运输条款*/
- tg.f_name AS goodName,
- /**货名*/
- tn.f_name AS transit,
- /**箱型*/
- items.f_cntrcount AS fCntrcount,
- /**箱量*/
- tb.f_shippername AS fShippername,
- /**发货人*/
- tb.f_consigneername AS fConsigneername,
- /**收货人*/
- tf.f_id AS fSrcid,
- tf.f_pid AS fSrcpid,
- tf.create_by AS createBy,
- tf.create_time AS createTime,
- tf.update_by AS updateBy,
- tf.update_time AS updateTime,
- tf.remark AS remark,
- tf.f_mblno AS fMblno,
- tf.f_corpid AS fCorpid,
- tf.f_feeid AS fFeeid
- FROM
- t_warehousebillsfees tf
- LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
- LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
- LEFT JOIN t_warehousebills tb ON tb.f_id = tf.f_pid
- LEFT JOIN t_vessel tv ON tv.f_id = tb.f_vslid
- LEFT JOIN t_voyage ty ON ty.f_id = tb.f_voyid
- LEFT JOIN t_address ta ON ta.f_id = tb.f_loadportid
- LEFT JOIN t_address tr ON tr.f_id = tb.f_destportid
- LEFT JOIN sys_dict_data pro ON pro.dict_value = tb.f_paymode
- AND pro.dict_type = 'data_settlement_type'
- LEFT JOIN sys_dict_data pr ON pr.dict_value = tb.f_serviceitems
- AND pr.dict_type = 'f_serviceitems'
- LEFT JOIN ( SELECT f_pid, MAX( f_goodsid ) f_goodsid FROM t_warehousebills_cntr GROUP BY f_pid ) w ON w.f_pid =
- tb.f_id
- LEFT JOIN t_goods tg ON tg.f_id = w.f_goodsid
- LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items
- ON items.f_pid = tb.f_id
- LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON
- twc.f_pid = tb.f_id
- LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
- LEFT JOIN t_corps tp ON tp.f_id = tb.f_corpid
- WHERE
- tf.f_billstatus = 6
- and tf.del_flag = '0'
- AND tf.f_dc = 'D'
- AND tb.f_typeid = 1
- and tb.f_review_date IS NOT NULL
- and ifnull(tf.f_amount, 0) - ifnull(tf.f_accamount, 0) > 0
- <if test="fLoadportid != null">and tb.f_loadportid = #{fLoadportid}</if>
- <if test="fDestportid != null">and tb.f_destportid = #{fDestportid}</if>
- <if test="fInvoceobj != null and fInvoceobj != ''">and tb.f_invoceobj like concat('%', #{fInvoceobj}, '%')</if>
- <if test="fShippername != null and fShippername != ''">and tb.f_shippername like concat('%', #{fShippername},
- '%')
- </if>
- <if test="fConsigneername != null and fConsigneername != ''">and tb.f_consigneername like concat('%',
- #{fConsigneername}, '%')
- </if>
- <if test="fMblno != null and fMblno != ''">and tb.f_mblno like concat('%', #{fMblno}, '%')</if>
- <if test="fBillno != null and fBillno != ''">and tb.f_billno like concat('%', #{fBillno}, '%')</if>
- <if test="fVslid != null">and tb.f_vslid = #{fVslid}</if>
- <if test="fVoyid != null">and tb.f_voyid = #{fVoyid}</if>
- <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
- <if test="fPaymodeid != null">and tb.f_paymode = #{fPaymodeid}</if>
- <if test='sailTime != null and sailTime[0] != null and sailTime[0]!= ""'>
- and tf.create_time >= #{sailTime[0]}
- </if>
- <if test='sailTime != null and sailTime[1] != null and sailTime[1]!= ""'>
- and tf.create_time <= #{sailTime[1]}
- </if>
- <if test="fDocmentdate != null and fDocmentdate != ''">and tb.f_docmentdate = #{fDocmentdate}</if>
- <if test="createBy != null and createBy != ''">and tb.create_by = #{createBy}</if>
- <if test="goodName != null and goodName != ''">and tg.f_name like concat('%', #{goodName}, '%')</if>
- ORDER BY tf.f_id desc
- </select>
- <!--网页版查询对账明细-->
- <select id="webVersionDetail" parameterType="TAccount" resultType="map">
- SELECT
- tf.f_id AS fId,
- te.f_billno AS accountBillno,
- /**账单编号*/
- tw.f_billno AS fBillno,
- /**运单编号*/
- tv.f_name AS vesselName,
- /**船名*/
- ty.f_no AS voyageName,
- /**航次*/
- te.f_ctrlcorpid AS fCtrlcorpid,
- /**获权方*/
- tp.f_name AS corpName,
- /**结算单位*/
- ta.f_name AS fLoadportidName,
- /**始发港*/
- tr.f_name AS fDestportidName,
- /**目的港*/
- pr.dict_label AS fServiceitems,
- /**运输条款*/
- ts.f_name AS payment,
- /**费用名称*/
- tf.f_amtdr AS fAmtdr,
- /**原始金额*/
- tf.f_amt AS fAmt,
- /**本次金额*/
- tn.f_name AS transit,
- /**箱型*/
- items.f_cntrcount AS fCntrcount,
- /**箱量*/
- tf.create_by AS createBy,
- tf.create_time AS createTime,
- CASE
- WHEN te.f_billstatus = '1' THEN
- '保存'
- WHEN te.f_billstatus = '2' THEN
- '暂存'
- WHEN te.f_billstatus = '3' THEN
- '审批驳回'
- WHEN te.f_billstatus = '4' THEN
- '提交审核'
- WHEN te.f_billstatus = '5' THEN
- '审核中'
- WHEN te.f_billstatus = '6' THEN
- '审核完成'
- END AS fBillstatus
- FROM
- t_fee_do tf
- LEFT JOIN t_fee te ON te.f_id = tf.f_pid
- LEFT JOIN t_warehousebills tw ON tf.f_srcpid = tw.f_id
- LEFT JOIN t_warehousebillsfees th ON th.f_id = tf.f_srcid
- LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
- LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
- LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
- LEFT JOIN t_address tr ON tr.f_id = tw.f_destportid
- LEFT JOIN sys_dict_data pr ON pr.dict_value = tw.f_serviceitems
- AND pr.dict_type = 'f_serviceitems'
- LEFT JOIN t_fees ts ON ts.f_id = tf.f_feeid
- LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items
- ON items.f_pid = tw.f_id
- LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON
- twc.f_pid = tw.f_id
- LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
- LEFT JOIN t_corps tp ON tp.f_id = te.f_corpid
- WHERE
- te.f_billtype = 'KHDZ'
- and th.del_flag = '0'
- <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
- <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
- <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj like concat('%', #{fInvoceobj}, '%')</if>
- <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%', #{fShippername},
- '%')
- </if>
- <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
- #{fConsigneername}, '%')
- </if>
- <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
- <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
- <if test="fId != null">and tf.f_id = #{fId}</if>
- <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
- <if test="fCorpid != null">and te.f_corpid = #{fCorpid}</if>
- <if test="fPaymodeid != null">and tw.f_paymode = #{fPaymodeid}</if>
- <if test='sailTime != null and sailTime[0] != null and sailTime[0]!= ""'>
- and tf.create_time >= #{sailTime[0]}
- </if>
- <if test='sailTime != null and sailTime[1] != null and sailTime[1]!= ""'>
- and tf.create_time <= #{sailTime[1]}
- </if>
- <if test="fDocmentdate != null and fDocmentdate != ''">and tw.f_docmentdate = #{fDocmentdate}</if>
- <if test="createBy != null and createBy != ''">and te.create_by = #{createBy}</if>
- <if test="accountBillno != null and accountBillno != ''">and te.f_billno = #{accountBillno}</if>
- ORDER BY tf.f_id desc
- </select>
- <select id="selectTWarehousebillsfeesSrcId" parameterType="Long" resultType="long">
- select src_id
- FROM t_warehousebillsfees
- where f_pid = #{fId} and del_flag = '0'
- AND src_id IS NOT NULL
- </select>
- <select id="accountsDue" resultType="map">
- SELECT CASE MONTH (tf.create_time) WHEN '1' THEN SUM(tf.f_amount) ELSE 0 END AS January,
- CASE MONTH(tf.create_time) WHEN '2' THEN SUM(tf.f_amount) ELSE 0
- END
- AS February,
- CASE MONTH(tf.create_time) WHEN '3' THEN SUM(tf.f_amount) ELSE 0
- END
- AS March,
- CASE MONTH(tf.create_time) WHEN '4' THEN SUM(tf.f_amount) ELSE 0
- END
- AS April,
- CASE MONTH(tf.create_time) WHEN '5' THEN SUM(tf.f_amount) ELSE 0
- END
- AS May,
- CASE MONTH(tf.create_time) WHEN '6' THEN SUM(tf.f_amount) ELSE 0
- END
- AS June,
- CASE MONTH(tf.create_time) WHEN '7' THEN SUM(tf.f_amount) ELSE 0
- END
- AS July,
- CASE MONTH(tf.create_time) WHEN '8' THEN SUM(tf.f_amount) ELSE 0
- END
- AS August,
- CASE MONTH(tf.create_time) WHEN '9' THEN SUM(tf.f_amount) ELSE 0
- END
- AS September,
- CASE MONTH(tf.create_time) WHEN '10' THEN SUM(tf.f_amount) ELSE 0
- END
- AS October,
- CASE MONTH(tf.create_time) WHEN '11' THEN SUM(tf.f_amount) ELSE 0
- END
- AS November,
- CASE MONTH(tf.create_time) WHEN '12' THEN SUM(tf.f_amount) ELSE 0
- END
- AS December,
- tc.f_name corpName
- FROM
- t_warehousebillsfees tf
- LEFT JOIN t_corps tc ON tf.f_corpid = tc.f_id
- WHERE ifnull(tf.f_amount, 0) - ifnull(tf.f_stlamount, 0) >0
- AND tf.f_dc = 'D'
- and tf.del_flag = '0'
- AND YEAR(tf.create_time) = YEAR(NOW())
- GROUP BY tf.f_corpid
- LIMIT 10
- </select>
- <select id="selectQueryMenuList" parameterType="TWarehousebillsfees"
- resultType="com.ruoyi.warehouseBusiness.excel.QueryMenu">
- SELECT
- tc.f_name AS corpName,
- tf.f_mblno AS fMblno,
- IF(tf.f_billtype = 'SJRK' || tf.f_billtype = 'SJCK' || tf.f_billtype = 'CKDB' || tf.f_billtype = 'HQZY' || tf.f_billtype = 'KCZZ' || tf.f_billtype = 'QTZW',tf.f_bsdate, null) AS fBsdate,
- tf.f_review_date AS fReviewDate,
- te.f_name AS feeName,
- tf.f_dc AS fDc,
- tf.f_amount AS fAmount,
- tf.f_stlamount_no AS fStlamountNo,
- tw.f_shipper AS fShipper,
- tw.f_emblno AS fEmblno,
- tf.f_stlamount AS fStlamount,
- tf.f_stlamount_date AS fStlamountDate,
- tf.f_invamount AS fInvamount,
- tf.f_invnos AS fInvnos,
- tf.f_accamount AS fAccamount,
- tf.f_accamount_date AS fAccamountDate,
- tf.f_statement_no AS fStatementNo,
- tf.f_feeUnitid AS fFeeUnitid,
- tf.f_qty AS fQty,
- tf.f_unitprice AS fUnitprice,
- tf.f_billtype AS fBilltype,
- tf.f_product_name AS fProductName,
- tf.f_stltypeid AS fStltypeid,
- tf.remark AS remark,
- tf.src_bill_no AS fSrcBillno,
- tf.f_chargedate AS fChargedate,
- tf.f_billing_deadline AS fBillingDeadline,
- tf.f_originalbilldate AS fOriginalbilldate,
- tf.f_exrate AS fExrate,
- tf.f_taxrate AS fTaxrate,
- CASE
- WHEN tf.f_billstatus = '1' THEN '录入'
- WHEN tf.f_billstatus = '2' THEN '暂存'
- WHEN tf.f_billstatus = '3' THEN '审批驳回'
- WHEN tf.f_billstatus = '4' THEN '提交审核'
- WHEN tf.f_billstatus = '5' THEN '审核中'
- WHEN tf.f_billstatus = '6' THEN '审核通过'
- END AS fBillstatusName
- FROM t_warehousebillsfees tf
- LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
- LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
- LEFT JOIN t_warehousebills tw on tf.f_pid = tw.f_id
- <where>
- tf.del_flag = '0'
- <if test="fBillstatus != null and fBillstatus != ''">and tf.f_billstatus = #{fBillstatus}</if>
- <if test="fDc != null and fDc != ''">and tf.f_dc = #{fDc}</if>
- <if test="fMblno != null and fMblno != ''">and tf.f_mblno like concat('%', #{fMblno}, '%')</if>
- <if test="fStalmountStatus == 1">and tf.f_stlamount_no is not null and tf.f_stlamount!=0</if>
- <if test="fStalmountStatus == 2">and tf.f_stlamount_no is null</if>
- <if test="feesStatus == 1">and tf.f_statement_no is not null and tf.f_accamount >= 0 and tf.f_accamount
- != 0
- </if>
- <if test="feesStatus == 2">and tf.f_statement_no is null</if>
- <if test="fInvnosStatus == 1">and tf.f_invnos is not null and tf.f_invamount != 0</if>
- <if test="fInvnosStatus == 2">and tf.f_invnos is null</if>
- <if test="fCorpid != null and fCorpid != ''">and tf.f_corpid = #{fCorpid}</if>
- <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%',#{fShipper},'%')</if>
- <if test="fEmblno != null and fEmblno != ''">and tw.f_emblno like concat('%',#{fEmblno},'%')</if>
- <if test="fStltypeid != null">and tf.f_stltypeid = #{fStltypeid}</if>
- <if test="fSrcBillno != null">and tf.src_bill_no = #{fSrcBillno}</if>
- <if test='fFeeids != null'>
- and tf.f_feeid in
- <foreach item="fFeeid" collection="fFeeids" open="(" separator="," close=")">
- #{fFeeid}
- </foreach>
- </if>
- <if test='fReviewDateList != null and fReviewDateList[0] != null and fReviewDateList[0]!= ""'>
- and tf.f_review_date >= #{fReviewDateList[0]}
- </if>
- <if test='fReviewDateList != null and fReviewDateList[1] != null and fReviewDateList[1]!= ""'>
- and tf.f_review_date <= #{fReviewDateList[1]}
- </if>
- <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
- and tf.f_bsdate >= #{fBsdateList[0]}
- </if>
- <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
- and tf.f_bsdate <= #{fBsdateList[1]}
- </if>
- </where>
- ORDER BY tf.f_bsdate desc
- </select>
- <select id="selectBillDetailsSubItemNew" parameterType="TWarehousebillsfees" resultType="map">
- select
- twf.f_pid as fId,
- twf.f_mblno as fMblno,
- dict.dict_label as fBusinesstype,
- CASE
- WHEN twf.f_billtype = 'SJRK' THEN '入库'
- WHEN twf.f_billtype = 'SJCK' THEN '实际出库'
- WHEN twf.f_billtype = 'CKDB' THEN '调拨'
- WHEN twf.f_billtype = 'HQZY' THEN '货权转移'
- WHEN twf.f_billtype = 'CDZZ' THEN '场地直装'
- END as fBilltype,
- twf.f_corpid as fCorpid,
- twf.f_statement_no as fStatementno,
- twf.f_product_name as tgfName,
- tc.f_name as tcfName,
- twf.f_qty as fQty,
- tw.f_netweight as fNetweight,
- tw.f_volumn as fVolumn,
- date_format(twf.f_originalbilldate, '%Y-%m-%d') fOriginalbilldate,
- date_format(twf.f_bsdate, '%Y-%m-%d') fBsdate,
- twf.f_billing_days as fBillingdays,
- twf.f_amt as fAmt,
- twf.f_amount as fAmount,
- twf.create_by as createBy,
- date_format(twf.f_chargedate, '%Y-%m-%d') fChargedate,
- date_format(twf.f_billing_deadline, '%Y-%m-%d') fStlamountdate,
- th.f_name as fhName,
- twf.f_dc as fDc,
- twf.remark as remark
- from t_warehousebillsfees twf
- LEFT JOIN t_warehousebills tw on twf.f_pid = tw.f_id
- LEFT JOIN t_goods tg on tw.f_goodsid = tg.f_id
- LEFT JOIN t_corps tc on twf.f_corpid = tc.f_id
- LEFT JOIN t_warehouse th on tw.f_warehouseid = th.f_id
- LEFT JOIN (
- SELECT
- *
- FROM
- sys_dict_data dictIn
- WHERE
- dictIn.dict_label =
- IF((
- (dictIn.dict_type = 'st_in_type' AND dictIn.`status` = '0') OR
- (dictIn.dict_type = 'st_out_type'AND dictIn.status = '0') OR
- (dictIn.dict_type = 'st_trans_type' AND dictIn.status = '0')
- ),dictIn.dict_label,NULL)
- ) dict ON dict.dict_value = twf.f_business_type
- <where>
- twf.del_flag = '0'
- <if test="fCorpid != null and fCorpid != ''">and twf.f_corpid = #{fCorpid}</if>
- <if test="fMblno != null and fMblno != ''">and twf.f_mblno like concat('%', #{fMblno}, '%')</if>
- <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
- and twf.f_bsdate >= #{fBsdateList[0]}
- </if>
- <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
- and twf.f_bsdate <= #{fBsdateList[1]}
- </if>
- <if test='fReviewDateList != null and fReviewDateList[0] != null and fReviewDateList[0]!= ""'>
- and twf.f_review_date >= #{fReviewDateList[0]}
- </if>
- <if test='fReviewDateList != null and fReviewDateList[1] != null and fReviewDateList[1]!= ""'>
- and twf.f_review_date <= #{fReviewDateList[1]}
- </if>
- <if test="fStalmountStatus == 1">and twf.f_stlamount_no is not null and twf.f_stlamount!=0</if>
- <if test="fStalmountStatus == 2">and twf.f_stlamount_no is null</if>
- <if test="feesStatus == 1">and twf.f_statement_no is not null and twf.f_accamount >= 0 and
- twf.f_accamount != 0
- </if>
- <if test="feesStatus == 2">and twf.f_statement_no is null</if>
- <if test="fInvnosStatus == 1">and twf.f_invnos is not null and twf.f_invamount != 0</if>
- <if test="fInvnosStatus == 2">and twf.f_invnos is null</if>
- <if test="fDc != null and fDc != ''">and twf.f_dc = #{fDc}</if>
- <if test='fFeeids != null'>
- and twf.f_feeid in
- <foreach item="fFeeid" collection="fFeeids" open="(" separator="," close=")">
- #{fFeeid}
- </foreach>
- </if>
- <if test="fBillstatus != null and fBillstatus != ''">and twf.f_billstatus = #{fBillstatus}</if>
- <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%',#{fShipper},'%')</if>
- </where>
- GROUP BY
- twf.f_mblno,tc.f_name
- ORDER BY twf.f_bsdate desc
- </select>
- <select id="selectFeesBymblnoAndFname" resultType="map">
- SELECT
- tf.f_name as feeName,
- SUM(twf.f_unitprice) as fUnitprice,
- SUM(twf.f_amount) as fAmount
- FROM
- t_fees tf
- LEFT JOIN t_warehousebillsfees twf on tf.f_id = twf.f_feeid
- <where>
- twf.del_flag = '0'
- <if test="fMblno != null and fMblno != ''">and twf.f_mblno = #{fMblno}</if>
- <if test="fCorpid != null and fCorpid != ''">and twf.f_corpid = #{fCorpid}</if>
- <if test="fDc != null and fDc != ''">and twf.f_dc = #{fDc}</if>
- <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
- and twf.f_bsdate >= #{fBsdateList[0]}
- </if>
- <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
- and twf.f_bsdate <= #{fBsdateList[1]}
- </if>
- <if test='fReviewDateList != null and fReviewDateList[0] != null and fReviewDateList[0]!= ""'>
- and twf.f_review_date >= #{fReviewDateList[0]}
- </if>
- <if test='fReviewDateList != null and fReviewDateList[1] != null and fReviewDateList[1]!= ""'>
- and twf.f_review_date <= #{fReviewDateList[1]}
- </if>
- </where>
- GROUP BY
- feeName
- </select>
- <select id="getCorpid" resultType="long">
- SELECT f_corpid FROM t_warehousebillsfees where del_flag = '0' and f_id in
- <foreach item="fId" collection="fIds" open="(" separator="," close=")">
- #{fId}
- </foreach>
- </select>
- <select id="selectTWarehousebillsfeesList1" resultType="java.util.Map">
- SELECT
- tw.f_id AS fId,
- tw.f_pid AS fPid,
- tw.f_lineno AS fLineno,
- tw.f_corpid AS fCorpid,
- tw.f_feeid AS fFeeid,
- tw.f_warehouseid AS fWarehouseid,
- tw.f_feeUnitid AS fFeeUnitid,
- tw.f_qty AS fQty,
- tw.f_unitprice AS fUnitprice,
- tw.f_amount AS fAmount,
- tw.f_currency AS fCurrency,
- tw.f_exrate AS fExrate,
- tw.f_taxrate AS fTaxrate,
- CASE
- WHEN tw.f_taxrate = 0 THEN
- '0.00%'
- WHEN tw.f_taxrate != 0 THEN
- CONCAT( tw.f_taxrate, '%' )
- END AS f_taxratestr,
- tw.f_dc AS fDc,
- tw.f_billstatus AS fBillstatus,
- tw.f_review_date AS fReviewDate,
- tw.f_statement_no AS fStatementNo,
- tw.f_accamount AS fAccamount,
- tw.f_stlamount AS fStlamount,
- tw.f_accamount_date AS fAccamountDate,
- tw.f_stlamount_no AS fStlamountNo,
- tw.f_askamount AS fAskamount,
- tw.f_status AS f_status,
- tw.f_stlamount_date AS fStlamountDate,
- tw.del_flag AS delFlag,
- tw.create_by AS createBy,
- tw.create_time AS createTime,
- tw.update_by AS updateBy,
- tw.update_time AS updateTime,
- tw.remark AS remark,
- tw.src_id AS srcId,
- tw.src_bill_no AS srcBillNo,
- tw.f_mblno AS fMblno,
- tw.f_product_name AS fProductName,
- tw.f_marks AS fMarks,
- tw.f_chargedate AS fChargedate,
- tw.f_billing_deadline AS fBillingDeadline,
- tw.f_inventory_days AS fInventoryDays,
- tw.f_amt AS fAmt,
- tw.f_billing_days AS fBillingDays,
- tw.f_billing_qty AS fBillingQty,
- tw.f_billtype AS fBilltype,
- tw.f_billingway AS fBillingway,
- tw.f_bsdate AS fBsdate,
- tw.f_originalbilldate AS fOriginalbilldate,
- tw.f_stltypeid AS fStltypeid,
- tw.f_business_type AS fBusinessType,
- tw.f_src_type_id AS fSrcTypeId,
- tw.price_date_remarks AS priceDateRemarks,
- tw.f_address_name AS fAddress_name,
- tw.f_address AS fAddress,
- tw.f_invnos AS fInvnos,
- tw.f_invamount AS fInvamount,
- tw.f_invoicing_date AS fInvoicingDate
- FROM
- t_warehousebillsfees tw
- <where>
- tw.del_flag = '0'
- <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 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="fInvoicingDate != null ">and tw.f_invoicing_date = #{fInvoicingDate}</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="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="fAddress != null">and tw.f_address = #{fAddress}</if>
- <if test="fAddressName != null and fAddressName != ''">and tw.f_address_name = #{fAddressName}</if>
- GROUP BY tw.f_id
- </where>
- </select>
- </mapper>
|