<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "产量信息统计">
<query id = "FrmrptTotalProduct.get_TotalProductionData_Insert" desc = "A、B、D、E、F、G产量信息查询">
<![CDATA[
BEGIN 
delete from TEMP_TAB_RPT_PRODUCTION;
insert into TEMP_TAB_RPT_PRODUCTION (productiondate, processcode,area,dept,plinename,production,totalproduction, 
outputweight, totaloutputweight,productionrate,firstgoodrate,productionrate_m,firstgoodrate_m,input, 
output, firstgood,totalinput,totaloutput,totalfirstgood) 
select '#today#' as productiondate,'A' as processcode
  ,a.department_desc_p as area ,a.factoryname as dept,a.pline_name as plinename
  ,to_char(production_d,'FM9,999,990.000') as production
  ,to_char(production_m,'FM9,999,990.000') as totalproduction
,(select to_char(sum(nvl(t.TAPPINGWGT,0)),'FM9,999,999.000')
  from stl_eaf_optinfo t
  where to_char(t.OPTDATE+3/24,'yyyyMMdd')=replace('#today#','-','')
      and nvl((select t1.ef_pline_code from stl_control_log t1
      where t.stove_no=t1.stove_no and rownum=1),
      (select t2.ef_pline_code from pln_steelforfurnace t2
      where t.stove_no=t2.stove_no and rownum=1))=a.pline_code) as output 
  ,(select to_char(sum(nvl(t.TAPPINGWGT,0)),'FM999,999.000')   
  from stl_eaf_optinfo t
  where substr(to_char(t.OPTDATE+3/24,'yyyyMMdd'),1,6)=replace(substr('#today#',1,7),'-','')  
      and to_char(t.OPTDATE+3/24,'yyyyMMdd')<=replace('#today#','-','')
      and nvl((select t1.ef_pline_code from stl_control_log t1
      where t.stove_no=t1.stove_no and rownum=1),
      (select t2.ef_pline_code from pln_steelforfurnace t2
      where t.stove_no=t2.stove_no and rownum=1))=a.pline_code) as totaloutput    
  ,'' as productionrate,'' as firstgoodrate
    ,'' as productionrate_m,'' as firstgoodrate_m
    ,to_number(null) as input,to_number(null) as output,to_number(null) as firstgood
    ,to_number(null) as totalinput,to_number(null) as totaloutput,to_number(null) as totalfirstgood
from v_production_a_pline a
left join (select t.pline_code,sum(t.production) as production_m
  from v_production_a t
  where t.bal_year_month=replace(substr('#today#',1,7),'-','')
           and t.proc_date<=replace('#today#','-','')
  group by t.pline_code) x on x.pline_code=a.pline_code
left join (select t.pline_code,sum(t.production) as production_d
  from v_production_a t
  where t.proc_date=replace('#today#','-','')
  group by t.pline_code) y on y.pline_code=a.pline_code
where x.production_m is not null 
order by a.department_code_p,a.factory_code,a.pline_code; 

insert into TEMP_TAB_RPT_PRODUCTION (productiondate, processcode,area,dept,plinename,production,totalproduction, 
outputweight, totaloutputweight,productionrate,firstgoodrate,productionrate_m,firstgoodrate_m,input, 
output, firstgood,totalinput,totaloutput,totalfirstgood) 
select '#today#' as productiondate,'B' as processcode
  ,a.department_desc_p as area ,a.factoryname as dept,a.pline_name as plinename
  ,to_char(production_d,'FM9,999,990.000') as production
  ,to_char(production_m,'FM9,999,990.000') as totalproduction
  ,to_char((select sum(t.weight) --合格量
  from v_production_b_pweight t
  where t.proc_date=replace('#today#','-','')
      and t.pline_code=a.pline_code),'FM9,999,999.000') as outputweight
  ,to_char((select sum(t.weight) --合格量
  from v_production_b_pweight t
  where t.bal_year_month=replace(substr('#today#',1,7),'-','')
      and t.proc_date<=replace('#today#','-','')
      and t.pline_code=a.pline_code),'FM9,999,999.000') as totaloutputweight
  ,''  as productionrate  ,''  as firstgoodrate
  ,''  as productionrate_m  ,''  as firstgoodrate_m
  ,y.output_d as input,y.output_d as output,y.firstgood_d as firstgood
  ,x.output_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
from v_production_b_pline a 
left join (select t.pline_code
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_b_new t
      where t.bal_year_month=replace(substr('#today#',1,7),'-','')
           and t.proc_date<=replace('#today#','-','')
      group by t.pline_code) x on x.pline_code=a.pline_code
left join
     (select t.pline_code
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
      from v_production_b_new t
      where t.proc_date=replace('#today#','-','')
      group by t.pline_code) y on y.pline_code=a.pline_code
where (select sum(t.weight) --合格量
  from v_production_b_pweight t
  where t.bal_year_month=replace(substr('#today#',1,7),'-','')
      and to_char(t.product_TIME+3/24,'yyyyMMdd')<=replace('#today#','-','')
      and t.pline_code=a.pline_code) is not null or production_m is not null
order by a.department_code_p,a.factory_code,a.pline_code;

insert into TEMP_TAB_RPT_PRODUCTION (productiondate, processcode,area,dept,plinename,production,totalproduction, 
outputweight, totaloutputweight,productionrate,firstgoodrate,productionrate_m,firstgoodrate_m,input, 
output, firstgood,totalinput,totaloutput,totalfirstgood) 
select '#today#' as productiondate,'D' as processcode
  ,a.department_desc_p as area ,a.factoryname as dept,a.pline_name as plinename
  ,to_char(production_d,'FM9,999,990.000') as production
  ,to_char(production_m,'FM9,999,990.000') as totalproduction
  ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
      from v_production_d_pweight y
      where y.proc_date=replace('#today#','-','') and qualified_wt>0
      and y.pline_code=x.pline_code) as outputweight
  ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
      from v_production_d_pweight y
      where y.bal_year_month=replace(substr('#today#',1,7),'-','')
      and y.proc_date<=replace('#today#','-','') and qualified_wt>0
      and y.pline_code=x.pline_code) as totaloutputweight
  ,''  as productionrate
  ,''  as firstgoodrate
  ,''  as productionrate_m
  ,''  as firstgoodrate_m
  ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
