TWarehousebillsfeesMapper.xml 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256
  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.warehouseBusiness.mapper.TWarehousebillsfeesMapper">
  6. <resultMap type="TWarehousebillsfees" id="TWarehousebillsfeesResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fPid" column="f_pid"/>
  9. <result property="fLineno" column="f_lineno"/>
  10. <result property="fCorpid" column="f_corpid"/>
  11. <result property="fShipper" column="f_shipper"/>
  12. <result property="fFeeid" column="f_feeid"/>
  13. <result property="fFeeunitid" column="f_feeUnitid"/>
  14. <result property="fWarehouseid" column="f_warehouseid"/>
  15. <result property="fQty" column="f_qty"/>
  16. <result property="fUnitprice" column="f_unitprice"/>
  17. <result property="fAmount" column="f_amount"/>
  18. <result property="fCurrency" column="f_currency"/>
  19. <result property="fExrate" column="f_exrate"/>
  20. <result property="fTaxrate" column="f_taxrate"/>
  21. <result property="fTaxrateStr" column="f_taxratestr"/>
  22. <result property="fDc" column="f_dc"/>
  23. <result property="fBillstatus" column="f_billstatus"/>
  24. <result property="fReviewDate" column="f_review_date"/>
  25. <result property="fAccamount" column="f_accamount"/>
  26. <result property="fStatementNo" column="f_statement_no"/>
  27. <result property="fStlamount" column="f_stlamount"/>
  28. <result property="fInvnos" column="f_invnos"/>
  29. <result property="fAccamountDate" column="f_accamount_date"/>
  30. <result property="fInvamount" column="f_invamount"/>
  31. <result property="fInvoicingDate" column="f_invoicing_date"/>
  32. <result property="fStlamountNo" column="f_stlamount_no"/>
  33. <result property="fAskamount" column="f_askamount"/>
  34. <result property="fStatus" column="f_status"/>
  35. <result property="fStlamountDate" column="f_stlamount_date"/>
  36. <result property="delFlag" column="del_flag"/>
  37. <result property="createBy" column="create_by"/>
  38. <result property="createTime" column="create_time"/>
  39. <result property="updateBy" column="update_by"/>
  40. <result property="updateTime" column="update_time"/>
  41. <result property="remark" column="remark"/>
  42. <result property="srcId" column="src_id"/>
  43. <result property="srcBillNo" column="src_bill_no"/>
  44. <result property="fMblno" column="f_mblno"/>
  45. <result property="fProductName" column="f_product_name"/>
  46. <result property="fMarks" column="f_marks"/>
  47. <result property="fChargedate" column="f_chargedate"/>
  48. <result property="fBillingDeadline" column="f_billing_deadline"/>
  49. <result property="fInventoryDays" column="f_inventory_days"/>
  50. <result property="fAmt" column="f_amt"/>
  51. <result property="fBillingDays" column="f_billing_days"/>
  52. <result property="fBillingQty" column="f_billing_qty"/>
  53. <result property="fBilltype" column="f_billtype"/>
  54. <result property="fBillingway" column="f_billingway"/>
  55. <result property="fBsdate" column="f_bsdate"/>
  56. <result property="priceDateRemarks" column="price_date_remarks"/>
  57. <result property="fOriginalbilldate" column="f_originalbilldate"/>
  58. <result property="fStltypeid" column="f_stltypeid"/>
  59. <result property="fBusinessType" column="f_business_type"/>
  60. <result property="fSrcTypeId" column="f_src_type_id"/>
  61. <result property="fSrcBillno" column="src_bill_no"/>
  62. <result property="fAddress" column="f_address"/>
  63. <result property="fAddressName" column="f_address_name"/>
  64. </resultMap>
  65. <sql id="selectTWarehousebillsfeesVo">
  66. select f_id,
  67. f_pid,
  68. f_lineno,
  69. f_corpid,
  70. f_feeid,
  71. f_warehouseid,
  72. f_feeUnitid,
  73. f_qty,
  74. f_unitprice,
  75. f_amount,
  76. f_currency,
  77. f_exrate,
  78. f_taxrate,
  79. CASE
  80. WHEN f_taxrate = 0 THEN '0.00%'
  81. WHEN f_taxrate != 0 THEN CONCAT(f_taxrate,'%')
  82. END as f_taxratestr,
  83. f_dc,
  84. f_billstatus,
  85. f_review_date,
  86. f_statement_no,
  87. f_accamount,
  88. f_stlamount,
  89. f_accamount_date,
  90. f_invnos,
  91. f_invamount,
  92. f_invoicing_date,
  93. f_stlamount_no,
  94. f_askamount,
  95. f_status,
  96. f_stlamount_date,
  97. del_flag,
  98. create_by,
  99. create_time,
  100. update_by,
  101. update_time,
  102. remark,
  103. src_id,
  104. src_bill_no,
  105. f_mblno,
  106. f_product_name,
  107. f_marks,
  108. f_chargedate,
  109. f_billing_deadline,
  110. f_inventory_days,
  111. f_amt,
  112. f_billing_days,
  113. f_billing_qty,
  114. f_billtype,
  115. f_billingway,
  116. f_bsdate,
  117. f_originalbilldate,
  118. f_stltypeid,
  119. f_business_type,
  120. f_src_type_id,
  121. price_date_remarks,
  122. f_address_name,
  123. f_address
  124. from t_warehousebillsfees
  125. </sql>
  126. <select id="selectTWarehousebillsfeesList" parameterType="TWarehousebillsfees"
  127. resultMap="TWarehousebillsfeesResult">
  128. <include refid="selectTWarehousebillsfeesVo"/>
  129. <where>
  130. <if test="fPid != null ">and f_pid = #{fPid}</if>
  131. <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
  132. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  133. <if test="fFeeid != null ">and f_feeid = #{fFeeid}</if>
  134. <if test="fFeeunitid != null ">and f_feeUnitid = #{fFeeunitid}</if>
  135. <if test="fQty != null ">and f_qty = #{fQty}</if>
  136. <if test="fUnitprice != null ">and f_unitprice = #{fUnitprice}</if>
  137. <if test="fAmount != null ">and f_amount = #{fAmount}</if>
  138. <if test="fCurrency != null and fCurrency != ''">and f_currency = #{fCurrency}</if>
  139. <if test="fExrate != null ">and f_exrate = #{fExrate}</if>
  140. <if test="fTaxrate != null ">and f_taxrate = #{fTaxrate}</if>
  141. <if test="fDc != null and fDc != ''">and f_dc = #{fDc}</if>
  142. <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
  143. <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
  144. <if test="fStatementNo != null and fStatementNo != ''">and f_statement_no = #{fStatementNo}</if>
  145. <if test="fAccamount != null ">and f_accamount = #{fAccamount}</if>
  146. <if test="fStlamount != null ">and f_stlamount = #{fStlamount}</if>
  147. <if test="fAccamountDate != null ">and f_accamount_date = #{fAccamountDate}</if>
  148. <if test="fInvnos != null and fInvnos != ''">and f_invnos = #{fInvnos}</if>
  149. <if test="fInvamount != null ">and f_invamount = #{fInvamount}</if>
  150. <if test="fInvoicingDate != null ">and f_invoicing_date = #{fInvoicingDate}</if>
  151. <if test="fStlamountNo != null and fStlamountNo != ''">and f_stlamount_no = #{fStlamountNo}</if>
  152. <if test="fAskamount != null ">and f_askamount = #{fAskamount}</if>
  153. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  154. <if test="fStlamountDate != null ">and f_stlamount_date = #{fStlamountDate}</if>
  155. <if test="srcId != null ">and src_id = #{srcId}</if>
  156. <if test="srcBillNo != null and srcBillNo != ''">and src_bill_no = #{srcBillNo}</if>
  157. <if test="fMblno != null and fMblno != ''">and f_mblno = #{fMblno}</if>
  158. <if test="fProductName != null and fProductName != ''">and f_product_name like concat('%', #{fProductName},
  159. '%')
  160. </if>
  161. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  162. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  163. <if test="fBillingDeadline != null ">and f_billing_deadline = #{fBillingDeadline}</if>
  164. <if test="fInventoryDays != null ">and f_inventory_days = #{fInventoryDays}</if>
  165. <if test="fAmt != null ">and f_amt = #{fAmt}</if>
  166. <if test="fBillingDays != null ">and f_billing_days = #{fBillingDays}</if>
  167. <if test="fBillingQty != null ">and f_billing_qty = #{fBillingQty}</if>
  168. <if test="fBilltype != null and fBilltype != ''">and f_billtype = #{fBilltype}</if>
  169. <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
  170. <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
  171. <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
  172. <if test="fStltypeid != null">and f_stltypeid = #{fStltypeid},</if>
  173. <if test="fSrcTypeId != null">and f_src_type_id = #{fSrcTypeId},</if>
  174. <if test="fAddress != null">and f_address = #{fAddress}</if>
  175. <if test="fAddressName != null and fAddressName != ''">and f_address_name = #{fAddressName}</if>
  176. </where>
  177. </select>
  178. <select id="selectTWarehousebillsfeesById" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  179. <include refid="selectTWarehousebillsfeesVo"/>
  180. where f_id = #{fId} and del_flag = 0
  181. </select>
  182. <select id="selectTWarehousebillsfeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  183. select f_id, f_pid, f_billing_deadline, src_bill_no,f_billstatus
  184. from t_warehousebillsfees
  185. where f_pid = #{fId}
  186. and f_billtype = 'SJCK'
  187. </select>
  188. <select id="selectWarehousebillsfeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  189. <include refid="selectTWarehousebillsfeesVo"/>
  190. where f_pid = #{fId}
  191. </select>
  192. <select id="selectReconciliation" resultType="java.lang.Integer">
  193. SELECT COUNT(d.f_id)
  194. FROM t_fee_do d
  195. LEFT JOIN t_fee f ON d.f_pid = f.f_id
  196. WHERE d.f_srcpid = #{fId}
  197. AND f.f_billtype = 'DZ'
  198. </select>
  199. <select id="selectCharge" resultType="java.lang.Integer">
  200. SELECT COUNT(d.f_id)
  201. FROM t_fee_do d
  202. LEFT JOIN t_fee f ON d.f_pid = f.f_id
  203. WHERE d.f_srcpid = #{fId}
  204. AND f.f_billtype = 'SF'
  205. </select>
  206. <select id="selectPay" resultType="java.lang.Integer">
  207. SELECT COUNT(d.f_id)
  208. FROM t_fee_do d
  209. LEFT JOIN t_fee f ON d.f_pid = f.f_id
  210. WHERE d.f_srcpid = #{fId}
  211. AND f.f_billtype = 'FF'
  212. </select>
  213. <select id="selectFleetExcelMonthList" parameterType="TWarehousebillsfees"
  214. resultType="com.ruoyi.finance.excel.FleetExcel">
  215. SELECT
  216. CONCAT( MONTH ( s.f_bsdate ), '月份小计:' ) feelMonthName,
  217. CONCAT(
  218. YEAR ( s.f_bsdate ),
  219. '-',
  220. MONTH ( s.f_bsdate )) feelMonth,
  221. sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
  222. sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
  223. sum( s.f_amount ) totalAmount,
  224. sum( s.f_invamount ) invamount,
  225. ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
  226. FROM
  227. t_warehousebillsfees s
  228. LEFT JOIN t_corps c ON s.f_corpid = c.f_id
  229. LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
  230. WHERE
  231. s.f_dc = 'D'
  232. <if test='fMonth != null and fMonth[0] != null and fMonth[0]!= ""'>
  233. and s.f_bsdate &gt;= #{fMonth[0]}
  234. </if>
  235. <if test='fMonth != null and fMonth[1] != null and fMonth[1]!= ""'>
  236. and s.f_bsdate &lt;= #{fMonth[1]}
  237. </if>
  238. GROUP BY
  239. CONCAT(
  240. YEAR ( f_bsdate ),
  241. '-',
  242. MONTH ( f_bsdate ))
  243. </select>
  244. <select id="selectFleetExcelList" parameterType="TWarehousebillsfees"
  245. resultType="com.ruoyi.finance.excel.FleetExcel">
  246. SELECT
  247. #{createBy} userName,
  248. CONCAT(
  249. YEAR ( s.f_bsdate ),
  250. '-',
  251. MONTH ( s.f_bsdate )) feelMonth,
  252. c.f_name corpName,
  253. sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
  254. sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
  255. sum( s.f_amount ) totalAmount,
  256. IF
  257. ( f_invamount = 0, 'F', 'T' ) isInvoice,
  258. sum( s.f_invamount ) invamount,
  259. ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
  260. FROM
  261. t_warehousebillsfees s
  262. LEFT JOIN t_corps c ON s.f_corpid = c.f_id
  263. LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
  264. WHERE
  265. s.f_dc = 'D'
  266. <if test='fMonth != null and fMonth[0] != null and fMonth[0]!= ""'>
  267. and s.f_bsdate &gt;= #{fMonth[0]}
  268. </if>
  269. <if test='fMonth != null and fMonth[1] != null and fMonth[1]!= ""'>
  270. and s.f_bsdate &lt;= #{fMonth[1]}
  271. </if>
  272. GROUP BY CONCAT( YEAR ( f_bsdate ), '-', MONTH ( f_bsdate )), s.f_corpid, c.f_name
  273. </select>
  274. <insert id="insertTWarehousebillsfees" parameterType="TWarehousebillsfees" useGeneratedKeys="true"
  275. keyProperty="fId">
  276. insert into t_warehousebillsfees
  277. <trim prefix="(" suffix=")" suffixOverrides=",">
  278. <if test="fId != null">f_id,</if>
  279. <if test="fPid != null">f_pid,</if>
  280. <if test="fLineno != null">f_lineno,</if>
  281. <if test="fCorpid != null">f_corpid,</if>
  282. <if test="fFeeid != null">f_feeid,</if>
  283. <if test="fWarehouseid != null">f_warehouseid,</if>
  284. <if test="fFeeunitid != null">f_feeUnitid,</if>
  285. <if test="fQty != null">f_qty,</if>
  286. <if test="fUnitprice != null">f_unitprice,</if>
  287. <if test="fAmount != null">f_amount,</if>
  288. <if test="fCurrency != null">f_currency,</if>
  289. <if test="fExrate != null">f_exrate,</if>
  290. <if test="fTaxrate != null">f_taxrate,</if>
  291. <if test="fDc != null">f_dc,</if>
  292. <if test="fBillstatus != null">f_billstatus,</if>
  293. <if test="fReviewDate != null">f_review_date,</if>
  294. <if test="fStatementNo != null">f_statement_no,</if>
  295. <if test="fAccamount != null">f_accamount,</if>
  296. <if test="fStlamount != null">f_stlamount,</if>
  297. <if test="fAccamountDate != null">f_accamount_date,</if>
  298. <if test="fInvnos != null">f_invnos,</if>
  299. <if test="fInvamount != null">f_invamount,</if>
  300. <if test="fInvoicingDate != null ">f_invoicing_date,</if>
  301. <if test="fStlamountNo != null">f_stlamount_no,</if>
  302. <if test="fAskamount != null">f_askamount,</if>
  303. <if test="fStatus != null">f_status,</if>
  304. <if test="fStlamountDate != null">f_stlamount_date,</if>
  305. <if test="delFlag != null">del_flag,</if>
  306. <if test="createBy != null">create_by,</if>
  307. <if test="createTime != null">create_time,</if>
  308. <if test="updateBy != null">update_by,</if>
  309. <if test="updateTime != null">update_time,</if>
  310. <if test="remark != null">remark,</if>
  311. <if test="srcId != null">src_id,</if>
  312. <if test="srcBillNo != null">src_bill_no,</if>
  313. <if test="fMblno != null">f_mblno,</if>
  314. <if test="fProductName != null">f_product_name,</if>
  315. <if test="fMarks != null">f_marks,</if>
  316. <if test="fChargedate != null">f_chargedate,</if>
  317. <if test="fBillingDeadline != null">f_billing_deadline,</if>
  318. <if test="fInventoryDays != null">f_inventory_days,</if>
  319. <if test="fAmt != null">f_amt,</if>
  320. <if test="fBillingDays != null">f_billing_days,</if>
  321. <if test="fBillingQty != null">f_billing_qty,</if>
  322. <if test="fBilltype != null">f_billtype,</if>
  323. <if test="fBillingway != null">f_billingway,</if>
  324. <if test="fBsdate != null">f_bsdate,</if>
  325. <if test="fOriginalbilldate != null">f_originalbilldate,</if>
  326. <if test="fStltypeid != null">f_stltypeid,</if>
  327. <if test="fBusinessType != null">f_business_type,</if>
  328. <if test="fSrcTypeId != null">f_src_type_id,</if>
  329. <if test="priceDateRemarks != null">price_date_remarks,</if>
  330. <if test="fAddress != null">f_address,</if>
  331. <if test="fAddressName != null">f_address_name,</if>
  332. </trim>
  333. <trim prefix="values (" suffix=")" suffixOverrides=",">
  334. <if test="fId != null">#{fId},</if>
  335. <if test="fPid != null">#{fPid},</if>
  336. <if test="fLineno != null">#{fLineno},</if>
  337. <if test="fCorpid != null">#{fCorpid},</if>
  338. <if test="fFeeid != null">#{fFeeid},</if>
  339. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  340. <if test="fFeeunitid != null">#{fFeeunitid},</if>
  341. <if test="fQty != null">#{fQty},</if>
  342. <if test="fUnitprice != null">#{fUnitprice},</if>
  343. <if test="fAmount != null">#{fAmount},</if>
  344. <if test="fCurrency != null">#{fCurrency},</if>
  345. <if test="fExrate != null">#{fExrate},</if>
  346. <if test="fTaxrate != null">#{fTaxrate},</if>
  347. <if test="fDc != null">#{fDc},</if>
  348. <if test="fBillstatus != null">#{fBillstatus},</if>
  349. <if test="fReviewDate != null">#{fReviewDate},</if>
  350. <if test="fStatementNo != null">#{fStatementNo},</if>
  351. <if test="fAccamount != null">#{fAccamount},</if>
  352. <if test="fStlamount != null">#{fStlamount},</if>
  353. <if test="fAccamountDate != null">#{fAccamountDate},</if>
  354. <if test="fInvnos != null">#{fInvnos},</if>
  355. <if test="fInvamount != null">#{fInvamount},</if>
  356. <if test="fInvoicingDate != null ">#{fInvoicingDate},</if>
  357. <if test="fStlamountNo != null">#{fStlamountNo},</if>
  358. <if test="fAskamount != null">#{fAskamount},</if>
  359. <if test="fStatus != null">#{fStatus},</if>
  360. <if test="fStlamountDate != null">#{fStlamountDate},</if>
  361. <if test="delFlag != null">#{delFlag},</if>
  362. <if test="createBy != null">#{createBy},</if>
  363. <if test="createTime != null">#{createTime},</if>
  364. <if test="updateBy != null">#{updateBy},</if>
  365. <if test="updateTime != null">#{updateTime},</if>
  366. <if test="remark != null">#{remark},</if>
  367. <if test="srcId != null">#{srcId},</if>
  368. <if test="srcBillNo != null">#{srcBillNo},</if>
  369. <if test="fMblno != null">#{fMblno},</if>
  370. <if test="fProductName != null">#{fProductName},</if>
  371. <if test="fMarks != null">#{fMarks},</if>
  372. <if test="fChargedate != null">#{fChargedate},</if>
  373. <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
  374. <if test="fInventoryDays != null">#{fInventoryDays},</if>
  375. <if test="fAmt != null">#{fAmt},</if>
  376. <if test="fBillingDays != null">#{fBillingDays},</if>
  377. <if test="fBillingQty != null">#{fBillingQty},</if>
  378. <if test="fBilltype != null">#{fBilltype},</if>
  379. <if test="fBillingway != null">#{fBillingway},</if>
  380. <if test="fBsdate != null">#{fBsdate},</if>
  381. <if test="fOriginalbilldate != null">#{fOriginalbilldate},</if>
  382. <if test="fStltypeid != null">#{fStltypeid},</if>
  383. <if test="fBusinessType != null">#{fBusinessType},</if>
  384. <if test="fSrcTypeId != null">#{fSrcTypeId},</if>
  385. <if test="priceDateRemarks != null">#{priceDateRemarks},</if>
  386. <if test="fAddress != null">#{fAddress},</if>
  387. <if test="fAddressName != null">#{fAddressName},</if>
  388. </trim>
  389. </insert>
  390. <update id="updateTWarehousebillsfees" parameterType="TWarehousebillsfees">
  391. update t_warehousebillsfees
  392. <trim prefix="SET" suffixOverrides=",">
  393. <if test="fPid != null">f_pid = #{fPid},</if>
  394. <if test="fLineno != null">f_lineno = #{fLineno},</if>
  395. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  396. <if test="fFeeid != null">f_feeid = #{fFeeid},</if>
  397. <if test="fFeeunitid != null">f_feeUnitid = #{fFeeunitid},</if>
  398. <if test="fQty != null">f_qty = #{fQty},</if>
  399. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  400. <if test="fUnitprice != null">f_unitprice = #{fUnitprice},</if>
  401. <if test="fAmount != null">f_amount = #{fAmount},</if>
  402. <if test="fCurrency != null">f_currency = #{fCurrency},</if>
  403. <if test="fExrate != null">f_exrate = #{fExrate},</if>
  404. <if test="fTaxrate != null">f_taxrate = #{fTaxrate},</if>
  405. <if test="fDc != null">f_dc = #{fDc},</if>
  406. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  407. <if test="fReviewDate != null || fReviewDate == null">f_review_date = #{fReviewDate},</if>
  408. <if test="fStatementNo != null">f_statement_no = #{fStatementNo},</if>
  409. <if test="fAccamount != null">f_accamount = #{fAccamount},</if>
  410. <if test="fStlamount != null">f_stlamount = #{fStlamount},</if>
  411. <if test="fAccamountDate != null">f_accamount_date = #{fAccamountDate},</if>
  412. <if test="fInvnos != null">f_invnos = #{fInvnos},</if>
  413. <if test="fInvamount != null">f_invamount = #{fInvamount},</if>
  414. <if test="fInvoicingDate != null ">f_invoicing_date = #{fInvoicingDate},</if>
  415. <if test="fStlamountNo != null">f_stlamount_no = #{fStlamountNo},</if>
  416. <if test="fAskamount != null">f_askamount = #{fAskamount},</if>
  417. <if test="fStatus != null">f_status = #{fStatus},</if>
  418. <if test="fStlamountDate != null">f_stlamount_date = #{fStlamountDate},</if>
  419. <if test="delFlag != null">del_flag = #{delFlag},</if>
  420. <if test="createBy != null">create_by = #{createBy},</if>
  421. <if test="createTime != null">create_time = #{createTime},</if>
  422. <if test="updateBy != null">update_by = #{updateBy},</if>
  423. <if test="updateTime != null">update_time = #{updateTime},</if>
  424. <if test="remark != null">remark = #{remark},</if>
  425. <if test="srcId != null">src_id = #{srcId},</if>
  426. <if test="srcBillNo != null">src_bill_no = #{srcBillNo},</if>
  427. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  428. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  429. <if test="fMarks != null">f_marks = #{fMarks},</if>
  430. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  431. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  432. <if test="fInventoryDays != null">f_inventory_days = #{fInventoryDays},</if>
  433. <if test="fAmt != null">f_amt = #{fAmt},</if>
  434. <if test="fBillingDays != null">f_billing_days = #{fBillingDays},</if>
  435. <if test="fBillingQty != null">f_billing_qty = #{fBillingQty},</if>
  436. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  437. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  438. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  439. <if test="fOriginalbilldate != null">f_originalbilldate = #{fOriginalbilldate},</if>
  440. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  441. <if test="priceDateRemarks != null">price_date_remarks = #{priceDateRemarks},</if>
  442. <if test="fSrcTypeId != null">f_src_type_id = #{fSrcTypeId},</if>
  443. <if test="fAddress != null">f_address = #{fAddress},</if>
  444. <if test="fAddressName != null">f_address_name = #{fAddressName},</if>
  445. </trim>
  446. where f_id = #{fId}
  447. </update>
  448. <delete id="deleteTWarehousebillsfeesById" parameterType="Long">
  449. delete
  450. from t_warehousebillsfees
  451. where f_id = #{fId}
  452. </delete>
  453. <delete id="deleteByFPid" parameterType="Long">
  454. delete
  455. from t_warehousebillsfees
  456. where f_pid = #{fId}
  457. </delete>
  458. <delete id="deleteTWarehousebillsfeesByIds" parameterType="String">
  459. delete from t_warehousebillsfees where f_id in
  460. <foreach item="fId" collection="array" open="(" separator="," close=")">
  461. #{fId}
  462. </foreach>
  463. </delete>
  464. <update id="warehouseFeesFollowUpdate">
  465. update
  466. t_warehousebillsfees
  467. <trim prefix="SET" suffixOverrides=",">
  468. <if test="fettle != null">f_billstatus = #{fettle},</if>
  469. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  470. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  471. </trim>
  472. where f_pid = #{fPid} and f_accamount &lt;= 0 and f_stlamount &lt;= 0 and f_invamount &lt;= 0
  473. </update>
  474. <update id="warehouseFeesFollowUpdateById">
  475. update
  476. t_warehousebillsfees
  477. <trim prefix="SET" suffixOverrides=",">
  478. <if test="fettle != null">f_billstatus = #{fettle},</if>
  479. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  480. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  481. </trim>
  482. where f_id = #{fPid} and f_accamount &lt;= 0 and f_stlamount &lt;= 0 and f_invamount &lt;= 0
  483. </update>
  484. <update id="updateTWarehousebillsfee" parameterType="Map">
  485. update t_warehousebillsfees
  486. <trim prefix="SET" suffixOverrides=",">
  487. /*判断确认对账*/
  488. <if test="map.billType == 'DZ'">
  489. f_statement_no = #{map.tFee.fBillno},
  490. f_accamount = f_accamount + #{map.tFeeDo.fAmt},
  491. f_accamount_date = #{map.tFee.fAccbilldate}
  492. </if>
  493. /*判断撤销对账*/
  494. <if test="map.billType == 'DZRevoke'">
  495. f_statement_no = #{map.tFee.fBillno},
  496. f_accamount = f_accamount - #{map.tFeeDo.fAmt},
  497. f_accamount_date = null
  498. </if>
  499. /*判断收付款*/
  500. <if test="map.billType == 'DC'">
  501. f_stlamount_no = #{map.tFee.fBillno},
  502. f_stlamount = f_stlamount + #{map.tFeeDo.fAmt},
  503. f_stlamount_date =#{map.tFee.fAccbilldate}
  504. </if>
  505. /*判断撤销收付款*/
  506. <if test="map.billType == 'DCRevoke'">
  507. f_stlamount_no = #{map.tFee.fBillno},
  508. f_stlamount = f_stlamount - #{map.tFeeDo.fAmt},
  509. f_stlamount_date =#{map.tFee.fAccbilldate}
  510. </if>
  511. /*判断开发票款*/
  512. <if test="map.billType == 'invoiceFP'">
  513. f_invamount = f_invamount + #{map.tFeeDo.fAmt},
  514. f_stlamount_date =#{map.tFee.fAccbilldate}
  515. </if>
  516. <if test="map.billType == 'DZinvoiceFP'">
  517. f_invamount = f_invamount - #{map.tFeeDo.fAmt},
  518. f_stlamount_date =#{map.tFee.fAccbilldate}
  519. </if>
  520. /*判断申请发票款*/
  521. <if test="map.billType == 'ApplyFP'">
  522. f_askamount = f_askamount + #{map.tFeeDo.fAmt},
  523. f_stlamount_date =#{map.tFee.fAccbilldate}
  524. </if>
  525. <if test="map.billType == 'DZApplyFP'">
  526. f_askamount = f_askamount - #{map.tFeeDo.fAmt},
  527. f_stlamount_date =#{map.tFee.fAccbilldate}
  528. </if>
  529. /*判断确认对账*/
  530. <if test="map.billType == 'KHDZ'">
  531. f_statement_no = #{map.tFee.fBillno},
  532. f_accamount = f_accamount + #{map.tFeeDo.fAmt},
  533. f_accamount_date = #{map.tFee.fAccbilldate}
  534. </if>
  535. /*判断撤销对账*/
  536. <if test="map.billType == 'KHDZRevoke'">
  537. f_statement_no = #{map.tFee.fBillno},
  538. f_accamount = f_accamount - #{map.tFeeDo.fAmt},
  539. f_accamount_date = #{map.tFee.fAccbilldate}
  540. </if>
  541. /*判断确认仓库发票*/
  542. <if test="map.billType == 'FP'">
  543. f_invnos = #{map.tFee.invoiceNo},
  544. f_invamount = f_invamount + #{map.tFeeDo.fAmt},
  545. f_invoicing_date = #{map.tFee.fAccbilldate}
  546. </if>
  547. /*判断撤销仓库发票*/
  548. <if test="map.billType == 'FPRevoke'">
  549. f_invnos = #{map.tFee.invoiceNo},
  550. f_invamount = f_invamount - #{map.tFeeDo.fAmt},
  551. f_invoicing_date = #{map.tFee.fAccbilldate}
  552. </if>
  553. </trim>
  554. where f_id = #{map.tFeeDo.fSrcid}
  555. </update>
  556. <update id="updateByPid">
  557. update t_warehousebillsfees set f_chargedate = #{fChargedate} where f_pid = #{fId}
  558. </update>
  559. <select id="selectFeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  560. SELECT
  561. tw.f_id,
  562. tw.f_pid,
  563. tw.f_lineno,
  564. tw.f_corpid,
  565. tc.f_name corpName,
  566. tw.f_feeid,
  567. tf.f_name feeName,
  568. tw.f_feeUnitid,
  569. tw.f_qty,
  570. tw.f_unitprice,
  571. tw.f_amount,
  572. tw.f_currency,
  573. tw.f_exrate,
  574. tw.f_taxrate,
  575. tw.f_dc,
  576. tw.f_billstatus,
  577. CASE
  578. WHEN tw.f_billstatus = '1' THEN
  579. '新建'
  580. WHEN tw.f_billstatus = '2' THEN
  581. '暂存'
  582. WHEN tw.f_billstatus = '3' THEN
  583. '驳回'
  584. WHEN tw.f_billstatus = '4' THEN
  585. '提交'
  586. WHEN tw.f_billstatus = '5' THEN
  587. '审批中'
  588. WHEN tw.f_billstatus = '6' THEN
  589. '审批通过'
  590. END AS fBillstatusName,
  591. tw.f_review_date,
  592. tw.f_statement_no,
  593. tw.f_accamount,
  594. tw.f_stlamount,
  595. tw.f_accamount_date,
  596. tw.f_invnos,
  597. tw.f_invamount,
  598. tw.f_stlamount_no,
  599. tw.f_askamount,
  600. tw.f_status,
  601. tw.f_stlamount_date,
  602. tw.del_flag,
  603. tw.create_by,
  604. tw.create_time,
  605. tw.update_by,
  606. tw.update_time,
  607. tw.remark,
  608. tw.src_id,
  609. tw.src_bill_no,
  610. tw.f_mblno,
  611. tw.f_product_name,
  612. tw.f_marks,
  613. tw.price_date_remarks,
  614. tw.f_chargedate,
  615. tw.f_billing_deadline,
  616. tw.f_inventory_days,
  617. tw.f_amt,
  618. tw.f_billing_days,
  619. tw.f_billing_qty,
  620. tw.f_billtype,
  621. tw.f_billingway,
  622. tw.f_bsdate,
  623. tw.f_originalbilldate,
  624. tw.f_stltypeid,
  625. tw.f_business_type,
  626. tw.f_src_type_id,
  627. tw.f_address,
  628. tw.f_address_name
  629. FROM
  630. t_warehousebillsfees tw
  631. LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
  632. LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
  633. where tw.f_pid = #{fPid}
  634. and tw.f_billtype = 'KHDD'
  635. <if test="fDc != null and fDc != ''">and tw.f_dc = #{fDc}</if>
  636. </select>
  637. <select id="voyageFeeDetails" resultType="map">
  638. SELECT
  639. tf.f_name feeName,
  640. SUM(tw.f_unitprice) fUnitprice,
  641. SUM(tw.f_amount) fAmount
  642. FROM
  643. t_warehousebillsfees tw
  644. LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
  645. WHERE
  646. tw.f_pid = #{fPid}
  647. AND tw.f_billtype = 'KHDD'
  648. <if test="fDc != null and fDc != ''">AND tw.f_dc = #{fDc}</if>
  649. GROUP BY feeName;
  650. </select>
  651. <select id="selectSubItemsFeeDetails" resultType="map">
  652. select tf.f_name feeName,
  653. tw.f_unitprice fUnitprice,
  654. tw.f_amount fAmount
  655. from t_warehousebillsfees tw
  656. LEFT JOIN t_fees tf on tw.f_feeid = tf.f_id
  657. where
  658. <if test="fPid != null and fPid != ''">tw.f_pid = #{fPid}</if>
  659. <if test="fDc != null and fDc != ''">and tw.f_dc = #{fDc}</if>
  660. </select>
  661. <delete id="deleteFessByFPid" parameterType="object">
  662. delete
  663. from t_warehousebillsfees
  664. where f_pid = #{fPid}
  665. <if test="fDc != null and fDc != ''">and f_dc = #{fDc}</if>
  666. </delete>
  667. <!--网页版查询对账-->
  668. <select id="webVersionReconciliation" parameterType="TAccount" resultType="map">
  669. SELECT
  670. tb.f_billno AS fBillno,
  671. /**运单号*/
  672. tv.f_name AS vesselName,
  673. /**船名*/
  674. ty.f_no AS voyageName,
  675. /**航次*/
  676. tc.f_name AS invoice,
  677. /**收费单位*/
  678. tc.f_name AS drawee,
  679. /**受票单位*/
  680. tp.f_name AS corpName,
  681. /**货权方*/
  682. pro.dict_label AS fPaymode,
  683. /**付款方式*/
  684. te.f_name AS payment,
  685. /**费用名称*/
  686. ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmtdr,
  687. /**原始金额*/
  688. ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmt,
  689. /**本次金额*/
  690. ta.f_name AS fLoadportidName,
  691. /**始发港*/
  692. tr.f_name AS fDestportidName,
  693. /**目的港*/
  694. pr.dict_label AS fServiceitems,
  695. /**运输条款*/
  696. tg.f_name AS goodName,
  697. /**货名*/
  698. tn.f_name AS transit,
  699. /**箱型*/
  700. items.f_cntrcount AS fCntrcount,
  701. /**箱量*/
  702. tb.f_shippername AS fShippername,
  703. /**发货人*/
  704. tb.f_consigneername AS fConsigneername,
  705. /**收货人*/
  706. tf.f_id AS fSrcid,
  707. tf.f_pid AS fSrcpid,
  708. tf.create_by AS createBy,
  709. tf.create_time AS createTime,
  710. tf.update_by AS updateBy,
  711. tf.update_time AS updateTime,
  712. tf.remark AS remark,
  713. tf.f_mblno AS fMblno,
  714. tf.f_corpid AS fCorpid,
  715. tf.f_feeid AS fFeeid
  716. FROM
  717. t_warehousebillsfees tf
  718. LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
  719. LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
  720. LEFT JOIN t_warehousebills tb ON tb.f_id = tf.f_pid
  721. LEFT JOIN t_vessel tv ON tv.f_id = tb.f_vslid
  722. LEFT JOIN t_voyage ty ON ty.f_id = tb.f_voyid
  723. LEFT JOIN t_address ta ON ta.f_id = tb.f_loadportid
  724. LEFT JOIN t_address tr ON tr.f_id = tb.f_destportid
  725. LEFT JOIN sys_dict_data pro ON pro.dict_value = tb.f_paymode
  726. AND pro.dict_type = 'data_settlement_type'
  727. LEFT JOIN sys_dict_data pr ON pr.dict_value = tb.f_serviceitems
  728. AND pr.dict_type = 'f_serviceitems'
  729. LEFT JOIN ( SELECT f_pid, MAX( f_goodsid ) f_goodsid FROM t_warehousebills_cntr GROUP BY f_pid ) w ON w.f_pid =
  730. tb.f_id
  731. LEFT JOIN t_goods tg ON tg.f_id = w.f_goodsid
  732. LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items
  733. ON items.f_pid = tb.f_id
  734. LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON
  735. twc.f_pid = tb.f_id
  736. LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
  737. LEFT JOIN t_corps tp ON tp.f_id = tb.f_corpid
  738. WHERE
  739. tf.f_billstatus = 6
  740. AND tf.f_dc = 'D'
  741. AND tb.f_typeid = 1
  742. and tb.f_review_date IS NOT NULL
  743. and ifnull(tf.f_amount, 0) - ifnull(tf.f_accamount, 0) > 0
  744. <if test="fLoadportid != null">and tb.f_loadportid = #{fLoadportid}</if>
  745. <if test="fDestportid != null">and tb.f_destportid = #{fDestportid}</if>
  746. <if test="fInvoceobj != null and fInvoceobj != ''">and tb.f_invoceobj like concat('%', #{fInvoceobj}, '%')</if>
  747. <if test="fShippername != null and fShippername != ''">and tb.f_shippername like concat('%', #{fShippername},
  748. '%')
  749. </if>
  750. <if test="fConsigneername != null and fConsigneername != ''">and tb.f_consigneername like concat('%',
  751. #{fConsigneername}, '%')
  752. </if>
  753. <if test="fMblno != null and fMblno != ''">and tb.f_mblno like concat('%', #{fMblno}, '%')</if>
  754. <if test="fBillno != null and fBillno != ''">and tb.f_billno like concat('%', #{fBillno}, '%')</if>
  755. <if test="fVslid != null">and tb.f_vslid = #{fVslid}</if>
  756. <if test="fVoyid != null">and tb.f_voyid = #{fVoyid}</if>
  757. <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
  758. <if test="fPaymodeid != null">and tb.f_paymode = #{fPaymodeid}</if>
  759. <if test='sailTime != null and sailTime[0] != null and sailTime[0]!= ""'>
  760. and tf.create_time &gt;= #{sailTime[0]}
  761. </if>
  762. <if test='sailTime != null and sailTime[1] != null and sailTime[1]!= ""'>
  763. and tf.create_time &lt;= #{sailTime[1]}
  764. </if>
  765. <if test="fDocmentdate != null and fDocmentdate != ''">and tb.f_docmentdate = #{fDocmentdate}</if>
  766. <if test="createBy != null and createBy != ''">and tb.create_by = #{createBy}</if>
  767. <if test="goodName != null and goodName != ''">and tg.f_name like concat('%', #{goodName}, '%')</if>
  768. ORDER BY tf.f_id desc
  769. </select>
  770. <!--网页版查询对账明细-->
  771. <select id="webVersionDetail" parameterType="TAccount" resultType="map">
  772. SELECT
  773. tf.f_id AS fId,
  774. te.f_billno AS accountBillno,
  775. /**账单编号*/
  776. tw.f_billno AS fBillno,
  777. /**运单编号*/
  778. tv.f_name AS vesselName,
  779. /**船名*/
  780. ty.f_no AS voyageName,
  781. /**航次*/
  782. te.f_ctrlcorpid AS fCtrlcorpid,
  783. /**获权方*/
  784. tp.f_name AS corpName,
  785. /**结算单位*/
  786. ta.f_name AS fLoadportidName,
  787. /**始发港*/
  788. tr.f_name AS fDestportidName,
  789. /**目的港*/
  790. pr.dict_label AS fServiceitems,
  791. /**运输条款*/
  792. ts.f_name AS payment,
  793. /**费用名称*/
  794. tf.f_amtdr AS fAmtdr,
  795. /**原始金额*/
  796. tf.f_amt AS fAmt,
  797. /**本次金额*/
  798. tn.f_name AS transit,
  799. /**箱型*/
  800. items.f_cntrcount AS fCntrcount,
  801. /**箱量*/
  802. tf.create_by AS createBy,
  803. tf.create_time AS createTime,
  804. CASE
  805. WHEN te.f_billstatus = '1' THEN
  806. '保存'
  807. WHEN te.f_billstatus = '2' THEN
  808. '暂存'
  809. WHEN te.f_billstatus = '3' THEN
  810. '审批驳回'
  811. WHEN te.f_billstatus = '4' THEN
  812. '提交审核'
  813. WHEN te.f_billstatus = '5' THEN
  814. '审核中'
  815. WHEN te.f_billstatus = '6' THEN
  816. '审核完成'
  817. END AS fBillstatus
  818. FROM
  819. t_fee_do tf
  820. LEFT JOIN t_fee te ON te.f_id = tf.f_pid
  821. LEFT JOIN t_warehousebills tw ON tf.f_srcpid = tw.f_id
  822. LEFT JOIN t_warehousebillsfees th ON th.f_id = tf.f_srcid
  823. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  824. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  825. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  826. LEFT JOIN t_address tr ON tr.f_id = tw.f_destportid
  827. LEFT JOIN sys_dict_data pr ON pr.dict_value = tw.f_serviceitems
  828. AND pr.dict_type = 'f_serviceitems'
  829. LEFT JOIN t_fees ts ON ts.f_id = tf.f_feeid
  830. LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items
  831. ON items.f_pid = tw.f_id
  832. LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON
  833. twc.f_pid = tw.f_id
  834. LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
  835. LEFT JOIN t_corps tp ON tp.f_id = te.f_corpid
  836. WHERE
  837. te.f_billtype = 'KHDZ'
  838. <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
  839. <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
  840. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj like concat('%', #{fInvoceobj}, '%')</if>
  841. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%', #{fShippername},
  842. '%')
  843. </if>
  844. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  845. #{fConsigneername}, '%')
  846. </if>
  847. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  848. <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
  849. <if test="fId != null">and tf.f_id = #{fId}</if>
  850. <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
  851. <if test="fCorpid != null">and te.f_corpid = #{fCorpid}</if>
  852. <if test="fPaymodeid != null">and tw.f_paymode = #{fPaymodeid}</if>
  853. <if test='sailTime != null and sailTime[0] != null and sailTime[0]!= ""'>
  854. and tf.create_time &gt;= #{sailTime[0]}
  855. </if>
  856. <if test='sailTime != null and sailTime[1] != null and sailTime[1]!= ""'>
  857. and tf.create_time &lt;= #{sailTime[1]}
  858. </if>
  859. <if test="fDocmentdate != null and fDocmentdate != ''">and tw.f_docmentdate = #{fDocmentdate}</if>
  860. <if test="createBy != null and createBy != ''">and te.create_by = #{createBy}</if>
  861. <if test="accountBillno != null and accountBillno != ''">and te.f_billno = #{accountBillno}</if>
  862. ORDER BY tf.f_id desc
  863. </select>
  864. <select id="selectTWarehousebillsfeesSrcId" parameterType="Long" resultType="long">
  865. select src_id
  866. FROM t_warehousebillsfees
  867. where f_pid = #{fId}
  868. AND src_id IS NOT NULL
  869. </select>
  870. <select id="accountsDue" resultType="map">
  871. SELECT CASE MONTH (tf.create_time) WHEN '1' THEN SUM(tf.f_amount) ELSE 0 END AS January,
  872. CASE MONTH(tf.create_time) WHEN '2' THEN SUM(tf.f_amount) ELSE 0
  873. END
  874. AS February,
  875. CASE MONTH(tf.create_time) WHEN '3' THEN SUM(tf.f_amount) ELSE 0
  876. END
  877. AS March,
  878. CASE MONTH(tf.create_time) WHEN '4' THEN SUM(tf.f_amount) ELSE 0
  879. END
  880. AS April,
  881. CASE MONTH(tf.create_time) WHEN '5' THEN SUM(tf.f_amount) ELSE 0
  882. END
  883. AS May,
  884. CASE MONTH(tf.create_time) WHEN '6' THEN SUM(tf.f_amount) ELSE 0
  885. END
  886. AS June,
  887. CASE MONTH(tf.create_time) WHEN '7' THEN SUM(tf.f_amount) ELSE 0
  888. END
  889. AS July,
  890. CASE MONTH(tf.create_time) WHEN '8' THEN SUM(tf.f_amount) ELSE 0
  891. END
  892. AS August,
  893. CASE MONTH(tf.create_time) WHEN '9' THEN SUM(tf.f_amount) ELSE 0
  894. END
  895. AS September,
  896. CASE MONTH(tf.create_time) WHEN '10' THEN SUM(tf.f_amount) ELSE 0
  897. END
  898. AS October,
  899. CASE MONTH(tf.create_time) WHEN '11' THEN SUM(tf.f_amount) ELSE 0
  900. END
  901. AS November,
  902. CASE MONTH(tf.create_time) WHEN '12' THEN SUM(tf.f_amount) ELSE 0
  903. END
  904. AS December,
  905. tc.f_name corpName
  906. FROM
  907. t_warehousebillsfees tf
  908. LEFT JOIN t_corps tc ON tf.f_corpid = tc.f_id
  909. WHERE ifnull(tf.f_amount, 0) - ifnull(tf.f_stlamount, 0) >0
  910. AND tf.f_dc = 'D'
  911. AND YEAR(tf.create_time) = YEAR(NOW())
  912. GROUP BY tf.f_corpid
  913. LIMIT 10
  914. </select>
  915. <select id="selectQueryMenuList" parameterType="TWarehousebillsfees"
  916. resultType="com.ruoyi.warehouseBusiness.excel.QueryMenu">
  917. SELECT
  918. tc.f_name AS corpName,
  919. tf.f_mblno AS fMblno,
  920. IF(tf.f_billtype = 'SJRK' || tf.f_billtype = 'SJCK' || tf.f_billtype = 'CKDB' || tf.f_billtype = 'HQZY' || tf.f_billtype = 'KCZZ',tf.f_bsdate, null) AS fBsdate,
  921. tf.f_review_date AS fReviewDate,
  922. te.f_name AS feeName,
  923. tf.f_dc AS fDc,
  924. tf.f_amount AS fAmount,
  925. tf.f_stlamount_no AS fStlamountNo,
  926. tw.f_shipper AS fShipper,
  927. tw.f_emblno AS fEmblno,
  928. tf.f_stlamount AS fStlamount,
  929. tf.f_stlamount_date AS fStlamountDate,
  930. tf.f_invamount AS fInvamount,
  931. tf.f_invnos AS fInvnos,
  932. tf.f_accamount AS fAccamount,
  933. tf.f_accamount_date AS fAccamountDate,
  934. tf.f_statement_no AS fStatementNo,
  935. tf.f_feeUnitid AS fFeeUnitid,
  936. tf.f_qty AS fQty,
  937. tf.f_unitprice AS fUnitprice,
  938. tf.f_billtype AS fBilltype,
  939. tf.f_product_name AS fProductName,
  940. tf.f_stltypeid AS fStltypeid,
  941. tf.remark AS remark,
  942. tf.src_bill_no AS fSrcBillno,
  943. tf.f_chargedate AS fChargedate,
  944. tf.f_billing_deadline AS fBillingDeadline,
  945. tf.f_originalbilldate AS fOriginalbilldate,
  946. CASE
  947. WHEN tf.f_billstatus = '1' THEN '录入'
  948. WHEN tf.f_billstatus = '2' THEN '暂存'
  949. WHEN tf.f_billstatus = '3' THEN '审批驳回'
  950. WHEN tf.f_billstatus = '4' THEN '提交审核'
  951. WHEN tf.f_billstatus = '5' THEN '审核中'
  952. WHEN tf.f_billstatus = '6' THEN '审核通过'
  953. END AS fBillstatusName
  954. FROM t_warehousebillsfees tf
  955. LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
  956. LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
  957. LEFT JOIN t_warehousebills tw on tf.f_pid = tw.f_id
  958. <where>
  959. <if test="fBillstatus != null and fBillstatus != ''">and tf.f_billstatus = #{fBillstatus}</if>
  960. <if test="fDc != null and fDc != ''">and tf.f_dc = #{fDc}</if>
  961. <if test="fMblno != null and fMblno != ''">and tf.f_mblno like concat('%', #{fMblno}, '%')</if>
  962. <if test="fStalmountStatus == 1">and tf.f_stlamount_no is not null and tf.f_stlamount!=0</if>
  963. <if test="fStalmountStatus == 2">and tf.f_stlamount_no is null</if>
  964. <if test="feesStatus == 1">and tf.f_statement_no is not null and tf.f_accamount &gt;= 0 and tf.f_accamount
  965. != 0
  966. </if>
  967. <if test="feesStatus == 2">and tf.f_statement_no is null</if>
  968. <if test="fInvnosStatus == 1">and tf.f_invnos is not null and tf.f_invamount != 0</if>
  969. <if test="fInvnosStatus == 2">and tf.f_invnos is null</if>
  970. <if test="fCorpid != null and fCorpid != ''">and tf.f_corpid = #{fCorpid}</if>
  971. <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%',#{fShipper},'%')</if>
  972. <if test="fEmblno != null and fEmblno != ''">and tw.f_emblno like concat('%',#{fEmblno},'%')</if>
  973. <if test="fStltypeid != null">and tf.f_stltypeid = #{fStltypeid}</if>
  974. <if test="fSrcBillno != null">and tf.src_bill_no = #{fSrcBillno}</if>
  975. <if test='fFeeids != null'>
  976. and tf.f_feeid in
  977. <foreach item="fFeeid" collection="fFeeids" open="(" separator="," close=")">
  978. #{fFeeid}
  979. </foreach>
  980. </if>
  981. <if test='fReviewDateList != null and fReviewDateList[0] != null and fReviewDateList[0]!= ""'>
  982. and tf.f_review_date &gt;= #{fReviewDateList[0]}
  983. </if>
  984. <if test='fReviewDateList != null and fReviewDateList[1] != null and fReviewDateList[1]!= ""'>
  985. and tf.f_review_date &lt;= #{fReviewDateList[1]}
  986. </if>
  987. <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
  988. and tf.f_bsdate &gt;= #{fBsdateList[0]}
  989. </if>
  990. <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
  991. and tf.f_bsdate &lt;= #{fBsdateList[1]}
  992. </if>
  993. </where>
  994. ORDER BY tf.f_bsdate desc
  995. </select>
  996. <select id="selectBillDetailsSubItemNew" parameterType="TWarehousebillsfees" resultType="map">
  997. select
  998. twf.f_pid as fId,
  999. twf.f_mblno as fMblno,
  1000. dict.dict_label as fBusinesstype,
  1001. CASE
  1002. WHEN twf.f_billtype = 'SJRK' THEN '入库'
  1003. WHEN twf.f_billtype = 'SJCK' THEN '实际出库'
  1004. WHEN twf.f_billtype = 'CKDB' THEN '调拨'
  1005. WHEN twf.f_billtype = 'HQZY' THEN '货权转移'
  1006. WHEN twf.f_billtype = 'CDZZ' THEN '场地直装'
  1007. END as fBilltype,
  1008. twf.f_corpid as fCorpid,
  1009. twf.f_statement_no as fStatementno,
  1010. twf.f_product_name as tgfName,
  1011. tc.f_name as tcfName,
  1012. twf.f_qty as fQty,
  1013. tw.f_netweight as fNetweight,
  1014. tw.f_volumn as fVolumn,
  1015. date_format(twf.f_originalbilldate, '%Y-%m-%d') fOriginalbilldate,
  1016. date_format(twf.f_bsdate, '%Y-%m-%d') fBsdate,
  1017. twf.f_billing_days as fBillingdays,
  1018. twf.f_amt as fAmt,
  1019. twf.f_amount as fAmount,
  1020. twf.create_by as createBy,
  1021. date_format(twf.f_chargedate, '%Y-%m-%d') fChargedate,
  1022. date_format(twf.f_stlamount_date, '%Y-%m-%d') fStlamountdate,
  1023. th.f_name as fhName,
  1024. twf.f_dc as fDc,
  1025. twf.remark as remark
  1026. from t_warehousebillsfees twf
  1027. LEFT JOIN t_warehousebills tw on twf.f_pid = tw.f_id
  1028. LEFT JOIN t_goods tg on tw.f_goodsid = tg.f_id
  1029. LEFT JOIN t_corps tc on twf.f_corpid = tc.f_id
  1030. LEFT JOIN t_warehouse th on tw.f_warehouseid = th.f_id
  1031. LEFT JOIN (
  1032. SELECT
  1033. *
  1034. FROM
  1035. sys_dict_data dictIn
  1036. WHERE
  1037. dictIn.dict_label =
  1038. IF((
  1039. (dictIn.dict_type = 'st_in_type' AND dictIn.`status` = '0') OR
  1040. (dictIn.dict_type = 'st_out_type'AND dictIn.status = '0') OR
  1041. (dictIn.dict_type = 'st_trans_type' AND dictIn.status = '0')
  1042. ),dictIn.dict_label,NULL)
  1043. ) dict ON dict.dict_value = twf.f_business_type
  1044. <where>
  1045. <if test="fCorpid != null and fCorpid != ''">and twf.f_corpid = #{fCorpid}</if>
  1046. <if test="fMblno != null and fMblno != ''">and twf.f_mblno like concat('%', #{fMblno}, '%')</if>
  1047. <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
  1048. and twf.f_bsdate &gt;= #{fBsdateList[0]}
  1049. </if>
  1050. <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
  1051. and twf.f_bsdate &lt;= #{fBsdateList[1]}
  1052. </if>
  1053. <if test='fReviewDateList != null and fReviewDateList[0] != null and fReviewDateList[0]!= ""'>
  1054. and twf.f_review_date &gt;= #{fReviewDateList[0]}
  1055. </if>
  1056. <if test='fReviewDateList != null and fReviewDateList[1] != null and fReviewDateList[1]!= ""'>
  1057. and twf.f_review_date &lt;= #{fReviewDateList[1]}
  1058. </if>
  1059. <if test="fStalmountStatus == 1">and twf.f_stlamount_no is not null and twf.f_stlamount!=0</if>
  1060. <if test="fStalmountStatus == 2">and twf.f_stlamount_no is null</if>
  1061. <if test="feesStatus == 1">and twf.f_statement_no is not null and twf.f_accamount &gt;= 0 and
  1062. twf.f_accamount != 0
  1063. </if>
  1064. <if test="feesStatus == 2">and twf.f_statement_no is null</if>
  1065. <if test="fInvnosStatus == 1">and twf.f_invnos is not null and twf.f_invamount != 0</if>
  1066. <if test="fInvnosStatus == 2">and twf.f_invnos is null</if>
  1067. <if test="fDc != null and fDc != ''">and twf.f_dc = #{fDc}</if>
  1068. <if test='fFeeids != null'>
  1069. and twf.f_feeid in
  1070. <foreach item="fFeeid" collection="fFeeids" open="(" separator="," close=")">
  1071. #{fFeeid}
  1072. </foreach>
  1073. </if>
  1074. <if test="fBillstatus != null and fBillstatus != ''">and twf.f_billstatus = #{fBillstatus}</if>
  1075. <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%',#{fShipper},'%')</if>
  1076. </where>
  1077. GROUP BY
  1078. twf.f_mblno,tc.f_name
  1079. ORDER BY twf.f_bsdate desc
  1080. </select>
  1081. <select id="selectFeesBymblnoAndFname" resultType="map">
  1082. SELECT
  1083. tf.f_name as feeName,
  1084. SUM(twf.f_unitprice) as fUnitprice,
  1085. SUM(twf.f_amount) as fAmount
  1086. FROM
  1087. t_fees tf
  1088. LEFT JOIN t_warehousebillsfees twf on tf.f_id = twf.f_feeid
  1089. <where>
  1090. <if test="fMblno != null and fMblno != ''">and twf.f_mblno = #{fMblno}</if>
  1091. <if test="fCorpid != null and fCorpid != ''">and twf.f_corpid = #{fCorpid}</if>
  1092. <if test="fDc != null and fDc != ''">and twf.f_dc = #{fDc}</if>
  1093. <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
  1094. and twf.f_bsdate &gt;= #{fBsdateList[0]}
  1095. </if>
  1096. <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
  1097. and twf.f_bsdate &lt;= #{fBsdateList[1]}
  1098. </if>
  1099. <if test='fReviewDateList != null and fReviewDateList[0] != null and fReviewDateList[0]!= ""'>
  1100. and twf.f_review_date &gt;= #{fReviewDateList[0]}
  1101. </if>
  1102. <if test='fReviewDateList != null and fReviewDateList[1] != null and fReviewDateList[1]!= ""'>
  1103. and twf.f_review_date &lt;= #{fReviewDateList[1]}
  1104. </if>
  1105. </where>
  1106. GROUP BY
  1107. feeName
  1108. </select>
  1109. <select id="getCorpid" resultType="long">
  1110. SELECT f_corpid FROM t_warehousebillsfees where f_id in
  1111. <foreach item="fId" collection="fIds" open="(" separator="," close=")">
  1112. #{fId}
  1113. </foreach>
  1114. </select>
  1115. <select id="selectTWarehousebillsfeesList1" resultType="java.util.Map">
  1116. SELECT
  1117. tw.f_id AS fId,
  1118. tw.f_pid AS fPid,
  1119. tw.f_lineno AS fLineno,
  1120. tw.f_corpid AS fCorpid,
  1121. tw.f_feeid AS fFeeid,
  1122. tw.f_warehouseid AS fWarehouseid,
  1123. tw.f_feeUnitid AS fFeeUnitid,
  1124. tw.f_qty AS fQty,
  1125. tw.f_unitprice AS fUnitprice,
  1126. tw.f_amount AS fAmount,
  1127. tw.f_currency AS fCurrency,
  1128. tw.f_exrate AS fExrate,
  1129. tw.f_taxrate AS fTaxrate,
  1130. CASE
  1131. WHEN tw.f_taxrate = 0 THEN
  1132. '0.00%'
  1133. WHEN tw.f_taxrate != 0 THEN
  1134. CONCAT( tw.f_taxrate, '%' )
  1135. END AS f_taxratestr,
  1136. tw.f_dc AS fDc,
  1137. tw.f_billstatus AS fBillstatus,
  1138. tw.f_review_date AS fReviewDate,
  1139. tw.f_statement_no AS fStatementNo,
  1140. tw.f_accamount AS fAccamount,
  1141. tw.f_stlamount AS fStlamount,
  1142. tw.f_accamount_date AS fAccamountDate,
  1143. tw.f_stlamount_no AS fStlamountNo,
  1144. tw.f_askamount AS fAskamount,
  1145. tw.f_status AS f_status,
  1146. tw.f_stlamount_date AS fStlamountDate,
  1147. tw.del_flag AS delFlag,
  1148. tw.create_by AS createBy,
  1149. tw.create_time AS createTime,
  1150. tw.update_by AS updateBy,
  1151. tw.update_time AS updateTime,
  1152. tw.remark AS remark,
  1153. tw.src_id AS srcId,
  1154. tw.src_bill_no AS srcBillNo,
  1155. tw.f_mblno AS fMblno,
  1156. tw.f_product_name AS fProductName,
  1157. tw.f_marks AS fMarks,
  1158. tw.f_chargedate AS fChargedate,
  1159. tw.f_billing_deadline AS fBillingDeadline,
  1160. tw.f_inventory_days AS fInventoryDays,
  1161. tw.f_amt AS fAmt,
  1162. tw.f_billing_days AS fBillingDays,
  1163. tw.f_billing_qty AS fBillingQty,
  1164. tw.f_billtype AS fBilltype,
  1165. tw.f_billingway AS fBillingway,
  1166. tw.f_bsdate AS fBsdate,
  1167. tw.f_originalbilldate AS fOriginalbilldate,
  1168. tw.f_stltypeid AS fStltypeid,
  1169. tw.f_business_type AS fBusinessType,
  1170. tw.f_src_type_id AS fSrcTypeTd,
  1171. tw.price_date_remarks AS priceDateRemarks,
  1172. tw.f_address_name AS fAddress_name,
  1173. tw.f_address AS fAddress,
  1174. tw.f_invnos AS fInvnos,
  1175. tw.f_invamount AS fInvamount,
  1176. tw.f_invoicing_date AS fInvoicingDate
  1177. FROM
  1178. t_warehousebillsfees tw
  1179. <where>
  1180. <if test="fPid != null ">and tw.f_pid = #{fPid}</if>
  1181. <if test="fLineno != null ">and tw.f_lineno = #{fLineno}</if>
  1182. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  1183. <if test="fFeeid != null ">and tw.f_feeid = #{fFeeid}</if>
  1184. <if test="fFeeunitid != null ">and tw.f_feeUnitid = #{fFeeunitid}</if>
  1185. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  1186. <if test="fUnitprice != null ">and tw.f_unitprice = #{fUnitprice}</if>
  1187. <if test="fAmount != null ">and tw.f_amount = #{fAmount}</if>
  1188. <if test="fCurrency != null and fCurrency != ''">and tw.f_currency = #{fCurrency}</if>
  1189. <if test="fExrate != null ">and tw.f_exrate = #{fExrate}</if>
  1190. <if test="fTaxrate != null ">and tw.f_taxrate = #{fTaxrate}</if>
  1191. <if test="fDc != null and fDc != ''">and tw.f_dc = #{fDc}</if>
  1192. <if test="fBillstatus != null and fBillstatus != ''">and tw.f_billstatus = #{fBillstatus}</if>
  1193. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  1194. <if test="fStatementNo != null and fStatementNo != ''">and f_statement_no = #{fStatementNo}</if>
  1195. <if test="fAccamount != null ">and tw.f_accamount = #{fAccamount}</if>
  1196. <if test="fStlamount != null ">and tw.f_stlamount = #{fStlamount}</if>
  1197. <if test="fAccamountDate != null ">and tw.f_accamount_date = #{fAccamountDate}</if>
  1198. <if test="fInvnos != null and fInvnos != ''">and tw.f_invnos = #{fInvnos}</if>
  1199. <if test="fInvamount != null ">and tw.f_invamount = #{fInvamount}</if>
  1200. <if test="fInvoicingDate != null ">and tw.f_invoicing_date = #{fInvoicingDate}</if>
  1201. <if test="fStlamountNo != null and fStlamountNo != ''">and tw.f_stlamount_no = #{fStlamountNo}</if>
  1202. <if test="fAskamount != null ">and tw.f_askamount = #{fAskamount}</if>
  1203. <if test="fStatus != null and fStatus != ''">and tw.f_status = #{fStatus}</if>
  1204. <if test="fStlamountDate != null ">and tw.f_stlamount_date = #{fStlamountDate}</if>
  1205. <if test="srcId != null ">and tw.src_id = #{srcId}</if>
  1206. <if test="srcBillNo != null and srcBillNo != ''">and tw.src_bill_no = #{srcBillNo}</if>
  1207. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  1208. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%', #{fProductName},
  1209. '%')
  1210. </if>
  1211. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  1212. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  1213. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  1214. <if test="fInventoryDays != null ">and tw.f_inventory_days = #{fInventoryDays}</if>
  1215. <if test="fAmt != null ">and tw.f_amt = #{fAmt}</if>
  1216. <if test="fBillingDays != null ">and tw.f_billing_days = #{fBillingDays}</if>
  1217. <if test="fBillingQty != null ">and tw.f_billing_qty = #{fBillingQty}</if>
  1218. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  1219. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  1220. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  1221. <if test="fOriginalbilldate != null ">and tw.f_originalbilldate = #{fOriginalbilldate}</if>
  1222. <if test="fStltypeid != null">and tw.f_stltypeid = #{fStltypeid},</if>
  1223. <if test="fSrcTypeId != null">and tw.f_src_type_id = #{fSrcTypeId},</if>
  1224. <if test="fAddress != null">and tw.f_address = #{fAddress}</if>
  1225. <if test="fAddressName != null and fAddressName != ''">and tw.f_address_name = #{fAddressName}</if>
  1226. GROUP BY tw.f_id
  1227. </where>
  1228. </select>
  1229. </mapper>