protected string nopr_status_show(object cprj, object line, object nopr) { int cprjint = Convert.ToInt32(cc1.connectionofc008_select("select count(*) as ct from ecsfc929_memb where cprj='" + cprj.ToString() + "' and line='" + line.ToString() + "'", "ct")); if (Convert.ToInt32(nopr) <= cprjint) { string nsstr = string.Empty; string[] tranarray = { "code", "pfc", "sti", "emno" }; int recovery_ct = Convert.ToInt32(cc1.connectionofc008_select("select count(*) as rect from ecsfc929_memb where cprj='" + cprj.ToString() + "' and line='" + line.ToString() + "' and nopr='" + nopr + "' and(code is null and sdate is not null)", "rect")); string pausect = cc1.connectionofc008_select("select distinct t1.cprj,t1.line,t1.nopr,(select count(*) from ecsfc929_memb as t3 inner join ecsfc933_mdt as t4 on t3.cprj=t4.cprj and t3.line=t4.line and t3.nopr=t4.nopr where t3.cprj=t1.cprj and t3.line=t1.line and t3.nopr=t1.nopr and(t4.sdate is not null and t4.edate is null) and pfc!='是')as pausect from ecsfc929_memb as t1 full join ecsfc933_mdt as t2 on t1.cprj=t2.cprj and t1.line=t2.line and t1.nopr=t2.nopr where t1.cprj='" + cprj.ToString() + "' and t1.line='" + line.ToString() + "' and t1.nopr='" + nopr.ToString() + "'", "pausect"); var resulta = cc1.strarray("select distinct t1.code,t1.pfc,(select count(*) from ecsfc930_pud where cprj='" + cprj.ToString() + "' and line='" + line.ToString() + "' and nopr='" + nopr.ToString() + "' and uclose='否') as sti, t1.emno from (ecsfc929_memb as t1 full join ecsfc933_mdt as t2 on t1.cprj=t2.cprj and t1.line=t2.line and t1.nopr=t2.nopr) full join ecsfc930_pud as t3 on t1.cprj=t2.cprj and t1.line=t3.line and t1.nopr=t3.nopr where t1.cprj='" + cprj.ToString() + "' and t1.line='" + line.ToString() + "' and t1.nopr='" + nopr.ToString() + "';", 4, tranarray); nsstr = resulta.Item1[0]; string ename = cc1.connectionofc008_select("select t_name from ecpsl010 where t_empl='" + resulta.Item1[3] + "'", "t_name"); if (resulta.Item1[0] == "*" && Convert.ToInt32(resulta.Item1[2]) == 0 && resulta.Item1[1] == "否") { //if (pausect == "0") // return "休停"; //else return(ename); } else if (resulta.Item1[1] == "是") { Global.errorct = Convert.ToInt32(cc1.connectionofc008_select("select count(*) as ect from ecsfc930_pud where cprj='" + cprj + "' and line='" + line + "' and nopr='" + nopr + "' and uclose='否'", "ect")); if (Global.errorct > 0) { return(""); } else { return("已完工"); } } else if (Convert.ToInt32(resulta.Item1[2]) > 0) { return(""); } else if (recovery_ct > 0) { return("已復工"); } else { return("未開工"); } } else { return("------"); } }
protected string scheduled_project(string cprj, string line, int source_type) { Global.spnloc = cc1.connectionofc008_select("select top 1 nloc from ecsfc929_memb as t1 where cprj='" + cprj + "' and line='" + line + "' and convert(char(10),apdt,20)+' '+convert(varchar(5),stuff(right('0000'+cast(apti as nvarchar),4),3,0,':'),108)<=getdate() order by apdt desc,apti desc", "nloc"); string pre_nopr = cc1.connectionofc008_select("select top 1 nopr,nloc,code from ecsfc929_memb as t1 where cprj='" + cprj + "' and line='" + line + "' and convert(char(10),apdt,20)+' '+convert(varchar(5),stuff(right('0000'+cast(apti as nvarchar),4),3,0,':'),108)<=getdate() order by apdt desc,apti desc", "nopr"); string now_nopr = cc1.connectionofc008_select("select top 1 nopr from ecsfc929_memb as t1 where cprj='" + cprj + "' and line='" + line + "' and sdate is not null order by nopr desc", "nopr"); if (pre_nopr == "") { pre_nopr = "0"; } if (now_nopr == "") { now_nopr = "0"; } if (source_type == 1) { if (Global.spnloc == "" && Convert.ToInt32(now_nopr) > Convert.ToInt32(pre_nopr)) { return("超前"); } else { //預計的進度是否已完工 string[] preFinDtCol = { "apdtime", "rutm" }; var preFinDtCols = cc1.strarray("select top 1 convert(nvarchar(11),apdt)+' '+stuff(right('0000'+cast(apti as nvarchar),4),3,0,':') as apdtime,rutm from ecsfc929_memb where cprj='" + cprj + "' and line='" + line + "' order by apdtime desc", 2, preFinDtCol); DateTime apdtime = Convert.ToDateTime(preFinDtCols.Item1[0]).AddHours(Convert.ToInt32(preFinDtCols.Item1[1])); int k = 0; if (apdtime <= DateTime.Now) { k = 1; } if (k == 1) { return("應完工"); } else { return(Global.spnloc); } } } else { Global.spnloc2 = cc1.connectionofc008_select("select code from ecsfc929_memb where cprj='" + cprj + "' and line='" + line + "' and nloc like'%" + Global.spnloc + "%'", "code"); //判斷預計目前是否已完工 string[] preFinDtCol = { "apdtime", "rutm" }; var preFinDtCols = cc1.strarray("select top 1 convert(nvarchar(11),apdt)+' '+stuff(right('0000'+cast(apti as nvarchar),4),3,0,':') as apdtime,rutm from ecsfc929_memb where cprj='" + cprj + "' and line='" + line + "' order by apdtime desc", 2, preFinDtCol); DateTime apdtime = Convert.ToDateTime(preFinDtCols.Item1[0]).AddHours(Convert.ToInt32(preFinDtCols.Item1[1])); int k = 0; if (apdtime <= DateTime.Now) { k = 1; } //if (Global.spnloc2 == "*") // return "#5BFF24";//green //else // return "#FFBB66";//orange if (Convert.ToInt32(now_nopr) > Convert.ToInt32(pre_nopr)) { return("#00BBFF");//indigo靛青 超前 } else if (Convert.ToInt32(now_nopr) == Convert.ToInt32(pre_nopr) && k == 0) { return("#5BFF24");//green 正常 } else { return("#FFBB66");//orange 落後 } } }