TFeeMapper.xml 85 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812
  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. </resultMap>
  42. <sql id="selectTFeeVo">
  43. select f_id,
  44. f_billno,
  45. f_ctrlcorpid,
  46. f_act_id,
  47. f_corpid,
  48. t_mblno,
  49. f_trans_act_id,
  50. f_amtdr,
  51. f_amtcr,
  52. f_billtype,
  53. f_billstatus,
  54. f_remarks,
  55. f_from_date,
  56. f_to_date,
  57. f_accbilldate,
  58. f_ref_no,
  59. del_flag,
  60. create_by,
  61. f_deptid,
  62. create_time,
  63. update_by,
  64. update_time,
  65. charging_method,
  66. invoice_no,
  67. bank,
  68. water_bill_no,
  69. f_system_type,
  70. f_tracking_number,
  71. f_invoice_rise,
  72. f_sign,
  73. f_send_Time,
  74. f_apply_money,
  75. f_account_id,
  76. f_make
  77. from t_fee
  78. </sql>
  79. <select id="selectTFeeList" parameterType="TFee" resultMap="TFeeResult">
  80. select
  81. ware.f_id,
  82. ware.f_billno,
  83. ware.f_ctrlcorpid,
  84. ware.f_act_id,
  85. ware.f_corpid,
  86. ware.t_mblno,
  87. ware.f_trans_act_id,
  88. ware.f_amtdr,
  89. ware.f_amtcr,
  90. ware.f_billtype,
  91. CASE
  92. WHEN ware.f_billstatus = '1' THEN '保存'
  93. WHEN ware.f_billstatus = '2' THEN '暂存'
  94. WHEN ware.f_billstatus = '3' THEN '审批驳回'
  95. WHEN ware.f_billstatus = '4' THEN '提交审核'
  96. WHEN ware.f_billstatus = '5' THEN '审核中'
  97. WHEN ware.f_billstatus = '6' THEN '审核完成'
  98. END
  99. AS f_billstatus,
  100. ware.f_remarks,
  101. ware.f_from_date,
  102. ware.f_to_date,
  103. ware.f_accbilldate,
  104. ware.f_ref_no,
  105. ware.del_flag,
  106. ware.create_by,
  107. ware.f_deptid,
  108. ware.create_time,
  109. ware.update_by,
  110. ware.update_time,
  111. pro.dict_label AS charging_method,
  112. ware.invoice_no,
  113. ware.bank,
  114. ware.water_bill_no,
  115. ware.f_system_type
  116. from
  117. t_fee ware
  118. left join sys_user u on ware.create_by = u.user_name
  119. left join sys_dept d on ware.f_deptid = d.dept_id
  120. LEFT JOIN sys_dict_data pro ON pro.dict_value = ware.charging_method and pro.dict_type = 'data_settlement_type'
  121. <where>
  122. <if test="fBillno != null and fBillno != ''">and ware.f_billno = #{fBillno}</if>
  123. <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
  124. <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
  125. <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
  126. <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
  127. <if test="tMblno != null and tMblno != ''">and t_mblno = #{tMblno}</if>
  128. <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
  129. <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
  130. <if test="fBilltype != null and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
  131. <if test="fBillstatus != null and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
  132. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%') </if>
  133. <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
  134. <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
  135. <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
  136. <if test="fRefNo != null and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
  137. <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
  138. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  139. and ware.f_accbilldate &gt;= #{timeInterval[0]}
  140. </if>
  141. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  142. and ware.f_accbilldate &lt;= #{timeInterval[1]}
  143. </if>
  144. <if test='amount != null and amount[0] != null and amount[0]!= ""'>
  145. and ware.f_amtdr &gt;= #{amount[0]}
  146. </if>
  147. <if test='amount != null and amount[1] != null and amount[1]!= ""'>
  148. and ware.f_amtdr &lt;= #{amount[1]}
  149. </if>
  150. <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
  151. <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
  152. <if test="bank != null ">and ware.bank = #{bank}</if>
  153. <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
  154. <if test="fSystemType != null and fSystemType != ''">and ware.f_system_type = #{fSystemType}</if>
  155. </where>
  156. ORDER BY ware.create_time desc
  157. ${params.dataScope}
  158. </select>
  159. <select id="selectTFeeList1" parameterType="TFee" resultType="Map">
  160. SELECT
  161. f.f_id AS fId,
  162. f.f_billno AS fBillno,
  163. f.f_ctrlcorpid AS fCtrlcorpid,
  164. pro.dict_label AS chargingMethod,
  165. f.invoice_no AS invoiceNo,
  166. f.bank,
  167. f.water_bill_no AS waterBillNo,
  168. f.f_corpid AS fCorpid,
  169. c.f_name AS fCorpidName,
  170. f.f_accbilldate AS fAccbilldate,
  171. f.t_mblno AS tMblno,
  172. f.f_amtdr AS fAmtdr,
  173. f.f_amtcr AS fAmtcr,
  174. f.f_billtype AS fBilltype,
  175. f.f_system_type AS fSystemType,
  176. CASE
  177. WHEN f.f_billstatus = '1' THEN '保存'
  178. WHEN f.f_billstatus = '2' THEN '暂存'
  179. WHEN f.f_billstatus = '3' THEN '审批驳回'
  180. WHEN f.f_billstatus = '4' THEN '提交审核'
  181. WHEN f.f_billstatus = '5' THEN '审核中'
  182. WHEN f.f_billstatus = '6' THEN '审核完成'
  183. END
  184. AS fBillstatus,
  185. f.f_remarks AS fRemarks,
  186. f.create_by AS createBy,
  187. tp.f_name AS createName,
  188. f.create_time createTime,
  189. f.update_by updateBy,
  190. f.update_time
  191. FROM
  192. t_fee AS f
  193. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  194. left join sys_user u on f.create_by = u.user_name
  195. left join sys_dept d on f.f_deptid = d.dept_id
  196. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  197. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  198. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
  199. <where>
  200. <if test="fId != null ">and f.f_id = #{fId}</if>
  201. <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
  202. <if test="fCtrlcorpid != null ">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
  203. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  204. <if test="tMblno != null and tMblno != ''">and f.t_mblno = #{tMblno}</if>
  205. <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
  206. <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
  207. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  208. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  209. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%') </if>
  210. <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
  211. <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
  212. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  213. and f.f_accbilldate &gt;= #{timeInterval[0]}
  214. </if>
  215. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  216. and f.f_accbilldate &lt;= #{timeInterval[1]}
  217. </if>
  218. <if test='money != null and money[0] != null and money[0]!= ""'>
  219. and f.f_amtdr &gt;= #{money[0]}
  220. </if>
  221. <if test='money != null and money[1] != null and money[1]!= ""'>
  222. and f.f_amtdr &lt;= #{money[1]}
  223. </if>
  224. <if test='amount != null and amount[0] != null and amount[0]!= ""'>
  225. and f.f_amtdr &gt;= #{amount[0]}
  226. </if>
  227. <if test='amount != null and amount[1] != null and amount[1]!= ""'>
  228. and f.f_amtdr &lt;= #{amount[1]}
  229. </if>
  230. <if test='applyTime != null and applyTime[0] != null and applyTime[0]!= ""'>
  231. and f.create_time &gt;= #{applyTime[0]}
  232. </if>
  233. <if test='applyTime != null and applyTime[1] != null and applyTime[1]!= ""'>
  234. and f.create_time &lt;= #{applyTime[1]}
  235. </if>
  236. <if test="chargingMethod != null ">and f.charging_method = #{chargingMethod}</if>
  237. <if test="invoiceNo != null ">and f.invoice_no = #{invoiceNo}</if>
  238. <if test="bank != null ">and f.bank = #{bank}</if>
  239. <if test="waterBillNo != null ">and f.water_bill_no = #{waterBillNo}</if>
  240. <if test="fSystemType != null and fSystemType != ''">and f.f_system_type = #{fSystemType}</if>
  241. <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
  242. </where>
  243. ORDER BY f.f_id desc
  244. ${params.dataScope}
  245. </select>
  246. <select id="selectTFeeById" parameterType="Long" resultMap="TFeeResult">
  247. <include refid="selectTFeeVo"/>
  248. where f_id = #{fId}
  249. </select>
  250. <select id="selectTFeeByIdNew" parameterType="Long" resultMap="TFeeResult">
  251. SELECT f.f_id,
  252. f.f_billno,
  253. f.f_ctrlcorpid,
  254. f.f_corpid,
  255. c.f_name AS fCorpidName,
  256. f.f_accbilldate,
  257. f.t_mblno,
  258. f.f_amtdr,
  259. f.f_amtcr,
  260. f.f_billtype,
  261. f.f_system_type,
  262. f.f_billstatus,
  263. f.f_remarks,
  264. f.create_by,
  265. tp.f_name AS createName,
  266. f.create_time,
  267. f.update_by,
  268. f.update_time,
  269. tn.f_taxrate AS fTaxrate,
  270. f.charging_method,
  271. f.invoice_no,
  272. f.bank,
  273. f.water_bill_no
  274. FROM t_fee AS f
  275. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  276. left join sys_user u on f.create_by = u.user_name
  277. left join sys_dept d on f.f_deptid = d.dept_id
  278. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  279. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  280. LEFT JOIN(SELECT ti.f_pid, ti.f_taxrate FROM t_fee_invoice ti LIMIT 1) tn ON tn.f_pid = f.f_id
  281. where f.f_id = #{fId}
  282. </select>
  283. <!--凯和确认账单查询-->
  284. <select id="webVersionTFee" parameterType="TFee" resultType="map">
  285. SELECT
  286. f.f_id AS fId,
  287. f.f_billno AS fBillno,
  288. f.f_ctrlcorpid AS fCtrlcorpid,
  289. c.f_name AS fCorpidName,
  290. f.f_accbilldate AS fAccbilldate,
  291. f.t_mblno AS tMblno,
  292. f.f_amtdr AS fAmtdr,
  293. f.f_amtcr AS fAmtcr,
  294. f.f_billtype AS filltype,
  295. f.f_remarks AS fRemarks,
  296. f.create_by AS createBy,
  297. tp.f_name AS createName,
  298. f.create_time AS createTime,
  299. f.update_by AS updateBy,
  300. f.update_time AS updateTime,
  301. tn.f_taxrate AS fTaxrate,
  302. f.charging_method AS chargingMethod,
  303. f.invoice_no AS invoiceNo,
  304. f.bank AS bank,
  305. f.water_bill_no AS waterBillNo,
  306. CASE
  307. WHEN f.f_billstatus = '1' THEN '保存'
  308. WHEN f.f_billstatus = '2' THEN '暂存'
  309. WHEN f.f_billstatus = '3' THEN '审批驳回'
  310. WHEN f.f_billstatus = '4' THEN '提交审核'
  311. WHEN f.f_billstatus = '5' THEN '审核中'
  312. WHEN f.f_billstatus = '6' THEN '审核完成'
  313. END
  314. AS fBillstatus
  315. FROM
  316. t_fee AS f
  317. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  318. left join sys_user u on f.create_by = u.user_name
  319. left join sys_dept d on f.f_deptid = d.dept_id
  320. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  321. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  322. LEFT JOIN(SELECT ti.f_pid,ti.f_taxrate FROM t_fee_invoice ti LIMIT 1) tn ON tn.f_pid = f.f_id
  323. <where>
  324. f.f_make = 0
  325. <if test="fId != null ">and f.f_id = #{fId}</if>
  326. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  327. <if test="createId != null ">and tp.f_id = #{createId}</if>
  328. <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
  329. <if test="fCtrlcorpid != null and fCtrlcorpid != ''">and f.f_ctrlcorpid like concat('%',
  330. #{fCtrlcorpid},'%')
  331. </if>
  332. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  333. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  334. <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
  335. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  336. and f.f_accbilldate &gt;= #{timeInterval[0]}
  337. </if>
  338. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  339. and f.f_accbilldate &lt;= #{timeInterval[1]}
  340. </if>
  341. </where>
  342. ORDER BY f.f_id desc
  343. </select>
  344. <insert id="insertTFee" parameterType="TFee" useGeneratedKeys="true" keyProperty="fId">
  345. insert into t_fee
  346. <trim prefix="(" suffix=")" suffixOverrides=",">
  347. <if test="fId != null">f_id,</if>
  348. <if test="fBillno != null">f_billno,</if>
  349. <if test="fCtrlcorpid != null">f_ctrlcorpid,</if>
  350. <if test="fActId != null">f_act_id,</if>
  351. <if test="fCorpid != null">f_corpid,</if>
  352. <if test="tMblno != null">t_mblno,</if>
  353. <if test="fTransActId != null">f_trans_act_id,</if>
  354. <if test="fAmtdr != null">f_amtdr,</if>
  355. <if test="fAmtcr != null">f_amtcr,</if>
  356. <if test="fBilltype != null and fBilltype != ''">f_billtype,</if>
  357. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus,</if>
  358. <if test="fRemarks != null">f_remarks,</if>
  359. <if test="fFromDate != null">f_from_date,</if>
  360. <if test="fToDate != null">f_to_date,</if>
  361. <if test="fAccbilldate != null">f_accbilldate,</if>
  362. <if test="fRefNo != null">f_ref_no,</if>
  363. <if test="delFlag != null">del_flag,</if>
  364. <if test="createBy != null">create_by,</if>
  365. <if test="fDeptid != null">f_deptid,</if>
  366. <if test="createTime != null">create_time,</if>
  367. <if test="updateBy != null">update_by,</if>
  368. <if test="updateTime != null">update_time,</if>
  369. <if test="chargingMethod != null">charging_method,</if>
  370. <if test="invoiceNo != null">invoice_no,</if>
  371. <if test="bank != null">bank,</if>
  372. <if test="waterBillNo != null">water_bill_no,</if>
  373. <if test="fSystemType != null">f_system_type,</if>
  374. <if test="fTrackingNumber != null">f_tracking_number,</if>
  375. <if test="fInvoiceRise != null">f_invoice_rise,</if>
  376. <if test="fSign != null">f_sign,</if>
  377. <if test="fSendTime != null">f_send_Time,</if>
  378. <if test="fApplyMoney != null">f_apply_money,</if>
  379. <if test="fAccountId != null">f_account_id,</if>
  380. <if test="fMake != null">f_make,</if>
  381. </trim>
  382. <trim prefix="values (" suffix=")" suffixOverrides=",">
  383. <if test="fId != null">#{fId},</if>
  384. <if test="fBillno != null">#{fBillno},</if>
  385. <if test="fCtrlcorpid != null">#{fCtrlcorpid},</if>
  386. <if test="fActId != null">#{fActId},</if>
  387. <if test="fCorpid != null">#{fCorpid},</if>
  388. <if test="tMblno != null">#{tMblno},</if>
  389. <if test="fTransActId != null">#{fTransActId},</if>
  390. <if test="fAmtdr != null">#{fAmtdr},</if>
  391. <if test="fAmtcr != null">#{fAmtcr},</if>
  392. <if test="fBilltype != null and fBilltype != ''">#{fBilltype},</if>
  393. <if test="fBillstatus != null and fBillstatus != ''">#{fBillstatus},</if>
  394. <if test="fRemarks != null">#{fRemarks},</if>
  395. <if test="fFromDate != null">#{fFromDate},</if>
  396. <if test="fToDate != null">#{fToDate},</if>
  397. <if test="fAccbilldate != null">#{fAccbilldate},</if>
  398. <if test="fRefNo != null">#{fRefNo},</if>
  399. <if test="delFlag != null">#{delFlag},</if>
  400. <if test="createBy != null">#{createBy},</if>
  401. <if test="fDeptid != null">#{fDeptid},</if>
  402. <if test="createTime != null">#{createTime},</if>
  403. <if test="updateBy != null">#{updateBy},</if>
  404. <if test="updateTime != null">#{updateTime},</if>
  405. <if test="chargingMethod != null">#{chargingMethod},</if>
  406. <if test="invoiceNo != null">#{invoiceNo},</if>
  407. <if test="bank != null">#{bank},</if>
  408. <if test="waterBillNo != null">#{waterBillNo},</if>
  409. <if test="fSystemType != null">#{fSystemType},</if>
  410. <if test="fTrackingNumber != null">#{fTrackingNumber},</if>
  411. <if test="fInvoiceRise != null">#{fInvoiceRise},</if>
  412. <if test="fSign != null">#{fSign},</if>
  413. <if test="fSendTime != null">#{fSendTime},</if>
  414. <if test="fApplyMoney != null">#{fApplyMoney},</if>
  415. <if test="fAccountId != null">#{fAccountId},</if>
  416. <if test="fMake != null">#{fMake},</if>
  417. </trim>
  418. </insert>
  419. <update id="updateTFee" parameterType="TFee">
  420. update t_fee
  421. <trim prefix="SET" suffixOverrides=",">
  422. <if test="fBillno != null">f_billno = #{fBillno},</if>
  423. <if test="fCtrlcorpid != null">f_ctrlcorpid = #{fCtrlcorpid},</if>
  424. <if test="fActId != null">f_act_id = #{fActId},</if>
  425. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  426. <if test="tMblno != null">t_mblno = #{tMblno},</if>
  427. <if test="fTransActId != null">f_trans_act_id = #{fTransActId},</if>
  428. <if test="fAmtdr != null">f_amtdr = #{fAmtdr},</if>
  429. <if test="fAmtcr != null">f_amtcr = #{fAmtcr},</if>
  430. <if test="fBilltype != null and fBilltype != ''">f_billtype = #{fBilltype},</if>
  431. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus = #{fBillstatus},</if>
  432. <if test="fRemarks != null">f_remarks = #{fRemarks},</if>
  433. <if test="fFromDate != null">f_from_date = #{fFromDate},</if>
  434. <if test="fToDate != null">f_to_date = #{fToDate},</if>
  435. <if test="fAccbilldate != null">f_accbilldate = #{fAccbilldate},</if>
  436. <if test="fRefNo != null">f_ref_no = #{fRefNo},</if>
  437. <if test="delFlag != null">del_flag = #{delFlag},</if>
  438. <if test="createBy != null">create_by = #{createBy},</if>
  439. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  440. <if test="createTime != null">create_time = #{createTime},</if>
  441. <if test="updateBy != null">update_by = #{updateBy},</if>
  442. <if test="updateTime != null">update_time = #{updateTime},</if>
  443. <if test="chargingMethod != null">charging_method = #{chargingMethod},</if>
  444. <if test="invoiceNo != null">invoice_no = #{invoiceNo},</if>
  445. <if test="bank != null">bank = #{bank},</if>
  446. <if test="waterBillNo != null">water_bill_no = #{waterBillNo},</if>
  447. <if test="fSystemType != null">f_system_type = #{fSystemType},</if>
  448. <if test="fTrackingNumber != null">f_tracking_number = #{fTrackingNumber},</if>
  449. <if test="fInvoiceRise != null">f_invoice_rise = #{fInvoiceRise},</if>
  450. <if test="fSign != null">f_sign = #{fSign},</if>
  451. <if test="fSendTime != null">f_send_Time = #{fSendTime},</if>
  452. <if test="fApplyMoney != null">f_apply_money = #{fApplyMoney},</if>
  453. <if test="fAccountId != null">f_account_id = #{fAccountId},</if>
  454. <if test="fMake != null">f_make = #{fMake},</if>
  455. </trim>
  456. where f_id = #{fId}
  457. </update>
  458. <delete id="deleteTFeeById" parameterType="Long">
  459. delete
  460. from t_fee
  461. where f_id = #{fId}
  462. </delete>
  463. <delete id="deleteTFeeByIds" parameterType="String">
  464. delete
  465. f.*,
  466. fd.* ,
  467. fi.*
  468. from
  469. t_fee f
  470. LEFT JOIN t_fee_do fd ON fd.f_pid = f.f_id
  471. LEFT JOIN t_fee_invoice fi ON fi.f_pid = f.f_id
  472. where f.f_id in
  473. <foreach item="fId" collection="array" open="(" separator="," close=")">
  474. #{fId}
  475. </foreach>
  476. </delete>
  477. <select id="warehouseBillsFeesList" resultType="java.util.Map">
  478. SELECT
  479. w.f_id AS fSrcid,
  480. t.f_id AS fSrcpid,
  481. t.f_corpid AS fCorpid,
  482. c.f_name AS fName,
  483. w.fId AS fId,
  484. w.fName AS fFeesName,
  485. t.f_bscorpno AS fBscorpno,
  486. w.f_mblno AS fMblno,
  487. w.f_product_name AS fProductName,
  488. w.f_bsdate AS fBsdate,
  489. t.f_billtype AS fBilltype,
  490. t.f_review_date AS fReviewDate,
  491. w.f_feeid AS fFeeid,
  492. w.src_bill_no AS srcBillNo,
  493. w.f_marks AS fMarks,
  494. w.f_chargedate AS fChargedate,
  495. w.f_billing_days AS fBillingDays,
  496. w.f_billing_deadline AS fBillingDeadline,
  497. w.f_inventory_days AS fInventoryDays,
  498. w.f_originalbilldate AS fOriginalbilldate,
  499. f.f_name AS fFeeName,
  500. w.f_dc AS fSrcdc,
  501. CASE
  502. WHEN w.f_dc = 'D' THEN '收'
  503. WHEN w.f_dc = 'C' THEN '付'
  504. END AS fSrcdcName,
  505. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  506. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
  507. dictIn.dict_label AS fBusinessType
  508. FROM
  509. t_warehousebills t
  510. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  511. LEFT JOIN (
  512. SELECT
  513. f.f_id AS f_id,
  514. f.f_pid AS f_pid,
  515. f.f_lineno AS f_lineno,
  516. f.f_corpid,
  517. f.f_feeid,
  518. f.f_feeUnitid,
  519. f.f_qty,
  520. f.f_unitprice,
  521. f.f_amount,
  522. f.f_currency,
  523. f.f_exrate,
  524. f.f_taxrate,
  525. f.f_dc,
  526. f.f_billstatus,
  527. f.f_statement_no,
  528. f.f_accamount,
  529. f.f_accamount_date,
  530. f.f_stlamount_no,
  531. f.f_stlamount,
  532. f.f_stlamount_date,
  533. f.f_invnos,
  534. f.f_invamount,
  535. f.f_askamount,
  536. f.f_chargedate,
  537. f.f_status,
  538. f.remark,
  539. f.f_mblno,
  540. f.f_product_name,
  541. f.src_bill_no,
  542. f.f_billing_days,
  543. f.f_inventory_days,
  544. f.f_marks,
  545. f.f_billing_deadline,
  546. f.f_originalbilldate,
  547. f.f_billtype,
  548. f.f_business_type,
  549. f.f_bsdate,
  550. c.f_id AS fId,
  551. c.f_name AS fName
  552. FROM
  553. t_warehousebillsfees AS f
  554. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  555. ) w ON w.f_pid = t.f_id
  556. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  557. LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = w.f_business_type
  558. <where>
  559. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  560. #{map.tWareHouseFees.fCorpid}
  561. </if>
  562. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  563. #{map.tWareHouseFees.fToCorpid}
  564. </if>
  565. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  566. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  567. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  568. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  569. </if>
  570. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  571. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  572. </if>
  573. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  574. and w.f_accamount_date IS NOT NULL
  575. </if>
  576. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  577. and w.f_accamount_date IS NULL
  578. </if>
  579. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  580. and w.f_dc = #{map.tWareHouseFees.fDc}
  581. </if>
  582. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  583. and w.f_dc = #{map.tWareHouseFees.fDc}
  584. </if>
  585. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  586. and w.f_feeid in
  587. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  588. separator=",">
  589. #{id}
  590. </foreach>
  591. </if>
  592. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  593. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  594. </if>
  595. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  596. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  597. </if>
  598. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  599. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  600. </if>
  601. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  602. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  603. </if>
  604. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  605. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  606. </if>
  607. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  608. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  609. </if>
  610. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  611. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  612. AND dictIn.dict_type = 'st_in_type'
  613. AND dictIn.status = '0'
  614. </if>
  615. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  616. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  617. AND dictIn.dict_type = 'st_out_type'
  618. AND dictIn.status = '0'
  619. </if>
  620. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  621. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  622. AND dictIn.dict_type = 'st_trans_type'
  623. AND dictIn.status = '0'
  624. </if>
  625. <if test="map.tWareHouseFees.fBilltype == null ">
  626. AND dictIn.dict_type in ('st_in_type','st_out_type','st_trans_type')
  627. AND dictIn.status = '0'
  628. </if>
  629. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
  630. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  631. </if>
  632. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  633. and w.f_business_type in
  634. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  635. #{id}
  636. </foreach>
  637. </if>
  638. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  639. and w.f_id in
  640. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  641. separator=",">
  642. #{id}
  643. </foreach>
  644. </if>
  645. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  646. and t.f_id in
  647. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  648. separator=",">
  649. #{id}
  650. </foreach>
  651. </if>
  652. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  653. </if>
  654. and t.f_review_date IS NOT NULL
  655. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) > 0
  656. GROUP BY w.f_id
  657. </where>
  658. </select>
  659. <select id="warehouseApplyFPFeesList" resultType="java.util.Map">
  660. SELECT
  661. w.f_id AS fSrcid,
  662. t.f_id AS fSrcpid,
  663. t.f_corpid AS fCorpid,
  664. c.f_name AS fName,
  665. w.fId AS fId,
  666. w.fName AS fFeesName,
  667. t.f_bscorpno AS fBscorpno,
  668. w.f_mblno AS fMblno,
  669. w.f_product_name AS fProductName,
  670. w.f_bsdate AS fBsdate,
  671. t.f_billtype AS fBilltype,
  672. t.f_review_date AS fReviewDate,
  673. w.f_feeid AS fFeeid,
  674. w.src_bill_no AS srcBillNo,
  675. w.f_marks AS fMarks,
  676. w.f_chargedate AS fChargedate,
  677. w.f_billing_days AS fBillingDays,
  678. w.f_billing_deadline AS fBillingDeadline,
  679. w.f_inventory_days AS fInventoryDays,
  680. w.f_originalbilldate AS fOriginalbilldate,
  681. f.f_name AS fFeeName,
  682. w.f_dc AS fSrcdc,
  683. CASE
  684. WHEN w.f_dc = 'D' THEN '收'
  685. WHEN w.f_dc = 'C' THEN '付'
  686. END AS fSrcdcName,
  687. ifnull( w.f_amount, 0 ) - ifnull( w.f_askamount, 0 ) AS fAmtdr,
  688. ifnull( w.f_amount, 0 ) - ifnull( w.f_askamount, 0 ) AS fAmt,
  689. dict.dict_label AS fFeeunitid,
  690. w.f_qty AS fQty,
  691. w.f_unitprice AS fUnitprice,
  692. w.f_currency AS fCurreny,
  693. w.f_taxrate AS fTaxrate,
  694. w.remark AS remark,
  695. tv.f_name AS boatName,
  696. ty.f_no AS voyageName,
  697. w.create_time createTime,
  698. w.businessName,
  699. t.f_loadportid AS fLoadportid,
  700. t.f_destportid AS fDestportid
  701. FROM
  702. t_warehousebills t
  703. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  704. LEFT JOIN (
  705. SELECT
  706. f.f_id AS f_id,
  707. f.f_pid AS f_pid,
  708. f.f_lineno AS f_lineno,
  709. f.f_corpid,
  710. f.f_feeid,
  711. f.f_feeUnitid,
  712. f.f_qty,
  713. f.f_unitprice,
  714. f.f_amount,
  715. f.f_currency,
  716. f.f_exrate,
  717. f.f_taxrate,
  718. f.f_dc,
  719. f.f_billstatus,
  720. f.f_statement_no,
  721. f.f_accamount,
  722. f.f_accamount_date,
  723. f.f_stlamount_no,
  724. f.f_stlamount,
  725. f.f_stlamount_date,
  726. f.f_invnos,
  727. f.f_invamount,
  728. f.f_askamount,
  729. f.f_chargedate,
  730. f.f_status,
  731. f.remark,
  732. f.f_mblno,
  733. f.f_product_name,
  734. f.src_bill_no,
  735. f.f_billing_days,
  736. f.f_inventory_days,
  737. f.f_marks,
  738. f.f_billing_deadline,
  739. f.f_originalbilldate,
  740. f.f_billtype,
  741. f.f_business_type,
  742. pro.dict_label businessName,
  743. f.f_bsdate,
  744. c.f_id AS fId,
  745. c.f_name AS fName,f.create_time
  746. FROM
  747. t_warehousebillsfees AS f
  748. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  749. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type
  750. ) w ON w.f_pid = t.f_id
  751. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  752. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  753. LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
  754. LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
  755. <where>
  756. dict.status = '0'
  757. AND dict.dict_type = 'data_unitfees'
  758. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  759. #{map.tWareHouseFees.fCorpid}
  760. </if>
  761. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  762. #{map.tWareHouseFees.fToCorpid}
  763. </if>
  764. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  765. <if test="map.tWareHouseFees.fLoadportid != null ">and t.f_loadportid = #{map.tWareHouseFees.fLoadportid}
  766. </if>
  767. <if test="map.tWareHouseFees.fDestportid != null ">and t.f_destportid = #{map.tWareHouseFees.fDestportid}
  768. </if>
  769. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  770. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  771. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  772. </if>
  773. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  774. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  775. </if>
  776. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  777. and w.f_accamount_date IS NOT NULL
  778. </if>
  779. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  780. and w.f_accamount_date IS NULL
  781. </if>
  782. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  783. and w.f_dc = #{map.tWareHouseFees.fDc}
  784. </if>
  785. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  786. and w.f_dc = #{map.tWareHouseFees.fDc}
  787. </if>
  788. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  789. and w.f_feeid in
  790. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  791. separator=",">
  792. #{id}
  793. </foreach>
  794. </if>
  795. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  796. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  797. </if>
  798. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  799. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  800. </if>
  801. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
  802. and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
  803. </if>
  804. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
  805. and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
  806. </if>
  807. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  808. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  809. </if>
  810. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  811. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  812. </if>
  813. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  814. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  815. </if>
  816. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  817. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  818. </if>
  819. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  820. and w.f_business_type in
  821. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  822. #{id}
  823. </foreach>
  824. </if>
  825. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  826. and w.f_id in
  827. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  828. separator=",">
  829. #{id}
  830. </foreach>
  831. </if>
  832. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  833. and t.f_id in
  834. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  835. separator=",">
  836. #{id}
  837. </foreach>
  838. </if>
  839. <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  840. <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  841. <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
  842. #{map.tWareHouseFees.boatName}
  843. </if>
  844. <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no like
  845. concat('%', #{map.tWareHouseFees.voyageName}, '%')
  846. </if>
  847. <if test="map.tWareHouseFees.fName != null and map.tWareHouseFees.fName != ''">and c.f_name like
  848. concat('%', #{map.tWareHouseFees.fName}, '%')
  849. </if>
  850. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  851. </if>
  852. and t.f_review_date IS NOT NULL
  853. and ifnull(w.f_amount, 0) - ifnull(w.f_askamount, 0) > 0
  854. GROUP BY w.f_id
  855. </where>
  856. </select>
  857. <select id="warehouseInvoiceFPFeesList" resultType="java.util.Map">
  858. SELECT
  859. w.f_id AS fSrcid,
  860. t.f_id AS fSrcpid,
  861. t.f_corpid AS fCorpid,
  862. c.f_name AS fName,
  863. w.fId AS fId,
  864. w.fName AS fFeesName,
  865. t.f_bscorpno AS fBscorpno,
  866. w.f_mblno AS fMblno,
  867. w.f_product_name AS fProductName,
  868. w.f_bsdate AS fBsdate,
  869. t.f_billtype AS fBilltype,
  870. t.f_review_date AS fReviewDate,
  871. w.f_feeid AS fFeeid,
  872. w.src_bill_no AS srcBillNo,
  873. w.f_marks AS fMarks,
  874. w.f_chargedate AS fChargedate,
  875. w.f_billing_days AS fBillingDays,
  876. w.f_billing_deadline AS fBillingDeadline,
  877. w.f_inventory_days AS fInventoryDays,
  878. w.f_originalbilldate AS fOriginalbilldate,
  879. f.f_name AS fFeeName,
  880. w.f_dc AS fSrcdc,
  881. CASE
  882. WHEN w.f_dc = 'D' THEN '收'
  883. WHEN w.f_dc = 'C' THEN '付'
  884. END AS fSrcdcName,
  885. ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmtdr,
  886. ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmt,
  887. dict.dict_label AS fFeeunitid,
  888. w.f_qty AS fQty,
  889. w.f_unitprice AS fUnitprice,
  890. w.f_currency AS fCurreny,
  891. w.f_taxrate AS fTaxrate,
  892. w.remark AS remark,
  893. tv.f_name AS boatName,
  894. ty.f_no AS voyageName,
  895. w.create_time createTime,
  896. w.businessName
  897. FROM
  898. t_warehousebills t
  899. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  900. LEFT JOIN (
  901. SELECT
  902. f.f_id AS f_id,
  903. f.f_pid AS f_pid,
  904. f.f_lineno AS f_lineno,
  905. f.f_corpid,
  906. f.f_feeid,
  907. f.f_feeUnitid,
  908. f.f_qty,
  909. f.f_unitprice,
  910. f.f_amount,
  911. f.f_currency,
  912. f.f_exrate,
  913. f.f_taxrate,
  914. f.f_dc,
  915. f.f_billstatus,
  916. f.f_statement_no,
  917. f.f_accamount,
  918. f.f_accamount_date,
  919. f.f_stlamount_no,
  920. f.f_stlamount,
  921. f.f_stlamount_date,
  922. f.f_invnos,
  923. f.f_invamount,
  924. f.f_askamount,
  925. f.f_chargedate,
  926. f.f_status,
  927. f.remark,
  928. f.f_mblno,
  929. f.f_product_name,
  930. f.src_bill_no,
  931. f.f_billing_days,
  932. f.f_inventory_days,
  933. f.f_marks,
  934. f.f_billing_deadline,
  935. f.f_originalbilldate,
  936. f.f_billtype,
  937. f.f_business_type,
  938. pro.dict_label businessName,
  939. f.f_bsdate,
  940. c.f_id AS fId,
  941. c.f_name AS fName,f.create_time
  942. FROM
  943. t_warehousebillsfees AS f
  944. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  945. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type
  946. ) w ON w.f_pid = t.f_id
  947. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  948. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  949. LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
  950. LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
  951. <where>
  952. dict.status = '0'
  953. AND dict.dict_type = 'data_unitfees'
  954. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  955. #{map.tWareHouseFees.fCorpid}
  956. </if>
  957. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  958. #{map.tWareHouseFees.fToCorpid}
  959. </if>
  960. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  961. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  962. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  963. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  964. </if>
  965. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  966. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  967. </if>
  968. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  969. and w.f_accamount_date IS NOT NULL
  970. </if>
  971. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  972. and w.f_accamount_date IS NULL
  973. </if>
  974. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  975. and w.f_dc = #{map.tWareHouseFees.fDc}
  976. </if>
  977. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  978. and w.f_dc = #{map.tWareHouseFees.fDc}
  979. </if>
  980. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  981. and w.f_feeid in
  982. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  983. separator=",">
  984. #{id}
  985. </foreach>
  986. </if>
  987. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  988. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  989. </if>
  990. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  991. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  992. </if>
  993. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
  994. and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
  995. </if>
  996. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
  997. and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
  998. </if>
  999. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1000. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1001. </if>
  1002. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1003. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1004. </if>
  1005. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1006. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1007. </if>
  1008. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1009. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1010. </if>
  1011. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1012. and w.f_business_type in
  1013. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1014. #{id}
  1015. </foreach>
  1016. </if>
  1017. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  1018. and w.f_id in
  1019. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  1020. separator=",">
  1021. #{id}
  1022. </foreach>
  1023. </if>
  1024. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  1025. and t.f_id in
  1026. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  1027. separator=",">
  1028. #{id}
  1029. </foreach>
  1030. </if>
  1031. <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  1032. <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  1033. <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
  1034. #{map.tWareHouseFees.boatName}
  1035. </if>
  1036. <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no =
  1037. #{map.tWareHouseFees.voyageName}
  1038. </if>
  1039. <if test="map.tWareHouseFees.fName != null and map.tWareHouseFees.fName != ''">and c.f_name = like
  1040. concat('%', #{map.tWareHouseFees.fName}, '%')
  1041. </if>
  1042. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1043. </if>
  1044. and t.f_review_date IS NOT NULL
  1045. and ifnull(w.f_amount, 0) - ifnull(w.f_invamount, 0) > 0
  1046. GROUP BY w.f_id
  1047. </where>
  1048. </select>
  1049. <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
  1050. SELECT
  1051. w.f_id AS fSrcid,
  1052. t.f_id AS fSrcpid,
  1053. t.f_corpid AS fCorpid,
  1054. c.f_name AS fName,
  1055. w.fName AS fFeesName,
  1056. t.f_bscorpno AS fBscorpno,
  1057. w.f_mblno AS fMblno,
  1058. w.f_product_name AS fProductName,
  1059. w.f_bsdate AS fBsdate,
  1060. t.f_billtype AS fBilltype,
  1061. t.f_review_date AS fReviewDate,
  1062. w.f_marks AS fMarks,
  1063. w.f_feeid AS fFeeid,
  1064. w.f_billtype AS fBilltype,
  1065. w.f_chargedate AS fChargedate,
  1066. w.f_originalbilldate AS fOriginalbilldate,
  1067. w.f_billing_deadline AS fBillingDeadline,
  1068. w.f_billing_days AS fBillingDays,
  1069. w.f_inventory_days AS fInventoryDays,
  1070. f.f_name AS fFeeName,
  1071. w.f_dc AS fSrcdc,
  1072. CASE
  1073. WHEN w.f_dc = 'D' THEN '收'
  1074. WHEN w.f_dc = 'C' THEN '付'
  1075. END AS fSrcdcName,
  1076. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  1077. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  1078. dict.dict_label AS fFeeunitid,
  1079. w.f_qty AS fQty ,
  1080. w.f_unitprice AS fUnitprice ,
  1081. dictIn.dict_label AS fBusinessType
  1082. FROM
  1083. t_warehousebills t
  1084. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1085. LEFT JOIN (
  1086. SELECT
  1087. f.f_id AS f_id,
  1088. f.f_pid AS f_pid,
  1089. f.f_lineno AS f_lineno,
  1090. f.f_corpid,
  1091. f.f_feeid,
  1092. f.f_feeUnitid,
  1093. f.f_qty,
  1094. f.f_unitprice,
  1095. f.f_amount,
  1096. f.f_currency,
  1097. f.f_exrate,
  1098. f.f_taxrate,
  1099. f.f_dc,
  1100. f.f_billstatus,
  1101. f.f_statement_no,
  1102. f.f_accamount,
  1103. f.f_accamount_date,
  1104. f.f_stlamount_no,
  1105. f.f_stlamount,
  1106. f.f_stlamount_date,
  1107. f.f_invnos,
  1108. f.f_invamount,
  1109. f.f_askamount,
  1110. f.f_status,
  1111. f.remark,
  1112. f.f_inventory_days,
  1113. f.f_billing_days,
  1114. f.f_billing_deadline,
  1115. f.f_originalbilldate,
  1116. f.f_mblno,
  1117. f.f_product_name,
  1118. f.f_chargedate,
  1119. f.src_bill_no,
  1120. f.f_billtype,
  1121. f.f_marks,
  1122. f.f_business_type,
  1123. f.f_bsdate,
  1124. c.f_id AS fId,
  1125. c.f_name AS fName
  1126. FROM
  1127. t_warehousebillsfees AS f
  1128. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  1129. ) w ON w.f_pid = t.f_id
  1130. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1131. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1132. LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = w.f_business_type
  1133. <where>
  1134. dict.status = '0'
  1135. AND dict.dict_type = 'data_unitfees'
  1136. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  1137. #{map.tWareHouseFees.fCorpid}
  1138. </if>
  1139. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1140. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1141. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1142. #{map.tWareHouseFees.fToCorpid}
  1143. </if>
  1144. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1145. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1146. </if>
  1147. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1148. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1149. </if>
  1150. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1151. and w.f_accamount_date IS NOT NULL
  1152. </if>
  1153. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1154. and w.f_accamount_date IS NULL
  1155. </if>
  1156. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1157. and w.f_dc = #{map.tWareHouseFees.fDc}
  1158. </if>
  1159. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1160. and w.f_dc = #{map.tWareHouseFees.fDc}
  1161. </if>
  1162. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1163. and w.f_feeid in
  1164. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1165. separator=",">
  1166. #{id}
  1167. </foreach>
  1168. </if>
  1169. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1170. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1171. </if>
  1172. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1173. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1174. </if>
  1175. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1176. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1177. </if>
  1178. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1179. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1180. </if>
  1181. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1182. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1183. </if>
  1184. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1185. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1186. </if>
  1187. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  1188. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1189. AND dictIn.dict_type = 'st_in_type'
  1190. AND dictIn.status = '0'
  1191. </if>
  1192. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  1193. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1194. AND dictIn.dict_type = 'st_out_type'
  1195. AND dictIn.status = '0'
  1196. </if>
  1197. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  1198. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1199. AND dictIn.dict_type = 'st_trans_type'
  1200. AND dictIn.status = '0'
  1201. </if>
  1202. <if test="map.tWareHouseFees.fBilltype == null ">
  1203. AND dictIn.dict_type in ('st_in_type','st_out_type','st_trans_type')
  1204. AND dictIn.status = '0'
  1205. </if>
  1206. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
  1207. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1208. </if>
  1209. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1210. and w.f_business_type in
  1211. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1212. #{id}
  1213. </foreach>
  1214. </if>
  1215. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  1216. and w.f_id in
  1217. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  1218. separator=",">
  1219. #{id}
  1220. </foreach>
  1221. </if>
  1222. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  1223. and t.f_id in
  1224. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  1225. separator=",">
  1226. #{id}
  1227. </foreach>
  1228. </if>
  1229. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1230. </if>
  1231. <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
  1232. and t.create_by = #{map.tWareHouseFees.createBy}
  1233. </if>
  1234. and t.f_review_date IS NOT NULL
  1235. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  1236. GROUP BY w.f_id
  1237. </where>
  1238. </select>
  1239. <select id="warehouseBillsKHFeesListAccamount" resultType="java.util.Map">
  1240. SELECT
  1241. w.f_id AS fSrcid,
  1242. t.f_id AS fSrcpid,
  1243. t.f_corpid AS fCorpid,
  1244. t.f_billno fBillno,
  1245. c.f_name AS fName,
  1246. w.fName AS fFeesName,
  1247. t.f_bscorpno AS fBscorpno,
  1248. w.f_mblno AS fMblno,
  1249. w.f_product_name AS fProductName,
  1250. w.f_bsdate AS fBsdate,
  1251. t.f_billtype AS tfBilltype,
  1252. t.f_review_date AS fReviewDate,
  1253. w.f_marks AS fMarks,
  1254. w.f_feeid AS fFeeid,
  1255. w.f_billtype AS wfBilltype,
  1256. w.f_chargedate AS fChargedate,
  1257. w.f_originalbilldate AS fOriginalbilldate,
  1258. w.f_billing_deadline AS fBillingDeadline,
  1259. w.f_billing_days AS fBillingDays,
  1260. w.f_inventory_days AS fInventoryDays,
  1261. f.f_name AS fFeeName,
  1262. w.f_dc AS fSrcdc,
  1263. CASE
  1264. WHEN w.f_dc = 'D' THEN '收'
  1265. WHEN w.f_dc = 'C' THEN '付'
  1266. END AS fSrcdcName,
  1267. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  1268. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  1269. dict.dict_label AS fFeeunitid,
  1270. w.f_qty AS fQty,
  1271. w.f_unitprice AS fUnitprice,
  1272. w.f_currency AS fCurreny,
  1273. w.f_taxrate AS fTaxrate,
  1274. w.remark AS remark,
  1275. tv.f_name AS boatName,
  1276. ty.f_no AS voyageName,
  1277. w.create_time createTime,
  1278. w.businessName
  1279. FROM
  1280. t_warehousebills t
  1281. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1282. LEFT JOIN (
  1283. SELECT
  1284. f.f_id AS f_id,
  1285. f.f_pid AS f_pid,
  1286. f.f_lineno AS f_lineno,
  1287. f.f_corpid,
  1288. f.f_feeid,
  1289. f.f_feeUnitid,
  1290. f.f_qty,
  1291. f.f_unitprice,
  1292. f.f_amount,
  1293. f.f_currency,
  1294. f.f_exrate,
  1295. f.f_taxrate,
  1296. f.f_dc,
  1297. f.f_billstatus,
  1298. f.f_statement_no,
  1299. f.f_accamount,
  1300. f.f_accamount_date,
  1301. f.f_stlamount_no,
  1302. f.f_stlamount,
  1303. f.f_stlamount_date,
  1304. f.f_invnos,
  1305. f.f_invamount,
  1306. f.f_askamount,
  1307. f.f_status,
  1308. f.remark,
  1309. f.f_inventory_days,
  1310. f.f_billing_days,
  1311. f.f_billing_deadline,
  1312. f.f_originalbilldate,
  1313. f.f_mblno,
  1314. f.f_product_name,
  1315. f.f_chargedate,
  1316. f.src_bill_no,
  1317. f.f_billtype,
  1318. f.f_marks,
  1319. f.f_business_type,
  1320. pro.dict_label businessName,
  1321. f.f_bsdate,
  1322. c.f_id AS fId,
  1323. c.f_name AS fName,
  1324. f.create_time
  1325. FROM
  1326. t_warehousebillsfees AS f
  1327. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  1328. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type and pro.dict_type = 'data_billType'
  1329. ) w ON w.f_pid = t.f_id
  1330. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1331. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1332. LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
  1333. LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
  1334. <where>
  1335. dict.status = '0'
  1336. AND dict.dict_type = 'data_unitfees'
  1337. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  1338. #{map.tWareHouseFees.fToCorpid}
  1339. </if>
  1340. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1341. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1342. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1343. #{map.tWareHouseFees.fCorpid}
  1344. </if>
  1345. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1346. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1347. </if>
  1348. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1349. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1350. </if>
  1351. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1352. and w.f_accamount_date IS NOT NULL
  1353. </if>
  1354. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1355. and w.f_accamount_date IS NULL
  1356. </if>
  1357. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1358. and w.f_dc = #{map.tWareHouseFees.fDc}
  1359. </if>
  1360. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1361. and w.f_dc = #{map.tWareHouseFees.fDc}
  1362. </if>
  1363. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1364. and w.f_feeid in
  1365. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1366. separator=",">
  1367. #{id}
  1368. </foreach>
  1369. </if>
  1370. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1371. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1372. </if>
  1373. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1374. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1375. </if>
  1376. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
  1377. and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
  1378. </if>
  1379. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
  1380. and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
  1381. </if>
  1382. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1383. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1384. </if>
  1385. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1386. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1387. </if>
  1388. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1389. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1390. </if>
  1391. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1392. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1393. </if>
  1394. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1395. and w.f_business_type in
  1396. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1397. #{id}
  1398. </foreach>
  1399. </if>
  1400. <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  1401. <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  1402. <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
  1403. #{map.tWareHouseFees.boatName}
  1404. </if>
  1405. <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no =
  1406. #{map.tWareHouseFees.voyageName}
  1407. </if>
  1408. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1409. </if>
  1410. and t.f_review_date IS NOT NULL
  1411. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  1412. GROUP BY w.f_id
  1413. </where>
  1414. </select>
  1415. <select id="warehouseBillsFeesList1" resultType="java.util.Map">
  1416. SELECT
  1417. w.f_id AS fSrcid,
  1418. t.f_id AS fSrcpid,
  1419. t.f_corpid AS fCorpid,
  1420. c.f_name AS fName,
  1421. w.f_corpid AS fCorpids,
  1422. c1.f_name AS fFeesName,
  1423. w.f_mblno AS fMblno,
  1424. w.f_product_name AS fProductName,
  1425. w.f_marks AS fMarks,
  1426. t.f_billtype AS fBilltype,
  1427. t.f_review_date AS fReviewDate,
  1428. w.f_dc AS fSrcdc,
  1429. SUM(w.f_amount) AS fAmount,
  1430. SUM(w.f_stlamount) AS fStlamount,
  1431. ifnull(SUM( w.f_amount ) , 0 ) - ifnull( SUM( w.f_stlamount ) , 0 ) AS nnfinished
  1432. FROM
  1433. t_warehousebills t
  1434. left join sys_user u on t.create_by = u.user_name
  1435. left join sys_dept d on t.f_bsdeptid = d.dept_id
  1436. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1437. LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
  1438. LEFT JOIN t_corps c1 ON w.f_corpid = c1.f_id
  1439. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1440. <where>
  1441. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
  1442. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
  1443. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  1444. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
  1445. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
  1446. #{fProductName}, '%')
  1447. </if>
  1448. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
  1449. and w.f_billstatus != 6
  1450. </if>
  1451. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  1452. and w.f_billstatus = 6
  1453. </if>
  1454. <if test='fDc != null and fDc != "" and fDc == "D" '>
  1455. and w.f_dc = #{fDc}
  1456. </if>
  1457. <if test='fDc != null and fDc != "" and fDc == "C" '>
  1458. and w.f_dc = #{fDc}
  1459. </if>
  1460. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  1461. and t.f_review_date &gt;= #{timeExamine[0]}
  1462. </if>
  1463. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  1464. and t.f_review_date &lt;= #{timeExamine[1]}
  1465. </if>
  1466. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  1467. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  1468. </if>
  1469. and t.f_review_date IS NOT NULL
  1470. ${params.dataScope}
  1471. GROUP BY
  1472. w.f_pid,
  1473. w.f_dc,
  1474. w.f_corpid
  1475. </where>
  1476. </select>
  1477. <select id="selectTWarehousebillsItemsList"
  1478. resultType="com.ruoyi.warehouseBusiness.excel.TWareHouseExcelItem">
  1479. SELECT (@ii := @ii + 1) AS fId,
  1480. wi.f_mblno AS fMblno,
  1481. wi.f_bsdate AS fBsdate,
  1482. f.f_name AS fFeeid,
  1483. CASE
  1484. WHEN w.f_srcdc = 'D' THEN
  1485. '收'
  1486. WHEN w.f_srcdc = 'C' THEN
  1487. '付'
  1488. END AS fSrcdc,
  1489. w.f_amtdr AS fAmtdr,
  1490. dict.dict_label AS fFeeunitid,
  1491. wi.f_qty AS fBillingQty,
  1492. wi.f_unitprice AS fUnitprice,
  1493. w.f_amt AS fAmt,
  1494. wi.f_business_type AS fBusinessType,
  1495. CASE
  1496. wi.f_billtype
  1497. WHEN 'SJRK' THEN
  1498. '入库'
  1499. WHEN 'SJCK' THEN
  1500. '出库'
  1501. WHEN 'HQZY' THEN
  1502. '货转'
  1503. WHEN 'CKDB' THEN
  1504. '调拨'
  1505. WHEN 'HWTG' THEN
  1506. '货物通关'
  1507. WHEN 'KCZZ' THEN
  1508. '库存总账'
  1509. END AS fBilltype,
  1510. wi.f_product_name AS fGoodsid,
  1511. wi.f_marks AS fMarks,
  1512. wi.f_chargedate AS fChargedate,
  1513. wi.f_billing_deadline AS fBillingDeadline,
  1514. wi.f_inventory_days AS fInventoryDays,
  1515. wi.f_billing_days AS fBillingDays,
  1516. w.f_remarks AS fRemarks
  1517. FROM t_fee_do w
  1518. LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
  1519. LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
  1520. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  1521. , (
  1522. SELECT @ii := 0
  1523. ) AS ii
  1524. WHERE dict.status = '0'
  1525. AND dict.dict_type = 'data_unitfees'
  1526. AND w.f_pid = #{fId}
  1527. </select>
  1528. <select id="warehouseBillsFeesProfitList" resultType="java.util.Map">
  1529. SELECT
  1530. t.f_id AS fSrcpid,
  1531. c.f_name AS fName,
  1532. c1.f_name AS fFeesName,
  1533. w.f_mblno AS fMblno,
  1534. w.f_product_name AS fProductName,
  1535. w.f_marks AS fMarks,
  1536. t.f_billtype AS fBilltype,
  1537. w.f_review_date AS fReviewDate,
  1538. sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) fAmount,
  1539. sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) fStlamount,
  1540. sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END )
  1541. nnfinished
  1542. FROM
  1543. t_warehousebillsfees w
  1544. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  1545. left join sys_user u on t.create_by = u.user_name
  1546. left join sys_dept d on t.f_bsdeptid = d.dept_id
  1547. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1548. LEFT JOIN t_corps c1 ON c1.f_id = w.f_corpid
  1549. <where>
  1550. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
  1551. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
  1552. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  1553. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
  1554. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
  1555. #{fProductName}, '%')
  1556. </if>
  1557. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
  1558. and w.f_billstatus != 6
  1559. </if>
  1560. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  1561. and w.f_billstatus = 6
  1562. </if>
  1563. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  1564. and w.f_review_date &gt;= #{timeExamine[0]}
  1565. </if>
  1566. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  1567. and w.f_review_date &lt;= #{timeExamine[1]}
  1568. </if>
  1569. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  1570. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  1571. </if>
  1572. <if test="fBusinessType != null and fBusinessType != '' ">
  1573. and w.f_business_type in
  1574. <foreach collection="fBusinessType" item="id" open="(" close=")" separator=",">
  1575. #{id}
  1576. </foreach>
  1577. </if>
  1578. <if test="fFeeid != null and fFeeid != '' ">
  1579. and w.f_feeid in
  1580. <foreach collection="fFeeid" item="id" open="(" close=")" separator=",">
  1581. #{id}
  1582. </foreach>
  1583. </if>
  1584. and w.f_review_date IS NOT NULL
  1585. ${params.dataScope}
  1586. GROUP BY
  1587. w.f_mblno
  1588. </where>
  1589. </select>
  1590. <select id="selectFeeList" resultType="java.util.Map">
  1591. select
  1592. ware.create_by AS createBy,
  1593. ware.f_billno AS fBillno,
  1594. ware.f_ctrlcorpid AS fCtrlcorpid,
  1595. ware.create_time AS createTime,
  1596. ware.f_accbilldate AS fAccbilldate,
  1597. ware.t_mblno AS tMblno,
  1598. dict.dict_label AS chargingMethod,
  1599. ware.invoice_no AS invoiceNo,
  1600. ware.bank AS bank,
  1601. ware.water_bill_no AS waterBillNo,
  1602. ware.f_amtdr AS fAmtdr,
  1603. ware.f_amtcr AS fAmtcr,
  1604. ware.f_remarks AS fRemarks,
  1605. CASE
  1606. WHEN ware.f_billstatus = '1' THEN '保存'
  1607. WHEN ware.f_billstatus = '2' THEN '暂存'
  1608. WHEN ware.f_billstatus = '3' THEN '审批驳回'
  1609. WHEN ware.f_billstatus = '4' THEN '提交审核'
  1610. WHEN ware.f_billstatus = '5' THEN '审核中'
  1611. WHEN ware.f_billstatus = '6' THEN '审核完成'
  1612. END
  1613. AS fBillstatus
  1614. from
  1615. t_fee ware
  1616. left join sys_user u on ware.create_by = u.user_name
  1617. left join sys_dept d on ware.f_deptid = d.dept_id
  1618. LEFT JOIN sys_dict_data dict ON dict.dict_value = ware.charging_method
  1619. <where>
  1620. dict.status = '0'
  1621. AND dict.dict_type = 'data_settlement_type'
  1622. <if test="fBillno != null and fBillno != ''">and ware.f_billno = #{fBillno}</if>
  1623. <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
  1624. <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
  1625. <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
  1626. <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
  1627. <if test="tMblno != null and tMblno != ''">and ware.t_mblno = #{tMblno}</if>
  1628. <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
  1629. <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
  1630. <if test="fBilltype != null and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
  1631. <if test="fBillstatus != null and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
  1632. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks = #{fRemarks}</if>
  1633. <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
  1634. <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
  1635. <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
  1636. <if test="fRefNo != null and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
  1637. <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
  1638. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1639. and ware.f_accbilldate &gt;= #{timeInterval[0]}
  1640. </if>
  1641. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1642. and ware.f_accbilldate &lt;= #{timeInterval[1]}
  1643. </if>
  1644. <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
  1645. <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
  1646. <if test="bank != null ">and ware.bank = #{bank}</if>
  1647. <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
  1648. </where>
  1649. ${params.dataScope}
  1650. </select>
  1651. <select id="selectDetailedList" resultType="com.ruoyi.finance.excel.Detailed">
  1652. SELECT (@ii := @ii + 1) AS fId,
  1653. wi.f_mblno AS fMblno,
  1654. wi.f_bsdate AS fBsdate,
  1655. t.f_bscorpno AS fBscorpno,
  1656. f.f_name AS fFeeid,
  1657. CASE
  1658. WHEN w.f_srcdc = 'D' THEN
  1659. '收'
  1660. WHEN w.f_srcdc = 'C' THEN
  1661. '付'
  1662. END AS fSrcdc,
  1663. w.f_amtdr AS fAmtdr,
  1664. dict.dict_label AS fFeeunitid,
  1665. wi.f_qty AS fBillingQty,
  1666. wi.f_unitprice AS fUnitprice,
  1667. w.f_amt AS fAmt,
  1668. wi.f_business_type AS fBusinessType,
  1669. CASE
  1670. wi.f_billtype
  1671. WHEN 'SJRK' THEN
  1672. '入库'
  1673. WHEN 'SJCK' THEN
  1674. '出库'
  1675. WHEN 'HQZY' THEN
  1676. '货转'
  1677. WHEN 'CKDB' THEN
  1678. '调拨'
  1679. WHEN 'HWTG' THEN
  1680. '货物通关'
  1681. WHEN 'KCZZ' THEN
  1682. '库存总账'
  1683. END AS fBilltype,
  1684. wi.f_product_name AS fGoodsid,
  1685. wi.f_marks AS fMarks,
  1686. w.f_remarks AS fRemarks
  1687. FROM t_fee_do w
  1688. LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
  1689. LEFT JOIN t_warehousebills t ON wi.f_pid = t.f_id
  1690. LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
  1691. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  1692. , (
  1693. SELECT @ii := 0
  1694. ) AS ii
  1695. WHERE dict.status = '0'
  1696. AND dict.dict_type = 'data_unitfees'
  1697. AND w.f_pid = #{fId}
  1698. </select>
  1699. <select id="selectDetailedList1" resultType="java.util.Map">
  1700. SELECT t.f_id AS fSrcpid,
  1701. t.f_corpid AS fCorpid,
  1702. c.f_name AS fName,
  1703. c1.f_name AS fFeesName,
  1704. w.f_mblno AS fMblno,
  1705. w.f_product_name AS fProductName,
  1706. w.f_marks AS fMarks,
  1707. w.f_dc AS fSrcdc,
  1708. w.f_amount AS fAmount,
  1709. w.f_stlamount AS fStlamount,
  1710. ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) AS nnfinished
  1711. FROM t_warehousebills t
  1712. LEFT JOIN sys_user u ON t.create_by = u.user_name
  1713. LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
  1714. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1715. LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
  1716. LEFT JOIN t_corps c1 ON w.f_corpid = c1.f_id
  1717. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1718. WHERE w.f_dc = #{fSrcdc}
  1719. AND t.f_review_date IS NOT NULL
  1720. AND w.f_corpid = #{fCorpIds}
  1721. AND t.f_corpid = #{fCorpId}
  1722. AND w.f_mblno = #{fMblno}
  1723. </select>
  1724. <!--网页版发票申请查询-->
  1725. <select id="webVersionInvoice" parameterType="TFee" resultType="java.util.Map">
  1726. SELECT
  1727. tf.f_id AS fId,/**费用主表id*/
  1728. tf.f_billno AS fBillno,/**费用申请编号*/
  1729. tf.f_ctrlcorpid AS fCtrlcorpid,/**货权方*/
  1730. tf.f_corpid AS fCorpid,/**结算单位*/
  1731. tc.f_name AS fCorpidName,/**结算单位中文名称*/
  1732. tf.t_mblno AS tMblno,/**提单号*/
  1733. tf.f_amtdr AS fAmtdr,/**应收合计*/
  1734. tf.f_amtcr AS fAmtcr,/**应付合计*/
  1735. tf.f_billtype AS fBilltype,/**业务类型*/
  1736. tf.f_billstatus AS fBillstatus,/**状态*/
  1737. CASE
  1738. WHEN tf.f_billstatus = '1' THEN
  1739. '新建'
  1740. WHEN tf.f_billstatus = '2' THEN
  1741. '暂存'
  1742. WHEN tf.f_billstatus = '3' THEN
  1743. '驳回'
  1744. WHEN tf.f_billstatus = '4' THEN
  1745. '提交'
  1746. WHEN tf.f_billstatus = '5' THEN
  1747. '审批中'
  1748. WHEN tf.f_billstatus = '6' THEN
  1749. '审批通过'
  1750. END AS fBillstatusName,
  1751. tf.f_remarks AS fRemarks,/**备注*/
  1752. tf.f_accbilldate AS fAccbilldate,/**结算日期*/
  1753. tf.create_by AS createBy,/**创建人*/
  1754. tf.create_time AS createTime,/**创建时间*/
  1755. tf.update_by AS updateBy,/**更新人*/
  1756. tf.update_time AS updateTime,/**更新时间*/
  1757. tf.invoice_no AS invoiceNo,/**发票号*/
  1758. tf.bank AS bank,/**银行*/
  1759. tf.water_bill_no AS waterBillNo,/**水单号*/
  1760. tf.f_system_type AS fSystemType,/**系统类型*/
  1761. tf.f_tracking_number AS fTrackingNumber,/**快递单号*/
  1762. tf.f_invoice_rise AS fInvoiceRise,/**发票抬头*/
  1763. tf.f_sign AS fSign,/**是否签收*/
  1764. tf.f_send_Time AS fSendTime,/**寄送时间*/
  1765. tf.charging_method AS chargingMethod,/**收费方式*/
  1766. pro.dict_label AS chargingMethodName /**收费方式中文名称*/
  1767. FROM
  1768. t_fee tf
  1769. LEFT JOIN t_corps tc ON tf.f_corpid = tc.f_id
  1770. LEFT JOIN sys_dict_data pro ON pro.dict_value = tf.charging_method
  1771. AND pro.dict_type = 'data_settlement_type'
  1772. WHERE tf.f_billtype = 'ApplyFP'
  1773. <if test="createBy != null and createBy != ''">and tf.create_by = #{createBy}</if>
  1774. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1775. and tf.create_time &gt;= #{timeInterval[0]}
  1776. </if>
  1777. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1778. and tf.create_time &lt;= #{timeInterval[1]}
  1779. </if>
  1780. <if test="invoiceNo != null and invoiceNo != ''">and tf.invoice_no like concat('%', #{invoiceNo}, '%')</if>
  1781. <if test="fInvoiceRise != null and fInvoiceRise != ''">and tf.f_invoice_rise like concat('%', #{fInvoiceRise},
  1782. '%')
  1783. </if>
  1784. <if test="fBillno != null and fBillno != ''">and tf.f_billno like concat('%', #{fBillno}, '%')</if>
  1785. <if test="fBillstatus != null and fBillstatus != '' and fBillstatus != 'null' ">and tf.f_billstatus = #{fBillstatus}</if>
  1786. ORDER BY tf.f_id desc
  1787. </select>
  1788. </mapper>