Acumatica:如何使用 Web API 从 SO Screen 获取附件文件?
Acumatica: How do I get an attachment file from SO Screen using Web API?
我会按照 I200 pdf 中的库存项目示例进行操作,但我不知道如何从销售订单下载文件。有人知道吗?
IN202500Content stockItemSchema = context.IN202500GetSchema();
var commands = new Command[]
{
new Value
{
Value = "AAMACHINE1",
LinkedCommand = stockItemSchema.StockItemSummary.InventoryID
},
new Value
{
FieldName = "T2MCRO.jpg",
LinkedCommand =
stockItemSchema.StockItemSummary.ServiceCommands.Attachment
}
};
var stockItemAttachment =
context.IN202500Export(commands, null, 1, false, true);
您几乎已经完成了,在 "stockItemAttachment" 变量中您应该以字节格式包含文件 "T2MCRO.jpg" 的内容。
您唯一要做的就是将其写入您的文件系统。
您可以使用以下命令:
File.WriteAllBytes(路径, Convert.FromBase64String(stockItemAttachment[0][0]));
我会按照 I200 pdf 中的库存项目示例进行操作,但我不知道如何从销售订单下载文件。有人知道吗?
IN202500Content stockItemSchema = context.IN202500GetSchema();
var commands = new Command[]
{
new Value
{
Value = "AAMACHINE1",
LinkedCommand = stockItemSchema.StockItemSummary.InventoryID
},
new Value
{
FieldName = "T2MCRO.jpg",
LinkedCommand =
stockItemSchema.StockItemSummary.ServiceCommands.Attachment
}
};
var stockItemAttachment =
context.IN202500Export(commands, null, 1, false, true);
您几乎已经完成了,在 "stockItemAttachment" 变量中您应该以字节格式包含文件 "T2MCRO.jpg" 的内容。
您唯一要做的就是将其写入您的文件系统。 您可以使用以下命令:
File.WriteAllBytes(路径, Convert.FromBase64String(stockItemAttachment[0][0]));