首页 > 其他分享 >Camstar获取回参

Camstar获取回参

时间:2022-11-04 15:22:13浏览次数:47  
标签:setValue Container string Camstar int 获取 Connection 回参 InputData

 

public static bool SplitQty(string Username, string Password, string Container, int splitQty,int plateQty,ref List<string> childList,ref string Msg)
        {
            string SessionID = Guid.NewGuid().ToString();
            csiClient Client = new csiClient();
            csiConnection Connection = Client.createConnection(Constants.CAMSTAR_HOST, Constants.CAMSTAR_PORT);
            Connection.setConnectionTimeout(600000);
            csiSession Session = Connection.createSession(Username, Password, SessionID);
            try
            {
                csiDocument Document = Session.createDocument("SplitDoc");
                csiService Service = Document.createService("Split");
                csiObject InputData = Service.inputData();
                InputData.containerField("Container").setRef(Container, "");
                InputData.dataField("AutoNumber").setValue("True");
                InputData.dataField("CloseWhenEmpty").setValue("False");
                InputData.namedObjectField("AutoNumberRule").setRef("SplitRule");
                InputData.dataField("ES_SNDetail").setValue("1");
                csiSubentityList Details = InputData.subentityList("ToContainerDetails");
                for(int i=1;i<=plateQty;i++)
                {
                    csiSubentity Detail = Details.appendItem();
                    Detail.dataField("Qty").setValue(splitQty.ToString());
                }
                Service.setExecute();
                Service.requestData().requestField("CompletionMsg");
                Service.requestData().requestField("ToContainerDetails");
                Service.requestData().requestField("ChildContainers");
                csiDocument ResponseDocument = Document.submit();
                if (ResponseDocument.checkErrors())//提交失败
                {
                    csiExceptionData csiexceptiondata = ResponseDocument.exceptionData();
                    Msg = csiexceptiondata.getDescription();
                    return false;
                }
                else//提交成功
                {
                    csiService RespService = ResponseDocument.getService();
                    var xxxxx = RespService.responseData();
                    csiField CompletionMsg = RespService.responseData().getResponseFieldByName("CompletionMsg");
                    csiField details = RespService.responseData().getResponseFieldByName("ToContainerDetails");
                    
                    //需要解析XML
                    csiSubentityList list = details.asSubentityList();
                    for (int i = 0; i < plateQty; i++)
                    { 
                        csiSubentity item = list.getItemByIndex(i);
                        var a = item.getField("ToContainerName");
                        var sn=a.asDataField().getValue();
                        childList.Add(sn);
                    }
                    Msg = CompletionMsg.asDataField().getValue();
                    return true;
                }
            }
            catch (Exception e)
            {
                Msg = e.Message;
                return false;
            }
            finally
            {
                if (Session != null)
                    Session.removeDocument("SplitDoc");
                if (Connection != null)
                    Connection.removeSession(SessionID);
                if (Client != null)
                    Client.removeConnection(Constants.CAMSTAR_HOST, Constants.CAMSTAR_PORT);
            }
        }

  

 

标签:setValue,Container,string,Camstar,int,获取,Connection,回参,InputData
From: https://www.cnblogs.com/CarryYou-lky/p/16857917.html

相关文章

  • Java 微信小程序登录接口获取openid
    根据官方文档,wx.login()的回调函数中,需要我们传递生成的用户登录凭证到code2accessToken的接口中小程序登录方法code2accessToken的方法中要求传入如下参数获取Appid与app......
  • 自定义注解获取请求Header中的值
    前言这几天开发一个项目,为了方便,前台将当前登陆人的ID和名称放在每个请求的Header中(这里不考虑安全性之类的),这样后台只要需要用到,就直接从Header中get出来就可以了。后台......
  • 获取标准报表CJI3的ALV数据
    1、CJI3运行标准程序CJI3,获取对象和业务货币值,在其他程序中展示2、代码展示CJI3对应程序名rkpep003,最终展示的ALV结构可以再程序中找到。因为本实例只获取其中两个字段的值,......
  • .Netcore IOptions<LoggerFilterOptions> 获取的顺序
    .netcore配置文件的日志级别:{"Logging":{"LogLevel":{"Default":"Information","Microsoft":"Trace","Microsoft.Hosting.Lifetime......
  • 获取标准报表CJI3的ALV数据
    1、CJI3运行标准程序CJI3,获取对象和业务货币值,在其他程序中展示 2、代码展示CJI3对应程序名rkpep003,最终展示的ALV结构可以再程序中找到。因为本实例只获取其中两个......
  • C#获取软件占用内存,和任务管理器显示的大小一样
    一般在VS调试的时候,VS里面显示内存和任务管理器的大小差别很大。所以可以用下面的代码获取真实的内存占用大小stringprcName=Process.GetCurrentProcess().ProcessNam......
  • Sql Server获取所有表的触发器
    Sql语句:select t.name 表名,tr.name 触发器名称 from (select * from sysobjects where xtype='U') t inner join (select * from sysobjects where x......
  • ArcGIS JS API 添加要素图层 点击时获取图层属性
    //需要引入:"esri/layers/FeatureLayer"模块//要素图层被点击时弹出图层属性的模板定义{为字段}varTuCeng03TC={"title":"ID:{objectid}",......
  • curl 获取响应的状态码
    需要在执行curl_exec后再通过curl_getinfo来获取。$ch=curl_init();curl_setopt($ch,CURLOPT_URL,'http://www.google.com.hk');curl_setopt($ch,CURLOPT_TIMEOUT......
  • Random-获取随机数
    之前也用过Random的函数,今天了解一些python中random的函数。importrandomprint(random.random)print(random.random())这用于生成一个0到1的随机符点数:0<=n<1.0看结......