| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?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.yr.warehouse.admin.statistics.mapper.BillingQuantityStatisticsMapper">
- <select id="queryPickingBillingQuantity" resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">
- select poi.area_staff_id as areaStaffId, pod.goods_id as goodsId, SUM(pod.picking_number) as totalNum
- from yr_picking_order_detail as pod
- left join yr_picking_order_info as poi on pod.order_number = poi.order_number
- where poi.create_time between #{beginTime} and #{endTime}
- and pod.is_aggregation = 0
- group by poi.area_staff_id, pod.goods_id
- </select>
- <select id="queryAggregationBillingQuantity" resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">
- select api.area_staff_id as areaStaffId,
- apd.goods_id as goodsId,
- IFNULL(sum(apd.picking_number), 0) + IFNULL(sum(apd.more_number), 0) as totalNum
- from yr_aggregation_pick_detail as apd
- left join yr_aggregation_pick_info as api on apd.order_number = api.order_number
- where api.modify_time between #{beginTime} and #{endTime}
- group by api.area_staff_id, apd.goods_id
- </select>
- <select id="queryUnOutStockCancelNum"
- resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">
- with cancel_data as (select poi.area_staff_id as areaStaffId,
- pod.goods_id as goodsId,
- IFNULL(SUM(pod.picking_number), 0) as pickingNumber
- from yr_picking_order_detail as pod
- left join yr_picking_order_info as poi on pod.order_number = poi.order_number
- where poi.modify_time between #{beginTime} and #{endTime}
- and pod.is_aggregation = 0
- and poi.picking_status = 3
- group by poi.area_staff_id, pod.goods_id
- union all
- select api.area_staff_id as areaStaffId,
- apd.goods_id as goodsId,
- IFNULL(sum(apd.picking_number), 0) + IFNULL(sum(apd.more_number), 0) as pickingNumber
- from yr_aggregation_pick_detail as apd
- left join yr_aggregation_pick_info as api on apd.order_number = api.order_number
- where api.modify_time between #{beginTime} and #{endTime}
- and api.status = 'CANCEL')
- select areaStaffId, goodsId, sum(pickingNumber) as totalNum
- from cancel_data
- where areaStaffId IS NOT NULL
- group by areaStaffId, goodsId
- </select>
- <select id="queryOutStockCancelNum" resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">
- with cancel_data as (select poi.area_staff_id as areaStaffId,
- pod.goods_id as goodsId,
- IFNULL(SUM(pod.picking_number), 0) as pickingNumber
- from yr_picking_order_detail as pod
- left join yr_picking_order_info as poi on pod.order_number = poi.order_number
- where poi.modify_time between #{beginTime} and #{endTime}
- and pod.is_aggregation = 0
- and poi.picking_status = 4
- group by poi.area_staff_id, pod.goods_id
- union all
- select api.area_staff_id as areaStaffId,
- apd.goods_id as goodsId,
- IFNULL(sum(apd.picking_number), 0) + IFNULL(sum(apd.more_number), 0) as pickingNumber
- from yr_aggregation_pick_detail as apd
- left join yr_aggregation_pick_info as api on apd.order_number = api.order_number
- where api.modify_time between #{beginTime} and #{endTime}
- and api.status = 'OUT_CANCEL')
- select areaStaffId, goodsId, sum(pickingNumber) as totalNum
- from cancel_data
- where areaStaffId IS NOT NULL
- group by areaStaffId, goodsId
- </select>
- <select id="queryDriverReplenishNum" resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">
- select roi.area_staff_id as areaStaffId, rod.goods_id as goodsId, sum(rod.real_picking_number) as totalNum
- from yr_replenish_order_detail as rod
- left join yr_replenish_order_info as roi on rod.order_number = roi.order_number
- where roi.replenish_time between #{beginTime} and #{endTime}
- and roi.replenish_status = 2
- group by roi.area_staff_id, rod.goods_id
- </select>
- <select id="queryDeviceReplenishNum" resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">
- select roi.area_staff_id as areaStaffId, sum(rod.real_picking_number) as totalNum
- from yr_replenish_order_detail as rod
- left join yr_replenish_order_info as roi on rod.order_number = roi.order_number
- where roi.replenish_time between #{beginTime} and #{endTime}
- and roi.replenish_status = 2
- and rod.real_picking_number > 0
- group by roi.area_staff_id
- </select>
- <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
- </select>
- <select id="queryDriverDeviceInventoryNum"
- resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">
- with device_stock as (select odcw.deviceId as deviceId, SUM(odcw.stockNumber) as stockNumber
- from yr_operators_device_cargo_way as odcw
- where odcw.isDelete = 'NORMAL'
- and odcw.goodsId > 0
- group by odcw.deviceId
- union all
- select odrg.deviceId as deviceId, SUM(odrg.stockNumber) as stockNumber
- from yr_operators_device_replace_goods as odrg
- where odrg.status = 'INIT'
- and odrg.way = 'HOLD'
- group by odrg.deviceId)
- select ods.areaStaffId as areaStaffId, sum(ds.stockNumber) as totalNum
- from device_stock as ds
- left join yr_operators_device_site as ods on ds.deviceId = ods.deviceId
- left join yr_operators_device as od on ds.deviceId = od.id
- where od.bindStatus = 'BIND'
- and putStatus = 'USED'
- group by ods.areaStaffId
- </select>
- </mapper>
|