1.构造UI项目后,打开生成的UI项目代码,在Model文件下,如初始化一些字段的值
2.订单明细行中行号设置、订单基本操作按钮提示
UFIDA.U9.Base.BaseBP.Agent.dll(代理)
UFIDA.U9.Base.BaseBP.Deploy.dll(实现弱类型)
该dll在Portal\ApplicationServer\Libs目录下,因UI是通过代理去调用,且只能用弱类型去实现
3.枚举值,如单据状态枚举值可能会出现显示出来没有值须运行以下一段sql,而代码中的:Homa.test.ch01.GiftDocStatusBE.GiftDocStatusEnum,即如下图所示的单据类型BE枚举值的全名
declare @now datetime
set @now=getdate()
--同步单个枚举
declare @FN varchar(550), @ClsID bigint, @UID varchar(50) select @FN='Homa.test.ch01.GiftDocStatusBE.GiftDocStatusEnum'
--此处只需填入你要更新的枚举FullName,示例为标准产品的业务员类型枚举
select @ClsID=Local_ID,@UID=ID from UBF_MD_Class where FullName = 'Homa.test.ch01.GiftDocStatusBE.GiftDocStatusEnum' 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,@now,'admin',@now,'admin',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,@now,'admin',@now,'admin',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
4.查找参照代码中引用,如下图所示:
5.WebPart代码如下:
public void AfterOnLoad()
{
string paramWhere = null;
//查询
PDFormMessage.ShowConfirmDialog(this.Page, "c26b593b-0d17-4986-a814-bb32cfdbc046", "", "", Title, wpFindID.ClientID, this.BtnFind, paramWhere); FlexFieldHelper.SetDescFlexField(new DescFlexFieldParameter[] { new DescFlexFieldParameter(this.FlexFieldPicker0, this.Model.HomaGiftDoc) });
FlexFieldHelper.SetDescFlexField(new DescFlexFieldParameter[] { new DescFlexFieldParameter(this.DataGrid8, this.DataGrid8.Columns.Count - , "DescFlexField") });
//开启个性化
// UFIDA.U9.UI.PDHelper.PersonalizationHelper.SetPersonalizationEnable((BaseWebForm)this, true);
//取得提示信息资源:是否删除当前记录
string message = PDResource.GetDeleteConfirmInfo(); //绑定注册弹出对话框到删除按钮
PDFormMessage.ShowConfirmDialog(this.Page, message, "", this.BtnDelete);
PDFormMessage.ShowConfirmDialog(this.Page, "确认放弃当前记录?", "", this.BtnCancel); //引入命名空间:
//UFIDA.U9.Base.BaseBP.Agent.dll(代理)
//UFIDA.U9.Base.BaseBP.Deploy.dll(弱类型数据) //设置默认行号
GetProfileValueProxy bpObj = new GetProfileValueProxy();
bpObj.ProfileCode = "SysLineNo";
PVDTOData pVTDOData = bpObj.Do();
//行GRID
((IAutoRowNo)this.DataGrid8.Columns["RowNo"]).Sequence = true;
((IAutoRowNo)this.DataGrid8.Columns["RowNo"]).SequenceStep = Int32.Parse(pVTDOData.ProfileValue);
((IAutoRowNo)this.DataGrid8.Columns["RowNo"]).SequenceStart = Int32.Parse(pVTDOData.ProfileValue);
} public void AfterUIModelBinding()
{
//设置单据状态只读
((UFSoft.UBF.UI.ControlModel.IUIFieldBindingDataBindControl)this.GiftDocStatus150).ReadOnly = true; //设置行号不可编辑
this.DataGrid8.Columns["RowNo"].Enabled = false; DisableBtn();
} /// <summary>
/// 控制按钮显示
/// </summary>
private void DisableBtn()
{
if (UFIDA.U9.UI.PDHelper.NavigateManager.IsModelPopup(this) || UFIDA.U9.UI.PDHelper.NavigateManager.IsTitleLink(this))
{
//this.BtnOk.Visible = true;
//this.BtnClose.Visible = true;
this.BtnList.Enabled = false;
}
else
{
//this.BtnOk.Visible = false;
//this.BtnClose.Visible = false;
this.BtnList.Enabled = true;
}
//没有数据时
if (this.Model.HomaGiftDoc.FocusedRecord.ID < 0L)
{
this.BtnApprove.Enabled = false;
this.BtnUndoApprove.Enabled = false;
this.BtnSubmit.Enabled = false;
this.BtnDelete.Enabled = false;
this.BtnCopy.Enabled = false;
}
else
{
//据单据状态控制按钮
switch (this.Model.HomaGiftDoc.FocusedRecord.GiftDocStatus)
{
case : //开立
this.BtnApprove.Enabled = false;
this.BtnUndoApprove.Enabled = false;
this.BtnSubmit.Enabled = true;
this.BtnDelete.Enabled = false;
break;
case : //核准中
this.BtnApprove.Enabled = true;
this.BtnUndoApprove.Enabled = true;
this.BtnSubmit.Enabled = false;
this.BtnDelete.Enabled = true;
break;
case : //已核准
this.BtnApprove.Enabled = false;
this.BtnUndoApprove.Enabled = false;
this.BtnSubmit.Enabled = false;
this.BtnDelete.Enabled = false;
break;
}
}
}
WebPart代码
6.审核操作代码如下,代码写在Action文件下,须先引入单据状态实体弱类型数据dll,即:Homa.test.ch01.GiftDocStatusBE.Deploy.dll
/// <summary>
/// 列表
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ListClick_Extend(object sender, UIActionEventArgs e)
{
//List Click Code Demo...
this.CurrentPart.NavigatePage("440a2758-90f7-4281-a672-84c20d39ebfcListURL", null);
//this.ListClick_DefaultImpl(sender,e) ; //调用模版定义的默认实现方法.如需扩展,请直接在此编程.
this.ListClick_DefaultImpl(sender, e);
} /// <summary>
/// 提交
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SubmitClick_Extend(object sender, UIActionEventArgs e)
{
DoApprove(Homa.test.ch01.GiftDocStatusBE.GiftDocStatusEnumData.Approving);
//调用模版定义的默认实现方法.如需扩展,请直接在此编程.
this.SubmitClick_DefaultImpl(sender, e);
} /// <summary>
/// 审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ApproveClick_Extend(object sender, UIActionEventArgs e)
{
DoApprove(Homa.test.ch01.GiftDocStatusBE.GiftDocStatusEnumData.Approved);
//调用模版定义的默认实现方法.如需扩展,请直接在此编程.
this.ApproveClick_DefaultImpl(sender, e);
} /// <summary>
/// 弃审
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UnApproved_Extend(object sender, UIActionEventArgs e)
{
DoApprove(Homa.test.ch01.GiftDocStatusBE.GiftDocStatusEnumData.OpenL);
//调用模版定义的默认实现方法.如需扩展,请直接在此编程.
this.UnApproved_DefaultImpl(sender, e);
} /// <summary>
/// 审核操作
/// </summary>
/// <param name="docStatus">须引入单据状态BE弱类型数据dll,即:Homa.test.ch01.GiftDocStatusBE.Deploy.dll</param>
private void DoApprove(Homa.test.ch01.GiftDocStatusBE.GiftDocStatusEnumData docStatus)
{
//查找到当前BE记录行
HomaGiftDocRecord focusedRecord = this.CurrentModel.HomaGiftDoc.FocusedRecord;
if (focusedRecord == null) return;
this.CurrentModel.ClearErrorMessage(); //取得当前记录单据状态
int? oldState = focusedRecord.GiftDocStatus; //保存单据状态
focusedRecord.GiftDocStatus = Convert.ToInt32(docStatus);
this.CommonAction.Save(); if (!this.CurrentModel.ErrorMessage.hasErrorMessage)
this.NavigateAction.Refresh(null);//保存成功
else
focusedRecord.GiftDocStatus = oldState;//保存失败
}
Action中审批代码
至此单据的基本功能开发完毕