private void 保存_Click(object sender, EventArgs e) { bool keyitijiao = true; if (curLab != null) { curLab.SaveCheckVals = true; foreach (var item in curLab.CheckVals) { if (item.CheckVal == null) { keyitijiao = false; MessageBox.Show("请填完项目再提交");//20151225 } else { item.JianYan(); } } if (keyitijiao == true) { curLab.Billtype = "检验完成"; curLab.LabState = "检验完成"; curLab.Save(); lableiji.LoadDataByWhere("main.BillType=@BillType order by JyTime desc", "开始检验"); MessageBox.Show("检验完成"); } } else { MessageBox.Show("没有选中数据"); } }
public void HandleCardMessage(Device.CardReader device, string cardId) { QC_IC_Info icCard = QC_IC_Info.FindByCardId(cardId); if (icCard == null) { MessageBox.Show("此卡未注册"); return; } if (!icCard.CardType.StartsWith("CUT_")) { MessageBox.Show("磁扣类型不对"); return; } if (icCard.SampleId <= 0) { MessageBox.Show("此卡没有业务信息"); return; } QC_Sample_Lab_Jy tempLab = QC_Sample_Lab_Jy.GetById(icCard.SampleId); if (tempLab == null) { MessageBox.Show("没有找到单据"); return; } tempLab.JyCode = DbContext.GetSeq("JY" + DateTime.Now.Date.ToString("yyyyMMdd"), 2); tempLab.Billtype = "开始检验"; tempLab.LabState = "开始检验"; tempLab.JyUser = LocalInfo.Current.user.ID; tempLab.JyTime = DateTime.Now; icCard.SampleId = 0; IDbConnection conn = DbContext.GetDefaultConnection(); conn.Open(); IDbTransaction trans = conn.BeginTransaction(); icCard.Save(trans); tempLab.Save(trans); trans.Commit(); conn.Close(); this.curLab = QC_Sample_Lab_Jy.GetById(tempLab.Sample_Lab_ID); lableiji.Add(curLab); DbContext.ExeSql("insert into QC_LabLog(zycode,jycode,jytime) values('" + this.curLab.StoreCode + "','" + this.curLab.JyCode + "',getDate())"); labTable1.LoadDataByWhere("labstate='送检' and checkgroupname like '化验样%' and maketime>=@maketime", DateTime.Today.AddDays(-1)); // labTable2.LoadDataByWhere("labstate='送检' and checkgroupname like '角质层%' and maketime>=@maketime", DateTime.Today.AddDays(-1)); label2.Text = labTable1.Count.ToString(); // label4.Text = labTable2.Count.ToString(); SetGridViewFocuse(); this.printDocument1.Print(); //自动打印 //this.printPreviewDialog1.ShowDialog(); }