Ejemplo n.º 1
0
 protected void Save_Click(object sender, EventArgs e)
 {
     using (DbAppDataContext db = new DbAppDataContext())
     {
         Check data = new Check();
         data.No        = double.Parse(TbNo.Value.ToString());
         data.Type      = TbType1.Text.ToString();
         data.Content   = TbContent.Value.ToString();
         data.Tool      = TbTool.Value.ToString();
         data.L_Toler   = GetToler(TbL_Toler.Value.ToString());
         data.U_Toler   = GetToler(TbU_Toler.Value.ToString());
         limit          = GetLimitData(TbL_Toler.Value.ToString(), TbL_Limit1.Value.ToString());
         data.L_Limit1  = limit[0];
         data.L_Limit2  = limit[1];
         limit          = GetLimitData(TbU_Toler.Value.ToString(), TbU_Limit1.Value.ToString());
         data.U_Limit1  = limit[0];
         data.U_Limit2  = limit[1];
         data.Maktx     = getMaktx;
         data.Mold      = getmold;
         data.CreatDate = DateTime.Now;
         db.Check.InsertOnSubmit(data);
         db.SubmitChanges();
         Maktx = getMaktx;
         Mold  = getmold;
         Server.Transfer("Detail.aspx");
     }
 }
Ejemplo n.º 2
0
        protected void GridView2_RowEditing(object sender, GridViewEditEventArgs e)
        {
            int id = (int)GridView2.DataKeys[e.NewEditIndex].Value;

            using (DbAppDataContext db = new DbAppDataContext())
            {
                var data = db.Record_Cavity.SingleOrDefault(c => c.Id == id);
                CavityNo            = data.CavityNo.ToString();
                GridView2.EditIndex = e.NewEditIndex;
                BindCheck(CavityNo);
                if (data.Type.ToString() == "计量")
                {
                    ((DropDownList)GridView2.Rows[e.NewEditIndex].FindControl("DdlResult")).Visible = false;
                    TextBox tb = (TextBox)GridView2.Rows[e.NewEditIndex].FindControl("TbResult");
                    tb.Visible = true;
                    tb.Text    = ((HiddenField)GridView2.Rows[e.NewEditIndex].FindControl("HidResult")).Value;
                }
                else
                {
                    ((TextBox)GridView2.Rows[e.NewEditIndex].FindControl("TbResult")).Visible = false;
                    DropDownList dd = ((DropDownList)GridView2.Rows[e.NewEditIndex].FindControl("DdlResult"));
                    dd.Visible = true;
                    HiddenField hf = (HiddenField)GridView2.Rows[e.NewEditIndex].FindControl("HidResult");
                    dd.SelectedValue = hf.Value;
                }
            }
        }
Ejemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            string maktx = HttpContext.Current.Request["maktx"];

            context.Response.ContentType = "text/plain";
            using (DbAppDataContext db = new DbAppDataContext())
            {
                var list = from m in db.Cavity
                           where maktx == m.Maktx && m.Del == 0
                           select new Mold {
                    Name = m.Mold
                };
                var result = list.Distinct().ToList();
                JavaScriptSerializer jss = new JavaScriptSerializer();
                if (list != null)
                {
                    string s = jss.Serialize(result);
                    context.Response.Write(s);
                }
                else
                {
                    context.Response.Write("");
                }
            }
        }
