diff --git a/doc/databases/统计报表更新.sql b/doc/databases/统计报表更新.sql index 92be4cc8a0..69416603ae 100644 --- a/doc/databases/统计报表更新.sql +++ b/doc/databases/统计报表更新.sql @@ -313,6 +313,11 @@ BEGIN WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); -- 销售订单-待交车累计(销售订单已办结且库存状态为库存和在途的) +/* --待交车累计总订单台数统计规则: +1.现车:销售订单总台数-未选车架号台数 2.需采购的销售订单:已选择采购渠道销售订单总台数 + 3.排产中的销售订单:销售订单总台数。 + 4.已出库台数+已退车台数。 +待交车累计总订单台数=1+2+3-4*/ /* UPDATE daily_report r INNER JOIN (select count(bv.id) as scount, bv.useOrgSid, bv.modelSid, bv.modelConfigSid, bo.contractNo from anrui_base.base_vehicle bv @@ -352,7 +357,7 @@ BEGIN and bo.useOrgSid = a.useOrgSid and bm.modelSid = a.modelSid and bm.modelConfigSid = a.modelConfigSid - and bo.contractNo = a.contractNo) as ssscount1, + and bo.contractNo = a.contractNo and (bov.linkSid != '' or bov.linkSid != null)) as ssscount1, (SELECT count(bov.id) AS scount FROM anrui_base.base_vehicle bv LEFT JOIN anrui_buscenter.bus_sales_order_vehicle bov ON bov.linkSid = bv.sid @@ -444,7 +449,7 @@ BEGIN d.modelSid, d.modelConfigSid, d.contractNo - ) a) b) c + ) a) b ) c group by c.useOrgSid, c.modelSid, c.modelConfigSid ) AS s ON r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.modelSid