**学习资料:**链接: https://pan.baidu.com/s/13JbKSSRkSn2V6-dYX5zKFQ 提取码: p9at
页面 &__dm=true 客开插件 &Admin=true 开发者使用查看代码
插件
UI插件配置项
1.关闭热插拔
2.在configuration节点下加配置,多个在WebPartExtend节点下可以继续加ExtendedPart
<WebPartExtend>
<!--生产订单保存按钮-->
<ExtendedPart parentPartFullName="UFIDA.U9.MFG.MO.DiscreteMOUIModel.DiscreteMOMainUIFormWebPart" --对应UI页面通过FormID查询
extendedPartFullName="UFIDA.U9.Cust.HR.MES.PlugIn.DiscreteMOMainUIFormWebPart" --对应文件夹名称
extendedPartAssemblyName="UFIDA.U9.Cust.HR.MES.PlugIn.dll" /> --对应dll文件
</WebPartExtend>
UI插件文件需放在Protal下 BE插件需放在Protal/bin 下 后需批处理才能加载
BE相关-枚举添加
--同步单个枚举
declare @FN varchar(550),
@ClsID bigint,
@UID varchar(50)
select @FN='UFIDA.U9.Cust.HuaRui.ReserveBE.ClauseSetTypeEnum' --此处只需填入你要更新的枚举FullName,示例为标准产品的业务员类型枚举
select @ClsID=Local_ID,@UID=ID from UBF_MD_Class where FullName = 'UFIDA.U9.Cust.HuaRui.ReserveBE.ClauseSetTypeEnum' and ClassType=3
select @ClsID,@UID
--先删除已有的数据
delete from UBF_Sys_ExtEnumType_Trl where ID=@ClsID or ID in (select ID from ubf_sys_extenumtype where UID=@UID)
delete from ubf_sys_extenumtype where ID=@ClsID or UID=@UID
delete from UBF_Sys_ExtEnumValue_Trl where ID in (select ID from ubf_sys_extenumvalue where ExtEnumType=@ClsID or ExtEnumTypeUID=@UID)
delete from ubf_sys_extenumvalue where ExtEnumType=@ClsID or ExtEnumTypeUID=@UID
--下面为插入最新数据
insert into ubf_sys_extenumtype
select local_id as id,'20101111','YonYou','20101111','YonYou',0,fullname as code,isextend,id as uid,0
from ubf_md_class where Local_ID = @ClsID
insert into ubf_sys_extenumtype_trl
select a.local_id as id,'zh-CN',b.[displayname] as [name],b.[Description]
from ubf_md_class a
left join ubf_RES_resourcevalue b on cast(a.[iD] as varchar(50)) = cast(b.resourcename as varchar(50))
where Local_ID = @ClsID
insert into ubf_sys_extenumvalue
select a.local_id as id,'20101111','YonYou','20101111','YonYou',0,a.[Local_Class_ID] as ExtEnumType ,
a.[name] as code,a.defaultvalue as evalue,issystem,md_class_id as ExtEnumTypeUID
from ubf_md_attribute as a
inner join ubf_md_class as b on cast(a.md_class_id as varchar(50))=cast(b.id as varchar(50))
where b.Local_ID = @ClsID
insert into ubf_sys_extenumvalue_trl
select a.local_id as id,'zh-CN',c.[displayname] as [name]
from ubf_md_attribute as a
inner join ubf_md_class as b on cast(a.md_class_id as varchar(50))=cast(b.id as varchar(50))
left join ubf_RES_resourcevalue c on cast(a.[ID] as varchar(50)) = cast(c.resourcename as varchar(50))
where b.Local_ID = @ClsID
查询枚举名称:
select dbo.F_GetEnumName('YONYOU.U9.Cust.DaHua.IRDocumentTypeBE.DocStatusEnum',ir.Status,'zh-CN') as RecStatus from Cust_InitialReceipt as ir
BP相关
DECLARE @Name NVARCHAR(500);
DECLARE @FullName NVARCHAR(500);
SET @Name = N'报关单号定时获取';
SET @FullName = N'UFIDA.U9.Cust.LC.CustomsClearance.CustomsClearanceOper';
IF NOT EXISTS (SELECT * FROM dbo.UBF_JOB_NoParaRunableBPSVList WHERE FullName = @FullName)
BEGIN
INSERT INTO dbo.UBF_JOB_NoParaRunableBPSVList(ID, FullName, Memo)
SELECT NEWID(), @FullName, @Name;
END;
请求管理新增时的提交人就是BP对应创建单据的创建人。
发布BP找不到方法
需要按照顺序执行,生成代码后,先执行脚本文件在批处理,在发布dll
反编译BP调试加载不了dll问题记录
1、测试环境-补丁问题引起: BP会生成7个文件要全放,BP要先发布-bdxml文件
2、本地环境-U9工具构造BP,解决报错的所有问题,在尝试能否调试
第一次调试程序集报错问题:需要报错的dll文件放到LIBS下面重新调试就行
UI相关:
UI插件使用实体查询需要引用AOP.DLL 添加一下内容
using (BPForEngine bp = new BPForEngine())
{
using (ISession session = Session.Open())
{}
}
UI界面,加合计,UBF选中DataGrid打开属性页签吧是否累计改成true
UI界面,主FORM 自适应 修改UI后保存构造,sql脚本文件批处理,重启iis 删除菜单:加载bdxml文件,清除菜单信息
UI界面初始化,给控件赋值: ReplaceRecord record = this.Model.Replace.AddNewUIRecord();
UI界面 清除报错信息 this.Model.Clear();
UI界面 刷新数据 this.Action.NavigateAction.Refresh(null);
//数据收集
_strongPart.OnDataCollect(this);
_strongPart.IsDataBinding = true;
_strongPart.IsConsuming = true;
//清除报错信息
_strongPart.Model.ClearErrorMessage();
//弹窗跳转
_strongPart.ShowAtlasModalDialog(this.BtnFresh, "a21f9617-1a6d-45aa-b57f-e35acd19e653", "替代", "410", "370", null, nameValue, true, false, true, UFSoft.UBF.UI.IView.PartShowType.NavigateForm, true);
//调用模版提供的默认实现.--默认实现可能会调用相应的Action. 页面跳转-列表
Cust.HT.TransactionPriceList 对应页面设置的URL
this.Action.CommonAction.CurrentPart.NavigatePage("Cust.HT.TransactionPriceList", null);
UI界面底部提示自定义
this.Action.CurrentPart.ShowWindowStatus(string.Format("推送成功", 1));
UI列表初始化加载默认条件
#region 列表应用开发人员扩展代码段
private string CustomFilterOpath_Extend(string filterOpath)
{
if (!string.IsNullOrEmpty(filterOpath))
{
filterOpath += "and Name Like 'BP%'";
}
else
{
filterOpath = "Name Like 'BP%'";
}
return filterOpath;
}
#endregion
UIList点击行跳转详情页
private void OnGridRowDbClick_Extend(object sender, UIActionEventArgs e)
{
string DataID = this.CurrentModel.InspectionReminder.FocusedRecord["ID"].ToString();
OnNavigatCard("Browse", DataID, "Cust.HR.InspectionReminder");/Cust.HR.InspectionReminder 是发布时创建页面的URL
//List Grid RowDbClic Code Demo...
//string DataID = this.CurrentModel.PositionType.FocusedRecord.ID.ToString();
//string CardPageID="Test";//在这里CardPageID表示卡片的URI
//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);
this.CommonAction.CurrentPart.NavigatePage(FormID, nameValCol);
}
//throw new NotImplementedException();
}
UI发布

