public int AddOrder(ExOrder objOrder) { int order_id = RemoteCall.GetNextID(_reqSession, "Order_Id"); string url = "/caxa/add_order_item"; JObject newOrder = new JObject { new JProperty("order_id", order_id), new JProperty("order_no", objOrder.OrderNo), new JProperty("customer", objOrder.CustomerName), new JProperty("phone", objOrder.CustomerPhone), new JProperty("person", objOrder.CustomerName), new JProperty("address", objOrder.CustomerAddress), new JProperty("order_date", objOrder.OrderDate), new JProperty("delivery_date", objOrder.DeliveryDate), new JProperty("order_memo", objOrder.Remarks), new JProperty("order_status", "scheduling"), new JProperty("projectid", 0) }; string response = RemoteCall.PostJObject(_reqSession, url, newOrder); JObject jResult = JObject.Parse(response); if ((int)jResult["result_code"] > 0) { return(order_id); } else { return(0); } }
public static int TaskCancel(WebRequestSession session, String taskID, StringBuilder taskError) { string url = "/caxa/task_cancel"; try { Boolean bSSL = session.ssl; String host = session.host; int port = session.port; JObject obj2Post = new JObject(); obj2Post["taskid"] = taskID; StringBuilder errMessage = new StringBuilder(); string txtResult = RemoteCall.PostJObject(session, url, obj2Post); if (txtResult != null) { JObject jResult = JObject.Parse(txtResult); if ((int)jResult["result_code"] > 0) { if (jResult["message"] != null) { if (taskError != null) { taskError.Append(txtResult); } } return(1); } } } catch (Exception e) { Debug.WriteLine(e.Message); if (taskError != null) { taskError.Append(e.Message); } } return(-1); }
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"); } } }