Ejemplo n.º 4
0
        protected void SignIn_Click(object sender, EventArgs e)
        {
            string username = UserName.Value.Trim();
            string password = Password.Value.Trim();

            byte[] passwordBytes = System.Text.Encoding.UTF8.GetBytes(password);
            byte[] hashBytes     = new System.Security.Cryptography.SHA256Managed().ComputeHash(passwordBytes);
            string hashString    = Convert.ToBase64String(hashBytes);

            using (DbAppDataContext db = new DbAppDataContext())
            {
                User data = db.User.SingleOrDefault(c => c.UserName == username && c.Password == hashString);
                if (data != null)
                {
                    DivMsg.Visible = false;
                    Session.Remove("UserName");
                    Session["Username"] = username;
                    Session["Level"]    = data.Level;
                    Response.Redirect("product/Search.aspx");
                }
                else
                {
                    DivMsg.Visible = true;
                }
            }
        }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.FilePath.ToString() == "/cavity/Add.aspx")
         {
             Create.Visible = true;
             Update.Visible = false;
         }
         else if (Request.FilePath.ToString() == "/cavity/Search.aspx")
         {
             Search data;
             data     = (Search)Context.Handler;
             getMaktx = data.Maktx;
             getMold  = data.Mold;
             using (DbAppDataContext db = new DbAppDataContext())
             {
                 var dtlist = from m in db.Cavity
                              where m.Maktx == getMaktx && m.Mold == getMold
                              select new Search {
                     Cid = m.Id.ToString(), Mold = m.Mold, Num = m.Num, Maktx = m.Maktx, SerialNo = m.SerialNo, Ps = m.PS
                 };
                 var list = dtlist.ToList();
                 TbMaktx.Value   = list[0].Maktx;
                 TbMold.Value    = list[0].Mold;
                 TbNum.Value     = list[0].Num.ToString();
                 TbPs.Value      = list[0].Ps;
                 TxtSerial.Value = list[0].SerialNo;
             }
             Create.Visible = true;
             Update.Visible = false;
         }
         else
         {
             Detail data;
             data     = (Detail)Context.Handler;
             id       = data.Cid;
             getMaktx = data.Maktx;
             getMold  = data.Mold;
             using (DbAppDataContext db = new DbAppDataContext())
             {
                 var dtlist = from m in db.Cavity
                              where m.Id == int.Parse(id)
                              select new Search {
                     Cid = m.Id.ToString(), Mold = m.Mold, Num = m.Num, Maktx = m.Maktx, SerialNo = m.SerialNo, Ps = m.PS
                 };
                 var list = dtlist.ToList();
                 TbMaktx.Value   = list[0].Maktx;
                 TbMold.Value    = list[0].Mold;
                 TbNum.Value     = list[0].Num.ToString();
                 TbPs.Value      = list[0].Ps;
                 TxtSerial.Value = list[0].SerialNo;
             }
             TbMaktx.Disabled = true;
             TbMold.Disabled  = true;
             Create.Visible   = false;
             Update.Visible   = true;
         }
     }
 }
Ejemplo n.º 6
0
 public void RecToDB()
 {
     //true为启动,false为退出
     act.启动   = active ? (byte)1 : (byte)0;
     act.退出   = active ? (byte)0 : (byte)1;
     act.时间   = time;
     act.IP地址 = GetLocalIP();
     try
     {
         using (db = new DbAppDataContext(Setting.ConnectionStr))
         {
             if (!db.DatabaseExists())
             {
                 return;
             }
             db.Activate.InsertOnSubmit(act);
             db.CommandTimeout = 30;
             db.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         errStr = ex.ToString();
         return;
     }
 }
Ejemplo n.º 7
0
        public bool IsNoRun(string maktx, string mold)
        {
            bool run = true;

            if (String.IsNullOrEmpty(maktx) && String.IsNullOrEmpty(mold))
            {
                Response.Redirect("Add.aspx");
                run = true;
            }
            else if (String.IsNullOrEmpty(maktx) || String.IsNullOrEmpty(mold))
            {
                LbMsg.Text = "如需复制,产品号和模具号都需要填写";
                DivMsg.Attributes["class"] = "has-error";
                run = false;
            }
            else
            {
                using (DbAppDataContext db = new DbAppDataContext())
                {
                    Cavity data = db.Cavity.SingleOrDefault(c => c.Maktx == maktx && c.Mold == mold);
                    if (data == null)
                    {
                        LbMsg.Text = "没有找到所需复制的产品号和模具号";
                        DivMsg.Attributes["class"] = "has-error";
                        run = false;
                    }
                }
            }
            return(run);
        }
Ejemplo n.º 8
0
 public PushInfoHelper(DbAppDataContext db, PsInfo pHelper, bool insert)
 {
     this.db      = db;
     this.insert  = insert;
     this.pHelper = pHelper;
     AssignmentInsertInfo();
 }
Ejemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Detail data;
         data          = (Detail)Context.Handler;
         getMaktx      = data.Maktx;
         getmold       = data.Mold;
         TbMaktx.Value = getMaktx;
         TbMold.Value  = getmold;
         using (DbAppDataContext db = new DbAppDataContext())
         {
             //Check data= db.Check.(c=>c.Maktx==getMaktx && c.Mold==getmold && c.Id==db.Check.Max )
             var data1 = db.Check.Where(c => c.Maktx == getMaktx && c.Mold == getmold);
             if (data1 != null)
             {
                 var maxData = data1.OrderByDescending(c => c.Id).FirstOrDefault();
                 msg        = maxData.No;
                 LbMsg.Text = "当前最新序号为: " + msg;
             }
             else
             {
                 LbMsg.Text = "";
             }
         }
     }
 }
