JMFUI插件案例(任务栏按钮/工具栏按钮
using System;
using UFSoft.UBF.UI.JMF.Controls;
using System.Collections.Specialized;
using UFSoft.UBF.UI.JMF.Engine.Builder;
using UFSoft.UBF.UI.JMF.Controls.Adapters;
namespace UFIDA.U9.Cust.RIBO.MO.PlugInUI
{
public class StockMendMainPlugInUI : UFSoft.UBF.UI.JMF.Forms.Extend.ExtendedPartBase
{
UFSoft.UBF.UI.JMF.Controls.UFButton BtnReSetPickList;
UFIDA.U9.MFG.MO.StockMendUI.StockMendMainUIWebPart part;
public override void AfterInit(UFSoft.UBF.UI.JMF.Interface.View.IPart Part, EventArgs args)
{
//首先调用原来的事件
base.AfterInit(Part, args);
if (Part == null)
return;
part = Part as UFIDA.U9.MFG.MO.StockMendUI.StockMendMainUIWebPart;
if (part == null)
return;
part.Model.ClearErrorMessage();
//设置按钮在容器中的位置
UFCard card = (UFCard)part.GetUFControlByName(part.TopLevelContainer, "Card0");
BtnReSetPickList = new UFSoft.UBF.UI.JMF.Controls.UFButton();
BtnReSetPickList.Text = "重算备料";
BtnReSetPickList.ID = "BtnReSetPickList";
BtnReSetPickList.Width = 120;
BtnReSetPickList.Click += BtnReSetPickList_Click;
card.Controls.Add(BtnReSetPickList);
UIJMFPlugHelper.Layout(card, BtnReSetPickList, 18, 0); //一般为从左往右按钮个数乘以2
#region //在工具栏中增加按钮
UFWebToolbarAdapter toolbar = (UFWebToolbarAdapter)part.GetUFControlByName(part.TopLevelContainer, "Toolbar2");
if (toolbar != null)
{
string guid = "AAB717CD-5F34-CD70-95D7-557E0BCBA752";
UFWebButtonAdapter btnTest = UIControlBuilder.BuilderToolbarButton
(toolbar, "True", "BtnTest", "True", "True", 35, 28, "100", "",
true, false, "8288c5a3-3b19-48d3-b139-f7018d2782ee", "8288c5a3-3b19-48d3-b139-f7018d2782ee", "33b3fcd2-a459-4e80-8ebb-1e5e7437e513");
UIControlBuilder.SetButtonAccessKey(btnTest);
btnTest.UIModel = part.Model.ElementID;
btnTest.Text = "测试";
BtnReSetPickList.Click += BtnReSetPickList_Click;
}
#endregion
}
public override void AfterRender(UFSoft.UBF.UI.JMF.Interface.View.IPart Part, EventArgs args)
{
base.AfterRender(Part, args);
//UFSoft.UBF.UI.ControlModel.IUFButton btnMOBarCodePrint = (UFSoft.UBF.UI.ControlModel.IUFButton)CommonFunction.FindControl(_part, "Card1", "btnMOBarCodePrint");
//if (_part.Model.Views["MO"].FocusedRecord != null && Convert.ToInt64(_part.Model.Views["MO"].FocusedRecord["ID"]) > 0)
//{ btnMOBarCodePrint.Enabled = true; }
//else
//{ btnMOBarCodePrint.Enabled = false; }
}
private void BtnReSetPickList_Click(object sender, EventArgs e)
{
string title = "BOM对比结果";
if (part.Model.MO.FocusedRecord == null)
return;
NameValueCollection nvc = new NameValueCollection();
nvc.Add("MO", part.Model.MO.FocusedRecord.ID.ToString());
nvc.Add("AfterMendItemMaster", part.Model.MO.FocusedRecord.ItemMaster.ToString());
nvc.Add("BeforeMendItemMaster", part.Model.MO_MOPickLists.FocusedRecord.ItemMaster.ToString());
part.ShowModalDialog("214f8ca0-e2d7-4d0d-be8b-b7679eb8dce1", title, "810", "504", part.TaskId.ToString(), nvc, false);
}
public override void BeforeDataBinding(UFSoft.UBF.UI.JMF.Interface.View.IPart Part, out bool executeDefault)
{
base.BeforeDataBinding(Part, out executeDefault);
if (Part.CurrentState["MO"] != null)
{
part.Action.NavigateAction.MovePageAt(null, long.Parse(Part.CurrentState["MO"].ToString()));
Part.CurrentState.Remove("MO");
}
}
}
}
引用dll 清单:
JMFUI插件案例(任务栏按钮/工具栏按钮
本文2024-08-20 18:02:56发表“u9cloud知识”栏目。
本文链接:https://wenku.my7c.com/article/yonyou-u9cloud-1180.html