TWhgenlegMapper.xml 34 KB

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