我正在将旧版本(6.1)升级到2019 R1(19.100.0022),旧代码段给了我一个我听不懂的错误。这是相关的代码-这是一个属性:
[ActiveProjectTask(typeof(EPExpenseClaimSummary.projectID), BatchModule.EP, DisplayName = "Project Task")]
[PXDefault]
public virtual int? TaskID
{
问题在于'BatchModule.EP'参数似乎存在问题。这是我得到的错误:
ProjectTaskAttribute does not support the given module.
Parameter name: Module
Actual value was EP.
堆栈跟踪如下:
[ArgumentOutOfRangeException: ProjectTaskAttribute does not support the given module.
Parameter name: Module
Actual value was EP.]
PX.Data.PXGraph.CreateInstance(Type graphType, String prefix) +1017
PX.Web.UI.PXBaseDataSource.f(Type A_0) +560
PX.Web.UI.PXBaseDataSource.g(Type A_0) +195
PX.Web.UI.PXBaseDataSource.get_DataGraph() +396
User_PageTitle.InitAuditMenu() +591
User_PageTitle.Page_InitComplete(Object sender, EventArgs e) +71
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.OnInitComplete(EventArgs e) +141
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2203
有人知道这里发生了什么吗?
答案 0 :(得分:0)
我找不到相关的发行说明,但几乎可以肯定,这是较新版本引入的重大更改。在这种情况下,只允许使用BatchModule.EA
,出于所有实际目的,它似乎已经取代了BatchModule.EP
。
更多有关EPExpenseClaimSummary
的内容已删除,因此我认为这里有必要进行一些重构,因为该模块已重新实现。您可以从新的DAC EPExpenseClaim(摘要)和EPExpenseClaimDetails(详细信息)中获得启发。我认为ActiveProjectTask
属性应替换为EPExpenseAllowProjectTask
属性(以下源代码中的示例)。
TaskID字段已从“摘要”移动到“详细信息”,因此您无法重用当前的逻辑。这意味着现在为每个明细记录分配任务,而不是分配给单个标题记录,将关系从1-1更改为1-x。项目也更名为合同。与您最相关的字段是EPExpenseClaimDetails.ContractID
和EPExpenseClaimDetails.TaskID
:
#region ContractID
public abstract class contractID : PX.Data.IBqlField
{
}
/// <summary>
/// The <see cref = "Contract.ContractID"/> project or contract</see>, which should be specified if the
/// employee incurred the expenses while working on a particular project or contract.
/// You can select a project or contract only if the Project Management or Contract Management feature,
/// respectively, is enabled on the Enable/Disable Features (CS100000) form.
/// </summary>
[PXDBInt]
[PXUIField(DisplayName = "Project/Contract")]
[PXDimensionSelector(ContractAttribute.DimensionName,
typeof(Search2<Contract.contractID,
LeftJoin<EPEmployeeContract,
On<EPEmployeeContract.contractID, Equal<Contract.contractID>,
And<EPEmployeeContract.employeeID, Equal<Current2<employeeID>>>>>,
Where<Contract.isActive, Equal<True>,
And<Contract.isCompleted, Equal<False>,
And<Where<Contract.nonProject, Equal<True>,
Or2<Where<Contract.baseType, Equal<CTPRType.contract>,
And<FeatureInstalled<FeaturesSet.contractManagement>>>,
Or<Contract.baseType, Equal<CTPRType.project>,
And2<Where<Contract.visibleInEA, Equal<True>>,
And2<FeatureInstalled<FeaturesSet.projectModule>,
And2<Match<Current<AccessInfo.userName>>,
And<Where<Contract.restrictToEmployeeList, Equal<False>,
Or<EPEmployeeContract.employeeID, IsNotNull>>>>>>>>>>>>,
OrderBy<Desc<Contract.contractCD>>>),
typeof(Contract.contractCD),
typeof(Contract.contractCD),
typeof(Contract.description),
typeof(Contract.customerID),
typeof(Contract.status),
Filterable = true,
ValidComboRequired = true,
CacheGlobal = true,
DescriptionField = typeof(Contract.description))]
[ProjectDefault(BatchModule.EA, AccountType = typeof(expenseAccountID))]
public virtual int? ContractID
{
get;
set;
}
#endregion
#region TaskID
public abstract class taskID : PX.Data.IBqlField
{
}
/// <summary>
/// The <see cref="PMTask">project task</see> to which the expenses are related.
/// This box is available only if the Project Management feature is enabled on the Enable/Disable Features (CS100000) form.
/// </summary>
///
[PXDefault(typeof(Search<PMTask.taskID, Where<PMTask.projectID, Equal<Current<contractID>>, And<PMTask.isDefault, Equal<True>>>>), PersistingCheck = PXPersistingCheck.Nothing)]
[EPExpenseAllowProjectTaskAttribute(typeof(EPExpenseClaimDetails.contractID), BatchModule.EA, DisplayName = "Project Task")]
[PXUIEnabled(typeof(Where<contractID, IsNotNull, And<Selector<contractID, Contract.baseType>, Equal<CTPRType.project>>>))]
[PXFormula(typeof(Switch<Case<Where<contractID, IsNull, Or<Selector<contractID, Contract.baseType>, NotEqual<CTPRType.project>>>, Null>, taskID>))]
[PXForeignReference(typeof(Field<taskID>.IsRelatedTo<PMTask.taskID>))]
public virtual int? TaskID
{
get;
set;
}
#endregion