TFeeMapper.xml 108 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.finance.mapper.TFeeMapper">
  6. <resultMap type="TFee" id="TFeeResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fBillno" column="f_billno"/>
  9. <result property="fCtrlcorpid" column="f_ctrlcorpid"/>
  10. <result property="fActId" column="f_act_id"/>
  11. <result property="fCorpid" column="f_corpid"/>
  12. <result property="tMblno" column="t_mblno"/>
  13. <result property="fTransActId" column="f_trans_act_id"/>
  14. <result property="fAmtdr" column="f_amtdr"/>
  15. <result property="fAmtcr" column="f_amtcr"/>
  16. <result property="fBilltype" column="f_billtype"/>
  17. <result property="fBillstatus" column="f_billstatus"/>
  18. <result property="fRemarks" column="f_remarks"/>
  19. <result property="fFromDate" column="f_from_date"/>
  20. <result property="fToDate" column="f_to_date"/>
  21. <result property="fAccbilldate" column="f_accbilldate"/>
  22. <result property="fRefNo" column="f_ref_no"/>
  23. <result property="delFlag" column="del_flag"/>
  24. <result property="createBy" column="create_by"/>
  25. <result property="fDeptid" column="f_deptid"/>
  26. <result property="createTime" column="create_time"/>
  27. <result property="updateBy" column="update_by"/>
  28. <result property="updateTime" column="update_time"/>
  29. <result property="chargingMethod" column="charging_method"/>
  30. <result property="invoiceNo" column="invoice_no"/>
  31. <result property="bank" column="bank"/>
  32. <result property="waterBillNo" column="water_bill_no"/>
  33. <result property="fSystemType" column="f_system_type"/>
  34. <result property="fTrackingNumber" column="f_tracking_number"/>
  35. <result property="fInvoiceRise" column="f_invoice_rise"/>
  36. <result property="fSign" column="f_sign"/>
  37. <result property="fSendTime" column="f_send_Time"/>
  38. <result property="fApplyMoney" column="f_apply_money"/>
  39. <result property="fAccountId" column="f_account_id"/>
  40. <result property="fMake" column="f_make"/>
  41. <result property="fVslid" column="f_vslid" />
  42. <result property="fVoyid" column="f_voyid" />
  43. <result property="fLoadportid" column="f_loadportid" />
  44. <result property="fDestportid" column="f_destportid" />
  45. <result property="fDc" column="f_dc" />
  46. <result property="fBankNumber" column="f_bank_number" />
  47. <result property="fReconciliation" column="f_reconciliation" />
  48. </resultMap>
  49. <sql id="selectTFeeVo">
  50. select f_id,
  51. f_billno,
  52. f_ctrlcorpid,
  53. f_act_id,
  54. f_corpid,
  55. t_mblno,
  56. f_trans_act_id,
  57. f_amtdr,
  58. f_amtcr,
  59. f_billtype,
  60. f_billstatus,
  61. f_remarks,
  62. f_from_date,
  63. f_to_date,
  64. f_accbilldate,
  65. f_ref_no,
  66. del_flag,
  67. create_by,
  68. f_deptid,
  69. create_time,
  70. update_by,
  71. update_time,
  72. charging_method,
  73. invoice_no,
  74. bank,
  75. water_bill_no,
  76. f_system_type,
  77. f_tracking_number,
  78. f_invoice_rise,
  79. f_sign,
  80. f_send_Time,
  81. f_apply_money,
  82. f_account_id,
  83. f_make,
  84. f_vslid,
  85. f_voyid,
  86. f_loadportid,
  87. f_destportid,
  88. f_dc,
  89. f_bank_number,
  90. f_reconciliation
  91. from t_fee
  92. </sql>
  93. <select id="selectTFeeList" parameterType="TFee" resultMap="TFeeResult">
  94. select
  95. ware.f_id,
  96. ware.f_billno,
  97. ware.f_ctrlcorpid,
  98. ware.f_act_id,
  99. ware.f_corpid,
  100. ware.t_mblno,
  101. ware.f_trans_act_id,
  102. ware.f_amtdr,
  103. ware.f_amtcr,
  104. ware.f_billtype,
  105. CASE
  106. WHEN ware.f_billstatus = '1' THEN '新建'
  107. WHEN ware.f_billstatus = '2' THEN '暂存'
  108. WHEN ware.f_billstatus = '3' THEN '审批驳回'
  109. WHEN ware.f_billstatus = '4' THEN '提交审核'
  110. WHEN ware.f_billstatus = '5' THEN '审核中'
  111. WHEN ware.f_billstatus = '6' THEN '审核完成'
  112. END
  113. AS f_billstatus,
  114. ware.f_remarks,
  115. ware.f_from_date,
  116. ware.f_to_date,
  117. ware.f_accbilldate,
  118. ware.f_ref_no,
  119. ware.del_flag,
  120. ware.create_by,
  121. ware.f_deptid,
  122. ware.create_time,
  123. ware.update_by,
  124. ware.update_time,
  125. pro.dict_label AS charging_method,
  126. ware.invoice_no,
  127. ware.bank,
  128. ware.water_bill_no,
  129. ware.f_system_type
  130. from
  131. t_fee ware
  132. left join sys_user u on ware.create_by = u.user_name
  133. left join sys_dept d on ware.f_deptid = d.dept_id
  134. LEFT JOIN sys_dict_data pro ON pro.dict_value = ware.charging_method and pro.dict_type = 'data_settlement_type'
  135. <where>
  136. <if test="fBillno != null and fBillno != ''">and ware.f_billno = #{fBillno}</if>
  137. <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
  138. <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
  139. <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
  140. <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
  141. <if test="tMblno != null and tMblno != ''">and t_mblno = #{tMblno}</if>
  142. <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
  143. <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
  144. <if test="fBilltype != null and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
  145. <if test="fBillstatus != null and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
  146. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%') </if>
  147. <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
  148. <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
  149. <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
  150. <if test="fRefNo != null and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
  151. <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
  152. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  153. and ware.f_accbilldate &gt;= #{timeInterval[0]}
  154. </if>
  155. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  156. and ware.f_accbilldate &lt;= #{timeInterval[1]}
  157. </if>
  158. <if test='amount != null and amount[0] != null and amount[0]!= ""'>
  159. and ware.f_amtdr &gt;= #{amount[0]}
  160. </if>
  161. <if test='amount != null and amount[1] != null and amount[1]!= ""'>
  162. and ware.f_amtdr &lt;= #{amount[1]}
  163. </if>
  164. <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
  165. <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
  166. <if test="bank != null ">and ware.bank = #{bank}</if>
  167. <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
  168. <if test="fSystemType != null and fSystemType != ''">and ware.f_system_type = #{fSystemType}</if>
  169. </where>
  170. ORDER BY ware.create_time desc
  171. ${params.dataScope}
  172. </select>
  173. <select id="selectTFeeList1" parameterType="TFee" resultType="Map">
  174. SELECT
  175. f.f_id AS fId,
  176. f.f_billno AS fBillno,
  177. f.f_ctrlcorpid AS fCtrlcorpid,
  178. pro.dict_label AS chargingMethod,
  179. f.invoice_no AS invoiceNo,
  180. f.bank,
  181. f.water_bill_no AS waterBillNo,
  182. f.f_corpid AS fCorpid,
  183. c.f_name AS fCorpidName,
  184. f.f_accbilldate AS fAccbilldate,
  185. f.t_mblno AS tMblno,
  186. f.f_amtdr AS fAmtdr,
  187. f.f_amtcr AS fAmtcr,
  188. f.f_billtype AS fBilltype,
  189. f.f_system_type AS fSystemType,
  190. CASE
  191. WHEN f.f_billstatus = '1' THEN '新建'
  192. WHEN f.f_billstatus = '2' THEN '暂存'
  193. WHEN f.f_billstatus = '3' THEN '审批驳回'
  194. WHEN f.f_billstatus = '4' THEN '提交审核'
  195. WHEN f.f_billstatus = '5' THEN '审核中'
  196. WHEN f.f_billstatus = '6' THEN '审核完成'
  197. END
  198. AS fBillstatus,
  199. f.f_remarks AS fRemarks,
  200. f.create_by AS createBy,
  201. tp.f_name AS createName,
  202. f.create_time createTime,
  203. f.update_by updateBy,
  204. f.update_time
  205. FROM
  206. t_fee AS f
  207. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  208. left join sys_user u on f.create_by = u.user_name
  209. left join sys_dept d on f.f_deptid = d.dept_id
  210. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  211. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  212. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
  213. <where>
  214. <if test="fId != null ">and f.f_id = #{fId}</if>
  215. <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
  216. <if test="fCtrlcorpid != null ">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
  217. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  218. <if test="tMblno != null and tMblno != ''">and f.t_mblno = #{tMblno}</if>
  219. <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
  220. <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
  221. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  222. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  223. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%') </if>
  224. <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
  225. <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
  226. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  227. and f.f_accbilldate &gt;= #{timeInterval[0]}
  228. </if>
  229. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  230. and f.f_accbilldate &lt;= #{timeInterval[1]}
  231. </if>
  232. <if test='money != null and money[0] != null and money[0]!= ""'>
  233. and f.f_amtdr &gt;= #{money[0]}
  234. </if>
  235. <if test='money != null and money[1] != null and money[1]!= ""'>
  236. and f.f_amtdr &lt;= #{money[1]}
  237. </if>
  238. <if test='amount != null and amount[0] != null and amount[0]!= ""'>
  239. and f.f_amtdr &gt;= #{amount[0]}
  240. </if>
  241. <if test='amount != null and amount[1] != null and amount[1]!= ""'>
  242. and f.f_amtdr &lt;= #{amount[1]}
  243. </if>
  244. <if test='applyTime != null and applyTime[0] != null and applyTime[0]!= ""'>
  245. and f.create_time &gt;= #{applyTime[0]}
  246. </if>
  247. <if test='applyTime != null and applyTime[1] != null and applyTime[1]!= ""'>
  248. and f.create_time &lt;= #{applyTime[1]}
  249. </if>
  250. <if test="chargingMethod != null ">and f.charging_method = #{chargingMethod}</if>
  251. <if test="invoiceNo != null ">and f.invoice_no = #{invoiceNo}</if>
  252. <if test="bank != null ">and f.bank = #{bank}</if>
  253. <if test="waterBillNo != null ">and f.water_bill_no = #{waterBillNo}</if>
  254. <if test="fSystemType != null and fSystemType != ''">and f.f_system_type = #{fSystemType}</if>
  255. <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
  256. </where>
  257. ORDER BY f.f_id desc
  258. ${params.dataScope}
  259. </select>
  260. <!--凯和查询财务信息-->
  261. <select id="selectFinancialTFeeList" parameterType="TFee" resultType="com.ruoyi.finance.shipping.FinancialTFee">
  262. SELECT
  263. f.f_id AS fId,
  264. f.f_billno AS fBillno,
  265. f.f_ctrlcorpid AS fCtrlcorpid,
  266. pro.dict_label AS chargingMethod,
  267. f.invoice_no AS invoiceNo,
  268. f.bank AS fBank,
  269. f.water_bill_no AS waterBillNo,
  270. f.f_corpid AS fCorpid,
  271. c.f_name AS fCorpidName,
  272. f.f_accbilldate AS fAccbilldate,
  273. f.t_mblno AS tMblno,
  274. f.f_amtdr AS fAmtdr,
  275. f.f_amtcr AS fAmtcr,
  276. f.f_billtype AS fBilltype,
  277. f.f_system_type AS fSystemType,
  278. f.f_billstatus AS fBillstatus,
  279. CASE
  280. WHEN f.f_billstatus = '1' THEN '新建'
  281. WHEN f.f_billstatus = '2' THEN '暂存'
  282. WHEN f.f_billstatus = '3' THEN '审批驳回'
  283. WHEN f.f_billstatus = '4' THEN '提交审核'
  284. WHEN f.f_billstatus = '5' THEN '审核中'
  285. WHEN f.f_billstatus = '6' THEN '审核完成'
  286. END
  287. AS fBillstatusName,
  288. f.f_remarks AS fRemarks,
  289. f.create_by AS createBy,
  290. tp.f_name AS createName,
  291. f.create_time AS createTime,
  292. f.update_by AS updateBy,
  293. f.update_time AS updateTime,
  294. tv.f_name AS vessel,
  295. ty.f_no AS voyage,
  296. tre.f_name AS loadportName,
  297. ts.f_name AS destportName,
  298. f.f_bank_number AS fBankNumber,
  299. f.bank AS bank,
  300. CASE
  301. WHEN f.f_dc = 'D' THEN
  302. '收'
  303. WHEN f.f_dc = 'C' THEN
  304. '付'
  305. END AS fSrcdcName
  306. FROM
  307. t_fee AS f
  308. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  309. left join sys_user u on f.create_by = u.user_name
  310. left join sys_dept d on f.f_deptid = d.dept_id
  311. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  312. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  313. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
  314. LEFT JOIN t_vessel tv ON f.f_vslid = tv.f_id
  315. LEFT JOIN t_voyage ty ON f.f_voyid = ty.f_id
  316. LEFT JOIN t_address tre ON tre.f_id = f.f_loadportid
  317. LEFT JOIN t_address ts ON ts.f_id = f.f_destportid
  318. <where>
  319. <if test="fId != null ">and f.f_id = #{fId}</if>
  320. <if test="fBillno != null and fBillno != ''">and f.f_billno like concat('%', #{fBillno}, '%')</if>
  321. <if test="fCtrlcorpid != null and fCtrlcorpid != ''">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
  322. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  323. <if test="tMblno != null and tMblno != ''">and f.t_mblno like concat('%', #{tMblno}, '%')</if>
  324. <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
  325. <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
  326. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  327. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  328. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%') </if>
  329. <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
  330. <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
  331. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  332. and f.f_accbilldate &gt;= #{timeInterval[0]}
  333. </if>
  334. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  335. and f.f_accbilldate &lt;= #{timeInterval[1]}
  336. </if>
  337. <if test='money != null and money[0] != null and money[0]!= ""'>
  338. and f.f_amtdr &gt;= #{money[0]}
  339. </if>
  340. <if test='money != null and money[1] != null and money[1]!= ""'>
  341. and f.f_amtdr &lt;= #{money[1]}
  342. </if>
  343. <if test='amount != null and amount[0] != null and amount[0]!= ""'>
  344. and f.f_amtdr &gt;= #{amount[0]}
  345. </if>
  346. <if test='amount != null and amount[1] != null and amount[1]!= ""'>
  347. and f.f_amtdr &lt;= #{amount[1]}
  348. </if>
  349. <if test='applyTime != null and applyTime[0] != null and applyTime[0]!= ""'>
  350. and f.create_time &gt;= #{applyTime[0]}
  351. </if>
  352. <if test='applyTime != null and applyTime[1] != null and applyTime[1]!= ""'>
  353. and f.create_time &lt;= #{applyTime[1]}
  354. </if>
  355. <if test="chargingMethod != null ">and f.charging_method = #{chargingMethod}</if>
  356. <if test="invoiceNo != null ">and f.invoice_no like concat('%', #{invoiceNo}, '%') </if>
  357. <if test="bank != null ">and f.bank like concat('%', #{bank}, '%')</if>
  358. <if test="waterBillNo != null ">and f.water_bill_no like concat('%', #{waterBillNo}, '%') </if>
  359. <if test="fSystemType != null and fSystemType != ''">and f.f_system_type = #{fSystemType}</if>
  360. <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
  361. <if test="fVslid != null "> and f.f_vslid = #{fVslid}</if>
  362. <if test="fVoyid != null "> and f.f_voyid = #{fVoyid}</if>
  363. <if test="fLoadportid != null "> and f.f_loadportid = #{fLoadportid}</if>
  364. <if test="fDestportid != null "> and f.f_destportid = #{fDestportid}</if>
  365. <if test="fDc != null and fDc != ''"> and f.f_dc = #{fDc}</if>
  366. <if test="fBankNumber != null and fBankNumber != ''"> and f.f_bank_number like concat('%', #{fBankNumber}, '%')</if>
  367. <if test="fReconciliation != null "> and f.f_reconciliation = #{fReconciliation}</if>
  368. </where>
  369. ORDER BY f.f_id desc
  370. </select>
  371. <select id="selectTFeeById" parameterType="Long" resultMap="TFeeResult">
  372. <include refid="selectTFeeVo"/>
  373. where f_id = #{fId}
  374. </select>
  375. <select id="selectTFeeByIdNew" parameterType="Long" resultMap="TFeeResult">
  376. SELECT f.f_id,
  377. f.f_billno,
  378. f.f_ctrlcorpid,
  379. f.f_corpid,
  380. c.f_name AS fCorpidName,
  381. f.f_accbilldate,
  382. f.t_mblno,
  383. f.f_amtdr,
  384. f.f_amtcr,
  385. f.f_billtype,
  386. f.f_system_type,
  387. f.f_billstatus,
  388. f.f_remarks,
  389. f.create_by,
  390. tp.f_name AS createName,
  391. f.create_time,
  392. f.update_by,
  393. f.update_time,
  394. tn.f_taxrate AS fTaxrate,
  395. f.charging_method,
  396. f.invoice_no,
  397. f.bank,
  398. f.water_bill_no
  399. FROM t_fee AS f
  400. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  401. left join sys_user u on f.create_by = u.user_name
  402. left join sys_dept d on f.f_deptid = d.dept_id
  403. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  404. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  405. LEFT JOIN(SELECT ti.f_pid, ti.f_taxrate FROM t_fee_invoice ti LIMIT 1) tn ON tn.f_pid = f.f_id
  406. where f.f_id = #{fId}
  407. </select>
  408. <!--凯和确认账单查询-->
  409. <select id="webVersionTFee" parameterType="TFee" resultType="map">
  410. SELECT
  411. f.f_id AS fId,
  412. f.f_billno AS fBillno,
  413. f.f_ctrlcorpid AS fCtrlcorpid,
  414. c.f_name AS fCorpidName,
  415. f.f_accbilldate AS fAccbilldate,
  416. f.t_mblno AS tMblno,
  417. f.f_amtdr AS fAmtdr,
  418. f.f_amtcr AS fAmtcr,
  419. f.f_billtype AS filltype,
  420. f.f_remarks AS fRemarks,
  421. f.create_by AS createBy,
  422. tp.f_name AS createName,
  423. f.create_time AS createTime,
  424. f.update_by AS updateBy,
  425. f.update_time AS updateTime,
  426. tn.f_taxrate AS fTaxrate,
  427. f.charging_method AS chargingMethod,
  428. f.invoice_no AS invoiceNo,
  429. f.bank AS bank,
  430. f.water_bill_no AS waterBillNo,
  431. CASE
  432. WHEN f.f_billstatus = '1' THEN '新建'
  433. WHEN f.f_billstatus = '2' THEN '暂存'
  434. WHEN f.f_billstatus = '3' THEN '审批驳回'
  435. WHEN f.f_billstatus = '4' THEN '提交审核'
  436. WHEN f.f_billstatus = '5' THEN '审核中'
  437. WHEN f.f_billstatus = '6' THEN '审核完成'
  438. END
  439. AS fBillstatus
  440. FROM
  441. t_fee AS f
  442. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  443. left join sys_user u on f.create_by = u.user_name
  444. left join sys_dept d on f.f_deptid = d.dept_id
  445. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  446. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  447. LEFT JOIN(SELECT ti.f_pid,ti.f_taxrate FROM t_fee_invoice ti LIMIT 1) tn ON tn.f_pid = f.f_id
  448. <where>
  449. f.f_make = 0
  450. <if test="fId != null ">and f.f_id = #{fId}</if>
  451. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  452. <if test="createId != null ">and tp.f_id = #{createId}</if>
  453. <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
  454. <if test="fCtrlcorpid != null and fCtrlcorpid != ''">and f.f_ctrlcorpid like concat('%',
  455. #{fCtrlcorpid},'%')
  456. </if>
  457. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  458. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  459. <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
  460. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  461. and f.f_accbilldate &gt;= #{timeInterval[0]}
  462. </if>
  463. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  464. and f.f_accbilldate &lt;= #{timeInterval[1]}
  465. </if>
  466. </where>
  467. ORDER BY f.f_id desc
  468. </select>
  469. <insert id="insertTFee" parameterType="TFee" useGeneratedKeys="true" keyProperty="fId">
  470. insert into t_fee
  471. <trim prefix="(" suffix=")" suffixOverrides=",">
  472. <if test="fId != null">f_id,</if>
  473. <if test="fBillno != null">f_billno,</if>
  474. <if test="fCtrlcorpid != null">f_ctrlcorpid,</if>
  475. <if test="fActId != null">f_act_id,</if>
  476. <if test="fCorpid != null">f_corpid,</if>
  477. <if test="tMblno != null">t_mblno,</if>
  478. <if test="fTransActId != null">f_trans_act_id,</if>
  479. <if test="fAmtdr != null">f_amtdr,</if>
  480. <if test="fAmtcr != null">f_amtcr,</if>
  481. <if test="fBilltype != null and fBilltype != ''">f_billtype,</if>
  482. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus,</if>
  483. <if test="fRemarks != null">f_remarks,</if>
  484. <if test="fFromDate != null">f_from_date,</if>
  485. <if test="fToDate != null">f_to_date,</if>
  486. <if test="fAccbilldate != null">f_accbilldate,</if>
  487. <if test="fRefNo != null">f_ref_no,</if>
  488. <if test="delFlag != null">del_flag,</if>
  489. <if test="createBy != null">create_by,</if>
  490. <if test="fDeptid != null">f_deptid,</if>
  491. <if test="createTime != null">create_time,</if>
  492. <if test="updateBy != null">update_by,</if>
  493. <if test="updateTime != null">update_time,</if>
  494. <if test="chargingMethod != null">charging_method,</if>
  495. <if test="invoiceNo != null">invoice_no,</if>
  496. <if test="bank != null">bank,</if>
  497. <if test="waterBillNo != null">water_bill_no,</if>
  498. <if test="fSystemType != null">f_system_type,</if>
  499. <if test="fTrackingNumber != null">f_tracking_number,</if>
  500. <if test="fInvoiceRise != null">f_invoice_rise,</if>
  501. <if test="fSign != null">f_sign,</if>
  502. <if test="fSendTime != null">f_send_Time,</if>
  503. <if test="fApplyMoney != null">f_apply_money,</if>
  504. <if test="fAccountId != null">f_account_id,</if>
  505. <if test="fMake != null">f_make,</if>
  506. <if test="fVslid != null">f_vslid,</if>
  507. <if test="fVoyid != null">f_voyid,</if>
  508. <if test="fLoadportid != null">f_loadportid,</if>
  509. <if test="fDestportid != null">f_destportid,</if>
  510. <if test="fDc != null">f_dc,</if>
  511. <if test="fBankNumber != null">f_bank_number,</if>
  512. <if test="fReconciliation != null">f_reconciliation,</if>
  513. </trim>
  514. <trim prefix="values (" suffix=")" suffixOverrides=",">
  515. <if test="fId != null">#{fId},</if>
  516. <if test="fBillno != null">#{fBillno},</if>
  517. <if test="fCtrlcorpid != null">#{fCtrlcorpid},</if>
  518. <if test="fActId != null">#{fActId},</if>
  519. <if test="fCorpid != null">#{fCorpid},</if>
  520. <if test="tMblno != null">#{tMblno},</if>
  521. <if test="fTransActId != null">#{fTransActId},</if>
  522. <if test="fAmtdr != null">#{fAmtdr},</if>
  523. <if test="fAmtcr != null">#{fAmtcr},</if>
  524. <if test="fBilltype != null and fBilltype != ''">#{fBilltype},</if>
  525. <if test="fBillstatus != null and fBillstatus != ''">#{fBillstatus},</if>
  526. <if test="fRemarks != null">#{fRemarks},</if>
  527. <if test="fFromDate != null">#{fFromDate},</if>
  528. <if test="fToDate != null">#{fToDate},</if>
  529. <if test="fAccbilldate != null">#{fAccbilldate},</if>
  530. <if test="fRefNo != null">#{fRefNo},</if>
  531. <if test="delFlag != null">#{delFlag},</if>
  532. <if test="createBy != null">#{createBy},</if>
  533. <if test="fDeptid != null">#{fDeptid},</if>
  534. <if test="createTime != null">#{createTime},</if>
  535. <if test="updateBy != null">#{updateBy},</if>
  536. <if test="updateTime != null">#{updateTime},</if>
  537. <if test="chargingMethod != null">#{chargingMethod},</if>
  538. <if test="invoiceNo != null">#{invoiceNo},</if>
  539. <if test="bank != null">#{bank},</if>
  540. <if test="waterBillNo != null">#{waterBillNo},</if>
  541. <if test="fSystemType != null">#{fSystemType},</if>
  542. <if test="fTrackingNumber != null">#{fTrackingNumber},</if>
  543. <if test="fInvoiceRise != null">#{fInvoiceRise},</if>
  544. <if test="fSign != null">#{fSign},</if>
  545. <if test="fSendTime != null">#{fSendTime},</if>
  546. <if test="fApplyMoney != null">#{fApplyMoney},</if>
  547. <if test="fAccountId != null">#{fAccountId},</if>
  548. <if test="fMake != null">#{fMake},</if>
  549. <if test="fVslid != null">#{fVslid},</if>
  550. <if test="fVoyid != null">#{fVoyid},</if>
  551. <if test="fLoadportid != null">#{fLoadportid},</if>
  552. <if test="fDestportid != null">#{fDestportid},</if>
  553. <if test="fDc != null">#{fDc},</if>
  554. <if test="fBankNumber != null">#{fBankNumber},</if>
  555. <if test="fReconciliation != null">#{fReconciliation},</if>
  556. </trim>
  557. </insert>
  558. <update id="updateTFee" parameterType="TFee">
  559. update t_fee
  560. <trim prefix="SET" suffixOverrides=",">
  561. <if test="fBillno != null">f_billno = #{fBillno},</if>
  562. <if test="fCtrlcorpid != null">f_ctrlcorpid = #{fCtrlcorpid},</if>
  563. <if test="fActId != null">f_act_id = #{fActId},</if>
  564. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  565. <if test="tMblno != null">t_mblno = #{tMblno},</if>
  566. <if test="fTransActId != null">f_trans_act_id = #{fTransActId},</if>
  567. <if test="fAmtdr != null">f_amtdr = #{fAmtdr},</if>
  568. <if test="fAmtcr != null">f_amtcr = #{fAmtcr},</if>
  569. <if test="fBilltype != null and fBilltype != ''">f_billtype = #{fBilltype},</if>
  570. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus = #{fBillstatus},</if>
  571. <if test="fRemarks != null">f_remarks = #{fRemarks},</if>
  572. <if test="fFromDate != null">f_from_date = #{fFromDate},</if>
  573. <if test="fToDate != null">f_to_date = #{fToDate},</if>
  574. <if test="fAccbilldate != null">f_accbilldate = #{fAccbilldate},</if>
  575. <if test="fRefNo != null">f_ref_no = #{fRefNo},</if>
  576. <if test="delFlag != null">del_flag = #{delFlag},</if>
  577. <if test="createBy != null">create_by = #{createBy},</if>
  578. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  579. <if test="createTime != null">create_time = #{createTime},</if>
  580. <if test="updateBy != null">update_by = #{updateBy},</if>
  581. <if test="updateTime != null">update_time = #{updateTime},</if>
  582. <if test="chargingMethod != null">charging_method = #{chargingMethod},</if>
  583. <if test="invoiceNo != null">invoice_no = #{invoiceNo},</if>
  584. <if test="bank != null">bank = #{bank},</if>
  585. <if test="waterBillNo != null">water_bill_no = #{waterBillNo},</if>
  586. <if test="fSystemType != null">f_system_type = #{fSystemType},</if>
  587. <if test="fTrackingNumber != null">f_tracking_number = #{fTrackingNumber},</if>
  588. <if test="fInvoiceRise != null">f_invoice_rise = #{fInvoiceRise},</if>
  589. <if test="fSign != null">f_sign = #{fSign},</if>
  590. <if test="fSendTime != null">f_send_Time = #{fSendTime},</if>
  591. <if test="fApplyMoney != null">f_apply_money = #{fApplyMoney},</if>
  592. <if test="fAccountId != null">f_account_id = #{fAccountId},</if>
  593. <if test="fMake != null">f_make = #{fMake},</if>
  594. <if test="fVslid != null">f_vslid = #{fVslid},</if>
  595. <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
  596. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  597. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  598. <if test="fDc != null">f_dc = #{fDc},</if>
  599. <if test="fBankNumber != null">f_bank_number = #{fBankNumber},</if>
  600. <if test="fReconciliation != null">f_reconciliation = #{fReconciliation},</if>
  601. </trim>
  602. where f_id = #{fId}
  603. </update>
  604. <delete id="deleteTFeeById" parameterType="Long">
  605. delete
  606. from t_fee
  607. where f_id = #{fId}
  608. </delete>
  609. <delete id="deleteTFeeByIds" parameterType="String">
  610. delete
  611. f.*,
  612. fd.* ,
  613. fi.*
  614. from
  615. t_fee f
  616. LEFT JOIN t_fee_do fd ON fd.f_pid = f.f_id
  617. LEFT JOIN t_fee_invoice fi ON fi.f_pid = f.f_id
  618. where f.f_id in
  619. <foreach item="fId" collection="array" open="(" separator="," close=")">
  620. #{fId}
  621. </foreach>
  622. </delete>
  623. <select id="warehouseBillsFeesList" resultType="java.util.Map">
  624. SELECT
  625. w.f_id AS fSrcid,
  626. t.f_id AS fSrcpid,
  627. t.f_corpid AS fCorpid,
  628. c.f_name AS fName,
  629. c.f_id AS fId,
  630. c.f_name AS fFeesName,
  631. t.f_bscorpno AS fBscorpno,
  632. w.f_mblno AS fMblno,
  633. w.f_product_name AS fProductName,
  634. w.f_bsdate AS fBsdate,
  635. t.f_billtype AS fBilltype,
  636. t.f_review_date AS fReviewDate,
  637. w.f_feeid AS fFeeid,
  638. w.src_bill_no AS srcBillNo,
  639. w.f_marks AS fMarks,
  640. w.f_chargedate AS fChargedate,
  641. w.f_billing_days AS fBillingDays,
  642. w.f_billing_deadline AS fBillingDeadline,
  643. w.f_inventory_days AS fInventoryDays,
  644. w.f_originalbilldate AS fOriginalbilldate,
  645. f.f_name AS fFeeName,
  646. w.f_dc AS fSrcdc,
  647. CASE
  648. WHEN w.f_dc = 'D' THEN
  649. '收'
  650. WHEN w.f_dc = 'C' THEN
  651. '付'
  652. END AS fSrcdcName,
  653. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  654. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
  655. w.f_business_type AS fBusinessType
  656. FROM
  657. t_warehousebillsfees w
  658. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  659. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  660. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  661. <where>
  662. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
  663. #{map.tWareHouseFees.fCorpid}
  664. </if>
  665. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  666. #{map.tWareHouseFees.fToCorpid}
  667. </if>
  668. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  669. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  670. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  671. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  672. </if>
  673. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  674. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  675. </if>
  676. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  677. and w.f_accamount_date IS NOT NULL
  678. </if>
  679. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  680. and w.f_accamount_date IS NULL
  681. </if>
  682. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  683. and w.f_dc = #{map.tWareHouseFees.fDc}
  684. </if>
  685. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  686. and w.f_dc = #{map.tWareHouseFees.fDc}
  687. </if>
  688. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  689. and w.f_feeid in
  690. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  691. separator=",">
  692. #{id}
  693. </foreach>
  694. </if>
  695. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  696. and w.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  697. </if>
  698. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  699. and w.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  700. </if>
  701. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  702. and w.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  703. </if>
  704. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  705. and w.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  706. </if>
  707. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  708. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  709. </if>
  710. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  711. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  712. </if>
  713. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  714. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  715. </if>
  716. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  717. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  718. </if>
  719. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  720. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  721. </if>
  722. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
  723. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  724. </if>
  725. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  726. and w.f_business_type in
  727. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  728. #{id}
  729. </foreach>
  730. </if>
  731. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  732. and w.f_id in
  733. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  734. separator=",">
  735. #{id}
  736. </foreach>
  737. </if>
  738. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  739. and t.f_id in
  740. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  741. separator=",">
  742. #{id}
  743. </foreach>
  744. </if>
  745. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  746. </if>
  747. and w.f_review_date IS NOT NULL
  748. and abs(w.f_amount - w.f_stlamount) &gt; 0
  749. GROUP BY w.f_id
  750. </where>
  751. </select>
  752. <select id="warehouseApplyFPFeesList" resultType="java.util.Map">
  753. SELECT
  754. w.f_id AS fSrcid,
  755. t.f_id AS fSrcpid,
  756. t.f_corpid AS fCorpid,
  757. c.f_name AS fName,
  758. w.fId AS fId,
  759. w.fName AS fFeesName,
  760. t.f_bscorpno AS fBscorpno,
  761. w.f_mblno AS fMblno,
  762. w.f_product_name AS fProductName,
  763. w.f_bsdate AS fBsdate,
  764. t.f_billtype AS fBilltype,
  765. t.f_review_date AS fReviewDate,
  766. w.f_feeid AS fFeeid,
  767. w.src_bill_no AS srcBillNo,
  768. w.f_marks AS fMarks,
  769. w.f_chargedate AS fChargedate,
  770. w.f_billing_days AS fBillingDays,
  771. w.f_billing_deadline AS fBillingDeadline,
  772. w.f_inventory_days AS fInventoryDays,
  773. w.f_originalbilldate AS fOriginalbilldate,
  774. f.f_name AS fFeeName,
  775. w.f_dc AS fSrcdc,
  776. CASE
  777. WHEN w.f_dc = 'D' THEN '收'
  778. WHEN w.f_dc = 'C' THEN '付'
  779. END AS fSrcdcName,
  780. ifnull( w.f_amount, 0 ) - ifnull( w.f_askamount, 0 ) AS fAmtdr,
  781. ifnull( w.f_amount, 0 ) - ifnull( w.f_askamount, 0 ) AS fAmt,
  782. dict.dict_label AS fFeeunitid,
  783. w.f_qty AS fQty,
  784. w.f_unitprice AS fUnitprice,
  785. w.f_currency AS fCurreny,
  786. w.f_taxrate AS fTaxrate,
  787. w.remark AS remark,
  788. tv.f_name AS boatName,
  789. ty.f_no AS voyageName,
  790. w.create_time createTime,
  791. w.businessName,
  792. t.f_loadportid AS fLoadportid,
  793. t.f_destportid AS fDestportid
  794. FROM
  795. t_warehousebills t
  796. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  797. LEFT JOIN (
  798. SELECT
  799. f.f_id AS f_id,
  800. f.f_pid AS f_pid,
  801. f.f_lineno AS f_lineno,
  802. f.f_corpid,
  803. f.f_feeid,
  804. f.f_feeUnitid,
  805. f.f_qty,
  806. f.f_unitprice,
  807. f.f_amount,
  808. f.f_currency,
  809. f.f_exrate,
  810. f.f_taxrate,
  811. f.f_dc,
  812. f.f_billstatus,
  813. f.f_statement_no,
  814. f.f_accamount,
  815. f.f_accamount_date,
  816. f.f_stlamount_no,
  817. f.f_stlamount,
  818. f.f_stlamount_date,
  819. f.f_invnos,
  820. f.f_invamount,
  821. f.f_askamount,
  822. f.f_chargedate,
  823. f.f_status,
  824. f.remark,
  825. f.f_mblno,
  826. f.f_product_name,
  827. f.src_bill_no,
  828. f.f_billing_days,
  829. f.f_inventory_days,
  830. f.f_marks,
  831. f.f_billing_deadline,
  832. f.f_originalbilldate,
  833. f.f_billtype,
  834. f.f_business_type,
  835. pro.dict_label businessName,
  836. f.f_bsdate,
  837. c.f_id AS fId,
  838. c.f_name AS fName,f.create_time
  839. FROM
  840. t_warehousebillsfees AS f
  841. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  842. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type
  843. ) w ON w.f_pid = t.f_id
  844. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  845. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  846. LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
  847. LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
  848. <where>
  849. dict.status = '0'
  850. AND dict.dict_type = 'data_unitfees'
  851. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  852. #{map.tWareHouseFees.fCorpid}
  853. </if>
  854. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  855. #{map.tWareHouseFees.fToCorpid}
  856. </if>
  857. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  858. <if test="map.tWareHouseFees.fLoadportid != null ">and t.f_loadportid = #{map.tWareHouseFees.fLoadportid}
  859. </if>
  860. <if test="map.tWareHouseFees.fDestportid != null ">and t.f_destportid = #{map.tWareHouseFees.fDestportid}
  861. </if>
  862. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  863. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  864. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  865. </if>
  866. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  867. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  868. </if>
  869. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  870. and w.f_accamount_date IS NOT NULL
  871. </if>
  872. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  873. and w.f_accamount_date IS NULL
  874. </if>
  875. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  876. and w.f_dc = #{map.tWareHouseFees.fDc}
  877. </if>
  878. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  879. and w.f_dc = #{map.tWareHouseFees.fDc}
  880. </if>
  881. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  882. and w.f_feeid in
  883. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  884. separator=",">
  885. #{id}
  886. </foreach>
  887. </if>
  888. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  889. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  890. </if>
  891. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  892. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  893. </if>
  894. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
  895. and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
  896. </if>
  897. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
  898. and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
  899. </if>
  900. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  901. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  902. </if>
  903. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  904. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  905. </if>
  906. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  907. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  908. </if>
  909. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  910. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  911. </if>
  912. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  913. and w.f_business_type in
  914. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  915. #{id}
  916. </foreach>
  917. </if>
  918. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  919. and w.f_id in
  920. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  921. separator=",">
  922. #{id}
  923. </foreach>
  924. </if>
  925. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  926. and t.f_id in
  927. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  928. separator=",">
  929. #{id}
  930. </foreach>
  931. </if>
  932. <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  933. <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  934. <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
  935. #{map.tWareHouseFees.boatName}
  936. </if>
  937. <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no like
  938. concat('%', #{map.tWareHouseFees.voyageName}, '%')
  939. </if>
  940. <if test="map.tWareHouseFees.fName != null and map.tWareHouseFees.fName != ''">and c.f_name like
  941. concat('%', #{map.tWareHouseFees.fName}, '%')
  942. </if>
  943. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  944. </if>
  945. and t.f_review_date IS NOT NULL
  946. and ifnull(w.f_amount, 0) - ifnull(w.f_askamount, 0) > 0
  947. GROUP BY w.f_id
  948. </where>
  949. </select>
  950. <select id="warehouseInvoiceFPFeesList" resultType="java.util.Map">
  951. SELECT
  952. w.f_id AS fSrcid,
  953. t.f_id AS fSrcpid,
  954. t.f_corpid AS fCorpid,
  955. c.f_name AS fName,
  956. w.fId AS fId,
  957. w.fName AS fFeesName,
  958. t.f_bscorpno AS fBscorpno,
  959. w.f_mblno AS fMblno,
  960. w.f_product_name AS fProductName,
  961. w.f_bsdate AS fBsdate,
  962. t.f_billtype AS fBilltype,
  963. t.f_review_date AS fReviewDate,
  964. w.f_feeid AS fFeeid,
  965. w.src_bill_no AS srcBillNo,
  966. w.f_marks AS fMarks,
  967. w.f_chargedate AS fChargedate,
  968. w.f_billing_days AS fBillingDays,
  969. w.f_billing_deadline AS fBillingDeadline,
  970. w.f_inventory_days AS fInventoryDays,
  971. w.f_originalbilldate AS fOriginalbilldate,
  972. f.f_name AS fFeeName,
  973. w.f_dc AS fSrcdc,
  974. CASE
  975. WHEN w.f_dc = 'D' THEN '收'
  976. WHEN w.f_dc = 'C' THEN '付'
  977. END AS fSrcdcName,
  978. ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmtdr,
  979. ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmt,
  980. dict.dict_label AS fFeeunitid,
  981. w.f_qty AS fQty,
  982. w.f_unitprice AS fUnitprice,
  983. w.f_currency AS fCurreny,
  984. w.f_taxrate AS fTaxrate,
  985. w.remark AS remark,
  986. tv.f_name AS boatName,
  987. ty.f_no AS voyageName,
  988. w.create_time createTime,
  989. w.businessName
  990. FROM
  991. t_warehousebills t
  992. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  993. LEFT JOIN (
  994. SELECT
  995. f.f_id AS f_id,
  996. f.f_pid AS f_pid,
  997. f.f_lineno AS f_lineno,
  998. f.f_corpid,
  999. f.f_feeid,
  1000. f.f_feeUnitid,
  1001. f.f_qty,
  1002. f.f_unitprice,
  1003. f.f_amount,
  1004. f.f_currency,
  1005. f.f_exrate,
  1006. f.f_taxrate,
  1007. f.f_dc,
  1008. f.f_billstatus,
  1009. f.f_statement_no,
  1010. f.f_accamount,
  1011. f.f_accamount_date,
  1012. f.f_stlamount_no,
  1013. f.f_stlamount,
  1014. f.f_stlamount_date,
  1015. f.f_invnos,
  1016. f.f_invamount,
  1017. f.f_askamount,
  1018. f.f_chargedate,
  1019. f.f_status,
  1020. f.remark,
  1021. f.f_mblno,
  1022. f.f_product_name,
  1023. f.src_bill_no,
  1024. f.f_billing_days,
  1025. f.f_inventory_days,
  1026. f.f_marks,
  1027. f.f_billing_deadline,
  1028. f.f_originalbilldate,
  1029. f.f_billtype,
  1030. f.f_business_type,
  1031. pro.dict_label businessName,
  1032. f.f_bsdate,
  1033. c.f_id AS fId,
  1034. c.f_name AS fName,f.create_time
  1035. FROM
  1036. t_warehousebillsfees AS f
  1037. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  1038. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type
  1039. ) w ON w.f_pid = t.f_id
  1040. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1041. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1042. LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
  1043. LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
  1044. <where>
  1045. dict.status = '0'
  1046. AND dict.dict_type = 'data_unitfees'
  1047. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  1048. #{map.tWareHouseFees.fCorpid}
  1049. </if>
  1050. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1051. #{map.tWareHouseFees.fToCorpid}
  1052. </if>
  1053. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1054. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1055. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1056. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1057. </if>
  1058. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1059. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1060. </if>
  1061. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1062. and w.f_accamount_date IS NOT NULL
  1063. </if>
  1064. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1065. and w.f_accamount_date IS NULL
  1066. </if>
  1067. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1068. and w.f_dc = #{map.tWareHouseFees.fDc}
  1069. </if>
  1070. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1071. and w.f_dc = #{map.tWareHouseFees.fDc}
  1072. </if>
  1073. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1074. and w.f_feeid in
  1075. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1076. separator=",">
  1077. #{id}
  1078. </foreach>
  1079. </if>
  1080. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1081. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1082. </if>
  1083. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1084. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1085. </if>
  1086. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
  1087. and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
  1088. </if>
  1089. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
  1090. and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
  1091. </if>
  1092. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1093. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1094. </if>
  1095. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1096. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1097. </if>
  1098. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1099. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1100. </if>
  1101. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1102. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1103. </if>
  1104. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1105. and w.f_business_type in
  1106. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1107. #{id}
  1108. </foreach>
  1109. </if>
  1110. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  1111. and w.f_id in
  1112. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  1113. separator=",">
  1114. #{id}
  1115. </foreach>
  1116. </if>
  1117. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  1118. and t.f_id in
  1119. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  1120. separator=",">
  1121. #{id}
  1122. </foreach>
  1123. </if>
  1124. <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  1125. <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  1126. <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
  1127. #{map.tWareHouseFees.boatName}
  1128. </if>
  1129. <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no =
  1130. #{map.tWareHouseFees.voyageName}
  1131. </if>
  1132. <if test="map.tWareHouseFees.fName != null and map.tWareHouseFees.fName != ''">and c.f_name = like
  1133. concat('%', #{map.tWareHouseFees.fName}, '%')
  1134. </if>
  1135. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1136. </if>
  1137. and t.f_review_date IS NOT NULL
  1138. and ifnull(w.f_amount, 0) - ifnull(w.f_invamount, 0) > 0
  1139. GROUP BY w.f_id
  1140. </where>
  1141. </select>
  1142. <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
  1143. SELECT
  1144. w.f_id AS fSrcid,
  1145. t.f_id AS fSrcpid,
  1146. t.f_corpid AS fCorpid,
  1147. c.f_name AS fName,
  1148. c.f_name AS fFeesName,
  1149. t.f_bscorpno AS fBscorpno,
  1150. w.f_mblno AS fMblno,
  1151. w.f_product_name AS fProductName,
  1152. w.f_bsdate AS fBsdate,
  1153. t.f_billtype AS fBilltype,
  1154. t.f_review_date AS fReviewDate,
  1155. w.f_marks AS fMarks,
  1156. w.f_feeid AS fFeeid,
  1157. w.f_billtype AS fBilltype,
  1158. w.f_chargedate AS fChargedate,
  1159. w.f_originalbilldate AS fOriginalbilldate,
  1160. w.f_billing_deadline AS fBillingDeadline,
  1161. w.f_billing_days AS fBillingDays,
  1162. w.f_inventory_days AS fInventoryDays,
  1163. f.f_name AS fFeeName,
  1164. w.f_dc AS fSrcdc,
  1165. CASE
  1166. WHEN w.f_dc = 'D' THEN
  1167. '收'
  1168. WHEN w.f_dc = 'C' THEN
  1169. '付'
  1170. END AS fSrcdcName,
  1171. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  1172. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  1173. dict.dict_label AS fFeeunitid,
  1174. w.f_qty AS fQty,
  1175. w.f_unitprice AS fUnitprice,
  1176. w.f_business_type AS fBusinessType
  1177. FROM
  1178. t_warehousebillsfees w
  1179. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  1180. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  1181. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1182. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1183. <where>
  1184. dict.status = '0'
  1185. AND dict.dict_type = 'data_unitfees'
  1186. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
  1187. #{map.tWareHouseFees.fCorpid}
  1188. </if>
  1189. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1190. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1191. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1192. #{map.tWareHouseFees.fToCorpid}
  1193. </if>
  1194. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1195. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1196. </if>
  1197. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1198. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1199. </if>
  1200. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1201. and w.f_accamount_date IS NOT NULL
  1202. </if>
  1203. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1204. and w.f_accamount_date IS NULL
  1205. </if>
  1206. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1207. and w.f_dc = #{map.tWareHouseFees.fDc}
  1208. </if>
  1209. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1210. and w.f_dc = #{map.tWareHouseFees.fDc}
  1211. </if>
  1212. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1213. and w.f_feeid in
  1214. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1215. separator=",">
  1216. #{id}
  1217. </foreach>
  1218. </if>
  1219. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1220. and w.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1221. </if>
  1222. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1223. and w.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1224. </if>
  1225. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1226. and w.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1227. </if>
  1228. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1229. and w.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1230. </if>
  1231. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1232. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1233. </if>
  1234. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1235. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1236. </if>
  1237. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  1238. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1239. </if>
  1240. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  1241. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1242. </if>
  1243. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  1244. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1245. </if>
  1246. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
  1247. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1248. </if>
  1249. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1250. and w.f_business_type in
  1251. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1252. #{id}
  1253. </foreach>
  1254. </if>
  1255. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  1256. and w.f_id in
  1257. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  1258. separator=",">
  1259. #{id}
  1260. </foreach>
  1261. </if>
  1262. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  1263. and t.f_id in
  1264. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  1265. separator=",">
  1266. #{id}
  1267. </foreach>
  1268. </if>
  1269. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1270. </if>
  1271. <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
  1272. and w.create_by = #{map.tWareHouseFees.createBy}
  1273. </if>
  1274. and w.f_review_date IS NOT NULL
  1275. and abs(w.f_amount - w.f_accamount) &gt; 0
  1276. GROUP BY w.f_id
  1277. </where>
  1278. </select>
  1279. <!--
  1280. <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
  1281. SELECT
  1282. w.f_id AS fSrcid,
  1283. t.f_id AS fSrcpid,
  1284. t.f_corpid AS fCorpid,
  1285. c.f_name AS fName,
  1286. w.fName AS fFeesName,
  1287. t.f_bscorpno AS fBscorpno,
  1288. w.f_mblno AS fMblno,
  1289. w.f_product_name AS fProductName,
  1290. w.f_bsdate AS fBsdate,
  1291. t.f_billtype AS fBilltype,
  1292. t.f_review_date AS fReviewDate,
  1293. w.f_marks AS fMarks,
  1294. w.f_feeid AS fFeeid,
  1295. w.f_billtype AS fBilltype,
  1296. w.f_chargedate AS fChargedate,
  1297. w.f_originalbilldate AS fOriginalbilldate,
  1298. w.f_billing_deadline AS fBillingDeadline,
  1299. w.f_billing_days AS fBillingDays,
  1300. w.f_inventory_days AS fInventoryDays,
  1301. f.f_name AS fFeeName,
  1302. w.f_dc AS fSrcdc,
  1303. CASE
  1304. WHEN w.f_dc = 'D' THEN '收'
  1305. WHEN w.f_dc = 'C' THEN '付'
  1306. END AS fSrcdcName,
  1307. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  1308. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  1309. dict.dict_label AS fFeeunitid,
  1310. w.f_qty AS fQty ,
  1311. w.f_unitprice AS fUnitprice ,
  1312. dictIn.dict_label AS fBusinessType
  1313. FROM
  1314. t_warehousebills t
  1315. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1316. LEFT JOIN (
  1317. SELECT
  1318. f.f_id AS f_id,
  1319. f.f_pid AS f_pid,
  1320. f.f_lineno AS f_lineno,
  1321. f.f_corpid,
  1322. f.f_feeid,
  1323. f.f_feeUnitid,
  1324. f.f_qty,
  1325. f.f_unitprice,
  1326. f.f_amount,
  1327. f.f_currency,
  1328. f.f_exrate,
  1329. f.f_taxrate,
  1330. f.f_dc,
  1331. f.f_billstatus,
  1332. f.f_statement_no,
  1333. f.f_accamount,
  1334. f.f_accamount_date,
  1335. f.f_stlamount_no,
  1336. f.f_stlamount,
  1337. f.f_stlamount_date,
  1338. f.f_invnos,
  1339. f.f_invamount,
  1340. f.f_askamount,
  1341. f.f_status,
  1342. f.remark,
  1343. f.f_inventory_days,
  1344. f.f_billing_days,
  1345. f.f_billing_deadline,
  1346. f.f_originalbilldate,
  1347. f.f_mblno,
  1348. f.f_product_name,
  1349. f.f_chargedate,
  1350. f.src_bill_no,
  1351. f.f_billtype,
  1352. f.f_marks,
  1353. f.f_business_type,
  1354. f.f_bsdate,
  1355. c.f_id AS fId,
  1356. c.f_name AS fName
  1357. FROM
  1358. t_warehousebillsfees AS f
  1359. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  1360. ) w ON w.f_pid = t.f_id
  1361. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1362. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1363. LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = w.f_business_type
  1364. <where>
  1365. dict.status = '0'
  1366. AND dict.dict_type = 'data_unitfees'
  1367. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  1368. #{map.tWareHouseFees.fCorpid}
  1369. </if>
  1370. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1371. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1372. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1373. #{map.tWareHouseFees.fToCorpid}
  1374. </if>
  1375. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1376. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1377. </if>
  1378. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1379. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1380. </if>
  1381. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1382. and w.f_accamount_date IS NOT NULL
  1383. </if>
  1384. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1385. and w.f_accamount_date IS NULL
  1386. </if>
  1387. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1388. and w.f_dc = #{map.tWareHouseFees.fDc}
  1389. </if>
  1390. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1391. and w.f_dc = #{map.tWareHouseFees.fDc}
  1392. </if>
  1393. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1394. and w.f_feeid in
  1395. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1396. separator=",">
  1397. #{id}
  1398. </foreach>
  1399. </if>
  1400. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1401. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1402. </if>
  1403. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1404. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1405. </if>
  1406. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1407. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1408. </if>
  1409. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1410. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1411. </if>
  1412. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1413. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1414. </if>
  1415. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1416. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1417. </if>
  1418. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  1419. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1420. AND dictIn.dict_type = 'st_in_type'
  1421. AND dictIn.status = '0'
  1422. </if>
  1423. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  1424. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1425. AND dictIn.dict_type = 'st_out_type'
  1426. AND dictIn.status = '0'
  1427. </if>
  1428. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  1429. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1430. AND dictIn.dict_type = 'st_trans_type'
  1431. AND dictIn.status = '0'
  1432. </if>
  1433. <if test="map.tWareHouseFees.fBilltype == null ">
  1434. AND dictIn.dict_type in ('st_in_type','st_out_type','st_trans_type')
  1435. AND dictIn.status = '0'
  1436. </if>
  1437. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
  1438. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1439. </if>
  1440. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1441. and w.f_business_type in
  1442. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1443. #{id}
  1444. </foreach>
  1445. </if>
  1446. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  1447. and w.f_id in
  1448. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  1449. separator=",">
  1450. #{id}
  1451. </foreach>
  1452. </if>
  1453. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  1454. and t.f_id in
  1455. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  1456. separator=",">
  1457. #{id}
  1458. </foreach>
  1459. </if>
  1460. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1461. </if>
  1462. <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
  1463. and t.create_by = #{map.tWareHouseFees.createBy}
  1464. </if>
  1465. and t.f_review_date IS NOT NULL
  1466. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  1467. GROUP BY w.f_id
  1468. </where>
  1469. </select>
  1470. -->
  1471. <select id="warehouseBillsKHFeesListAccamount" resultType="java.util.Map">
  1472. SELECT
  1473. w.f_id AS fSrcid,
  1474. t.f_id AS fSrcpid,
  1475. t.f_corpid AS fCorpid,
  1476. t.f_billno fBillno,
  1477. c.f_name AS fName,
  1478. w.fName AS fFeesName,
  1479. t.f_bscorpno AS fBscorpno,
  1480. w.f_mblno AS fMblno,
  1481. w.f_product_name AS fProductName,
  1482. w.f_bsdate AS fBsdate,
  1483. t.f_billtype AS tfBilltype,
  1484. t.f_review_date AS fReviewDate,
  1485. w.f_marks AS fMarks,
  1486. w.f_feeid AS fFeeid,
  1487. w.f_billtype AS wfBilltype,
  1488. w.f_chargedate AS fChargedate,
  1489. w.f_originalbilldate AS fOriginalbilldate,
  1490. w.f_billing_deadline AS fBillingDeadline,
  1491. w.f_billing_days AS fBillingDays,
  1492. w.f_inventory_days AS fInventoryDays,
  1493. f.f_name AS fFeeName,
  1494. w.f_dc AS fSrcdc,
  1495. CASE
  1496. WHEN w.f_dc = 'D' THEN '收'
  1497. WHEN w.f_dc = 'C' THEN '付'
  1498. END AS fSrcdcName,
  1499. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  1500. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  1501. dict.dict_label AS fFeeunitid,
  1502. w.f_qty AS fQty,
  1503. w.f_unitprice AS fUnitprice,
  1504. w.f_currency AS fCurreny,
  1505. w.f_taxrate AS fTaxrate,
  1506. w.remark AS remark,
  1507. tv.f_name AS boatName,
  1508. ty.f_no AS voyageName,
  1509. w.create_time createTime,
  1510. w.businessName
  1511. FROM
  1512. t_warehousebills t
  1513. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1514. LEFT JOIN (
  1515. SELECT
  1516. f.f_id AS f_id,
  1517. f.f_pid AS f_pid,
  1518. f.f_lineno AS f_lineno,
  1519. f.f_corpid,
  1520. f.f_feeid,
  1521. f.f_feeUnitid,
  1522. f.f_qty,
  1523. f.f_unitprice,
  1524. f.f_amount,
  1525. f.f_currency,
  1526. f.f_exrate,
  1527. f.f_taxrate,
  1528. f.f_dc,
  1529. f.f_billstatus,
  1530. f.f_statement_no,
  1531. f.f_accamount,
  1532. f.f_accamount_date,
  1533. f.f_stlamount_no,
  1534. f.f_stlamount,
  1535. f.f_stlamount_date,
  1536. f.f_invnos,
  1537. f.f_invamount,
  1538. f.f_askamount,
  1539. f.f_status,
  1540. f.remark,
  1541. f.f_inventory_days,
  1542. f.f_billing_days,
  1543. f.f_billing_deadline,
  1544. f.f_originalbilldate,
  1545. f.f_mblno,
  1546. f.f_product_name,
  1547. f.f_chargedate,
  1548. f.src_bill_no,
  1549. f.f_billtype,
  1550. f.f_marks,
  1551. f.f_business_type,
  1552. pro.dict_label businessName,
  1553. f.f_bsdate,
  1554. c.f_id AS fId,
  1555. c.f_name AS fName,
  1556. f.create_time
  1557. FROM
  1558. t_warehousebillsfees AS f
  1559. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  1560. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type and pro.dict_type = 'data_billType'
  1561. ) w ON w.f_pid = t.f_id
  1562. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1563. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1564. LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
  1565. LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
  1566. <where>
  1567. dict.status = '0'
  1568. AND dict.dict_type = 'data_unitfees'
  1569. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  1570. #{map.tWareHouseFees.fToCorpid}
  1571. </if>
  1572. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1573. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1574. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1575. #{map.tWareHouseFees.fCorpid}
  1576. </if>
  1577. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1578. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1579. </if>
  1580. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1581. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1582. </if>
  1583. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1584. and w.f_accamount_date IS NOT NULL
  1585. </if>
  1586. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1587. and w.f_accamount_date IS NULL
  1588. </if>
  1589. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1590. and w.f_dc = #{map.tWareHouseFees.fDc}
  1591. </if>
  1592. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1593. and w.f_dc = #{map.tWareHouseFees.fDc}
  1594. </if>
  1595. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1596. and w.f_feeid in
  1597. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1598. separator=",">
  1599. #{id}
  1600. </foreach>
  1601. </if>
  1602. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1603. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1604. </if>
  1605. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1606. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1607. </if>
  1608. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
  1609. and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
  1610. </if>
  1611. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
  1612. and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
  1613. </if>
  1614. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1615. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1616. </if>
  1617. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1618. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1619. </if>
  1620. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1621. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1622. </if>
  1623. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1624. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1625. </if>
  1626. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1627. and w.f_business_type in
  1628. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1629. #{id}
  1630. </foreach>
  1631. </if>
  1632. <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  1633. <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  1634. <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
  1635. #{map.tWareHouseFees.boatName}
  1636. </if>
  1637. <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no =
  1638. #{map.tWareHouseFees.voyageName}
  1639. </if>
  1640. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1641. </if>
  1642. and t.f_review_date IS NOT NULL
  1643. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  1644. GROUP BY w.f_id
  1645. </where>
  1646. </select>
  1647. <select id="warehouseBillsFeesList1" resultType="java.util.Map">
  1648. SELECT
  1649. w.f_id AS fSrcid,
  1650. t.f_id AS fSrcpid,
  1651. t.f_corpid AS fCorpid,
  1652. c.f_name AS fName,
  1653. w.f_corpid AS fCorpids,
  1654. c1.f_name AS fFeesName,
  1655. w.f_mblno AS fMblno,
  1656. w.f_product_name AS fProductName,
  1657. w.f_marks AS fMarks,
  1658. t.f_billtype AS fBilltype,
  1659. t.f_review_date AS fReviewDate,
  1660. w.f_dc AS fSrcdc,
  1661. SUM(w.f_amount) AS fAmount,
  1662. SUM(w.f_stlamount) AS fStlamount,
  1663. ifnull(SUM( w.f_amount ) , 0 ) - ifnull( SUM( w.f_stlamount ) , 0 ) AS nnfinished
  1664. FROM
  1665. t_warehousebills t
  1666. left join sys_user u on t.create_by = u.user_name
  1667. left join sys_dept d on t.f_bsdeptid = d.dept_id
  1668. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1669. LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
  1670. LEFT JOIN t_corps c1 ON w.f_corpid = c1.f_id
  1671. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1672. <where>
  1673. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
  1674. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
  1675. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  1676. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
  1677. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
  1678. #{fProductName}, '%')
  1679. </if>
  1680. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
  1681. and w.f_billstatus != 6
  1682. </if>
  1683. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  1684. and w.f_billstatus = 6
  1685. </if>
  1686. <if test='fDc != null and fDc != "" and fDc == "D" '>
  1687. and w.f_dc = #{fDc}
  1688. </if>
  1689. <if test='fDc != null and fDc != "" and fDc == "C" '>
  1690. and w.f_dc = #{fDc}
  1691. </if>
  1692. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  1693. and t.f_review_date &gt;= #{timeExamine[0]}
  1694. </if>
  1695. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  1696. and t.f_review_date &lt;= #{timeExamine[1]}
  1697. </if>
  1698. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  1699. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  1700. </if>
  1701. and t.f_review_date IS NOT NULL
  1702. ${params.dataScope}
  1703. GROUP BY
  1704. w.f_pid,
  1705. w.f_dc,
  1706. w.f_corpid
  1707. </where>
  1708. </select>
  1709. <select id="selectTWarehousebillsItemsList"
  1710. resultType="com.ruoyi.warehouseBusiness.excel.TWareHouseExcelItem">
  1711. SELECT (@ii := @ii + 1) AS fId,
  1712. wi.f_mblno AS fMblno,
  1713. wi.f_bsdate AS fBsdate,
  1714. f.f_name AS fFeeid,
  1715. CASE
  1716. WHEN w.f_srcdc = 'D' THEN
  1717. '收'
  1718. WHEN w.f_srcdc = 'C' THEN
  1719. '付'
  1720. END AS fSrcdc,
  1721. w.f_amtdr AS fAmtdr,
  1722. dict.dict_label AS fFeeunitid,
  1723. wi.f_qty AS fBillingQty,
  1724. wi.f_unitprice AS fUnitprice,
  1725. w.f_amt AS fAmt,
  1726. wi.f_business_type AS fBusinessType,
  1727. CASE
  1728. wi.f_billtype
  1729. WHEN 'SJRK' THEN
  1730. '入库'
  1731. WHEN 'SJCK' THEN
  1732. '出库'
  1733. WHEN 'HQZY' THEN
  1734. '货转'
  1735. WHEN 'CKDB' THEN
  1736. '调拨'
  1737. WHEN 'HWTG' THEN
  1738. '货物通关'
  1739. WHEN 'KCZZ' THEN
  1740. '库存总账'
  1741. END AS fBilltype,
  1742. wi.f_product_name AS fGoodsid,
  1743. wi.f_marks AS fMarks,
  1744. wi.f_chargedate AS fChargedate,
  1745. wi.f_billing_deadline AS fBillingDeadline,
  1746. wi.f_inventory_days AS fInventoryDays,
  1747. wi.f_billing_days AS fBillingDays,
  1748. w.f_remarks AS fRemarks
  1749. FROM t_fee_do w
  1750. LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
  1751. LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
  1752. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  1753. , (
  1754. SELECT @ii := 0
  1755. ) AS ii
  1756. WHERE dict.status = '0'
  1757. AND dict.dict_type = 'data_unitfees'
  1758. AND w.f_pid = #{fId}
  1759. </select>
  1760. <select id="warehouseBillsFeesProfitList" resultType="java.util.Map">
  1761. SELECT
  1762. t.f_id AS fSrcpid,
  1763. c.f_name AS fName,
  1764. c1.f_name AS fFeesName,
  1765. w.f_mblno AS fMblno,
  1766. w.f_product_name AS fProductName,
  1767. w.f_marks AS fMarks,
  1768. t.f_billtype AS fBilltype,
  1769. w.f_review_date AS fReviewDate,
  1770. sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) fAmount,
  1771. sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) fStlamount,
  1772. sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END )
  1773. nnfinished
  1774. FROM
  1775. t_warehousebillsfees w
  1776. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  1777. left join sys_user u on t.create_by = u.user_name
  1778. left join sys_dept d on t.f_bsdeptid = d.dept_id
  1779. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1780. LEFT JOIN t_corps c1 ON c1.f_id = w.f_corpid
  1781. <where>
  1782. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
  1783. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
  1784. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  1785. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
  1786. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
  1787. #{fProductName}, '%')
  1788. </if>
  1789. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
  1790. and w.f_billstatus != 6
  1791. </if>
  1792. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  1793. and w.f_billstatus = 6
  1794. </if>
  1795. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  1796. and w.f_review_date &gt;= #{timeExamine[0]}
  1797. </if>
  1798. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  1799. and w.f_review_date &lt;= #{timeExamine[1]}
  1800. </if>
  1801. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  1802. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  1803. </if>
  1804. <if test="fBusinessType != null and fBusinessType != '' ">
  1805. and w.f_business_type in
  1806. <foreach collection="fBusinessType" item="id" open="(" close=")" separator=",">
  1807. #{id}
  1808. </foreach>
  1809. </if>
  1810. <if test="fFeeid != null and fFeeid != '' ">
  1811. and w.f_feeid in
  1812. <foreach collection="fFeeid" item="id" open="(" close=")" separator=",">
  1813. #{id}
  1814. </foreach>
  1815. </if>
  1816. and w.f_review_date IS NOT NULL
  1817. ${params.dataScope}
  1818. GROUP BY
  1819. w.f_mblno
  1820. </where>
  1821. </select>
  1822. <select id="selectFeeList" resultType="java.util.Map">
  1823. select
  1824. ware.create_by AS createBy,
  1825. ware.f_billno AS fBillno,
  1826. ware.f_ctrlcorpid AS fCtrlcorpid,
  1827. ware.create_time AS createTime,
  1828. ware.f_accbilldate AS fAccbilldate,
  1829. ware.t_mblno AS tMblno,
  1830. dict.dict_label AS chargingMethod,
  1831. ware.invoice_no AS invoiceNo,
  1832. ware.bank AS bank,
  1833. ware.water_bill_no AS waterBillNo,
  1834. ware.f_amtdr AS fAmtdr,
  1835. ware.f_amtcr AS fAmtcr,
  1836. ware.f_remarks AS fRemarks,
  1837. CASE
  1838. WHEN ware.f_billstatus = '1' THEN '新建'
  1839. WHEN ware.f_billstatus = '2' THEN '暂存'
  1840. WHEN ware.f_billstatus = '3' THEN '审批驳回'
  1841. WHEN ware.f_billstatus = '4' THEN '提交审核'
  1842. WHEN ware.f_billstatus = '5' THEN '审核中'
  1843. WHEN ware.f_billstatus = '6' THEN '审核完成'
  1844. END
  1845. AS fBillstatus
  1846. from
  1847. t_fee ware
  1848. left join sys_user u on ware.create_by = u.user_name
  1849. left join sys_dept d on ware.f_deptid = d.dept_id
  1850. LEFT JOIN sys_dict_data dict ON dict.dict_value = ware.charging_method
  1851. <where>
  1852. dict.status = '0'
  1853. AND dict.dict_type = 'data_settlement_type'
  1854. <if test="fBillno != null and fBillno != ''">and ware.f_billno = #{fBillno}</if>
  1855. <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
  1856. <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
  1857. <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
  1858. <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
  1859. <if test="tMblno != null and tMblno != ''">and ware.t_mblno = #{tMblno}</if>
  1860. <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
  1861. <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
  1862. <if test="fBilltype != null and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
  1863. <if test="fBillstatus != null and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
  1864. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks = #{fRemarks}</if>
  1865. <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
  1866. <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
  1867. <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
  1868. <if test="fRefNo != null and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
  1869. <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
  1870. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1871. and ware.f_accbilldate &gt;= #{timeInterval[0]}
  1872. </if>
  1873. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1874. and ware.f_accbilldate &lt;= #{timeInterval[1]}
  1875. </if>
  1876. <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
  1877. <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
  1878. <if test="bank != null ">and ware.bank = #{bank}</if>
  1879. <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
  1880. </where>
  1881. ${params.dataScope}
  1882. </select>
  1883. <select id="selectDetailedList" resultType="com.ruoyi.finance.excel.Detailed">
  1884. SELECT (@ii := @ii + 1) AS fId,
  1885. wi.f_mblno AS fMblno,
  1886. wi.f_bsdate AS fBsdate,
  1887. t.f_bscorpno AS fBscorpno,
  1888. f.f_name AS fFeeid,
  1889. CASE
  1890. WHEN w.f_srcdc = 'D' THEN
  1891. '收'
  1892. WHEN w.f_srcdc = 'C' THEN
  1893. '付'
  1894. END AS fSrcdc,
  1895. w.f_amtdr AS fAmtdr,
  1896. dict.dict_label AS fFeeunitid,
  1897. wi.f_qty AS fBillingQty,
  1898. wi.f_unitprice AS fUnitprice,
  1899. w.f_amt AS fAmt,
  1900. wi.f_business_type AS fBusinessType,
  1901. CASE
  1902. wi.f_billtype
  1903. WHEN 'SJRK' THEN
  1904. '入库'
  1905. WHEN 'SJCK' THEN
  1906. '出库'
  1907. WHEN 'HQZY' THEN
  1908. '货转'
  1909. WHEN 'CKDB' THEN
  1910. '调拨'
  1911. WHEN 'HWTG' THEN
  1912. '货物通关'
  1913. WHEN 'KCZZ' THEN
  1914. '库存总账'
  1915. END AS fBilltype,
  1916. wi.f_product_name AS fGoodsid,
  1917. wi.f_marks AS fMarks,
  1918. w.f_remarks AS fRemarks
  1919. FROM t_fee_do w
  1920. LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
  1921. LEFT JOIN t_warehousebills t ON wi.f_pid = t.f_id
  1922. LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
  1923. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  1924. , (
  1925. SELECT @ii := 0
  1926. ) AS ii
  1927. WHERE dict.status = '0'
  1928. AND dict.dict_type = 'data_unitfees'
  1929. AND w.f_pid = #{fId}
  1930. </select>
  1931. <select id="selectDetailedList1" resultType="java.util.Map">
  1932. SELECT t.f_id AS fSrcpid,
  1933. t.f_corpid AS fCorpid,
  1934. c.f_name AS fName,
  1935. c1.f_name AS fFeesName,
  1936. w.f_mblno AS fMblno,
  1937. w.f_product_name AS fProductName,
  1938. w.f_marks AS fMarks,
  1939. w.f_dc AS fSrcdc,
  1940. w.f_amount AS fAmount,
  1941. w.f_stlamount AS fStlamount,
  1942. ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) AS nnfinished
  1943. FROM t_warehousebills t
  1944. LEFT JOIN sys_user u ON t.create_by = u.user_name
  1945. LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
  1946. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1947. LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
  1948. LEFT JOIN t_corps c1 ON w.f_corpid = c1.f_id
  1949. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1950. WHERE w.f_dc = #{fSrcdc}
  1951. AND t.f_review_date IS NOT NULL
  1952. AND w.f_corpid = #{fCorpIds}
  1953. AND t.f_corpid = #{fCorpId}
  1954. AND w.f_mblno = #{fMblno}
  1955. </select>
  1956. <!--网页版发票申请查询-->
  1957. <select id="webVersionInvoice" parameterType="TFee" resultType="java.util.Map">
  1958. SELECT
  1959. tf.f_id AS fId,/**费用主表id*/
  1960. tf.f_billno AS fBillno,/**费用申请编号*/
  1961. tf.f_ctrlcorpid AS fCtrlcorpid,/**货权方*/
  1962. tf.f_corpid AS fCorpid,/**结算单位*/
  1963. tc.f_name AS fCorpidName,/**结算单位中文名称*/
  1964. tf.t_mblno AS tMblno,/**提单号*/
  1965. tf.f_amtdr AS fAmtdr,/**应收合计*/
  1966. tf.f_amtcr AS fAmtcr,/**应付合计*/
  1967. tf.f_billtype AS fBilltype,/**业务类型*/
  1968. tf.f_billstatus AS fBillstatus,/**状态*/
  1969. CASE
  1970. WHEN tf.f_billstatus = '1' THEN
  1971. '新建'
  1972. WHEN tf.f_billstatus = '2' THEN
  1973. '暂存'
  1974. WHEN tf.f_billstatus = '3' THEN
  1975. '驳回'
  1976. WHEN tf.f_billstatus = '4' THEN
  1977. '提交'
  1978. WHEN tf.f_billstatus = '5' THEN
  1979. '审批中'
  1980. WHEN tf.f_billstatus = '6' THEN
  1981. '审批通过'
  1982. END AS fBillstatusName,
  1983. tf.f_remarks AS fRemarks,/**备注*/
  1984. tf.f_accbilldate AS fAccbilldate,/**结算日期*/
  1985. tf.create_by AS createBy,/**创建人*/
  1986. tf.create_time AS createTime,/**创建时间*/
  1987. tf.update_by AS updateBy,/**更新人*/
  1988. tf.update_time AS updateTime,/**更新时间*/
  1989. tf.invoice_no AS invoiceNo,/**发票号*/
  1990. tf.bank AS bank,/**银行*/
  1991. tf.water_bill_no AS waterBillNo,/**水单号*/
  1992. tf.f_system_type AS fSystemType,/**系统类型*/
  1993. tf.f_tracking_number AS fTrackingNumber,/**快递单号*/
  1994. tf.f_invoice_rise AS fInvoiceRise,/**发票抬头*/
  1995. tf.f_sign AS fSign,/**是否签收*/
  1996. tf.f_send_Time AS fSendTime,/**寄送时间*/
  1997. tf.charging_method AS chargingMethod,/**收费方式*/
  1998. pro.dict_label AS chargingMethodName /**收费方式中文名称*/
  1999. FROM
  2000. t_fee tf
  2001. LEFT JOIN t_corps tc ON tf.f_corpid = tc.f_id
  2002. LEFT JOIN sys_dict_data pro ON pro.dict_value = tf.charging_method
  2003. AND pro.dict_type = 'data_settlement_type'
  2004. WHERE tf.f_billtype = 'ApplyFP'
  2005. <if test="createBy != null and createBy != ''">and tf.create_by = #{createBy}</if>
  2006. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2007. and tf.create_time &gt;= #{timeInterval[0]}
  2008. </if>
  2009. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2010. and tf.create_time &lt;= #{timeInterval[1]}
  2011. </if>
  2012. <if test="invoiceNo != null and invoiceNo != ''">and tf.invoice_no like concat('%', #{invoiceNo}, '%')</if>
  2013. <if test="fInvoiceRise != null and fInvoiceRise != ''">and tf.f_invoice_rise like concat('%', #{fInvoiceRise},
  2014. '%')
  2015. </if>
  2016. <if test="fBillno != null and fBillno != ''">and tf.f_billno like concat('%', #{fBillno}, '%')</if>
  2017. <if test="fBillstatus != null and fBillstatus != '' and fBillstatus != 'null' ">and tf.f_billstatus = #{fBillstatus}</if>
  2018. ORDER BY tf.f_id desc
  2019. </select>
  2020. <!--凯和检索费用信息-->
  2021. <select id="FinancialFeesList" resultType="java.util.Map">
  2022. SELECT
  2023. w.f_id AS fSrcid,
  2024. t.f_id AS fSrcpid,
  2025. w.f_corpid AS fCorpid,
  2026. w.fName AS fName,
  2027. w.f_mblno AS fMblno,
  2028. w.f_bsdate AS fBsdate,
  2029. t.f_billtype AS fBilltype,
  2030. t.f_review_date AS fReviewDate,
  2031. w.f_feeid AS fFeeid,
  2032. w.src_bill_no AS srcBillNo,
  2033. w.f_marks AS fMarks,
  2034. f.f_name AS fFeeName,
  2035. w.f_dc AS fSrcdc,
  2036. w.f_qty AS fQty,
  2037. w.f_unitprice AS fUnitPrice,
  2038. w.f_amount AS fAmount,
  2039. w.f_feeUnitid AS fFeeUnitId,
  2040. pr.dict_label AS fFeeUnitName,
  2041. t.f_vslid AS fVslid,
  2042. t.f_voyid AS fVoyid,
  2043. tv.f_name AS fvslName,
  2044. ty.f_no AS fvoyName,
  2045. tre.f_name AS fLoadPortName,
  2046. ts.f_name As fDestPortName,
  2047. w.f_billstatus AS fBillStatus,
  2048. t.f_loadportid AS fLoadportid,
  2049. t.f_destportid AS fDestportid,
  2050. tn.f_name AS cntrName,
  2051. ti.f_cntrcount AS fCntrCount,
  2052. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHDZ" '>
  2053. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  2054. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  2055. </if>
  2056. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHSF" '>
  2057. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  2058. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
  2059. </if>
  2060. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHFF" '>
  2061. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  2062. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
  2063. </if>
  2064. CASE
  2065. WHEN w.f_dc = 'D' THEN '收'
  2066. WHEN w.f_dc = 'C' THEN '付'
  2067. END AS fSrcdcName,
  2068. CASE
  2069. WHEN w.f_billstatus = '1' THEN '新建'
  2070. WHEN w.f_billstatus = '2' THEN '暂存'
  2071. WHEN w.f_billstatus = '3' THEN '驳回'
  2072. WHEN w.f_billstatus = '4' THEN '提交'
  2073. WHEN w.f_billstatus = '5' THEN '审批中'
  2074. WHEN w.f_billstatus = '6' THEN '通过'
  2075. END AS fBillStatusName
  2076. FROM
  2077. t_warehousebills t
  2078. LEFT JOIN (
  2079. SELECT
  2080. f.f_id AS f_id,
  2081. f.f_pid AS f_pid,
  2082. f.f_lineno AS f_lineno,
  2083. f.f_corpid,
  2084. f.f_feeid,
  2085. f.f_feeUnitid,
  2086. f.f_qty,
  2087. f.f_unitprice,
  2088. f.f_amount,
  2089. f.f_currency,
  2090. f.f_exrate,
  2091. f.f_taxrate,
  2092. f.f_dc,
  2093. f.f_billstatus,
  2094. f.f_statement_no,
  2095. f.f_accamount,
  2096. f.f_accamount_date,
  2097. f.f_stlamount_no,
  2098. f.f_stlamount,
  2099. f.f_stlamount_date,
  2100. f.f_invnos,
  2101. f.f_invamount,
  2102. f.f_askamount,
  2103. f.f_chargedate,
  2104. f.f_status,
  2105. f.remark,
  2106. f.f_mblno,
  2107. f.f_product_name,
  2108. f.src_bill_no,
  2109. f.f_billing_days,
  2110. f.f_inventory_days,
  2111. f.f_marks,
  2112. f.f_billing_deadline,
  2113. f.f_originalbilldate,
  2114. f.f_billtype,
  2115. f.f_business_type,
  2116. f.f_bsdate,
  2117. c.f_id AS fId,
  2118. c.f_name AS fName
  2119. FROM
  2120. t_warehousebillsfees AS f
  2121. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  2122. ) w ON w.f_pid = t.f_id
  2123. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  2124. LEFT JOIN sys_dict_data pr ON pr.dict_value = w.f_feeUnitid
  2125. AND pr.dict_type = 'data_unitfees'
  2126. LEFT JOIN t_vessel tv ON t.f_vslid = tv.f_id
  2127. LEFT JOIN t_voyage ty ON t.f_voyid = ty.f_id
  2128. LEFT JOIN t_address tre ON tre.f_id = t.f_loadportid
  2129. LEFT JOIN t_address ts ON ts.f_id = t.f_destportid
  2130. LEFT JOIN t_warehousebills_cntr ti ON ti.f_pid = t.f_id
  2131. LEFT JOIN t_cntr tn ON tn.f_id = ti.f_cntrid
  2132. <where>
  2133. t.f_typeid = 1
  2134. and w.f_billstatus = 6
  2135. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
  2136. #{map.tWareHouseFees.fCorpid}
  2137. </if>
  2138. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  2139. and w.f_accamount_date IS NOT NULL
  2140. </if>
  2141. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  2142. and w.f_accamount_date IS NULL
  2143. </if>
  2144. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  2145. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  2146. </if>
  2147. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != ""'>
  2148. and w.f_dc = #{map.tWareHouseFees.fDc}
  2149. </if>
  2150. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  2151. </if>
  2152. <if test="map.tWareHouseFees.fVslid != null">and t.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  2153. <if test="map.tWareHouseFees.fVoyid != null">and t.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  2154. <if test="map.tWareHouseFees.fLoadportid != null ">and t.f_loadportid = #{map.tWareHouseFees.fLoadportid}
  2155. </if>
  2156. <if test="map.tWareHouseFees.fDestportid != null ">and t.f_destportid = #{map.tWareHouseFees.fDestportid}
  2157. </if>
  2158. <if test="map.tWareHouseFees.fFromDate != null ">and t.f_bsdate &gt;= #{map.tWareHouseFees.fFromDate}</if>
  2159. <if test="map.tWareHouseFees.fToDate != null ">and t.f_bsdate &lt;= #{map.tWareHouseFees.fToDate}</if>
  2160. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHDZ" '>
  2161. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  2162. </if>
  2163. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHSF" '>
  2164. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) > 0
  2165. </if>
  2166. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHFF" '>
  2167. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) > 0
  2168. </if>
  2169. GROUP BY w.f_id
  2170. </where>
  2171. </select>
  2172. <!--凯和查询财务主表数据-->
  2173. <select id="selectFinancialTFeeId" parameterType="TFee" resultType="com.ruoyi.finance.shipping.FinancialTFee">
  2174. SELECT
  2175. f.f_id AS fId,
  2176. f.f_billno AS srcBillNo,
  2177. f.f_ctrlcorpid AS fCtrlcorpid,
  2178. pro.dict_label AS chargingMethod,
  2179. f.invoice_no AS invoiceNo,
  2180. f.bank AS fBank,
  2181. f.water_bill_no AS waterBillNo,
  2182. f.f_corpid AS fCorpid,
  2183. c.f_name AS fCorpidName,
  2184. f.f_accbilldate AS fAccbilldate,
  2185. f.t_mblno AS tMblno,
  2186. f.f_amtdr AS fAmtdr,
  2187. f.f_amtcr AS fAmtcr,
  2188. f.f_billtype AS fBilltype,
  2189. f.f_system_type AS fSystemType,
  2190. f.f_billstatus AS fBillstatus,
  2191. CASE
  2192. WHEN f.f_billstatus = '1' THEN '新建'
  2193. WHEN f.f_billstatus = '2' THEN '暂存'
  2194. WHEN f.f_billstatus = '3' THEN '审批驳回'
  2195. WHEN f.f_billstatus = '4' THEN '提交审核'
  2196. WHEN f.f_billstatus = '5' THEN '审核中'
  2197. WHEN f.f_billstatus = '6' THEN '审核完成'
  2198. END
  2199. AS fBillstatusName,
  2200. f.f_remarks AS fRemarks,
  2201. f.create_by AS createBy,
  2202. tp.f_name AS createName,
  2203. f.create_time AS createTime,
  2204. f.update_by AS updateBy,
  2205. f.update_time AS updateTime,
  2206. tv.f_name AS vessel,
  2207. ty.f_no AS voyage,
  2208. tre.f_name AS loadportName,
  2209. ts.f_name AS destportName,
  2210. f.f_bank_number AS fBankNumber,
  2211. f.f_loadportid AS fLoadportid,
  2212. f.f_destportid AS fDestportid,
  2213. f.f_vslid AS fVslid,
  2214. f.f_voyid AS fVoyid,
  2215. f.f_from_date AS fFromDate,
  2216. f.f_to_date AS fToDate,
  2217. f.f_dc As fDc,
  2218. f.f_reconciliation AS fReconciliation,
  2219. f.bank AS bank,
  2220. CASE
  2221. WHEN f.f_dc = 'D' THEN
  2222. '收'
  2223. WHEN f.f_dc = 'C' THEN
  2224. '付'
  2225. END AS fSrcdcName
  2226. FROM
  2227. t_fee AS f
  2228. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  2229. left join sys_user u on f.create_by = u.user_name
  2230. left join sys_dept d on f.f_deptid = d.dept_id
  2231. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  2232. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  2233. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
  2234. LEFT JOIN t_vessel tv ON f.f_vslid = tv.f_id
  2235. LEFT JOIN t_voyage ty ON f.f_voyid = ty.f_id
  2236. LEFT JOIN t_address tre ON tre.f_id = f.f_loadportid
  2237. LEFT JOIN t_address ts ON ts.f_id = f.f_destportid
  2238. where
  2239. f.f_id = #{fId}
  2240. </select>
  2241. </mapper>