Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.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# 如何访问Epicor以外的Epicor10业务对象中的UD字段?_C#_Epicorerp - Fatal编程技术网

C# 如何访问Epicor以外的Epicor10业务对象中的UD字段?

C# 如何访问Epicor以外的Epicor10业务对象中的UD字段?,c#,epicorerp,C#,Epicorerp,在Epicor 9中,打开Visual Studio并创建项目并使用Epicor库访问其业务对象(BOs)相当容易。因此,例如,可以通过包含库Epicor.Mfg.Part并更新零件对象来访问零件。然后,通过调用part.GetByID(“partnum”)。这将返回PartDataSet 在Epicor 10中,做同样的事情是不同的,但不是那么困难。但是,我注意到PartDataSet不包含任何UD字段,甚至包括在Epicor10中正确设置的UD字段 当通过Epicor 10的业务对象进入时,

在Epicor 9中,打开Visual Studio并创建项目并使用Epicor库访问其业务对象(BOs)相当容易。因此,例如,可以通过包含库Epicor.Mfg.Part并更新零件对象来访问零件。然后,通过调用
part.GetByID(“partnum”)。这将返回PartDataSet

在Epicor 10中,做同样的事情是不同的,但不是那么困难。但是,我注意到PartDataSet不包含任何UD字段,甚至包括在Epicor10中正确设置的UD字段

当通过Epicor 10的业务对象进入时,如何访问UD字段

编辑:


当您找到要查找的特定记录,并且有一个包含该记录所有列的对象时,您应该会看到另一个名为UserDefinedColumns的对象。它的工作原理类似于类型为
的听写器。例如,要设置一个值,您可以执行以下操作:

myPartDs.Part[0].UserDefinedColumns["MyUdColumn_c"] = "some value";

如果需要提取值,则必须将其解析为所需的任何类型,因为它们存储为对象。

这仍然相当容易,调用BO返回的DS将在客户端和服务器上找到的契约DLL中定义,由于此文件需要分发到客户端计算机,因此未将UD字段添加到其中。这将导致太多的客户端更新

这意味着VisualStudio无法查看合同程序集来确定字段名。而是使用columnName索引器访问字段,即:

class Program
{
    static void Main(string[] args)
    {
        // Hard-coded LogOn method 
        // Reference: Ice.Core.Session.dll
        Ice.Core.Session session = new Ice.Core.Session("manager", "manager", "net.tcp://AppServer/MyCustomerAppserver-99999-10.0.700.2");

        // References: Epicor.ServiceModel.dll, Erp.Contracts.BO.ABCCode.dll
        var abcCodeBO = Ice.Lib.Framework.WCFServiceSupport.CreateImpl<Erp.Proxy.BO.ABCCodeImpl>(session, Erp.Proxy.BO.ABCCodeImpl.UriPath);

        // Call the BO methods
        var ds = abcCodeBO.GetByID("A");
        var row = ds.ABCCode[0];

        System.Console.WriteLine("CountFreq is {0}", row.CountFreq);
        System.Console.WriteLine("CustomField_c is {0}", row["CustomField_c"]);
        System.Console.ReadKey();
    }
}
类程序
{
静态void Main(字符串[]参数)
{
//硬编码登录方法
//参考:Ice.Core.Session.dll
Ice.Core.Session Session=新的Ice.Core.Session(“管理器”、“管理器”、“网络”)。tcp://AppServer/MyCustomerAppserver-99999-10.0.700.2");
//参考:Epicor.ServiceModel.dll、Erp.Contracts.BO.ABCCode.dll
var abcCodeBO=Ice.Lib.Framework.WCFServiceSupport.CreateImpl(会话,Erp.Proxy.BO.ABCCodeImpl.UriPath);
//调用BO方法
var ds=abcCodeBO.GetByID(“A”);
var row=ds.ABCCode[0];
System.Console.WriteLine(“CountFreq是{0}”,row.CountFreq);
System.Console.WriteLine(“CustomField_c是{0}”,行[“CustomField_c”]);
System.Console.ReadKey();
}
}

UserDefinedColumns
在Epicor.ServiceModel中定义,但无法访问,因为它是
Ice.IceRow
的内部属性,而
Erp.Tablesets.QuoteHedRow
继承自该属性

是否需要程序集来访问UserDefinedColumns?我在数据集中找不到它。我编辑了上面的问题以显示我正在使用的对象和程序集。您正在使用Erp.Tablesets.QuoteHedRow。我正在尝试使用Erp.BO.QuoteDataSet.QuoteHedRow。据我所知,QuoteImpl类需要一个类型与后者匹配的引用。有没有办法将表集强制转换为数据集(反之亦然)?我应该使用不同的BO对象来使用表集进行通信吗?我添加了一个更完整的示例,用于从外部客户端调用BO方法。您不需要使用QuoteImpl类,只需调用CreateImpl方法,就可以得到一个BO实例,就像在BPM中调用Ice.Assemblies.ServiceRenderer.GetService一样。这非常完美。正是我需要的。谢谢我希望我知道一种在外部环境中使用表集的方法。我试着将QuoteImpl转换为QuoteSvcContract,但没有成功。再次感谢。
class Program
{
    static void Main(string[] args)
    {
        // Hard-coded LogOn method 
        // Reference: Ice.Core.Session.dll
        Ice.Core.Session session = new Ice.Core.Session("manager", "manager", "net.tcp://AppServer/MyCustomerAppserver-99999-10.0.700.2");

        // References: Epicor.ServiceModel.dll, Erp.Contracts.BO.ABCCode.dll
        var abcCodeBO = Ice.Lib.Framework.WCFServiceSupport.CreateImpl<Erp.Proxy.BO.ABCCodeImpl>(session, Erp.Proxy.BO.ABCCodeImpl.UriPath);

        // Call the BO methods
        var ds = abcCodeBO.GetByID("A");
        var row = ds.ABCCode[0];

        System.Console.WriteLine("CountFreq is {0}", row.CountFreq);
        System.Console.WriteLine("CustomField_c is {0}", row["CustomField_c"]);
        System.Console.ReadKey();
    }
}