设置参照:后缀 - Ref
新建后再 发布对象浏览器里找到实体-拖表后-拖字段
在VS里的UI扩展类里的-AfterCreateChildControls方法中加入下面这段话
//查询按钮设置
PDFormMessage.ShowConfirmDialog(this.Page, "a4ce0ce1-7fa9-4522-a2a9-dc9dbc4a1505", "580", "408",
Title, wpFindID.ClientID, this.BtnFind, null);
其中 a4ce0ce1-7fa9-4522-a2a9-dc9dbc4a1505 这个是参照生成的.cs文件的 Form ID,替换后编译批处理就可以了。
参照多选设置
代码:使用session记录选择内容在字段内容变更时触发赋值使用
调用:
private void ConfirmButton_Click_Extend(object sender, EventArgs e)
{
//调用模版提供的默认实现.--默认实现可能会调用相应的Action.
ReturnSelectedValue();
ConfirmButton_Click_DefaultImpl(sender,e);
}
private void DataGrid_GridRowDbClicked_Extend(object sender, GridDBClickEventArgs e)
{
//调用模版提供的默认实现.--默认实现可能会调用相应的Action.
ReturnSelectedValue();
DataGrid_GridRowDbClicked_DefaultImpl(sender,e);
}
记录选择 session赋值
private void ReturnSelectedValue()
{
this.CurrentSessionState["ResultSoDoctype"] = null;
DataTable dt = new DataTable();
dt.Columns.Add("ID", typeof(long));
dt.Columns.Add("Code", typeof(string));
dt.Columns.Add("Name", typeof(string));
foreach (IUIRecord _frd in this.Model.cRef.SelectRecords)
{
DataRow dr = dt.NewRow();
dr["ID"] = _frd["ID"];
dr["Code"] = _frd["Code"];
dr["Name"] = _frd["Name"];
dt.Rows.Add(dr);
}
this.CurrentSessionState["ResultSoDoctype"] = dt;
}
UI界面使用
private void DocumentType95_TextChanged_Extend(object sender, EventArgs e)
{
//调用模版提供的默认实现.--默认实现可能会调用相应的Action.
if (DocumentType95.Value != null)
{
ShipWorkBenchHeadRecord record = this.Model.ShipWorkBenchHead.FocusedRecord;
record.DocumentType_Code = DocumentType95.Value.ToString();
record.CustomerPO = "test";
string Name = string.Empty;
this.CurrentSessionState["ischange2"] = null;
if (this.CurrentSessionState["ResultSoDoctype"] != null)//多选缓存
{
DataTable ds = new DataTable();
ds = this.CurrentSessionState["ResultSoDoctype"] as DataTable;
bool first = true;
for (int i = 0; i < ds.Rows.Count; i++)
{
DataRow dr = ds.Rows[i];
if (first)
{
Name = dr["Name"].ToString();
first = false;
}
else Name = Name + "," + dr["Name"].ToString();
}
this.CurrentSessionState["ResultSoDoctype"] = null;
this.CurrentSessionState["ischange2"] = Name;
}
else this.CurrentSessionState["ischange2"] = DocumentType95.Text;
}
this.DataBind();
this.DataCollect();
DocumentType95_TextChanged_DefaultImpl(sender, e);
}
报表相关
单元格合并:选中拖拽右键
合计:拖拽字段到对应字段下面
正式环境的U9集团开发报表,需要勾选运行时使用此链接
报表加载不出来原因:要默认勾选一个字段才会加载事件。
报表参数:有条件限制时,要把值填到下面行上并勾选常量 --值集
报表的主子表跳转:
1、首先主报表需要发布且需要有一个参数(没有的话跳转按钮显示不出来),子报表不需要
2、需要 在主报表字段上设置动作-跳转另外一个报表并设置参数

