WarehousePositionStorageInfoMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.WarehousePositionStorageInfoMapper">
  4. <select id="selectSumStoreage" parameterType="Map" resultType="java.lang.Double">
  5. SELECT
  6. sum(a.`storage`)
  7. FROM
  8. warehouse_position_storage_info a
  9. left join warehouse_position_info wpi on wpi.id = a.position_id and wpi.delete_flag = 0
  10. left join warehouse_base_info wbi on wbi.id = wpi.base_id and wbi.delete_flag = 0
  11. WHERE
  12. a.delete_flag = 0
  13. and wbi.comp_id = #{compId}
  14. <if test="jointVentureParties != null">
  15. AND wbi.joint_venture_parties = #{jointVentureParties}
  16. </if>
  17. </select>
  18. <select id="selectSumWare" parameterType="Map" resultType="java.lang.Double">
  19. SELECT
  20. sum(a.`storage`)
  21. FROM
  22. warehouse_position_storage_info a
  23. left join warehouse_position_info wpi on wpi.id = a.position_id and wpi.delete_flag = 0
  24. left join warehouse_base_info wbi on wbi.id = wpi.base_id and wbi.delete_flag = 0
  25. WHERE
  26. a.delete_flag = 0
  27. and
  28. wbi.id = #{baseId}
  29. and wbi.comp_id = #{compId}
  30. </select>
  31. <select id="selectSumWareNew" parameterType="Map" resultType="java.lang.Double">
  32. SELECT
  33. sum( wioi.net_weight )
  34. FROM
  35. warehouse_in_out_info wioi
  36. LEFT JOIN warehouse_base_info wbi ON wbi.id = wioi.base_id
  37. AND wbi.delete_flag = 0
  38. WHERE
  39. wioi.delete_flag = 0
  40. <if test="baseId != null">
  41. and wbi.id = #{baseId}
  42. </if>
  43. <if test="jointVentureParties != null">
  44. and wbi.joint_venture_parties = #{jointVentureParties}
  45. </if>
  46. and wbi.comp_id = #{compId}
  47. and wioi.in_out_flag = #{flag}
  48. <if test="seachMoth != null and seachMoth != ''">
  49. and wioi.create_date >= #{seachMoth}
  50. and wbi.create_date >= #{seachMoth}
  51. </if>
  52. <!-- <if test="type != null and type != ''">-->
  53. -- group by
  54. -- wioi.goods_name
  55. <!-- </if>-->
  56. </select>
  57. <select id="selectSumWareNewByGoods" parameterType="Map"
  58. resultType="com.yh.saas.plugin.yiliangyiyun.entity.view.BiViewInfo">
  59. SELECT
  60. wioi.goods_name as name,
  61. sum( wioi.net_weight ) as weight
  62. FROM
  63. warehouse_in_out_info wioi
  64. LEFT JOIN warehouse_base_info wbi ON wbi.id = wioi.base_id
  65. AND wbi.delete_flag = 0
  66. WHERE
  67. wioi.delete_flag = 0
  68. <if test="baseId != null">
  69. and wbi.id = #{baseId}
  70. </if>
  71. <if test="jointVentureParties != null">
  72. and wbi.joint_venture_parties = #{jointVentureParties}
  73. </if>
  74. and wbi.comp_id = #{compId}
  75. and wioi.in_out_flag = #{flag}
  76. <if test="seachMoth != null and seachMoth != ''">
  77. and wioi.create_date >= #{seachMoth}
  78. and wbi.create_date >= #{seachMoth}
  79. </if>
  80. group by
  81. wioi.goods_name
  82. </select>
  83. <select id="selectSumWareChaoByGoods" parameterType="Map"
  84. resultType="com.yh.saas.plugin.yiliangyiyun.entity.view.BiViewInfo">
  85. SELECT
  86. wioi.goods_name as name,
  87. sum( wioi.pure_weight ) as weight
  88. FROM
  89. warehouse_in_out_info wioi
  90. LEFT JOIN warehouse_base_info wbi ON wbi.id = wioi.base_id
  91. AND wbi.delete_flag = 0
  92. WHERE
  93. wioi.delete_flag = 0
  94. and
  95. wioi.status_flag = '3'
  96. and
  97. locate('潮粮', wioi.goods_name)
  98. <if test="baseId != null">
  99. and wbi.id = #{baseId}
  100. </if>
  101. <if test="jointVentureParties != null">
  102. and wbi.joint_venture_parties = #{jointVentureParties}
  103. </if>
  104. and wbi.comp_id = #{compId}
  105. and wioi.in_out_flag = #{flag}
  106. <if test="seachMoth != null and seachMoth != ''">
  107. and wioi.create_date >= #{seachMoth}
  108. and wbi.create_date >= #{seachMoth}
  109. </if>
  110. group by
  111. wioi.goods_name
  112. </select>
  113. <select id="getQuantityZhe" parameterType="Map"
  114. resultType="com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView">
  115. SELECT
  116. REPLACE(wioi.goods_name,'(潮粮)','') as goodsName,
  117. ifnull(sum( case when wioi.goods_name like '%潮粮%' and wioi.type = '潮粮' then wioi.pure_weight else wioi.net_weight end ),0) as pureWeight
  118. FROM
  119. warehouse_in_out_info wioi
  120. LEFT JOIN warehouse_base_info wbi ON wbi.id = wioi.base_id
  121. AND wbi.delete_flag = 0
  122. WHERE
  123. wioi.delete_flag = 0
  124. and wbi.comp_id = #{compId}
  125. and
  126. wioi.status_flag = '3'
  127. <if test="baseId != null">
  128. and wbi.id = #{baseId}
  129. </if>
  130. and wioi.in_out_flag = #{flag}
  131. and wioi.in_out_type not like '%折%'
  132. <if test="seachMoth != null and seachMoth != ''">
  133. and wioi.create_date >= #{seachMoth}
  134. and wbi.create_date >= #{seachMoth}
  135. </if>
  136. group by
  137. REPLACE(wioi.goods_name,'(潮粮)','')
  138. </select>
  139. <select id="getQuantityHong" resultType="com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView">
  140. SELECT
  141. REPLACE(wioi.goods_name,'(潮粮)','') as goodsName,
  142. ifnull(sum( case when wioi.goods_name like '%潮粮%' and wioi.type = '潮粮' then wioi.pure_weight else wioi.net_weight end ),0) as pureWeight
  143. FROM
  144. warehouse_in_out_info wioi
  145. LEFT JOIN warehouse_base_info wbi ON wbi.id = wioi.base_id
  146. AND wbi.delete_flag = 0
  147. left join in_out_warehouse_task iowt on iowt.in_out_task_no = wioi.in_out_task_no and iowt.delete_flag = 0
  148. WHERE
  149. wioi.delete_flag = 0
  150. and iowt.task_flag = '烘干入库'
  151. and wbi.comp_id = #{compId}
  152. and
  153. wioi.status_flag = '3'
  154. <if test="baseId != null">
  155. and wbi.id = #{baseId}
  156. </if>
  157. and wioi.in_out_flag = #{flag}
  158. and wioi.in_out_type not like '%折%'
  159. <if test="seachMoth != null and seachMoth != ''">
  160. and wioi.create_date >= #{seachMoth}
  161. and wbi.create_date >= #{seachMoth}
  162. </if>
  163. group by
  164. REPLACE(wioi.goods_name,'(潮粮)','')
  165. </select>
  166. </mapper>