from v_production_d_pline a 
left join (select t.pline_code,sum(t.input) as input_m,sum(t.outputweight) as outputweight_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_d_new t
      where substr(t.production_date,1,7)=substr('#today#',1,7)
           and t.production_date<='#today#'
      group by t.pline_code) x on x.pline_code=a.pline_code
left join
     (select t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.outputweight) as outputweight_d
      from v_production_d_new t
      where t.production_date='#today#'
      group by t.pline_code) y on y.pline_code=a.pline_code
where (select sum(y.qualified_wt)
      from v_production_d_pweight y
      where y.bal_year_month=replace(substr('#today#',1,7),'-','')
      and y.proc_date<=replace('#today#','-','') and qualified_wt>0
      and y.pline_code=x.pline_code) is not null or production_m is not null 
order by a.department_code_p,a.factory_code,a.pline_code;

insert into TEMP_TAB_RPT_PRODUCTION (productiondate, processcode,area,dept,plinename,production,totalproduction, 
outputweight, totaloutputweight,productionrate,firstgoodrate,productionrate_m,firstgoodrate_m,input, 
output, firstgood,totalinput,totaloutput,totalfirstgood) 
select '#today#' as productiondate,'E' as processcode
  ,a.department_desc_p,a.factoryname,a.pline_name as plinename
  ,to_char(production_d,'FM9,999,990.000') as production
  ,to_char(production_m,'FM9,999,990.000') as totalproduction
  ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
      from v_production_e_pweight y
      where y.proc_date=replace('#today#','-','')
      and y.pline_code=x.pline_code) as outputweight
  ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000') 
      from v_production_e_pweight y
      where bal_year_month=replace(substr('#today#',1,7),'-','')
      and y.proc_date<=replace('#today#','-','')
      and y.pline_code=x.pline_code) as totaloutputweight
  ,'' as productionrate
  ,'' as firstgoodrate
  ,'' as productionrate_m
  ,'' as firstgoodrate_m
  ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
from v_production_e_pline a
left join
     (select t.pline_code,sum(t.input) as input_m,sum(t.output_weight) as outputweight_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_e t
      where substr(t.production_date,1,7)=substr('#today#',1,7)
           and t.production_date<='#today#'
      group by t.pline_code) x on x.pline_code=a.pline_code
left join
     (select t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.output_weight) as outputweight_d
      from v_production_e t
      where t.production_date='#today#'
      group by t.pline_code) y on y.pline_code=a.pline_code
where (select sum(y.qualified_wt)
      from v_production_e_pweight y
      where y.bal_year_month=replace(substr('#today#',1,7),'-','')
      and y.proc_date<=replace('#today#','-','')
      and y.pline_code=x.pline_code) is not null or production_m is not null
order by a.department_code_p,a.factory_code,a.pline_code; 

insert into TEMP_TAB_RPT_PRODUCTION (productiondate, processcode,area,dept,plinename,production,totalproduction, 
outputweight, totaloutputweight,productionrate,firstgoodrate,productionrate_m,firstgoodrate_m,input, 
output, firstgood,totalinput,totaloutput,totalfirstgood) 
select '#today#' as productiondate,'F' as processcode
  ,a.department_desc_p,a.factoryname,a.pline_name as plinename
  ,to_char(production_d,'FM9,999,990.000') as production
  ,to_char(production_m,'FM9,999,990.000') as totalproduction
  ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
      from v_production_f_pweight y
      where proc_date=replace('#today#','-','')
      and y.pline_code=x.pline_code) as outputweight
  ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
      from v_production_f_pweight y
      where y.bal_year_month=replace(substr('#today#',1,7),'-','')
      and y.proc_date<=replace('#today#','-','')
      and y.pline_code=x.pline_code) as totaloutputweight
  ,'' as productionrate
  ,'' as firstgoodrate
  ,'' as productionrate_m
  ,'' as firstgoodrate_m
  ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
