TWhgenlegMapper.xml 26 KB

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