Я добавил много пользовательских экранов в свой проект Acumatica и хочу добавить одобрение для них, поэтому я нашел и последовал этому руководству:
Как работать с картами назначения и утверждения в Acumatica с помощью автоматизацииШаги?
А это мой код: Мой ЦАП:
[PXEMailSource]
[PXPrimaryGraph(typeof(ProductMaint))]
[Serializable]
public class PSSAProduct : IBqlTable, IAssign
{
#region ProductID
[PXDBIdentity(IsKey = true)]
[PXUIField(DisplayName = "Product ID")]
public virtual int? ProductID { get; set; }
public abstract class productID : IBqlField { }
#endregion
#region ProductCD
[PXDBString(50, IsUnicode = true)]
[PXUIField(DisplayName = "Product ID")]
public virtual string ProductCD { get; set; }
public abstract class productCD : IBqlField { }
#endregion
#region ProductName
[PXDBString(50, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Product Name")]
public virtual string ProductName { get; set; }
public abstract class productName : IBqlField { }
#endregion
#region Active
[PXDBBool()]
[PXDefault(true, PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Active")]
public virtual bool? Active { get; set; }
public abstract class active : IBqlField { }
#endregion
#region OwnerID
public abstract class ownerID : IBqlField { }
[PXDBGuid()]
[PX.TM.PXOwnerSelector()]
[PXUIField(DisplayName = "Owner")]
public virtual Guid? OwnerID { get; set; }
#endregion
#region WorkgroupID
public abstract class workgroupID : IBqlField { }
[PXDBInt()]
[PXSelector(typeof(Search<EPCompanyTree.workGroupID>), SubstituteKey = typeof(EPCompanyTree.description))]
[PX.TM.PXCompanyTreeSelector]
[PXUIField(DisplayName = "Workgroup", Enabled = false)]
public virtual int? WorkgroupID { get; set; }
#endregion
#region Hold
[PXDBBool()]
[PXUIField(DisplayName = "Hold", Visibility = PXUIVisibility.Visible)]
[PXDefault(true)]
//[PXNoUpdate] <- Saw this in the PO code, but had to remove so user could save stat of the Hold checkbox
public virtual bool? Hold { get; set; }
public abstract class hold : IBqlField { }
#endregion
#region Approved
public abstract class approved : IBqlField { }
[PXDBBool]
[PXDefault(false, PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Approved", Visibility = PXUIVisibility.Visible, Enabled = false)]
public virtual bool? Approved { get; set; }
#endregion
#region Rejected
public abstract class rejected : IBqlField { }
[PXBool]
[PXDefault(false, PersistingCheck = PXPersistingCheck.Nothing)]
public bool? Rejected { get; set; }
#endregion
#region Status
[PXDBString(1)]
[PXDefault(PSSAProduct.Statuses.Hold)]
[PXUIField(DisplayName = "Status", Visibility = PXUIVisibility.SelectorVisible, Enabled = false)]
[Statuses.List]
public virtual string Status { get; set; }
public abstract class status : IBqlField { }
#endregion
}
Мой график:
public class ProductMaint : PXGraph<ProductMaint, PSSAProduct>
{
public PXSelect<PSSAProduct> PSSAProductView;
public PXSelect<PSSASetupApproval> SetupApproval;
public EPApprovalAutomation<PSSAProduct, PSSAProduct.approved, PSSAProduct.rejected, PSSAProduct.hold, PSSASetupApproval> Approval;
}
Мой класс настройки:
[Serializable]
public class PSSASetup : IBqlTable
{
#region SARequestApproval
[EPRequireApproval]
[PXDefault(false, PersistingCheck = PXPersistingCheck.Null)]
[PXUIField(DisplayName = "SARequest Approval")]
public virtual bool? SARequestApproval { get; set; }
public abstract class sARequestApproval : IBqlField { }
#endregion
}
И мой класс подтверждения установки:
[Serializable]
public class PSSASetupApproval : IBqlTable, IAssignedMap
{
#region ApprovalID
[PXDBIdentity(IsKey = true)]
[PXUIField(DisplayName = "Approval ID")]
public virtual int? ApprovalID { get; set; }
public abstract class approvalID : IBqlField { }
#endregion
#region AssignmentMapID
[PXDefault()]
[PXDBInt()]
[PXSelector(typeof(Search<EPAssignmentMap.assignmentMapID, Where<EPAssignmentMap.entityType, Equal<AssignmentMapType.AssignmentMapTypeProduct>>>),
DescriptionField = typeof(EPAssignmentMap.name))]
[PXUIField(DisplayName = "Assignment Map ID")]
public virtual int? AssignmentMapID { get; set; }
public abstract class assignmentMapID : IBqlField { }
#endregion
#region AssignmentNotificationID
[PXDBInt()]
[PXSelector(typeof(PX.SM.Notification.notificationID), SubstituteKey = typeof(PX.SM.Notification.name))]
[PXUIField(DisplayName = "Pending Approval Notification")]
public virtual int? AssignmentNotificationID { get; set; }
public abstract class assignmentNotificationID : IBqlField { }
#endregion
#region IsActive
[PXDBBool()]
[PXDefault(typeof(Search<PSSASetup.sARequestApproval>), PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Is Active")]
public virtual bool? IsActive { get; set; }
public abstract class isActive : IBqlField { }
#endregion
}
public static class AssignmentMapType
{
public class AssignmentMapTypeProduct : Constant<string>
{
public AssignmentMapTypeProduct() : base(typeof(PSSAProduct).FullName) { }
}
}
Моя проблема в том, что если я поставлю ЦАП Acumatica в качестве SourceAssign EPApprovalAutomation, он не будет иметь ошибки.Но если я использую свой ЦАП, в коде фреймворка появляется «Значение не может быть нулевым».
Я тщательно проверил разницу между двумя ЦАП, но ничего не понимаю.
Мойверсия Acumatica - 17R2.
Если вы знаете, пожалуйста, скажите мне, что мне не хватает.
Спасибо всем!