TWhgenlegMapper.xml 37 KB

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