示例#1
0
        /// <summary>
        /// 转换流程文件实体
        /// </summary>
        /// <param name="processEntity">流程实体</param>
        /// <param name="extStorage">外部存储</param>
        /// <returns></returns>
        private ProcessFileEntity FillProcessFileEntity(ProcessEntity processEntity, IXPDLStorage extStorage = null)
        {
            //流程文件实体
            var processFileEntity = new ProcessFileEntity();

            processFileEntity.ProcessGUID     = processEntity.ProcessGUID;
            processFileEntity.ProcessName     = processEntity.ProcessName;
            processFileEntity.ProcessCode     = processEntity.ProcessCode;
            processFileEntity.Version         = processEntity.Version;
            processFileEntity.StartType       = processEntity.StartType;
            processFileEntity.StartExpression = processEntity.StartExpression;
            processFileEntity.Description     = processEntity.Description;

            if (extStorage != null)
            {
                //扩展方式读取xml文件内容
                var xmlDoc = extStorage.Read(processEntity);
                processFileEntity.XmlContent = xmlDoc.OuterXml;
            }
            else
            {
                processFileEntity.XmlContent = processEntity.XmlContent;
            }
            return(processFileEntity);
        }
示例#2
0
        // 主表删除
        protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string rmes_id = e.Values["RMES_ID"].ToString();

            //插入到日志表//20161031add
            try
            {
                string Sql1 = " SELECT * FROM data_process_file WHERE rmes_id='" + rmes_id + "'";
                dc.setTheSql(Sql1);
                string company_code   = dc.GetTable().Rows[0]["COMPANY_CODE"].ToString();
                string pline_code     = dc.GetTable().Rows[0]["PLINE_CODE"].ToString();
                string product_series = dc.GetTable().Rows[0]["PRODUCT_SERIES"].ToString();
                string process_code   = dc.GetTable().Rows[0]["PROCESS_CODE"].ToString();
                string file_name      = dc.GetTable().Rows[0]["FILE_NAME"].ToString();
                string file_url       = dc.GetTable().Rows[0]["FILE_URL"].ToString();
                string file_type      = dc.GetTable().Rows[0]["FILE_TYPE"].ToString();
                string Sql2           = " INSERT INTO DATA_PROCESS_FILE_LOG(rmes_id,company_code,pline_code,product_series,process_code,file_name,file_url,file_type,user_code,flag,rqsj)"
                                        + " VALUES( '" + rmes_id + "', '" + company_code + "','" + pline_code + "','" + product_series + "','" + process_code + "','" + file_name + "','" + file_url + "','" + file_type + "','" + theUserCode + "','DEL',SYSDATE)";
                dc.ExeSql(Sql2);
            }
            catch
            {
                return;
            }

            ProcessFileEntity detEntity = new ProcessFileEntity {
                RMES_ID = rmes_id
            };

            db.Delete(detEntity);

            queryFunction();
            e.Cancel = true;
        }
示例#3
0
        public ResponseResult <ProcessEntity> CreateProcess([FromBody] ProcessFileEntity fileEntity)
        {
            var result = ResponseResult <ProcessEntity> .Default();

            try
            {
                if (string.IsNullOrEmpty(fileEntity.ProcessName.Trim()) ||
                    string.IsNullOrEmpty(fileEntity.ProcessCode.Trim()) ||
                    string.IsNullOrEmpty(fileEntity.Version.Trim()))
                {
                    result = ResponseResult <ProcessEntity> .Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.crateprocess.warning"));

                    return(result);
                }

                //创建新流程,ProcessGUID默认赋值
                if (string.IsNullOrEmpty(fileEntity.ProcessGUID))
                {
                    fileEntity.ProcessGUID = Guid.NewGuid().ToString();
                }

                if (string.IsNullOrEmpty(fileEntity.Version))
                {
                    fileEntity.Version = "1";
                }

                //根据模板类型来创建流程
                ProcessEntity entity = null;
                if (fileEntity.TemplateType == ProcessTemplateType.Blank)
                {
                    entity = new ProcessEntity
                    {
                        ProcessGUID = fileEntity.ProcessGUID,
                        ProcessName = fileEntity.ProcessName,
                        ProcessCode = fileEntity.ProcessCode,
                        Version     = fileEntity.Version,
                        IsUsing     = fileEntity.IsUsing,
                        Description = fileEntity.Description,
                    };
                    var wfService = new WorkflowService();
                    var processID = wfService.CreateProcess(entity);
                    entity.ID = processID;
                }
                else
                {
                    //模板默认生成XML内容
                    //entity = ProcessTemplateFactory.CreateProcessByTemplateType(fileEntity);
                }
                result = ResponseResult <ProcessEntity> .Success(entity,
                                                                 LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.crateprocess.success")
                                                                 );
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <ProcessEntity> .Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.crateprocess.error", ex.Message));
            }
            return(result);
        }
