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 button3_Click_1(object sender, EventArgs e) { if (lvMain.SelectedIndices.Count > 0) { ListViewItem item = lvMain.Items[lvMain.SelectedIndices[0]]; SpecsDetail detail = CurrentSpecs.FindByID(Int32.Parse(item.Tag.ToString())); //MessageBox.Show(String.Format("{0},{1}", item.Text, item.SubItems.ToString())); FormCheckDetail detailform = new FormCheckDetail(detail); if (detailform.ShowDialog() == DialogResult.OK) { MessageBox.Show(detail.Note); } } }
public SpecsDetail FindByID(int detailID) { SpecsDetail result = null; foreach (SpecsDetail detail in Items) { if (detail.ID == detailID) { result = detail; break; } } return(result); //return Items.Single(detail => detail.ID == detailID); }
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; }
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; } }
public FormCheckDetail(SpecsDetail detail) : this() { _detail = detail; initView(); }