TWarehousebillsfeesMapper.xml 49 KB

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