TWhgenlegMapper.xml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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.reportManagement.mapper.TWhgenlegMapper">
  6. <resultMap type="TWhgenleg" id="TWhgenlegResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fAccyear" column="f_accyear"/>
  9. <result property="fAccmonth" column="f_accmonth"/>
  10. <result property="fCorpid" column="f_corpid"/>
  11. <result property="fMblno" column="f_mblno"/>
  12. <result property="fOriginalbillno" column="f_originalbillno"/>
  13. <result property="fWarehouseLocationid" column="f_warehouse_locationid"/>
  14. <result property="fGoodsid" column="f_goodsid"/>
  15. <result property="fChargedate" column="f_chargedate"/>
  16. <result property="fTrademodeid" column="f_trademodeid"/>
  17. <result property="fPreqty" column="f_preqty"/>
  18. <result property="fWarehouseid" column="f_warehouseid"/>
  19. <result property="fPregrossweight" column="f_pregrossweight"/>
  20. <result property="fPrenetweight" column="f_prenetweight"/>
  21. <result property="fQtyd" column="f_qtyD"/>
  22. <result property="fVolumnd" column="f_volumnD"/>
  23. <result property="fBillingway" column="f_billingway"/>
  24. <result property="fGrossweightd" column="f_grossweightD"/>
  25. <result property="fNetweightd" column="f_netweightD"/>
  26. <result property="fVolumnc" column="f_volumnC"/>
  27. <result property="fQtyc" column="f_qtyC"/>
  28. <result property="fGrossweightc" column="f_grossweightC"/>
  29. <result property="fQtyblc" column="f_qtyblc"/>
  30. <result property="fGrossweightblc" column="f_grossweightblc"/>
  31. <result property="fNetweightc" column="f_netweightC"/>
  32. <result property="fNetweightblc" column="f_netweightblc"/>
  33. <result property="fCntrno" column="f_cntrno"/>
  34. <result property="fStatus" column="f_status"/>
  35. <result property="delFlag" column="del_flag"/>
  36. <result property="createBy" column="create_by"/>
  37. <result property="fMarks" column="f_marks"/>
  38. <result property="createTime" column="create_time"/>
  39. <result property="updateBy" column="update_by"/>
  40. <result property="updateTime" column="update_time"/>
  41. <result property="remark" column="remark"/>
  42. <result property="fBusinessType" column="f_business_type"/>
  43. <result property="fOriginalbilldate" column="f_originalbilldate"/>
  44. </resultMap>
  45. <sql id="selectTWhgenlegVo">
  46. select f_id, f_accyear, f_accmonth, f_corpid, f_mblno, f_originalbillno, f_warehouse_locationid, f_goodsid, f_trademodeid, f_preqty, f_pregrossweight, f_warehouseid, f_prenetweight, f_chargedate, f_volumnD, f_qtyD, f_billingway, f_grossweightD, f_netweightD, f_volumnC, f_qtyC, f_grossweightC, f_qtyblc, f_grossweightblc, f_netweightC, f_netweightblc, f_cntrno, f_status, del_flag, f_marks, create_by, create_time, update_by, f_volumnblc, update_time, remark, f_business_type, f_originalbilldate from t_whgenleg
  47. </sql>
  48. <select id="selectTWhgenlegList" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
  49. select
  50. ware.*
  51. from
  52. t_whgenleg ware
  53. left join sys_user u on ware.create_by = u.user_name
  54. left join sys_dept d on u.dept_id = d.dept_id
  55. <where>
  56. <if test="fOriginalbillno != null and fOriginalbillno != ''">and f_originalbillno = #{fOriginalbillno}</if>
  57. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  58. <if test="fPreqty != null ">and f_preqty = #{fPreqty}</if>
  59. <if test="fWarehouseid != null ">and f_warehouseid = #{fWarehouseid}</if>
  60. <if test="fPregrossweight != null ">and f_pregrossweight = #{fPregrossweight}</if>
  61. <if test="fPrenetweight != null ">and f_prenetweight = #{fPrenetweight}</if>
  62. <if test="fQtyd != null ">and f_qtyD = #{fQtyd}</if>
  63. <if test="fVolumnd != null ">and f_volumnD = #{fVolumnd}</if>
  64. <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
  65. <if test="fGrossweightd != null ">and f_grossweightD = #{fGrossweightd}</if>
  66. <if test="fNetweightd != null ">and f_netweightD = #{fNetweightd}</if>
  67. <if test="fVolumnc != null ">and f_volumnC = #{fVolumnc}</if>
  68. <if test="fBusinessType != null "> and f_business_type = #{fBusinessType}</if>
  69. <if test="fQtyc != null ">and f_qtyC = #{fQtyc}</if>
  70. <if test="fGrossweightc != null ">and f_grossweightC = #{fGrossweightc}</if>
  71. <if test="fQtyblc != null ">and f_qtyblc = #{fQtyblc}</if>
  72. <if test="fGrossweightblc != null ">and f_grossweightblc = #{fGrossweightblc}</if>
  73. <if test="fNetweightc != null ">and f_netweightC = #{fNetweightc}</if>
  74. <if test="fNetweightblc != null ">and f_netweightblc = #{fNetweightblc}</if>
  75. <if test="fCntrno != null and fCntrno != ''">and f_cntrno = #{fCntrno}</if>
  76. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  77. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  78. <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
  79. </where>
  80. ${params.dataScope}
  81. </select>
  82. <select id="selectTWhgenleg" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
  83. <include refid="selectTWhgenlegVo"/>
  84. <where>
  85. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  86. <if test="fMblno != null ">and f_mblno = #{fMblno}</if>
  87. <if test="fCntrno != null ">and f_cntrno = #{fCntrno}</if>
  88. <if test="fBusinessType != null ">and f_business_type = #{fBusinessType}</if>
  89. <if test="fMarks != null ">and f_marks = #{fMarks}</if>
  90. <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
  91. <if test="fWarehouseLocationid != null ">and f_warehouse_locationid = #{fWarehouseLocationid}</if>
  92. <if test="fGoodsid != null ">and f_goodsid = #{fGoodsid}</if>
  93. <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
  94. <if test="fBillingway != null">and f_billingway = #{fBillingway}</if>
  95. </where>
  96. </select>
  97. <select id="selectTWhgenlegById" parameterType="Long" resultMap="TWhgenlegResult">
  98. <include refid="selectTWhgenlegVo"/>
  99. where f_id = #{fId}
  100. </select>
  101. <insert id="insertTWhgenleg" parameterType="TWhgenleg">
  102. insert into t_whgenleg
  103. <trim prefix="(" suffix=")" suffixOverrides=",">
  104. <if test="fAccyear != null">f_accyear,</if>
  105. <if test="fAccmonth != null">f_accmonth,</if>
  106. <if test="fCorpid != null">f_corpid,</if>
  107. <if test="fMblno != null">f_mblno,</if>
  108. <if test="fOriginalbillno != null">f_originalbillno,</if>
  109. <if test="fWarehouseLocationid != null">f_warehouse_locationid,</if>
  110. <if test="fGoodsid != null">f_goodsid,</if>
  111. <if test="fTrademodeid != null">f_trademodeid,</if>
  112. <if test="fPreqty != null">f_preqty,</if>
  113. <if test="fPregrossweight != null">f_pregrossweight,</if>
  114. <if test="fWarehouseid != null">f_warehouseid,</if>
  115. <if test="fPrenetweight != null">f_prenetweight,</if>
  116. <if test="fChargedate != null">f_chargedate,</if>
  117. <if test="fVolumnd != null">f_volumnD,</if>
  118. <if test="fQtyd != null">f_qtyD,</if>
  119. <if test="fBillingway != null">f_billingway,</if>
  120. <if test="fGrossweightd != null">f_grossweightD,</if>
  121. <if test="fNetweightd != null">f_netweightD,</if>
  122. <if test="fVolumnc != null">f_volumnC,</if>
  123. <if test="fQtyc != null">f_qtyC,</if>
  124. <if test="fGrossweightc != null">f_grossweightC,</if>
  125. <if test="fQtyblc != null">f_qtyblc,</if>
  126. <if test="fGrossweightblc != null">f_grossweightblc,</if>
  127. <if test="fNetweightc != null">f_netweightC,</if>
  128. <if test="fNetweightblc != null">f_netweightblc,</if>
  129. <if test="fCntrno != null">f_cntrno,</if>
  130. <if test="fStatus != null">f_status,</if>
  131. <if test="delFlag != null">del_flag,</if>
  132. <if test="fMarks != null and fMarks != ''">f_marks,</if>
  133. <if test="createBy != null">create_by,</if>
  134. <if test="createTime != null">create_time,</if>
  135. <if test="updateBy != null">update_by,</if>
  136. <if test="fVolumnblc != null">f_volumnblc,</if>
  137. <if test="updateTime != null">update_time,</if>
  138. <if test="remark != null">remark,</if>
  139. <if test="fBusinessType != null">f_business_type,</if>
  140. <if test="fOriginalbilldate != null">f_originalbilldate,</if>
  141. </trim>
  142. <trim prefix="values (" suffix=")" suffixOverrides=",">
  143. <if test="fAccyear != null">#{fAccyear},</if>
  144. <if test="fAccmonth != null">#{fAccmonth},</if>
  145. <if test="fCorpid != null">#{fCorpid},</if>
  146. <if test="fMblno != null">#{fMblno},</if>
  147. <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
  148. <if test="fWarehouseLocationid != null">#{fWarehouseLocationid},</if>
  149. <if test="fGoodsid != null">#{fGoodsid},</if>
  150. <if test="fTrademodeid != null">#{fTrademodeid},</if>
  151. <if test="fPreqty != null">#{fPreqty},</if>
  152. <if test="fPregrossweight != null">#{fPregrossweight},</if>
  153. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  154. <if test="fPrenetweight != null">#{fPrenetweight},</if>
  155. <if test="fChargedate != null">#{fChargedate},</if>
  156. <if test="fVolumnd != null">#{fVolumnd},</if>
  157. <if test="fQtyd != null">#{fQtyd},</if>
  158. <if test="fBillingway != null">#{fBillingway},</if>
  159. <if test="fGrossweightd != null">#{fGrossweightd},</if>
  160. <if test="fNetweightd != null">#{fNetweightd},</if>
  161. <if test="fVolumnc != null">#{fVolumnc},</if>
  162. <if test="fQtyc != null">#{fQtyc},</if>
  163. <if test="fGrossweightc != null">#{fGrossweightc},</if>
  164. <if test="fQtyblc != null">#{fQtyblc},</if>
  165. <if test="fGrossweightblc != null">#{fGrossweightblc},</if>
  166. <if test="fNetweightc != null">#{fNetweightc},</if>
  167. <if test="fNetweightblc != null">#{fNetweightblc},</if>
  168. <if test="fCntrno != null">#{fCntrno},</if>
  169. <if test="fStatus != null">#{fStatus},</if>
  170. <if test="delFlag != null">#{delFlag},</if>
  171. <if test="fMarks != null and fMarks != ''">#{fMarks},</if>
  172. <if test="createBy != null">#{createBy},</if>
  173. <if test="createTime != null">#{createTime},</if>
  174. <if test="updateBy != null">#{updateBy},</if>
  175. <if test="fVolumnblc != null">#{fVolumnblc},</if>
  176. <if test="updateTime != null">#{updateTime},</if>
  177. <if test="remark != null">#{remark},</if>
  178. <if test="fBusinessType != null">#{fBusinessType},</if>
  179. <if test="fOriginalbilldate != null">#{fOriginalbilldate},</if>
  180. </trim>
  181. </insert>
  182. <update id="updateTWhgenleg" parameterType="TWhgenleg">
  183. update t_whgenleg
  184. <trim prefix="SET" suffixOverrides=",">
  185. <if test="fAccyear != null">f_accyear = #{fAccyear},</if>
  186. <if test="fAccmonth != null">f_accmonth = #{fAccmonth},</if>
  187. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  188. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  189. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  190. <if test="fWarehouseLocationid != null">f_warehouse_locationid = #{fWarehouseLocationid},</if>
  191. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  192. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  193. <if test="fPreqty != null">f_preqty = #{fPreqty},</if>
  194. <if test="fPregrossweight != null">f_pregrossweight = #{fPregrossweight},</if>
  195. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  196. <if test="fPrenetweight != null">f_prenetweight = #{fPrenetweight},</if>
  197. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  198. <if test="fVolumnd != null">f_volumnD = #{fVolumnd},</if>
  199. <if test="fQtyd != null">f_qtyD = #{fQtyd},</if>
  200. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  201. <if test="fGrossweightd != null">f_grossweightD = #{fGrossweightd},</if>
  202. <if test="fNetweightd != null">f_netweightD = #{fNetweightd},</if>
  203. <if test="fVolumnc != null">f_volumnC = #{fVolumnc},</if>
  204. <if test="fQtyc != null">f_qtyC = #{fQtyc},</if>
  205. <if test="fGrossweightc != null">f_grossweightC = #{fGrossweightc},</if>
  206. <if test="fQtyblc != null">f_qtyblc = #{fQtyblc},</if>
  207. <if test="fGrossweightblc != null">f_grossweightblc = #{fGrossweightblc},</if>
  208. <if test="fNetweightc != null">f_netweightC = #{fNetweightc},</if>
  209. <if test="fNetweightblc != null">f_netweightblc = #{fNetweightblc},</if>
  210. <if test="fCntrno != null">f_cntrno = #{fCntrno},</if>
  211. <if test="fStatus != null">f_status = #{fStatus},</if>
  212. <if test="delFlag != null">del_flag = #{delFlag},</if>
  213. <if test="fMarks != null and fMarks != ''">f_marks = #{fMarks},</if>
  214. <if test="createBy != null">create_by = #{createBy},</if>
  215. <if test="createTime != null">create_time = #{createTime},</if>
  216. <if test="updateBy != null">update_by = #{updateBy},</if>
  217. <if test="fVolumnblc != null">f_volumnblc = #{fVolumnblc},</if>
  218. <if test="updateTime != null">update_time = #{updateTime},</if>
  219. <if test="remark != null">remark = #{remark},</if>
  220. <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
  221. <if test="fOriginalbilldate != null">f_originalbilldate = #{fOriginalbilldate},</if>
  222. </trim>
  223. where f_id = #{fId}
  224. </update>
  225. <update id="updateTWhgenlegData" parameterType="Map">
  226. update t_whgenleg
  227. <trim prefix="SET" suffixOverrides=",">
  228. /*判断是否入库*/
  229. <if test="map.billType == 'SJRK'">
  230. f_qtyD = f_qtyD + #{map.warehousebillsitems.fQty},
  231. f_volumnD = f_volumnD + #{map.warehousebillsitems.fVolumn},
  232. f_netweightD = f_netweightD + #{map.warehousebillsitems.fNetweight},
  233. f_grossweightD = f_grossweightD + #{map.warehousebillsitems.fGrossweight},
  234. f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
  235. </if>
  236. /*判断是否撤销入库*/
  237. <if test="map.billType == 'SJRKRevoke'">
  238. f_qtyD = f_qtyD - #{map.warehousebillsitems.fQty},
  239. f_volumnD = f_volumnD - #{map.warehousebillsitems.fVolumn},
  240. f_netweightD = f_netweightD - #{map.warehousebillsitems.fNetweight},
  241. f_grossweightD = f_grossweightD - #{map.warehousebillsitems.fGrossweight},
  242. f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
  243. </if>
  244. /*判断是否出库*/
  245. <if test="map.billType == 'SJCK'">
  246. f_qtyC = f_qtyC + #{map.warehousebillsitems.fQty},
  247. f_volumnC = f_volumnC + #{map.warehousebillsitems.fVolumn},
  248. f_netweightC = f_netweightC + #{map.warehousebillsitems.fNetweight},
  249. f_grossweightC = f_grossweightC + #{map.warehousebillsitems.fGrossweight},
  250. f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
  251. </if>
  252. /*判断是否撤销出库*/
  253. <if test="map.billType == 'SJCKRevoke'">
  254. f_qtyC = f_qtyC - #{map.warehousebillsitems.fQty},
  255. f_volumnC = f_volumnC - #{map.warehousebillsitems.fVolumn},
  256. f_netweightC = f_netweightC - #{map.warehousebillsitems.fNetweight},
  257. f_grossweightC = f_grossweightC - #{map.warehousebillsitems.fGrossweight},
  258. f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
  259. </if>
  260. -- update_by = NOW()
  261. </trim>
  262. where f_id = #{map.whgenlegId}
  263. </update>
  264. <!--修改安品的库存总账-->
  265. <update id="anPinUpdateTWhgenlegData" parameterType="Map">
  266. update t_whgenleg
  267. <trim prefix="SET" suffixOverrides=",">
  268. /*判断是否入库*/
  269. <if test="map.billType == 'RK'">
  270. f_volumnD = f_volumnD + #{map.warehousebillsitems.fQty},
  271. f_grossweightD = f_grossweightD + #{map.warehousebillsitems.fAmount}
  272. </if>
  273. /*判断是否撤销入库*/
  274. <if test="map.billType == 'RKRevoke'">
  275. f_volumnD = f_volumnD - #{map.warehousebillsitems.fQty},
  276. f_grossweightD = f_grossweightD - #{map.warehousebillsitems.fAmount}
  277. </if>
  278. /*判断是否出库*/
  279. <if test="map.billType == 'CK'">
  280. f_netweightC = f_netweightC + #{map.warehousebillsitems.fQty},
  281. f_grossweightC = f_grossweightC + #{map.warehousebillsitems.fAmount}
  282. </if>
  283. /*判断是否撤销出库*/
  284. <if test="map.billType == 'CKRevoke'">
  285. f_netweightC = f_netweightC - #{map.warehousebillsitems.fQty},
  286. f_grossweightC = f_grossweightC - #{map.warehousebillsitems.fAmount}
  287. </if>
  288. -- update_by = NOW()
  289. </trim>
  290. where f_id = #{map.whgenlegId}
  291. </update>
  292. <delete id="deleteTWhgenlegById" parameterType="Long">
  293. delete from t_whgenleg where f_id = #{fId}
  294. </delete>
  295. <delete id="deleteTWhgenlegByIds" parameterType="String">
  296. delete from t_whgenleg where f_id in
  297. <foreach item="fAccyear" collection="array" open="(" separator="," close=")">
  298. #{fId}
  299. </foreach>
  300. </delete>
  301. <select id="selectGoodsList" resultType="Map">
  302. SELECT
  303. t.f_goodsid AS fGoodsid,
  304. g.f_name AS fName
  305. FROM
  306. t_goods g
  307. RIGHT JOIN (
  308. SELECT
  309. f_goodsid AS f_goodsid
  310. FROM
  311. t_whgenleg
  312. GROUP BY
  313. f_goodsid
  314. ) t ON g.f_id = t.f_goodsid
  315. </select>
  316. <select id="selectGoodsListWhouse" resultType="Map">
  317. SELECT
  318. t.f_goodsid AS fGoodsid,
  319. g.f_name AS fName,
  320. w.f_name AS fWarehouseName,
  321. w.f_totalgross AS fTotalgross,
  322. t.f_grossweightblc AS fGrossweightD
  323. FROM
  324. t_goods g
  325. RIGHT JOIN (
  326. SELECT
  327. f_goodsid AS f_goodsid,
  328. f_warehouseid AS f_warehouseid,
  329. sum( f_grossweightblc ) AS f_grossweightblc
  330. FROM
  331. t_whgenleg
  332. GROUP BY
  333. f_goodsid,
  334. f_warehouseid
  335. ORDER BY
  336. sum( f_grossweightblc ) DESC
  337. ) t ON g.f_id = t.f_goodsid
  338. LEFT JOIN t_warehouse w ON w.f_id = t.f_warehouseid
  339. <where>
  340. <if test="fId != null ">and w.f_id = #{fId}</if>
  341. </where>
  342. </select>
  343. <select id="selectWareHouseList" resultType="Map">
  344. SELECT
  345. t.f_warehouseid AS fWarehouseid,
  346. w.f_name AS fName,
  347. t.f_grossweightblc AS fGrossweightD,
  348. w.f_totalgross AS fTotalgross
  349. FROM
  350. t_warehouse w
  351. RIGHT JOIN (
  352. SELECT
  353. f_warehouseid AS f_warehouseid,
  354. sum( f_grossweightblc ) AS f_grossweightblc
  355. FROM
  356. t_whgenleg
  357. GROUP BY
  358. f_warehouseid
  359. ORDER BY
  360. sum( f_grossweightblc ) DESC
  361. ) t ON w.f_id = t.f_warehouseid
  362. </select>
  363. <select id="selectWareHouseListWhouse" resultType="Map">
  364. SELECT
  365. t.f_warehouseid AS fWarehouseid,
  366. w.f_name AS fName,
  367. t.f_grossweightblc AS fGrossweightD,
  368. w.f_totalgross AS fTotalgross
  369. FROM
  370. t_warehouse w
  371. RIGHT JOIN (
  372. SELECT
  373. f_warehouseid AS f_warehouseid,
  374. sum( f_grossweightblc ) AS f_grossweightblc
  375. FROM
  376. t_whgenleg
  377. GROUP BY
  378. f_warehouseid
  379. ORDER BY
  380. sum( f_grossweightblc ) DESC
  381. ) t ON w.f_id = t.f_warehouseid
  382. <where>
  383. <if test="fId != null ">and w.f_id = #{fId}</if>
  384. </where>
  385. </select>
  386. <select id="selectCorpsList" resultType="Map">
  387. SELECT
  388. t.f_corpid AS fCorpid,
  389. c.f_name AS fName
  390. FROM
  391. t_corps c
  392. RIGHT JOIN (
  393. SELECT
  394. f_corpid AS f_corpid
  395. FROM
  396. t_whgenleg
  397. GROUP BY
  398. f_corpid
  399. ) t ON c.f_id = t.f_corpid
  400. </select>
  401. <select id="selectCorpsListWhouse" resultType="Map">
  402. SELECT
  403. t.f_corpid AS fCorpid,
  404. g.f_name AS fName,
  405. w.f_name AS fWarehouseName,
  406. w.f_totalgross AS fTotalgross,
  407. t.f_grossweightblc AS fGrossweightD
  408. FROM
  409. t_corps g
  410. RIGHT JOIN (
  411. SELECT
  412. f_corpid AS f_corpid,
  413. f_warehouseid AS f_warehouseid,
  414. sum( f_grossweightblc ) AS f_grossweightblc
  415. FROM
  416. t_whgenleg
  417. GROUP BY
  418. f_corpid,
  419. f_warehouseid
  420. ORDER BY
  421. sum( f_grossweightblc ) DESC
  422. ) t ON g.f_id = t.f_corpid
  423. LEFT JOIN t_warehouse w ON w.f_id = t.f_warehouseid
  424. <where>
  425. <if test="fId != null ">and w.f_id = #{fId}</if>
  426. </where>
  427. </select>
  428. <select id="selectDateFQtyblcListList" resultType="Map">
  429. SELECT
  430. t.f_originalbilldate AS fOriginalbilldate,
  431. sum(t.f_qtyblc) AS fQtyblc
  432. FROM
  433. t_whgenleg t
  434. WHERE
  435. t.f_originalbilldate &gt; #{map.frontday}
  436. AND t.f_originalbilldate &lt; #{map.nowadays}
  437. GROUP BY
  438. t.f_originalbilldate
  439. ORDER BY
  440. t.f_originalbilldate
  441. </select>
  442. <select id="selectStorageFeeItemList" parameterType="com.ruoyi.warehouseBusiness.domain.TWarehouseBills" resultType="Map">
  443. SELECT
  444. wh.f_id AS fId,
  445. wh.f_originalbillno AS fBillno,
  446. wh.f_goodsid AS fGoodsid,
  447. wh.f_originalbilldate AS fBsdate,
  448. wh.f_billingway AS fBillingway,
  449. wh.f_mblno AS fMblno,
  450. wh.f_chargedate AS fChargedate,
  451. wh.f_originalbilldate AS fOriginalbilldate,
  452. wh.f_marks AS fMarks,
  453. wh.f_volumnblc AS fVolumn,
  454. wh.f_qtyblc AS fQty,
  455. wh.f_grossweightblc AS fGrossweight,
  456. wh.f_netweightblc AS fNetweight,
  457. "KCZZ" AS fBilltype,
  458. goods.f_typeid AS fTypeid,
  459. goods.f_name AS fGoodsids
  460. FROM
  461. t_whgenleg wh
  462. LEFT JOIN t_goods goods ON goods.f_id = wh.f_goodsid
  463. LEFT JOIN t_warehouse ware ON ware.f_id = wh.f_warehouseid
  464. <where>
  465. wh.f_corpid = #{warehouse.fCorpid}
  466. and ware.f_charg = 1
  467. and wh.f_chargedate &lt; #{warehouse.fBillingDeadline}
  468. <if test="warehouse.fGoodsid != null">and wh.f_goodsid = #{warehouse.fGoodsid}</if>
  469. <if test="warehouse.fMblno != null">and wh.f_mblno = #{warehouse.fMblno}</if>
  470. </where>
  471. </select>
  472. <select id="selectInventoryList" parameterType="TWhgenleg" resultType="Map">
  473. select
  474. DISTINCT
  475. leg.f_id AS fId,
  476. leg.f_corpid AS fCorpIds,
  477. corp.f_name AS fCorpid,
  478. ware.f_warehouse_information AS fWarehouseids,
  479. area.f_name AS fWarehouseLocationids,
  480. leg.f_originalbillno AS fOriginalbillno,
  481. leg.f_warehouse_locationid AS fWarehouseLocationid,
  482. dict1.dict_label AS fTrademodeid,
  483. goods.f_name AS fGoodsids,
  484. leg.f_trademodeid AS fTrademodeids,
  485. goods.f_packagespecs AS fPackagespecs,
  486. leg.f_goodsid AS fGoodsid,
  487. leg.f_volumnD AS fVolumnD,
  488. leg.f_qtyD AS fQtyD,
  489. leg.f_mblno AS fMblno,
  490. leg.f_grossweightD AS fGrossweightD,
  491. leg.f_netweightD AS fNetweightD,
  492. leg.f_volumnC AS fVolumnC,
  493. leg.f_volumnblc AS fVolumnblc,
  494. leg.f_qtyC AS fQtyC,
  495. leg.f_business_type AS fBusinessType,
  496. leg.f_grossweightC AS fGrossweightC,
  497. leg.f_netweightC AS fNetweightC,
  498. leg.f_qtyblc AS fQtyblc,
  499. leg.f_billingway AS fBillingway,
  500. leg.f_chargedate AS fChargedate,
  501. leg.f_grossweightblc AS fGrossweightblc,
  502. leg.f_netweightblc AS fNetweightblc,
  503. dict.dict_label AS fBusinessTypes,
  504. leg.f_marks AS fMarks,
  505. DATE_FORMAT( leg.create_time, '%Y-%m-%d' ) AS createTime,
  506. DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
  507. leg.f_cntrno AS fCntrno
  508. FROM
  509. t_whgenleg leg
  510. left join sys_user u on leg.create_by = u.user_name
  511. left join sys_dept d on u.dept_id = d.dept_id
  512. LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
  513. LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
  514. LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid
  515. LEFT JOIN sys_dict_data dict ON dict.dict_value = leg.f_business_type
  516. LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
  517. LEFT JOIN sys_dict_data dict1 ON dict1.dict_value = leg.f_trademodeid
  518. <where>
  519. dict.status = '0'
  520. AND dict1.status = '0'
  521. AND dict.dict_type = 'storage_type'
  522. AND dict1.dict_type = 'data_trademodes'
  523. <if test="fOriginalbillno != null and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
  524. <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
  525. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  526. <if test="fMblno != null ">and leg.f_mblno LIKE concat('%', #{fMblno}, '%') </if>
  527. <if test='orgStorageDate != null and orgStorageDate[0] != null and orgStorageDate[0]!= ""'>
  528. and leg.f_originalbilldate &gt;= #{orgStorageDate[0]}
  529. </if>
  530. <if test='orgStorageDate != null and orgStorageDate[1] != null and orgStorageDate[1]!= ""'>
  531. and leg.f_originalbilldate &lt;= #{orgStorageDate[1]}
  532. </if>
  533. <if test="fPregrossweight != null ">and leg.f_pregrossweight = #{fPregrossweight}</if>
  534. <if test="fPrenetweight != null ">and leg.f_prenetweight = #{fPrenetweight}</if>
  535. <if test="fQtyd != null ">and leg.f_qtyD = #{fQtyd}</if>
  536. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  537. <if test="fGoodsid != null ">and leg.f_goodsid = #{fGoodsid}</if>
  538. <if test="fVolumnd != null ">and leg.f_volumnD = #{fVolumnd}</if>
  539. <if test="fGrossweightd != null ">and leg.f_grossweightD = #{fGrossweightd}</if>
  540. <if test="fNetweightd != null ">and leg.f_netweightD = #{fNetweightd}</if>
  541. <if test="fVolumnc != null ">and leg.f_volumnC = #{fVolumnc}</if>
  542. <if test="fQtyc != null ">and leg.f_qtyC = #{fQtyc}</if>
  543. <if test="fOriginalbilldate != null ">and leg.f_originalbilldate = #{fOriginalbilldate}</if>
  544. <if test="fMarks != null and fMarks != ''">and leg.f_marks = #{fMarks}</if>
  545. <if test="fQtyblc != null ">and leg.f_qtyblc = #{fQtyblc}</if>
  546. <if test="fGrossweightc != null ">and leg.f_grossweightC = #{fGrossweightc}</if>
  547. <if test="fNetweightc != null ">and leg.f_netweightC = #{fNetweightc}</if>
  548. <if test="fGrossweightblc != null ">and leg.f_grossweightblc = #{fGrossweightblc}</if>
  549. <if test="fNetweightblc != null ">and leg.f_netweightblc = #{fNetweightblc}</if>
  550. <if test="fCntrno != null and fCntrno != ''">and leg.f_cntrno = #{fCntrno}</if>
  551. <if test="fStatus != null and fStatus != ''">and leg.f_status = #{fStatus}</if>
  552. <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid} </if>
  553. <if test="fLocation != null and fLocation ==1 ">
  554. and leg.f_warehouse_locationid = #{fWarehouseLocationid}
  555. </if>
  556. <if test="fLocation != null and fLocation ==0 ">
  557. and ware.ancestors LIKE concat('%', #{fWarehouseLocationid}, '%')
  558. </if>
  559. </where>
  560. ${params.dataScope}
  561. </select>
  562. <select id="selectWhgenlegList" resultType="java.util.Map">
  563. select
  564. DISTINCT
  565. leg.f_id AS fId,
  566. corp.f_name AS fCorpid,
  567. DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
  568. ware.f_warehouse_information AS fWarehouseids,
  569. leg.f_mblno AS fMblno,
  570. goods.f_name AS fGoodsids,
  571. dict.dict_label AS fBusinessTypes,
  572. leg.f_marks AS fMarks,
  573. leg.f_qtyblc AS fQtyblc,
  574. leg.f_grossweightblc AS fGrossweightblc,
  575. leg.f_netweightblc AS fNetweightblc
  576. FROM
  577. t_whgenleg leg
  578. LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
  579. LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
  580. LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid
  581. LEFT JOIN sys_dict_data dict ON dict.dict_value = leg.f_business_type
  582. LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
  583. <where>
  584. dict.status = '0'
  585. AND dict.dict_type = 'storage_type'
  586. <if test="fOriginalbillno != null and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
  587. <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
  588. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  589. <if test="fMblno != null ">and leg.f_mblno LIKE concat('%', #{fMblno}, '%') </if>
  590. <if test='timeStartBsdate != null and timeStartBsdate!= ""'>
  591. and leg.f_originalbilldate &gt;= #{timeStartBsdate}
  592. </if>
  593. <if test='timeEndBsdate != null timeEndBsdate!= ""'>
  594. and leg.f_originalbilldate &lt;= #{timeEndBsdate}
  595. </if>
  596. <if test="fPregrossweight != null ">and leg.f_pregrossweight = #{fPregrossweight}</if>
  597. <if test="fPrenetweight != null ">and leg.f_prenetweight = #{fPrenetweight}</if>
  598. <if test="fQtyd != null ">and leg.f_qtyD = #{fQtyd}</if>
  599. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  600. <if test="fGoodsid != null ">and leg.f_goodsid = #{fGoodsid}</if>
  601. <if test="fVolumnd != null ">and leg.f_volumnD = #{fVolumnd}</if>
  602. <if test="fGrossweightd != null ">and leg.f_grossweightD = #{fGrossweightd}</if>
  603. <if test="fNetweightd != null ">and leg.f_netweightD = #{fNetweightd}</if>
  604. <if test="fVolumnc != null ">and leg.f_volumnC = #{fVolumnc}</if>
  605. <if test="fQtyc != null ">and leg.f_qtyC = #{fQtyc}</if>
  606. <if test="fOriginalbilldate != null ">and leg.f_originalbilldate = #{fOriginalbilldate}</if>
  607. <if test="fMarks != null and fMarks != ''">and leg.f_marks = #{fMarks}</if>
  608. <if test="fQtyblc != null ">and leg.f_qtyblc = #{fQtyblc}</if>
  609. <if test="fGrossweightc != null ">and leg.f_grossweightC = #{fGrossweightc}</if>
  610. <if test="fNetweightc != null ">and leg.f_netweightC = #{fNetweightc}</if>
  611. <if test="fGrossweightblc != null ">and leg.f_grossweightblc = #{fGrossweightblc}</if>
  612. <if test="fNetweightblc != null ">and leg.f_netweightblc = #{fNetweightblc}</if>
  613. <if test="fCntrno != null and fCntrno != ''">and leg.f_cntrno = #{fCntrno}</if>
  614. <if test="fStatus != null and fStatus != ''">and leg.f_status = #{fStatus}</if>
  615. <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid} </if>
  616. <if test="fLocation != null and fLocation ==1 ">
  617. and leg.f_warehouse_locationid = #{fWarehouseLocationid}
  618. </if>
  619. <if test="fLocation != null and fLocation ==0 ">
  620. and ware.ancestors LIKE concat('%', #{fWarehouseLocationid}, '%')
  621. </if>
  622. </where>
  623. </select>
  624. </mapper>