from v_production_f_pline a
left join
     (select t.pline_code,sum(t.input) as input_m,sum(t.output_weight) as outputweight_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_f t
      where substr(t.production_date,1,7)=substr('#today#',1,7)
           and t.production_date<='#today#'
      group by t.pline_code) x on x.pline_code=a.pline_code
left join
     (select t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.output_weight) as outputweight_d
      from v_production_f t
      where t.production_date='#today#'
      group by t.pline_code) y on y.pline_code=a.pline_code
where (select sum(y.qualified_wt)
      from v_production_f_pweight y
      where y.bal_year_month=replace(substr('#today#',1,7),'-','')
      and y.proc_date<=replace('#today#','-','')
      and y.pline_code=x.pline_code) is not null or production_m is not null 
order by a.department_code_p,a.factory_code,a.pline_code;

insert into TEMP_TAB_RPT_PRODUCTION (productiondate, processcode,area,dept,plinename,production,totalproduction, 
outputweight, totaloutputweight,productionrate,firstgoodrate,productionrate_m,firstgoodrate_m,input, 
output, firstgood,totalinput,totaloutput,totalfirstgood) 
select '#today#' as productiondate,'G' as processcode
  ,a.department_desc_p,a.factoryname,a.pline_name as plinename
  ,to_char(production_d,'FM9,999,990.000') as production
  ,to_char(production_m,'FM9,999,990.000') as totalproduction
  ,(select to_char(sum(qualified_wt),'FM9,999,990.000')
      from v_production_g_pweight  t --生产点
      where proc_date=replace('#today#','-','')
      and t.pline_code=a.pline_code) as outputweight
  ,(select to_char(sum(qualified_wt),'FM9,999,990.000')
      from v_production_g_pweight  t --生产点
      where t.bal_year_month=replace(substr('#today#',1,7),'-','')
      and proc_date<=replace('#today#','-','')
      and t.pline_code=a.pline_code) as totaloutputweight
  ,'' as productionrate
  ,'' as firstgoodrate
  ,'' as productionrate_m
  ,'' as firstgoodrate_m 
  ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
from v_production_g_pline a
left join
     (select t.pline_code,sum(t.input) as input_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m,sum(t.output_weight) as outputweight_m
      from v_production_g t
      where substr(t.production_date,1,7)=substr('#today#',1,7)
           and t.production_date<='#today#'
      group by t.pline_code) x on x.pline_code=a.pline_code
left join
     (select t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.output_weight) as outputweight_d
      from v_production_g t
      where t.production_date='#today#'
      group by t.pline_code) y on y.pline_code=a.pline_code
where (select sum(qualified_wt)
      from v_production_g_pweight  t --生产点
      where t.bal_year_month=replace(substr('#today#',1,7),'-','')
      and proc_date<=replace('#today#','-','')
      and t.pline_code=a.pline_code) is not null or production_m is not null
order by a.department_code_p,a.factory_code,a.pline_code;
commit;
end;
]]>
</query>

<query id = "FrmrptTotalProduct.get_TotalProductionData_Select" desc = "A、B、D、E、F、G产量信息查询">
<![CDATA[
select * from TEMP_TAB_RPT_PRODUCTION where productiondate='#today#'
]]>
</query>

