/// <summary> /// 打开流程 /// </summary> /// <param name="para"></param> public void DoOpenFlow(AtPara para) { string fk_flow = para.GetValStrByKey("FK_Flow"); int workid = para.GetValIntByKey("WorkID"); int fk_node = para.GetValIntByKey("FK_Node"); if (WebUser.WorkID == workid && WebUser.FK_Node == fk_node) { if (MessageBox.Show("当前流程已经打开,您想重新加载吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { this.webBrowser1.GoBack(); return; } } string file = Glo.PathOfTInstall + workid + "@" + WebUser.No + ".doc"; if (File.Exists(file) == false) { try { FtpSupport.FtpConnection conn = Glo.HisFtpConn; if (conn.DirectoryExist("/DocFlow/" + fk_flow + "/" + workid)) { conn.SetCurrentDirectory("/DocFlow/" + fk_flow + "/" + workid); conn.GetFile(workid + ".doc", file, true, FileAttributes.Archive); conn.Close(); } else { throw new Exception("@没有找到文件,流程文件丢失错误。"); } } catch (Exception ex) { MessageBox.Show("@打开公文错误@技术信息:" + ex.Message + "@流程编号:" + WebUser.FK_Flow); return; } } WebUser.FK_Flow = fk_flow; WebUser.FK_Node = fk_node; WebUser.WorkID = workid; WebUser.RetrieveWFNode(WebUser.FK_Node); /*如果存在这个文件,就激活它。*/ WebUser.WriterIt(StartFlag.DoOpenFlow, fk_flow, fk_node, workid); this.OpenDoc(file, false); this.Close(); }
public void DoOpenDoc(AtPara para) { string fk_flow = para.GetValStrByKey("FK_Flow"); int workid = para.GetValIntByKey("WorkID"); int fk_node = para.GetValIntByKey("FK_Node"); string file = Glo.PathOfTInstall + workid + "@" + WebUser.No + ".doc"; if (File.Exists(file) == false) { try { FtpSupport.FtpConnection conn = Glo.HisFtpConn; if (conn.DirectoryExist("/DocFlow/" + fk_flow + "/" + workid)) { conn.SetCurrentDirectory("/DocFlow/" + fk_flow + "/" + workid); conn.GetFile(workid + ".doc", file, true, FileAttributes.Archive); conn.Close(); } else { throw new Exception("@没有找到文件,流程错误。"); } } catch (Exception ex) { MessageBox.Show("@打开公文错误@技术信息:" + ex.Message + "@流程编号:" + WebUser.FK_Flow); return; } } WebUser.FK_Flow = fk_flow; WebUser.FK_Node = fk_node; WebUser.WorkID = workid; WebUser.RetrieveWFNode(WebUser.FK_Node); /*如果存在这个文件,就激活它。*/ WebUser.WriterIt(StartFlag.DoOpenDoc, fk_flow, fk_node, workid); this.OpenDoc(file, false); this.HisRibbon1.SetState(); this.Close(); }
/// <summary> /// 按照模板生成公文 /// </summary> /// <param name="para"></param> public void DoStartFlowByTemple(AtPara para) { string fk_flow = para.GetValStrByKey("FK_Flow"); // 下载流程模板 FtpSupport.FtpConnection conn = Glo.HisFtpConn; string file = Glo.PathOfTInstall + fk_flow + "@" + DateTime.Now.ToString("MM月dd日hh时mm分ss秒") + ".doc"; try { conn.SetCurrentDirectory("/DocFlowTemplete/"); if (conn.FileExist(fk_flow + ".doc") == false) { throw new Exception("@没有为公文启动设置模板。"); } conn.GetFile(fk_flow + ".doc", file, true, FileAttributes.Archive); conn.Close(); } catch (Exception ex) { conn.Close(); file = null; MessageBox.Show("@异常信息:" + ex.Message + "\t\n@流程编号:" + WebUser.FK_Flow + "\t\n@可能的原因如下:1,设计人员没有正确的设置ftp服务器。 \t\n2,没有该流程的公文模板。"); } WebUser.WorkID = 0; WebUser.FK_Flow = fk_flow; WebUser.FK_Node = int.Parse(fk_flow + "01"); WebUser.RetrieveWFNode(WebUser.FK_Node); this.HisRibbon1.SetState(); WebUser.WriterIt(StartFlag.DoNewFlow, fk_flow, int.Parse(fk_flow + "01"), 0); this.OpenDoc(file, false); this.Close(); }