private void btnSaveLab_Click(object sender, EventArgs e) { if (curSelLab == null) { MessageBox.Show("没有选中数据"); return; } QC_Sample_Lab tempLab = curSelLab; if (tempLab.CheckGroupType == "立刻检验") { foreach (var item in tempLab.CheckVals) { item.CheckUser = LocalInfo.Current.user.ID; item.CheckTime = DateTime.Now; } tempLab.Billtype = "检验完成"; tempLab.LabState = "检验完成"; tempLab.MakeUser = LocalInfo.Current.user.ID; tempLab.MakeTime = DateTime.Now; tempLab.RefreshState(); tempLab.SaveCheckVals = true; tempLab.Save(); } }
/// <summary> /// 刷卡 /// </summary> 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_")) { if (icCard.SampleId > 0) { MessageBox.Show("此卡已绑定信息"); return; } if (curSelLab == null) { MessageBox.Show("请先查询样品单号"); return; } if (curSelLab.CheckGroupType != "后续检验") { MessageBox.Show("此样品单号不需要绑定磁卡"); return; } if (curSelLab.LabState != "制样") { MessageBox.Show("此样品已绑定磁扣"); return; } string ckgCode = icCard.CardType.Substring(4); if (curSelLab.CheckGroupName.Contains("角质层")) { if (ckgCode != "04" && ckgCode != "05") { MessageBox.Show("磁扣类型不对"); return; } } else { if (curSelLab.CheckGroupCode != ckgCode && !((curSelLab.CheckGroupCode == "14" || curSelLab.CheckGroupCode == "13") && (ckgCode == "04" || ckgCode == "05" || ckgCode == "14" || ckgCode == "13"))) { MessageBox.Show("磁扣类型不对"); return; } } QC_Sample_Lab tempLab = curSelLab; icCard.SampleId = tempLab.Sample_Lab_ID; tempLab.CardId = icCard.CardID; tempLab.MakeUser = LocalInfo.Current.user.ID; tempLab.MakeTime = DateTime.Now; tempLab.Billtype = "已扫样品扣"; tempLab.LabState = "送检"; tempLab.RefreshState(); IDbConnection conn = DbContext.GetDefaultConnection(); conn.Open(); IDbTransaction trans = conn.BeginTransaction(); tempLab.Save(trans); icCard.Save(trans); trans.Commit(); conn.Close(); //DbContext.ExeSql("update mix set mix.SampleState=4 from QC_SAMPLE_MIX mix where mix.SampleState=3 and not exists (select * from QC_SAMPLE_LAB t1 inner join QC_MIXCHECKGROUP t2 on t2.SAMPLE_LAB_ID= t1.SAMPLE_LAB_ID where t2.SAMPLE_MIX_ID=mix.SAMPLE_MIX_ID and t1.CheckGroupName!='水分样' and IsNull(t1.BILLTYPE,'')='未绑定样品扣')"); lblLabMakeTime.Text = DateTime.Now.ToString("HH:mm:ss") + "完成刷卡"; DlgZyInfo dlg = new DlgZyInfo(curSelLab.CheckGroupName, curSelLab.ShortStoreCode); dlg.ShowDialog(); } else { MessageBox.Show("磁卡类型不对"); return; } }