Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在Acumatica中确认装运时,如何旋转从承运人检索到的装运标签图像?_C#_Acumatica_Acumatica Kb - Fatal编程技术网

C# 在Acumatica中确认装运时,如何旋转从承运人检索到的装运标签图像?

C# 在Acumatica中确认装运时,如何旋转从承运人检索到的装运标签图像?,c#,acumatica,acumatica-kb,C#,Acumatica,Acumatica Kb,我们在Acumatica使用定制装箱单报告,该报告适用于所有不同类型的承运商(UPS、联邦快递、USPS等),并要求运输标签图像无需任何旋转 通过Stamps.com和FedEx检索的装运标签图像没有任何旋转,但通过UPS carrier integration检索的装运标签图像在包装箱外顺时针旋转了270度,这与文具/报告的指定区域(粘合剂)不匹配 UPS发货标签API没有选项指定发货标签图像的旋转度。我们将通过定制ShipmentEntrygraph/BLC和shipmentry屏幕(SO3

我们在Acumatica使用定制装箱单报告,该报告适用于所有不同类型的承运商(UPS、联邦快递、USPS等),并要求运输标签图像无需任何旋转


通过Stamps.com和FedEx检索的装运标签图像没有任何旋转,但通过UPS carrier integration检索的装运标签图像在包装箱外顺时针旋转了270度,这与文具/报告的指定区域(粘合剂)不匹配

UPS发货标签API没有选项指定发货标签图像的旋转度。我们将通过定制
ShipmentEntry
graph/BLC和
shipmentry屏幕(SO302000)
解决这个问题

当前工作流中不会有任何更改(最终用户透视图)。在Acumatica中确认装运后,将生成标签并从UPS中检索,在此过程中,我们的定制将以顺时针90度旋转检索到的标签(仅当装运时通过使用UPS插件且标签格式为GIF时)。此UPS标签将与通过其他插件(FedEx和Stamps.com)生成的标签对齐。报告层面无需调整

通过
ShipmentEntry
Graph/BLC中的
shipppackages
virtual方法生成装运标签。所以,我们将在
ShipmentEntry
Graph/BLC的Graph/BLC扩展中重写
ShipPackages
virtual方法

公共类SoShipmentryRotateGiflabelExt:PXGrapherExtension
{
公共委托无效ShippPackagesBaseDelegate(SOShipping shiporder);
[PXOverride]
公共作废ShippPackages(SoShipping ShippOrder、ShippPackagesBaseDelegate BaseInvoke)
{
//如果载体为UPS且标签格式为GIF,则旋转图像的自定义代码
//调用基方法
BaseInvoke(shiporder);
}
}
Acumatica中的文件附件通过
UploadFileMaintenance
Graph/BLC执行。 我们将扩展逻辑,将
UploadFileRevision
DAC的
rowserted
事件处理程序添加到
UploadFileMaintenance
图中

由于
UploadFileMaintenance
BLC实例是在
ShipPackages
中创建的,并且在执行之前不可用,因此我们将向
PXGraph
类的静态
InstanceCreated
集合添加一个委托

在初始化
UploadFileMaintenance
BLC实例时执行的委托中,我们将向
UploadFileMaintenance
Graph/BLC实例的
RowInserted
集合添加一个事件处理程序

公共类SoShipmentryRotateGiflabelExt:PXGrapherExtension
{
公共委托无效ShippPackagesBaseDelegate(SOShipping shiporder);
[PXOverride]
公共作废ShippPackages(SoShipping ShippOrder、ShippPackagesBaseDelegate BaseInvoke)
{
#用于旋转检索标签的区域自定义代码
PXGraph.InstanceCreated.AddHandler((fileGraph)=>
{
fileGraph.RowInserted.AddHandler((发件人,e)=>
{
UploadFileRevision fileData=(UploadFileRevision)e.Row;
});
});
#端区
//调用基方法
BaseInvoke(shiporder);
}
}
rowserted
事件处理程序中,我们获取正在处理的
UploadFileRevision
数据记录,检索装运标签图像并旋转它

最后我们调用基本方法

使用PX.Data;
使用PX.Objects.CS;
使用PX.Objects.SO;
使用PX.SM;
使用系统图;
使用System.IO;
命名空间PX.RotateUPSLabelImage.Ext
{
公共类SoShipmentryRotateGiflabelExt:PXGrapherExtension
{
公共委托无效ShippPackagesBaseDelegate(SOShipping shiporder);
[PXOverride]
公共作废ShippPackages(SoShipping ShippOrder、ShippPackagesBaseDelegate BaseInvoke)
{
#用于旋转检索标签的区域自定义代码
//确定指定的运输方式/承运人装运正在使用
var carrier=carrier.PK.Find(Base,shiporder.ShipVia);
//如果指定的发货通道/承运商基于API/插件
如果(载体?.IsExternal==true)
{
//识别已连接的托架插头
var plugin=CarrierPlugin.PK.Find(Base,carrier.CarrierPluginID);
//如果插件与UPS一起工作
if(plugin?.PluginTypeName?.Trim()==typeof(PX.upscarier.upscarier.FullName)
{
PXGraph.InstanceCreated.AddHandler((fileGraph)=>
{
fileGraph.RowInserted.AddHandler((发件人,e)=>
{
UploadFile fileInfo=(UploadFile)sender.Graph.Caches()?.Current;
如果(fileInfo!=null)
{
if(fileInfo.Name.StartsWith(“Label#”)&&(fileInfo.Extansion.ToUpper()=“GIF”))
{
UploadFileRevision fileData=(UploadFileRevision)e.Row;
使用(MemoryStream fileMemoryStream=新的MemoryStream(fileData?.Data))
{
Image labelImage=Image.FromStream(fileMemoryStream);
if(labelImage!=null)
{
labelImage.RotateFlip(RotateFlipType.Rotate90FlipNone);
ImageConverter imgConverter=新的ImageConverter();
fileData.Data=(字节[])imgConverter.ConvertTo(labelImage,typeof(字节[]));