<query id = "FrmrptTotalProduct.get_TotalProductionData0" desc = "A、B、D、E、F、G产量信息查询">
<![CDATA[
select * from (select '#today#' as productiondate,'A' as processcode
  ,a.department_desc_p as area ,a.factoryname as dept,a.pline_name as plinename
  ,to_char(production_d,'FM9,999,990.000') as production
  ,to_char(production_m,'FM9,999,990.000') as totalproduction
  ,to_char(production_d,'FM9,999,990.000') as outputweight
  ,to_char(production_m,'FM9,999,990.000') as totaloutputweight
  ,'' as productionrate,'' as firstgoodrate
    ,'' as productionrate_m,'' as firstgoodrate_m
    ,to_number(null) as input,to_number(null) as output,to_number(null) as firstgood
    ,to_number(null) as totalinput,to_number(null) as totaloutput,to_number(null) as totalfirstgood
from v_production_a_pline a
left join (select t.pline_code,sum(t.production) as production_m
  from v_production_a t
  where t.bal_year_month=replace(substr('#today#',1,7),'-','')
           and t.proc_date<=replace('#today#','-','')
  group by t.pline_code) x on x.pline_code=a.pline_code
left join (select t.pline_code,sum(t.production) as production_d
  from v_production_a t
  where t.proc_date=replace('#today#','-','')
  group by t.pline_code) y on y.pline_code=a.pline_code
where x.production_m is not null 
order by a.department_code_p,a.factory_code,a.pline_code) 
union all
select * from (select '#today#' as productiondate,'B' as processcode
  ,a.department_desc_p as area ,a.factoryname as dept,a.pline_name as plinename
  ,to_char(production_d,'FM9,999,990.000') as production
  ,to_char(production_m,'FM9,999,990.000') as totalproduction
  ,to_char((select sum(t.weight) --合格量
  from v_production_b_pweight t
  where t.proc_date=replace('#today#','-','')
      and t.pline_code=a.pline_code),'FM999999.000') as outputweight
  ,to_char((select sum(t.weight) --合格量
  from v_production_b_pweight t
  where t.bal_year_month=replace(substr('#today#',1,7),'-','')
      and t.proc_date<=replace('#today#','-','')
      and t.pline_code=a.pline_code),'FM999999.000') as totaloutputweight
  ,''  as productionrate  ,''  as firstgoodrate
  ,''  as productionrate_m  ,''  as firstgoodrate_m
  ,y.output_d as input,y.output_d as output,y.firstgood_d as firstgood
  ,x.output_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
from v_production_b_pline a 
left join (select t.pline_code
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_b_new t
      where t.bal_year_month=replace(substr('#today#',1,7),'-','')
           and t.proc_date<=replace('#today#','-','')
      group by t.pline_code) x on x.pline_code=a.pline_code
left join
     (select t.pline_code
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
      from v_production_b_new t
      where t.proc_date=replace('#today#','-','')
      group by t.pline_code) y on y.pline_code=a.pline_code
where/* (select sum(t.weight) --合格量+废品
  from v_production_b_pweight t
  where t.bal_year_month=replace(substr('#today#',1,7),'-','')
      and to_char(t.product_TIME+3/24,'yyyyMMdd')<=replace('#today#','-','')
      and t.pline_code=a.pline_code) is not null or */production_m is not null
order by a.department_code_p,a.factory_code,a.pline_code) 
union all
select * from (select '#today#' as productiondate,'D' as processcode
  ,a.department_desc_p as area ,a.factoryname as dept,a.pline_name as plinename
  ,to_char(production_d,'FM9,999,990.000') as production
  ,to_char(production_m,'FM9,999,990.000') as totalproduction
  ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
      from v_production_d_pweight y
      where y.proc_date=replace('#today#','-','') and qualified_wt>0
      and y.pline_code=x.pline_code) as outputweight
  ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
      from v_production_d_pweight y
      where y.bal_year_month=replace(substr('#today#',1,7),'-','')
      and y.proc_date<=replace('#today#','-','') and qualified_wt>0
      and y.pline_code=x.pline_code) as totaloutputweight
  ,''  as productionrate
  ,''  as firstgoodrate
  ,''  as productionrate_m
  ,''  as firstgoodrate_m
  ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
from v_production_d_pline a 
left join (select t.pline_code,sum(t.input) as input_m,sum(t.outputweight) as outputweight_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_d_new t
      where substr(t.production_date,1,7)=substr('#today#',1,7)
           and t.production_date<='#today#'
      group by t.pline_code) x on x.pline_code=a.pline_code
left join
     (select t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.outputweight) as outputweight_d
      from v_production_d_new t
      where t.production_date='#today#'
      group by t.pline_code) y on y.pline_code=a.pline_code
where (select sum(y.qualified_wt)
      from v_production_d_pweight y
      where y.bal_year_month=replace(substr('#today#',1,7),'-','')
      and y.proc_date<=replace('#today#','-','') and qualified_wt>0
      and y.pline_code=x.pline_code) is not null or production_m is not null 
order by a.department_code_p,a.factory_code,a.pline_code) 
union all
select *  from (select '#today#' as productiondate,'E' as processcode
  ,a.department_desc_p,a.factoryname,a.pline_name as plinename
  ,to_char(production_d,'FM9,999,990.000') as production
  ,to_char(production_m,'FM9,999,990.000') as totalproduction
  ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
      from v_production_e_pweight y
      where y.proc_date=replace('#today#','-','')
      and y.pline_code=x.pline_code) as outputweight
  ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000') 
      from v_production_e_pweight y
      where bal_year_month=replace(substr('#today#',1,7),'-','')
      and y.proc_date<=replace('#today#','-','')
      and y.pline_code=x.pline_code) as totaloutputweight
  ,'' as productionrate
  ,'' as firstgoodrate
  ,'' as productionrate_m
  ,'' as firstgoodrate_m
  ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
from v_production_e_pline a
left join
     (select t.pline_code,sum(t.input) as input_m,sum(t.output_weight) as outputweight_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_e t
      where substr(t.production_date,1,7)=substr('#today#',1,7)
           and t.production_date<='#today#'
      group by t.pline_code) x on x.pline_code=a.pline_code
left join
     (select t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.output_weight) as outputweight_d
      from v_production_e t
      where t.production_date='#today#'
      group by t.pline_code) y on y.pline_code=a.pline_code