Ejemplo n.º 10
0
        public void Bind()
        {
            using (DbAppDataContext db = new DbAppDataContext())
            {
                var dtlist = from m in db.Check
                             where m.Maktx == getMaktx && m.Mold == getMold && m.Del == 0
                             select new Detail {
                    CheckId = m.Id, No = m.No, Type = m.Type, Tool = m.Tool, Maktx = m.Maktx, Mold = m.Mold, Content = m.Content, L_Toler = (double)m.L_Toler, U_Toler = (double)m.U_Toler, L_Limit1 = (double)m.L_Limit1, U_Limit1 = (double)m.U_Limit1, L_Limit2 = (double)m.L_Limit2, U_Limit2 = (double)m.U_Limit2
                };
                if (dtlist.ToList().Count == 0)
                {
                    DivGrid.InnerHtml = "<p>没有检验项</p>"; GridView1.Visible = false;
                }
                else
                {
                    GridView1.Visible = true;
                    var dtlist1 = dtlist.ToList();
                    GridView1.DataSource = dtlist.ToList();
#if !DEBUG
                    GridView1.Columns[0].HeaderStyle.CssClass = "hidden";
                    GridView1.Columns[0].ItemStyle.CssClass   = "hidden";
#endif
                    GridView1.DataBind();
                }
            }
        }
Ejemplo n.º 11
0
 public PingInfoHelper(DbAppDataContext db, PgInfo pInfo, bool beginRec)
 {
     this.db = db;
     if (!db.DatabaseExists())
     {
         return;
     }
     this.pInfo = pInfo;
     AssignmentInsertInfo(beginRec);
 }
Ejemplo n.º 12
0
 protected void SubmitPs_Click(object sender, EventArgs e)
 {
     using (DbAppDataContext db = new DbAppDataContext())
     {
         Record data = db.Record.SingleOrDefault(c => c.Batch == batch);
         data.Ps2 = TxtPs.Value;
         db.SubmitChanges();
         Response.Write("<script>alert('成功');</script>");
     }
 }
Ejemplo n.º 13
0
 protected void BtnPs_Click(object sender, EventArgs e)
 {
     using (DbAppDataContext db = new DbAppDataContext())
     {
         Record data = db.Record.SingleOrDefault(c => c.Batch == Batch && c.Del == 0);
         data.ChangeDate = DateTime.Now;
         data.Ps         = TaPs.Value.ToString();
         db.SubmitChanges();
     }
 }
Ejemplo n.º 14
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string id = GridView1.DataKeys[e.RowIndex].Value.ToString();

            using (DbAppDataContext db = new DbAppDataContext())
            {
                Cavity data = db.Cavity.SingleOrDefault(c => c.Id == int.Parse(id));
                data.Del = 1;
                db.SubmitChanges();
                Bind();
            }
        }
Ejemplo n.º 15
0
        protected void GridView2_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
        {
            int id = (int)GridView2.DataKeys[e.RowIndex].Value;

            using (DbAppDataContext db = new DbAppDataContext())
            {
                GridView2.EditIndex = -1;
                var data = db.Record_Cavity.SingleOrDefault(c => c.Id == id);
                CavityNo = data.CavityNo.ToString();
                BindCheck(CavityNo);
            }
        }
Ejemplo n.º 16
0
 public void RecToPlanDB()
 {
     using (db = new DbAppDataContext(Setting.ConnectionStr))
     {
         if (!db.DatabaseExists())
         {
             return;
         }
         DeleteFromDbPlan(editPlan);
         AddToDbPlan(editPlan);
         db.SubmitChanges();
     }
 }
Ejemplo n.º 17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         batch             = Request.QueryString["batch"].ToString();
         LbBatch.InnerText = "批次号: " + batch;
         using (DbAppDataContext db = new DbAppDataContext())
         {
             Record data = db.Record.SingleOrDefault(c => c.Batch == batch);
             TxtPs.Value = data.Ps2;
         }
     }
 }
