2016-05-04 52 views
1

我有2個屏幕,查詢和數據輸入。 ,我想從屏幕1複製記錄到屏幕2,請參閱下圖。 scree1 and Screen2將記錄複製到acumatica中的另一個屏幕

我使用下面的代碼:

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

有人可以幫助解決這個看似愚蠢的問題?

對不起我的英語不好.. :)

謝謝!

回答

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"); 
     } 
+0

謝謝您的建議是爲我工作@DChhapgar – Rozak

相關問題