コード例 #1
0
        private void buttonTest_Click(object sender, EventArgs e)
        {
            /////////////////////////////////////////////////////////////////////
            if (false)
            { //获取模型列表
                string  url      = "/caxa/get_cadm_model_list";
                String  filter   = "";
                string  response = RemoteCall.GetJsonData(_reqSession, url, filter);
                JObject jResult  = JObject.Parse(response);
                if ((int)jResult["result_code"] > 0)
                {
                    this.listBoxLog.Items.Add(String.Format("成功获取模型树"));
                }
                else
                {
                    this.listBoxLog.Items.Add(String.Format("获取模型树失败"));
                }
            }
            /////////////////////////////////////////////////////////////////////
            else if (false)
            { //获取指定模型的数据包
                string  url       = "/caxa/get_cadm_model_data";
                String  modelPath = UrlUtility.UrlEncode("\\CADM\\SVG\\喷漆圆角矩形加负刀补(2000x750)#4");
                string  response  = RemoteCall.GetCadmModelData(_reqSession, url, modelPath);
                JObject jResult   = JObject.Parse(response);
                if ((int)jResult["result_code"] > 0)
                {
                    this.listBoxLog.Items.Add(String.Format("成功获取模型数据"));
                }
                else
                {
                    this.listBoxLog.Items.Add(String.Format("获取模型数据失败"));
                }
            }
            /////////////////////////////////////////////////////////////////////
            else if (false)
            { //测试增加订单
                string url = "/caxa/add_order_item";

                JObject newOrder = new JObject(
                    new JProperty("order_id", -1),
                    new JProperty("order_no", ""),
                    new JProperty("customer", ""),
                    new JProperty("phone", ""),
                    new JProperty("person", ""),
                    new JProperty("address", ""),
                    new JProperty("order_date", "2017-02-19"),
                    new JProperty("delivery_date", "2017-03-19"),
                    new JProperty("order_memo", ""),
                    new JProperty("order_status", ""),
                    new JProperty("projectid", -1));

                string  response = RemoteCall.PostJObject(_reqSession, url, newOrder);
                JObject jResult  = JObject.Parse(response);
                if ((int)jResult["result_code"] > 0)
                {
                    this.listBoxLog.Items.Add(String.Format("增加订单成功"));
                }
                else
                {
                    this.listBoxLog.Items.Add(String.Format("增加订单失败"));
                }
            }
            /////////////////////////////////////////////////////////////////////
            else if (false)
            { //测试增加带附件的订单项
                string url = "/caxa/multipart_order_item";

                NameValueCollection valuePairs = new NameValueCollection();
                valuePairs.Add("order_name", "订单名称");
                valuePairs.Add("customer", "客户名称");

                NameValueCollection files = new NameValueCollection();
                files.Add("压缩文件", "C:\\ACC\\CuttingStockNew.rar");
                files.Add("部件名称", "C:\\ACC\\part_form.xml");

                string  response = RemoteCall.PostMultipartRequest(_reqSession, url, valuePairs, files);
                JObject jResult  = JObject.Parse(response);
                if ((int)jResult["result_code"] > 0)
                {
                    this.listBoxLog.Items.Add(String.Format("增加订单项成功"));
                }
                else
                {
                    this.listBoxLog.Items.Add(String.Format("增加订单项失败"));
                }
            }
            /////////////////////////////////////////////////////////////////////
            else if (false)
            {
                //String srcFolder = "C:\\SmartHomeDesign_x64\\2.0\\drawLibs\\files\\banshijiaju\\";
                //String zipFile = "C:\\temp\\bsjj.zip";
                //RESTClient.GZip.ZipFolder(srcFolder, zipFile);

                //RESTClient.GZip.UnZip(zipFile, "C:\\temp\\out\\");

                //AssemblyLine lines = AssemblyLine.getInstance("C:\\326Demo_V45\\WebServerWithDb\\WebServer\\template\\processTemplate.xml");
                DataTable dtLines = RemoteCall.GetAssemblyLines(_reqSession);
            }
            /////////////////////////////////////////////////////////////////////
            else if (false)
            {
                String package_codeid = "0PE77BF72BE832"; //PostgreSQL 9.4,PostgreSQL 9.4
                String sheet_codeid   = "0Hck6vLDjhqWhu";
                String part_codeid    = "02ck6vLDf8kXVJ";

                StringBuilder resultFile = new StringBuilder(1024);
                Boolean       result     = RemoteCall.GetSheetList(_reqSession, package_codeid, resultFile);
                if (result)
                {
                    result = RemoteCall.UpdateSheetStatus(_reqSession, sheet_codeid, "cutted");
                    result = RemoteCall.UpdatePartStatus(_reqSession, part_codeid, "cutted");
                }
            }
        }