Пользовательское поле на экране клиента
Мне нужно чтобы получить доступ к этому полю для расчета в графике ввода заказа на продажу, но я получаю эту ошибку.
[2024-10-23 04:45:10.957] \App_Code\Caches\SOOrderEntry.cs (159): ошибка CS0246: не удалось найти тип или имя пространства имен StandaloneLocationExt (вам не хватает директивы using или ссылки на сборку?)
Код: Выделить всё
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using PX.Common;
using PX.Data;
using PX.Objects.AP;
using PX.Objects.AR;
using PX.Objects.CA;
using PX.Objects.CM;
using PX.Objects.CR;
using PX.Objects.CS;
using PX.Objects.DR;
using PX.Objects.EP;
using PX.Objects.GL;
using PX.Objects.IN;
using PX.Objects.PM;
using PX.Objects.PO;
using PX.Objects.TX;
using POLine = PX.Objects.PO.POLine;
using POOrder = PX.Objects.PO.POOrder;
using PX.CarrierService;
using PX.Concurrency;
using CRLocation = PX.Objects.CR.Standalone.Location;
using PX.Objects.AR.CCPaymentProcessing;
using PX.Objects.AR.CCPaymentProcessing.Common;
using PX.Objects.AR.CCPaymentProcessing.Helpers;
using PX.Objects.AR.CCPaymentProcessing.Interfaces;
using ARRegisterAlias = PX.Objects.AR.Standalone.ARRegisterAlias;
using PX.Objects.AR.MigrationMode;
using PX.Objects.Common;
using PX.Objects.Common.Discount;
using PX.Objects.Common.Extensions;
using PX.Objects.IN.Overrides.INDocumentRelease;
using PX.CS.Contracts.Interfaces;
using Message = PX.CarrierService.Message;
using PX.TaxProvider;
using PX.Data.DependencyInjection;
using PX.Data.WorkflowAPI;
using PX.LicensePolicy;
using PX.Objects.Extensions.PaymentTransaction;
using PX.Objects.SO.GraphExtensions.CarrierRates;
using PX.Objects.SO.GraphExtensions.SOOrderEntryExt;
using PX.Objects.SO.Attributes;
using PX.Objects.Common.Attributes;
using PX.Objects.Common.Bql;
using OrderActions = PX.Objects.SO.SOOrderEntryActionsAttribute;
using PX.Objects.SO.DAC.Projections;
using PX.Data.BQL.Fluent;
using PX.Data.Localization;
using PX.Data.Reports;
using PX.Objects.IN.DAC.Accumulators;
using PX.Data.BQL;
using PX.Objects.SO.Standalone;
using PX.Objects;
using PX.Objects.SO;
using CFMWT22072024;
namespace PX.Objects.SO
{
public class SOOrderEntry_Extension : PXGraphExtension
{
#region Event Handlers
protected void SOLine_UsrAnticipatedInvDate_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
var row = e.Row as SOLine;
if (row == null) return;
// Fetch the Sales Order
SOOrder order = PXSelect
.Select(Base, row.OrderNbr);
if (order == null) return;
// Fetch the Terms
Terms terms = PXSelect
.Select(Base, order.TermsID)
.RowCast()
.FirstOrDefault();
if (terms == null) return;
// Get the anticipated invoice date from SOLine
SOLineExt soLineExt = sender.GetExtension(row);
DateTime? anticipatedInvoiceDate = soLineExt.UsrAnticipatedInvDate;
if (anticipatedInvoiceDate == null) return;
// Get the payment terms days
int termsDays = terms.DayDue00.GetValueOrDefault();
// Fetch the Location
//Location location = PXSelect
// .Select(Base, order.CustomerID, order.CustomerLocationID)
// .RowCast()
// .FirstOrDefault();
//if (location == null) return;
// Get the Location extension to access custom fields
// LocationExt locationExt = PXCache.GetExtension(location);
// Fetch the Location using the CRLocation alias
CRLocation location = PXSelect
.Select(Base, order.CustomerID, order.CustomerLocationID)
.RowCast()
.FirstOrDefault();
if (location == null) return;
// Get the Location extension to access custom fields
StandaloneLocationExt locationExt = PXCache.GetExtension(location);
if (locationExt?.UsrExpectedPaymentDate == null) return;
// Get the additional days from the Location UDF
int additionalDays = locationExt.UsrExpectedPaymentDate.Value.Day;
// Calculate the final expected payment date:
// Anticipated Invoice Date + Terms Days + Additional Days from Location
DateTime expectedPaymentDate = anticipatedInvoiceDate.Value
.AddDays(termsDays)
.AddDays(additionalDays);
// Update the expected payment date in the SOLine
sender.SetValueExt(row, expectedPaymentDate);
}
}
}
Буду признателен за любую помощь, спасибо!
Подробнее здесь: https://stackoverflow.com/questions/791 ... alone-loca