我试图扩展Allocations SOShipLineSplit DAC但没有成功。
第一种方法:在同一张表中使用Usr字段。
扩展DAC的定义如下:
public class SOShipLineSplitExtended : PXCacheExtension<SOShipLineSplit>
{
#region UsrentryA
public abstract class usrentryA : PX.Data.IBqlField
{
}
[PXDBInt]
[PXDefault(6, PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "UsrEntryA")]
public virtual int? UsrentryA { get; set; }
#endregion
#region UsrentryB
public abstract class usrentryB : PX.Data.IBqlField
{
}
[PXDBBool]
[PXDefault(true, PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "UsrEntryB")]
public virtual Boolean? UsrentryB { get; set; }
#endregion
}
最后,在UI中添加了字段(虽然在我们的项目中不需要这样做)。
创建销售订单后,还会创建相应的货件,信息将在DB中正确保留:
Select UsrentryA, UsrEntryB from SOShipLineSplit
where ShipmentNbr = '001713'
但是,在确认装运后,立即将这些字段设置为NULL
第二种方法:作为解决方法,我尝试创建扩展表
CREATE TABLE [dbo].[SOShipLineSplitStandalone](
[CompanyID] [int] NOT NULL,
[ShipmentNbr] [nvarchar](15) NOT NULL,
[LineNbr] [int] NOT NULL,
[SplitLineNbr] [int] NOT NULL,
--Extended Fields
[FieldInteger] [int] NULL,
[FieldBool] [bit] NULL
--
CONSTRAINT [SOShipLineSplitStandalone_PK] PRIMARY KEY CLUSTERED
(
[CompanyID] ASC,
[ShipmentNbr] ASC,
[LineNbr] ASC,
[SplitLineNbr] ASC
)
)
END
使用相应的DAC:
namespace SOShipLineSplitNS
{
[PXTable(typeof(SOShipLineSplit.shipmentNbr), typeof(SOShipLineSplit.lineNbr), typeof(SOShipLineSplit.splitLineNbr), IsOptional = true)]
public class SOShipLineSplitStandalone : PXCacheExtension<SOShipLineSplit>
{
#region FieldInteger
public abstract class fieldInteger : PX.Data.IBqlField
{
}
[PXDBInt]
[PXDefault(7, PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "FieldInteger")]
public virtual int? FieldInteger { get; set; }
#endregion
#region FieldBool
public abstract class fieldBool : PX.Data.IBqlField
{
}
[PXDBBool]
[PXDefault(true, PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "FieldBool")]
public virtual Boolean? FieldBool { get; set; }
#endregion
}
}
在这种情况下,当创建SO并且还创建其Shipment时,不会在扩展表中插入任何记录: Original and Extended tables
有关如何在发货确认期间阻止此表中的Usr字段设置为空的任何想法?
谢谢!