微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PXAction不想保存缓存数据

如何解决PXAction不想保存缓存数据

美好的一天

内部版本20.107.0026

屏幕ID FS300200

我在“约会”屏幕上创建了一个按钮,该按钮可以进行一些工作并计算地址的经度和纬度。

我已经扩展了地址,并添加了usrDeliveryAddressLongitude和usrDeliveryAddressLattitude。

但是为了我的一生,我无法将这个东西保存到数据库中。

我在同一屏幕上还有另一个按钮,当我调试时,该按钮引用了上面的字段,并且可以看到其中的数据。

在“约会”屏幕上的按钮中保存AddressExt数据的正确方法是什么?

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);

        }
    }

解决方法

不确定为什么会发生上述情况。认为这是因为系统中的2个地方都有一个地址/位置类型。我为客户位置打开了一个PXGraph,并使用该位置保存了数据。有两种方法可以同时显示以下内容:

'--enable-automation'

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。