where (select sum(y.qualified_wt)
      from v_production_e_pweight y
      where y.bal_year_month=replace(substr('#today#',1,7),'-','')
      and y.proc_date<=replace('#today#','-','')
      and y.pline_code=x.pline_code) is not null or production_m is not null
order by a.department_code_p,a.factory_code,a.pline_code) 
union all
select *  from (select '#today#' as productiondate,'F' as processcode
  ,a.department_desc_p,a.factoryname,a.pline_name as plinename
  ,to_char(production_d,'FM9,999,990.000') as production
  ,to_char(production_m,'FM9,999,990.000') as totalproduction
  ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
      from v_production_f_pweight y
      where proc_date=replace('#today#','-','')
      and y.pline_code=x.pline_code) as outputweight
  ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
      from v_production_f_pweight y
      where y.bal_year_month=replace(substr('#today#',1,7),'-','')
      and y.proc_date<=replace('#today#','-','')
      and y.pline_code=x.pline_code) as totaloutputweight
  ,'' as productionrate
  ,'' as firstgoodrate
  ,'' as productionrate_m
  ,'' as firstgoodrate_m
  ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
from v_production_f_pline a
left join
     (select t.pline_code,sum(t.input) as input_m,sum(t.output_weight) as outputweight_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_f t
      where substr(t.production_date,1,7)=substr('#today#',1,7)
           and t.production_date<='#today#'
      group by t.pline_code) x on x.pline_code=a.pline_code
left join
     (select t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.output_weight) as outputweight_d
      from v_production_f t
      where t.production_date='#today#'
      group by t.pline_code) y on y.pline_code=a.pline_code
where (select sum(y.qualified_wt)
      from v_production_f_pweight y
      where y.bal_year_month=replace(substr('#today#',1,7),'-','')
      and y.proc_date<=replace('#today#','-','')
      and y.pline_code=x.pline_code) is not null or production_m is not null 
order by a.department_code_p,a.factory_code,a.pline_code)
union all
select * from (select '#today#' as productiondate,'G' as processcode
  ,a.department_desc_p,a.factoryname,a.pline_name as plinename
  ,to_char(production_d,'FM9,999,990.000') as production
  ,to_char(production_m,'FM9,999,990.000') as totalproduction
  ,(select to_char(sum(qualified_wt),'FM9,999,990.000')
      from v_production_g_pweight  t --生产点
      where proc_date=replace('#today#','-','')
      and t.pline_code=a.pline_code) as outputweight
  ,(select to_char(sum(qualified_wt),'FM9,999,990.000')
      from v_production_g_pweight  t --生产点
      where t.bal_year_month=replace(substr('#today#',1,7),'-','')
      and proc_date<=replace('#today#','-','')
      and t.pline_code=a.pline_code) as totaloutputweight
  ,'' as productionrate
  ,'' as firstgoodrate
  ,'' as productionrate_m
  ,'' as firstgoodrate_m 
  ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
from v_production_g_pline a
left join
     (select t.pline_code,sum(t.input) as input_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m,sum(t.output_weight) as outputweight_m
      from v_production_g t
      where substr(t.production_date,1,7)=substr('#today#',1,7)
           and t.production_date<='#today#'
      group by t.pline_code) x on x.pline_code=a.pline_code
left join
     (select t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.output_weight) as outputweight_d
      from v_production_g t
      where t.production_date='#today#'
      group by t.pline_code) y on y.pline_code=a.pline_code
where (select sum(qualified_wt)
      from v_production_g_pweight  t --生产点
      where t.bal_year_month=replace(substr('#today#',1,7),'-','')
      and proc_date<=replace('#today#','-','')
      and t.pline_code=a.pline_code) is not null or production_m is not null
order by a.department_code_p,a.factory_code,a.pline_code)
]]>
</query>

