【U9客开总结】总结一下U9V60客开相关技术点.md

U9客开技术点总结文档

UBF

  • 继承
  • 组合
  • 状态机

BE

  • 重写单据类型属性
        public override DocType DocType
        {
            get
            {
                return this.DocumentType;
            }
        }
  • 设置默认值
        /// <summary>
        /// 设置默认值
        /// </summary>
        protected override void OnSetDefaultValue()
		{
            if (this.Org == null)
            {
                this.Org = UFIDA.U9.Base.Context.LoginOrg;
            }

            base.OnSetDefaultValue();
		}

BP

  • 查询代码包括在之内,引用 Runtime\UFSoft.UBF.AopFrame.dll
                using (BPForEngine bp = new BPForEngine())
                {
                    //...
                }

防止报异常:

  • 执行SQL语句的方法 添加引用 UFSoft.UBF.Util.DataAccess.dll、UFSoft.UBF.Sys.Database.dll
DataAccessor.RunSQL(DatabaseManager.GetCurrentConnection(),"sql", null);
  • 实体查询 XXX.Finder.Find() 带参数
var nextControlPeriod = BudgetControlPeriod.Finder.Find("BudgetYear=@BudgetYear and BudgetControlScheme=@BudgetControlScheme and Num=@Num",
                    new List<OqlParam>()
                    {
                    new OqlParam("BudgetYear", controlPeriod.BudgetYear.ID),
                    new OqlParam("BudgetControlScheme", controlPeriod.BudgetControlScheme.ID),
                    new OqlParam("Num", controlPeriod.Num + 1),
                    }.ToArray());
  • 数据会话
using (var session = Session.Open())
{
    //...

    //提交变更
    session.Commit();
}
  • 账簿上下文 引用 UFIDA.U9.UI.PDHelper.dll
PDContext.Current.PrimarySOBRef.CodeColumn;
  • 组织上下文
PDContext.Current.OrgID;

添加行记录

XXX.Lines.AddNew();

UI

AfterCreateChildControls()

  • 注册查找参照
PDFormMessage.ShowConfirmDialog(this.Page, "4540e880-7eb7-4eba-8da7-f1889b092af8", "580", "408", Title, wpFindID.ClientID, this.BtnFind, "");
  • 设置默认行号
        /// <summary>
        /// 设置表格默认行号
        /// </summary>
        /// <param name="dataGrid"></param>
        /// <param name="colName"></param>
        public static void AfterCreateChildControls_SetDefaultDocLineNo(IUFDataGrid dataGrid, string colName = "DocLineNo")
        {
            //设置默认行号
            GetProfileValueProxy bpObj = new GetProfileValueProxy();
            bpObj.ProfileCode = "SysLineNo";
            var pVTDOData = bpObj.Do();

            //行GRID
            //var colName = "DocLineNo";
            ((IAutoRowNo)dataGrid.Columns[colName]).Sequence = true;
            ((IAutoRowNo)dataGrid.Columns[colName]).SequenceStep = int.Parse(pVTDOData.ProfileValue);
            ((IAutoRowNo)dataGrid.Columns[colName]).SequenceStart = int.Parse(pVTDOData.ProfileValue);

            //this.Model.MenuAuthority.PageStrategy.IsUsing = false;
            ((UFSoft.UBF.UI.WebControlAdapter.UFWebDataGridAdapter)dataGrid).PagingStrategy = GridPagingStrategy.View;
            ((UFSoft.UBF.UI.WebControlAdapter.UFWebDataGridAdapter)dataGrid).Paging = false;
        }
  • 删除提示
            //设置“删除”时弹出的提示对话框
            string message = "确定删除当前记录?";
            PDFormMessage.ShowDelConfirmDialog(this.Page, message, "", this.BtnDelete);

AfterUIModelBinding()

  • 设置按钮权限

  • 设置弹性域
    FlexFieldHelper.SetDescFlexField(this.DataGrid8, (this.DataGrid8.Columns.Count - 1));
  • 设置行过滤条件
    ((IUFFldReferenceColumn)this.DataGrid8.Columns["ProductType"]).CustomInParams = BaseAction.Symbol_AddCustomFilter + "= ValueSetDef.Code= 'Z30'";
  • 设置card权限

  • 设置异步

  • webpart里的AfterOnLoad() || OnLoadDefault()事件获取当然状态值,传给action的方法,aciton里调用BP