报表策略 :目的-设置报表参数的默认值

-
UFIDA.U9.Cust.LC.RptProcessStrategy.OrderCloseRateStrategy
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UFIDA.U9.SCM.Pub.ReportStrategy; using UFIDA.U9.UI.PDHelper; using UFIDA.UBF.Query.CaseModel; using UFIDA.UBF.Report.App.UI.ProcessStrategy; using UFSoft.UBF.Report.Filter; using UFSoft.UBF.Report.Filter.FilterModel; using UFSoft.UBF.Report.UI.ReportView; namespace UFIDA.U9.Cust.LC.RptProcessStrategy { public class OrderCloseRateStrategy : ReportProcessStrategy { public List<string> CellGroupNameList; public OrderCloseRateStrategy() : base() { } public OrderCloseRateStrategy(LoadReportTemplateArgs args, Case useCase) : base(args, useCase) { } protected override void ProcessFormat(bool layoutUngroup) { base.ProcessFormat(layoutUngroup); } /// <summary> /// 默认值 /// </summary> /// <param name="usercase"></param> /// <param name="caseDefine"></param> /// <returns></returns> public override CaseDefine ProcessCaseDefine(Case usercase, CaseDefine caseDefine) { caseDefine = base.ProcessCaseDefine(usercase, caseDefine); //组织赋默认值 //组织默认值 ReportStrategyHelper.SetDefaultValue( caseDefine.FilterDefines.GetObjectByName("OrgCode"), PDContext.Current.OrgRef.NameColumn, PDContext.Current.OrgID, //PDContext.Current.OrgRef.CodeColumn, enuOperatorListType.Equal); return caseDefine; } /// <summary> /// 数据校验 /// </summary> /// <param name="usercase"></param> /// <param name="caseDefine"></param> /// <returns></returns> public override string VerifyParameters(Case usercase, CaseDefine caseDefine) { string note = base.VerifyParameters(usercase, caseDefine); if (note != null) return note; return null; } } }
数据库访问参数化:
//初始化参数化对象实例
DataParamList listpara = new DataParamList();
//添加参数值,参数名称一般以@符号开头,注意数据类型要设置正确,否则可能会出现类型不正确的报错
listpara.Add(DataParamFactory.CreateInput("@param", input.ID, System.Data.DbType.Int64));
//参数与对象中的名称一致
string commandText = "SELECT DescFlexField_PrivateDescSeg4,Status,DescFlexField_PrivateDescSeg2,NoteEndDate FROM dbo.NM_RecNoteMain WHERE ID=@param";
//执行语句
DataAccessor.RunSQL(DataAccessor.GetConn(), commandText, listpara, out DataSet dataSet);
参数化存储过程调用案例
string procRec = "HR_ShipQry";
DataParamList listpara = new DataParamList();
listpara.Add(DataParamFactory.CreateInput("BeginDate", businessDTOData.BeginDate, System.Data.DbType.String));
listpara.Add(DataParamFactory.CreateInput("EndDate", businessDTOData.EndDate, System.Data.DbType.String));
listpara.Add(DataParamFactory.CreateInput("OrgID", Base.Context.LoginOrg.ID, System.Data.DbType.Int64));
var count = DataAccessor.RunSP(procRec, listpara, out ds);
报表的参数替换
@CustomersName=replace(@CustomersName,'CustomersName','Customertrl.Name')