wms-acq-goods-on-seat.xml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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.emato.cus.supervise.mapper.WmsAcqGoodsSeatMapper">
  4. <!-- 库位上的货品信息 -->
  5. <select id="getWmsAcqGoodsSeat" parameterType="java.util.Map" resultType="com.emato.cus.supervise.domain.WmsAcqGoodsOnSeat">
  6. SELECT * FROM
  7. (SELECT
  8. th.companyCode AS merchSn,
  9. th.locationCode AS seatNo,
  10. th.itemName AS goodsName,
  11. th.itemCode AS codeTs,
  12. th.itemCode AS skuNo,
  13. th.itemCode AS goodsId,
  14. i.unitDesc AS gUnit,
  15. th.afterOnHandQty AS gQty,
  16. th.warehouseCode AS storeCode,
  17. CONCAT( i.itemSize, '-', i.itemColor, '-', i.itemStyle ) AS goodsModel
  18. FROM transaction_history th
  19. LEFT JOIN ( SELECT itemCode, locationCode, SUM( onHandQty ) AS qty FROM location_inventory GROUP BY itemCode, locationCode ) AS li
  20. ON th.itemCode = li.itemCode AND th.locationCode = li.locationCode
  21. LEFT JOIN item i ON th.itemCode = i.CODE
  22. <where>
  23. 1 = 1
  24. and th.zone in ('A区', 'B区', 'C区', 'GQ区', 'F区', 'P区')
  25. and (th.afterOnHandQty = li.qty or th.afterOnHandQty = 0)
  26. and li.qty is not null
  27. <if test="thisTime != null">
  28. and th.created &gt;= #{thisTime}
  29. </if>
  30. </where>
  31. ORDER BY th.created DESC
  32. ) AS temp
  33. GROUP BY skuNo, seatNo
  34. </select>
  35. </mapper>