Переглянути джерело

[update] 日统计司机设备回仓中设备撤机回仓接口不进行统计

miajio 2 тижнів тому
батько
коміт
ac7aa45561

+ 16 - 34
warehouse-admin-data/src/main/resources/mapper/statistics/BillingQuantityStatisticsMapper.xml

@@ -6,8 +6,9 @@
         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.modify_time between #{beginTime} and #{endTime}
-        and poi.picking_status = 2
+        where
+        poi.picking_time is not null
+        and poi.picking_time between #{beginTime} and #{endTime}
         and pod.is_aggregation = 0
         group by poi.area_staff_id, pod.goods_id
     </select>
@@ -18,8 +19,9 @@
                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}
-        and api.status = 'UN_REPLENISH'
+        where
+            api.picking_time is not null
+        and api.picking_time between #{beginTime} and #{endTime}
         group by api.area_staff_id, apd.goods_id
     </select>
 
@@ -92,36 +94,16 @@
     </select>
 
     <select id="queryDriverReturnNum" resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">
-        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 oas.id 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
+                 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
     </select>
     <select id="queryDriverDeviceInventoryNum"
             resultType="com.yr.warehouse.admin.replenish.vo.DriverGoodsOrderNumVo">