示例#4
0
        /// <summary>
        /// 保存XML文件
        /// </summary>
        /// <param name="entity">实体</param>
        /// <param name="extStorage">存储</param>
        internal void SaveProcessFile(ProcessFileEntity entity, IXPDLStorage extStorage = null)
        {
            //默认数据库存储
            var session = SessionFactory.CreateSession();

            try
            {
                session.BeginTrans();

                var processEntity = GetByVersion(session.Connection, entity.ProcessGUID, entity.Version, false, session.Transaction);
                var processModel  = ProcessModelFactory.Create(session.Connection, entity.ProcessGUID, entity.Version, session.Transaction);
                if (processEntity != null)
                {
                    processEntity.XmlContent = entity.XmlContent;
                    SetProcessStartEndType(processModel, processEntity, entity.XmlContent);

                    processEntity.LastUpdatedDateTime = DateTime.Now;

                    //数据库存储
                    Repository.Update <ProcessEntity>(session.Connection, processEntity, session.Transaction);
                }
                else
                {
                    processEntity                 = new ProcessEntity();
                    processEntity.ProcessGUID     = entity.ProcessGUID;
                    processEntity.ProcessName     = entity.ProcessName;
                    processEntity.ProcessCode     = entity.ProcessCode;
                    processEntity.Version         = entity.Version;
                    processEntity.IsUsing         = entity.IsUsing;
                    processEntity.XmlContent      = entity.XmlContent;
                    processEntity.CreatedDateTime = DateTime.Now;
                    SetProcessStartEndType(processModel, processEntity, entity.XmlContent);

                    //数据库存储
                    Repository.Insert <ProcessEntity>(session.Connection, processEntity, session.Transaction);
                }

                //本地存储
                if (extStorage != null)
                {
                    var xmlDoc = new XmlDocument();
                    xmlDoc.LoadXml(entity.XmlContent);

                    extStorage.Save(processEntity.XmlFilePath, xmlDoc);
                }
                session.Commit();
            }
            catch
            {
                session.Rollback();
                throw;
            }
            finally
            {
                session.Dispose();
            }
        }
示例#5
0
        /// <summary>
        /// 保存XML文件
        /// </summary>
        /// <param name="entity">实体</param>
        /// <param name="extStorage">存储</param>
        internal void SaveProcessFile(ProcessFileEntity entity)
        {
            using (var session = DbFactory.CreateSession())
            {
                var processEntity = GetByVersion(entity.ProcessGUID, entity.Version);
                processEntity.StartType           = entity.StartType;
                processEntity.StartExpression     = entity.StartExpression;
                processEntity.XmlContent          = entity.XmlContent;
                processEntity.LastUpdatedDateTime = DateTime.Now;
                session.GetRepository <ProcessEntity>().Update(processEntity);

                session.SaveChanges();
            }
        }
示例#6
0
        /// <summary>
        /// 转换流程文件实体
        /// </summary>
        /// <param name="processEntity">流程实体</param>
        /// <returns>流程文件实体</returns>
        private ProcessFileEntity FillProcessFileEntity(ProcessEntity processEntity)
        {
            //流程文件实体
            var processFileEntity = new ProcessFileEntity();

            processFileEntity.ProcessGUID     = processEntity.ProcessGUID;
            processFileEntity.ProcessName     = processEntity.ProcessName;
            processFileEntity.Version         = processEntity.Version;
            processFileEntity.StartType       = processEntity.StartType;
            processFileEntity.StartExpression = processEntity.StartExpression;
            processFileEntity.Description     = processEntity.Description;
            processFileEntity.XmlContent      = processEntity.XmlContent;

            return(processFileEntity);
        }
示例#7
0
        protected void InitFlowXmlInfo()
        {
            String ProcessGUID = Request.QueryString["ProcessGUID"] == null ? String.Empty : Request.QueryString["ProcessGUID"].ToString();

            if (ProcessGUID != String.Empty)
            {
                IWorkflowService  wfService         = new WorkflowService();
                ProcessFileEntity processFileEntity = wfService.GetProcessFile(ProcessGUID);
                if (processFileEntity != null)
                {
                    this.txtProcessGUID.Value = processFileEntity.ProcessGUID.ToString();
                    this.wfxml.InnerHtml      = processFileEntity.XmlContent;
                }
            }
        }