this.CurrentState["XXX"]
System.Web.HttpContext.Current.Session["XXX"]
  • 页面跳转到指定ID
        public void OnLoadDefault()
        {
            var detailPage = "26210e6c-1396-43b9-a5dd-c6f389950136";
            
            if (System.Web.HttpContext.Current.Session[detailPage] != null)
            {
                var result = System.Web.HttpContext.Current.Session[detailPage].ToString();
                System.Web.HttpContext.Current.Session[detailPage] = null;

                long temp;
                if (long.TryParse(result, out temp))
                {
                    this.NavigateAction.MovePageAt(null, temp);
                }
            }
        }
  • 打开页面默认第一页 webpart
		private void OnLoadData_Extend(object sender)
		{	
			OnLoadData_DefaultImpl(sender);

            var rec = this.Model.BudgetChange.FocusedRecord;
            if (rec == null)
            {
                this.BtnFirstPage_Click(this, new EventArgs());
            }

        }

URL参数

  • 设置
NaviteParamter param = new NaviteParamter();
param.NameValues.Add("PLSID", PLSID);
NavigateManager.ShowModelWebpart(this, "a540abf0-8696-4ea8-be56-2d898ac637ae", this.TaskId.ToString(), 520, 120, param);
  • 获取 webpart里
this.NameValues["XXX"]
  • 跳转到列表 action
        private void ListClick_Extend(object sender, UIActionEventArgs e)
        {
            //List Click Code Demo...
            //this.CurrentPart.NavigatePage("TestList", null);
            //this.ListClick_DefaultImpl(sender,e) ;	

            string ListPageID = "100300e3-6d61-45b8-a5b0-22b4eb3aa866";
            this.CurrentPart.NavigatePage(ListPageID, null);


            //调用模版定义的默认实现方法.如需扩展,请直接在此编程.			
            this.ListClick_DefaultImpl(sender, e);
        }
  • 跳转到详情
