|
@@ -92,13 +92,36 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="queryDriverReturnNum" resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">
|
|
<select id="queryDriverReturnNum" resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">
|
|
|
- select oas.id as areaStaffId, wbod.productSpecId as goodsId, SUM(wbod.realBackNumber) as totalNum
|
|
|
|
|
- from yr_warehouse_back_order_detail as wbod
|
|
|
|
|
- left join yr_warehouse_back_order_info as wboi on wbod.backOrderId = wboi.id
|
|
|
|
|
- left join yr_operators_area_staff as oas on wboi.replenishId = oas.accountId
|
|
|
|
|
- where wboi.backTime between #{beginTime} and #{endTime}
|
|
|
|
|
- and wboi.backStatus = 'BACK_SUCCESS'
|
|
|
|
|
- group by wboi.replenishId, wbod.productSpecId
|
|
|
|
|
|
|
+ with driver_back as (select oas.id as areaStaffId,
|
|
|
|
|
+ wbod.productSpecId as goodsId,
|
|
|
|
|
+ SUM(wbod.realBackNumber) as totalNum
|
|
|
|
|
+ from yr_warehouse_back_order_detail as wbod
|
|
|
|
|
+ left join yr_warehouse_back_order_info as wboi on wbod.backOrderId = wboi.id
|
|
|
|
|
+ left join (select id, accountId
|
|
|
|
|
+ from yr_operators_area_staff
|
|
|
|
|
+ group by accountId) as oas on oas.accountId = wboi.replenishId
|
|
|
|
|
+ where wboi.backTime between #{beginTime} and #{endTime}
|
|
|
|
|
+ and wboi.backStatus = 'BACK_SUCCESS'
|
|
|
|
|
+ and wboi.sourceBack = 'DRIVER'
|
|
|
|
|
+ group by wboi.replenishId, wbod.productSpecId),
|
|
|
|
|
+ device_back as (select wboi.areaStaffId as areaStaffId,
|
|
|
|
|
+ wbod.productSpecId as goodsId,
|
|
|
|
|
+ wbod.realBackNumber as totalNum
|
|
|
|
|
+ from yr_warehouse_back_order_detail as wbod
|
|
|
|
|
+ left join yr_warehouse_back_order_info as wboi on wbod.backOrderId = wboi.id
|
|
|
|
|
+ where wboi.backTime between #{beginTime} and #{endTime}
|
|
|
|
|
+ and wboi.backStatus = 'BACK_SUCCESS'
|
|
|
|
|
+ and wboi.sourceBack = 'DEVICE'
|
|
|
|
|
+ group by wboi.areaStaffId, wbod.productSpecId)
|
|
|
|
|
+ select areaStaffId, goodsId, sum(totalNum) as totalNum
|
|
|
|
|
+ from (select areaStaffId, goodsId, totalNum
|
|
|
|
|
+ from driver_back
|
|
|
|
|
+ where areaStaffId is not null
|
|
|
|
|
+ union all
|
|
|
|
|
+ select areaStaffId, goodsId, totalNum
|
|
|
|
|
+ from device_back
|
|
|
|
|
+ where areaStaffId is not null) as c
|
|
|
|
|
+ group by areaStaffId, goodsId
|
|
|
</select>
|
|
</select>
|
|
|
<select id="queryDriverDeviceInventoryNum"
|
|
<select id="queryDriverDeviceInventoryNum"
|
|
|
resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">
|
|
resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">
|