private void tsbBack_Click(object sender, EventArgs e) { try { if (dataGridView1.DataSource == null || dataGridView1.SelectedRows.Count <= 0) { MessageBox.Show("请选择需要回退到的报告签名。", "提示"); return; } if (_reportData.签名信息 == null || _reportData.签名信息.签名明细.Count <= 0) { MessageBox.Show("报告尚未进行签名,不能进行回退处理。", "提示"); return; } if (_reportData.状态信息.是否已完结) { MessageBox.Show("报告已完结,不能进行回退处理。", "提示"); return; } JReportSignInfo signInfo = _reportData.签名信息; JReportSignItem signLast = signInfo.签名明细[signInfo.签名明细.Count - 1]; if (signLast.用户名称 != _userData.Name) { if (_userData.Level < signLast.用户级别) { MessageBox.Show("报告最后已由 [" + signLast.用户名称 + "] 处理,无权进行回退。", "提示"); return; } if (_userData.Level == signLast.用户级别) { if (!(_reportPars.EqualAdutingLevel > -1 && _userData.Level >= _reportPars.EqualAdutingLevel)) { MessageBox.Show("报告最后已由 [" + signLast.用户名称 + "] 处理,无权进行回退。", "提示"); return; } } } DataGridViewRow dvr = dataGridView1.SelectedRows[0]; string signKey = dvr.Cells["Key"].Value.ToString(); int backIndex = signInfo.签名明细.FindIndex(T => T.Key == signKey); if (backIndex < 0) { MessageBox.Show("未找到对应签名信息,不能进行回退。", "提示"); return; } JReportSignItem signback = signInfo.签名明细[backIndex]; if (signback == null) { MessageBox.Show("当前所选签名无效,不能进行回退。", "提示"); return; } if (CheckStateChange(_reportData) == false) { return; } string reason = ""; using (frmReason backReason = new frmReason()) { reason = backReason.ShowReason(this); } if (string.IsNullOrEmpty(reason)) { return; } //报告回退处理 _reportData.状态信息.签名状态 = signback.签名时状态; _reportData.状态信息.最后更新时间 = _reportModel.GetServerDate(); _reportData.报告信息.最后审签人 = ""; _reportData.报告信息.最后审签时间 = default(DateTime); JReportBackItem backItem = new JReportBackItem(); backItem.回退人 = _userData.Name; backItem.回退原因 = reason; backItem.回退时间 = _reportModel.GetServerDate(); backItem.终签状态 = signLast.CloneTo(); _reportData.回退信息.回退明细.Add(backItem); //配置回退签名后的报告 if (backIndex > 0) { JReportSignItem signNext = signInfo.签名明细[backIndex - 1]; if (string.IsNullOrEmpty(signNext.签名报告) == false) { previewControl1.ImportByXml(signNext.签名报告); } else { //获取上次签名的内容 for (int i = backIndex - 1; i >= 0; i--) { JReportSignItem signItem = signInfo.签名明细[backIndex]; if (string.IsNullOrEmpty(signItem.签名报告)) { continue; } previewControl1.ImportByXml(signItem.签名报告); break; } } } else { previewControl1.ImportByXml(signback.签名报告); } previewControl1.ReadOnly = true; for (int i = signInfo.签名明细.Count - 1; i >= backIndex; i--) { signInfo.签名明细.RemoveAt(i); } //调整审核签名状态 int auditCount = ReportPublic.GetAuditingCount(_reportData); if (auditCount > 0) { //写入最后审核人 _reportData.报告信息.最后审签人 = signInfo.签名明细[signInfo.签名明细.Count - 1].用户名称; _reportData.报告信息.最后审签时间 = signInfo.签名明细[signInfo.签名明细.Count - 1].签名时间; } if (auditCount < 3) { previewControl1.SetItemValue(SignElementNameDefine.级审签, ""); previewControl1.setImage("[图片]" + SignElementNameDefine.级审签, null, new Size(0, 0)); previewControl1.SetItemReMark(SignElementNameDefine.级审签, ""); previewControl1.SetItemReMark("[图片]" + SignElementNameDefine.级审签, ""); } if (auditCount < 2) { previewControl1.SetItemValue(SignElementNameDefine.二级审签, ""); previewControl1.setImage("[图片]" + SignElementNameDefine.二级审签, null, new Size(0, 0)); previewControl1.SetItemReMark(SignElementNameDefine.二级审签, ""); previewControl1.SetItemReMark("[图片]" + SignElementNameDefine.二级审签, ""); } if (auditCount < 1) { previewControl1.SetItemValue(SignElementNameDefine.一级审签, ""); previewControl1.setImage("[图片]" + SignElementNameDefine.一级审签, null, new Size(0, 0)); previewControl1.SetItemReMark(SignElementNameDefine.一级审签, ""); previewControl1.SetItemReMark("[图片]" + SignElementNameDefine.一级审签, ""); } if (signInfo.签名明细.Count <= 0) { previewControl1.SetItemValue(SignElementNameDefine.记录签名, ""); previewControl1.setImage("[图片]" + SignElementNameDefine.记录签名, null, new Size(0, 0)); previewControl1.SetItemReMark(SignElementNameDefine.记录签名, ""); previewControl1.SetItemReMark("[图片]" + SignElementNameDefine.记录签名, ""); previewControl1.SetItemValue(SignElementNameDefine.诊断签名, ""); previewControl1.setImage("[图片]" + SignElementNameDefine.诊断签名, null, new Size(0, 0)); previewControl1.SetItemReMark(SignElementNameDefine.诊断签名, ""); previewControl1.SetItemReMark("[图片]" + SignElementNameDefine.诊断签名, ""); _reportData.报告信息.报告医生 = ""; _reportData.报告信息.报告时间 = default(DateTime); } _reportData.报告信息.报告内容 = previewControl1.ExportXmlf(); _reportData.报告信息.CopyBasePro(_reportData); _reportModel.BackReportSign(_reportData); _IsOk = true; LoadSignInfo(); } catch (Exception ex) { MsgBox.ShowException(ex, this); } }