|
@@ -5,28 +5,34 @@
|
|
|
|
|
|
<!-- 库位上的货品信息 -->
|
|
|
<select id="getWmsAcqGoodsSeat" parameterType="java.util.Map" resultType="com.emato.cus.supervise.domain.WmsAcqGoodsOnSeat">
|
|
|
- SELECT
|
|
|
- li.companyCode AS merchSn,
|
|
|
- li.locationCode AS seatNo,
|
|
|
- li.itemName AS goodsName,
|
|
|
- li.itemCode AS codeTs,
|
|
|
- li.itemCode AS skuNo,
|
|
|
- li.itemCode AS goodsId,
|
|
|
- i.unitDesc AS gUnit,
|
|
|
- SUM(li.onHandQty) AS gQty,
|
|
|
- li.warehouseCode AS storeCode,
|
|
|
- CONCAT(i.itemSize, '-', i.itemColor, '-', i.itemStyle) AS goodsModel
|
|
|
- FROM location_inventory li
|
|
|
- LEFT JOIN item i ON li.itemCode = i.CODE
|
|
|
- LEFT JOIN location l ON li.locationCode = l.CODE
|
|
|
+ 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 l.zoneCode in ('A区', 'B区', 'C区', 'GQ区', 'F区', 'P区')
|
|
|
- <if test="thisTime != null">
|
|
|
- and li.lastUpdated >= #{thisTime}
|
|
|
- </if>
|
|
|
+ 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>
|
|
|
- GROUP BY li.itemCode, li.locationCode
|
|
|
+ ORDER BY th.created DESC
|
|
|
+ ) AS temp
|
|
|
+ GROUP BY skuNo, seatNo
|
|
|
</select>
|
|
|
|
|
|
|