//protected void Timer1_Tick(object sender, EventArgs e) //{ // Label2.DataBind(); //} protected string emno_status(string tbt) { string roleauthority = string.Empty; string emno_name = string.Empty; if (tbt.Length == 4) { emno_name = cc1.connectionofc008_select("select t_name from ecpsl010 where t_empl='" + tbt + "'", "t_name"); if (emno_name == "") { return("查無此工號"); } else { roleauthority = cc1.connectionofc008_select("select substring(t2.[role],2,1) as rolea from (ecpsl010 as t1 inner join ecsfc000_emplrole as t2 on t1.t_empl=t2.empl) inner join ecsfc001_role as t3 on t2.role=t3.role where t1.t_empl='" + TextBox1.Text.ToString() + "'", "rolea"); if (roleauthority.ToString() == "") { return(emno_name + "" + "您好!" + "<br/>" + "此工號無權限進行作業!!請聯絡權限管理人"); } else { return(emno_name + "" + "您好!"); } } } else if (tbt.Length == 0) { if (Session["emplnet"] == null) { return("您好 請輸入工號!"); } else { if (Request.QueryString["empl"] != null) { Session["emplnet"] = Request.QueryString["empl"]; } if (Session["emplnet"] == null) { Session["emplnet"] = ""; } emno_name = cc1.connectionofc008_select("select t_name from ecpsl010 where t_empl='" + Session["emplnet"].ToString() + "'", "t_name"); return(emno_name + ""); } } else { return("工號格式錯誤!!"); } }
protected void Page_Load(object sender, EventArgs e) { Session["nowtrigger"] = ""; string serverIP; serverIP = Request.Url.ToString(); if (!Page.IsPostBack) { Session["mod"] = ""; Session["tempe"] = Session["emplnet"]; //------------------抓取emplnet session-----------------sn if (serverIP == "http://localhost:61434/pman_hour_collect.aspx") { //Session["emplnet"] = "5682"; //Session.Timeout = 15; //Session["chktimeout"] = "15"; } if (Session["emplnet"] == null) { try { Session["emplnet"] = Request.QueryString["empl"]; //lbempl.Text = Session["emplnet"].ToString(); } catch (Exception ex) { System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "opennewwindow", "alert('尚未登入,請由系統首頁登入。'" + ex.ToString() + "'');window.location.href='/default.aspx';", true); } //if (Session["chktimeout"] == null) //{ // Session.Timeout = 15; // Session["chktimeout"] = "15"; //} } //lbempl.Text = Session["emplnet"].ToString(); lbname.Text = cc1.connectionofc008_select("select t_name from ecpsl010 where t_empl='" + Session["emplnet"] + "'", "t_name"); if (cc1.connectionofc008_select("select line from ecsfc000_emplrole where empl='" + Session["emplnet"] + "'", "line") != "") { Global.gline = cc1.connectionofc008_select("select line from ecsfc000_emplrole where empl='" + Session["emplnet"] + "'", "line"); } //DBInit(); GVBind(); } //else //{ // if (Session["chktimeout"].ToString() == "") // System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "opennewwindow", "alert('閒置時間過長,請重新登入。');", true); // //DBInit(); //} }
protected void Page_Load(object sender, EventArgs e) { this.InputValue = "ture"; string serverIP; serverIP = Request.Url.ToString(); if (!Page.IsPostBack) { //------------------抓取emplnet session-----------------sn if (serverIP == "http://*****:*****@"<hr/> <script language=javascript>alert('尚未登入,請由系統首頁登入。'); window.location.href='/logout.asp'</script>" + ex.ToString()); } //if (Session["chktimeout"] == null) //{ // Session.Timeout = 15; // Session["chktimeout"] = "15"; //} } GVBind(); } //else //{ // if (Session["chktimeout"].ToString() == "" || Session["chktimeout"] == null) // Response.Write(@"<script language=javascript>alert('閒置時間過長,請重新登入。');"); //} lbname.Text = cc1.connectionofc008_select("select t_name from ecpsl010 where t_empl='" + Session["emplnet"] + "'", "t_name"); }
// GET api/<controller>/5 public DataTable Get(string id) { string line = cc1.connectionofc008_select("select line from ecsfc000_emplrole where empl='" + id + "'", "line"); if (line.Trim() != "N112") { return(cc1.QueryDataTable(string.Format(@"SELECT distinct [cprj], [line], [nopr], [nloc], convert(char(10),[apdt],20) as apdt, [rutm], convert(nvarchar(11),edate)+' '+stuff(right('0000'+cast(edtim as nvarchar),4),3,0,':') as tb2, convert(char(10),sdate,20)+' '+stuff(right('0000'+cast(sdtim as nvarchar),4),3,0,':') as tb, [autm], [code], [mkind], [msfid], [pfc], t1.position ,statuscode,'' as cooperation FROM [ecsfc929_memb] as t1 WHERE ([emno] = '{0}' and [pfc] !='是') union all select t933.[cprj], t933.[line], t933.[nopr], [nloc], convert(char(10),[apdt],20) as apdt, [rutm], convert(nvarchar(11),t929.edate)+' '+stuff(right('0000'+cast(t929.edtim as nvarchar),4),3,0,':') as tb2, convert(char(10),t929.sdate,20)+' '+stuff(right('0000'+cast(t929.sdtim as nvarchar),4),3,0,':') as tb, [autm], [code], [mkind], t933.[msfid], [pfc], t929.position ,statuscode,cooperation from ecsfc933_mdt as t933 left join ecsfc929_memb as t929 on t933.cprj=t929.cprj and t933.line=t929.line and t933.nopr=t929.nopr where cooperation='1' and t933.emno='{0}' and t933.msfid in(select ftb.mid from(select t1.cprj,t1.line,t1.nopr,(select top 1 t2.msfid from ecsfc933_mdt as t2 where t2.cprj=t1.cprj and t2.line=t1.line and t2.nopr=t1.nopr group by t2.msfid order by t2.msfid desc) as mid from ecsfc933_mdt as t1 where t1.emno='{0}' and cooperation='1' group by t1.cprj,t1.line,t1.nopr )as ftb)", id))); } else { return(cc1.QueryDataTable(string.Format(@"SELECT distinct [cprj], [line], [nopr], [nloc], convert(char(10),[apdt],20) as apdt, [rutm], convert(nvarchar(11),edate)+' '+stuff(right('0000'+cast(edtim as nvarchar),4),3,0,':') as tb2, convert(char(10),sdate,20)+' '+stuff(right('0000'+cast(sdtim as nvarchar),4),3,0,':') as tb, [autm], [code], [mkind], [msfid], [pfc], RTRIM(t915.t_dsca) as position ,statuscode,''as cooperation FROM [ecsfc929_memb] as t1 inner join rp3440.baan.baan.tecsfc915230 as t915 on t1.cprj=t915.t_cprj WHERE ([emno] = '{0}' and [pfc] !='是') union all select t933.[cprj], t933.[line], t933.[nopr], [nloc], convert(char(10),[apdt],20) as apdt, [rutm], convert(nvarchar(11),t929.edate)+' '+stuff(right('0000'+cast(t929.edtim as nvarchar),4),3,0,':') as tb2, convert(char(10),t929.sdate,20)+' '+stuff(right('0000'+cast(t929.sdtim as nvarchar),4),3,0,':') as tb, [autm], [code], [mkind], t933.[msfid], [pfc], RTRIM(t915.t_dsca) as position ,statuscode,cooperation from ecsfc933_mdt as t933 left join ecsfc929_memb as t929 on t933.cprj=t929.cprj and t933.line=t929.line and t933.nopr=t929.nopr inner join rp3440.baan.baan.tecsfc915230 as t915 on t933.cprj=t915.t_cprj and t933.line=t915.t_line where cooperation='1' and t933.emno='{0}' and t933.msfid in (select ftb.mid from(select t1.cprj,t1.line,t1.nopr,(select top 1 t2.msfid from ecsfc933_mdt as t2 where t2.cprj=t1.cprj and t2.line=t1.line and t2.nopr=t1.nopr group by t2.msfid order by t2.msfid desc) as mid from ecsfc933_mdt as t1 where t1.emno='{0}' and cooperation='1' group by t1.cprj,t1.line,t1.nopr )as ftb)", id))); } }
// POST api/<controller> public string Post([FromBody] object value) { var jd = JObject.Parse(value.ToString()); int status = Convert.ToInt32((string)jd["status"]); string cprj = (string)jd["cprj"]; string line = (string)jd["line"]; string nopr = (string)jd["nopr"]; string errno = (string)jd["errno"]; //dt、workstop switch (status) { //不停工異常 case 4: cc1.connectionofc008_modify(string.Format("insert into ecsfc930_pud(cprj,line,nopr,usdtim,errno,WorkStop) values('{0}','{1}','{2}','{3}','{4}','0')", cprj, line, nopr, DateTime.Now.ToString("yyyy-MM-dd HH:mm"), errno)); cc1.connectionofc008_modify(string.Format("update ecsfc929_memb set statuscode='4' where cprj='{0}' and line= '{1}' and nopr='{2}'", cprj, line, nopr)); break; //停工異常(進行中) case 3: cc1.connectionofc008_modify(string.Format("insert into ecsfc930_pud(cprj,line,nopr,usdtim,errno,WorkStop) values('{0}','{1}','{2}','{3}','{4}','1')", cprj, line, nopr, DateTime.Now.ToString("yyyy-MM-dd HH:mm"), errno)); string msfid = cc1.connectionofc008_select(string.Format("select top 1 msfid from ecsfc933_mdt where cprj='{0}' and line='{1}' and nopr='{2}' order by msfid desc", cprj, line, nopr), "msfid"); this.cc1.connectionofc008_modify(string.Format(@"update ecsfc933_mdt set edate='{0}',edtim='{1}' where msfid='{2}'", DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("HHmm"), msfid)); int countofgroup933 = Convert.ToInt32(cc1.connectionofc008_select(string.Format("select count(*) as cot from ecsfc933_mdt where cprj='{0}' and line='{1}' and nopr='{2}'", cprj, line, nopr), "cot")); int totalm = connectionofc008_selectarray(string.Format("select sdate,stuff(right('0000'+cast(sdtim as nvarchar),4),3,0,':') as sdt,edate,stuff(right('0000'+cast(edtim as nvarchar),4),3,0,':') as edt from ecsfc933_mdt where cprj='{0}' and line='{1}' and nopr='{2}'", cprj, line, nopr), countofgroup933); this.cc1.connectionofc008_modify(string.Format("update ecsfc929_memb set autm='" + totalm + "',statuscode='3' where cprj='{0}' and line='{1}' and nopr='{2}'", cprj, line, nopr)); break; //停工異常(休停中) default: cc1.connectionofc008_modify(string.Format("insert into ecsfc930_pud(cprj,line,nopr,usdtim,errno,WorkStop) values('{0}','{1}','{2}','{3}','{4}','1')", cprj, line, nopr, DateTime.Now.ToString("yyyy-MM-dd HH:mm"), errno)); this.cc1.connectionofc008_modify(string.Format("update ecsfc929_memb set statuscode='3' where cprj='{0}' and line='{1}' and nopr='{2}'", cprj, line, nopr)); break; } return(""); }
public void ProcessRequest(HttpContext context) { int test; #region 抓取目標tb欄位資料 DataTable dt = new DataTable(); DataColumn column; DataRow row; column = new DataColumn(); column.DataType = System.Type.GetType("System.Int32"); column.ColumnName = "empno"; dt.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "name"; dt.Columns.Add(column); string[] earray = cc1.connectionofc008_selectasarray("select empl from ecsfc000_emplrole", "empl", Convert.ToInt32(cc1.connectionofc008_select("select count(*) as cte from ecsfc000_emplrole", "cte"))); string[] col_array = { "empl", "t_name" }; int emplct = Convert.ToInt32(cc1.connectionofc008_select("select count(*) as ct from ecsfc000_emplrole", "ct")); var enarray = cc1.mstrarray("select empl,t_name from ecsfc000_emplrole as t1 inner join ecpsl010 as t2 on t1.empl=t2.t_empl", emplct, col_array); for (int k = 0; k < emplct; k++) { row = dt.NewRow(); row["empno"] = Convert.ToInt32(enarray.Item1[0, k]); row["name"] = enarray.Item1[1, k].ToString(); dt.Rows.Add(row); } //for (int i = 0; i < earray.Length; i++) //{ // row = dt.NewRow(); // row["empno"] = i; // row["name"] = earray[i]; // dt.Rows.Add(row); //} #endregion string result = Newtonsoft.Json.JsonConvert.SerializeObject(dt); context.Response.ContentType = "application/json"; context.Response.Charset = "utf-8"; context.Response.Write(result); }
protected string datetime_value(object cprj, object line, object nopr, object trigger) { string dvstr = string.Empty; DateTime dt; dvstr = cc1.connectionofc008_select("select convert(char(10),edate,20)+' '+convert(varchar(5),stuff(right('0000'+cast(edtim as nvarchar),4),3,0,':'),108) as tb from ecsfc929_memb where cprj='" + cprj + "' and line='" + line + "' and nopr='" + nopr + "'", "tb"); string tristr = cc1.connectionofc008_select("select cprj+line+convert(nvarchar,nopr) as comb from ecsfc929_memb where cprj='" + cprj + "' and line='" + line + "' and nopr='" + nopr + "'", "comb"); if (trigger.ToString() != "" && trigger.ToString() == tristr) { dvstr = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"); } else if (dvstr != "") { dt = Convert.ToDateTime(dvstr); dvstr = dt.ToString("yyyy-MM-ddTHH:mm:ss"); } else { dvstr = ""; } return(dvstr); }
public void ProcessRequest(HttpContext context) { #region 抓取cprj資料 DataTable dt = new DataTable(); DataColumn column; DataRow row; column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "cprj"; dt.Columns.Add(column); string[] earray = cc1.connectionofc008_selectasarray("select distinct cprj from ecsfc929_memb where code!='*'", "cprj", Convert.ToInt32(cc1.connectionofc008_select("select count(distinct cprj) as cte from ecsfc929_memb where code!='*'", "cte"))); for (int i = 0; i < earray.Length; i++) { row = dt.NewRow(); row["cprj"] = earray[i]; dt.Rows.Add(row); } #endregion string result = Newtonsoft.Json.JsonConvert.SerializeObject(dt); context.Response.ContentType = "application/json"; context.Response.Charset = "utf-8"; context.Response.Write(result); }
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 void Page_Load(object sender, EventArgs e) { string serverIP; serverIP = Request.Url.ToString(); if (!Page.IsPostBack) { Global.gcstatus = "否"; //------------------抓取emplnet session-----------------sn if (serverIP == "http://*****:*****@"<hr/> <script language=javascript>alert('尚未登入,請由系統首頁登入。'); window.location.href='/logout.asp'</script>" + ex.ToString()); } //if (Session["chktimeout"] == null) //{ // Session.Timeout = 15; // Session["chktimeout"] = "15"; //} } //DBInit(); Global.query_cprj = Request.QueryString["cprj"]; Global.query_line = Request.QueryString["line"]; Global.query_nopr = Request.QueryString["nopr"]; //Session["gline"] = Request.QueryString["line"]; //if (cc1.connectionofc008_select("select line from ecsfc000_emplrole where empl='" + Session["emplnet"] + "'", "line") != "") //{ // Global.gline = cc1.connectionofc008_select("select line from ecsfc000_emplrole where empl='" + Session["emplnet"] + "'", "line"); // Session["gline"] = Global.gline; //} GVBind(); //DataBind(); } ////Label4.Text = Request.QueryString["cprj"]; ////Label5.Text = serverIP; //else //{ // if (Session["chktimeout"].ToString() == "" || Session["chktimeout"] == null) // Response.Write(@"<script language=javascript>alert('閒置時間過長,請重新登入。');"); // //DBInit(); //} //try //{ //table9292.SelectCommand = "SELECT [cprj], [line], [nopr], [nloc], [apdt], [rutm], convert(nvarchar(11),edate)+' '+convert(nvarchar(6),edtim) as tb2, convert(nvarchar(11),sdate)+' '+convert(nvarchar(6),sdtim) as tb, [autm], [error], [code], [mkind], [msfid], [pfc] FROM [ecsfc929_memb] WHERE ([emno] = '" + Session["emplnet"] + "' and [pfc] !='是')"; //} //catch (Exception ex) //{ // Response.Write("<hr />error"+ex.ToString()); //} lbname.Text = cc1.connectionofc008_select("select t_name from ecpsl010 where t_empl='" + Session["emplnet"] + "'", "t_name"); }
public void GV1Bind() { int tt = Convert.ToInt32(cc1.connectionofc008_select("select count(*) as ct from [ecsfc929_memb] WHERE ([emno] = '" + Session["emplnet"] + "' and [pfc] !='是')", "ct")); GridView1.DataSource = cc1.QueryDataTable("select t1.cprj,t1.line,(select count(cprj) from ecsfc929_memb where cprj=t1.cprj and line=t1.line and pfc='是') 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=t3.cprj and t1.line=t3.line and t1.nopr=t3.nopr where t1.line='" + Session["line"] + "' and (select count(cprj) from ecsfc929_memb where cprj=t1.cprj and line=t1.line)!=(select count(cprj) from ecsfc929_memb where cprj=t1.cprj and line=t1.line and pfc='是') group by t1.cprj,t1.line order by max(t2.nopr) desc "); GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //HttpCookie pagePart = new HttpCookie("pagePart"); string pp = Request.QueryString["pagePart"] ?? "0"; Response.Cookies["PagePart"].Value = pp; Response.Cookies["PagePart"].Expires = DateTime.Now.AddDays(10); //tp:當天TT啟動時間 string tp = cc1.connectionofc008_select("select top 1 convert(nvarchar(23),sdate,20)+' '+stuff(right('0000'+cast(sdtim as nvarchar),4),3,0,':') as sdt from ecsfc933_mdt where line='N112' and sdate=convert(nvarchar(23),getdate(),23)", "sdt"); switch (pp) { case "0": if (tp == "") { break; } else { TimeSpan tts = DateTime.Now - Convert.ToDateTime(tp); Session["sTtime"] = tts.TotalSeconds; } break; case "1": string fetime = cc1.connectionofc008_select("select top 1 SUBSTRING(convert(nvarchar(23),usdtim,20),1,20)as udt from ecsfc930_pud where line='N112' and WorkStop='1' and uclose='否' order by usdtim asc", "udt"); if (fetime != "") { //有停工異常存在 //異常發生日期 DateTime tfetime = Convert.ToDateTime(fetime); if (tfetime.Date != DateTime.Now.Date) { //判斷最早異常是否非當天發生 //累積異常起算時間,使用當天TT開始時間 if (tp == "") //開啟看板時待當天作業開始才啟動計算累積時間 { break; } DateTime tdt = Convert.ToDateTime(tp); //TimeSpan ets = DateTime.Now - tdt; Session["accumulate"] = tdt.ToString("yyyy-MM-dd HH:mm:ss"); } else { Session["accumulate"] = tfetime.ToString("yyyy-MM-dd HH:mm:ss"); } } else { Session["accumulate"] = ""; } break; case "2": DateTime kd1 = new DateTime(1970, 1, 1); DateTime kd2 = DateTime.Now.ToUniversalTime(); TimeSpan kts = new TimeSpan(kd2.Ticks - kd1.Ticks); ViewState["serverTime"] = kts.TotalMilliseconds; break; } //pagePart.Expires = DateTime.Now.AddMinutes(2); //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SetClientID", "DoCookieSetup(\"pagePart\",\"" + pp + "\")", true); } }