private void button1_Click(object sender, EventArgs e) { cleaning(); if (!String.IsNullOrEmpty(txtBarCode.Text)) { Specs spec = DbFactory.Find(txtBarCode.Text, CurrentJob.IsFull); if (spec != null) { //first process last spec; /* * if ((CurrentJob.IsFull==false) && (spec.IsFull)) * { * if (MessageBox.Show("此项检查是牵引变检查项目,是否继续检查?", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No) * return; * }*/ CurrentSpecs = spec; InitView(); } else { MessageBox.Show("输入的编码不存在,请重新输入"); } } }
private void InitView() { tvMain.Nodes.Clear(); tvMain.BeginUpdate(); try { string sqlstring = String.Format("select Section,sequence,checkposition,id from DictSpecs where Section='{0}' order by sequence ", _keyName); if (!_Job.IsFull) { sqlstring = "select Section,sequence,checkposition,id from DictSpecs where isfull<>1 order by sequence"; } using (IDataReader dr = DataAccess.ExecuteReader(sqlstring)) { TreeNode t1 = null; TreeNode t2 = null; string section = ""; int sequ = 0; String checkp = ""; while (dr.Read()) { if (!section.Equals(dr["Section"].ToString())) { section = dr["Section"].ToString(); t1 = new TreeNode(section); tvMain.Nodes.Add(t1); } sequ = Int32.Parse(dr["Sequence"].ToString()); checkp = dr["CheckPosition"].ToString(); t2 = new TreeNode(String.Format("{0}.{1}", sequ, checkp)); Specs spec = DbFactory.FindByFilter("ID=" + dr["ID"].ToString(), _Job.IsFull); if (spec != null) { _Job.SetCheckToSpecs(spec); if (spec.IsCheckAll) { t2.Checked = true; t2.ForeColor = System.Drawing.Color.Blue; } foreach (SpecsDetail detail in spec.Items) { TreeNode node = t2.Nodes.Add(String.Format("{0}({1})--{2}[{3}]", detail.CheckDetail, detail.CheckMethod, detail.SpecifiedSizeHeight, detail.KnockPosition)); node.Checked = detail.isChecked; if (detail.isDone) { node.ForeColor = System.Drawing.Color.Blue; } } } t1.Nodes.Add(t2); } dr.Close(); } } finally { tvMain.EndUpdate(); } }
public void SetCheckToSpecs(Specs spec) { //JobDetail detail = FindBySpecsID(spec.ID); JobDetail detail = findByBarCode(spec.BarCode); if (detail != null) { foreach (string kv in detail.CheckDetailList.Split(',')) { String[] checkresults = kv.Split('='); if (checkresults.Length == 2) { int spid = Int32.Parse(checkresults[0]); String checkresult = checkresults[1].Trim(); bool ispass = checkresult.Substring(0, 1) == "1" ? true : false; string note = ""; if (checkresult.Length > 2) { note = checkresult.Substring(2, checkresult.Length - 2); } SpecsDetail spdetail = spec.FindByID(spid); if (spdetail != null) { spdetail.isChecked = ispass; spdetail.isDone = true; spdetail.Note = note; } } } spec.IsCheckAll = true; detail.BarCode = spec.BarCode; } }
private void btnSave_Click(object sender, EventArgs e) { CurrentSpecs.IsCheckAll = true; foreach (ListViewItem item in lvMain.Items) { SpecsDetail detail = CurrentSpecs.FindByID(Int32.Parse(item.Tag.ToString())); detail.isChecked = item.Checked; if (!detail.isChecked) { CurrentSpecs.IsCheckAll = false; } } //JobDetail jobdetail = CurrentJob.FindBySpecsID(CurrentSpecs.ID); JobDetail jobdetail = CurrentJob.findByBarCode(CurrentSpecs.BarCode); if (jobdetail == null) { jobdetail = new JobDetail(); } jobdetail.JobID = CurrentJob.ID; jobdetail.SpecsID = CurrentSpecs.ID; jobdetail.CheckTime = DateTime.Now; jobdetail.isChecked = CurrentSpecs.IsCheckAll; jobdetail.CheckDetailList = CurrentSpecs.CheckDetailList; jobdetail.BarCode = CurrentSpecs.BarCode; CurrentJob.Items.Add(jobdetail); if (jobdetail.ID == 0) { jobdetail.ID = DbFactory.JobDetailInsert(jobdetail); CurrentJob.CheckPosition += 1; } else { DbFactory.JobDetailUpdate(jobdetail); } //DbFactory.SaveJob(CurrentJob); if (AppHelper.IsLockOnCheck == false) { Specs spec = DbFactory.FindBySequence(CurrentSpecs.Sequence + 1, CurrentJob.IsFull); if (spec != null) { CurrentSpecs = spec; InitView(); } else { //work done. MessageBox.Show("已经检查到最大序号!"); } } else { InitView(); } }
private void button1_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(txtBarCode.Text)) { Specs spec = DbFactory.Find(txtBarCode.Text); if (spec != null) { //first process last spec; CurrentSpecs = spec; InitView(); } } }
public FormCheck(JobMain job) : this() { CurrentJob = job; if (job.Items.Count > 0) { Int32 specsid = job.Items.Max(jobdetail => jobdetail.SpecsID); Specs spec = DbFactory.FindByFilter("ID=" + specsid.ToString()); if (spec != null) { CurrentSpecs = spec; InitView(); } } }
public static Specs FindByFilter(String sFilter, Boolean isFull) { Specs result = new Specs(); using (IDataReader dr = DataAccess.ExecuteReader(String.Format("select * from DictSpecs where {0}", sFilter))) { if (dr.Read()) { result.BarCode = (dr["barcode"] == DBNull.Value)?"":dr["barcode"].ToString(); result.ID = Int32.Parse(dr["ID"].ToString()); result.Sequence = Int32.Parse(dr["Sequence"].ToString()); result.Seciton = dr["Section"].ToString(); result.CheckPosition = dr["CheckPosition"].ToString(); result.CheckMethod = dr["CheckMethod"].ToString(); result.IsFull = (dr["IsFull"] == DBNull.Value) ? false : Boolean.Parse(dr["IsFull"].ToString()); dr.Close(); } else { return(null); } } string sqlstring = String.Format("select * from DictSpecsItems where DictSpecsID={0}", result.ID); if (isFull == false) { sqlstring = String.Format("select * from DictSpecsItems where DictSpecsID={0} and IsFull<>1", result.ID); } using (IDataReader dr = DataAccess.ExecuteReader(sqlstring)) { while (dr.Read()) { SpecsDetail detail = new SpecsDetail(); detail.ID = Int32.Parse(dr["id"].ToString()); detail.SpecsID = result.ID; detail.SpecifiedSizeHeight = (dr["SpecifiedSizeHeight"] == DBNull.Value) ? "" : dr["SpecifiedSizeHeight"].ToString(); detail.CheckDetail = dr["CheckDetail"].ToString(); detail.CheckMethod = (dr["CheckMethod"] == DBNull.Value) ? result.CheckMethod : dr["CheckMethod"].ToString(); detail.KnockPosition = (dr["KnockPosition"] == DBNull.Value) ? "" : dr["KnockPosition"].ToString(); detail.IsFull = (dr["IsFull"] == DBNull.Value) ? false : Boolean.Parse(dr["IsFull"].ToString()); result.Items.Add(detail); } } return(result); }
public static Specs FindByFilter(String sFilter,Boolean isFull) { Specs result = new Specs(); using (IDataReader dr = DataAccess.ExecuteReader(String.Format("select * from DictSpecs where {0}", sFilter))) { if (dr.Read()) { result.BarCode = (dr["barcode"]==DBNull.Value)?"":dr["barcode"].ToString(); result.ID = Int32.Parse(dr["ID"].ToString()); result.Sequence = Int32.Parse(dr["Sequence"].ToString()); result.Seciton = dr["Section"].ToString(); result.CheckPosition = dr["CheckPosition"].ToString(); result.CheckMethod = dr["CheckMethod"].ToString(); result.IsFull = (dr["IsFull"] == DBNull.Value) ? false : Boolean.Parse(dr["IsFull"].ToString()); dr.Close(); } else { return null; } } string sqlstring = String.Format("select * from DictSpecsItems where DictSpecsID={0}", result.ID); if (isFull==false) sqlstring = String.Format("select * from DictSpecsItems where DictSpecsID={0} and IsFull<>1", result.ID); using (IDataReader dr = DataAccess.ExecuteReader(sqlstring)) { while (dr.Read()) { SpecsDetail detail = new SpecsDetail(); detail.ID=Int32.Parse(dr["id"].ToString()); detail.SpecsID=result.ID; detail.SpecifiedSizeHeight=(dr["SpecifiedSizeHeight"] == DBNull.Value) ? "" : dr["SpecifiedSizeHeight"].ToString(); detail.CheckDetail=dr["CheckDetail"].ToString(); detail.CheckMethod=(dr["CheckMethod"] == DBNull.Value) ? result.CheckMethod : dr["CheckMethod"].ToString(); detail.KnockPosition =(dr["KnockPosition"] == DBNull.Value) ? "" : dr["KnockPosition"].ToString(); detail.IsFull = (dr["IsFull"] == DBNull.Value) ? false : Boolean.Parse(dr["IsFull"].ToString()); result.Items.Add(detail); } } return result; }
private void button3_Click(object sender, EventArgs e) { if (CurrentSpecs == null) { return; } Int32 sequ = CurrentSpecs.Sequence - 1; if (sequ <= 0) { sequ = 1; } Specs spec = DbFactory.FindBySequence(sequ, CurrentJob.IsFull); if (spec != null) { CurrentSpecs = spec; InitView(); } }
private void button4_Click(object sender, EventArgs e) { if (CurrentSpecs == null) { return; } Int32 sequ = CurrentSpecs.Sequence + 1; if (sequ >= CurrentJob.NeedCheckPosition) { sequ = CurrentJob.NeedCheckPosition; } Specs spec = DbFactory.FindBySequence(sequ, CurrentJob.IsFull); if (spec != null) { CurrentSpecs = spec; InitView(); } }
public static Specs Find(String barcode, Boolean isFull) { string sParam = ""; barcode = barcode.Trim(); if (barcode.Length == 16) { sParam = barcode.Substring(13, 3); } else { sParam = barcode.Substring(barcode.Length - 3, 3); } Specs result = FindByFilter(String.Format("ltrim(rtrim(barcode))='{0}'", sParam), isFull); if (result != null) { result.BarCode = barcode; } return(result); }
private void btnSave_Click(object sender, EventArgs e) { foreach (ListViewItem item in lvMain.Items) { SpecsDetail detail = CurrentSpecs.FindByID(Int32.Parse(item.Tag.ToString())); detail.isChecked = item.Checked; } JobDetail jobdetail = CurrentJob.FindBySpecsID(CurrentSpecs.ID); if (jobdetail == null) { jobdetail = new JobDetail(); } jobdetail.JobID = CurrentJob.ID; jobdetail.SpecsID = CurrentSpecs.ID; jobdetail.CheckTime = DateTime.Now; jobdetail.isChecked = CurrentSpecs.IsCheckAll; jobdetail.CheckDetailList = CurrentSpecs.CheckDetailList; CurrentJob.Items.Add(jobdetail); if (jobdetail.ID == 0) { jobdetail.ID = DbFactory.JobDetailInsert(jobdetail); CurrentJob.CheckPosition += CurrentJob.CheckPosition; } else DbFactory.JobDetailUpdate(jobdetail); //DbFactory.SaveJob(CurrentJob); Specs spec = DbFactory.FindBySequence(CurrentSpecs.Sequence + 1); if (spec != null) { CurrentSpecs = spec; InitView(); } else { //work done. MessageBox.Show("已经检查到最大序号!"); } }
public void SetCheckToSpecs(Specs spec) { JobDetail detail = FindBySpecsID(spec.ID); if (detail != null) { foreach (string kv in detail.CheckDetailList.Split(',')) { String[] checkresults = kv.Split('='); if (checkresults.Length == 2) { int spid = Int32.Parse(checkresults[0]); bool ispass = checkresults[1] == "1" ? true : false; SpecsDetail spdetail = spec.FindByID(spid); if (spdetail != null) { spdetail.isChecked = ispass; spdetail.isDone = true; } } } spec.IsCheckAll = true; } }
private void txtSequ_ValueChanged(object sender, EventArgs e) { CurrentSpecs = DbFactory.FindBySequence(Int32.Parse(txtSequ.Value.ToString()), true); InitView(); }
private void button1_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(txtBarCode.Text)) { Specs spec = DbFactory.Find(txtBarCode.Text); if (spec != null) { //first process last spec; CurrentSpecs = spec; InitView(); } } }
private void button4_Click(object sender, EventArgs e) { if (CurrentSpecs == null) return; Int32 sequ = CurrentSpecs.Sequence + 1; if (sequ >= CurrentJob.NeedCheckPosition) { sequ = CurrentJob.NeedCheckPosition; } Specs spec = DbFactory.FindBySequence(sequ); if (spec != null) { CurrentSpecs = spec; InitView(); } }
public static bool UpdateSpecsBarCode(Specs spec, String barcode) { int result = DataAccess.ExecuteNonQuery(String.Format("Update DictSpecs set barcode='{0}' where id={1}", barcode, spec.ID)); return(result == 1); }
private void button1_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(txtBarCode.Text)) { Specs spec = DbFactory.Find(txtBarCode.Text,CurrentJob.IsFull); if (spec != null) { //first process last spec; if ((CurrentJob.IsFull==false) && (spec.IsFull)) { if (MessageBox.Show("此项检查是全面检查项目,是否继续检查?", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No) return; } CurrentSpecs = spec; InitView(); } else { MessageBox.Show("输入的编码不存在,请重新输入"); } } }
private void txtSequ_ValueChanged(object sender, EventArgs e) { CurrentSpecs = DbFactory.FindBySequence(Int32.Parse(txtSequ.Value.ToString()),true); InitView(); }
public void SetCheckToSpecs(Specs spec) { JobDetail detail = FindBySpecsID(spec.ID); if (detail != null) { foreach (string kv in detail.CheckDetailList.Split(',')) { String[] checkresults = kv.Split('='); if (checkresults.Length == 2) { int spid = Int32.Parse(checkresults[0]); String checkresult = checkresults[1].Trim(); bool ispass = checkresult.Substring(0, 1) == "1" ? true : false; string note = ""; if (checkresult.Length > 2) { note = checkresult.Substring(2, checkresult.Length - 2); } SpecsDetail spdetail = spec.FindByID(spid); if (spdetail != null) { spdetail.isChecked = ispass; spdetail.isDone = true; spdetail.Note = note; } } } spec.IsCheckAll = true; detail.BarCode = spec.BarCode; } }
public static bool UpdateSpecsBarCode(Specs spec, String barcode) { int result = DataAccess.ExecuteNonQuery(String.Format("Update DictSpecs set barcode='{0}' where id={1}", barcode, spec.ID)); return result == 1; }
public static bool SaveSpecs(Specs spec) { return false; }
private void FormSpecsEdit_Load(object sender, EventArgs e) { CurrentSpecs = DbFactory.FindBySequence(1, true); InitCombobox(); InitView(); }
public static bool SaveSpecs(Specs spec) { return(false); }
private void button3_Click(object sender, EventArgs e) { if (CurrentSpecs == null) return; Int32 sequ = CurrentSpecs.Sequence - 1; if (sequ <=0) { sequ = 1; } Specs spec = DbFactory.FindBySequence(sequ); if (spec != null) { CurrentSpecs = spec; InitView(); } }
private void FormSpecsEdit_Load(object sender, EventArgs e) { CurrentSpecs = DbFactory.FindBySequence(1,true); InitCombobox(); InitView(); }
public void SetCheckToSpecs(Specs spec) { JobDetail detail = FindBySpecsID(spec.ID); if (detail != null) { foreach (string kv in detail.CheckDetailList.Split(',')) { String[] checkresults = kv.Split('='); if (checkresults.Length == 2) { int spid = Int32.Parse(checkresults[0]); bool ispass = checkresults[1] == "1" ? true : false; SpecsDetail spdetail = spec.FindByID(spid); if (spdetail != null) { spdetail.isChecked = ispass; spdetail.isDone = true; } } } spec.IsCheckAll = true; } }