string CardPageID = "26210e6c-1396-43b9-a5dd-c6f389950136";
        
        private void OnGridRowDbClick_Extend(object sender, UIActionEventArgs e)
		{
            if (this.MainView.FocusedRecord != null && this.MainView.FocusedIndex != -2)
            {
                string DataID = GetMainID().ToString();
                OnNavigatCard("Browse", DataID, CardPageID);
            }

            this.OnGridRowDbClick_DefaultImpl(sender,e);								
        }

        private void OnNavigatCard(string type, string dataID, string formID)
        {
            string FormID = formID;
            string DataID = dataID;
            if (DataID == String.Empty && type == "Browse")
            {
                return;
            }
            else
            {
                System.Collections.Specialized.NameValueCollection nameValCol = new System.Collections.Specialized.NameValueCollection();
                nameValCol.Add("PDPageStatus", type);
                nameValCol.Add("ID", DataID);
                nameValCol.Add("isFromList", "1");
                this.CommonAction.CurrentPart.NavigatePage(FormID, nameValCol);
            }
        }

        private long GetMainID()
        {
            if (this.MainView.FocusedRecord["ID"] != null)
            {
                var lineID = long.Parse(this.MainView.FocusedRecord["ID"].ToString());

                //sql 查询 根据行id查询头id
                using (BPForEngine bp = new BPForEngine())
                {
                    //UFSoft.UBF.Sys.Database.dll
                    using (IDbConnection conn = UFSoft.UBF.Sys.Database.DatabaseManager.GetCurrentConnection())
                    {
                        //UFSoft.UBF.Util.DataAccess.dll
                        IDataReader reader = null;
                        UFSoft.UBF.Util.DataAccess.DataAccessor.RunSQL(conn, 
                            @"
                            SELECT BudgetChange
                            --, * 
                            FROM Cust_BudgetChangeLine
                            WHERE id = " + lineID, null, out reader);

                        while (reader.Read())
                        {
                            if (reader[0] != null)
                            {
                                long headID;
                                if (long.TryParse(reader[0].ToString(), out headID))
                                {
                                    return headID;
                                }
                            }
                        }
                    }
                }

                return lineID;

            }
            return -1;
        }

工作流审批

  • 提交
        private void BudgetOrganizationSubmit(List<DocDTO> docDTOs, ref string rtnResult)
        {
            List<string> rtnResults = new List<string>();
            foreach (DocDTO dto in docDTOs)
            {
                var entity = BudgetOrganizationBE.BudgetOrganizationOrder.Finder.FindByID(dto.EntityID);
                if (entity != null && entity.SysVersion == dto.SysVersion)
                {
                    using (ISession session = Session.Open())
                    {
                        if (entity.DocType.ConfirmType == UFIDA.U9.Base.Doc.ConfirmTypeEnum.ComfirmWork || 
                            entity.DocType.ConfirmType == UFIDA.U9.Base.Doc.ConfirmTypeEnum.InTimeComfirm)//工作确认或即时确认
                        {
                            if (entity.Status == BudgetOrganizationBE.BudgetOrganizationOrderStatusEnum.Opened)
                            {
                                entity.Status = BudgetOrganizationBE.BudgetOrganizationOrderStatusEnum.Approving;
                            }
                        }
                        if (entity.DocType.ConfirmType == UFIDA.U9.Base.Doc.ConfirmTypeEnum.ApproveFlow)//审批流
                        {
                            if (entity.Status == BudgetOrganizationBE.BudgetOrganizationOrderStatusEnum.Opened)
                            {
                                entity.StateMachineInstance.Opened_SubmitEventDriven(new YY.U9.Cust.ZCLZ.BudgetOrganizationBE.SubmitEvent());
                            }
                        }
                        session.Commit();
                        rtnResults.Add(entity.DocNo);
                    }
                }
                else
                {
                    throw new Exception("数据已被修改,请刷新后操作");
                }
            }
            rtnResult = string.Join(",", rtnResults.ToArray());
        }
  • 审批
        private void BudgetOrganizationApprove(List<DocDTO> docDTOs, ref string rtnResult)
        {
            List<string> rtnResults = new List<string>();
            foreach (var dto in docDTOs)
            {
                var entity = BudgetOrganizationBE.BudgetOrganizationOrder.Finder.FindByID(dto.EntityID);
                if (entity != null && entity.SysVersion == dto.SysVersion)
                {
                    using (var session = Session.Open())
                    {
                        if (entity.DocType.ConfirmType == UFIDA.U9.Base.Doc.ConfirmTypeEnum.ComfirmWork || 
                            entity.DocType.ConfirmType == UFIDA.U9.Base.Doc.ConfirmTypeEnum.InTimeComfirm)//工作确认或即时确认
                        {
                            if (entity.Status == BudgetOrganizationBE.BudgetOrganizationOrderStatusEnum.Approving)
                            {
                                entity.Status = BudgetOrganizationBE.BudgetOrganizationOrderStatusEnum.Approved;
                                entity.ApprovedTime = DateTime.Now;
                            }
                        }
                        if (entity.DocType.ConfirmType == UFIDA.U9.Base.Doc.ConfirmTypeEnum.ApproveFlow)
                        {
                            entity.StateMachineInstance.Approving_ApprovedEventDriven(new BudgetOrganizationBE.ApproveEvent());
                        }
                        session.Commit();

                        SetBudgetOrganizationDefaultAmont(entity.ID);

                        rtnResults.Add(entity.DocNo);
                    }
                }
                else
                {
                    throw new Exception("数据已被修改,请刷新后操作");
                }
            }

            rtnResult = string.Join(",", rtnResults.ToArray());
        }
  • 弃审
        private void BudgetOrganizationUnApprove(List<DocDTO> docDTOs, ref string rtnResult)
        {
            List<string> rtnResults = new List<string>();
            foreach (DocDTO dto in docDTOs)
            {
                var entity = BudgetOrganizationBE.BudgetOrganizationOrder.Finder.FindByID(dto.EntityID);
                if (entity != null && entity.SysVersion == dto.SysVersion)
                {
                    using (ISession session = Session.Open())
                    {
                        if (entity.DocType.ConfirmType == UFIDA.U9.Base.Doc.ConfirmTypeEnum.ComfirmWork || 
                            entity.DocType.ConfirmType == UFIDA.U9.Base.Doc.ConfirmTypeEnum.InTimeComfirm)//工作确认或即时确认
                        {
                            if (entity.Status == BudgetOrganizationBE.BudgetOrganizationOrderStatusEnum.Approved)
                            {
                                entity.Status = BudgetOrganizationBE.BudgetOrganizationOrderStatusEnum.Opened;
                            }
                        }
                        if (entity.DocType.ConfirmType == UFIDA.U9.Base.Doc.ConfirmTypeEnum.ApproveFlow)//审批流
                        {
                            if (entity.Status == BudgetOrganizationBE.BudgetOrganizationOrderStatusEnum.Approved)
                            {
                                entity.StateMachineInstance.Approved_UnApprovedEventDriven(new UFIDA.U9.GeneralEvents.ApprovalResultEvent());
                            }
                        }
                        session.Commit();
                        rtnResults.Add(entity.DocNo);
                    }
                }
                else
                {
                    throw new Exception("数据已被修改,请刷新后操作");
                }
            }
            rtnResult = string.Join(",", rtnResults.ToArray());
        }

插件

菜单发布

补丁打包


$ node
> x = 10
10
> var y = 10
undefined
> x + y
20
> console.log("Hello World")
Hello World
undefined
> console.log("www.runoob.com")
www.runoob.com
undefined

posted @ 2020-01-06 14:19  0539  阅读(971)  评论(0编辑  收藏  举报