/// <summary> /// 存样 /// </summary> /// <param name="cupBoardNumber"></param> /// <param name="saveUser"></param> /// <param name="sampleCode"></param> /// <returns></returns> public bool SaveCupBoard(int cupBoardNumber, string saveUser, string sampleCode) { CmcsCupCoardSave saveBoard = CommonDAO.GetInstance().SelfDber.Entity <CmcsCupCoardSave>("where CupCoardNumber=:CupCoardNumber and IsUse=1", new { CupCoardNumber = cupBoardNumber }); if (saveBoard == null) { saveBoard = new CmcsCupCoardSave(); saveBoard.CupCoardNumber = cupBoardNumber; saveBoard.SaveCount++; saveBoard.IsUse = 1; saveBoard.UpdateTime = DateTime.Now; CommonDAO.GetInstance().SelfDber.Insert(saveBoard); } else { saveBoard.SaveCount++; saveBoard.UpdateTime = DateTime.Now; CommonDAO.GetInstance().SelfDber.Update(saveBoard); } CmcsCupCoardSaveDetail saveDetail = new CmcsCupCoardSaveDetail(); saveDetail.CupCoardSaveId = saveBoard.Id; saveDetail.SampleCode = sampleCode; saveDetail.SaveUser = saveUser; saveDetail.IsTake = 0; saveDetail.SaveTime = DateTime.Now; return(CommonDAO.GetInstance().SelfDber.Insert(saveDetail) > 0); }
private void superGridControl1_DataBindingComplete(object sender, DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs e) { foreach (GridRow gridRow in e.GridPanel.Rows) { try { CmcsCupCoardSaveDetail entity = gridRow.DataItem as CmcsCupCoardSaveDetail; if (entity == null) { return; } // 填充有效状态 gridRow.Cells["CupBoardNumber"].Value = entity.TheSave.CupCoardNumber.ToString(); if (entity.SaveTime < DateTime.Now.AddDays(-Over_Day)) { gridRow.Cells["glcmSaveTime"].CellStyles.Default.Background.Color1 = Color.Red; } } catch (Exception) { } } #endregion }
/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { string barrelCode = txtInputSampleCode.Text.Trim(); if (String.IsNullOrWhiteSpace(barrelCode)) { return; } this.RCMakeDetail = commonDAO.SelfDber.Entity <CmcsRCMakeDetail>("where SampleCode=:SampleCode order by CreateDate desc", new { SampleCode = barrelCode }); // 根据采样桶编码查找该采样单下所有采样桶记录 if (this.RCMakeDetail != null) { CmcsCupCoardSaveDetail saveDetail = commonDAO.SelfDber.Entity <CmcsCupCoardSaveDetail>("where SampleCode=:SampleCode ", new { SampleCode = barrelCode }); if (saveDetail != null) { ShowMessage("该样品已存样,存样位置:" + saveDetail.TheSave.CupCoardNumber + "柜", eOutputType.Warn); return; } else { CmcsCupCoardSaveDetail saveDetailReady = commonDAO.SelfDber.Entity <CmcsCupCoardSaveDetail>("where SampleCode like :SampleCode||'%' ", new { SampleCode = barrelCode.Substring(0, barrelCode.Length - 3) }); if (saveDetailReady != null && saveDetailReady.TheSave != null) { CurrentCupBoardNumber = saveDetailReady.TheSave.CupCoardNumber; Hardwarer.Iocer.Output(CurrentCupBoardNumber); //Thread.Sleep(1000); //if (Hardwarer.Iocer.IsOpenSuccess) //{ ShowMessage(CurrentCupBoardNumber + "号柜门已打开,请放入样品关好柜门", eOutputType.Normal); czyHandlerDAO.SaveCupBoard(CurrentCupBoardNumber, SelfVars.LoginUser.UserName, barrelCode); //} } else { CmcsCupCoardSave saveCupBoard = commonDAO.SelfDber.Entity <CmcsCupCoardSave>(" where IsUse=1 order by dbms_random.value()"); if (saveCupBoard != null) { CurrentCupBoardNumber = saveCupBoard.CupCoardNumber; Hardwarer.Iocer.Output(CurrentCupBoardNumber); //Thread.Sleep(1000); //if (Hardwarer.Iocer.IsOpenSuccess) //{ ShowMessage(CurrentCupBoardNumber + "号柜门已打开,请放入样品关好柜门", eOutputType.Normal); czyHandlerDAO.SaveCupBoard(CurrentCupBoardNumber, SelfVars.LoginUser.UserName, barrelCode); //} } } } } else { txtInputSampleCode.ResetText(); ShowMessage("制样子码:" + barrelCode + " 不存在", eOutputType.Error); } }
/// <summary> /// 重置 /// </summary> private void Restet() { this.CurrentCupCoard = null; txtInputSampleCode.ResetText(); rtxtOutputInfo.ResetText(); // 方便客户快速使用,获取焦点 txtInputSampleCode.Focus(); }
/// <summary> /// 取样 /// </summary> /// <param name="cupBoardNumber"></param> /// <param name="takeUser"></param> /// <param name="sampleCode"></param> /// <returns></returns> public bool TakeCupBoard(int cupBoardNumber, string takeUser, string sampleCode) { CmcsCupCoardSave saveBoard = CommonDAO.GetInstance().SelfDber.Entity <CmcsCupCoardSave>("where CupCoardNumber=:CupCoardNumber and IsUse=1", new { CupCoardNumber = cupBoardNumber }); if (saveBoard != null) { saveBoard.SaveCount--; saveBoard.UpdateTime = DateTime.Now; CommonDAO.GetInstance().SelfDber.Update(saveBoard); } CmcsCupCoardSaveDetail saveDetail = CommonDAO.GetInstance().SelfDber.Entity <CmcsCupCoardSaveDetail>("where SampleCode=:SampleCode and IsTake=0", new { SampleCode = sampleCode }); if (saveDetail != null) { saveDetail.TakeUser = takeUser; saveDetail.IsTake = 1; saveDetail.TakeTime = DateTime.Now; return(CommonDAO.GetInstance().SelfDber.Update(saveDetail) > 0); } return(false); }
void btnTakeCupBoard_Click(object sender, EventArgs e) { GridButtonXEditControl btn = sender as GridButtonXEditControl; if (btn == null) { return; } CmcsCupCoardSaveDetail rCMakeDetail = btn.EditorCell.GridRow.DataItem as CmcsCupCoardSaveDetail; if (rCMakeDetail == null || rCMakeDetail.TheSave == null) { return; } if (MessageBoxEx.Show("是否确定取样?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.CurrentCupCoard = rCMakeDetail; Hardwarer.Iocer.Output(rCMakeDetail.TheSave.CupCoardNumber); //Thread.Sleep(1000); //if (Hardwarer.Iocer.IsOpenSuccess) ShowMessage("取样成功,请到" + this.CurrentCupCoard.TheSave.CupCoardNumber + "号柜取样", eOutputType.Normal); } }