Ejemplo n.º 18
0
        /// <summary>
        /// 从DB中按条件查询联锁信息
        /// </summary>
        /// <param name="start">查询起始时间</param>
        /// <param name="end">查询终止时间</param>
        /// <param name="room">按炉号查询时,room>0</param>
        /// <returns></returns>
        public DataTable QueryRec(DateTime start, DateTime end, byte room)
        {
            //记录查询:
            //0日期,1计划炉号,2实际炉号,3联锁,***T-L-X车号,4推物理地址,5拦物理地址,6熄物理地址,7煤物理地址,8实际推,9预定推,10实际装,11实际结焦,12Max推焦电流,13Avg推焦电流,14Avg平煤电流,15时段,16班组
            DataTable table = new DataTable("Rec");

            SetCloumnsName(table);
            using (db = new DbAppDataContext(Setting.ConnectionStr))
            {
                if (!db.DatabaseExists())
                {
                    return(null);
                }
                // 判断是否为按炉号查询 :(room > 0 ? (pInfo.计划炉号 == room || rec.实际炉号 == room) : 1 == 1) 条件表达式返回值为一条语句
                var recs = from rec in db.PushInfo
                           where rec.预定出焦时间 >= start && rec.预定出焦时间 < end && (room > 0 ? (rec.实际炉号 == room || rec.计划炉号 == room) : 1 == 1)
                           select rec;
                if (recs == null || recs.Count() <= 0)
                {
                    return(null);
                }
                foreach (var p in recs)
                {
                    DataRow r     = table.NewRow();
                    int     index = 0;
                    r[index++] = p.预定出焦时间.Value.Date.ToString("d"); //0日期
                    r[index++] = p.计划炉号.Value.ToString("000");      //1计划炉号
                    r[index++] = p.T炉号 != null?p.T炉号.Value.ToString("000") : "0";

                    r[index++] = p.L炉号 != null?p.L炉号.Value.ToString("000") : "0";

                    r[index++] = p.X炉号 != null?p.X炉号.Value.ToString("000") : "0";

                    r[index++] = ByteToLockStatus(p.联锁.Value);//3联锁
                    r[index++] = p.Push工作车序列 != null?p.Push工作车序列.Value.ToString("0-0-0") : "0-0-0";

                    r[index++] = p.Max推焦电流 != null?p.Max推焦电流.Value.ToString("000") : "0";                                          //Max推焦电流

                    r[index++] = p.实际推焦时间 != null?p.实际推焦时间.Value.ToString("G") : " ";                                              //8实际推焦时间

                    r[index++] = p.预定出焦时间 != null?p.预定出焦时间.Value.ToString("g") : " ";                                              //9预定出焦时间

                    r[index++] = p.实际推焦时间 != null?IntToTimeFormat(((int)(p.实际推焦时间.Value - p.次装煤时间.Value).TotalMinutes)) : "19:00"; //实际结焦时间

                    r[index++] = p.PlanIndex != null ? p.PlanIndex.Value : -1;
                    r[index++] = p.PlanCount != null ? p.PlanCount.Value : 0;
                    table.Rows.Add(r);
                }
            }
            return(table);
        }
Ejemplo n.º 19
0
 protected void Search_btn_Click(object sender, EventArgs e)
 {
     using (DbAppDataContext db = new DbAppDataContext())
     {
         Maktx = TbSearchMaktx.Value.ToString().Trim().ToUpper();
         Mold  = TbMold.Value.ToString().Trim().ToUpper();
         if (String.IsNullOrEmpty(Mold))
         {
             Mold = Request.Params.Get("Select").ToString();
             //SelMold.Items[SelMold.SelectedIndex].Value.ToString();
         }
         Server.Transfer("Detail.aspx");
     }
 }
Ejemplo n.º 20
0
        public bool IsNoRun(string maktx)
        {
            bool run = true;

            using (DbAppDataContext db = new DbAppDataContext())
            {
                Product data = db.Product.SingleOrDefault(c => c.Maktx == maktx);
                if (data != null)
                {
                    run = false;
                }
                return(run);
            }
        }
