|
@@ -5,34 +5,35 @@
|
|
|
|
|
|
<!-- 库位上的货品信息 -->
|
|
<!-- 库位上的货品信息 -->
|
|
<select id="getWmsAcqGoodsSeat" parameterType="java.util.Map" resultType="com.emato.cus.supervise.domain.WmsAcqGoodsOnSeat">
|
|
<select id="getWmsAcqGoodsSeat" parameterType="java.util.Map" resultType="com.emato.cus.supervise.domain.WmsAcqGoodsOnSeat">
|
|
- SELECT * FROM
|
|
|
|
- (SELECT
|
|
|
|
- th.companyCode AS merchSn,
|
|
|
|
- th.locationCode AS seatNo,
|
|
|
|
- th.itemName AS goodsName,
|
|
|
|
- th.itemCode AS codeTs,
|
|
|
|
- th.itemCode AS skuNo,
|
|
|
|
- th.itemCode AS goodsId,
|
|
|
|
- i.unitDesc AS gUnit,
|
|
|
|
- th.afterOnHandQty AS gQty,
|
|
|
|
- th.warehouseCode AS storeCode,
|
|
|
|
- CONCAT( i.itemSize, '-', i.itemColor, '-', i.itemStyle ) AS goodsModel
|
|
|
|
- FROM transaction_history th
|
|
|
|
- LEFT JOIN ( SELECT itemCode, locationCode, SUM( onHandQty ) AS qty FROM location_inventory GROUP BY itemCode, locationCode ) AS li
|
|
|
|
- ON th.itemCode = li.itemCode AND th.locationCode = li.locationCode
|
|
|
|
- LEFT JOIN item i ON th.itemCode = i.CODE
|
|
|
|
- <where>
|
|
|
|
- 1 = 1
|
|
|
|
- and th.zone in ('A区', 'B区', 'C区', 'GQ区', 'F区', 'P区')
|
|
|
|
- and (th.afterOnHandQty = li.qty or th.afterOnHandQty = 0)
|
|
|
|
- and li.qty is not null
|
|
|
|
- <if test="thisTime != null">
|
|
|
|
- and th.created >= #{thisTime}
|
|
|
|
- </if>
|
|
|
|
- </where>
|
|
|
|
- ORDER BY th.created DESC
|
|
|
|
- ) AS temp
|
|
|
|
- GROUP BY skuNo, seatNo
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ *
|
|
|
|
+ FROM
|
|
|
|
+ (SELECT DISTINCT
|
|
|
|
+ th.companyCode AS merchSn,
|
|
|
|
+ th.locationCode AS seatNo,
|
|
|
|
+ th.itemName AS goodsName,
|
|
|
|
+ th.itemCode AS codeTs,
|
|
|
|
+ th.itemCode AS skuNo,
|
|
|
|
+ th.itemCode AS goodsId,
|
|
|
|
+ i.unitDesc AS gUnit,
|
|
|
|
+ ( case when (li.qty is null and th.afterOnHandQty = 0) or (li.qty is not null and th.afterOnHandQty = li.qty) then th.afterOnHandQty
|
|
|
|
+ else li.qty end) AS gQty,
|
|
|
|
+ th.warehouseCode AS storeCode,
|
|
|
|
+ CONCAT( i.itemSize, '-', i.itemColor, '-', i.itemStyle ) AS goodsModel
|
|
|
|
+ FROM
|
|
|
|
+ transaction_history th
|
|
|
|
+ LEFT JOIN ( SELECT itemCode, locationCode, SUM( onHandQty ) AS qty FROM location_inventory GROUP BY itemCode, locationCode ) AS li ON
|
|
|
|
+ th.itemCode = li.itemCode AND th.locationCode = li.locationCode
|
|
|
|
+ LEFT JOIN item i ON th.itemCode = i.CODE
|
|
|
|
+ WHERE
|
|
|
|
+ 1 = 1
|
|
|
|
+ AND th.zone IN ( 'A区', 'B区', 'C区', 'GQ区', 'F区', 'P区', 'Y区' )
|
|
|
|
+ AND th.created >= '2018-01-01'
|
|
|
|
+ ORDER BY
|
|
|
|
+ th.created DESC
|
|
|
|
+ ) AS a
|
|
|
|
+ GROUP BY
|
|
|
|
+ skuNo, seatNo
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|