我已使用AR301000屏幕通过API创建了客户付款方式。但是,在尝试将付款方式添加到销售订单时,我遇到了错误。这是我目前的代码。
SO301000Content SO301000 = context.SO301000GetSchema();
context.SO301000Clear();
SO301000Content[] SO30100content = context.SO301000Submit
(
new Command[]
{
//add header info
new Value { Value = "SO", LinkedCommand = SO301000.OrderSummary.OrderType },
new Value { Value = "000129", LinkedCommand = SO301000.OrderSummary.OrderNbr },
//add payment
new Value { Value = "VISA", LinkedCommand = SO301000.PaymentSettings.PaymentMethod },
new Value { Value = "VISA:****-****-****-7261", LinkedCommand = SO301000.PaymentSettings.CardAccountNo },
SO301000.Actions.Save
}
);
尝试运行时,会出现以下错误:
System.Web.Services.Protocols.SoapException:服务器无法处理请求。 ---> PX.Data.PXException:错误#12:更新“销售订单”记录引发了一个或多个错误。请查阅。错误:'卡/帐号否'可能不为空。
是否还有其他卡/帐号字段必须更新?
答案 0 :(得分:0)
You have to use different approach
SO301000Content orderSchema = context.SO301000GetSchema();
var commands = new Command[]
{
new Value
{
Value = orderType,
LinkedCommand = orderSchema.OrderSummary.OrderType
},
new Value
{
Value = orderNbr,
LinkedCommand = orderSchema.OrderSummary.OrderNbr
},
new Value
{
Value = "TOKENCC",
LinkedCommand = orderSchema.PaymentSettings.PaymentMethod
},
new Value
{
Value = "True",
LinkedCommand = orderSchema.PaymentSettings.NewCard
},
new Value { Value = "VISA", LinkedCommand = orderSchema.PaymentSettings.PaymentMethod },
//below you have to fill attributes (pairs key-value)
new Key
{
ObjectName = orderSchema.PaymentSettingsCardInfoDescription.Description.ObjectName,
FieldName = orderSchema.PaymentSettingsCardInfoDescription.Description.FieldName,
Value = "='CCDNUM'"
},
new Value
{
Value = "4321111111111234",
LinkedCommand = orderSchema.PaymentSettingsCardInfoDescription.Value
},
new Key
{
ObjectName = orderSchema.PaymentSettingsCardInfoDescription.Description.ObjectName,
FieldName = orderSchema.PaymentSettingsCardInfoDescription.Description.FieldName,
Value = "='CVV'"
},
new Value
{
Value = "321",
LinkedCommand = orderSchema.PaymentSettingsCardInfoDescription.Value
},
new Key
{
ObjectName = orderSchema.PaymentSettingsCardInfoDescription.Description.ObjectName,
FieldName = orderSchema.PaymentSettingsCardInfoDescription.Description.FieldName,
Value = "='EXPDATE'"
},
new Value
{
Value = "01/2019",
LinkedCommand = orderSchema.PaymentSettingsCardInfoDescription.Value
},
new Key
{
ObjectName = orderSchema.PaymentSettingsCardInfoDescription.Description.ObjectName,
FieldName = orderSchema.PaymentSettingsCardInfoDescription.Description.FieldName,
Value = "='NAMEONCC'"
},
new Value
{
Value = "01/2019",
LinkedCommand = orderSchema.PaymentSettingsCardInfoDescription.Value
},
orderSchema.Actions.Save
};