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); } } }