TWhgenlegMapper.xml 31 KB

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