protected void btSave_Click(object sender, EventArgs e) { ProduceTrack info = new ProduceTrack(); ProduceTrackBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <ProduceTrackBLL>(); if (this.hiID.Value == "") { info.MATID = this.hiMatID.Value; info.STATUS = "1"; info.WPID = "start"; info.MATBARCODE = this.HiMatBarCode.Value; bll.Insert(info); } ClientScript.RegisterStartupScript(this.GetType(), "myjs", "alert('原料上线完成');window.location.href='MaterialOnline.aspx';", true); } catch (Exception ex) { throw ex; } }
protected void btReset_Click(object sender, EventArgs e) { ProduceTrack info = new ProduceTrack(); ProduceTrackBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <ProduceTrackBLL>(); info.PID = this.hiID.Value; info.STATUS = "0"; info.WPID = this.hiGX.Value; info.EQUID = this.hiCB.Value; info.WSID = this.hiGW.Value; info.PRODUCTIONID = this.hiPid.Value; info.WORKINGSTARTTIME = DateTime.MinValue; bll.Update(info); BindData(info.PID); } catch (Exception ex) { throw ex; } }
protected void btEnd_Click(object sender, EventArgs e) { ProduceTrack info = new ProduceTrack(); ProduceTrackBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <ProduceTrackBLL>(); info.PID = this.hiID.Value; info.WORKINGENDTIME = DateTime.Now; info.STATUS = "1"; info.WPID = this.hiGX.Value; info.EQUID = this.hiCB.Value; info.WSID = this.hiGW.Value; info.PRODUCTIONID = this.hiPid.Value; info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value); info.CREATEUSER = this.HiCREATEUSER.Value; bll.Update(info); ClientScript.RegisterStartupScript(this.GetType(), "myjs", "alert('完成');window.location.href='MaterialTrace.aspx';", true); } catch (Exception ex) { throw ex; } }
private void BindData(string id) { ProduceTrackBLL bll = null; ProduceTrack info = new ProduceTrack(); try { bll = BLLFactory.CreateBLL <ProduceTrackBLL>(); if (string.IsNullOrEmpty(id) == false) { info.PID = id; info = bll.Get(info); UIBindHelper.BindForm(this.Page, info); this.PNAME.Text = info.PNAME; this.CBNAME.Text = info.CBNAME; this.GXNAME.Text = info.GXNAME; this.hiID.Value = info.PID; this.HiCREATEUSER.Value = info.CREATEUSER; this.HiCREATETIME.Value = info.CREATETIME.ToString(); this.hiCB.Value = info.EQUID; this.hiGX.Value = info.WPID; this.hiPid.Value = info.PRODUCTIONID; this.WORKINGSTARTTIME.Value = info.WORKINGSTARTTIME.ToString(); if (info.WORKINGSTARTTIME != DateTime.MinValue) { this.StartTime.Text = info.WORKINGSTARTTIME.Hour + ":" + info.WORKINGSTARTTIME.Minute + ":" + info.WORKINGSTARTTIME.Second; this.CurrentTime.Text = DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second; TimeSpan ts1 = new TimeSpan(DateTime.Now.Ticks); TimeSpan ts2 = new TimeSpan(info.WORKINGSTARTTIME.Ticks); TimeSpan ts = ts1.Subtract(ts2).Duration(); this.SpendTime.Text = ts.Hours.ToString() + "小时" + ts.Minutes.ToString() + "分钟" + ts.Seconds.ToString() + "秒"; } else { this.StartTime.Text = ""; this.CurrentTime.Text = ""; this.SpendTime.Text = ""; } } else { info = new ProduceTrack(); } SetBtnState(); } catch (Exception ex) { throw ex; } }
private void BindData() { ProduceTrackBLL bll = null; string barCode = this.tbBarCode.Text; DateTime DtNow = DateTime.Now; try { bll = BLLFactory.CreateBLL <ProduceTrackBLL>(); List <OnProcessingInfo> list = bll.GetOnProcessingList(barCode); if (list != null) { if (!string.IsNullOrEmpty(barCode) && list.Count > 0) { Response.Redirect("MaterialTrace.aspx?id=" + list[0].PID); } else { foreach (var item in list) { TimeSpan ts1 = new TimeSpan(DtNow.Ticks); TimeSpan ts2 = new TimeSpan(item.WorkingStartTime.Ticks); TimeSpan ts = ts1.Subtract(ts2).Duration(); item.SpendTime = ts.Hours.ToString() + "小时" + ts.Minutes.ToString() + "分钟" + ts.Seconds.ToString() + "秒"; item.CurrentTime = DtNow.Hour + ":" + DtNow.Minute + ":" + DtNow.Second; item.StartTime = item.WorkingStartTime.Hour + ":" + item.WorkingStartTime.Minute + ":" + item.WorkingStartTime.Second; } this.OnPList.DataSource = list; this.OnPList.DataBind(); } } } catch (Exception ex) { throw ex; } }
protected void btStart_Click(object sender, EventArgs e) { LoginInfo user = (Session["UserInfo"] as LoginInfo) as LoginInfo; ProduceTrack info = new ProduceTrack(); ProduceTrackBLL bll = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <ProduceTrackBLL>(); info.PRODUCTIONID = this.PRODUCTIONID.Value; if (this.hiID.Value == "") { info.PID = Guid.NewGuid().ToString(); info.STATUS = "0"; info.WPID = this.hiGX.Value; info.EQUID = this.hiCB.Value; info.WSID = this.hiGW.Value; info.FACTORYPID = user.OrgaID; info.WORKINGSTARTTIME = DateTime.Now; //校验是否跳序 string result = new ProcessCheckBLL().CheckSkipProcess(info.BATCHNUMBER, info.PRODUCTIONID, info.WPID); if (result != "") { ClientScript.RegisterStartupScript(this.GetType(), "myjs", "alert('" + result + "');", true); return; } bll.Insert(info); this.HiCREATEUSER.Value = info.CREATEUSER; this.HiCREATETIME.Value = info.CREATETIME.ToString(); } else { info.PID = this.hiID.Value; info.WORKINGSTARTTIME = DateTime.Now; info.STATUS = "0"; info.WPID = this.hiGX.Value; info.EQUID = this.hiCB.Value; info.WSID = this.hiGW.Value; info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value); info.CREATEUSER = this.HiCREATEUSER.Value; bll.Update(info); } BindData(info.PID); //获取产品信息 if (string.IsNullOrEmpty(this.BatchNumber.SelectedValue) == false) { ProducePlanBLL ppbll = BLLFactory.CreateBLL <ProducePlanBLL>(); ProductInfo result = ppbll.GetPNameByIDBatchNumber(this.BatchNumber.SelectedValue); this.PRODUCTIONID.Value = result.PID; this.PNAME.Text = result.PNAME; } this.hiID.Value = info.PID; //ClientScript.RegisterStartupScript(this.GetType(), "myjs", "window.location.href='MaterialTrace.aspx';", true); } catch (Exception ex) { throw ex; } }