TWhgenlegMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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="fAccyear" column="f_accyear"/>
  8. <result property="fId" column="f_id"/>
  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="fTrademodeid" column="f_trademodeid"/>
  16. <result property="fPreqty" column="f_preqty"/>
  17. <result property="fWarehouseid" column="f_warehouseid"/>
  18. <result property="fPregrossweight" column="f_pregrossweight"/>
  19. <result property="fPrenetweight" column="f_prenetweight"/>
  20. <result property="fQtyd" column="f_qtyD"/>
  21. <result property="fVolumnd" column="f_volumnD"/>
  22. <result property="fGrossweightd" column="f_grossweightD"/>
  23. <result property="fNetweightd" column="f_netweightD"/>
  24. <result property="fVolumnc" column="f_volumnC"/>
  25. <result property="fQtyc" column="f_qtyC"/>
  26. <result property="fQtyblc" column="f_qtyblc"/>
  27. <result property="fGrossweightc" column="f_grossweightC"/>
  28. <result property="fNetweightc" column="f_netweightC"/>
  29. <result property="fGrossweightblc" column="f_grossweightblc"/>
  30. <result property="fNetweightblc" column="f_netweightblc"/>
  31. <result property="fCntrno" column="f_cntrno"/>
  32. <result property="fMarks" column="f_marks"/>
  33. <result property="fStatus" column="f_status"/>
  34. <result property="delFlag" column="del_flag"/>
  35. <result property="createBy" column="create_by"/>
  36. <result property="createTime" column="create_time"/>
  37. <result property="updateBy" column="update_by"/>
  38. <result property="updateTime" column="update_time"/>
  39. <result property="remark" column="remark"/>
  40. </resultMap>
  41. <sql id="selectTWhgenlegVo">
  42. select f_accyear, f_id, f_accmonth, f_corpid, f_mblno, f_warehouseid, f_originalbillno, f_marks, f_warehouse_locationid, f_goodsid, f_trademodeid, f_preqty, f_pregrossweight, f_prenetweight, f_qtyD, f_volumnD, f_grossweightD, f_netweightD, f_volumnC, f_qtyC, f_qtyblc, f_grossweightC, f_netweightC, f_grossweightblc, f_netweightblc, f_cntrno, f_status, del_flag, create_by, create_time, update_by, update_time, remark from t_whgenleg
  43. </sql>
  44. <select id="selectTWhgenlegList" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
  45. <include refid="selectTWhgenlegVo"/>
  46. <where>
  47. <if test="fOriginalbillno != null and fOriginalbillno != ''">and f_originalbillno = #{fOriginalbillno}</if>
  48. <if test="fPreqty != null ">and f_preqty = #{fPreqty}</if>
  49. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  50. <if test="fMblno != null ">and f_mblno = #{fMblno}</if>
  51. <if test="fPregrossweight != null ">and f_pregrossweight = #{fPregrossweight}</if>
  52. <if test="fPrenetweight != null ">and f_prenetweight = #{fPrenetweight}</if>
  53. <if test="fQtyd != null ">and f_qtyD = #{fQtyd}</if>
  54. <if test="fVolumnd != null ">and f_volumnD = #{fVolumnd}</if>
  55. <if test="fWarehouseid != null ">and f_warehouseid = #{fWarehouseid}</if>
  56. <if test="fGrossweightd != null ">and f_grossweightD = #{fGrossweightd}</if>
  57. <if test="fNetweightd != null ">and f_netweightD = #{fNetweightd}</if>
  58. <if test="fVolumnc != null ">and f_volumnC = #{fVolumnc}</if>
  59. <if test="fQtyc != null ">and f_qtyC = #{fQtyc}</if>
  60. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  61. <if test="fQtyblc != null ">and f_qtyblc = #{fQtyblc}</if>
  62. <if test="fGrossweightc != null ">and f_grossweightC = #{fGrossweightc}</if>
  63. <if test="fNetweightc != null ">and f_netweightC = #{fNetweightc}</if>
  64. <if test="fGrossweightblc != null ">and f_grossweightblc = #{fGrossweightblc}</if>
  65. <if test="fNetweightblc != null ">and f_netweightblc = #{fNetweightblc}</if>
  66. <if test="fCntrno != null and fCntrno != ''">and f_cntrno = #{fCntrno}</if>
  67. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  68. </where>
  69. </select>
  70. <select id="selectInventoryList" parameterType="TWhgenleg" resultType="Map">
  71. select
  72. leg.f_id AS fId,
  73. corp.f_name AS fCorpid,
  74. area.f_name AS fWarehouseLocationid,
  75. leg.f_warehouse_locationid AS fWarehouseLocationids,
  76. leg.f_trademodeid AS fTrademodeid,
  77. goods.f_name AS fGoodsid,
  78. leg.f_goodsid AS fGoodsids,
  79. leg.f_volumnD AS fVolumnD,
  80. leg.f_qtyD AS fQtyD,
  81. leg.f_mblno AS fMblno,
  82. leg.f_grossweightD AS fGrossweightD,
  83. leg.f_netweightD AS fNetweightD,
  84. leg.f_volumnC AS fVolumnC,
  85. leg.f_qtyC AS fQtyC,
  86. leg.f_grossweightC AS fGrossweightC,
  87. leg.f_netweightC AS fNetweightC,
  88. leg.f_qtyblc AS fQtyblc,
  89. leg.f_grossweightblc AS fGrossweightblc,
  90. leg.f_netweightblc AS fNetweightblc,
  91. leg.f_marks AS fMarks,
  92. DATE_FORMAT( leg.create_time, '%Y-%m-%d' ) AS createTime,
  93. leg.f_cntrno AS fCntrno
  94. FROM
  95. t_whgenleg leg
  96. LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
  97. LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
  98. LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
  99. <where>
  100. <if test="fOriginalbillno != null and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
  101. <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
  102. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  103. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  104. <if test="fPregrossweight != null ">and leg.f_pregrossweight = #{fPregrossweight}</if>
  105. <if test="fPrenetweight != null ">and leg.f_prenetweight = #{fPrenetweight}</if>
  106. <if test="fQtyd != null ">and leg.f_qtyD = #{fQtyd}</if>
  107. <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid}</if>
  108. <if test="fVolumnd != null ">and leg.f_volumnD = #{fVolumnd}</if>
  109. <if test="fGrossweightd != null ">and leg.f_grossweightD = #{fGrossweightd}</if>
  110. <if test="fNetweightd != null ">and leg.f_netweightD = #{fNetweightd}</if>
  111. <if test="fVolumnc != null ">and leg.f_volumnC = #{fVolumnc}</if>
  112. <if test="fQtyc != null ">and leg.f_qtyC = #{fQtyc}</if>
  113. <if test="fMarks != null and fMarks != ''">and leg.f_marks = #{fMarks}</if>
  114. <if test="fQtyblc != null ">and leg.f_qtyblc = #{fQtyblc}</if>
  115. <if test="fGrossweightc != null ">and leg.f_grossweightC = #{fGrossweightc}</if>
  116. <if test="fNetweightc != null ">and leg.f_netweightC = #{fNetweightc}</if>
  117. <if test="fGrossweightblc != null ">and leg.f_grossweightblc = #{fGrossweightblc}</if>
  118. <if test="fNetweightblc != null ">and leg.f_netweightblc = #{fNetweightblc}</if>
  119. <if test="fCntrno != null and fCntrno != ''">and leg.f_cntrno = #{fCntrno}</if>
  120. <if test="fStatus != null and fStatus != ''">and leg.f_status = #{fStatus}</if>
  121. </where>
  122. </select>
  123. <select id="selectTWhgenleg" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
  124. <include refid="selectTWhgenlegVo"/>
  125. <where>
  126. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  127. <if test="fMblno != null ">and f_mblno = #{fMblno}</if>
  128. <if test="fGoodsid != null ">and f_goodsid = #{fGoodsid}</if>
  129. <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
  130. <if test="fWarehouseLocationid != null ">and f_warehouse_locationid = #{fWarehouseLocationid}</if>
  131. </where>
  132. </select>
  133. <select id="selectTWhgenlegById" parameterType="Long" resultMap="TWhgenlegResult">
  134. <include refid="selectTWhgenlegVo"/>
  135. where f_accyear = #{fAccyear}
  136. </select>
  137. <insert id="insertTWhgenleg" parameterType="TWhgenleg">
  138. insert into t_whgenleg
  139. <trim prefix="(" suffix=")" suffixOverrides=",">
  140. <if test="fAccyear != null">f_accyear,</if>
  141. <if test="fId != null">f_id,</if>
  142. <if test="fAccmonth != null">f_accmonth,</if>
  143. <if test="fCorpid != null">f_corpid,</if>
  144. <if test="fMblno != null">f_mblno,</if>
  145. <if test="fOriginalbillno != null">f_originalbillno,</if>
  146. <if test="fWarehouseLocationid != null">f_warehouse_locationid,</if>
  147. <if test="fGoodsid != null">f_goodsid,</if>
  148. <if test="fTrademodeid != null">f_trademodeid,</if>
  149. <if test="fPreqty != null">f_preqty,</if>
  150. <if test="fWarehouseid != null">f_warehouseid,</if>
  151. <if test="fPregrossweight != null">f_pregrossweight,</if>
  152. <if test="fPrenetweight != null">f_prenetweight,</if>
  153. <if test="fVolumnd != null">f_volumnD,</if>
  154. <if test="fQtyd != null">f_qtyD,</if>
  155. <if test="fGrossweightd != null">f_grossweightD,</if>
  156. <if test="fNetweightd != null">f_netweightD,</if>
  157. <if test="fVolumnc != null">f_volumnC,</if>
  158. <if test="fQtyc != null">f_qtyC,</if>
  159. <if test="fQtyblc != null">f_qtyblc,</if>
  160. <if test="fGrossweightc != null">f_grossweightC,</if>
  161. <if test="fGrossweightblc != null">f_grossweightblc,</if>
  162. <if test="fNetweightc != null">f_netweightC,</if>
  163. <if test="fNetweightblc != null">f_netweightblc,</if>
  164. <if test="fCntrno != null">f_cntrno,</if>
  165. <if test="fStatus != null">f_status,</if>
  166. <if test="delFlag != null">del_flag,</if>
  167. <if test="createBy != null">create_by,</if>
  168. <if test="fMarks != null and fMarks != ''">f_marks,</if>
  169. <if test="createTime != null">create_time,</if>
  170. <if test="updateBy != null">update_by,</if>
  171. <if test="updateTime != null">update_time,</if>
  172. <if test="remark != null">remark,</if>
  173. </trim>
  174. <trim prefix="values (" suffix=")" suffixOverrides=",">
  175. <if test="fAccyear != null">#{fAccyear},</if>
  176. <if test="fId != null">#{fId},</if>
  177. <if test="fAccmonth != null">#{fAccmonth},</if>
  178. <if test="fCorpid != null">#{fCorpid},</if>
  179. <if test="fMblno != null">#{fMblno},</if>
  180. <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
  181. <if test="fWarehouseLocationid != null">#{fWarehouseLocationid},</if>
  182. <if test="fGoodsid != null">#{fGoodsid},</if>
  183. <if test="fTrademodeid != null">#{fTrademodeid},</if>
  184. <if test="fPreqty != null">#{fPreqty},</if>
  185. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  186. <if test="fPregrossweight != null">#{fPregrossweight},</if>
  187. <if test="fPrenetweight != null">#{fPrenetweight},</if>
  188. <if test="fVolumnd != null">#{fVolumnd},</if>
  189. <if test="fQtyd != null">#{fQtyd},</if>
  190. <if test="fGrossweightd != null">#{fGrossweightd},</if>
  191. <if test="fNetweightd != null">#{fNetweightd},</if>
  192. <if test="fVolumnc != null">#{fVolumnc},</if>
  193. <if test="fQtyc != null">#{fQtyc},</if>
  194. <if test="fQtyblc != null">#{fQtyblc},</if>
  195. <if test="fGrossweightc != null">#{fGrossweightc},</if>
  196. <if test="fGrossweightblc != null">#{fGrossweightblc},</if>
  197. <if test="fNetweightc != null">#{fNetweightc},</if>
  198. <if test="fNetweightblc != null">#{fNetweightblc},</if>
  199. <if test="fCntrno != null">#{fCntrno},</if>
  200. <if test="fStatus != null">#{fStatus},</if>
  201. <if test="delFlag != null">#{delFlag},</if>
  202. <if test="createBy != null">#{createBy},</if>
  203. <if test="fMarks != null and fMarks != ''">#{fMarks},</if>
  204. <if test="createTime != null">#{createTime},</if>
  205. <if test="updateBy != null">#{updateBy},</if>
  206. <if test="updateTime != null">#{updateTime},</if>
  207. <if test="remark != null">#{remark},</if>
  208. </trim>
  209. </insert>
  210. <update id="updateTWhgenleg" parameterType="TWhgenleg">
  211. update t_whgenleg
  212. <trim prefix="SET" suffixOverrides=",">
  213. <if test="fId != null">f_id = #{fId},</if>
  214. <if test="fAccmonth != null">f_accmonth = #{fAccmonth},</if>
  215. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  216. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  217. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  218. <if test="fWarehouseLocationid != null">f_warehouse_locationid = #{fWarehouseLocationid},</if>
  219. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  220. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  221. <if test="fPreqty != null">f_preqty = #{fPreqty},</if>
  222. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  223. <if test="fPregrossweight != null">f_pregrossweight = #{fPregrossweight},</if>
  224. <if test="fPrenetweight != null">f_prenetweight = #{fPrenetweight},</if>
  225. <if test="fVolumnd != null">f_volumnD = #{fVolumnd},</if>
  226. <if test="fQtyd != null">f_qtyD = #{fQtyd},</if>
  227. <if test="fGrossweightd != null">f_grossweightD = #{fGrossweightd},</if>
  228. <if test="fNetweightd != null">f_netweightD = #{fNetweightd},</if>
  229. <if test="fVolumnc != null">f_volumnC = #{fVolumnc},</if>
  230. <if test="fQtyc != null">f_qtyC = #{fQtyc},</if>
  231. <if test="fQtyblc != null">f_qtyblc = #{fQtyblc},</if>
  232. <if test="fGrossweightc != null">f_grossweightC = #{fGrossweightc},</if>
  233. <if test="fGrossweightblc != null">f_grossweightblc = #{fGrossweightblc},</if>
  234. <if test="fNetweightc != null">f_netweightC = #{fNetweightc},</if>
  235. <if test="fNetweightblc != null">f_netweightblc = #{fNetweightblc},</if>
  236. <if test="fCntrno != null">f_cntrno = #{fCntrno},</if>
  237. <if test="fStatus != null">f_status = #{fStatus},</if>
  238. <if test="delFlag != null">del_flag = #{delFlag},</if>
  239. <if test="createBy != null">create_by = #{createBy},</if>
  240. <if test="fMarks != null and fMarks != ''">f_marks = #{fMarks},</if>
  241. <if test="createTime != null">create_time = #{createTime},</if>
  242. <if test="updateBy != null">update_by = #{updateBy},</if>
  243. <if test="updateTime != null">update_time = #{updateTime},</if>
  244. <if test="remark != null">remark = #{remark},</if>
  245. </trim>
  246. where f_accyear = #{fAccyear}
  247. </update>
  248. <update id="updateTWhgenlegData" parameterType="Map">
  249. update t_whgenleg
  250. <trim prefix="SET" suffixOverrides=",">
  251. /*判断是否入库*/
  252. <if test="map.billType == 'SJRK'">
  253. f_qtyD = f_qtyD + #{map.warehousebillsitems.fQty},
  254. f_volumnD = f_volumnD + #{map.warehousebillsitems.fVolumn},
  255. f_netweightD = f_netweightD + #{map.warehousebillsitems.fNetweight},
  256. f_grossweightD = f_grossweightD + #{map.warehousebillsitems.fGrossweight},
  257. f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
  258. </if>
  259. /*判断是否撤销入库*/
  260. <if test="map.billType == 'SJRKRevoke'">
  261. f_qtyD = f_qtyD - #{map.warehousebillsitems.fQty},
  262. f_volumnD = f_volumnD - #{map.warehousebillsitems.fVolumn},
  263. f_netweightD = f_netweightD - #{map.warehousebillsitems.fNetweight},
  264. f_grossweightD = f_grossweightD - #{map.warehousebillsitems.fGrossweight},
  265. f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
  266. </if>
  267. /*判断是否出库*/
  268. <if test="map.billType == 'SJCK'">
  269. f_qtyC = f_qtyC + #{map.warehousebillsitems.fQty},
  270. f_volumnC = f_volumnC + #{map.warehousebillsitems.fVolumn},
  271. f_netweightC = f_netweightC + #{map.warehousebillsitems.fNetweight},
  272. f_grossweightC = f_grossweightC + #{map.warehousebillsitems.fGrossweight},
  273. f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
  274. </if>
  275. /*判断是否撤销出库*/
  276. <if test="map.billType == 'SJCKRevoke'">
  277. f_qtyC = f_qtyC - #{map.warehousebillsitems.fQty},
  278. f_volumnC = f_volumnC - #{map.warehousebillsitems.fVolumn},
  279. f_netweightC = f_netweightC - #{map.warehousebillsitems.fNetweight},
  280. f_grossweightC = f_grossweightC - #{map.warehousebillsitems.fGrossweight},
  281. f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
  282. </if>
  283. -- update_by = NOW()
  284. </trim>
  285. where f_id = #{map.whgenlegId}
  286. </update>
  287. <delete id="deleteTWhgenlegById" parameterType="Long">
  288. delete from t_whgenleg where f_accyear = #{fAccyear}
  289. </delete>
  290. <delete id="deleteTWhgenlegByIds" parameterType="String">
  291. delete from t_whgenleg where f_accyear in
  292. <foreach item="fAccyear" collection="array" open="(" separator="," close=")">
  293. #{fAccyear}
  294. </foreach>
  295. </delete>
  296. </mapper>