You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

253 lines
11 KiB

10 months ago
9 months ago
10 months ago
10 months ago
7 months ago
4 months ago
8 months ago
10 months ago
4 months ago
10 months ago
10 months ago
7 months ago
10 months ago
10 months ago
2 weeks ago
4 months ago
10 months ago
4 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
7 months ago
8 months ago
10 months ago
10 months ago
10 months ago
  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.gaotao.modules.warehouse.dao.LabelQueryMapper">
  4. <!-- 分页查询HandlingUnit标签信息 -->
  5. <select id="getHandlingUnitLabelList" resultType="com.gaotao.modules.handlingunit.entity.dto.HandlingUnitDto">
  6. SELECT
  7. h.unit_id as unitId,
  8. h.site,
  9. h.part_no as partNo,
  10. h.part_desc as partDesc,
  11. h.batch_no as batchNo,
  12. h.location_id as locationId,
  13. h.warehouse_id as warehouseId,
  14. h.qty,
  15. h.in_stock_flag as inStockFlag,
  16. h.status,
  17. h.status_db as statusDb,
  18. h.created_date as createdDate,
  19. h.created_by as createdBy,
  20. h.modified_date as modifiedDate,
  21. h.modified_by as modifiedBy,
  22. h.print_count as printCount,
  23. h.last_print_date as lastPrintDate,
  24. h.printer_name as printerName,
  25. h.qr_code as qrCode,
  26. h.bar_code as barCode,
  27. h.remark,
  28. w.WareHouseName as warehouseName,
  29. l.LocationName as locationName,
  30. h.supplier_batch_no as supplierBatchNo,
  31. h.supplier_manufacture_date as supplierManufactureDate,
  32. h.height,h.wdr,h.eng_chg_level as engChgLevel,h.expired_date as expiredDate,
  33. h.count_flag as countFlag,h.last_count_date as lastCountDate,h.source_type as sourceType
  34. FROM handling_unit h WITH (NOLOCK)
  35. LEFT JOIN warehouse w WITH (NOLOCK) ON h.warehouse_id = w.WareHouseID AND h.site = w.Site
  36. LEFT JOIN location l WITH (NOLOCK) ON h.location_id = l.LocationID AND h.site = l.Site
  37. <where>
  38. <if test="params.site != null and params.site != ''">
  39. AND h.site = #{params.site}
  40. </if>
  41. <if test="params.inStockFlag != null and params.inStockFlag != ''">
  42. AND h.in_stock_flag = #{params.inStockFlag}
  43. </if>
  44. <!-- rqrq - 本期盘点 count_flag,仅 Y/N 入条件,空为全部 -->
  45. <if test="params.countFlag != null and params.countFlag != ''">
  46. AND h.count_flag = #{params.countFlag}
  47. </if>
  48. <if test="params.partNo != null and params.partNo != ''">
  49. AND h.part_no LIKE CONCAT('%', #{params.partNo}, '%')
  50. </if>
  51. <if test="params.batchNo != null and params.batchNo != ''">
  52. AND h.batch_no LIKE CONCAT('%', #{params.batchNo}, '%')
  53. </if>
  54. <if test="params.locationId != null and params.locationId != ''">
  55. AND h.location_id LIKE CONCAT('%', #{params.locationId}, '%')
  56. </if>
  57. <if test="params.unitId != null and params.unitId != ''">
  58. AND h.unit_id LIKE CONCAT('%', #{params.unitId}, '%')
  59. </if>
  60. <if test="params.partDesc != null and params.partDesc != ''">
  61. AND h.part_desc LIKE CONCAT('%', #{params.partDesc}, '%')
  62. </if>
  63. <if test="params.supplierBatchNo != null and params.supplierBatchNo != ''">
  64. AND h.supplier_batch_no LIKE CONCAT('%', #{params.supplierBatchNo}, '%')
  65. </if>
  66. <if test="params.sourceType != null and params.sourceType != ''">
  67. AND h.source_type = #{params.sourceType}
  68. </if>
  69. <if test=" params.startDate != null ">
  70. AND h.created_date >= #{params.startDate}
  71. </if>
  72. <if test=" params.endDate != null ">
  73. AND dateadd( DAY, 1, #{params.endDate} ) > h.created_date
  74. </if>
  75. </where>
  76. ORDER BY h.created_date DESC
  77. </select>
  78. <!-- rqrq - -->
  79. <select id="getHandlingUnitLabelListLocation" resultType="com.gaotao.modules.handlingunit.entity.dto.HandlingUnitDto">
  80. SELECT
  81. h.unit_id AS unitId,
  82. h.site,
  83. h.part_no AS partNo,
  84. h.part_desc AS partDesc,
  85. h.batch_no AS batchNo,
  86. h.location_id AS locationId,
  87. h.warehouse_id AS warehouseId,
  88. h.qty,
  89. h.in_stock_flag AS inStockFlag,
  90. h.status,
  91. h.status_db AS statusDb,
  92. h.created_date AS createdDate,
  93. h.created_by AS createdBy,
  94. h.modified_date AS modifiedDate,
  95. h.modified_by AS modifiedBy,
  96. h.print_count AS printCount,
  97. h.last_print_date AS lastPrintDate,
  98. h.printer_name AS printerName,
  99. h.qr_code AS qrCode,
  100. h.bar_code AS barCode,
  101. p.remark,
  102. w.WareHouseName AS warehouseName,
  103. l.LocationName AS locationName,
  104. p.pallet_id,
  105. s.station_id,
  106. s.station_area,
  107. h.height,
  108. b.position,
  109. b.layer,
  110. p.calling_flag,
  111. p.wcs_location AS wcsLocation,
  112. h.count_flag AS countFlag,
  113. h.last_count_date AS lastCountDate,
  114. h.eng_chg_level AS engChgLevel,
  115. h.expired_date AS expiredDate,
  116. h.receive_date AS receiveDate,
  117. h.wdr
  118. FROM handling_unit h
  119. LEFT JOIN warehouse w ON h.warehouse_id = w.WareHouseID AND h.site = w.Site
  120. LEFT JOIN location l ON h.location_id = l.LocationID AND h.site = l.Site
  121. LEFT JOIN pallet_detail b ON h.unit_id = b.serial_no AND h.site = b.site
  122. LEFT JOIN pallet p ON b.pallet_id = p.pallet_id AND b.site = p.site
  123. LEFT JOIN agv_station s ON p.location_code = s.station_code
  124. <where>
  125. and p.pallet_id IS NOT NULL
  126. <if test="params.site != null and params.site != ''">
  127. AND h.site = #{params.site}
  128. </if>
  129. <if test="params.inStockFlag != null and params.inStockFlag != ''">
  130. AND h.in_stock_flag = #{params.inStockFlag}
  131. </if>
  132. <!-- rqrq - 本期盘点 count_flag,仅 Y/N 入条件,空为全部 -->
  133. <if test="params.countFlag != null and params.countFlag != ''">
  134. AND h.count_flag = #{params.countFlag}
  135. </if>
  136. <if test="params.partNo != null and params.partNo != ''">
  137. AND h.part_no LIKE '%' + #{params.partNo} + '%'
  138. </if>
  139. <if test="params.batchNo != null and params.batchNo != ''">
  140. AND h.batch_no LIKE '%' + #{params.batchNo} + '%'
  141. </if>
  142. <if test="params.locationId != null and params.locationId != ''">
  143. AND h.location_id LIKE '%' + #{params.locationId} + '%'
  144. </if>
  145. <if test="params.unitId != null and params.unitId != ''">
  146. AND h.unit_id LIKE '%' + #{params.unitId} + '%'
  147. </if>
  148. <if test="params.partDesc != null and params.partDesc != ''">
  149. AND h.part_desc LIKE '%' + #{params.partDesc} + '%'
  150. </if>
  151. <if test="params.palletId != null and params.palletId != ''">
  152. AND p.pallet_id LIKE '%' + #{params.palletId} + '%'
  153. </if>
  154. <if test="params.stationId != null and params.stationId != ''">
  155. AND s.station_id LIKE '%' + #{params.stationId} + '%'
  156. </if>
  157. </where>
  158. ORDER BY h.created_date DESC
  159. </select>
  160. <select id="getHandlingUnitLabelAll" resultType="com.gaotao.modules.handlingunit.entity.dto.HandlingUnitDto">
  161. SELECT
  162. h.unit_id as unitId,
  163. h.site,
  164. h.part_no as partNo,
  165. h.part_desc as partDesc,
  166. h.batch_no as batchNo,
  167. h.location_id as locationId,
  168. h.warehouse_id as warehouseId,
  169. h.qty,
  170. h.in_stock_flag as inStockFlag,
  171. h.status,
  172. h.status_db as statusDb,
  173. h.created_date as createdDate,
  174. h.created_by as createdBy,
  175. h.modified_date as modifiedDate,
  176. h.modified_by as modifiedBy,
  177. h.print_count as printCount,
  178. h.last_print_date as lastPrintDate,
  179. h.printer_name as printerName,
  180. h.qr_code as qrCode,
  181. h.bar_code as barCode,
  182. h.remark,
  183. w.WareHouseName as warehouseName,
  184. l.LocationName as locationName,
  185. p.pallet_id,
  186. s.station_id,
  187. s.station_area,
  188. h.height,
  189. h.last_count_date as lastCountDate
  190. FROM handling_unit h WITH (NOLOCK)
  191. LEFT JOIN warehouse w WITH (NOLOCK) ON h.warehouse_id = w.WareHouseID AND h.site = w.Site
  192. LEFT JOIN location l WITH (NOLOCK) ON h.location_id = l.LocationID AND h.site = l.Site
  193. left join pallet_detail b WITH (NOLOCK) on h.unit_id = b.serial_no and h.site=b.site
  194. left join pallet p WITH (NOLOCK) on b.pallet_id = p.pallet_id and b.site = p.site
  195. left join agv_station s WITH (NOLOCK) on p.location_code=s.station_code
  196. <where>
  197. <if test="params.site != null and params.site != ''">
  198. AND h.site = #{params.site}
  199. </if>
  200. <if test="params.inStockFlag != null and params.inStockFlag != ''">
  201. AND h.in_stock_flag = #{params.inStockFlag}
  202. </if>
  203. <if test="params.partNo != null and params.partNo != ''">
  204. AND h.part_no LIKE CONCAT('%', #{params.partNo}, '%')
  205. </if>
  206. <if test="params.batchNo != null and params.batchNo != ''">
  207. AND h.batch_no LIKE CONCAT('%', #{params.batchNo}, '%')
  208. </if>
  209. <if test="params.locationId != null and params.locationId != ''">
  210. AND h.location_id LIKE CONCAT('%', #{params.locationId}, '%')
  211. </if>
  212. <if test="params.unitId != null and params.unitId != ''">
  213. AND h.unit_id LIKE CONCAT('%', #{params.unitId}, '%')
  214. </if>
  215. <if test="params.partDesc != null and params.partDesc != ''">
  216. AND h.part_desc LIKE CONCAT('%', #{params.partDesc}, '%')
  217. </if>
  218. <if test="params.partDesc != null and params.partDesc != ''">
  219. AND h.part_desc LIKE CONCAT('%', #{params.partDesc}, '%')
  220. </if>
  221. <if test="params.palletId != null and params.palletId != ''">
  222. AND p.pallet_id LIKE CONCAT('%', #{params.palletId}, '%')
  223. </if>
  224. <if test="params.stationId != null and params.stationId != ''">
  225. AND s.station_id LIKE CONCAT('%', #{params.stationId}, '%')
  226. </if>
  227. </where>
  228. ORDER BY h.created_date DESC
  229. </select>
  230. <!-- rqrq - 去除非栈板库存 -->
  231. <update id="removeNonPalletInventory">
  232. UPDATE handling_unit
  233. SET in_stock_flag = 'N', epc = CONVERT(VARCHAR(8), GETDATE(), 112)
  234. WHERE unit_id NOT IN (SELECT serial_no FROM pallet_detail)
  235. AND in_stock_flag = 'Y'
  236. AND site = #{site}
  237. </update>
  238. <!-- rqrq - 恢复非栈板库存 -->
  239. <update id="restoreNonPalletInventory">
  240. UPDATE handling_unit
  241. SET in_stock_flag = 'Y', epc = ''
  242. WHERE epc = CONVERT(VARCHAR(8), GETDATE(), 112)
  243. AND in_stock_flag = 'N'
  244. AND site = #{site}
  245. </update>
  246. </mapper>