示例#8
0
        public ResponseResult SaveProcessFile([FromBody] ProcessFileEntity entity)
        {
            var result = ResponseResult.Default();

            try
            {
                var wfService = new WorkflowService();
                entity.XmlContent = PaddingContentWithRightSpace(entity.XmlContent);
                wfService.SaveProcessFile(entity);

                result = ResponseResult.Success(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.saveprocessfile.success"));
            }
            catch (System.Exception ex)
            {
                result = ResponseResult.Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.saveprocessfile.error", ex.Message));
            }
            return(result);
        }
        public ResponseResult SaveProcessFile(ProcessFileEntity entity)
        {
            var result = ResponseResult.Default();

            try
            {
                var wfService = new WorkflowService();
                wfService.SaveProcessFile(entity);

                result = ResponseResult.Success();
            }
            catch (System.Exception ex)
            {
                result = ResponseResult.Error(
                    string.Format("保存流程XML文件失败!{0}", ex.Message)
                    );
            }
            return(result);
        }
示例#10
0
        /// <summary>
        /// 导入流程XML文件,并生成新流程
        /// </summary>
        /// <param name="entity">流程实体</param>
        /// <returns>新流程ID</returns>
        public int ImportProcess(ProcessEntity entity)
        {
            string xmlContent = entity.XmlContent;

            var pm        = new ProcessManager();
            var processID = pm.CreateProcess(entity);

            var fileEntity = new ProcessFileEntity
            {
                ProcessGUID = entity.ProcessGUID,
                Version     = entity.Version,
                ProcessName = entity.ProcessName,
                XmlContent  = xmlContent
            };

            pm.SaveProcessFile(fileEntity);

            return(processID);
        }
示例#11
0
        /// <summary>
        /// 保存XML文件
        /// </summary>
        /// <param name="entity">实体</param>
        /// <param name="extStorage">存储</param>
        internal void SaveProcessFile(ProcessFileEntity entity, IXPDLStorage extStorage = null)
        {
            //默认数据库存储
            var session = SessionFactory.CreateSession();

            try
            {
                session.BeginTrans();

                var processEntity = GetByVersion(entity.ProcessGUID, entity.Version);
                processEntity.StartType           = entity.StartType;
                processEntity.StartExpression     = entity.StartExpression;
                processEntity.EndType             = entity.EndType;
                processEntity.EndExpression       = entity.EndExpression;
                processEntity.XmlContent          = entity.XmlContent;
                processEntity.LastUpdatedDateTime = DateTime.Now;

                //本地存储
                if (extStorage != null)
                {
                    var xmlDoc = new XmlDocument();
                    xmlDoc.LoadXml(entity.XmlContent);

                    extStorage.Save(processEntity.XmlFilePath, xmlDoc);
                }

                //数据库存储
                Repository.Update <ProcessEntity>(session.Connection, processEntity, session.Transaction);

                session.Commit();
            }
            catch
            {
                session.Rollback();
                throw;
            }
            finally
            {
                session.Dispose();
            }
        }
示例#12
0
        public ResponseResult <ProcessEntity> CreateProcess([FromBody] ProcessFileEntity fileEntity)
        {
            var result = ResponseResult <ProcessEntity> .Default();

            try
            {
                if (string.IsNullOrEmpty(fileEntity.ProcessName.Trim()) ||
                    string.IsNullOrEmpty(fileEntity.ProcessCode.Trim()) ||
                    string.IsNullOrEmpty(fileEntity.Version.Trim()))
                {
                    result = ResponseResult <ProcessEntity> .Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.crateprocess.warning"));

                    return(result);
                }

                ProcessEntity entity = new ProcessEntity
                {
                    ProcessGUID = fileEntity.ProcessGUID,
                    ProcessName = fileEntity.ProcessName,
                    ProcessCode = fileEntity.ProcessCode,
                    Version     = fileEntity.Version,
                    IsUsing     = fileEntity.IsUsing,
                    Description = fileEntity.Description,
                };
                var wfService = new WorkflowService();
                var processID = wfService.CreateProcess(entity);
                entity.ID = processID;

                result = ResponseResult <ProcessEntity> .Success(entity,
                                                                 LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.crateprocess.success")
                                                                 );
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <ProcessEntity> .Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.crateprocess.error", ex.Message));
            }
            return(result);
        }
示例#13
0
        /// <summary>
        /// 读取流程XML文件内容
        /// </summary>
        /// <returns></returns>
        internal ProcessFileEntity GetProcessFile(string processGUID, string version)
        {
            var         processEntity = GetByVersion(processGUID, version);
            XmlDocument xmlDoc        = null;

            if (XPDLReader != null && XPDLReader.IsReadable() == true)
            {
                xmlDoc = XPDLReader.Read(processEntity);
            }
            else
            {
                xmlDoc = GetProcessXmlDocument(processEntity.XmlFilePath);
            }

            var processFileEntity = new ProcessFileEntity();

            processFileEntity.ProcessGUID = processEntity.ProcessGUID;
            processFileEntity.ProcessName = processEntity.ProcessName;
            processFileEntity.Version     = processEntity.Version;
            processFileEntity.Description = processEntity.Description;
            processFileEntity.XmlContent  = xmlDoc.OuterXml;
            return(processFileEntity);
        }
示例#14
0
        /// <summary>
        /// 读取流程XML文件内容
        /// </summary>
        /// <param name="processGUID">流程GUID</param>
        /// <param name="version">版本</param>
        /// <param name="extStorage">存储</param>
        /// <returns>流程文件实体</returns>
        internal ProcessFileEntity GetProcessFile(string processGUID, string version, IXPDLStorage extStorage = null)
        {
            var processEntity = GetByVersion(processGUID, version);

            //流程文件实体
            var processFileEntity = new ProcessFileEntity();

            processFileEntity.ProcessGUID = processEntity.ProcessGUID;
            processFileEntity.ProcessName = processEntity.ProcessName;
            processFileEntity.Version     = processEntity.Version;
            processFileEntity.Description = processEntity.Description;

            if (extStorage != null)
            {
                //扩展方式读取xml文件内容
                var xmlDoc = extStorage.Read(processEntity);
                processFileEntity.XmlContent = xmlDoc.OuterXml;
            }
            else
            {
                processFileEntity.XmlContent = processEntity.XmlContent;
            }
            return(processFileEntity);
        }
示例#15
0
        /// <summary>
        /// 保存XML文件
        /// </summary>
        /// <param name="entity"></param>
        internal void SaveProcessFile(ProcessFileEntity entity)
        {
            try
            {
                var processEntity    = (new ProcessManager()).GetByVersion(entity.ProcessGUID, entity.Version);
                var filePath         = processEntity.XmlFilePath;
                var serverPath       = ConfigHelper.GetAppSettingString("WorkflowFileServer");
                var physicalFileName = serverPath + "\\" + filePath;
                var path             = Path.GetDirectoryName(physicalFileName);

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(entity.XmlContent);
                xmlDoc.Save(physicalFileName);
            }
            catch (System.Exception ex)
            {
                throw new ApplicationException(string.Format("保存流程定义XML文件失败,错误: {0}", ex.Message));
            }
        }
示例#16
0
        public ResponseResult <ProcessEntity> CreateProcess([FromBody] ProcessFileEntity fileEntity)
        {
            var result = ResponseResult <ProcessEntity> .Default();

            try
            {
                ProcessEntity entity = null;
                //根据模板类型来创建流程
                if (fileEntity.TemplateType == ProcessTemplateType.Blank)
                {
                    entity = new ProcessEntity
                    {
                        ProcessGUID = fileEntity.ProcessGUID,
                        ProcessName = fileEntity.ProcessName,
                        ProcessCode = fileEntity.ProcessCode,
                        Version     = fileEntity.Version,
                        IsUsing     = fileEntity.IsUsing,
                        Description = fileEntity.Description,
                    };
                    var wfService = new WorkflowService();
                    var processID = wfService.CreateProcess(entity);
                    entity.ID = processID;
                }
                else
                {
                    //模板默认生成XML内容
                    entity = ProcessGraphFactory.CreateProcess(fileEntity);
                }
                result = ResponseResult <ProcessEntity> .Success(entity);
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <ProcessEntity> .Error(string.Format("创建流程记录失败,错误:{0}", ex.Message));
            }
            return(result);
        }
示例#17
0
        /// <summary>
        /// 保存流程定义的xml文件
        /// </summary>
        /// <param name="diagram"></param>
        public void SaveProcessFile(ProcessFileEntity entity)
        {
            var processModel = new ProcessModel(entity.ProcessGUID);

            processModel.SaveProcessFile(entity);
        }
示例#18
0
        /// <summary>
        /// 保存流程定义的xml文件
        /// </summary>
        /// <param name="entity">流程文件实体</param>
        public void SaveProcessFile(ProcessFileEntity entity)
        {
            var pm = new ProcessManager();

            pm.SaveProcessFile(entity, XPDLStorageFactory.CreateXPDLStorage());
        }
示例#19
0
        /// <summary>
        /// 保存流程定义的xml文件
        /// </summary>
        /// <param name="entity">流程文件实体</param>
        public void SaveProcessFile(ProcessFileEntity entity)
        {
            var pm = new ProcessManager();

            pm.SaveProcessFile(entity);
        }
示例#20
0
    protected void butConfirm_Click(object sender, EventArgs e)
    {
        try
        {
            string pline, process, flag, showName, url, pSeries;

            pline    = comboPlineCode.SelectedItem.Value.ToString();
            process  = ASPxListBoxProcess.SelectedItem.Value.ToString();
            flag     = ASPxComboFlag.SelectedItem.Value.ToString();
            showName = textFileName.Text.Trim();
            pSeries  = comboSeries.SelectedItem.Value.ToString();
            string pSeriesCode = comboSeries.SelectedItem.Text;
            //string FilePath = Server.MapPath("/") + "file\\" + flag;
            string FilePath = dc.GetValue("select INTERNAL_VALUE FROM CODE_INTERNAL WHERE COMPANY_CODE='" + theCompanyCode
                                          + "' AND INTERNAL_TYPE_CODE='PATH' AND INTERNAL_CODE='PROCESSFILEPATH'");

            string strFileName = "";
            FilePath = FilePath + "\\" + pSeriesCode + "\\";
            if (!Directory.Exists(FilePath))
            {
                Directory.CreateDirectory(FilePath);
            }
            if (fileup.HasFile)
            {
                strFileName = FilePath + System.IO.Path.GetFileName(fileup.FileName);

                try
                {
                    fileup.SaveAs(strFileName);
                }
                catch
                {
                    lblMessage.Text = "文件上传失败!";
                    return;
                }
            }

            //url = "http://10.1.33.1/file/" + flag + "/go.html?p=" + System.IO.Path.GetFileName(fileup.FileName);
            //url = "~/file/" + flag + "/go.html?p=" + System.IO.Path.GetFileName(fileup.FileName);
            //url = "~/file/" + flag + "/" + System.IO.Path.GetFileName(fileup.FileName);
            url = strFileName;
            ProcessFileEntity pf = new ProcessFileEntity();
            pf.COMPANY_CODE   = theCompanyCode;
            pf.PLINE_CODE     = pline;
            pf.PROCESS_CODE   = process;
            pf.FILE_NAME      = showName;
            pf.FILE_URL       = url;
            pf.FILE_TYPE      = flag;
            pf.PRODUCT_SERIES = pSeries;
            pf.INPUT_PERSON   = theUserId;    //20161031add
            pf.INPUT_TIME     = DateTime.Now; //20161031add

            //插入到日志表//20161031add
            try
            {
                string Sql2 = " INSERT INTO DATA_PROCESS_FILE_LOG(rmes_id,company_code,pline_code,product_series,process_code,file_name,file_url,file_type,user_code,flag,rqsj)"
                              + " VALUES( '" + pf.RMES_ID + "', '" + theCompanyCode + "','" + pline + "','" + pSeries + "','" + process + "','" + showName + "','" + url + "','" + flag + "','" + theUserCode + "','ADD',SYSDATE)";
                dc.ExeSql(Sql2);
            }
            catch
            {
                return;
            }

            //string id = db.Insert("DATA_PROCESS_FILE", "RMES_ID", pf).ToString();

            string id1 = db.Insert(pf).ToString();

            //string inSql = "insert into data_process_file(company_code,pline_code,process_code,file_name,file_url,file_type) " +
            //                   "values('" + theCompanyCode + "','" + pline + "','" + process
            //                   + "','" + showName + "','" + url + "','" + flag + "')";
            //dc.ExeSql(inSql);

            lblMessage.Text   = fileup.FileName + "上传成功!";
            textFileName.Text = "";
        }
        catch (Exception e2)
        {
            lblMessage.Text = "文件上传失败!" + e2.Message;
            return;
        }
    }