UI插件开发-JMF页面的插件开发

栏目:u9cloud知识作者:用友来源:用友发布:2024-08-20浏览:1

UI插件开发-JMF页面的插件开发

JMF框架

JMF框架为U9C早期推出的一套UI设计框架,部分产品模块使用的是新框架开发的,因为UI引擎和控件体系上的差异,JMF的UI插件和老版本的UI插件不能混用,需要为JMF的UI开发单独的插件。(注:新框架跟老框架只在UI部分存在差异,因此也只有UI插件部分不一样,BE,BP,SV插件不区分

在JMF的UI插件中,应该使用JMF下的对应的FormProcess、ActionProcess、Control和ControlAssociation的版本。

雷同,JMF插件需要从UFSoft.UBF.UI.JMF.Forms.Extend.ExtendedPartBase派生。

配置说明

1. WEB.CONFIG 增加配置结,才可以支持JMF的插件。--注:2013.12月份UBF补丁之后已增加此配置
 

2. 更改配置文件 JMFWebPartExtend.config  依照其他页面的扩展配置文件增加内容: 例:


 

实例

示例1:JMF UI插件给ToolBar增加按钮

由于界面是jmf界面,那么界面上的所有控件都必须是jmf的,引用的dll也要是jmf的dll。

在常规UI插件中,添加引用 都在( ../UBFStudio/Runtime/)

UFSoft.UBF.UI.JMF.Base

UFSoft.UBF.UI.JMF.Controls.Adapters

UFSoft.UBF.UI.JMF.Controls.BaseControls

UFSoft.UBF.UI.JMF.Engine

UFSoft.UBF.UI.JMF.Forms.FormProcess

UFSoft.UBF.UI.MVC

具体代码跟 常规ui插件代码类似,只有加粗部分是不同的,

public class Pub_ParamConfigExtend : UFSoft.UBF.UI.JMF.Forms.Extend.ExtendedPartBase

    {

        UFSoft.UBF.UI.JMF.Controls.UFButton btnAddCheck;

        public UFIDA.U9.CBO.ParaConfig.ParaConfigItemIssueModel.ParaConfigItemIssueMainFormWebPart _part;

        public override void AfterInit(UFSoft.UBF.UI.JMF.Interface.View.IPart Part, EventArgs args)

        {

            if (Part == null)

                return;

            _part = Part as ParaConfigItemIssueMainFormWebPart;

            _part.Model.ClearErrorMessage();

            //增加约束按钮

            btnAddCheck = new UFWebButtonAdapter();

            UFToolbar _Toolbar = (UFToolbar)Part.GetUFControlByName(Part.TopLevelContainer, "Toolbar2");

            UFSoft.UBF.UI.ControlModel.IUFToolbar toobar = null;

            //UFSoft.UBF.UI.JMF.Controls.UFToolbar

            //UFSoft.UBF.UI.Engine.Builder.UIControlBuilder.BuilderToolbarButton(toobar, "True", "btnAddCheck", "True", "True", 45, 28, "7", "", true, false, "36BA88E0-FC28-402e-B9BA-3745A6771687", "36BA88E0-FC28-402e-B9BA-3745A6771687", "9307E981-85AA-4f19-ADB7-340D159F4A01");

            btnAddCheck = UFSoft.UBF.UI.JMF.Engine.Builder.UIControlBuilder.BuilderToolbarButton(_Toolbar as UFSoft.UBF.UI.JMF.Interface.View.IUFContainer, "True", "btnAddCheck", "True", "True", 45, 28, "7", "", true, false, "36BA88E0-FC28-402e-B9BA-3745A6771687", "36BA88E0-FC28-402e-B9BA-3745A6771687", "9307E981-85AA-4f19-ADB7-340D159F4A01");

            UFSoft.UBF.UI.JMF.Engine.Builder.UIControlBuilder.SetButtonAccessKey(btnAddCheck);

            btnAddCheck.ID = "btnBatchMO";

            btnAddCheck.Text = "约束条件";

            //((UFWebToolbarAdapter)_Toolbar).Items.Add(btnBatchMO as System.Web.UI.WebControls.WebControl);

            ((UFWebToolbarAdapter)_Toolbar).Controls.Add(btnAddCheck as System.Web.UI.WebControls.WebControl);

            btnAddCheck.Click += new EventHandler((X, Y) =>

            {

                if (_part.Model.ItemIssue.FocusedRecord == null)

                {

                    return;

                }

                #region  生成单据之后弹出

                System.Collections.Specialized.NameValueCollection nameValcol = new System.Collections.Specialized.NameValueCollection();

                nameValcol.Add("PDPageStatus", "Browse");

                nameValcol.Add("ID", _part.Model.ItemIssue.FocusedRecord.ID.ToString());

                _part.ShowModalDialog("44a1a46c-43f5-4d2a-843e-f97f6aef99ee", "约束条件", "930", "515", "", nameValcol, false, false, true);

                #endregion

            });

            base.AfterInit(Part, args);

        }

    }

配置:

1。在portal查找是有 JMFWebPartExtend.config此文件

2. 没有就添加,有的话就在里面配置 如下:

 

示例2:成品入库(JMF)下发增加按钮

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UFSoft.UBF.UI.WebControlAdapter;
using UFSoft.UBF.UI.ControlModel;
using UFSoft.UBF.UI.MD.Runtime;
using UFSoft.UBF.UI.Engine.Builder;
using System.Data;
using UFSoft.UBF.Util.DataAccess;
using UFSoft.UBF.Sys.Database;
using UFSoft.UBF.UI.JMF.Forms.FormProcess;
using UFSoft.UBF.UI.JMF.Interface.View;
using UFSoft.UBF.UI.JMF.Engine.Builder;
using UFSoft.UBF.UI.JMF.Controls.Adapters;
using UFSoft.UBF.UI.JMF.ActionProcess;
using UFSoft.UBF.UI.JMF.Controls;
using UFSoft.UBF.ExportService.JMF;
using UIFDA.U9.Cust.ZS.XSS.RcvAllotBP;
using System.Collections.Specialized;
using System.Collections;
using UFIDA.U9.MFG.Complete.CompleteApplyRpt.RcvRptUI;

namespace UFIDA.U9.Cust.ZS.XSS.PlugUI
{
   public class RptWebPartExtend : UFSoft.UBF.UI.JMF.Forms.Extend.ExtendedPartBase
   {
       private UFIDA.U9.MFG.Complete.CompleteApplyRpt.RcvRptUI.RcvRptMainUIFormWebPart part;
       //IUFMenu BtnBinAllot = null;
       public UFSoft.UBF.UI.JMF.Controls.UFButton BtnBinAllot = new UFSoft.UBF.UI.JMF.Controls.Adapters.UFWebButtonAdapter();
       public UFSoft.UBF.UI.JMF.Controls.UFButton BtnBack = new UFSoft.UBF.UI.JMF.Controls.Adapters.UFWebButtonAdapter();
       IUFMenu BtnBack1 = null;
       //配置文件XX.config文件拷贝到portal下,dll文件放置到portal/UILib下
       //配置文件以WebPartExtend开头
       public override void AfterInit(IPart Part, EventArgs args)
       {
           //首先调用原来的事件
           base.AfterInit(Part, args);
           part = Part as UFIDA.U9.MFG.Complete.CompleteApplyRpt.RcvRptUI.RcvRptMainUIFormWebPart;

           if (part == null)
               return;

           //设置按钮在容器中的位置

           BtnBinAllot.Text = "库位分配";
           //BtnBinAllot.Width = 180;
           BtnBinAllot.ID = "BtnBinAllot";
           //BtnPickListOutWh.AutoPostBack = true;


           UFSoft.UBF.UI.JMF.Controls.UFCard card = (UFSoft.UBF.UI.JMF.Controls.UFCard)part.GetUFControlByName(part.TopLevelContainer, "Card0");
           card.Controls.Add(BtnBinAllot as System.Web.UI.WebControls.WebControl);
           UIJMFPlugHelper.Layout(card, BtnBinAllot, 10, 0);
           BtnBinAllot.Click += new EventHandler(BtnBinAllot_Click);

           BtnBack.Text = "回调按钮";
           BtnBack.ID = "BtnBack";
           BtnBack.Visible = false;

           card.Controls.Add(BtnBack as System.Web.UI.WebControls.WebControl);
           UIJMFPlugHelper.Layout(card, BtnBack, 18, 0);
           BtnBack.Click += new EventHandler(BtnBack_Click);
       }
       ///
       /// 回调按钮
       ///
       private void BtnBack_Click(object sender, EventArgs e)
       {
           if (part.CurrentSessionState["CustAllotRcv"] != null)
           {
              // part.Action.NavigateAction.Refresh(null);
               part.Action.NavigateAction.MovePageAt(null, part.Model.RcvRptDoc.FocusedRecord.ID);
               part.CurrentSessionState["CustAllotRcv"] = null;
           }
       }

 

       private void BtnBinAllot_Click(object sender, EventArgs e)
       {
           part.Model.ClearErrorMessage();
           if (part.Model.RcvRptDoc.FocusedRecord != null && part.Model.RcvRptDoc.FocusedRecord.ID > 0)
           {
               NameValueCollection param = new NameValueCollection();
               param.Add("RptID", part.Model.RcvRptDoc.FocusedRecord.ID.ToString());
               List listDTO = GetDTOList();
               part.CurrentSessionState["RptBinAllot"] = listDTO;
               part.ShowModalDialog("19c8f16c-c871-4fd7-a3a8-2b58574ebf94", "库位分配", "776", "376", "", null, true);
               //part.(BtnBack, "19c8f16c-c871-4fd7-a3a8-2b58574ebf94", "库位分配", "776", "376", part.TaskId.ToString(), param, false, false, false);
           }
           
       }

       public override void AfterRender(IPart Part, EventArgs args)
       {
           if (part.Model.RcvRptDoc.FocusedRecord != null && part.Model.RcvRptDoc.FocusedRecord.DocState == 2)
           {
               this.BtnBinAllot.Enabled = false;
           }
           else
           {
               this.BtnBinAllot.Enabled = true;
           }
           if (part.CurrentSessionState["CustAllotRcv"] != null)
           {
               //part.Action.NavigateAction.MovePageAt(null, part.Model.RcvRptDoc.FocusedRecord.ID);
               //part.Action.NavigateAction.Refresh(null);
               long id = part.Model.RcvRptDoc.FocusedRecord.ID;
               part.Model.RcvRptDoc.Clear();
               part.Model.RcvRptDocLine.Clear();
               part.Model.RcvRptDoc.CurrentFilter.OPath = "ID = " + id + "";
               part.Action.CommonAction.Load(part.Model.RcvRptDoc, part.Model.RcvRptDocLine);
               part.CurrentSessionState["CustAllotRcv"] = null;
           }
           base.AfterRender(Part, args);
       }

       private List GetDTOList()
       {
           Hashtable hs = new Hashtable();//料品id为key,value为List
           int lineNum = 0;
           foreach (RcvRptDocLineRecord line in part.Model.RcvRptDocLine.Records)
           {
               if (!line.Wh_IsBin)
                   continue;
               if(line.Wh <=0)
               {
                   part.Model.ErrorMessage.Message = "行"+line.LineNum+"未录入存储地点!";
                   return null;
               }
               lineNum++;
               if (hs.Contains(line.Item))
               {
                   ItemLineGroupDTO itemGroupDTO = (ItemLineGroupDTO)hs[line.Item];
                   itemGroupDTO.Qty += line.RcvQtyByProductUOM??0;

               }
               else
               {
                   ItemLineGroupDTO itemGroupDTO = SetValue(line, lineNum);
                   hs.Add(line.Item, itemGroupDTO);
               }
           }
           List resultList = new List();
           foreach (ItemLineGroupDTO dto in hs.Values)
           {
               resultList.Add(dto);
           }
           return resultList;
       }
       private ItemLineGroupDTO SetValue(RcvRptDocLineRecord line, int lineNum)
       {
           ItemLineGroupDTO itemGroupDTO = new ItemLineGroupDTO();
           itemGroupDTO.Rpt = line.RcvRptDoc;
           itemGroupDTO.LineNum = lineNum;
           itemGroupDTO.Item = line.Item;
           itemGroupDTO.Item_Code = line.Item_Code;
           itemGroupDTO.Item_Name = line.Item_Name;
           itemGroupDTO.SPECS = line.Item_SPECS;
           itemGroupDTO.Qty = line.RcvQtyByProductUOM ?? 0;
           itemGroupDTO.Uom = line.ProductUOM??0;
           itemGroupDTO.Uom_Code = line.ProductUOM_Code;
           itemGroupDTO.Uom_Name = line.ProductUOM_Name;
           itemGroupDTO.UOM_Precision = line.ProductUOM_Round_Precision;
           itemGroupDTO.UOM_RoundType = line.ProductUOM_Round_RoundType;
           itemGroupDTO.UOM_RoundValue = line.ProductUOM_Round_RoundValue ?? 0;
           itemGroupDTO.Wh = line.Wh??0;
           itemGroupDTO.Wh_Code = line.Wh_Code;
           itemGroupDTO.Wh_Name = line.Wh_Name;

           return itemGroupDTO;
       }
   }
}
 

附:JMF UI插件布局公共方法类 UIJMFPlugHelper.cs

using System;
using System.Collections.Generic;
using System.Text;
using UFSoft.UBF.UI.ControlModel;
using System.Web.UI.WebControls;
using UFSoft.UBF.UI.IView;
using System.Web.UI;
using UFSoft.UBF.UI.JMF.Controls;
using System.ComponentModel;

 

namespace UFIDA.U9.Cust.ZS.XSS.PlugInUI
{
   class UIJMFPlugHelper
   {
       ///


       /// 设置控件在卡片容器中的布局
       ///
       /// 卡片容器
       /// 增加的控件
       /// 布局横坐标
       /// 布局纵坐标
       public static void Layout(UFSoft.UBF.UI.JMF.Controls.UFCard container, UFSoft.UBF.UI.JMF.Controls.UFButton ctrl, uint x, uint y)
       {
           
           Layout(container, ctrl, x, y, 1, 1, Unit.Pixel(0), Unit.Pixel(0), true);
       }

 

       ///


       /// 设置控件在卡片容器中的布局
       ///
       /// 卡片容器
       /// 增加的控件
       /// 布局横坐标
       /// 布局纵坐标
       /// 控件宽
       /// 控件高
       public static void Layout(UFSoft.UBF.UI.JMF.Controls.UFCard container, UFSoft.UBF.UI.JMF.Controls.UFButton ctrl, uint x, uint y, int width, int height)
       {
           Layout(container, ctrl, x, y, 1, 1, Unit.Pixel(width), Unit.Pixel(height), false);
       }

 

       ///


       /// 设置控件在卡片容器中的布局
       ///
       /// 卡片容器
       /// 增加的控件
       /// 布局横坐标
       /// 布局纵坐标
       /// 单元格横向跨度
       /// 单元格纵向跨度
       /// 控件宽
       /// 控件高
       /// 是否自适应大小
       public static void Layout(UFSoft.UBF.UI.JMF.Controls.UFCard container, UFSoft.UBF.UI.JMF.Controls.UFButton ctrl, uint x, uint y, int xspan, int yspan,
           Unit width, Unit height, bool isAutoSize)
       {
           UFSoft.UBF.UI.JMF.Controls.GridLayout gl = container.Layout as UFSoft.UBF.UI.JMF.Controls.GridLayout;
           if (gl == null) return;
           UFSoft.UBF.UI.JMF.Controls.GridLayoutInfo glInfo = new UFSoft.UBF.UI.JMF.Controls.GridLayoutInfo((uint)x, (uint)y, (uint)xspan, (uint)yspan, width, height);
           glInfo.AutoSize = isAutoSize;
           gl.Controls.Add((Control)ctrl, glInfo);

 

       }
   }
}
 

UI插件开发-JMF页面的插件开发

JMF框架JMF框架为U9C早期推出的一套UI设计框架,部分产品模块使用的是新框架开发的,因为UI引擎和控件体系上的差异,JMF的UI插件和老版本的...
点击下载文档
标签: # U9C
分享:
上一篇:查询开发框架下一篇:列表开发框架
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息