| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using CoreFS.CA06;
- using System.Data;
- using System.Collections;
- using Core.Mes.Client.Common;
- namespace Core.LgMes.Client.lgServiceMgt.LgSqlCollection.LgReportSql
- {
- public class SqlCollectionBof
- {
- /// <summary>
- /// 查询转炉炉前铁水信息
- /// </summary>
- /// <param name="sqlConditionList"></param>
- /// <returns></returns>
- public static string returnSqlOfBofForwardReport(ArrayList sqlConditionList)
- {
- string sqlStr = "";
- sqlStr = @"select distinct t.HEATNO, --炉次号
- t.IRONPOTID, --铁水编号
- t4.aim_grade_code PLANSTEEL, --钢种计划
- nvl(t.IRONPOTWGT, '0') IRONPOTWGT,--铁水重量
- t.IRONTEMPERATURE, --铁水温度
- case substr(t.SHIFTCODE, 2, 1) --班组
- when '1' then
- '甲'
- when '2' then
- '乙'
- when '3' then
- '丙'
- when '4' then
- '丁'
- end BB,
- case substr(t.SHIFTCODE, 1, 1) --班次
- when '1' then
- '早'
- when '2' then
- '中'
- when '3' then
- '夜'
- end BC,
- --入炉铁水信息
- max(case
- when t.MOLIRNSOURCE = t10.HEATNO then
- t10.Mn
- end) over(partition by t.MOLIRNSOURCE) R_MN,
- max(case
- when t.MOLIRNSOURCE = t10.HEATNO then
- t10.C
- end) over(partition by t.MOLIRNSOURCE) R_C,
- max(case
- when t.MOLIRNSOURCE = t10.HEATNO then
- t10.P
- end) over(partition by t.MOLIRNSOURCE) R_P,
- max(case
- when t.MOLIRNSOURCE = t10.HEATNO then
- t10.S
- end) over(partition by t.MOLIRNSOURCE) R_S,
- max(case
- when t.MOLIRNSOURCE = t10.HEATNO then
- t10.si
- end) over(partition by t.MOLIRNSOURCE) R_SI,
- --TSO试样
- max(case
- when t.HEATNO = t9.HEATNO and t9.xh = t9.cnt then
- t9.Mn
- end) over(partition by t.HEATNO) Z_MN,
- max(case
- when t.HEATNO = t9.HEATNO and t9.xh = t9.cnt then
- t9.C
- end) over(partition by t.HEATNO) Z_C,
- max(case
- when t.HEATNO = t9.HEATNO and t9.xh = t9.cnt then
- t9.P
- end) over(partition by t.HEATNO) Z_P,
- to_char(t.optdate, 'yyyy-MM-dd hh24:mi') OPTDISP --操作时间
- from (select *
- from stl_bof_optinfo
- where 1 = 1
- {0}
- union
- select *
- from J#stl_bof_optinfo
- where 1 = 1
- {0}
- ) t
- left join (select y.*
- from (select x.*,
- row_number() over(partition by x.heatno order by x.assaytypecode) xh
- from (select *
- from stl_chemelement
- where upper(substr(assaytypecode, 1, 1)) = 'C'
- {1}
- union
- select *
- from J#stl_chemelement
- where upper(substr(ASSAYTYPECODE, 1, 1)) = 'C'
- {1}
- ) x) y) t1 on t.heatno = t1.heatno
- left join (select y.*
- from (select x.*,
- count(1) over(partition by x.HEATNO) cnt,
- row_number() over(partition by x.HEATNO order by x.ASSAYTYPECODE asc, x.assaydate asc) xh,
- substr(x.assaytypecode, 1, 1) gw
- from (select *
- from STL_CHEMELEMENT
- where 1 = 1
- and upper(SUBSTR(CHECKNO, 12, 1)) = 'C'
- and upper(SUBSTR(CHECKNO, -1)) = 'S'
- {1}
- union
- select *
- from J#STL_CHEMELEMENT
- where 1 = 1
- {1}
- and upper(SUBSTR(CHECKNO, 12, 1)) = 'C'
- and upper(SUBSTR(CHECKNO, -1)) = 'S') x) y) t9 on t9.heatno = t.heatno
- left join (select *
- from stl_chemelement where 1 = 1 {2}
- union
- select * from J#stl_chemelement where 1 = 1 {2}) t10 on t10.heatno = t.MOLIRNSOURCE
- left join (select *
- from ppc_steel_heat where 1 = 1 {3}
- union
- select * from J#ppc_steel_heat where 1 = 1 {3}) t4 on t.heatno = t4.heatno
- order by OPTDISP";
- sqlStr = lgCommon.stringFormat(sqlStr, sqlConditionList);
- return sqlStr;
- }
- /// <summary>
- /// 返回转炉操作记录报表查询
- /// </summary>
- /// <param name="sqlConditionList"></param>
- /// <returns></returns>
- public static string returnSqlOfBofOperatioReport(ArrayList sqlConditionList)
- {
- string sqlStr = "";
- sqlStr = @"select distinct t.heatno,
- t4.aim_grade_code plansteel,
- t.stationcode,
- t.sage,
- t.gage,
- t.o2consume,
- nvl(t.ironpotwgt, '0') ironpotwgt,
- t.wsteelwgt,
- t.pigironwgt,
- /*case when t6.baleleavewgt is not null then round(((nvl(t.ironpotwgt, '0')+nvl(t.wsteelwgt, '0')+nvl(t.pigironwgt, '0')))*1000/(t6.pfbalewgt - t6.baleleavewgt),2) else 0 end iron_sum,*/
- case when t6.baleleavewgt is not null then round(((nvl(t.ironpotwgt, '0')+nvl(t.wsteelwgt, '0')+nvl(t.pigironwgt, '0')))*1000/(decode(t6.pfbalewgt - t6.baleleavewgt,null,1,0,1,t6.pfbalewgt - t6.baleleavewgt)),2) else 0 end iron_sum,
- t.brpstime,
- t.potno,
- t.potdistinction,
- t.potwrapstate,
- t6.pfbalewgt - t6.baleleavewgt tappingwgt,
- decode(substr(t.shiftcode, 1, 1), '1', '早', '2', '中', '3', '晚') bc,
- decode(substr(t.shiftcode, 2, 1), '1', '甲', '2', '乙', '3', '丙', '4', '丁') bb,
- decode(blkredeffects, '0', '失败', '1', '成功', '2', '未投', '3', '一般') blkredeffects,
- t.subage,
- t.changestarttime,
- t.openoxygentime,
- round(t.tappingmaxangle,2) tappingmaxangle,round(t.psmaxangle,2) psmaxangle,
- t.irontemperature,
- t.wsteelwgt_fg,
- t.yakuaiwgt_fg,
- t.zhasteelwgt_fg,
- t.ironwgt_fg,
- t.broken_fg,
- t.terminusc,
- t.terminuso2,
- (select nvl(temperature,0)
- from (select *
- from (SELECT *
- FROM stl_bof_subsampling
- WHERE samplingtype = 'TSC'
- union
- SELECT *
- FROM j#stl_bof_subsampling
- WHERE samplingtype = 'TSC')
- order by samplingdate desc)
- WHERE heatno = t.heatno
- AND rownum = 1) b1temperature,
- (select nvl(temperature,0)
- from (select *
- from (SELECT *
- FROM stl_bof_subsampling
- WHERE samplingtype = 'TSO'
- union
- SELECT *
- FROM j#stl_bof_subsampling
- WHERE samplingtype = 'TSO')
- order by samplingdate desc)
- WHERE heatno = t.heatno
- AND rownum = 1) b2temperature,
- nvl(t.n2consume, 0) + nvl(t.topn2consume, 0) n2sum,
- t.irontemperature,
- '0.9' o2press,
- nvl(t.b2time, 0) + nvl(t.b3time, 0) + nvl(t.b4time, 0) +
- nvl(t.b5time, 0) dctime,
- to_char(t.changestarttime, 'HH24:mi') changestarttime,
- to_char(t.openoxygentime, 'HH24:mi') openoxygentime,
- round(nvl(t.supplyoxygentime / 60, 0), 1) supplyoxygentime,
- round(t.supplyoxygentime, 1) supplyoxygentime_s,
- t4.plan_lines plan_lines,
- t.terminustept tappingtemperature,
- t.tappingtime,
- to_char(t.tappingstarttime, 'HH24:mi') tappingstarttime,
- max(case
- when t.heatno = t2.heatno
- and t2.xh = t2.cnt then
- t2.c
- end) over(partition by t.heatno) f_c,
- max(case
- when t.heatno = t2.heatno
- and t2.xh = t2.cnt then
- t2.mn
- end) over(partition by t.heatno) f_mn,
- max(case
- when t.heatno = t2.heatno
- and t2.xh = t2.cnt then
- t2.si
- end) over(partition by t.heatno) f_si,
- max(case
- when t.heatno = t2.heatno
- and t2.xh = t2.cnt then
- t2.s
- end) over(partition by t.heatno) f_s,
- max(case
- when t.heatno = t2.heatno
- and t2.xh = t2.cnt then
- t2.p
- end) over(partition by t.heatno) f_p,
-
- max(case
- when t.heatno = t2.heatno
- and t2.xh = t2.cnt then
- t2.als
- end) over(partition by t.heatno) f_als,
-
- max(case
- when t.molirnsource = t10.heatno then
- t10.mn
- end) over(partition by t.molirnsource) r_mn,
- max(case
- when t.molirnsource = t10.heatno then
- t10.c
- end) over(partition by t.molirnsource) r_c,
- max(case
- when t.molirnsource = t10.heatno then
- t10.p
- end) over(partition by t.molirnsource) r_p,
- max(case
- when t.molirnsource = t10.heatno then
- t10.s
- end) over(partition by t.molirnsource) r_s,
- max(case
- when t.molirnsource = t10.heatno then
- t10.si
- end) over(partition by t.molirnsource) r_si,
-
- max(case
- when t.heatno = t9.heatno
- and t9.xh = t9.cnt then
- t9.mn
- end) over(partition by t.heatno) z_mn,
- max(case
- when t.heatno = t9.heatno
- and t9.xh = t9.cnt then
- t9.c
- end) over(partition by t.heatno) z_c,
- max(case
- when t.heatno = t9.heatno
- and t9.xh = t9.cnt then
- t9.p
- end) over(partition by t.heatno) z_p,
- max(case
- when t.heatno = t9.heatno
- and t9.xh = t9.cnt then
- t9.s
- end) over(partition by t.heatno) z_s,
-
- max(case
- when t.heatno = t9.heatno
- and t9.xh = t9.cnt then
- t9.si
- end) over(partition by t.heatno) z_si,
- case when max(case
- when t.molirnsource = t10.heatno then
- t10.mn
- end) over(partition by t.molirnsource) is not null then
- round(max(case
- when t.heatno = t9.heatno and t9.xh = t9.cnt then
- t9.mn
- end) over(partition by t.heatno)/max(case
- when t.molirnsource = t10.heatno then
- decode(t10.mn,null,1,0,1) --t10.mn 铁水mn元素有可能为0
- end) over(partition by t.molirnsource),2) else 0 end mn_harvest_rate,
- t4.cast_id ccmno,
- (t4.cast_id) || '-' || (t4.cast_seq) ccmno,
- t.memo,
- to_char(t.optdate, 'yyyy-MM-dd hh24:mi') optdisp,
- t.remark2
- from (select *
- from stl_bof_optinfo
- where 1 = 1
- {0}
- union all
- select *
- from j#stl_bof_optinfo
- where 1 = 1
- {0}) t
- left join (select y.*
- from (select x.*,
-
- row_number() over(partition by x.heatno order by x.assaytypecode) xh
- from (select *
- from stl_chemelement
- where upper(substr(assaytypecode, 1, 1)) = 'C'
- {1}
- union all
- select *
- from j#stl_chemelement
- where upper(substr(assaytypecode, 1, 1)) = 'C'
- {1}) x) y) t1 on t.heatno =
- t1.heatno
- left join (select y.*
- from (select x.*,
- count(1) over(partition by x.heatno) cnt,
- row_number() over(partition by x.heatno order by x.assaytypecode desc, x.assaydate desc) xh,
- substr(x.assaytypecode, 1, 1) gw
- from (select *
- from stl_chemelement
- where 1 = 1
- {1}
- and upper(substr(checkno, -1)) = 'S'
- and upper(substr(checkno, 12, 2)) = 'GP'
- union all
- select *
- from j#stl_chemelement
- where 1 = 1
- {1}
- and upper(substr(checkno, -1)) = 'S'
- and upper(substr(checkno, 12, 2)) = 'GP') x) y) t2 on t2.heatno =
- t.heatno
- left join (select y.*
- from (select x.*,
- count(1) over(partition by x.heatno) cnt,
- row_number() over(partition by x.heatno order by x.assaytypecode desc, x.assaydate desc) xh,
- substr(x.assaytypecode, 1, 1) gw
- from (select *
- from stl_chemelement
- where 1 = 1
- {1}
- and upper(substr(checkno, 12, 1)) = 'C'
- and upper(substr(checkno, -1)) = 'I'
- and upper(substr(checkno, 13, 1)) <> 'P'
- union all
- select *
- from j#stl_chemelement
- where 1 = 1
- {1}
- and upper(substr(checkno, 12, 1)) = 'C'
- and upper(substr(checkno, -1)) = 'I'
- and upper(substr(checkno, 13, 1)) <> 'P') x) y) t3 on t3.heatno =
- t.heatno
- left join (select y.*
- from (select x.*,
- count(1) over(partition by x.heatno) cnt,
- row_number() over(partition by x.heatno order by x.assaytypecode) xh,
- substr(x.assaytypecode, 1, 1) gw
- from (select *
- from stl_chemelement
- where 1 = 1
- {1}
- and upper(substr(checkno, 12, 1)) = 'C'
- and upper(substr(checkno, -1)) = 'S'
- union all
- select *
- from j#stl_chemelement
- where 1 = 1
- {1}
- and upper(substr(checkno, 12, 1)) = 'C'
- and upper(substr(checkno, -1)) = 'S') x) y) t9 on t9.heatno =
- t.heatno
- left join (select *
- from stl_chemelement where 1 = 1 {1}
- union all
- select * from j#stl_chemelement where 1 = 1 {1}) t10 on t10.heatno =
- t.molirnsource
- left join (select *
- from ppc_steel_heat where 1 = 1 {3}
- union all
- select * from j#ppc_steel_heat where 1 = 1 {3}) t4 on t.heatno =
- t4.heatno
- /*left join (select *
- from ppc_steel_heat where 1 = 1 {3}
- union all
- select * from j#ppc_steel_heat where 1 = 1 {3}) t5 on t.heatno =
- t5.heatno*/
- left join (select heatno,
- pfbalewgt,
- baleleavewgt,
- isrs,
- mwrapno,
- billetfixsize
- from stl_ccm_optinfo
- where 1 = 1
- {2}
- union all
- select heatno,
- pfbalewgt,
- baleleavewgt,
- isrs,
- mwrapno,
- billetfixsize
- from j#stl_ccm_optinfo
- where 1 = 1
- {2}) t6 on t.heatno = t6.heatno
- order by optdisp
- ";
- sqlStr = lgCommon.stringFormat(sqlStr, sqlConditionList);
- return sqlStr;
- }
- /// <summary>
- /// 返回转炉出钢c报表查询sql
- /// </summary>
- /// <param name="sqlCondition"></param>
- /// <returns></returns>
- public static string returnSqlOfBofTapping(ArrayList sqlConditionList)
- {
- string sqlStr = "";
- sqlStr = @" select distinct t.HEATNO, --炉号
- t4.aim_grade_code PLANSTEEL, --钢种
- case substr(t.SHIFTCODE, 2, 1)--班组
- when '1' then
- '甲'
- when '2' then
- '乙'
- when '3' then
- '丙'
- when '4' then
- '丁'
- end BB,
- case substr(t.SHIFTCODE, 1, 1)--班次
- when '1' then
- '早'
- when '2' then
- '中'
- when '3' then
- '夜'
- end BC,
- nvl(t.B2TIME,0) B2TIME, --2#吹时间(s)
- nvl(t.B3TIME,0) B3TIME, --3#吹时间(s)
- nvl(t.B4TIME,0) B4TIME, --4#吹时间(s)
- nvl(t.B5TIME,0) B5TIME, --5#吹时间(s)
- --LD2(第二次取样)
- max(case
- when t.HEATNO = t3.HEATNO and t3.xh = t3.cnt then
- t3.Mn
- end) over(partition by t.HEATNO) Z_MN,
- max(case
- when t.HEATNO = t3.HEATNO and t3.xh = t3.cnt then
- t3.C
- end) over(partition by t.HEATNO) Z_C,
- max(case
- when t.HEATNO = t3.HEATNO and t3.xh = t3.cnt then
- t3.P
- end) over(partition by t.HEATNO) Z_P,
- max(case
- when t.HEATNO = t3.HEATNO and t3.xh = t3.cnt then
- t3.S
- end) over(partition by t.HEATNO) Z_S,
-
- to_char(t.optdate, 'yyyy-MM-dd hh24:mi') OPTDISP --操作时间
- from (select *
- from STL_bof_optinfo
- where 1 = 1
- {0}
- union
- select *
- from J#STL_bof_optinfo
- where 1 = 1
- {0}
- ) t
- left join (select y.*
- from (select x.*,
- count(1) over(partition by x.HEATNO) cnt,
- row_number() over(partition by x.HEATNO order by x.ASSAYTYPECODE asc, x.assaydate asc) xh,
- substr(x.assaytypecode, 1, 1) gw
- from (select *
- from STL_CHEMELEMENT
- where 1 = 1
- and upper(SUBSTR(CHECKNO, 12, 1)) = 'C'
- and upper(SUBSTR(CHECKNO, -1)) = 'S'
- {1}
- union
- select *
- from J#STL_CHEMELEMENT
- where 1 = 1 {1}
- and upper(SUBSTR(CHECKNO, 12, 1)) = 'C'
- and upper(SUBSTR(CHECKNO, -1)) = 'S') x) y ) t3 on t.heatno = t3.heatno
- left join (select *
- from ppc_steel_heat where 1 = 1 {2}
- union
- select * from J#ppc_steel_heat where 1 = 1 {2}) t4 on t.heatno = t4.heatno
- order by OPTDISP";
- sqlStr = Core.Mes.Client.Common.lgCommon.stringFormat(sqlStr,sqlConditionList);
- return sqlStr;
- }
- /// <summary>
- /// 终点MN考核报表
- /// </summary>
- /// <param name="sqlConditonList"></param>
- /// <returns></returns>
- public static string ReturnSqlOfBofChecnNmReport(ArrayList sqlConditonList)
- {
- string sqlStr = "";
- sqlStr = @"select distinct t.HEATNO,--炉号
- t.STATIONCODE, --岗位编号
- substr(t.SHIFTCODE, 2, 1) SHIFTCODE, --班组(甲、乙、丙、丁)
- max(case
- when t.HEATNO = t1.HEATNO and t1.xh = t1.cnt then
- t1.Mn
- end) over(partition by t.HEATNO) Z_MN,
- t2.stdmin, --最小值(内控)
- t2.stdmax, --最大值(内控)
- to_char(t.optdate, 'yyyy-MM-dd') OPTDISP --日期
-
- from (select * from stl_bof_optinfo where 1 = 1
- {0}
- union all select * from j#stl_bof_optinfo where 1 = 1
- {0}
- ) t
- left join (select y.*
- from (select x.*,
- count(1) over(partition by x.HEATNO) cnt,
- row_number() over(partition by x.HEATNO order by x.ASSAYTYPECODE asc, x.assaydate asc) xh,
- substr(x.assaytypecode, 1, 1) gw
- from (select *
- from STL_CHEMELEMENT
- where 1 = 1 {1}
- and upper(SUBSTR(CHECKNO, 12, 1)) = 'C'
- and upper(SUBSTR(CHECKNO, -1)) = 'S'
- union all
- select *
- from J#STL_CHEMELEMENT
- where 1 = 1 {1}
- and upper(SUBSTR(CHECKNO, 12, 1)) = 'C'
- and upper(SUBSTR(CHECKNO, -1)) = 'S') x) y) t1 on t1.heatno = t.heatno
- left join ( select distinct t3.gycode,t4.itemcode,t4.stdmin,t4.stdmax --decode(t1.itemcode,'Mn',t1.stdmin,'') MN_Min, decode(t1.itemcode,'Mn',t1.stdmax,'') MN_Max
- from scm_sortcode_chem t3, scm_standard_chem t4
- where t3.cic = t4.cic
- and t3.stdstyle = '1'
- and t4.itemcode= 'Mn' {2}) t2 on t2.gycode = t.heatno
- order by substr(OPTDISP,9,2) ";
- sqlStr = Core.Mes.Client.Common.lgCommon.stringFormat(sqlStr,sqlConditonList);
- return sqlStr;
-
- }
- /// <summary>
- /// 钢铁物料消耗报表
- /// </summary>
- /// <returns></returns>
- public static string ReturnSqlOfSteelAdditStats(ArrayList sqlConditionList)
- {
- string sqlStr = "";
- sqlStr = @"select A.HEATNO, --炉号
- A.station STATIONCODE, --岗位编码
- nvl(round(B.CPL, 3), 0) CPL, --合格铸坯量(T)
- case
- when (nvl(A.PFBALEWGT, 0) - nvl(A.BALELEAVEWGT, 0)) > 0 then
- round((nvl(A.PFBALEWGT, 0) - nvl(A.BALELEAVEWGT, 0)), 3)
- else
- 0
- end GSL, --GSL(合格钢水量) = (上台大包重量-下台大包重量)
- (select substr(mes_lg_common.getlgshift1(A.RecFlag), 2, 1) from dual) SHIFTCODE,--班组
- case
- when to_char(A.RecFlag, 'yyyy-MM-dd HH24:mi') between '{2}' and '{3}' then
- '1'
- else
- '0'
- end BECURR --1#吹开始时刻(操作时间)
- from (select *
- from (select t.*,
- row_number() over(partition by HEATNO order by RecFlag) XH
- from (select t.recflag,station, t2.*
- from (select t.heatno,
- case
- when B1STARTTIME is not null then
- B1STARTTIME
- else
- OPTDATE
- end RecFlag,t.stationcode station
- from STL_bof_optinfo t
- where 1 = 1 {0}
- union all
- select t.heatno,
- case
- when B1STARTTIME is not null then
- B1STARTTIME
- else
- OPTDATE
- end RecFlag,t.stationcode station
- from J#STL_bof_optinfo t
- where 1 = 1 {0}) t,
- (select *
- from STL_ccm_optinfo where 1 = 1 {1}
- union
- select * from J#STL_Ccm_Optinfo where 1 = 1 {1}) t2
- where t.heatno = t2.heatno) t)
- where XH = 1) A,
- (select distinct substr(CHARGE_NO, 1, 10) HEATNO,
- sum(nvl(SLAB_WGT, 0)) over(partition by substr(CHARGE_NO, 1, 10)) CPL
- from (select CHARGE_NO, (SLAB_WGT/1000) SLAB_WGT --合格铸坯量(T)
- from stl_incision_view
- where 1 = 1 and to_char(to_date(substr(SLAB_CUT_DTIME,1,8),'yyyy-MM-dd hh24:mi:ss'),'yyyy-MM-dd') between '{4}' and '{5}'
- ) t) B
- where A.HEATNO = B.HEATNO(+) ";
- sqlStr = Core.Mes.Client.Common.lgCommon.stringFormat(sqlStr,sqlConditionList);
- return sqlStr;
- }
- public static string ReturnSqlOfBofQueryInfo(ArrayList sqlConditionList)
- {
- string sqlStr = "";
- sqlStr = @"select distinct b.HEATNO, --炉号
- b.STATIONCODE, --岗位编号
- substr(b.SHIFTCODE, 2, 1) SHIFTCODE,--班组(甲、乙、丙、丁)
- nvl(b.IRONPOTWGT, 0) TSL, --装入铁水量
- nvl(b.PIGIRONWGT, 0) STL, --装入生铁量(T)
- nvl(b.WSTEELWGT, 0) FGL, --装入废钢量(T)
- nvl(b.RSWGT, 0) HLL, --回炉重量(T)
- nvl(h.jmwgt,0) HJL, --加入合金量(Kg)
- to_char(b.CHANGESTARTTIME,'yyyy-mm-dd hh24:mi:ss') starttime, --兑铁开始时刻
- to_char(b.TAPPINGENDTIME,'yyyy-mm-dd hh24:mi:ss') endtime, --出钢结束时刻
- nvl((b.TAPPINGENDTIME-b.CHANGESTARTTIME )*24*60,0) time, --作业时间(min)
- case
- when to_char(RecFlag, 'yyyy-MM-dd HH24:mi') between '{0}' and '{1}' then
- '1'
- else
- '0'
- end BECURR --1#吹开始时刻(操作时间)
- from (select *
- from (select t.*,
- row_number() over(partition by t.HEATNO order by t.RecFlag) XH
- from (select t.*,
- case
- when B1STARTTIME is not null then
- B1STARTTIME
- else
- OPTDATE
- end RecFlag
- from STL_BOF_OPTINFO t
- where 1 = 1
- and optdate >= trunc(to_date('{2}','yyyy-mm-dd'))
- and optdate < trunc(to_date('{3}','yyyy-mm-dd')) + 1
-
- union all
- select t.*,
- case
- when B1STARTTIME is not null then
- B1STARTTIME
- else
- OPTDATE
- end RecFlag
- from J#STL_BOF_OPTINFO t
- where 1 = 1
- and optdate >= trunc(to_date('{2}','yyyy-mm-dd'))
- and optdate < trunc(to_date('{3}','yyyy-mm-dd')) + 1 ) t) v where XH = 1) b,
- (select distinct s.heatno,
- sum(s.jmwgt) over(partition by s.heatno order by s.heatno) jmwgt,
- s.materieltype,
- substr(s.stationcode, 2, 2) code
- from stl_additives s
- where s.materieltype = 'HJ'
- and substr(s.stationcode, 1, 1) = 'C'
- and jmdate >= trunc(to_date('{2}','yyyy-mm-dd'))
- and jmdate < trunc(to_date('{3}','yyyy-mm-dd')) + 1
- union
- select distinct s.heatno,
- sum(s.jmwgt) over(partition by s.heatno order by s.heatno) jmwgt,
- s.materieltype,
- substr(s.stationcode, 2, 2) code
- from j#stl_additives s
- where s.materieltype = 'HJ'
- and jmdate >= trunc(to_date('{2}','yyyy-mm-dd'))
- and jmdate < trunc(to_date('{3}','yyyy-mm-dd')) + 1
- and substr(s.stationcode, 1, 1) = 'C') h
- where b.heatno = h.heatno(+) order by b.heatno";
- sqlStr = Core.Mes.Client.Common.lgCommon.stringFormat(sqlStr, sqlConditionList);
- return sqlStr;
- }
- }
- }
|