<query id = "FrmrptTotalProduct.get_TotalProductionData1" desc = "A、B、D、E、F、G产量信息查询">
<![CDATA[
select * from (select nvl(y.production_date,'#today#') as productiondate,'A' as processcode
	,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
	,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
	,round(production_d,3) as production
	,round(production_m,3) as totalproduction
	,to_number(null) as productionrate,to_number(null) as firstgoodrate
    ,to_number(null) as productionrate_m,to_number(null) as firstgoodrate_m
from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.production) as production_m
	from v_production_a t
	where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
	and substr(t.production_date,1,7)=substr('#today#',1,7)
	group by substr(t.production_date,1,7),t.pline_code) x
left join (select t.production_date,t.pline_code,sum(t.production) as production_d
	from v_production_a t
	where t.production_date='#today#'
	group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
order by x.pline_code) 
union all
select * from (select nvl(y.production_date,'#today#') as productiondate,'B' as processcode
  ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  ,round(production_d,3) as production
  ,round(production_m,3) as totalproduction
  ,case when nvl(y.output_d,0.00)=0.00 then to_number(null) else round(y.production_d*100/y.output_d,2) end as productionrate
  ,case when nvl(y.output_d,0.00)=0.00 then to_number(null) else round(y.firstgood_d*100/y.output_d,2) end as firstgoodrate
  ,case when nvl(x.output_m,0.00)=0.00 then to_number(null) else round(x.production_m*100/x.output_m,2) end as productionrate_m
  ,case when nvl(x.output_m,0.00)=0.00 then to_number(null) else round(x.firstgood_m*100/x.output_m,2) end as firstgoodrate_m
from (select substr(t.production_date,1,7) as ny,t.pline_code
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_b_new t
      where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
           and substr(t.production_date,1,7)=substr('#today#',1,7)
      group by substr(t.production_date,1,7),t.pline_code) x
left join
     (select t.production_date,t.pline_code
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
      from v_production_b_new t
      where t.production_date='#today#'
      group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
order by x.pline_code) 
union all
select * from (select nvl(y.production_date,'#today#') as productiondate,'D' as processcode
  ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  ,round(production_d,3) as production
  ,round(production_m,3) as totalproduction
  ,case when nvl(y.input_d,0.00)=0.00 then to_number(null) else round(y.production_d*100/y.input_d,2) end as productionrate
  ,case when nvl(y.output_d,0.00)=0.00 then to_number(null) else round(y.firstgood_d*100/y.output_d,2) end as firstgoodrate
  ,case when nvl(x.input_m,0.00)=0.00 then to_number(null) else round(x.production_m*100/x.input_m,2) end as productionrate_m
  ,case when nvl(x.output_m,0.00)=0.00 then to_number(null) else round(x.firstgood_m*100/x.output_m,2) end as firstgoodrate_m
from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_d t
      where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
           and substr(t.production_date,1,7)=substr('#today#',1,7)
      group by substr(t.production_date,1,7),t.pline_code) x
left join
     (select t.production_date,t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
      from v_production_d t
      where t.production_date='#today#'
      group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
order by x.pline_code) 
union all
select *  from (select nvl(y.production_date,'#today#') as productiondate,'E' as processcode
  ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  ,round(production_d,3) as production
  ,round(production_m,3) as totalproduction
  ,case when nvl(y.input_d,0.00)=0.00 then to_number(null) else round(y.production_d*100/y.input_d,2) end as productionrate
  ,case when nvl(y.output_d,0.00)=0.00 then to_number(null) else round(y.firstgood_d*100/y.output_d,2) end as firstgoodrate
  ,case when nvl(x.input_m,0.00)=0.00 then to_number(null) else round(x.production_m*100/x.input_m,2) end as productionrate_m
  ,case when nvl(x.output_m,0.00)=0.00 then to_number(null) else round(x.firstgood_m*100/x.output_m,2) end as firstgoodrate_m
from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_e t
      where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
           and substr(t.production_date,1,7)=substr('#today#',1,7)
      group by substr(t.production_date,1,7),t.pline_code) x
left join
     (select t.production_date,t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
      from v_production_e t
      where t.production_date='#today#'
      group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
order by x.pline_code) 
union all
select *  from (select nvl(y.production_date,'#today#') as productiondate,'F' as processcode
  ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  ,round(production_d,3) as production
  ,round(production_m,3) as totalproduction
  ,case when nvl(y.input_d,0.00)=0.00 then to_number(null) else round(y.production_d*100/y.input_d,2) end as productionrate
  ,case when nvl(y.output_d,0.00)=0.00 then to_number(null) else round(y.firstgood_d*100/y.output_d,2) end as firstgoodrate
  ,case when nvl(x.input_m,0.00)=0.00 then to_number(null) else round(x.production_m*100/x.input_m,2) end as productionrate_m
  ,case when nvl(x.output_m,0.00)=0.00 then to_number(null) else round(x.firstgood_m*100/x.output_m,2) end as firstgoodrate_m
from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_f t
      where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
           and substr(t.production_date,1,7)=substr('#today#',1,7)
      group by substr(t.production_date,1,7),t.pline_code) x
left join
     (select t.production_date,t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
      from v_production_f t
      where t.production_date='#today#'
      group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
order by x.pline_code)
union all
select * from (select nvl(y.production_date,'#today#') as productiondate,'G' as processcode
  ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  ,round(production_d,3) as production
  ,round(production_m,3) as totalproduction
  ,case when nvl(y.input_d,0.00)=0.00 then to_number(null) else round(y.production_d*100/y.input_d,2) end as productionrate
  ,case when nvl(y.output_d,0.00)=0.00 then to_number(null) else round(y.firstgood_d*100/y.output_d,2) end as firstgoodrate
  ,case when nvl(x.input_m,0.00)=0.00 then to_number(null) else round(x.production_m*100/x.input_m,2) end as productionrate_m
  ,case when nvl(x.output_m,0.00)=0.00 then to_number(null) else round(x.firstgood_m*100/x.output_m,2) end as firstgoodrate_m 
from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_g t
      where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
           and substr(t.production_date,1,7)=substr('#today#',1,7)
      group by substr(t.production_date,1,7),t.pline_code) x
left join
     (select t.production_date,t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
      from v_production_g t
      where t.production_date='#today#'
      group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
order by x.pline_code)
]]>
</query>

