Acumatica PXSelect在插入记录后返回null
我正在代码中创建一个客户。创建客户后,我立即执行PXSelect,通过acctCd检索客户。但它每次都返回null。即使我检查了数据库并确认它存在 我猜这与缓存有关。如何刷新缓存 这是我的选择Acumatica PXSelect在插入记录后返回null,acumatica,Acumatica,我正在代码中创建一个客户。创建客户后,我立即执行PXSelect,通过acctCd检索客户。但它每次都返回null。即使我检查了数据库并确认它存在 我猜这与缓存有关。如何刷新缓存 这是我的选择 PXSelect<PX.Objects.AR.Customer, Where<PX.Objects.AR.Customer.acctCD, Equal<Required<PX.Objects.AR.Customer.acctCD>>>>.Select(t
PXSelect<PX.Objects.AR.Customer, Where<PX.Objects.AR.Customer.acctCD, Equal<Required<PX.Objects.AR.Customer.acctCD>>>>.Select(this, id);
PXSelect.Select(这个,id);
这是我添加客户的代码
private PX.Objects.AR.Customer UpdateContact(ContactRead rexContact, PX.Objects.AR.Customer m, string customerClassID, bool insert = true)
{
PX.Objects.CR.Contact defContact = null;
PX.Objects.AR.CustomerMaintInherit graph = PXGraph.CreateInstance<PX.Objects.AR.CustomerMaintInherit>();
graph.Clear(PXClearOption.ClearAll);
//Add Customer and BAccount Records
graph.BAccount.Current = m;
m.AcctCD = "V" + rexContact._id;
m.AcctName = rexContact.system_search_key;
m.Type = "CU";
if (insert) {
m = graph.BAccount.Insert(m);
defContact = graph.DefContact.Current;
}
else {
defContact = PXSelect<PX.Objects.CR.Contact, Where<PX.Objects.CR.Contact.contactID, Equal<Required<PX.Objects.CR.Contact.contactID>>>>.Select(this, m.DefContactID);
graph.DefContact.Current = defContact;
}
//Update Default Contact Record
defContact.ContactType = "AP";
defContact.FullName = rexContact.system_search_key;
if (rexContact._related.contact_emails != null)
{
if (rexContact._related.contact_emails.Length > 0)
{
defContact.EMail = (from e in rexContact._related.contact_emails where e.email_primary == true select e.email_address).FirstOrDefault();
}
}
if (rexContact._related.contact_phones != null)
{
if (rexContact._related.contact_phones.Length > 0)
{
defContact.Phone1 = (from e in rexContact._related.contact_phones where e.phone_primary == true select e.phone_number).FirstOrDefault();
}
}
defContact = graph.DefContact.Update(defContact);
//Change customer class to vendor
m.CustomerClassID = customerClassID;
m = (PX.Objects.AR.Customer)graph.BAccount.Update(m);
graph.Actions.PressSave();
return m;
}
private PX.Objects.AR.Customer UpdateContact(ContactRead rexContact,PX.Objects.AR.Customer m,字符串customerClassID,bool insert=true)
{
PX.Objects.CR.Contact deffcontact=null;
PX.Objects.AR.CustomerMatInherit graph=PXGraph.CreateInstance();
graph.Clear(PXClearOption.ClearAll);
//添加客户和BAccount记录
graph.BAccount.Current=m;
m、 AcctCD=“V”+rexContact.\u id;
m、 AcctName=rexContact.system\u search\u key;
m、 Type=“CU”;
如果(插入){
m=图.计数.插入(m);
defContact=graph.defContact.Current;
}
否则{
defContact=PXSelect.Select(这个,m.DefContactID);
graph.DefContact.Current=DefContact;
}
//更新默认联系人记录
defscontact.ContactType=“AP”;
defscontact.FullName=rexContact.system\u search\u键;
如果(rexContact.\u related.contact\u email!=null)
{
如果(rexContact.\u related.contact\u emails.Length>0)
{
defscontact.EMail=(来自rexContact中的e._related.contact_emails,其中e.EMail_primary==true选择e.EMail_地址)。FirstOrDefault();
}
}
如果(rexContact.\u related.contact\u phones!=null)
{
如果(rexContact.\u related.contact\u phones.Length>0)
{
defContact.Phone1=(来自rexContact中的e。_related.contact_phones,其中e.phone_primary==true选择e.phone_number)。FirstOrDefault();
}
}
defContact=graph.defContact.Update(defContact);
//将客户类别更改为供应商
m、 CustomerClassID=CustomerClassID;
m=(PX.Objects.AR.Customer)graph.BAccount.Update(m);
graph.Actions.PressSave();
返回m;
}
考虑使用PXSelectReadonly。它将尝试直接从数据库中检索值,而不使用缓存。另一个选项是创建带有所需视图的graph实例,并通过该图询问db with PXSelect您能否提供一个更详细的示例来说明问题?您的PXSelect还可以,但了解如何插入它有助于解决问题。