Ejemplo n.º 21
0
        protected void CreateBatch_Click(object sender, EventArgs e)
        {
            Maktx = TbMaktx.Value.Trim().ToUpper();
            Mold  = TbMold.Value.Trim().ToUpper();
            bool       run         = true;
            List <Add> productlist = new List <Add>();
            List <Add> cavitylist  = new List <Add>();
            List <Add> checklist   = new List <Add>();

            run = IsNoRun(Maktx, out productlist, out cavitylist, out checklist);
            if (run == true)
            {
                using (DbAppDataContext db = new DbAppDataContext())
                {
                    var maxId = db.Record.Max(c => c.Id);
                    maxId += 1;
                    Record data = new Record();
                    data.Maktx    = Maktx;
                    data.Mold     = Mold;
                    data.Customer = productlist[0].Customer;
                    data.Standard = productlist[0].Standard;
                    string   date = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
                    string[] strs = { Mold, Maktx, date, maxId.ToString() };
                    data.Batch      = string.Join("_", strs);
                    data.CreateDate = DateTime.Now;
                    db.Record.InsertOnSubmit(data);
                    db.SubmitChanges();

                    string[] serial = cavitylist[0].SerialNo.Split('|');
                    for (int i = 0; i < cavitylist[0].Num; i++)
                    {
                        for (int j = 0; j < checklist.Count; j++)
                        {
                            Record_Cavity dataCavity = new Record_Cavity();
                            dataCavity.Batch    = string.Join("_", strs);
                            dataCavity.CavityNo = serial[i];
                            dataCavity.No       = checklist[j].No;
                            dataCavity.Type     = checklist[j].Type;
                            dataCavity.Content  = checklist[j].Content;
                            dataCavity.Tool     = checklist[j].Tool;
                            dataCavity.L_Limit  = checklist[j].L_Limit2;
                            dataCavity.U_Limit  = checklist[j].U_Limit2;
                            db.Record_Cavity.InsertOnSubmit(dataCavity);
                            db.SubmitChanges();
                        }
                    }
                    Response.Write("<script>alert('成功')</script>");//创建成功
                }
            }
        }
Ejemplo n.º 22
0
 protected void BtnError_Click(object sender, EventArgs e)
 {
     using (DbAppDataContext db = new DbAppDataContext())
     {
         var temp = from m in db.Record_Cavity
                    where m.Batch == Batch && m.CavityNo == CavityNo
                    select m;
         foreach (var i in temp)
         {
             i.Stamp = "堵腔";
         }
         db.SubmitChanges();
     }
 }
Ejemplo n.º 23
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string strLowT, strUpT, strL_Toler, strU_Toler, strNo;
            string id  = GridView1.DataKeys[e.RowIndex].Value.ToString();
            bool   run = true;

            using (DbAppDataContext db = new DbAppDataContext())
            {
                Check data = db.Check.SingleOrDefault(c => c.Id == int.Parse(id));
                strNo      = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TbNo")).Text.ToString().Trim();
                data.Type  = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TbType")).Text.ToString().Trim();
                data.Tool  = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TbTool")).Text.ToString().Trim();
                strL_Toler = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TbL_Toler")).Text.ToString().Trim();
                strU_Toler = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TbU_Toler")).Text.ToString().Trim();
                strLowT    = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TbL_Limit1")).Text.ToString().Trim();
                strUpT     = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TbU_Limit1")).Text.ToString().Trim();
                run        = IsNoRun(strU_Toler, strU_Toler, strLowT, strUpT, strNo);

                if (run == true)
                {
                    data.No       = double.Parse(strNo);
                    data.L_Toler  = TolerIsNoNull(strL_Toler);
                    data.L_Limit2 = double.Parse(strL_Toler);
                    data.U_Toler  = TolerIsNoNull(strU_Toler);
                    data.U_Limit2 = double.Parse(strU_Toler);
                    if (!String.IsNullOrEmpty(strLowT) && strLowT != "0")
                    {
                        data.L_Limit1 = double.Parse(strLowT);
                        data.L_Limit2 = double.Parse(strLowT);
                    }
                    else
                    {
                        data.L_Limit1 = 0;
                    }
                    if (!String.IsNullOrEmpty(strUpT) && strUpT != "0")
                    {
                        data.U_Limit1 = double.Parse(strUpT);
                        data.U_Limit2 = double.Parse(strUpT);
                    }
                    else
                    {
                        data.U_Limit1 = 0;
                    }
                    data.ChangeDate = DateTime.Now;
                    db.SubmitChanges();
                    GridView1.EditIndex = -1;
                    Bind();
                }
            }
        }