<query id = "FrmrptTotalProduct.get_TotalProductionData_old" desc = "A、B、D、E、F、G产量信息查询">
<![CDATA[
select * from (select nvl(y.production_date,'#today#') as productiondate,'A' as processcode
	,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
	,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
	,case when y.production_date is null then '' else to_char(round(production_d,3),'FM9999,999') end as production
	,case when y.production_date is null then '' else to_char(round(production_m,3),'FM9999,999') end as totalproduction
	,'' as productionrate,'' as firstgoodrate
from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.production) as production_m
	from v_production_a t
	where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
	and substr(t.production_date,1,7)=substr('#today#',1,7)
	group by substr(t.production_date,1,7),t.pline_code) x
left join (select t.production_date,t.pline_code,sum(t.production) as production_d
	from v_production_a t
	where t.production_date='#today#'
	group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
order by x.pline_code)
union all
select * from (select nvl(y.production_date,'#today#') as productiondate,'B' as processcode
  ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
,to_char(round(production_d,3),'FM999,999.000') as production
,to_char(round(production_m,3),'FM999,999.000') as totalproduction
,case when y.production_date is null then '' else to_char(round(y.production_d*100/y.output_d,2),'FM999.00') || '%' end as productionrate
,case when y.production_date is null then '' else to_char(round(y.firstgood_d*100/y.output_d,2),'FM999.00') || '%' end as firstgoodrate
from (select substr(t.production_date,1,7) as ny,t.pline_code
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_b_new t
      where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
           and substr(t.production_date,1,7)=substr('#today#',1,7)
      group by substr(t.production_date,1,7),t.pline_code) x
left join
     (select t.production_date,t.pline_code
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
      from v_production_b_new t
      where t.production_date='#today#'
      group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
order by x.pline_code)
union all
select * from (select nvl(y.production_date,'#today#') as productiondate,'D' as processcode
  ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
,to_char(round(production_d,3),'FM999,999.000') as production
,to_char(round(production_m,3),'FM999,999.000') as totalproduction
,case when y.production_date is null then '' else to_char(round(y.production_d*100/y.input_d,2),'FM999.00') || '%' end as productionrate
,case when y.production_date is null then '' else to_char(round(y.firstgood_d*100/y.output_d,2),'FM999.00') || '%' end as firstgoodrate
from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_d t
      where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
           and substr(t.production_date,1,7)=substr('#today#',1,7)
      group by substr(t.production_date,1,7),t.pline_code) x
left join
     (select t.production_date,t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
      from v_production_d t
      where t.production_date='#today#'
      group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
order by x.pline_code)
union all
select * from (select nvl(y.production_date,'#today#') as productiondate,'E' as processcode
  ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
,to_char(round(production_d,3),'FM999,999.000') as production
,to_char(round(production_m,3),'FM999,999.000') as totalproduction
,case when y.production_date is null then '' else to_char(round(y.production_d*100/y.input_d,2),'FM999.00') || '%' end as productionrate
,case when y.production_date is null then '' else to_char(round(y.firstgood_d*100/y.output_d,2),'FM999.00') || '%' end as firstgoodrate
from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_e t
      where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
           and substr(t.production_date,1,7)=substr('#today#',1,7)
      group by substr(t.production_date,1,7),t.pline_code) x
left join
     (select t.production_date,t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
      from v_production_e t
      where t.production_date='#today#'
      group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
order by x.pline_code)
union all
select * from (select nvl(y.production_date,'#today#') as productiondate,'E' as processcode
  ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
,to_char(round(production_d,3),'FM999,999.000') as production
,to_char(round(production_m,3),'FM999,999.000') as totalproduction
,case when y.production_date is null then '' else to_char(round(y.production_d*100/y.input_d,2),'FM999.00') || '%' end as productionrate
,case when y.production_date is null then '' else to_char(round(y.firstgood_d*100/y.output_d,2),'FM999.00') || '%' end as firstgoodrate
from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_f t
      where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
           and substr(t.production_date,1,7)=substr('#today#',1,7)
      group by substr(t.production_date,1,7),t.pline_code) x
left join
     (select t.production_date,t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
      from v_production_f t
      where t.production_date='#today#'
      group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
order by x.pline_code)
union all
select * from (select nvl(y.production_date,'#today#') as productiondate,'G' as processcode
  ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
,to_char(round(production_d,3),'FM999,999.000') as production
,to_char(round(production_m,3),'FM999,999.000') as totalproduction
,case when y.production_date is null then '' else to_char(round(y.production_d*100/y.input_d,2),'FM999.00') || '%' end as productionrate
,case when y.production_date is null then '' else to_char(round(y.firstgood_d*100/y.output_d,2),'FM999.00') || '%' end as firstgoodrate
from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
     ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
      from v_production_g t
      where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
           and substr(t.production_date,1,7)=substr('#today#',1,7)
      group by substr(t.production_date,1,7),t.pline_code) x
left join
     (select t.production_date,t.pline_code,sum(t.input) as input_d
     ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
      from v_production_g t
      where t.production_date='#today#'
      group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
order by x.pline_code)
]]>
</query>

