TWarehousebillsfeesMapper.xml 60 KB

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