1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.emato.cus.supervise.mapper.WmsAcqInventoryInfoMapper">
- <!-- 企业库存信息查询 -->
- <select id="getWmsAcqInventoryInfo" parameterType="java.util.Map"
- resultType="com.emato.cus.supervise.domain.WmsAcqInventoryInfo">
- SELECT
- merchSn,
- goodsName,
- codeTs,
- gUnit,
- SUM( gQty ) AS gQty,
- goodsModel
- 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
- codeTs
- </select>
- </mapper>
|