Acumatica PXAction不';我不想保存缓存数据
你好 建造20.107.0026 屏幕id FS300200 我在“约会”屏幕上创建了一个按钮,用于计算地址的长度和纬度 我已经扩展了我的地址,并添加了usrDeliveryAddress经度和usrDeliveryAddressLattitude 但就我个人而言,我无法把这件事保存到DB 我在同一屏幕上有另一个按钮,当我调试时,该按钮引用上述字段,可以看到数据在那里 在约会屏幕上的按钮中保存AddressExt数据的正确方法是什么Acumatica PXAction不';我不想保存缓存数据,acumatica,Acumatica,你好 建造20.107.0026 屏幕id FS300200 我在“约会”屏幕上创建了一个按钮,用于计算地址的长度和纬度 我已经扩展了我的地址,并添加了usrDeliveryAddress经度和usrDeliveryAddressLattitude 但就我个人而言,我无法把这件事保存到DB 我在同一屏幕上有另一个按钮,当我调试时,该按钮引用上述字段,可以看到数据在那里 在约会屏幕上的按钮中保存AddressExt数据的正确方法是什么 public PXSelect<
public PXSelect<
Address,
Where<Address.bAccountID, Equal<Current<BAccount.bAccountID>>>> Addresslist;
public PXAction<PX.Objects.FS.FSAppointment> DoWork;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "DoWork")]
protected void doWork()
{
try
{
FSServiceOrder curFSServiceOrder = Base.ServiceOrderRelated.Current;
//check customerID
BAccount curBAccount = PXSelect<
BAccount,
Where<BAccount.bAccountID, Equal<Required<FSServiceOrder.customerID>>>>
.Select(Base, curFSServiceOrder.CustomerID);
string DeliveryAddressLongitude = "";
string DeliveryAddressLattitude = "";
//DeliveryAddress
Location curLocation = PXSelect<
Location,
Where<Location.bAccountID, Equal<Required<BAccount.bAccountID>>,
And<Location.locationID, Equal<Required<FSServiceOrder.locationID>>>>>
.Select(Base, curBAccount.BAccountID, curFSServiceOrder.LocationID);
Address curAddress = PXSelect<
Address,
Where<Address.addressID, Equal<Required<Location.defAddressID>>,
And<Address.bAccountID, Equal<Required<BAccount.bAccountID>>>>>
.Select(Base, curLocation.DefAddressID, curBAccount.BAccountID);
//Removed code that is not needed
DeliveryAddressLongitude = "fakeLong";
DeliveryAddressLattitude = "fakeLant";
// the below is a couple of things I have tried, i removed a couple of them that where
// not working at all
Addresslist.SetValueExt<AddressExt.usrDeliveryAddressLongitude>(curAddress, DeliveryAddressLongitude);
Addresslist.SetValueExt<AddressExt.usrDeliveryAddressLattitude>(curAddress, DeliveryAddressLattitude);
AddressExt curAddressExt = PXCache<Address>.GetExtension<AddressExt>(curAddress);
curAddressExt.UsrDeliveryAddressLattitude = DeliveryAddressLattitude;
curAddressExt.UsrDeliveryAddressLongitude = DeliveryAddressLongitude;
Addresslist.Update(curAddress);
Base.Caches<Address>().Cached.
//FSAppointment curFSAppointment = Base.AppointmentRecords.Current;
//FSAppointmentExt curFSAppointmentExt = curFSAppointment.GetExtension<FSAppointmentExt>();
// Base.
//Addresslist.Update(curAddress);
}
catch (Exception ex)
{
PXTrace.WriteError(ex);
}
}
public选择<
地址:,
其中>地址列表;
公共行动工作;
[PXButton(CommitChanges=true)]
[PXUIField(DisplayName=“DoWork”)]
受保护的空榫()
{
尝试
{
FSServiceOrder curFSServiceOrder=Base.ServiceOrderRelated.Current;
//检查客户ID
BAccount curBAccount=PXSelect<
巴克特,
何处>
.选择(基本,curFSServiceOrder.CustomerID);
字符串deliveryAddressLength=“”;
字符串deliveryAddressLattude=“”;
//送货地址
位置curLocation=PXSelect<
位置,
何处>
.Select(Base,curBAccount.BAccountID,curFSServiceOrder.LocationID);
地址CuraAddress=PXSelect<
地址:,
何处>
.Select(Base、curLocation.DefAddressID、curbcount.BAccountID);
//删除了不需要的代码
DeliveryAddressLength=“法克龙”;
deliveryAddresslatitude=“fakeLant”;
//下面是我尝试过的几件事,我把其中的几件去掉了
//根本不工作
Addresslist.SetValueExt(CuraAddress,DeliveryAddress经度);
Addresslist.SetValueExt(CuraAddress,DeliveryAddressLattude);
AddressExt CuraAddressExt=PXCache.GetExtension(CuraAddress);
CuraAddressExt.UsrDeliveryAddressLattitude=交货地址Lattitude;
CuraAddressExt.usrDeliveryAddress经度=交货地址经度;
地址列表。更新(CuraAddress);
Base.Caches().Cached。
//FSAppointment curFSAppointment=Base.AppointmentRecords.Current;
//fsappointext curfsappointext=curFSAppointment.GetExtension();
//基地。
//地址列表。更新(CuraAddress);
}
捕获(例外情况除外)
{
PXTrace.WriteError(ex);
}
}
不知道为什么会发生上述情况。我想这是因为系统中有两个位置有地址/位置类型。我打开了一个客户位置的PXGraph,并用它保存了数据。有两种方法可以做到这一点,我将在下面介绍:
CustomerLocationMaint customerLocationGraph = PXGraph.CreateInstance<CustomerLocationMaint>();
customerLocationGraph.Address.SetValueExt<AddressExt.usrDeliveryAddressLongitude>(curAddress, DeliveryAddressLongitude);
customerLocationGraph.Address.SetValueExt<AddressExt.usrDeliveryAddressLattitude>(curAddress, DeliveryAddressLattitude);
AddressExt curAddressExt = PXCache<Address>.GetExtension<AddressExt>(curAddress);
curAddressExt.UsrDeliveryAddressLattitude = DeliveryAddressLattitude;
curAddressExt.UsrDeliveryAddressLongitude = DeliveryAddressLongitude;
customerLocationGraph.Address.Update(curAddress);
customerLocationGraph.Save.PressButton();
CustomerLocationMaint customerLocationGraph=PXGraph.CreateInstance();
customerLocationGraph.Address.SetValueExt(CuraAddress,DeliveryAddress经度);
customerLocationGraph.Address.SetValueExt(CuraAddress,DeliveryAddressLattude);
AddressExt CuraAddressExt=PXCache.GetExtension(CuraAddress);
CuraAddressExt.UsrDeliveryAddressLattitude=交货地址Lattitude;
CuraAddressExt.usrDeliveryAddress经度=交货地址经度;
customerLocationGraph.Address.Update(CuraAddress);
customerLocationGraph.Save.PressButton();