我认为我列出的上一个问题工作正常,直到我注意到我需要InventoryCD而不是InventoryID。在KitAssembly屏幕(IN307000)或DAC上找不到inventoryCD。因此,我创建了一个名为UsrInventoryCD的新Usr字段,并在填充KitAssemblyID字段时拉出相同的InventoryCD。这是正常的。接下来,我想获取此字段并将值从按钮传递到报表参数。这就是我到目前为止所做的:
db.samplecol.find({}, {"properties.aar":1,"geometry.coordinates":1, "_id":0}).sort([("properties.aar", pymongo.ASCENDING)])
它编译得很好但是我在尝试点击已添加到屏幕上的其中一个报告按钮时收到此错误。
protected void INKitRegister_UsrInventoryCD_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
{
var item = (INKitRegister)e.Row;
if (item == null) return;
var invitem = (InventoryItem)PXSelect<InventoryItem,
Where<InventoryItem.inventoryID, Equal<Current<INKitRegister.kitInventoryID>>>>.Select(Base, item.InventoryID);
if (invitem != null)
{
e.ReturnValue = invitem.InventoryCD;
}
}
public class KitAssemblyEntry_Extension:PXGraphExtension<KitAssemblyEntry>
{
public override void Initialize()
{
Report.AddMenuAction(Report1);
Report.AddMenuAction(Report2);
Report.AddMenuAction(Report3);
Report.AddMenuAction(Report5);
Report.AddMenuAction(Report6);
Report.MenuAutoOpen = true;
}
#region Event Handlers
public PXAction<INKitRegister> Report;
[PXButton]
[PXUIField(DisplayName = "Go To", MapEnableRights = PXCacheRights.Select)]
protected void report()
{ }
public PXAction<INKitRegister> Report1;
[PXUIField(DisplayName = "Report1", MapEnableRights = PXCacheRights.Select)]
[PXLookupButton]
public virtual IEnumerable report1(PXAdapter adapter)
{
INKitRegister item = Base.Document.Current;
var style = item.GetExtension<INKitRegisterExt>().UsrInventoryCD;
INKitRegister doc = Base.Document.Current;
if (doc != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["ItemNumber"] = style.ToString();
throw new PXReportRequiredException(parameters, "IN610002", "Report1");
}
return adapter.Get();
}
public PXAction<INKitRegister> Report2;
[PXUIField(DisplayName = "Report2", MapEnableRights = PXCacheRights.Select)]
[PXLookupButton]
public virtual IEnumerable report2(PXAdapter adapter)
{
INKitRegister item = Base.Document.Current;
var style = item.GetExtension<INKitRegisterExt>().UsrInventoryCD;
INKitRegister doc = Base.Document.Current;
if (doc != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["ItemNumber"] = style.ToString();
throw new PXReportRequiredException(parameters, "IN610003", "Report2");
}
return adapter.Get();
}
public PXAction<INKitRegister> Report3;
[PXUIField(DisplayName = "Report3", MapEnableRights = PXCacheRights.Select)]
[PXLookupButton]
public virtual IEnumerable report3(PXAdapter adapter)
{
INKitRegister item = Base.Document.Current;
var style = item.GetExtension<INKitRegisterExt>().UsrInventoryCD;
INKitRegister doc = Base.Document.Current;
if (doc != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["ItemNumber"] = style.ToString();
throw new PXReportRequiredException(parameters, "IN610001", "Report3");
}
return adapter.Get();
}
public PXAction<INKitRegister> Report4;
[PXUIField(DisplayName = "Report4", MapEnableRights = PXCacheRights.Select)]
[PXLookupButton]
public virtual IEnumerable report4(PXAdapter adapter)
{
INKitRegister item = Base.Document.Current;
var style = item.GetExtension<INKitRegisterExt>().UsrInventoryCD;
INKitRegister doc = Base.Document.Current;
if (doc != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["ItemNumber"] = style.ToString();
throw new PXReportRequiredException(parameters, "IN610005", "Report4");
}
return adapter.Get();
}
public PXAction<INKitRegister> Report5;
[PXUIField(DisplayName = "Report5", MapEnableRights = PXCacheRights.Select)]
[PXLookupButton]
public virtual IEnumerable report5(PXAdapter adapter)
{
INKitRegister item = Base.Document.Current;
var style = item.GetExtension<INKitRegisterExt>().UsrInventoryCD;
INKitRegister doc = Base.Document.Current;
if (doc != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["ItemNumber"] = style.ToString();
throw new PXReportRequiredException(parameters, "IN610006", "Report5");
}
return adapter.Get();
}
#endregion
}
这是跟踪日志:
An unhandled exception has occurred in the function 'MoveNext'. Please see the trace log for more details.
以下问题我曾询问是否涉及任何可能有用的信息:Acumatica - Add Reports dropdown to Kit Assembly Screen
答案 0 :(得分:0)
我采用了不同的方向修复此问题但仅使用PXSelect而不是自定义字段。我删除了自定义字段并使用了下面的代码。答案如下并且有效:
public class KitAssemblyEntry_Extension:PXGraphExtension<KitAssemblyEntry>
{
public override void Initialize()
{
Report.AddMenuAction(Report1);
Report.AddMenuAction(Report2);
Report.AddMenuAction(Report3);
Report.AddMenuAction(Report5);
Report.AddMenuAction(Report6);
Report.MenuAutoOpen = true;
}
#region Event Handlers
public PXAction<INKitRegister> Report;
[PXButton]
[PXUIField(DisplayName = "Go To", MapEnableRights = PXCacheRights.Select)]
protected void report()
{ }
public PXAction<INKitRegister> Report1;
[PXUIField(DisplayName = "Report1", MapEnableRights = PXCacheRights.Select)]
[PXLookupButton]
public virtual IEnumerable report1(PXAdapter adapter)
{
INKitRegister item = Base.Document.Current;
var invitem = (InventoryItem)PXSelect<InventoryItem,
Where<InventoryItem.inventoryID, Equal<Current<INKitRegister.kitInventoryID>>>>.Select(Base, item.InventoryID);
INKitRegister doc = Base.Document.Current;
if (doc != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["ItemNumber"] = invitem.InventoryCD.ToString();
throw new PXReportRequiredException(parameters, "IN610002", "Report1");
}
return adapter.Get();
}
public PXAction<INKitRegister> Report2;
[PXUIField(DisplayName = "Report2", MapEnableRights = PXCacheRights.Select)]
[PXLookupButton]
public virtual IEnumerable report2(PXAdapter adapter)
{
INKitRegister item = Base.Document.Current;
var invitem = (InventoryItem)PXSelect<InventoryItem,
Where<InventoryItem.inventoryID, Equal<Current<INKitRegister.kitInventoryID>>>>.Select(Base, item.InventoryID);
INKitRegister doc = Base.Document.Current;
if (doc != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["ItemNumber"] = invitem.InventoryCD.ToString();
throw new PXReportRequiredException(parameters, "IN610003", "Report2");
}
return adapter.Get();
}
public PXAction<INKitRegister> Report3;
[PXUIField(DisplayName = "Report3", MapEnableRights = PXCacheRights.Select)]
[PXLookupButton]
public virtual IEnumerable report3(PXAdapter adapter)
{
INKitRegister item = Base.Document.Current;
var invitem = (InventoryItem)PXSelect<InventoryItem,
Where<InventoryItem.inventoryID, Equal<Current<INKitRegister.kitInventoryID>>>>.Select(Base, item.InventoryID);
INKitRegister doc = Base.Document.Current;
if (doc != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["ItemNumber"] = invitem.InventoryCD.ToString();
throw new PXReportRequiredException(parameters, "IN610001", "Report3");
}
return adapter.Get();
}
public PXAction<INKitRegister> Report4;
[PXUIField(DisplayName = "Report4", MapEnableRights = PXCacheRights.Select)]
[PXLookupButton]
public virtual IEnumerable report4(PXAdapter adapter)
{
INKitRegister item = Base.Document.Current;
var invitem = (InventoryItem)PXSelect<InventoryItem,
Where<InventoryItem.inventoryID, Equal<Current<INKitRegister.kitInventoryID>>>>.Select(Base, item.InventoryID);
INKitRegister doc = Base.Document.Current;
if (doc != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["ItemNumber"] = invitem.InventoryCD.ToString();
throw new PXReportRequiredException(parameters, "IN610005", "Report4");
}
return adapter.Get();
}
public PXAction<INKitRegister> Report5;
[PXUIField(DisplayName = "Report5", MapEnableRights = PXCacheRights.Select)]
[PXLookupButton]
public virtual IEnumerable report5(PXAdapter adapter)
{
INKitRegister item = Base.Document.Current;
var invitem = (InventoryItem)PXSelect<InventoryItem,
Where<InventoryItem.inventoryID, Equal<Current<INKitRegister.kitInventoryID>>>>.Select(Base, item.InventoryID);
INKitRegister doc = Base.Document.Current;
if (doc != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["ItemNumber"] = invitem.InventoryCD.ToString();
throw new PXReportRequiredException(parameters, "IN610006", "Report5");
}
return adapter.Get();
}
#endregion
}