Ejemplo n.º 24
0
 protected void Update_Click(object sender, EventArgs e)
 {
     using (DbAppDataContext db = new DbAppDataContext())
     {
         Cavity data = db.Cavity.SingleOrDefault(c => c.Id == int.Parse(id));
         data.Num      = int.Parse(TbNum.Value.ToString().Trim());
         data.PS       = TbPs.Value.ToString().Trim();
         data.SerialNo = TxtSerial.Value.ToString().Trim();
         db.SubmitChanges();
         Maktx = getMaktx;
         Mold  = getMold;
         Server.Transfer("Detail.aspx");
     }
 }
Ejemplo n.º 25
0
        public bool IsNoRun(string a, string b)
        {
            bool result = true;

            using (DbAppDataContext db = new DbAppDataContext())
            {
                Cavity searchData = db.Cavity.SingleOrDefault(c => c.Maktx == a && c.Mold == b && c.Del == 0);
                if (searchData != null)
                {
                    Response.Write("<script> var temp1='" + a + "'; var temp2 ='" + b + "';alert('产品编号:'+temp1+'  模具号:'+temp2+'已存在');</script>");
                    result = false;
                }
            }
            return(result);
        }
Ejemplo n.º 26
0
        public bool IsNoRun(string batch)
        {
            bool run = true;

            using (DbAppDataContext db = new DbAppDataContext())
            {
                Record data = db.Record.SingleOrDefault(c => c.Batch == Batch);
                if (data == null)
                {
                    Response.Write("<script>alert('不存在该批次')</script>");
                    run = false;
                }
            }
            return(run);
        }
Ejemplo n.º 27
0
 public void BindCavity()
 {
     using (DbAppDataContext db = new DbAppDataContext())
     {
         var cavityList = new List <Add>();
         var tempList   = from m in db.Record_Cavity
                          where m.Batch == Batch
                          select new Add {
             CavityNo = m.CavityNo, Stamp = m.Stamp
         };
         cavityList.AddRange(tempList.Distinct());
         GridView1.DataSource = cavityList;
         GridView1.DataBind();
     }
 }
Ejemplo n.º 28
0
        public DataTable Query(DateTime start, DateTime end, byte room)
        {
            //记录查询:
            //1"日期",2 "炉号", 3"T炉号", 4"T炉号", 5"T物理地址",6 "M物理地址", 7"预定装煤时间", 8"实际装煤时间", 9"装煤结束时间", 10"Avg平煤电流",11 "班组", 12"时段"
            DataTable table = new DataTable("Rec");

            SetCloumnsProperty(table);
            using (db = new DbAppDataContext(Setting.ConnectionStr))
            {
                // 判断是否为按炉号查询 :(room > 0 ? (pInfo.计划炉号 == room || rec.实际炉号 == room) : 1 == 1) 条件表达式返回值为一条语句
                var recs = from rec in db.PingInfo
                           where rec.Begin平煤时间 >= start && rec.Begin平煤时间 < end && (room > 0 ? (rec.预定装煤炉号 == room || rec.T平煤炉号 == room) : 1 == 1)
                           select rec;
                if (recs.Count() <= 0)
                {
                    return(null);
                }
                foreach (var p in recs)
                {
                    DataRow r     = table.NewRow();
                    int     index = 0;
                    //1"日期",2 "炉号", 3"T炉号",5"T物理地址,4"M炉号"",6 "M物理地址", 7"预定装煤时间", 8"实际装煤时间", 9"装煤结束时间", 10"Avg平煤电流",11 "班组", 12"时段"
                    r[index++] = p.Begin平煤时间.Value.Date.ToString("d");                      //1日期
                    r[index++] = p.预定装煤炉号.Value.ToString("000");                            //2炉号
                    r[index++] = p.T平煤炉号 != null?p.T平煤炉号.Value.ToString("000") : "000";     //3 T平煤炉号

                    r[index++] = p.T实际炉号.Value.ToString("000");                             //4T实际炉号炉号
                    r[index++] = p.T物理地址 != null?p.T物理地址.Value.ToString() : "0";            //6T物理地址

                    r[index++] = p.M炉号.Value.ToString("000");                               //4M炉号
                    r[index++] = p.M物理地址.Value;                                             //6M物理地址
                    r[index++] = p.Begin平煤时间 != null?p.Begin平煤时间.Value.ToString("G") : "0"; //8实际装煤时间

                    r[index++] = p.End平煤时间 != null?p.End平煤时间.Value.ToString("G") : "0";     //9装煤结束时间

                    r[index++] = p.Plan平煤时间 != null?p.Plan平煤时间.Value.ToString() : "0";      //7预定装煤时间

                    r[index++] = p.Avg平煤电流 != null?p.Avg平煤电流.Value.ToString("g") : "0";     //10Avg平煤电流

                    r[index++] = ByteToPeriod(p.P时段.Value);                                 //12时段:白班,夜班
                    r[index++] = ByteToGroup(p.G班组.Value);                                  //11班组:甲,乙,丙,丁
                    r[index++] = p.PlanIndex != null ? p.PlanIndex.Value : -1;
                    r[index]   = p.PlanCount != null ? p.PlanCount.Value : 0;
                    table.Rows.Add(r);
                }
            }
            return(table);
        }
