C# 数字刻度误差

C# 数字刻度误差,c#,device,C#,Device,我有一个C#中的程序,它连接到电子秤设备(digi scale)。我遇到的问题是,当我将值设置为电子秤的属性(单价和tareWieght)时,执行选项。 我得到的例外是 Error occured on SetTareWeight: Microsoft.PointOfService.PosControlException: Failed to set property TareWeight. at Microsoft.PointOfService.Legacy.LegacyProxy.Se

我有一个C#中的程序,它连接到电子秤设备(digi scale)。我遇到的问题是,当我将值设置为电子秤的属性(单价和tareWieght)时,执行选项。 我得到的例外是

Error occured on SetTareWeight: Microsoft.PointOfService.PosControlException: Failed to set property TareWeight.
   at Microsoft.PointOfService.Legacy.LegacyProxy.SetProperty(String propertyName, Object propertyValue)
   at Microsoft.PointOfService.Legacy.LegacyScale.set_TareWeight(Decimal value)
   at Retalix.Client.SelfWeight.BusinessObjects.Devices.DigiScale.set_TareWeight(Int32 value) in c:\Project\CustomerScaleClient\Src\Retalix.Client.SelfWeight.BusinessObjects\Devices\DigiScale.cs:line 237
   at Retalix.Client.SelfWeight.BusinessObjects.Devices.Scale.ScaleLogic.SetScaleTareWeightByScaleManager(Int32 tareWeight) in c:\Project\CustomerScaleClient\Src\Retalix.Client.SelfWeight.BusinessObjects\Devices\Scale\ScaleLogic.cs:line 58
ErrorCode: Illegal
ErrorCodeExtended: 0
2013-01-17 12:31:46,789 [10] FATAL (Retalix.Client.SelfWeight.BusinessObjects.Devices.Scale.ScaleLogic) POS((null),(null)) InitialTrans(ID=(null), SEQ=(null)) 
Error occured on SetTareWeight: Microsoft.PointOfService.PosControlException: Failed to set property UnitPrice.
   at Microsoft.PointOfService.Legacy.LegacyProxy.SetProperty(String propertyName, Object propertyValue)
   at Microsoft.PointOfService.Legacy.LegacyScale.set_UnitPrice(Decimal value)
   at Retalix.Client.SelfWeight.BusinessObjects.Devices.DigiScale.set_UnitPrice(Decimal value) in c:\Project\CustomerScaleClient\Src\Retalix.Client.SelfWeight.BusinessObjects\Devices\DigiScale.cs:line 253
   at Retalix.Client.SelfWeight.BusinessObjects.Devices.Scale.ScaleLogic.SetScaleUnitPrice(Decimal unitPrice) in c:\Project\CustomerScaleClient\Src\Retalix.Client.SelfWeight.BusinessObjects\Devices\Scale\ScaleLogic.cs:line 76
ErrorCode: Illegal
ErrorCodeExtended: 0
我检查了适当的
DeviceEnable
并声明,当我为
UnitPrice
tareWeight
赋值时,它们的值为true

下一个代码是导致EXCTION的- *//比例尺是数字比例尺*

var scale = deviceProvider.GetDevice<IScale>(); 
scale.TareWeight = tareWeight; 

var scale=deviceProvider.GetDevice();
scale.TareWeight=TareWeight;

在分配到TareWight属性之前,我检查了deviceEnable是否为true-***

var scale=deviceProvider.GetDevice();scale.TareWeight=TareWeight;在assignment to TareWeight属性之前,我检查了deviceEnable是否为true。您可以在赋值行上设置断点,并查看scale对象的属性。你可能有类型问题。是否可以使用
IScale scale=deviceProvider.GetDevice()