/// <summary> /// 生产工艺流程保存 /// </summary> /// <returns>成功返回1 失败返回-1</returns> public int SaveProcess() { Neusoft.NFC.Management.PublicTrans.BeginTransaction(); this.preparationManager.SetTrans(Neusoft.NFC.Management.PublicTrans.Trans); DateTime sysTime = this.preparationManager.GetDateTimeFromSysDateTime(); for (int i = 0; i < this.fsReport_Sheet1.Rows.Count; i++) { Neusoft.HISFC.Object.Preparation.Process p = this.GetProcessData(i); p.Oper.OperTime = sysTime; p.Oper.ID = this.preparationManager.Operator.ID; if (this.preparationManager.SetProcess(p) == -1) { Neusoft.NFC.Management.PublicTrans.RollBack(); MessageBox.Show("保存制剂工艺流程信息失败" + this.preparationManager.Err); } } Neusoft.NFC.Management.PublicTrans.Commit(); MessageBox.Show("工艺流程执行信息保存成功"); return(1); }
/// <summary> /// 获取报告单明细信息 /// </summary> /// <param name="rowIndex">行索引</param> /// <returns>成功返回报告单明细信息 失败返回null</returns> protected Neusoft.HISFC.Object.Preparation.Process GetProcessData(int row) { Neusoft.HISFC.Object.Preparation.Process process = new Neusoft.HISFC.Object.Preparation.Process(); if (this.fsReport_Sheet1.Rows[row].Tag is Neusoft.HISFC.Object.Preparation.Stencil) { Neusoft.HISFC.Object.Preparation.Stencil stencil = this.fsReport_Sheet1.Rows[row].Tag as Neusoft.HISFC.Object.Preparation.Stencil; if (stencil == null) { MessageBox.Show(Neusoft.NFC.Management.Language.Msg("获取当前选择的报告单明细信息时发生错误")); return(null); } process.Preparation = this.preparation; process.ItemType = stencil.Type.Name; process.ProcessItem = stencil.Item; } else if (this.fsReport_Sheet1.Rows[row].Tag is Neusoft.HISFC.Object.Preparation.Process) { process = this.fsReport_Sheet1.Rows[row].Tag as Neusoft.HISFC.Object.Preparation.Process; } process.ResultQty = Neusoft.NFC.Function.NConvert.ToDecimal(this.fsReport_Sheet1.Cells[row, (int)ReportColumnEnum.ColNum].Text); //实际值 process.ResultStr = this.fsReport_Sheet1.Cells[row, (int)ReportColumnEnum.ColDes].Text; process.IsEligibility = this.ConvertStringToBool(this.fsReport_Sheet1.Cells[row, (int)ReportColumnEnum.ColEli].Text); return(process); }
/// <summary> /// 删除当前已存在的报告单 /// </summary> /// <param name="rowIndex"></param> private int DelReport(int rowIndex) { if (rowIndex >= 0) { DialogResult rs = MessageBox.Show(Neusoft.NFC.Management.Language.Msg("是否确认删除该报告单明细信息"), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (rs == DialogResult.No) { return(-1); } } Neusoft.HISFC.Object.Preparation.Process tempProcess = this.GetProcessData(rowIndex); if (tempProcess != null) { if (this.preparationManager.DelProcess(tempProcess) == -1) { MessageBox.Show(Neusoft.NFC.Management.Language.Msg("删除失败") + this.preparationManager.Err); return(-1); } if (this.hsStencilReport.ContainsKey(tempProcess.ItemType + tempProcess.ProcessItem.Name)) { this.hsStencilReport.Remove(tempProcess.ItemType + tempProcess.ProcessItem.Name); } MessageBox.Show(Neusoft.NFC.Management.Language.Msg("删除成功")); } this.fsReport_Sheet1.Rows.Remove(rowIndex, 1); return(1); }
/// <summary> /// 添加报告单明细信息 /// </summary> /// <param name="p">生产工艺流程信息</param> private void AddReportData(Neusoft.HISFC.Object.Preparation.Process p) { int row = this.fsReport_Sheet1.Rows.Count; this.fsReport_Sheet1.Rows.Add(row, 1); this.fsReport_Sheet1.Cells[row, (int)ReportColumnEnum.ColType].Text = p.ItemType; this.fsReport_Sheet1.Cells[row, (int)ReportColumnEnum.ColItem].Text = p.ProcessItem.Name; this.fsReport_Sheet1.Cells[row, (int)ReportColumnEnum.ColNum].Text = p.ResultQty.ToString(); this.fsReport_Sheet1.Cells[row, (int)ReportColumnEnum.ColDes].Text = p.ResultStr; this.fsReport_Sheet1.Cells[row, (int)ReportColumnEnum.ColEli].Text = this.ConvertBoolToString(p.IsEligibility); if (p.IsEligibility) { this.fsReport_Sheet1.Rows[row].ForeColor = System.Drawing.Color.Black; } else { this.fsReport_Sheet1.Rows[row].ForeColor = System.Drawing.Color.Red; } this.fsReport_Sheet1.Rows[row].Tag = p; this.hsStencilReport.Add(p.ItemType + p.ProcessItem.Name, null); }