【订单进度跟踪】下线数量统计

dev
siontion 3 months ago
parent ba90884a3d
commit 01f13adb4d

@ -163,18 +163,11 @@ public interface ProjectOrderSubMapper extends BaseMapperX<ProjectOrderSubDO> {
.select("c.name as customerName")
.select("d.name as projectSubName", "d.code as projectSubCode")
.select("COALESCE(SUM(case when g.is_final=1 and g.name!='成品包装' then h.amount else 0 end), 0) as reportAmount")
.select("(SELECT count(distinct g.name,IFNULL(h.assemble_code,'')) " +
"FROM project_sale_order_sub o " +
"LEFT JOIN project_sale_order a ON (a.id = o.project_order_id) " +
"LEFT JOIN project_plan b ON (b.project_id = a.id) " +
"LEFT JOIN base_customer c ON (c.id = a.customer_id) " +
"LEFT JOIN base_material d ON (d.id = o.material_id) " +
"LEFT JOIN pro_task_dispatch e ON (e.project_sub_id = o.id) " +
"LEFT JOIN pro_task_dispatch_detail f ON (f.dispatch_id = e.id) " +
"LEFT JOIN base_procedure g ON (g.id = f.procedure_id AND g.is_final = 1) " +
"LEFT JOIN pro_task_report h ON (h.dispatch_detail_id = f.id AND h.has_report = 1) " +
"WHERE o.deleted=0 AND (a.order_status = 8 AND a.is_snapshot = 0) and g.name='成品包装' and o.id=t.id " +
") reportAmount1")
.select("ifnull((select amount from ( " +
"select a.material_id,a.project_id,sum(a.amount) as amount from " +
" (select distinct assemble_code,material_id,procedure_id,amount,SUBSTRING_INDEX(assemble_code,'-',1) as project_id from pro_task_report where isnull(assemble_code)=0) as a " +
"group by a.material_id,a.project_id) as b where b.material_id=t.material_id and b.project_id=t.project_order_id " +
"),0) reportAmount1")
.select("b.status as planStatus")
.leftJoin(ProjectOrderDO.class, "a", ProjectOrderDO::getId, ProjectOrderSubDO::getProjectOrderId)
.leftJoin(PlanDO.class, "b", PlanDO::getProjectId, ProjectOrderDO::getId)

Loading…
Cancel
Save