<query id = "FrmrptTotalProduct.getA_ProductionData" desc = "炼钢产量信息查询">
<![CDATA[
select t.production_time as ptime,stove_no,'' as judge_stove_no,'' as batchno,to_number(null) as pcount
,to_char(round(production,3),'FM9,999,990.000') as pweight
,'' as pweightrate,'' as pfirtgoodrate,'A' as processcode_d,a.pline_name as plinename_d 
from v_production_a t,com_base_pline a 
where t.production_date={0}
	and a.pline_code=t.pline_code and a.pline_name={1}
order by production_time,t.stove_no
]]>
</query>



<query id = "FrmrptTotalProduct.getB_ProductionData" desc = "铸造产量信息查询">
<![CDATA[
select t.production_time as ptime,stove_no,judge_stove_no,'' as batchno,t.production_count as pcount
,to_char(round(production,3),'FM9,999,990.000') as pweight
,to_char(round(t.production*100/t.output,2),'FM999.00') || '%' as pweightrate
,to_char(round(t.firstgood*100/t.output,2),'FM999.00') || '%' as pfirtgoodrate,'B' as processcode_d,a.pline_name as plinename_d 
from v_production_b_new t,com_base_pline a 
where t.production_date={0}
	and a.pline_code=t.pline_code and a.pline_name={1}
order by production_time,t.stove_no,judge_stove_no
	]]>
</query>

<query id = "FrmrptTotalProduct.getD_ProductionData" desc = "轧管产量信息查询">
<![CDATA[
select t.production_time as ptime,'' as stove_no,judge_stove_no,'' as batchno,t.production_count as pcount
,to_char(round(production,3),'FM9,999,990.000') as pweight
,to_char(round(production*100/input,2),'FM999.00') || '%' as pweightrate
,to_char(round(firstgood*100/output,2),'FM999.00') || '%' as pfirtgoodrate,'D' as processcode_d,a.pline_name as plinename_d 
from v_production_d t,com_base_pline a 
where t.production_date={0}
	and a.pline_code=t.pline_code and a.pline_name={1}
order by production_time,judge_stove_no
	]]>
</query>E	

<query id = "FrmrptTotalProduct.getE_ProductionData" desc = "镦拔扩产量信息查询">
<![CDATA[
select t.production_time as ptime,'' as stove_no,judge_stove_no,batch_no as batchno,t.production_count as pcount
,to_char(round(production,3),'FM9,999,990.000') as pweight
,to_char(round(production*100/input,2),'FM999.00') || '%' as pweightrate
,to_char(round(firstgood*100/output,2),'FM999.00') || '%' as pfirtgoodrate,'E' as processcode_d,a.pline_name as plinename_d 
from v_production_E t,com_base_pline a 
where t.production_date={0}
	and a.pline_code=t.pline_code and a.pline_name={1}
order by production_time,judge_stove_no,batch_no
	]]>
</query>

<query id = "FrmrptTotalProduct.getF_ProductionData" desc = "热处理量信息查询">
<![CDATA[
select t.production_time as ptime,'' as stove_no,judge_stove_no,batch_no as batchno,t.production_count as pcount
,to_char(round(production,3),'FM9,999,990.000') as pweight
,to_char(round(production*100/input,2),'FM999.00') || '%' as pweightrate
,to_char(round(firstgood*100/output,2),'FM999.00') || '%' as pfirtgoodrate,'F' as processcode_d,a.pline_name as plinename_d 
from v_production_f t,com_base_pline a 
where t.production_date={0}
	and a.pline_code=t.pline_code and a.pline_name={1}
order by production_time,judge_stove_no,batch_no
	]]>
</query>

<query id = "FrmrptTotalProduct.getG_ProductionData" desc = "加工产产量信息查询">
<![CDATA[
select t.production_time as ptime,'' as stove_no,judge_stove_no,phy_batch_no as batchno,t.production_count as pcount
,to_char(round(production,3),'FM9,999,990.000') as pweight
,to_char(round(production*100/input,2),'FM999.00') || '%' as pweightrate
,to_char(round(firstgood*100/output,2),'FM999.00') || '%' as pfirtgoodrate,'G' as processcode_d,a.pline_name as plinename_d 
from v_production_G t,com_base_pline a 
where t.production_date={0}
	and a.pline_code=t.pline_code and a.pline_name={1}
order by production_time,judge_stove_no,phy_batch_no
	]]>
</query>
</queryMap>