TWhgenlegMapper.xml 39 KB

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