运行 通过流程屏幕时流程运行良好,但不在自动计划下
Process runs fine while running through process screen but not under automated schedule
我正在尝试安排一个流程。当调度 运行s 时,我得到以下错误:
Message: Error #199: You are not currently logged in.
Date/Time: 09/06/2015 10:20
Platform:
Browser:
Source: PX.Data
Target Site: Int32 GetCurrentCompany()
Stack Trace: at PX.Data.PXDatabaseProviderBase.GetCurrentCompany()
at PX.Data.PXDatabaseProviderBase.getCompanyID(String tableName, companySetting& setting)
at PX.Data.PXDatabaseProviderBase.getRestriction(String table, String alias, Boolean mainRestriction, Boolean isRightJoin, Nullable`1 effectiveCid)
at PX.Data.PXDatabaseProviderBase.alterText(String text, Int32 start, Int32 stop, Boolean isTopLevelQuery)
at PX.Data.PXDatabaseProviderBase.alterText(String text, Int32 start, Int32 stop, Boolean isTopLevelQuery)
at PX.Data.PXDatabaseProviderBase.Select(PXGraph graph, BqlCommand command, Int32 topCount, PXView view, PXDataValue[] pars)
at PX.Data.PXGraph.ProviderSelect(BqlCommand command, Int32 topCount, PXView view, PXDataValue[] pars)
at PX.Data.PXView.GetResult(Object[] parameters, PXFilterRow[] filters, Boolean reverseOrder, Int32 topCount, PXSearchColumn[] sorts, Boolean& overrideSort, Boolean& extFilter)
at PX.Data.PXView.Select(Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows)
at PX.Data.PXSelectBase`1.selectBound[Resultset](BqlCommand command, Boolean readOnly, PXGraph graph, Int32 startRow, Int32 totalRows, Object[] currents, Object[] pars)
at PX.Data.PXSelectBase`1.select[Resultset](BqlCommand command, Boolean readOnly, PXGraph graph, Int32 startRow, Int32 totalRows, Object[] pars)
at PX.Data.PXSelectReadonly`2.SelectWindowed[Resultset](PXGraph graph, Int32 startRow, Int32 totalRows, Object[] pars)
at PX.Data.PXSelectReadonly`2.Select[Resultset](PXGraph graph, Object[] pars)
at Exosoft.MP.MikePero.Graphs.RexApiMaint.GetCustomerByCD(String id)
当我 运行 通过我的流程屏幕但不是在自动计划下时,流程 运行 很好。
当我调用下面的代码时发生错误...
PXSelectReadonly<PX.Objects.AR.Customer, Where<PX.Objects.AR.Customer.acctCD, Equal<Required<PX.Objects.AR.Customer.acctCD>>>>.Select(this, id);
图表及其调用处理的图表是基于我创建的自定义 table 自定义的。我已将 CompanyID 和其他审计字段添加到自定义 table。我是这样称呼它的
public class SyncRexApiProcess : PXGraph<SyncRexApiProcess>
{
public PXCancel<RexApiLogin> Cancel;
public PXProcessing<RexApiLogin> RexApiLogins;
public SyncRexApiProcess()
{
RexApiLogins.SetProcessCaption("Sync From Rex Api Login");
RexApiLogins.SetProcessAllCaption("Sync From All Rex Api Logins");
RexApiLogins.SetProcessDelegate<RexApiMaint>(
delegate(RexApiMaint graph, RexApiLogin login)
{
graph.Clear();
Func<Task> task = async () =>
{
await graph.SyncAPIDataAsync(login);
};
task().Wait();
});
}
}
通过使用 async/await,您的代码将 运行 在不同的线程中,不能保证使用会话变量正确初始化。我不相信 Acumatica 保证图形或任何缓存的任何类型的线程安全,因此您应该将与其交互的任何代码与异步操作分开。
此外,我看不出有任何理由使用异步操作;在这种情况下,它只会让您的生活更加艰难 - 只是 运行 您的 API 从主线程同步。如果你想一次 运行 多个操作,并等待它们 return,然后将这些操作与图形和缓存隔离。
我正在尝试安排一个流程。当调度 运行s 时,我得到以下错误:
Message: Error #199: You are not currently logged in.
Date/Time: 09/06/2015 10:20
Platform:
Browser:
Source: PX.Data
Target Site: Int32 GetCurrentCompany()
Stack Trace: at PX.Data.PXDatabaseProviderBase.GetCurrentCompany()
at PX.Data.PXDatabaseProviderBase.getCompanyID(String tableName, companySetting& setting)
at PX.Data.PXDatabaseProviderBase.getRestriction(String table, String alias, Boolean mainRestriction, Boolean isRightJoin, Nullable`1 effectiveCid)
at PX.Data.PXDatabaseProviderBase.alterText(String text, Int32 start, Int32 stop, Boolean isTopLevelQuery)
at PX.Data.PXDatabaseProviderBase.alterText(String text, Int32 start, Int32 stop, Boolean isTopLevelQuery)
at PX.Data.PXDatabaseProviderBase.Select(PXGraph graph, BqlCommand command, Int32 topCount, PXView view, PXDataValue[] pars)
at PX.Data.PXGraph.ProviderSelect(BqlCommand command, Int32 topCount, PXView view, PXDataValue[] pars)
at PX.Data.PXView.GetResult(Object[] parameters, PXFilterRow[] filters, Boolean reverseOrder, Int32 topCount, PXSearchColumn[] sorts, Boolean& overrideSort, Boolean& extFilter)
at PX.Data.PXView.Select(Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows)
at PX.Data.PXSelectBase`1.selectBound[Resultset](BqlCommand command, Boolean readOnly, PXGraph graph, Int32 startRow, Int32 totalRows, Object[] currents, Object[] pars)
at PX.Data.PXSelectBase`1.select[Resultset](BqlCommand command, Boolean readOnly, PXGraph graph, Int32 startRow, Int32 totalRows, Object[] pars)
at PX.Data.PXSelectReadonly`2.SelectWindowed[Resultset](PXGraph graph, Int32 startRow, Int32 totalRows, Object[] pars)
at PX.Data.PXSelectReadonly`2.Select[Resultset](PXGraph graph, Object[] pars)
at Exosoft.MP.MikePero.Graphs.RexApiMaint.GetCustomerByCD(String id)
当我 运行 通过我的流程屏幕但不是在自动计划下时,流程 运行 很好。
当我调用下面的代码时发生错误...
PXSelectReadonly<PX.Objects.AR.Customer, Where<PX.Objects.AR.Customer.acctCD, Equal<Required<PX.Objects.AR.Customer.acctCD>>>>.Select(this, id);
图表及其调用处理的图表是基于我创建的自定义 table 自定义的。我已将 CompanyID 和其他审计字段添加到自定义 table。我是这样称呼它的
public class SyncRexApiProcess : PXGraph<SyncRexApiProcess>
{
public PXCancel<RexApiLogin> Cancel;
public PXProcessing<RexApiLogin> RexApiLogins;
public SyncRexApiProcess()
{
RexApiLogins.SetProcessCaption("Sync From Rex Api Login");
RexApiLogins.SetProcessAllCaption("Sync From All Rex Api Logins");
RexApiLogins.SetProcessDelegate<RexApiMaint>(
delegate(RexApiMaint graph, RexApiLogin login)
{
graph.Clear();
Func<Task> task = async () =>
{
await graph.SyncAPIDataAsync(login);
};
task().Wait();
});
}
}
通过使用 async/await,您的代码将 运行 在不同的线程中,不能保证使用会话变量正确初始化。我不相信 Acumatica 保证图形或任何缓存的任何类型的线程安全,因此您应该将与其交互的任何代码与异步操作分开。
此外,我看不出有任何理由使用异步操作;在这种情况下,它只会让您的生活更加艰难 - 只是 运行 您的 API 从主线程同步。如果你想一次 运行 多个操作,并等待它们 return,然后将这些操作与图形和缓存隔离。