我是 X++ 开发的新手,我想在销售订单行而不是销售订单标题中插入运费。我使用了 SalesOrderLineChargeEntity 但它没有保存记录而是抛出错误。
private void addCharges()
{
SalesOrderLineChargeV2Entity chargeEntity;
boolean isNew;
str saleschargecode = 'Freight';
str saleschargecodedesc = 'Freight Charges';
if(saleschargecode != '')
{
select forupdate chargeEntity where chargeEntity.SalesOrderNumber=='22676' && chargeEntity.SalesChargeCode == saleschargecode && chargeEntity.ChargeLineNumber == 1;
if(!chargeEntity)
{
isNew = true;
chargeEntity.clear();
}
chargeEntity.ChargeCategory = MarkupCategory::Fixed;
chargeEntity.SalesChargeCode = saleschargecode;
chargeEntity.ChargeDescription=saleschargecodedesc;
chargeEntity.ChargeAccountingCurrencyCode = _ecomIntSalesOrderImportStaging.currency_id;
chargeEntity.ChargePercentage=0;
chargeEntity.ExternalChargeAmount=0;
chargeEntity.FixedChargeAmount= 230;
chargeEntity.ChargeLineNumber=1;
chargeEntity.SalesOrderNumber='22676';
chargeEntity.SalesTaxGroupCode='AvaTax';
chargeEntity.WillInvoiceProcessingKeepCharge=NoYes::No;
chargeEntity.IsIntercompanyCharge = NoYes::No;
if(isNew)
chargeEntity.insert();
else
chargeEntity.update();
}
}
需要帮忙。
谢谢,桑迪