我有2个屏幕,查询和数据输入。 我想将屏幕从Screen1复制到screen2,见下图。 scree1 and Screen2
我使用以下代码:
public PXAction<FuncLocFilter> CreateFuncLoc;
[PXButton]
[PXUIField(DisplayName = "Create Functional Location")]
protected virtual void createFuncLoc()
{
FuncLocFilter row = Filter.Current;
BSMTFuncLoc FnLc = new BSMTFuncLoc();
FunLocEntry graph = PXGraph.CreateInstance<FunLocEntry>();
graph.FunLocations.Current.FuncLocCD = row.FuncLocCD;
graph.FunLocations.Current.StructureID = row.StructureID;
graph.FunLocations.Current.HierLevels = row.HierLevels;
graph.FunLocations.Current.EditMask = row.EditMask;
if (graph.FunLocations.Current != null)
{
throw new PXRedirectRequiredException(graph, true, "Functional Location");
}
}
但我遇到如下错误: Error
有人可以帮助解决这个看似愚蠢的问题吗?
对不起,我的英语很差.. :)谢谢!
答案 0 :(得分:2)
以下是通过Acumatica中的代码/编程创建数据记录的常见模式
public PXAction<FuncLocFilter> CreateFuncLoc;
[PXButton]
[PXUIField(DisplayName = "Create Functional Location")]
protected virtual void createFuncLoc()
{
FuncLocFilter row = Filter.Current;
// 1. Create an instance of the BLC (graph)
FunLocEntry graph = PXGraph.CreateInstance<FunLocEntry>();
// 2. Create an instance of the BSMTFuncLoc DAC, set key field values (besides the ones whose values are generated by the system),
// and insert the record into the cache
BSMTFuncLoc FnLc = new BSMTFuncLoc();
FnLc.FuncLocCD = row.FuncLocCD;
FnLc = graph.FunLocations.Insert(FnLc);
// 3. Set non-key field values and update the record in the cache
FnLc.StructureID = row.StructureID;
FnLc.HierLevels = row.HierLevels;
FnLc.EditMask = row.EditMask;
FnLc = graph.FunLocations.Update(FnLc);
// 4. Redirect
if (graph.FunLocations.Current != null)
{
throw new PXRedirectRequiredException(graph, true, "Functional Location");
}