Ejemplo n.º 29
0
 /// <summary>
 /// 计算得到K系数
 /// </summary>
 /// <param name="start"> 起始时间</param>
 /// <param name="period"> 时段</param>
 /// <param name="_12H">决定24H分为白中夜三班,还是白夜两班 </param>
 /// <returns></returns>
 public List <SumHelper> QuerySumInfo(DateTime start, int period, bool _12H)
 {
     using (db = new DbAppDataContext(Setting.ConnectionStr))
     {
         if (!db.DatabaseExists())
         {
             return(null);
         }
         DateTime[] time = PeriodToTime(start, period, _12H);
         var        recs = from rec in db.PushInfo
                           from rec1 in db.PingInfo
                           where rec.预定出焦时间 >= time[0] && rec.预定出焦时间 < time[1] &&
                           rec1.预定出焦时间 >= time[0] && rec1.预定出焦时间 < time[1] &&
                           (rec.预定出焦时间 == rec1.预定出焦时间)
                           select new
         {
             rec.计划炉号,
             rec.预定出焦时间,
             rec.计划结焦时间,
             rec.规定结焦时间,
             rec.实际结焦时间,
             rec.实际推焦时间,
             rec1.Begin平煤时间,           //装煤时间
             rec.Max推焦电流,
         };
         if (recs == null || recs.Count() <= 0)
         {
             return(null);
         }
         List <SumHelper> sum = new List <SumHelper>();
         int index            = 1;
         foreach (var r in recs)
         {
             SumHelper s = new SumHelper();
             s.Num               = index++;//炉数
             s.RoomNum           = r.计划炉号 != null ? (int)r.计划炉号 : 0;
             s.PushTime          = r.预定出焦时间 != null ? (DateTime)r.预定出焦时间 : DateTime.Now;
             s.ActualPushTime    = r.实际推焦时间 != null ? (DateTime)r.实际推焦时间 : DateTime.Now;
             s.ActualStokingTime = r.Begin平煤时间 != null ? (DateTime)r.Begin平煤时间 : DateTime.Now;
             s.StandardBurnTime  = r.规定结焦时间 != null ? (int)r.规定结焦时间 : 0;
             s.BurnTime          = r.计划结焦时间 != null ? (int)r.计划结焦时间 : 0;
             s.ActualBurnTime    = r.实际结焦时间 != null ? (int)r.实际结焦时间 : 0;
             s.PushCur           = r.Max推焦电流 != null ? (int)r.Max推焦电流 : 0;
             sum.Add(s);
         }
         return(sum);
     }
 }
Ejemplo n.º 30
0
 protected void BtnError_Click(object sender, EventArgs e)
 {
     CavityNo = ((Label)GridView2.Rows[0].FindControl("Label2")).Text.ToString();
     using (DbAppDataContext db = new DbAppDataContext())
     {
         var temp = from m in db.Record_Cavity
                    where m.Batch == Batch && m.CavityNo == CavityNo
                    select m;
         foreach (var i in temp)
         {
             i.Stamp = "堵腔";
         }
         db.SubmitChanges();
         BindCavity();
     }
 }