<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "生产流速统计">
	<query id = "FrmrptSCLS.get_KF" desc = "生产流速--扣分说明">
	<![CDATA[
		select upper(substr(t.kftype,4,4)) as kftype,t.kf,max(t.kftype_name) as kftype_name
		from tab_rpt_kf t
		where t.isvalid='1' 
		group by substr(t.kftype,4,4),t.kf
		order by substr(t.kftype,4,4),t.kf
	]]>
	</query>
	<query id = "FrmrptSCLS.get_DC" desc = "生产流速--待产数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no, to_char(create_time,'yyyy-MM-dd hh24:mi:ss') as create_time,
		to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,planstatus,orderno,
		SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W，
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime,qz,cl_status 
		from TAB_RPT_LS_DC where to_char(CREATETIME,'yyyy-MM-dd')='#today#' --and kf>0
		order by processcode, dept_code,pline_code
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_QX" desc = "生产流速--清线数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no,feed_heat_no, to_char(maxfeed_time,'yyyy-MM-dd hh24:mi:ss') as feed_time,
    	to_char(maxfx_time,'yyyy-MM-dd hh24:mi:ss') as FX_time,
		to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,orderno,
    	nowork_times_days,nowork_times_days_desc,nowork_times,nowork_times_desc,
    	nowork_days,nowork_days_desc ,to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime,qz,cl_status
		from TAB_RPT_LS_QX where to_char(CREATETIME,'yyyy-MM-dd')='#today#' --and kf>0
		order by processcode, dept,pline_name
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_LXWT" desc = "生产流速--离线委托数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no,batch_no, to_char(maxoffline_time,'yyyy-MM-dd hh24:mi:ss') as offline_time,
    	to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,orderno,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime,qz,cl_status
		from TAB_RPT_LS_LX where sign='LXWT' and to_char(CREATETIME,'yyyy-MM-dd')='#today#' --and kf>0
		order by processcode, dept,pline_name
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_LXFX" desc = "生产流速--离线完工数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no,batch_no, to_char(maxwg_time,'yyyy-MM-dd hh24:mi:ss') as wg_time,
    	to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,orderno,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime,qz,cl_status
		from TAB_RPT_LS_LX where sign='LXFX' and to_char(CREATETIME,'yyyy-MM-dd')='#today#' --and kf>0
		order by processcode, dept,pline_name
	]]>
	</query>
	
	
	<query id = "FrmrptSCLS.get_DPSP" desc = "生产流速--待判（下线→送判）数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no,batch_no, to_char(maxin_time,'yyyy-MM-dd hh24:mi:ss') as in_time,
    	to_char(maxsp_time,'yyyy-MM-dd hh24:mi:ss') as sp_time,
		to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,orderno,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime,qz,cl_status  
		from TAB_RPT_LS_DP where sign='DSP' and to_char(CREATETIME,'yyyy-MM-dd')='#today#' --and kf>0
		order by processcode, dept,pline_name
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_DPPD" desc = "生产流速--待判（送判→判定）数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no,batch_no, to_char(maxsp_time,'yyyy-MM-dd hh24:mi:ss') as sp_time,
    	to_char(maxpd_time,'yyyy-MM-dd hh24:mi:ss') as pd_time,
		to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,orderno,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime,qz,cl_status 
		from TAB_RPT_LS_DP where sign='DPD' and to_char(CREATETIME,'yyyy-MM-dd')='#today#' --and kf>0
		order by processcode, dept,pline_name
	]]>
	</query>

	<query id = "FrmrptSCLS.get_FP" desc = "生产流速--废品数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no,batch_no, to_char(maxin_time,'yyyy-MM-dd hh24:mi:ss') as in_time,
		to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,orderno,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime,qz,cl_status  
		from TAB_RPT_LS_FP where to_char(CREATETIME,'yyyy-MM-dd')='#today#' --and kf>0
		order by processcode, dept,pline_name
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_DC_QJ" desc = "区间生产流速--待产数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no, to_char(create_time,'yyyy-MM-dd hh24:mi:ss') as create_time,
		to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,planstatus,orderno,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime 
		from TAB_RPT_LS_DC where to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		and kf>0
		order by processcode, dept_code,pline_code
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_QX_QJ" desc = "区间生产流速--清线数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no, to_char(maxfeed_time,'yyyy-MM-dd hh24:mi:ss') as feed_time,
    	to_char(maxfx_time,'yyyy-MM-dd hh24:mi:ss') as FX_time,
		to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,orderno,
    	nowork_times_days,nowork_times_days_desc,nowork_times,nowork_times_desc,
    	nowork_days,nowork_days_desc ,to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime
		from TAB_RPT_LS_QX where to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		and kf>0
		order by processcode, dept,pline_name
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_LXWT_QJ" desc = "区间生产流速--离线委托数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no,batch_no, to_char(maxoffline_time,'yyyy-MM-dd hh24:mi:ss') as offline_time,
    	to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,orderno,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime
		from TAB_RPT_LS_LX where sign='LXWT' 
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		and kf>0
		order by processcode, dept,pline_name
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_LXFX_QJ" desc = "区间生产流速--离线完工数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no,batch_no, to_char(maxwg_time,'yyyy-MM-dd hh24:mi:ss') as wg_time,
    	to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,orderno,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime
		from TAB_RPT_LS_LX where sign='LXFX'
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		and kf>0
		order by processcode, dept,pline_name
	]]>
	</query>
	
	
	<query id = "FrmrptSCLS.get_DPSP_QJ" desc = "区间生产流速--待判（下线→送判）数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no,batch_no, to_char(maxin_time,'yyyy-MM-dd hh24:mi:ss') as in_time,
    	to_char(maxsp_time,'yyyy-MM-dd hh24:mi:ss') as sp_time,
		to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,orderno,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime  
		from TAB_RPT_LS_DP where sign='DSP' 
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		and kf>0
		order by processcode, dept,pline_name
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_DPPD_QJ" desc = "区间生产流速--待判（送判→判定）数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no,batch_no, to_char(maxsp_time,'yyyy-MM-dd hh24:mi:ss') as sp_time,
    	to_char(maxpd_time,'yyyy-MM-dd hh24:mi:ss') as pd_time,
		to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,orderno,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime 
		from TAB_RPT_LS_DP where sign='DPD' 
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		and kf>0
		order by processcode, dept,pline_name
	]]>
	</query>

	<query id = "FrmrptSCLS.get_FP_QJ" desc = "区间生产流速--废品数据">
	<![CDATA[
		select processcode, area,area_code,dept,dept_code,pline_name,pline_code,heat_plan_no, 
		judge_stove_no,batch_no, to_char(maxin_time,'yyyy-MM-dd hh24:mi:ss') as in_time,
		to_char(bj_time,'yyyy-MM-dd hh24:mi:ss') as bj_time,dc_hours,dc_days,kf,kfsm,orderno,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime  
		from TAB_RPT_LS_FP where to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		and kf>0
		order by processcode, dept,pline_name
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_DC_KF" desc = "生产流速扣分--待产数据">
	<![CDATA[
		select max(processcode) as processcode, max(dept) as dept,max(dept_code) as dept_code
		,pline_name,pline_code,sum(kf) as kf,to_char(CREATETIME,'yyyy-MM-dd') as createtime 
		from TAB_RPT_LS_DC 
		where kf>0
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		group by  pline_name,pline_code,to_char(CREATETIME,'yyyy-MM-dd')
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_QX_KF" desc = "生产流速扣分--清线数据">
	<![CDATA[
		select max(processcode) as processcode, max(dept) as dept,max(dept_code) as dept_code
		,pline_name,pline_code,sum(kf) as kf,to_char(CREATETIME,'yyyy-MM-dd') as createtime 
		from TAB_RPT_LS_QX 
		where kf>0
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		group by  pline_name,pline_code,to_char(CREATETIME,'yyyy-MM-dd')
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_LXWT_KF" desc = "生产流速扣分--离线委托数据">
	<![CDATA[
		select max(processcode) as processcode, max(dept) as dept,max(dept_code) as dept_code
		,pline_name,pline_code,sum(kf) as kf,to_char(CREATETIME,'yyyy-MM-dd') as createtime 
		from TAB_RPT_LS_LX 
		where sign='LXWT' and kf>0
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		group by  pline_name,pline_code,to_char(CREATETIME,'yyyy-MM-dd')
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_LXFX_KF" desc = "生产流速扣分--离线完工数据">
	<![CDATA[
		select max(processcode) as processcode, max(dept) as dept,max(dept_code) as dept_code
		,pline_name,pline_code,sum(kf) as kf,to_char(CREATETIME,'yyyy-MM-dd') as createtime 
		from TAB_RPT_LS_LX 
		where sign='LXFX' and kf>0
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		group by  pline_name,pline_code,to_char(CREATETIME,'yyyy-MM-dd')
	]]>
	</query>
	
	
	<query id = "FrmrptSCLS.get_DPSP_KF" desc = "生产流速扣分--待判（下线→送判）数据">
	<![CDATA[
		select max(processcode) as processcode, max(dept) as dept,max(dept_code) as dept_code
		,pline_name,pline_code,sum(kf) as kf,to_char(CREATETIME,'yyyy-MM-dd') as createtime 
		from TAB_RPT_LS_DP 
		where sign='DSP' and kf>0
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		group by  pline_name,pline_code,to_char(CREATETIME,'yyyy-MM-dd')
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_DPPD_KF" desc = "生产流速扣分--待判（送判→判定）数据">
	<![CDATA[
		select max(processcode) as processcode, max(dept) as dept,max(dept_code) as dept_code
		,pline_name,pline_code,sum(kf) as kf,to_char(CREATETIME,'yyyy-MM-dd') as createtime 
		from TAB_RPT_LS_DP 
		where sign='DPD' and kf>0
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		group by  pline_name,pline_code,to_char(CREATETIME,'yyyy-MM-dd')
	]]>
	</query>

	<query id = "FrmrptSCLS.get_FP_KF" desc = "生产流速扣分--废品数据">
	<![CDATA[
		select max(processcode) as processcode, max(dept) as dept,max(dept_code) as dept_code
		,pline_name,pline_code,sum(kf) as kf,to_char(CREATETIME,'yyyy-MM-dd') as createtime 
		from TAB_RPT_LS_FP 
		where kf>0
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		group by  pline_name,pline_code,to_char(CREATETIME,'yyyy-MM-dd')
	]]>
	</query>
	
	
	<query id = "FrmrptSCLS.get_TotalKF" desc = "生产流速扣分汇总">
	<![CDATA[
		select * 
		from (select case when t.area_code='002001001' then '外委' when processcode='B' then '炼钢' when processcode<>'B' and area_code<>'002001002'then '轧管' else '管加工' end area
		,case when t.area_code='002001001' then '4' when processcode='B' then '1' when processcode<>'B' and area_code<>'002001002' then '2' else '3' end area_code
		,'1' as signxh,'DC'as sign,t.processcode,t.dept_code,max(t.dept) as dept,t.area_code as area_code1,max(t.area) as area1,
		t.pline_code,max(t.pline_name) as pline_name,to_char(createtime,'yyyy-MM-dd') as createdate,sum(kf) as kf,max(qz) as qz,to_number(sum(kf*qz)) as kfqz
		from tab_rpt_ls_dc t
		where kf>0
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		group by t.processcode,t.area_code,t.dept_code,t.pline_code,to_char(createtime,'yyyy-MM-dd')
		union
		select case when t.area_code='002001001' then '外委' when processcode='B' then '炼钢' when processcode<>'B' and area_code<>'002001002'then '轧管' else '管加工' end area
     	,case when t.area_code='002001001' then '4' when processcode='B' then '1' when processcode<>'B' and area_code<>'002001002' then '2' else '3' end area_code
     	,'2' as signxh,'QX'as sign,t.processcode,t.dept_code,max(t.dept) as dept,t.area_code as area_code1,max(t.area) as area1,
		t.pline_code,max(t.pline_name) as pline_name,to_char(createtime,'yyyy-MM-dd'),sum(kf),max(qz) as qz,to_number(sum(kf*qz)) as kfqz
		from tab_rpt_ls_qx t
		where kf>0
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		group by t.processcode,t.area_code,t.dept_code,t.pline_code,to_char(createtime,'yyyy-MM-dd')
		union 
		select case when t.area_code='002001001' then '外委' when processcode='B' then '炼钢' when processcode<>'B' and area_code<>'002001002'then '轧管' else '管加工' end area
     	,case when t.area_code='002001001' then '4' when processcode='B' then '1' when processcode<>'B' and area_code<>'002001002' then '2' else '3' end area_code
     	,case when t.sign='DSP' then '3' else '4' end as signxh,t.sign,t.processcode,t.dept_code,max(t.dept) as dept,t.area_code as area_code1,max(t.area) as area1,
		t.pline_code,max(t.pline_name) as pline_name,to_char(createtime,'yyyy-MM-dd'),sum(kf),max(qz) as qz,to_number(sum(kf*qz)) as kfqz
		from tab_rpt_ls_dp t
		where kf>0
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		group by t.sign,t.processcode,t.area_code,t.dept_code,t.pline_code,to_char(createtime,'yyyy-MM-dd')
		union
		select case when t.area_code='002001001' then '外委' when processcode='B' then '炼钢' when processcode<>'B' and area_code<>'002001002'then '轧管' else '管加工' end area
     	,case when t.area_code='002001001' then '4' when processcode='B' then '1' when processcode<>'B' and area_code<>'002001002' then '2' else '3' end area_code
     	,case when t.sign='LXWT' then '5' else '6' end as signxh,t.sign,t.processcode,t.dept_code,max(t.dept) as dept,t.area_code as area_code1,max(t.area) as area1,
		t.pline_code,max(t.pline_name) as pline_name,to_char(createtime,'yyyy-MM-dd'),sum(kf),max(qz) as qz,to_number(sum(kf*qz)) as kfqz
		from tab_rpt_ls_lx t
		where kf>0
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		group by t.sign,t.processcode,t.area_code,t.dept_code,t.pline_code,to_char(createtime,'yyyy-MM-dd')
		union
		select case when t.area_code='002001001' then '外委' when processcode='B' then '炼钢' when processcode<>'B' and area_code<>'002001002'then '轧管' else '管加工' end area
     	,case when t.area_code='002001001' then '4' when processcode='B' then '1' when processcode<>'B' and area_code<>'002001002' then '2' else '3' end area_code
     	,'7' as signxh,'FP' as sign,t.processcode,t.dept_code,max(t.dept) as dept,t.area_code as area_code1,max(t.area) as area1,
		t.pline_code,max(t.pline_name) as pline_name,to_char(createtime,'yyyy-MM-dd'),sum(kf),max(qz) as qz,to_number(sum(kf*qz)) as kfqz
		from tab_rpt_ls_fp  t
		where kf>0
		and to_char(CREATETIME,'yyyy-MM-dd')>='#fromday#' and to_char(CREATETIME,'yyyy-MM-dd')<='#today#' 
		group by t.processcode,t.area_code,t.dept_code,t.pline_code,to_char(createtime,'yyyy-MM-dd') )a 
    	order by area_code,dept,processcode,pline_name,createdate
	]]>
	</query>

	
	<query id = "FrmrptSCLS.get_SCZQ_PZ" desc = "生产周期--品种数据">
	<![CDATA[
		with v_sczq as (select round((to_date(to_char(t.judge_tolresult_time,'yyyy-MM-dd hh24:mi:ss'),'yyyy-MM-dd hh24:mi:ss')-to_date(to_char(t.zg_feedtime,'yyyy-MM-dd hh24:mi:ss'),'yyyy-MM-dd hh24:mi:ss')),1) as workhours,t.*
		from tab_rpt_ls_sczq t
		where not material_no is null and to_char(JUDGE_TOLRESULT_TIME,'yyyy-MM-dd')>='#fromday#' and to_char(JUDGE_TOLRESULT_TIME,'yyyy-MM-dd')<='#today#')
		select a.produccode,a.producname 
		,(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode)) as min_whole_backlog
		
		,(select min(workhours) from v_sczq z 
		where z.produccode=a.produccode
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode))) as minwhole_backlog_minworkhours
		,(select max(workhours) from v_sczq z 
		where z.produccode=a.produccode
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode))) as minwhole_backlog_maxworkhours
		
		,(select round(avg(workhours),1) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as minwhole_backlog_avgworkhours
		
		,(select round(sum(workhours*act_count)/sum(act_count),1) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as minwhole_backlog_ajqworkhours

		,(select round(STDDEV (workhours),1) from v_sczq z 
		where z.produccode=a.produccode
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode))) as minwholelog_STDDEVwhours --标准差
		,(select sum(act_count)  from v_sczq z 
		where z.produccode=a.produccode
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode))) as minwholelog_act_count
		,(select count(judge_stove_no)  from v_sczq z 
		where z.produccode=a.produccode
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode))) as minwholelog_lcount
		
		,(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode)) as max_whole_backlog
		,(select min(workhours) from v_sczq z 
		where z.produccode=a.produccode
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode))) as maxwhole_backlog_minworkhours
		,(select max(workhours) from v_sczq z 
		where z.produccode=a.produccode
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode))) as maxwhole_backlog_maxworkhours
		,(select  round(avg(workhours),1) from v_sczq z 
		where z.produccode=a.produccode
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode))) as maxwhole_backlog_avgworkhours
		
		,(select  round(sum(workhours*act_count)/sum(act_count),1) from v_sczq z 
		where z.produccode=a.produccode
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode))) as maxwhole_backlog_ajqworkhours
		
		,(select  round(STDDEV(workhours),1) from v_sczq z 
		where z.produccode=a.produccode
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode 
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode))) as maxwholelog_STDDEVwhours --标准差
		
		,(select sum(z.act_count) from v_sczq z 
		where z.produccode=a.produccode
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode))) as maxwholelog_act_count
		
		,(select count(judge_stove_no) from v_sczq z 
		where z.produccode=a.produccode
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode))) as maxwholelog_lcount
		
		/*,(select MIN(length(y.whole_backlog)) from v_sczq y 
		where y.produccode=a.produccode) as minlen
		,(select max(length(y.whole_backlog)) from v_sczq y 
		where y.produccode=a.produccode) as maxlen*/
		
		,(select min(workhours) from v_sczq y 
		where y.produccode=a.produccode) as minworkhours
		,(select max(workhours) from v_sczq y 
		where y.produccode=a.produccode) as maxworkhours
		,(select round(avg(workhours),1) from v_sczq y 
		where y.produccode=a.produccode) as avgworkhours
		
		,(select round(sum(workhours*act_count)/sum(act_count),1) from v_sczq y 
		where y.produccode=a.produccode) as avgjqworkhours
		
		,(select round(STDDEV(workhours),1) from v_sczq y 
		where y.produccode=a.produccode) as STDDEVwhours --标准差
		
		,(select sum(act_count) from v_sczq y 
		where y.produccode=a.produccode) as act_count
		
		,(select count(judge_stove_no) from v_sczq y 
		where y.produccode=a.produccode) as lcount
		
		from (SELECT * FROM v_sczq WHERE ROWID IN (
		 SELECT MIN(ROWID) FROM v_sczq t GROUP BY t.produccode)) a
		order by (select min(workhours) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode),a.produccode 
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_SCZQ_WL" desc = "生产周期--物料数据">
	<![CDATA[
		with v_sczq as (select round((to_date(to_char(t.judge_tolresult_time,'yyyy-MM-dd hh24:mi:ss'),'yyyy-MM-dd hh24:mi:ss')-to_date(to_char(t.zg_feedtime,'yyyy-MM-dd hh24:mi:ss'),'yyyy-MM-dd hh24:mi:ss')),1) as workhours,t.*
		from tab_rpt_ls_sczq t
		where not material_no is null and to_char(JUDGE_TOLRESULT_TIME,'yyyy-MM-dd')>='#fromday#' and to_char(JUDGE_TOLRESULT_TIME,'yyyy-MM-dd')<='#today#')
		select a.produccode,a.producname,a.material_no,a.material_name
		,(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no)) as min_whole_backlog
		
		,(select min(workhours) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as minwhole_backlog_minworkhours
		,(select max(workhours) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as minwhole_backlog_maxworkhours
		
		,(select round(avg(workhours),1) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as minwhole_backlog_avgworkhours

		,(select round(sum(workhours*act_count)/sum(act_count),1) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as minwhole_backlog_ajqworkhours

	
		,(select round(STDDEV (workhours),1) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as minwholelog_STDDEVwhours --标准差
		,(select sum(act_count)  from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as minwholelog_act_count
		,(select count(judge_stove_no)  from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select min(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as minwholelog_lcount
		
		,(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no)) as max_whole_backlog
		,(select min(workhours) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as maxwhole_backlog_minworkhours
		,(select max(workhours) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as maxwhole_backlog_maxworkhours
		,(select  round(avg(workhours),1) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as maxwhole_backlog_avgworkhours

		,(select  round(sum(workhours*act_count)/sum(act_count),1) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as maxwhole_backlog_ajqworkhours


		,(select  round(STDDEV(workhours),1) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as maxwholelog_STDDEVwhours --标准差
		
		,(select sum(act_count) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as maxwholelog_act_count
		,(select count(judge_stove_no) from v_sczq z 
		where z.produccode=a.produccode and z.material_no=a.material_no
		and z.whole_backlog=(select max(x.whole_backlog) from v_sczq x 
		where x.produccode=a.produccode and x.material_no=a.material_no
		and length(x.whole_backlog)=(select max(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no))) as maxwholelog_lcount
		
		/*,(select MIN(length(y.whole_backlog)) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no) as minlenwhole_backlog
		,(select max(length(y.whole_backlog)) from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no) as maxlenwhole_backlog*/
		
		,(select min(workhours) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no) as minworkhours
		,(select max(workhours) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no) as maxworkhours
		,(select round(avg(workhours),1) from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no) as avgworkhours
		
		,(select round(sum(workhours*act_count)/sum(act_count),2) from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no) as avgjqworkhours
		
		,(select round(STDDEV(workhours),1) from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no) as STDDEVwhours --标准差
		
		,(select sum(y.act_count) from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no) as act_count
		,(select count(judge_stove_no) from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no) as lcount
		
		from (SELECT * FROM v_sczq WHERE ROWID IN (
		SELECT MIN(ROWID) FROM v_sczq t GROUP BY t.produccode,t.producname,t.material_no,t.material_name )) a
		order by (select min(workhours) whole_backlog_len from v_sczq y 
		where y.produccode=a.produccode and y.material_no=a.material_no),a.produccode,a.material_no		

	]]>
	</query>
	<query id = "FrmrptSCLS.get_SCZQ_L" desc = "生产周期--炉数据">
	<![CDATA[
		with v_sczq as (select round((to_date(to_char(t.judge_tolresult_time,'yyyy-MM-dd hh24:mi:ss'),'yyyy-MM-dd hh24:mi:ss')-to_date(to_char(t.zg_feedtime,'yyyy-MM-dd hh24:mi:ss'),'yyyy-MM-dd hh24:mi:ss')),1) as workhours,t.*
		from tab_rpt_ls_sczq t
		where material_no='#material_no#' and to_char(JUDGE_TOLRESULT_TIME,'yyyy-MM-dd')>='#fromday#' and to_char(JUDGE_TOLRESULT_TIME,'yyyy-MM-dd')<='#today#')
		
		select pline_name as 产线, judge_stove_no as 判定炉号,batch_no as 批号, whole_backlog as 流程码,workhours as "生产周期（天）",
		to_char(judge_tolresult_time,'yyyy-MM-dd hh24:mi:ss') as 综合判定时间,
		to_char(zg_feedtime,'yyyy-MM-dd hh24:mi:ss') as 轧管上料时间, zg_feed_judge_stove_no as 轧管上料炉号, 
		produccode as 品种代码,producname as 品名,material_no as 物料码, material_name as 物料名称
		,act_count as 支,nvl(act_weight,act_theory_weight) as 吨, steelname as 钢级, 
		gradename as 钢种,spec_name as 规格,model_desc as 扣型,std_name as 标准,std_style_desc as 标准类别,
		act_len_min||'-'||act_len_max as 长度范围,act_len as 实际长度, pro_order_no as 合同号,process_status as 热处理状态
		
		/* steelcode, gradecode, spec_code, model_code, std_code, std_style,target, ct_dimater,act_height, 
		pline_code, load_judge_stove_no,load_batch_no,zp_m_lh,zp_coll, process_code, jugde_apply_code,
		jugde_apply_sequeno,quality_group,batch_groud_no, belong_name_jugde, ord_ln_dly_pk, 
		input_weight,input_count,output_weight,output_count,bal_year_month,is_all_scrap,is_carry_voer,
		stove_no,steel_standrad,heat_plan_no,zbs_flag,createtime */
		
		from v_sczq
		order by workhours,produccode,material_no			

	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_SCLS_kf" desc = "流速扣分">
	<![CDATA[
		select id, kftype, isvalid, to_char(startime,'yyyy-MM-dd') as startime, 
		endtime, processcode, min_range, max_range, kf, kftype_name , 
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime,
		to_char(updatetime,'yyyy-MM-dd hh24:mi:ss') as updatetime
		from tab_rpt_kf
		where ('#kftype#'='1' or kftype='#kftype#')
	]]>
	</query>

	<query id = "FrmrptSCLS.update_SCLS_kf" desc = "流速扣分_update">
	<![CDATA[
		update tab_rpt_kf 
		set kftype='#kftype#', startime=to_date('#startime#','yyyy-MM-dd'),  
		processcode='#processcode#', min_range=#min_range#, max_range=#max_range#, kf=#kf#, 
		kftype_name='#kftype_name#' , updatetime=sysdate
		where id='#id#'
	]]>
	</query>
	
	<query id = "FrmrptSCLS.insert_SCLS_kf" desc = "流速扣分_insert">
	<![CDATA[
		insert into tab_rpt_kf(id,kftype, isvalid, startime,processcode, 
		min_range, max_range, kf,kftype_name, createtime)
		values ('#id#','#kftype#','0', to_date('#startime#','yyyy-MM-dd'),'#processcode#',   
		#min_range#, #max_range#, #kf#, '#kftype_name#' , sysdate)
	]]>
	</query>
	
	<query id = "FrmrptSCLS.delete_SCLS_kf" desc = "流速扣分_delete">
	<![CDATA[
		delete tab_rpt_kf 
		where id='#id#' and isvalid='0'
	]]>
	</query>
	
	<query id = "FrmrptSCLS.isvalid_SCLS_kf" desc = "流速扣分_isvalid">
	<![CDATA[
		update tab_rpt_kf set isvalid='#newisvalid#'
		where id='#id#' and isvalid='#oldisvalid#'
	]]>
	</query>	
	
	<query id = "FrmrptSCLS.get_SCLS_kffjx1" desc = "流速扣分-附加项1">
	<![CDATA[
		select id,kftype,fjtype,fjtype_name,processcode,fj_value,isvalid,
		to_char(startime,'yyyy-MM-dd') as startime,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime,
		to_char(updatetime,'yyyy-MM-dd hh24:mi:ss') as updatetime
		from tab_rpt_kffj
		where ('#kftype#'='1' or kftype='#kftype#')
	]]>
	</query>

	<query id = "FrmrptSCLS.update_SCLS_kffjx1" desc = "流速扣分-附加项1_update">
	<![CDATA[
		update tab_rpt_kffj 
		set kftype='#kftype#',fjtype='#fjtype#',fjtype_name='#fjtype_name#',processcode='#processcode#',fj_value=#fj_value#, 
		startime=to_date('#startime#','yyyy-MM-dd'),updatetime=sysdate
		where id='#id#'
	]]>
	</query>
	
	<query id = "FrmrptSCLS.insert_SCLS_kffjx1" desc = "流速扣分-附加项1_insert">
	<![CDATA[
		insert into tab_rpt_kffj(id,kftype,fjtype,fjtype_name,processcode,fj_value,
		isvalid,startime,createtime)
		values ('#id#','#kftype#','#fjtype#','#fjtype_name#','#processcode#', #fj_value#, 
		'0', to_date('#startime#','yyyy-MM-dd'), sysdate)
	]]>
	</query>
	
	<query id = "FrmrptSCLS.delete_SCLS_kffjx1" desc = "流速扣分-附加项1_delete">
	<![CDATA[
		delete tab_rpt_kffj 
		where id='#id#' and isvalid='0'
	]]>
	</query>
	
	<query id = "FrmrptSCLS.isvalid_SCLS_kffjx1" desc = "流速扣分-附加项1_isvalid">
	<![CDATA[
		update tab_rpt_kffj set isvalid='#newisvalid#'
		where id='#id#' and isvalid='#oldisvalid#'
	]]>
	</query>
	
	<query id = "FrmrptSCLS.get_SCLS_kffjx2" desc = "流速扣分-附加项2">
	<![CDATA[
		select id,kftype,noworktime_desc,processcode,pline_code,pline_name,  
		nowork_times,nowork_days,isvalid,
		to_char(startime,'yyyy-MM-dd') as startime,
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime,
		to_char(updatetime,'yyyy-MM-dd hh24:mi:ss') as updatetime
		from tab_rpt_kf_works
		where ('#kftype#'='1' or kftype='#kftype#')
	]]>
	</query>

	<query id = "FrmrptSCLS.update_SCLS_kffjx2" desc = "流速扣分-附加项2_update">
	<![CDATA[
		update tab_rpt_kf_works 
		set kftype='#kftype#',noworktime_desc='#noworktime_desc#',
		processcode='#processcode#',pline_code='#pline_code#',pline_name='#pline_name#',  
		nowork_days=#nowork_days#,nowork_times=#nowork_times#,
		startime=to_date('#startime#','yyyy-MM-dd'),updatetime=sysdate
		where id='#id#'
	]]>
	</query>
	
	<query id = "FrmrptSCLS.insert_SCLS_kffjx2" desc = "流速扣分-附加项2_insert">
	<![CDATA[
		insert into tab_rpt_kf_works(id,kftype,noworktime_desc,
		processcode,pline_code,pline_name,nowork_days,nowork_times,
		isvalid,startime,createtime)
		values ('#id#','#kftype#','#noworktime_desc#',
		'#processcode#','#pline_code#','#pline_name#',#nowork_days#,#nowork_times#,
		'0', to_date('#startime#','yyyy-MM-dd'), sysdate)
	]]>
	</query>
	
	<query id = "FrmrptSCLS.delete_SCLS_kffjx2" desc = "流速扣分-附加项2_delete">
	<![CDATA[
		delete tab_rpt_kf_works 
		where id='#id#' and isvalid='0'
	]]>
	</query>
	
	<query id = "FrmrptSCLS.isvalid_SCLS_kffjx2" desc = "流速扣分-附加项2_isvalid">
	<![CDATA[
		update tab_rpt_kf_works set isvalid='#newisvalid#'
		where id='#id#' and isvalid='#oldisvalid#'
	]]>
	</query>
	
	
	<query id = "FrmrptSCLS.get_SCLS_kfqz" desc = "流速扣分权重_">
	<![CDATA[
		select id, qztype, isvalid, to_char(startime,'yyyy-MM-dd') as startime, qz, qztype_name , 
		to_char(createtime,'yyyy-MM-dd hh24:mi:ss') as createtime,
		to_char(updatetime,'yyyy-MM-dd hh24:mi:ss') as updatetime
		from tab_rpt_kfqz
	]]>
	</query>

	<query id = "FrmrptSCLS.update_SCLS_kfqz" desc = "流速扣分权重_update">
	<![CDATA[
		update tab_rpt_kfqz 
		set qztype='#qztype#', startime=to_date('#startime#','yyyy-MM-dd'),  qz=#qz#, 
		qztype_name='#qztype_name#' , updatetime=sysdate
		where id='#id#'
	]]>
	</query>
	
	<query id = "FrmrptSCLS.insert_SCLS_kfqz" desc = "流速扣分权重_insert">
	<![CDATA[
		insert into tab_rpt_kfqz(id,qztype, isvalid, startime,qz,qztype_name, createtime)
		values ('#id#','#qztype#','0', to_date('#startime#','yyyy-MM-dd'),#qz#, '#qztype_name#', sysdate)
	]]>
	</query>
	
	<query id = "FrmrptSCLS.delete_SCLS_kfqz" desc = "流速扣分权重_delete">
	<![CDATA[
		delete tab_rpt_kfqz 
		where id='#id#' and isvalid='0'
	]]>
	</query>
	
	<query id = "FrmrptSCLS.isvalid_SCLS_kfqz" desc = "流速扣分权重_isvalid">
	<![CDATA[
		update tab_rpt_kfqz set isvalid='#newisvalid#'
		where id='#id#' and isvalid='#oldisvalid#'
	]]>
	</query>	
	<query id = "FrmrptSCLS.get_pline" desc = "产线">
	<![CDATA[
		select process_code,pline_code,pline_name from com_base_pline  t 
		where t.validflag='1'
		order by process_code,pline_name
	]]>
	</query>
	
	
	<query id = "FrmrptSCLS.importDC" desc = "导入待产数据">
	<![CDATA[
		begin
			delete from TAB_RPT_temp_LS_DC;
			commit;
			insert into TAB_RPT_temp_LS_DC(processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
			create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,createtime,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz)
			select processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
			maxcreate_time, bj_time, dc_hours, dc_days, kf, kfsm, max_planstatus as planstatus ,maxorderno as orderno,sysdate,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz
			from v_rpt_scls_dc_d;
			insert into TAB_RPT_temp_LS_DC(processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
			create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,createtime,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz)
			select processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
			create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,sysdate,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz
			from v_rpt_scls_dc_e;
			insert into TAB_RPT_temp_LS_DC(processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
			create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,createtime,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz)
			select processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
			create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,sysdate,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz
			from v_rpt_scls_dc_f;
			insert into TAB_RPT_temp_LS_DC(processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
			create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,createtime,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz)
			select processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
			create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,sysdate,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz
			from v_rpt_scls_dc_g;
			commit;
			
			delete from TAB_RPT_LS_DC
			where to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
			and exists(select 1 from TAB_RPT_temp_LS_DC where to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd'));
			
			insert into TAB_RPT_LS_DC(processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
			create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,createtime,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz)
			select processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
			create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,createtime,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz
			from TAB_RPT_temp_LS_DC
			where to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd');
			commit;
		end;
	]]>
	</query>
	<query id = "FrmrptSCLS.selectDC" desc = "导入待产数据查询">
	<![CDATA[
	    select count(processcode) from TAB_RPT_LS_DC where to_char(CREATETIME,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	]]>
	</query>	
	<query id = "FrmrptSCLS.importQX" desc = "导入待清线数据">
	<![CDATA[
		BEGIN 
	        delete from TAB_RPT_temp_LS_QX;
	        commit;
	        insert into TAB_RPT_temp_LS_QX(processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,createtime,qz,feed_heat_no)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no,judge_stove_no, null as batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, max_zxz as zxz, maxorderno as orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,sysdate,qz,feed_heat_no
	        from v_rpt_scls_qx_d;
	        insert into TAB_RPT_temp_LS_QX(processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,createtime,qz,feed_heat_no)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,sysdate,qz,feed_heat_no
	        from v_rpt_scls_qx_e;
	        insert into TAB_RPT_temp_LS_QX(processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,createtime,qz,feed_heat_no)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,sysdate,qz,feed_heat_no
	        from v_rpt_scls_qx_f;
	        insert into TAB_RPT_temp_LS_QX(processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,createtime,qz,feed_heat_no)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,sysdate,qz,feed_heat_no
	        from v_rpt_scls_qx_g;
	        commit;
	
			delete from TAB_RPT_LS_QX
			where to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
			and exists(select 1 from TAB_RPT_temp_LS_QX where to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd'));
	
		    insert into TAB_RPT_LS_QX (processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
		    minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
		    kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
		    nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,createtime,qz,feed_heat_no)
		    select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
		    minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
		    kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
		    nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,createtime,qz,feed_heat_no
		    from TAB_RPT_temp_LS_QX where to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd');
		    commit;
		end;
	]]>
	</query>	
	<query id = "FrmrptSCLS.selectQX" desc = "导入待清线数据查询">
	<![CDATA[
	    select count(processcode) from TAB_RPT_LS_QX where to_char(CREATETIME,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	]]>
	</query>	
	
	<query id = "FrmrptSCLS.importLXWT" desc = "导入离线待委托数据">
	<![CDATA[
		begin
			delete from TAB_RPT_temp_LS_LX;
			commit;
			insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
			minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,wgz, orderno,jcx,createtime,qz)
			select 'LXWT' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no, judge_stove_no, null as batch_no,
			minoffline_time, maxoffline_time, to_date(null) as  minwg_time,to_date(null) as  maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,null as wgz,   orderno,null as jcx,sysdate,qz
			from v_rpt_scls_lxww_d;
			
			insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
			minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,wgz, orderno,jcx,createtime,qz)
			select 'LXWT' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minoffline_time, maxoffline_time, to_date(null) as  minwg_time,to_date(null) as  maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,null as wgz,   orderno,null as jcx,sysdate,qz
			from v_rpt_scls_lxww_e;
			
			insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
			minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,wgz, orderno,jcx,createtime,qz)
			select 'LXWT' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minoffline_time, maxoffline_time, to_date(null) as  minwg_time,to_date(null) as  maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,null as wgz,   orderno,null as jcx,sysdate,qz
			from v_rpt_scls_lxww_f;
			
			insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
			minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz, wgz,orderno,jcx,createtime,qz)
			select 'LXWT' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minoffline_time, maxoffline_time,to_date(null) as  minwg_time,to_date(null) as  maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,null as wgz,  orderno,null as jcx,sysdate,qz
			from v_rpt_scls_lxww_g;
			commit;
			
			delete from TAB_RPT_LS_LX
			where sign='LXWT' and to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
			and exists(select 1 from TAB_RPT_temp_LS_LX where sign='LXWT' and to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd'));
			
			insert into TAB_RPT_LS_LX (sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
			minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm,  lxz, wgz, orderno,jcx,createtime,qz)
			select sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
			minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm,  lxz, wgz, orderno,jcx,createtime,qz
			from TAB_RPT_temp_LS_LX
			where sign='LXWT' and to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd') ;
			commit;		
		end;
	]]>
	</query>	
	<query id = "FrmrptSCLS.selectLXWT" desc = "导入离线待委托数据查询">
	<![CDATA[
	    select count(processcode) from TAB_RPT_LS_LX where sign='LXWT' and to_char(CREATETIME,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	]]>
	</query>	
	
	<query id = "FrmrptSCLS.importLXFX" desc = "导入离线待返线数据">
	<![CDATA[
		begin
			delete from TAB_RPT_temp_LS_LX;
			commit;
			
			insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
			minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz, wgz, orderno,jcx,createtime,qz)
			select 'LXFX' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no, judge_stove_no, null as batch_no,
			to_date(null) as minoffline_time, to_date(null) as maxoffline_time,minwg_time, maxwg_time, bj_time, dc_hours, dc_days, kf, kfsm,null as lxz,  wgz, orderno, jcx,sysdate,qz
			from v_rpt_scls_lxfx_d;
			
			insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
			minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,  wgz,orderno,jcx,createtime,qz)
			select 'LXFX' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			to_date(null) as minoffline_time, to_date(null) as maxoffline_time,minwg_time, maxwg_time, bj_time, dc_hours, dc_days, kf, kfsm,null as lxz,  wgz, orderno, jcx,sysdate,qz
			from v_rpt_scls_lxfx_e;
			
			insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
			minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,  wgz,orderno,jcx,createtime,qz)
			select 'LXFX' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			to_date(null) as minoffline_time, to_date(null) as maxoffline_time,minwg_time, maxwg_time, bj_time, dc_hours, dc_days, kf, kfsm,null as lxz,  wgz, orderno, jcx,sysdate,qz
			from v_rpt_scls_lxfx_f;
			
			insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
			minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz, wgz, orderno,jcx,createtime,qz)
			select 'LXFX' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			to_date(null) as minoffline_time, to_date(null) as maxoffline_time,minwg_time, maxwg_time, bj_time, dc_hours, dc_days, kf, kfsm,null as lxz, wgz, orderno, jcx,sysdate,qz
			from v_rpt_scls_lxfx_g;
			commit;
			
			delete from TAB_RPT_LS_LX
			where sign='LXFX' and to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
			and exists(select 1 from TAB_RPT_temp_LS_LX where sign='LXFX' and to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd'));
			
			insert into TAB_RPT_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
			minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm,  lxz, wgz, orderno,jcx,createtime,qz)
			select sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
			minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm,  lxz, wgz, orderno,jcx,createtime,qz
			from TAB_RPT_temp_LS_LX
			where sign='LXFX' and to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd') ;
			commit;		
		end;
	]]>
	</query>	
	<query id = "FrmrptSCLS.selectLXFX" desc = "导入离线待返线数据查询">
	<![CDATA[
	    select count(processcode) from TAB_RPT_LS_LX where sign='LXFX' and to_char(CREATETIME,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	]]>
	</query>	
	
	<query id = "FrmrptSCLS.importDPDSP" desc = "导入下线待送判数据">
	<![CDATA[
		begin 
			delete from TAB_RPT_temp_LS_DP;
			commit;
			insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
			select 'DSP' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no, judge_stove_no, null as batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,null as  minpd_time,null as maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
			from v_rpt_scls_dpsp_b;
			
			insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
			select 'DSP' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code,  null as heat_plan_no, judge_stove_no, null as batch_no,
			minin_time, maxin_time,minsp_time, maxsp_time,to_date(null) as minpd_time, to_date(null) as maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
			from v_rpt_scls_dpsp_d;
			
			insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
			select 'DSP' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time,minsp_time, maxsp_time,to_date(null) as minpd_time, to_date(null) as maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
			from v_rpt_scls_dpsp_e;
			
			insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
			select 'DSP' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time,minsp_time, maxsp_time,to_date(null) as minpd_time, to_date(null) as maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
			from v_rpt_scls_dpsp_f;
			
			insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
			select 'DSP' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time,minsp_time, maxsp_time,to_date(null) as minpd_time, to_date(null) as maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
			from v_rpt_scls_dpsp_g;
			commit;
			
			delete from TAB_RPT_LS_DP
			where sign='DSP' and to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
			and exists(select 1 from TAB_RPT_temp_LS_DP where sign='DSP' and to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')) ;
			
			insert into TAB_RPT_LS_DP (sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
			select sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz
			from TAB_RPT_temp_LS_DP
			where sign='DSP' and to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd');
			commit;
		end;
	]]>
	</query>	
	<query id = "FrmrptSCLS.selectDPDSP" desc = "导入下线待送判数据查询">
	<![CDATA[
	    select count(processcode) from TAB_RPT_LS_DP where sign='DSP' and to_char(CREATETIME,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	]]>
	</query>		
	
	<query id = "FrmrptSCLS.importDPDPD" desc = "导入下线待判定数据">
	<![CDATA[
		begin
			delete from TAB_RPT_temp_LS_DP;
			commit;
			
			insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
			select 'DPD' as sign,processcode,area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no, judge_stove_no, null as batch_no,
			to_date(null) as minin_time, to_date(null) as maxin_time,minsp_time, maxsp_time, minpd_time, maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
			from v_rpt_scls_dppd_b;
			
			insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
			select 'DPD' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code,  null as heat_plan_no, judge_stove_no, null as batch_no,
			to_date(null) as minin_time, to_date(null) as maxin_time,minsp_time, maxsp_time, minpd_time, maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
			from v_rpt_scls_dppd_d;
			
			insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
			select 'DPD' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			to_date(null) as minin_time, to_date(null) as maxin_time,minsp_time, maxsp_time, minpd_time, maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
			from v_rpt_scls_dppd_e;
			
			insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
			select 'DPD' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			to_date(null) as minin_time, to_date(null) as maxin_time,minsp_time, maxsp_time, minpd_time, maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
			from v_rpt_scls_dppd_f;
			
			insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
			select 'DPD' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			to_date(null) as minin_time, to_date(null) as maxin_time,minsp_time, maxsp_time, minpd_time, maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
			from v_rpt_scls_dppd_g;
			commit;
			
			delete from TAB_RPT_LS_DP
			where sign='DPD' and to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
			and exists(select 1 from TAB_RPT_temp_LS_DP where sign='DPD' and to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd'));
			
			insert into TAB_RPT_LS_DP (sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
			select sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
			minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz
			from TAB_RPT_temp_LS_DP
			where sign='DPD' and to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd') ;
			commit;
		end;
	]]>
	</query>	
	<query id = "FrmrptSCLS.selectDPDPD" desc = "导入下线待判定数据查询">
	<![CDATA[
	    select count(processcode) from TAB_RPT_LS_DP where sign='DPD' and to_char(CREATETIME,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	]]>
	</query>	
	
	<query id = "FrmrptSCLS.importFP" desc = "导入废品待处理数据">
	<![CDATA[
		begin
			delete from TAB_RPT_temp_LS_FP;
			commit;
			insert into TAB_RPT_temp_LS_FP(processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz)
			select processcode,area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no, judge_stove_no, null as batch_no, 
			minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,sysdate,qz
			from v_rpt_scls_fp_b;
			
			insert into TAB_RPT_temp_LS_FP(processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz)
			select processcode, area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no, judge_stove_no, null as batch_no, 
			minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,sysdate,qz
			from v_rpt_scls_fp_d;
			
			insert into TAB_RPT_temp_LS_FP(processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz)
			select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,sysdate,qz
			from v_rpt_scls_fp_e;
			
			insert into TAB_RPT_temp_LS_FP(processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz)
			select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,sysdate,qz
			from v_rpt_scls_fp_f;
			
			insert into TAB_RPT_temp_LS_FP(processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz)
			select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,sysdate,qz
			from v_rpt_scls_fp_g;
			commit;
			
			delete from TAB_RPT_LS_FP
			where to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
			and exists(select 1 from TAB_RPT_temp_LS_FP where to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd'));
			
			insert into TAB_RPT_LS_FP(processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz)
			select processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
			minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz
			from TAB_RPT_temp_LS_FP where to_char(createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd');
			commit;
		end;
	]]>
	</query>	
	<query id = "FrmrptSCLS.selectFP" desc = "导入废品待处理数据查询">
	<![CDATA[
		select count(processcode) from TAB_RPT_LS_FP where to_char(CREATETIME,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	]]>
	</query>	
	
	
	<query id = "FrmrptSCLS.UpdateDC" desc = "更新待产数据">
	<![CDATA[
		begin
			delete from TAB_RPT_temp_LS_DC;
	        commit;
	        insert into TAB_RPT_temp_LS_DC(processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
	        create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,createtime,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
	        maxcreate_time, bj_time, dc_hours, dc_days, kf, kfsm, max_planstatus as planstatus ,maxorderno as orderno,sysdate,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz
	        from v_rpt_scls_dc_d;
	        insert into TAB_RPT_temp_LS_DC(processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
	        create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,createtime,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
	        create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,sysdate,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz
	        from v_rpt_scls_dc_e;
	        insert into TAB_RPT_temp_LS_DC(processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
	        create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,createtime,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
	        create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,sysdate,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz
	        from v_rpt_scls_dc_f;
	        insert into TAB_RPT_temp_LS_DC(processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
	        create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,createtime,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no,
	        create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,sysdate,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz
	        from v_rpt_scls_dc_g;
	        commit;
	        
			update TAB_RPT_LS_DC a set a.cl_status='1' 
	        where a.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	        and not exists (select 1 from TAB_RPT_temp_LS_DC b
	        where to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	        and a.processcode=b.processcode and a.pline_code=b.pline_code 
	        and a.heat_plan_no=b.heat_plan_no and a.judge_stove_no=b.judge_stove_no);
	        commit;
	
	        delete
	        from TAB_RPT_LS_DC a
	        where a.kf=0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	        and not exists (select 1 from TAB_RPT_temp_LS_DC b
	        where b.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	        and a.processcode=b.processcode and a.pline_code=b.pline_code 
	        and a.heat_plan_no=b.heat_plan_no and a.judge_stove_no=b.judge_stove_no);
	        commit;
	        
	        insert into TAB_RPT_LS_DC(processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no, 
           	create_time, bj_time, dc_hours, dc_days, kf, kfsm, planstatus ,orderno,createtime,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz)
           	select processcode, area, area_code, dept, dept_code, pline_name, pline_code,heat_plan_no,judge_stove_no, 
           	create_time, bj_time, dc_hours, dc_days, 0 as kf, kfsm, planstatus ,orderno,createtime,SPEC_NAME ,STEELNAME,PRODUCNAME,MODEL_DESC
			,PLN_OUTSINGLE_NUM,PLN_OUTSINGLE_W,qz
	        from TAB_RPT_temp_LS_DC a
	        where not exists (select 1 from TAB_RPT_LS_DC b
	        where to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	        and a.processcode=b.processcode and a.pline_code=b.pline_code 
	        and a.heat_plan_no=b.heat_plan_no and a.judge_stove_no=b.judge_stove_no);
	        commit;
		end;
	]]>
	</query>		
	
	
	<query id = "FrmrptSCLS.UpdateQX" desc = "更新清线数据">
	<![CDATA[
		begin
			delete from TAB_RPT_temp_LS_QX;
	        commit;
	        
	        insert into TAB_RPT_temp_LS_QX(processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,createtime,qz,feed_heat_no)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no,judge_stove_no, null as batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, max_zxz as zxz, maxorderno as orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,sysdate,qz,feed_heat_no
	        from v_rpt_scls_qx_d;
	        
	        insert into TAB_RPT_temp_LS_QX(processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,createtime,qz,feed_heat_no)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,sysdate,qz,feed_heat_no
	        from v_rpt_scls_qx_e;
	        
	        insert into TAB_RPT_temp_LS_QX(processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,createtime,qz,feed_heat_no)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,sysdate,qz,feed_heat_no
	        from v_rpt_scls_qx_f;
	        
	        insert into TAB_RPT_temp_LS_QX(processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,createtime,qz,feed_heat_no)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,sysdate,qz,feed_heat_no
	        from v_rpt_scls_qx_g;
	        commit;
	        
	        update TAB_RPT_LS_QX a set a.cl_status='1' 
	        where a.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	        and not exists (select 1 from TAB_RPT_temp_LS_QX b
	        where to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	        and a.processcode=b.processcode and a.pline_code=b.pline_code 
	        and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	        commit;
	        
	        delete from TAB_RPT_LS_QX a
	        where a.kf=0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	        and not exists (select 1 from TAB_RPT_temp_LS_QX b
	        where b.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	        and a.processcode=b.processcode and a.pline_code=b.pline_code 
	        and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	        commit;
	        
	        
	        insert into TAB_RPT_LS_QX (processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,createtime,qz,feed_heat_no)
	        select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	        minfeed_time, maxfeed_time, minfx_time, maxfx_time, bj_time, dc_hours, dc_days, dc_hours_xz, dc_days_xz,
	        0 as kf, kfsm, zxz, orderno, nowork_times_days, nowork_times, nowork_days,
	        nowork_days_all, nowork_times_days_desc, nowork_times_desc, nowork_days_desc,createtime,qz,feed_heat_no
	        from TAB_RPT_temp_LS_QX a
	        where not exists (select 1 from TAB_RPT_LS_QX b
	        where to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	        and a.processcode=b.processcode and a.pline_code=b.pline_code 
	        and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	        commit;
		end;
	]]>
	</query>	
		
	<query id = "FrmrptSCLS.UpdateDPDSP" desc = "更新待送判数据">
	<![CDATA[
		begin
		  delete from TAB_RPT_temp_LS_DP;
	      commit;
	      insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
	      select 'DSP' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no, judge_stove_no, null as batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,null as  minpd_time,null as maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
	      from v_rpt_scls_dpsp_b;
	      
	      insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
	      select 'DSP' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code,  null as heat_plan_no, judge_stove_no, null as batch_no,
	      minin_time, maxin_time,minsp_time, maxsp_time,to_date(null) as minpd_time, to_date(null) as maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
	      from v_rpt_scls_dpsp_d;
	      
	      insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
	      select 'DSP' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time,minsp_time, maxsp_time,to_date(null) as minpd_time, to_date(null) as maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
	      from v_rpt_scls_dpsp_e;
	      
	      insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
	      select 'DSP' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time,minsp_time, maxsp_time,to_date(null) as minpd_time, to_date(null) as maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
	      from v_rpt_scls_dpsp_f;
	      
	      insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
	      select 'DSP' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time,minsp_time, maxsp_time,to_date(null) as minpd_time, to_date(null) as maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
	      from v_rpt_scls_dpsp_g;
	      commit;
	      
	      update TAB_RPT_LS_DP a set a.cl_status='1' 
	      where sign='DSP' and a.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	      and not exists (select 1 from TAB_RPT_temp_LS_DP b
	      where b.sign='DSP' and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
	        
	      delete from TAB_RPT_LS_DP a
	      where sign='DSP' and a.kf=0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	      and not exists (select 1 from TAB_RPT_temp_LS_DP b
	      where b.sign='DSP' and b.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
   
	      insert into TAB_RPT_LS_DP (sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
	      select sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, 0 as kf, kfsm, dspz, orderno,createtime,qz
	      from TAB_RPT_temp_LS_DP a
	      where a.sign='DSP' and not exists (select 1 from TAB_RPT_LS_DP b
	      where b.sign='DSP' and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
		end;
	]]>
	</query>
	
	<query id = "FrmrptSCLS.UpdateDPDPD" desc = "更新待判定数据">
	<![CDATA[
		begin
	      insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
	      select 'DPD' as sign,processcode,area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no, judge_stove_no, null as batch_no,
	      to_date(null) as minin_time, to_date(null) as maxin_time,minsp_time, maxsp_time, minpd_time, maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
	      from v_rpt_scls_dppd_b;
	
	      insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
	      select 'DPD' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code,  null as heat_plan_no, judge_stove_no, null as batch_no,
	      to_date(null) as minin_time, to_date(null) as maxin_time,minsp_time, maxsp_time, minpd_time, maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
	      from v_rpt_scls_dppd_d;
	
	      insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
	      select 'DPD' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      to_date(null) as minin_time, to_date(null) as maxin_time,minsp_time, maxsp_time, minpd_time, maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
	      from v_rpt_scls_dppd_e;
	      
	      insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
	      select 'DPD' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      to_date(null) as minin_time, to_date(null) as maxin_time,minsp_time, maxsp_time, minpd_time, maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
	      from v_rpt_scls_dppd_f;
	      
	      insert into TAB_RPT_temp_LS_DP(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
	      select 'DPD' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      to_date(null) as minin_time, to_date(null) as maxin_time,minsp_time, maxsp_time, minpd_time, maxpd_time, bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,sysdate,qz
	      from v_rpt_scls_dppd_g;
	      commit;
	      
	      
	      update TAB_RPT_LS_DP a set a.cl_status='1' 
	      where sign='DPD' and a.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	      and not exists (select 1 from TAB_RPT_temp_LS_DP b
	      where b.sign='DPD' and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
	        
	      delete from TAB_RPT_LS_DP a
	      where sign='DPD' and a.kf=0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	      and not exists (select 1 from TAB_RPT_temp_LS_DP b
	      where b.sign='DPD' and b.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
	        
	        
	      insert into TAB_RPT_LS_DP (sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, kf, kfsm, dspz, orderno,createtime,qz)
	      select sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no,
	      minin_time, maxin_time, minsp_time, maxsp_time,minpd_time,maxpd_time,  bj_time, dc_hours, dc_days, 0 as kf, kfsm, dspz, orderno,createtime,qz
	      from TAB_RPT_temp_LS_DP a
	      where a.sign='DPD' and not exists (select 1 from TAB_RPT_LS_DP b
	      where b.sign='DPD' and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
		end;
	]]>
	</query>
	
	<query id = "FrmrptSCLS.UpdateLXWT" desc = "更新离线待委托数据">
	<![CDATA[
		begin
		  delete from TAB_RPT_temp_LS_LX;
	      commit;
	      insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
	      minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,wgz, orderno,jcx,createtime,qz)
	      select 'LXWT' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no, judge_stove_no, null as batch_no,
	      minoffline_time, maxoffline_time, to_date(null) as  minwg_time,to_date(null) as  maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,null as wgz,   orderno,null as jcx,sysdate,qz
	      from v_rpt_scls_lxww_d;
	      
	      insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
	      minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,wgz, orderno,jcx,createtime,qz)
	      select 'LXWT' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minoffline_time, maxoffline_time, to_date(null) as  minwg_time,to_date(null) as  maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,null as wgz,   orderno,null as jcx,sysdate,qz
	      from v_rpt_scls_lxww_e;
	      
	      insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
	      minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,wgz, orderno,jcx,createtime,qz)
	      select 'LXWT' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minoffline_time, maxoffline_time, to_date(null) as  minwg_time,to_date(null) as  maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,null as wgz,   orderno,null as jcx,sysdate,qz
	      from v_rpt_scls_lxww_f;
	      
	      insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
	      minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz, wgz,orderno,jcx,createtime,qz)
	      select 'LXWT' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minoffline_time, maxoffline_time,to_date(null) as  minwg_time,to_date(null) as  maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,null as wgz,  orderno,null as jcx,sysdate,qz
	      from v_rpt_scls_lxww_g;
	      commit;
	      
	      update TAB_RPT_LS_LX a set a.cl_status='1' 
	      where sign='LXWT' and a.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	      and not exists (select 1 from TAB_RPT_temp_LS_LX b
	      where b.sign='LXWT' and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
	        
	      delete from TAB_RPT_LS_LX a
	      where sign='LXWT' and a.kf=0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	      and not exists (select 1 from TAB_RPT_temp_LS_LX b
	      where b.sign='LXWT' and b.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
	        
	        
	      insert into TAB_RPT_LS_LX (sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
	      minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm,  lxz, wgz, orderno,jcx,createtime,qz)
	      select sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
	      minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days,0 as kf, kfsm,  lxz, wgz, orderno,jcx,createtime,qz
	      from TAB_RPT_temp_LS_LX a
	      where a.sign='LXWT' and not exists (select 1 from TAB_RPT_LS_LX b
	      where b.sign='LXWT' and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
		end;
	]]>
	</query>
	
	<query id = "FrmrptSCLS.UpdateLXFX" desc = "更新离线待返线数据">
	<![CDATA[
		begin
		  delete from TAB_RPT_temp_LS_LX;
	      commit;
	
	      insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
	      minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz, wgz, orderno,jcx,createtime,qz)
	      select 'LXFX' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no, judge_stove_no, null as batch_no,
	      to_date(null) as minoffline_time, to_date(null) as maxoffline_time,minwg_time, maxwg_time, bj_time, dc_hours, dc_days, kf, kfsm,null as lxz,  wgz, orderno, jcx,sysdate,qz
	      from v_rpt_scls_lxfx_d;
	      
	      insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
	      minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,  wgz,orderno,jcx,createtime,qz)
	      select 'LXFX' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      to_date(null) as minoffline_time, to_date(null) as maxoffline_time,minwg_time, maxwg_time, bj_time, dc_hours, dc_days, kf, kfsm,null as lxz,  wgz, orderno, jcx,sysdate,qz
	      from v_rpt_scls_lxfx_e;
	      
	      insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
	      minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm, lxz,  wgz,orderno,jcx,createtime,qz)
	      select 'LXFX' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      to_date(null) as minoffline_time, to_date(null) as maxoffline_time,minwg_time, maxwg_time, bj_time, dc_hours, dc_days, kf, kfsm,null as lxz,  wgz, orderno, jcx,sysdate,qz
	      from v_rpt_scls_lxfx_f;
	      
	      insert into TAB_RPT_temp_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
	      minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days,kf, kfsm, lxz, wgz, orderno,jcx,createtime,qz)
	      select 'LXFX' as sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      to_date(null) as minoffline_time, to_date(null) as maxoffline_time,minwg_time, maxwg_time, bj_time, dc_hours, dc_days, kf, kfsm,null as lxz, wgz, orderno, jcx,sysdate,qz
	      from v_rpt_scls_lxfx_g;
	      commit;
	      
	      update TAB_RPT_LS_LX a set a.cl_status='1' 
	      where sign='LXFX' and a.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	      and not exists (select 1 from TAB_RPT_temp_LS_LX b
	      where b.sign='LXFX' and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
	        
	      delete from TAB_RPT_LS_LX a
	      where sign='LXFX' and a.kf=0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	      and not exists (select 1 from TAB_RPT_temp_LS_LX b
	      where b.sign='LXFX' and b.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
	        
		  insert into TAB_RPT_LS_LX(sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
	      minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days, kf, kfsm,  lxz, wgz, orderno,jcx,createtime,qz)
	      select sign,processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no,batch_no,
	      minoffline_time, maxoffline_time, minwg_time,maxwg_time,bj_time, dc_hours, dc_days,0 as kf,kfsm,  lxz, wgz, orderno,jcx,createtime,qz
	      from TAB_RPT_temp_LS_LX a
	      where a.sign='LXFX' and not exists (select 1 from TAB_RPT_LS_LX b
	      where b.sign='LXFX' and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
		end;
	]]>
	</query>
	
	<query id = "FrmrptSCLS.UpdateFP" desc = "更新待处理废品数据">
	<![CDATA[
		begin
		  delete from TAB_RPT_temp_LS_FP;
	      commit;
	      insert into TAB_RPT_temp_LS_FP(processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz)
	      select processcode,area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no, judge_stove_no, null as batch_no, 
	      minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,sysdate,qz
	      from v_rpt_scls_fp_b;
	      
	      insert into TAB_RPT_temp_LS_FP(processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz)
	      select processcode, area, area_code, dept, dept_code, pline_name, pline_code, null as heat_plan_no, judge_stove_no, null as batch_no, 
	      minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,sysdate,qz
	      from v_rpt_scls_fp_d;
	      
	      insert into TAB_RPT_temp_LS_FP(processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz)
	      select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,sysdate,qz
	      from v_rpt_scls_fp_e;
	      
	      insert into TAB_RPT_temp_LS_FP(processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz)
	      select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,sysdate,qz
	      from v_rpt_scls_fp_f;
	      
	      insert into TAB_RPT_temp_LS_FP(processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz)
	      select processcode, area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,sysdate,qz
	      from v_rpt_scls_fp_g;
	      commit;
	    
	      update TAB_RPT_LS_FP a set a.cl_status='1' 
	      where a.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	      and not exists (select 1 from TAB_RPT_temp_LS_FP b
	      where to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
	        
	      delete from TAB_RPT_LS_FP a
	      where a.kf=0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(sysdate,'yyyy-MM-dd')
	      and not exists (select 1 from TAB_RPT_temp_LS_FP b
	      where b.kf>0 and to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
	      
	      insert into TAB_RPT_LS_FP(processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time, bj_time, dc_hours, dc_days, kf, kfsm, wsqz, orderno,createtime,qz)
	      select processcode,area, area_code, dept, dept_code, pline_name, pline_code, heat_plan_no, judge_stove_no, batch_no, 
	      minin_time, maxin_time, bj_time, dc_hours, dc_days,0 as kf, kfsm, wsqz, orderno,createtime,qz
	      from TAB_RPT_temp_LS_FP  a
	      where not exists (select 1 from TAB_RPT_LS_FP b
	      where to_char(a.createtime,'yyyy-MM-dd')=to_char(b.createtime,'yyyy-MM-dd') 
	      and a.processcode=b.processcode and a.pline_code=b.pline_code 
	      and (a.heat_plan_no is null and b.heat_plan_no is null or a.heat_plan_no=b.heat_plan_no) and a.judge_stove_no=b.judge_stove_no);
	      commit;
		end;
	]]>
	</query>
	
	<query id = "FrmrptSCLS.getHTZQ" desc = "查询合同生产周期数据">
	<![CDATA[
			select d.PRO_PLAN_ID as 轧管订单编号
		      ,d.GX_PLAN_NO as 工序排产序号
		      ,d.ORDER_SOURCE as 主合同来源
		      ,d.ORD_LN_DLY_PK as 主交货编码PK
		      ,d.PLN_DIVIDE_ID as 主排产流水号
		      ,d.ORDER_NO ||'/'|| d.ORDER_SEQ as 合同号
		      ,d.PLINE_NAME  as  产线
		      ,d.GRADENAME as  钢种
		      ,d.DIAMETER_GP as 管坯直径
		      ,d.PASS_NAME  as  孔型
		      ,d.WEIGTH_S  as 排产重量
		      ,d.IF_MONITOR_ZG as 是否轧管监制
		      ,d.CRAFT_FILE_NO  as 工艺文件号
		      ,d.CRAFT_FILE_MAN as 工艺文件责任人
		      ,d.PRO_MONTH as 生产年月
		      ,to_char(d.PLAN_TIME_B ,'yyyy-MM-dd hh24:mi:ss') as 计划开始时间
		      ,d.EXE_STATUS as  执行状态
		      ,d.GPREQ_ID as  管坯需求编号
		      ,d.OUTDIAMETER_ZG  as  轧管名义外径
		      ,d.WALLTHICK_ZG as  轧管名义壁厚
		      ,case when d.OUTDIAMETER_ZG < '90' then  '小' else  null end as 小管
		      ,d.PROCESS_DESC_C as  二级工序名
		      ,f.GROUP_JGX as  加工组
		      ,f.GROUP_RCL	as	热处理组
		      ,f.PLAN_TOT_LEN_D	as 分配总长米
		      ,f.PLANSTATUS	as 排产状态
		      ,f.PRIORITY	as	合同紧急度
		      ,f.PRIORITY_MEMO	as	紧急度备注
		      ,f.PROC_DESC_C_RCL as	热处理二级工序
		      ,f.BJ_TYPE  as  变径类型
		      ,f.ABC	as	产销ABC
		      ,f.VERSION_NO	as 合同下发版次
		      ,f.GRADECODE_ALL  as  钢种可选
		      ,f.ISSUED_TIME	as	下发日期
              ,to_date(substr(f.VERSION_NO,0,8),'yyyyMMdd') as 下发版次日期
		      ,to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd')-to_date(substr(f.VERSION_NO,0,8),'yyyyMMdd')	as	下发版次天数
		      ,f.ISSUED_MAN	as		下发人
		      ,o.PRODUCNAME	as	品名描述
		      ,o.STEELNAME	as		钢级牌号
		      ,o.SPEC_NAME	as	产品规格描述
		      ,o.MODEL_DESC	as	扣型描述
		      ,o.BUYER_NAME	as	客户名称
		      ,o.STD_STYLE_DESC	as	标准类别描述 
		      ,o.ORDERFROM	as		合同来源
		      ,o.FINAL_USER_DESC	as	最终用户描述
		      ,o.BUYER_ID	as		客户编号
		      ,o.ORDER_ADD_DESC  as   附加要求描述   
		      ,k.MARKET_SYS as 市场系统
		      ,k.ABRVITION as 客户简称
		      ,d.GPREQ_NUM  as  需求支
		      ,d.GPREQ_WEIGHT as  需求吨
		      ,d.WEIGTH_S_MIN as  排产最小吨
		      ,d.PLANS_NUM as  计划产出支
		      ,d.PROD_STANDARD  as  生产标准
		      ,d.DECISION  as 判定字头
		      ,d.OUTS_BILLET_FL as  外购坯
		      ,d.GRADENAME_LK as 
		      ,d.BATCHED_WT as 上料吨
		      ,d.BATCHED_NUM as  上料支
		      ,(select sum(nvl(PLAN_INDOUBLE_NUM,0)*nvl(CUT_NUM_GP,0)) FROM PLN_ZY_ZG_C a 
		      where exists (select 1 from PLN_ZY_ZG_M y where a.HEAT_PLAN_NO=y.HEAT_PLAN_NO and y.PLANSTATUS IN ('00','10') )
		      and d.PRO_PLAN_ID=a.PRO_PLAN_ID and d.GX_PLAN_NO=a.GX_PLAN_NO) as 装炉支
		      ,(select sum(nvl(PLAN_INDOUBLE_WT,0)) FROM PLN_ZY_ZG_C a 
		      where exists (select 1 from PLN_ZY_ZG_M y where a.HEAT_PLAN_NO=y.HEAT_PLAN_NO and y.PLANSTATUS IN ('00','10') )
		      and d.PRO_PLAN_ID=a.PRO_PLAN_ID and d.GX_PLAN_NO=a.GX_PLAN_NO) as 装炉吨
		      ,(select sum(REAL_INDOUBLE_NUM*CUT_NUM_GP) FROM PLN_ZY_ZG_C a
		      where exists (select 1 from PLN_ZY_ZG_M y where a.HEAT_PLAN_NO=y.HEAT_PLAN_NO and y.PLANSTATUS IN ('20','30','40'))
		      and d.PRO_PLAN_ID=a.PRO_PLAN_ID and d.GX_PLAN_NO=a.GX_PLAN_NO) as 出库支
		      ,(select sum(REAL_INDOUBLE_WT) FROM PLN_ZY_ZG_C a
		      where exists (select 1 from PLN_ZY_ZG_M y where a.HEAT_PLAN_NO=y.HEAT_PLAN_NO and y.PLANSTATUS IN ('20','30','40'))
		      and d.PRO_PLAN_ID=a.PRO_PLAN_ID and d.GX_PLAN_NO=a.GX_PLAN_NO) as 出库吨
		      ,(select  sum(ACT_COUNT * FIX_NUM) FROM MAT_GP_M a 
		      where a.Mat_Status = '80150101' and d.PRO_PLAN_ID=a.PRO_PLAN_ID_ZG and d.GX_PLAN_NO  =a.GX_PLAN_NO_ZG) as 待判支
		      ,(select  sum(ACT_WEIGHT) FROM MAT_GP_M a 
		      where a.Mat_Status = '80150101' and d.PRO_PLAN_ID=a.PRO_PLAN_ID_ZG and d.GX_PLAN_NO  =a.GX_PLAN_NO_ZG) as 待判吨
		      ,(select  sum(nvl(PLN_INSINGLE_NUM , 0 )) 
		      FROM PLN_ZY_ZG_M h   
		      where  d.PRO_PLAN_ID=h.PRO_PLAN_ID and d.GX_PLAN_NO  =h.GX_PLAN_NO) as LJ吨   
		      ,(select  sum(nvl(PLN_INSINGLE_WT ,  0))
		      FROM PLN_ZY_ZG_M h   
		      where  d.PRO_PLAN_ID=h.PRO_PLAN_ID and d.GX_PLAN_NO  =h.GX_PLAN_NO) as  LJ吨 
		     ,case when  round(months_between(to_date(to_char(d.PLAN_TIME_B,'yyyy-MM-dd'),'yyyy-MM-dd')，to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd'))) < 0   then  '历史'
		     when round(months_between(to_date(to_char(d.PLAN_TIME_B,'yyyy-MM-dd'),'yyyy-MM-dd')，to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd'))) =0    then 'N'
		     when round(months_between(to_date(to_char(d.PLAN_TIME_B,'yyyy-MM-dd'),'yyyy-MM-dd')，to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd'))) =1 then 'N+1' 
		     when round(months_between(to_date(to_char(d.PLAN_TIME_B,'yyyy-MM-dd'),'yyyy-MM-dd')，to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd'))) =2   then 'N+2' 
		     when trunc(months_between(to_date(to_char(d.PLAN_TIME_B,'yyyy-MM-dd'),'yyyy-MM-dd')，to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd'))) >2   then 'N+n' 
		  END as  排产年月  
		from PLN_ORDER_ZG_S d
		inner join (select ORD_LN_DLY_PK,PLN_DIVIDE_ID,GROUP_JGX,GROUP_RCL,PLAN_TOT_LEN_D,PLANSTATUS,PRIORITY,PRIORITY_MEMO,PROC_DESC_C_RCL
		      ,BJ_TYPE,ABC,VERSION_NO,GRADECODE_ALL,ISSUED_TIME,ISSUED_MAN 
		from PLN_SALEORD_PROC where to_date(substr(VERSION_NO,0,8),'yyyyMMdd')<to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd')-#days#) f on d.ORD_LN_DLY_PK =f.ORD_LN_DLY_PK and d.PLN_DIVIDE_ID= f.PLN_DIVIDE_ID
		left join PLN_SALEORD o on  d.ORD_LN_DLY_PK =o.ORD_LN_DLY_PK  
		left join SLM_BASE_CUSTOMER k on o.BUYER_ID=k.CUSTOMER_NO
		left  join (select PRODUCNAME,STEELNAME,SPEC_NAME,MODEL_DESC,STD_STYLE_DESC,TP_SERIES,SPECIAL_MODEL
		      ,UPMARKET_PRODUCT,HIGH_ADDITIONAL_PRODUCT,MATERIAL_TYPE_MAX_DESC,MATERIAL_TYPE_MID_DESC,MATERIAL_TYPE_MIN_DESC			
		      from SLM_BASE_MATERIAL）y on y.PRODUCNAME=o.PRODUCNAME and y.STEELNAME=o.STEELNAME and y.SPEC_NAME=o.SPEC_NAME 
		      and nvl(y.MODEL_DESC,0)=nvl(o.MODEL_DESC,0) and nvl(y.STD_STYLE_DESC,0)=nvl(o.STD_STYLE_DESC,0)
		where d.ORDER_NO  is not null and d.ORDER_SOURCE<>'备料需求' and d.EXE_STATUS<'3'
	]]>
	</query>
</queryMap>