我已经为我的项目制作了一些自定义代码, 我创建了一个新字段,下面是我创建新自定义字段时的源代码:
1. GLTranExtension.cs
using PX.Data;
using PX.Objects.GL;
using PX.Objects.SO;
using PX.Objects.IN;
using PX.Objects.AR;
namespace TEST_SGLI.TEST_SGLI.DAC_Extension
{
public class GLTranExtension : PXCacheExtension<GLTran>
{
#region
public abstract class usrJobOrderNbr : IBqlTable
{
}
[PXDBString(15, IsFixed = true, IsUnicode = true)]
[PXUIField(DisplayName = "Job Order Nbr.")]
[PXSelector(typeof(Search<JobOrderNbr.jobOrderNbrCD>),
typeof(JobOrderNbr.jobOrderNbrCD),
typeof(JobOrderNbr.customerID),
typeof(JobOrderNbr.status))]
public string UsrJobOrderNbr { get; set; }
#endregion
}
}
2. CASplitExtension.cs :
using PX.Data;
using PX.Objects.CA;
using PX.Objects.GL;
namespace TEST_SGLI.TEST_SGLI.DAC_Extension
{
public class CASplitExtension : PXCacheExtension<CASplit>
{
#region
public abstract class usrJobOrderNbr : IBqlTable
{
}
[PXDBString(15, IsFixed = true, IsUnicode = true)]
[PXUIField(DisplayName = "Job Order Nbr.")]
[PXSelector(typeof(Search<JobOrderNbr.jobOrderNbrCD>),
typeof(JobOrderNbr.jobOrderNbrCD),
typeof(JobOrderNbr.customerID),
typeof(JobOrderNbr.status))]
public string UsrJobOrderNbr { get; set; }
#endregion
}
}
3. CATranEntryExtension.cs :
using PX.Data;
using System.Collections;
using PX.Objects.CA;
using PX.Objects.GL;
using PX.Objects.SO;
namespace TEST_SGLI.TEST_SGLI.BLC
{
public class CATranEntryExtension : PXGraphExtension<CATranEntry>
{
public PXAction<CAAdj> action;
[PXUIField(DisplayName = "Actions",
MapEnableRights = PXCacheRights.Insert,
MapViewRights = PXCacheRights.Insert)]
[PXProcessButton]
public IEnumerable Action(PXAdapter adapter,
[PXIntList(new int[] { 1, 2, 3 },
new string[]
{
"Approve",
"Reject",
"Release"
}), PXInt] int? actionID, [PXString] string actionName)
{
if (actionID == 3)
{
PXGraph.InstanceCreated.AddHandler<CATranEntry>((graph) =>
{
graph.RowInserting.AddHandler<GLTran>((sender, e) =>
{
CASplit csplit = PXResult<CASplit>.Current;
DAC_Extension.CASplitExtension splitX = PXCache<CASplit>.GetExtension<DAC_Extension.CASplitExtension>(csplit);
if (csplit != null && splitX.UsrJobOrderNbr != null)
{
DAC_Extension.GLTranExtension glExt = PXCache<GLTran>.GetExtension<DAC_Extension.GLTranExtension>((GLTran)e.Row);
glExt.UsrJobOrderNbr = splitX.UsrJobOrderNbr;
}
}
);
});
}
return Base.action.Press(adapter);
}
}
}
情景如下图所示: 我在交易页面(CA304000)
中创建了一个交易插入此交易的所有数据后,我插入作业单Nbr =&#34; JO003&#34;,然后点击按钮&#34;操作&#34;,然后选择&#34;发布& #34;,所有数据交易将被发布并显示在期刊交易中。
但是我的工作单nbr无法插入到Journal Transaction中。
任何人都可以帮我解决这个问题..