|
|
@ -413,7 +413,8 @@ BEGIN |
|
|
|
left join anrui_buscenter.bus_sales_order_price bp on bp.salesOrderSid = bo.sid |
|
|
|
left join anrui_scm.scm_purchase_channel scc on scc.saleOrderSid = bo.sid |
|
|
|
WHERE bo.nodeState = '已办结' |
|
|
|
and bo.type = 3 and scc.state = 2 |
|
|
|
and bo.type = 3 |
|
|
|
and scc.state = 2 |
|
|
|
GROUP BY bo.useOrgSid, |
|
|
|
bm.modelSid, |
|
|
|
bm.modelConfigSid, |
|
|
@ -428,9 +429,12 @@ BEGIN |
|
|
|
LEFT JOIN anrui_buscenter.bus_sales_order_model bm ON bm.salesOrderSid = bo.sid |
|
|
|
left join anrui_buscenter.bus_sales_order_price bp on bp.salesOrderSid = bo.sid |
|
|
|
left join anrui_scm.scm_purchase_channel scc on scc.saleOrderSid = bo.sid |
|
|
|
left join anrui_buscenter.bus_sales_order_vehicle bvvv on bvvv.salesOrderSid = bo.sid |
|
|
|
left join anrui_buscenter.bus_sales_order_vehicle bvvv |
|
|
|
on bvvv.salesOrderSid = bo.sid |
|
|
|
WHERE bo.nodeState = '已办结' |
|
|
|
and bo.type = 3 and scc.state is null and length(bvvv.linkSid)>0 |
|
|
|
and bo.type = 3 |
|
|
|
and scc.state is null |
|
|
|
and length(bvvv.linkSid) > 0 |
|
|
|
GROUP BY bo.useOrgSid, |
|
|
|
bm.modelSid, |
|
|
|
bm.modelConfigSid, |
|
|
@ -456,7 +460,8 @@ BEGIN |
|
|
|
left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid |
|
|
|
left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid |
|
|
|
where bv.salesDate like concat('%', CURDATE(), '%') |
|
|
|
and bvoa.saleTypeKey = '001' and bvo.isDelete = 0 |
|
|
|
and bvoa.saleTypeKey = '001' |
|
|
|
and bvo.isDelete = 0 |
|
|
|
and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or |
|
|
|
length(bvo.materialTypeValue) = 0) |
|
|
|
group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss |
|
|
@ -474,7 +479,8 @@ BEGIN |
|
|
|
left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid |
|
|
|
left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid |
|
|
|
where bv.salesDate like concat('%', CURDATE(), '%') |
|
|
|
and bvoa.saleTypeKey = '002' and bvo.isDelete = 0 |
|
|
|
and bvoa.saleTypeKey = '002' |
|
|
|
and bvo.isDelete = 0 |
|
|
|
and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or |
|
|
|
length(bvo.materialTypeValue) = 0) |
|
|
|
group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss |
|
|
@ -499,7 +505,8 @@ BEGIN |
|
|
|
left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid |
|
|
|
left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid |
|
|
|
where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') |
|
|
|
and bvoa.saleTypeKey = '001' and bvo.isDelete = 0 |
|
|
|
and bvoa.saleTypeKey = '001' |
|
|
|
and bvo.isDelete = 0 |
|
|
|
and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or |
|
|
|
length(bvo.materialTypeValue) = 0) |
|
|
|
group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss |
|
|
@ -517,7 +524,8 @@ BEGIN |
|
|
|
left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid |
|
|
|
left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid |
|
|
|
where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y-%m'), '%') |
|
|
|
and bvoa.saleTypeKey = '002' and bvo.isDelete = 0 |
|
|
|
and bvoa.saleTypeKey = '002' |
|
|
|
and bvo.isDelete = 0 |
|
|
|
and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or |
|
|
|
length(bvo.materialTypeValue) = 0) |
|
|
|
group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss |
|
|
@ -542,7 +550,8 @@ BEGIN |
|
|
|
left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid |
|
|
|
left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid |
|
|
|
where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') |
|
|
|
and bvoa.saleTypeKey = '001' and bvo.isDelete = 0 |
|
|
|
and bvoa.saleTypeKey = '001' |
|
|
|
and bvo.isDelete = 0 |
|
|
|
and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or |
|
|
|
length(bvo.materialTypeValue) = 0) |
|
|
|
group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss |
|
|
@ -560,7 +569,8 @@ BEGIN |
|
|
|
left join anrui_base.base_vehicle_out bvo on bv.sid = bvo.vinSid |
|
|
|
left join anrui_base.base_vehicle_out_apply bvoa on bvoa.sid = bvo.mainSid |
|
|
|
where bv.salesDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') |
|
|
|
and bvoa.saleTypeKey = '002' and bvo.isDelete = 0 |
|
|
|
and bvoa.saleTypeKey = '002' |
|
|
|
and bvo.isDelete = 0 |
|
|
|
and (bvo.materialTypeKey = '001' or bvo.materialTypeValue is null or |
|
|
|
length(bvo.materialTypeValue) = 0) |
|
|
|
group by bv.useOrgSid, bv.modelSid, bv.modelConfigSid) ss |
|
|
@ -1060,9 +1070,18 @@ BEGIN |
|
|
|
set arrears_carry_veh_amount = ROUND(s.scount / 10000, 2) |
|
|
|
where DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); |
|
|
|
|
|
|
|
-- 全年厂家开票数 |
|
|
|
UPDATE daily_report r INNER JOIN (SELECT COUNT(id) AS scount, `useOrgSid`, `modelSid`, `modelConfigSid` |
|
|
|
FROM anrui_base.`base_vehicle` |
|
|
|
WHERE manDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') |
|
|
|
GROUP BY `useOrgSid`, `modelSid`, `modelConfigSid`) AS s ON |
|
|
|
r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.modelSid AND r.vehMConfigSid = s.modelConfigSid |
|
|
|
SET r.`manufacturer_invoicing_year`=s.scount |
|
|
|
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); |
|
|
|
|
|
|
|
-- 金融未放款数量--- 截止当日贷款业务已出库且融资放款未认款的台数。 |
|
|
|
update daily_report r inner join ( |
|
|
|
|
|
|
|
-- 金融未放款数量--- 截止当日贷款业务已出库且融资放款未认款的台数。 |
|
|
|
/* update daily_report r inner join ( |
|
|
|
SELECT sum(b.scount) AS scount, |
|
|
|
b.useOrgSid, |
|
|
|
b.NAME, |
|
|
@ -1174,11 +1193,12 @@ BEGIN |
|
|
|
group by b.useOrgSid, b.vehModelSid, b.vehMConfigSid) as s on |
|
|
|
r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid |
|
|
|
SET r.`loan_not_count`=s.scount |
|
|
|
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); |
|
|
|
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ |
|
|
|
|
|
|
|
|
|
|
|
-- 金融未放款金额-- 截止当日贷款业务已出库且融资放款未认款的台数融资放款金额之和 |
|
|
|
|
|
|
|
update daily_report r inner join ( |
|
|
|
/* update daily_report r inner join ( |
|
|
|
select SUM(b.scount) AS scount, |
|
|
|
b.useOrgSid, |
|
|
|
b.NAME, |
|
|
@ -1287,19 +1307,10 @@ BEGIN |
|
|
|
r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid |
|
|
|
SET r.`loan_not_amount`=ROUND(s.scount / 10000, 2) |
|
|
|
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); |
|
|
|
|
|
|
|
|
|
|
|
-- 全年厂家开票数 |
|
|
|
UPDATE daily_report r INNER JOIN (SELECT COUNT(id) AS scount, `useOrgSid`, `modelSid`, `modelConfigSid` |
|
|
|
FROM anrui_base.`base_vehicle` |
|
|
|
WHERE manDate like concat('%', DATE_FORMAT(CURDATE(), '%Y'), '%') |
|
|
|
GROUP BY `useOrgSid`, `modelSid`, `modelConfigSid`) AS s ON |
|
|
|
r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.modelSid AND r.vehMConfigSid = s.modelConfigSid |
|
|
|
SET r.`manufacturer_invoicing_year`=s.scount |
|
|
|
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); |
|
|
|
*/ |
|
|
|
|
|
|
|
-- 金融未放款数量已信审终审--- 截止当日贷款业务已信审终审且融资放款未认款的台数。 |
|
|
|
update daily_report r inner join ( |
|
|
|
/*update daily_report r inner join ( |
|
|
|
select sum(b.scount) AS scount, |
|
|
|
b.useOrgSid, |
|
|
|
b.NAME, |
|
|
@ -1424,11 +1435,11 @@ BEGIN |
|
|
|
group by b.useOrgSid, b.vehModelSid, b.vehMConfigSid) as s on |
|
|
|
r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid |
|
|
|
SET r.`loan_not_counts`=s.scount |
|
|
|
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); |
|
|
|
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ |
|
|
|
|
|
|
|
-- 金融未放款金额已信审终审-- 截止当日贷款业务已信审终审且融资放款未认款的台数融资放款金额之和 |
|
|
|
|
|
|
|
update daily_report r inner join ( |
|
|
|
/* update daily_report r inner join ( |
|
|
|
SELECT SUM(b.scount) AS scount, |
|
|
|
b.useOrgSid, |
|
|
|
b.NAME, |
|
|
@ -1559,7 +1570,11 @@ BEGIN |
|
|
|
, b.vehMConfigSid) as s on |
|
|
|
r.useOrgSid = s.useOrgSid AND r.vehModelSid = s.vehModelSid AND r.vehMConfigSid = s.vehMConfigSid |
|
|
|
SET r.`loan_not_amounts`=ROUND(s.scount / 10000, 2) |
|
|
|
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE(); |
|
|
|
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') = CURDATE();*/ |
|
|
|
|
|
|
|
|
|
|
|
-- 金融未放款 统计规则调整:包含担保和非担保。 金融未放款(已开票):截止当日贷款业务已开票的,融资放款应收未认款金额+未生成融资放款的总贷款金额。 |
|
|
|
-- 金融未放款(已终审):截止当日贷款业务的已开票且信审终审已通过,统计融资放款未认款金额。 |
|
|
|
|
|
|
|
|
|
|
|
END |