/// <summary> /// 发起流程 /// </summary> /// <param name="para"></param> public void DoStartFlow(AtPara para) { string fk_flow = para.GetValStrByKey("FK_Flow"); string workid = para.GetValStrByKey("WorkID"); 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); if (conn.FileExist(WebUser.FK_Node + "@" + WebUser.No + ".doc")) { conn.GetFile(WebUser.FK_Node + "@" + WebUser.No + ".doc", file, true, FileAttributes.Archive); } else { file = null; } } else { file = null; } conn.Close(); } catch (Exception ex) { MessageBox.Show("@流程设计错误,没有为该流程维护公文模板。@技术信息:" + ex.Message + "@流程编号:" + WebUser.FK_Flow); return; } } WebUser.FK_Flow = fk_flow; WebUser.WorkID = int.Parse(workid); /*如果存在这个文件,就激活它。*/ WebUser.WriterIt(StartFlag.DoNewFlow, fk_flow, int.Parse(fk_flow + "01"), int.Parse(workid)); this.OpenDoc(file, false); 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(); }