designHelper.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. using BizCom;
  2. using Newtonsoft.Json;
  3. using NPOI.POIFS.Properties;
  4. using NPOI.SS.Formula.Functions;
  5. using SiteCore.Handler;
  6. using SiteCore.taoObj;
  7. using SQLData;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Collections.Specialized;
  11. using System.Data;
  12. using System.Linq;
  13. using System.Net;
  14. using System.Net.Http;
  15. using System.Reflection;
  16. using System.Runtime.Remoting.Messaging;
  17. using System.Runtime.Remoting.Metadata.W3cXsd2001;
  18. using System.Security.Policy;
  19. using System.Text;
  20. using System.Text.RegularExpressions;
  21. using System.Threading.Tasks;
  22. using System.Web;
  23. using static NHibernate.Linq.Visitors.LeftJoinDetector;
  24. using static SiteCore.taoObj.work_core_vo;
  25. namespace SiteCore.Handler
  26. {
  27. public class designHelper : BaseHandler, IHttpHandler
  28. {
  29. public void ProcessRequest(HttpContext context)
  30. {
  31. if (UrlParmsCheck("t"))
  32. {
  33. String tname = GetString("t");
  34. MethodInfo method;
  35. Type type = this.GetType();
  36. method = type.GetMethod(tname);
  37. con = context;
  38. if (method == null)
  39. {
  40. conError("找不到对应方法,服务器返回错误");
  41. return;
  42. }
  43. successFlag = false;
  44. context.Response.ContentType = "application/json";
  45. context.Response.Headers.Set("Access-Control-Allow-Origin", "*");
  46. try
  47. {
  48. method.Invoke(this, null);
  49. }
  50. catch (Exception ex)
  51. {
  52. conError("处理接口错误,服务器返回错误");
  53. }
  54. finally
  55. {
  56. }
  57. }
  58. }
  59. static string baseUrl = "http://api.lingtao8.com/";
  60. static string test_baseUrl = "https://sj.lingtao8.com/";
  61. //static string test_baseUrl = "http://47.122.40.91:8181/";
  62. //static string baseUrl = "http://47.122.40.91:8099/";
  63. static string pUrl = baseUrl + "api/manager/";
  64. static HttpHelper tb_http = new HttpHelper();
  65. public static designApiResponseVo API_GetPrintData_CreateOrder(CeErpTradeCell ceErpTradeCell, string post = "")
  66. {
  67. if (ceErpTradeCell.IsSample == 2)
  68. {
  69. return new designApiResponseVo(-1, "补差价订单不需要过设计系统");
  70. }
  71. string post_url = pUrl + "createOrder";
  72. CeErpOrderFormData formData = null;
  73. if (!ceErpTradeCell.ctid.Contains("S_") && ceErpTradeCell.ShopId != 136)
  74. {
  75. formData = CeErpOrderFormData.GetByTid(ceErpTradeCell.ctid.ToString());
  76. if (formData == null)
  77. {
  78. return new designApiResponseVo(-1, "请填写订单的手机号或者微信号才可指派到设计系统");
  79. }
  80. }
  81. designApiResponseVo response = commonHelper.checkOrderDesignInfo(ceErpTradeCell, post);
  82. if (response.code != 200)
  83. {
  84. return response;
  85. }
  86. WebClient wc = new WebClient();
  87. wc.Encoding = Encoding.GetEncoding("utf-8");
  88. //json参数
  89. NameValueCollection PostVars = getParams(ceErpTradeCell);
  90. if (ceErpTradeCell.CustomerUserId > 0)
  91. {
  92. string sql = "select top 1 Name,Mobile from view_ErpUser where ID = '" + ceErpTradeCell.CustomerUserId + "'";
  93. DataTable dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
  94. PostVars.Add("customerName", dt.Rows[0]["Name"].ToString());
  95. PostVars.Add("customerTel", dt.Rows[0]["Mobile"].ToString());
  96. }
  97. //{"msg":"推送成功","code":200,"success":true}
  98. string result = "";
  99. try
  100. {
  101. byte[] ret = wc.UploadValues(post_url, "POST", PostVars);
  102. string remoteInfo = Encoding.GetEncoding("utf-8").GetString(ret);
  103. response = JsonConvert.DeserializeObject<designApiResponseVo>(remoteInfo);
  104. result = "设计共创:失败-" + response.msg;
  105. if (response.code == 200)
  106. {
  107. result = "设计共创:成功";
  108. CeErpSukuraData.createInfo(ceErpTradeCell.ctid, 2);
  109. //commonHelper.updateDataTradeCellDesignInfo(ceErpTradeCell.ctid);
  110. }
  111. }
  112. catch (Exception ex)
  113. {
  114. XLog.SaveLog(0, "API_GetPrintData_CreateOrder:" + ex.Message);
  115. }
  116. return new designApiResponseVo(200, result);
  117. }
  118. public static designApiResponseVo API_update_order(CeErpTradeCell ceErpTradeCell)
  119. {
  120. string post_url = pUrl + "workCore";
  121. WebClient wc = new WebClient();
  122. wc.Encoding = Encoding.GetEncoding("utf-8");
  123. NameValueCollection PostVars = getParams(ceErpTradeCell);
  124. PostVars.Add("actionName", "orderRemarks");
  125. PostVars.Add("orderNumber", ceErpTradeCell.ctid);
  126. string result = "";
  127. try
  128. {
  129. byte[] ret = wc.UploadValues(post_url, "POST", PostVars);
  130. string remoteInfo = Encoding.GetEncoding("utf-8").GetString(ret);
  131. designApiResponseVo response = JsonConvert.DeserializeObject<designApiResponseVo>(remoteInfo);
  132. result = "设计共创:失败-" + response.msg;
  133. if (response.code == 200)
  134. {
  135. result = "设计共创:成功";
  136. CeErpSukuraData.createInfo(ceErpTradeCell.ctid, 2);
  137. //commonHelper.updateDataTradeCellDesignInfo(ceErpTradeCell.ctid);
  138. }
  139. }
  140. catch (Exception ex)
  141. {
  142. XLog.SaveLog(0, "API_GetPrintData_CreateOrder:" + ex.Message);
  143. }
  144. return new designApiResponseVo(200, result);
  145. }
  146. public static designApiResponseVo API_update_renewOrder(CeErpTradeCell ceErpTradeCell)
  147. {
  148. string post_url = pUrl + "renewOrder";
  149. WebClient wc = new WebClient();
  150. wc.Encoding = Encoding.GetEncoding("utf-8");
  151. NameValueCollection PostVars = getParams(ceErpTradeCell);
  152. PostVars.Add("actionName", "orderRemarks");
  153. PostVars.Add("orderNumber", ceErpTradeCell.ctid);
  154. string result = "";
  155. try
  156. {
  157. byte[] ret = wc.UploadValues(post_url, "POST", PostVars);
  158. string remoteInfo = Encoding.GetEncoding("utf-8").GetString(ret);
  159. designApiResponseVo response = JsonConvert.DeserializeObject<designApiResponseVo>(remoteInfo);
  160. result = "设计共创:失败-" + response.msg;
  161. if (response.code == 200)
  162. {
  163. result = "设计共创:成功";
  164. CeErpSukuraData.createInfo(ceErpTradeCell.ctid, 2);
  165. //commonHelper.updateDataTradeCellDesignInfo(ceErpTradeCell.ctid);
  166. }
  167. }
  168. catch (Exception ex)
  169. {
  170. XLog.SaveLog(0, "API_update_renewOrder:" + ex.Message);
  171. }
  172. return new designApiResponseVo(200, result);
  173. }
  174. private static NameValueCollection getParams(CeErpTradeCell ceErpTradeCell)
  175. {
  176. Boolean isOldCustomerText = false;
  177. Boolean isReturn = false;
  178. Boolean isGai = false;
  179. if (ceErpTradeCell.IsOldCustomer == 1)
  180. {
  181. isOldCustomerText = true;
  182. }
  183. if (ceErpTradeCell.IsReturn > 0)
  184. {
  185. isReturn = true;
  186. }
  187. if (ceErpTradeCell.MemoOpt == 1)
  188. {
  189. isGai = true;
  190. }
  191. CeErpTrade ceErpTrade = CeErpTrade.Get(ceErpTradeCell.tid);
  192. CeErpShop ceErpShop = CeErpShop.Get(ceErpTradeCell.ShopId);
  193. CeErpTradeCellExtend ceErpTradeCellExtend = CeErpTradeCellExtend.getByTid(ceErpTradeCell.ctid);
  194. //Dictionary<string, object> dataDic = ToDictionary(ro_json);
  195. //string urlData = ToUrlParams(dataDic);
  196. //string sql_pay = "INSERT INTO CE_ErpToDesignLog (ctid, ctime) VALUES ('" + ceErpTradeCell.ctid + "', '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
  197. //CeErpTradeCell.ExecuteNonQuery(sql_pay.ToString());
  198. NameValueCollection PostVars = new NameValueCollection();
  199. PostVars.Add("outId", ceErpTradeCell.ID.ToString());
  200. PostVars.Add("productId", ceErpTradeCell.ProductId.ToString());
  201. PostVars.Add("payment", ceErpTradeCell.payment.ToString());
  202. PostVars.Add("isUrgent", ceErpTradeCell.IsUrgency.ToString());
  203. PostVars.Add("customerMemo", ceErpTradeCell.CustomerMemo);
  204. PostVars.Add("shopName", ceErpShop.ShopName);
  205. PostVars.Add("buyerNick", ceErpTrade.buyer_nick != "" ? ceErpTrade.buyer_nick : "lingtao");
  206. PostVars.Add("receiverName", ceErpTrade.receiver_name);
  207. PostVars.Add("receiverMobile", ceErpTrade.receiver_mobile);
  208. PostVars.Add("receiverState", ceErpTrade.receiver_state);
  209. PostVars.Add("receiverCity", ceErpTrade.receiver_city);
  210. PostVars.Add("receiverDistrict", ceErpTrade.receiver_district);
  211. PostVars.Add("receiverAddress", ceErpTrade.receiver_address);
  212. PostVars.Add("tids", ceErpTradeCell.ctid);
  213. PostVars.Add("isOldUser", isOldCustomerText.ToString());
  214. PostVars.Add("sellerMemo", ceErpTradeCell.seller_memo);
  215. PostVars.Add("orderRemarks", ceErpTradeCell.seller_memo);
  216. PostVars.Add("isChange", isGai.ToString());
  217. PostVars.Add("isBack", isReturn.ToString());
  218. PostVars.Add("tid", ceErpTradeCell.tid);
  219. PostVars.Add("isDianziOrder", ceErpTradeCell.isDianziOrder.ToString());
  220. PostVars.Add("orderUnique", ceErpTradeCell.OrderSn);
  221. PostVars.Add("ptid", ceErpTradeCell.ptid);
  222. PostVars.Add("SplitTag", ceErpTradeCell.SplitTag);
  223. PostVars.Add("remarkSign", ceErpTradeCell.MemoOpt.ToString());
  224. PostVars.Add("otherMemo", ceErpTradeCell.OtherMemo);
  225. PostVars.Add("parentSplitNo", ceErpTradeCell.ParentSplitNo);
  226. if (ceErpTradeCellExtend != null)
  227. {
  228. PostVars.Add("productFirName", ceErpTradeCellExtend.cate1);/// 分类1
  229. PostVars.Add("productFirId", ceErpTradeCellExtend.cate1Id);/// 分类id
  230. PostVars.Add("productSecName", ceErpTradeCellExtend.cate2);/// 分类2
  231. PostVars.Add("productSecId", ceErpTradeCellExtend.cate2Id);/// 分类id
  232. PostVars.Add("productThirdId", ceErpTradeCellExtend.cate3Id);/// 分类id
  233. PostVars.Add("sceneName", ceErpTradeCellExtend.scene); /// 场景
  234. PostVars.Add("sceneId", ceErpTradeCellExtend.sceneId); /// 场景id
  235. PostVars.Add("productSizeW", ceErpTradeCellExtend.length.ToString()); /// 长
  236. PostVars.Add("productSizeH", ceErpTradeCellExtend.height.ToString()); /// 高
  237. PostVars.Add("productSizeL", ceErpTradeCellExtend.width.ToString()); /// 宽
  238. PostVars.Add("productCraftName", ceErpTradeCellExtend.craft); /// 工艺
  239. PostVars.Add("offerAmount", ceErpTradeCellExtend.offerAmount.ToString()); /// 报价金额
  240. PostVars.Add("styleCount", ceErpTradeCellExtend.numbers.ToString()); /// 款数
  241. PostVars.Add("materialName", ceErpTradeCellExtend.material); /// 材质
  242. PostVars.Add("materialId", ceErpTradeCellExtend.materialId); /// 材质id
  243. PostVars.Add("stylePricing", ceErpTradeCellExtend.numberType); /// 多款类型
  244. PostVars.Add("productSceneName", ceErpTradeCellExtend.typeScene); /// 品类场景
  245. PostVars.Add("productSceneId", ceErpTradeCellExtend.typeSceneId); /// 品类场景id
  246. PostVars.Add("opScene", ceErpTradeCellExtend.opScene); /// 运营场景
  247. PostVars.Add("opSceneId", ceErpTradeCellExtend.opSceneId); /// 运营场景id
  248. PostVars.Add("quantity", ceErpTradeCellExtend.quantity.ToString()); /// 数量
  249. PostVars.Add("productUnit", ceErpTradeCellExtend.numberUnit); /// 数量单位
  250. PostVars.Add("spuId", ceErpTradeCellExtend.spu_id); /// spuid
  251. PostVars.Add("recSize", ceErpTradeCellExtend.recSize); /// 推荐尺寸
  252. PostVars.Add("productSizeUnit", ceErpTradeCellExtend.sizeUnit); /// 尺寸单位
  253. PostVars.Add("orderFrom", ceErpTradeCellExtend.orderFrom.ToString()); /// 【订单来源】"10":第三方平台"15":私域电商"20":ERP"30":售前系统
  254. PostVars.Add("orderType", ceErpTradeCellExtend.orderType.ToString()); /// 【订单类型】"10":线上单"15":线下单"20":补差单"30":售后单
  255. PostVars.Add("discountAmount", ceErpTradeCellExtend.discountAmount.ToString());//折扣金额
  256. PostVars.Add("differentAmount", ceErpTradeCellExtend.differentAmount.ToString());//补差金额
  257. PostVars.Add("differentSplitNo", ceErpTradeCellExtend.differentSplitNo);//补差识别号
  258. }
  259. return PostVars;
  260. }
  261. /**
  262. *actionName:
  263. * followRemarks 跟单备注
  264. * orderRemarks 修改订单备注
  265. * rebutDesign 下单部打回设计单
  266. * afterDesign 售后设计单
  267. * changeDesign 改稿/定稿/加急
  268. * remarkSign 1改稿2定稿3加急
  269. * closeDesign 关闭订单
  270. * resetDesign 重置订单
  271. * packageDesign 顺丰状态
  272. * finishDesign 顺丰状态
  273. * approveDesign 下单部通过
  274. **/
  275. public static void API_WorkCore(string orderNumber, string actionName, string orderRemarks = "", int remarkSign = 0, string reasonRemarks = "", string isSf = "", int demandExamine = 0)
  276. {
  277. string post_url = pUrl + "workCore";
  278. WebClient wc = new WebClient();
  279. wc.Encoding = Encoding.GetEncoding("utf-8");
  280. NameValueCollection PostVars = new NameValueCollection();
  281. PostVars.Add("orderNumber", orderNumber);
  282. PostVars.Add("actionName", actionName);
  283. if (remarkSign > 0)
  284. {
  285. PostVars.Add("remarkSign", remarkSign.ToString());
  286. }
  287. if (orderRemarks != "")
  288. {
  289. PostVars.Add("orderRemarks", orderRemarks);
  290. }
  291. if (reasonRemarks != "")
  292. {
  293. PostVars.Add("reasonRemarks", reasonRemarks);
  294. }
  295. if (isSf != "")
  296. {
  297. PostVars.Add("packageSign", isSf);
  298. }
  299. if (demandExamine != 0)
  300. {
  301. PostVars.Add("demandExamine", demandExamine.ToString());
  302. }
  303. string remoteInfo = "";
  304. try
  305. {
  306. byte[] ret = wc.UploadValues(post_url, "POST", PostVars);
  307. remoteInfo = Encoding.GetEncoding("utf-8").GetString(ret);
  308. }
  309. catch (Exception ex)
  310. {
  311. XLog.SaveLog(0, "API_WorkCore:" + ex.Message);
  312. }
  313. }
  314. /**
  315. *actionName:
  316. * followRemarks 跟单备注
  317. * orderRemarks 修改订单备注
  318. * rebutDesign 下单部打回设计单
  319. * afterDesign 售后设计单
  320. * changeDesign 改稿/定稿/加急
  321. * remarkSign 1改稿2定稿3加急
  322. * closeDesign 关闭订单
  323. * resetDesign 重置订单
  324. * packageDesign 顺丰状态
  325. * finishDesign 上传设计
  326. * repairDesign 补差金额
  327. * approveDesign 下单部通过
  328. * afterOver 售后结束
  329. **/
  330. public static void API_WorkCore(ApiVo vo)
  331. {
  332. string post_url = pUrl + "workCore";
  333. WebClient wc = new WebClient();
  334. wc.Encoding = Encoding.GetEncoding("utf-8");
  335. NameValueCollection PostVars = new NameValueCollection();
  336. PostVars.Add("orderNumber", vo.orderNumber);
  337. PostVars.Add("actionName", vo.actionName);
  338. PostVars.Add("isDesign", vo.isDesign.ToString());
  339. PostVars.Add("isOriginal", vo.isOriginal.ToString());
  340. if (vo.remarkSign > 0)
  341. {
  342. PostVars.Add("remarkSign", vo.remarkSign.ToString());
  343. }
  344. if (vo.orderRemarks != "")
  345. {
  346. PostVars.Add("orderRemarks", vo.orderRemarks);
  347. }
  348. if (vo.reasonRemarks != "")
  349. {
  350. PostVars.Add("reasonRemarks", vo.reasonRemarks);
  351. }
  352. if (vo.isSf != "")
  353. {
  354. PostVars.Add("packageSign", vo.isSf);
  355. }
  356. if (vo.demandExamine != 0)
  357. {
  358. PostVars.Add("demandExamine", vo.demandExamine.ToString());
  359. }
  360. if (vo.payment != 0)
  361. {
  362. PostVars.Add("payment", vo.payment.ToString());
  363. }
  364. if (vo.designFree != 0)
  365. {
  366. PostVars.Add("designFree", vo.designFree.ToString());
  367. }
  368. if (vo.responsibleId != 0)
  369. {
  370. PostVars.Add("responsibleId", vo.responsibleId.ToString());
  371. }
  372. if (!string.IsNullOrEmpty(vo.afterFiles))
  373. {
  374. PostVars.Add("afterFiles", vo.afterFiles);
  375. }
  376. string remoteInfo = "";
  377. try
  378. {
  379. byte[] ret = wc.UploadValues(post_url, "POST", PostVars);
  380. remoteInfo = Encoding.GetEncoding("utf-8").GetString(ret);
  381. if ("orderRemarks".Equals(vo.actionName))
  382. {
  383. XLog.SaveLog(0, "API_WorkCore:" + remoteInfo + vo.actionName);
  384. }
  385. }
  386. catch (Exception ex)
  387. {
  388. XLog.SaveLog(0, "API_WorkCore:" + ex.Message);
  389. }
  390. }
  391. public static void api_approveDesign(string orderNumber)
  392. {
  393. string post_url = pUrl + "approveDesign";
  394. WebClient wc = new WebClient();
  395. wc.Encoding = Encoding.GetEncoding("utf-8");
  396. NameValueCollection PostVars = new NameValueCollection();
  397. PostVars.Add("orderNumber", orderNumber);
  398. string remoteInfo = "";
  399. try
  400. {
  401. byte[] ret = wc.UploadValues(post_url, "POST", PostVars);
  402. remoteInfo = Encoding.GetEncoding("utf-8").GetString(ret);
  403. }
  404. catch (Exception ex)
  405. {
  406. XLog.SaveLog(0, "api_approveDesign:" + ex.Message);
  407. }
  408. }
  409. /**
  410. *actionName:
  411. * refundIng 退款申请
  412. * refundEd 已退款
  413. * refundCancel 取消退款
  414. **/
  415. public static void API_refundOrder(string orderNumber, string actionName, string remark)
  416. {
  417. string post_url = pUrl + "refundOrder";
  418. WebClient wc = new WebClient();
  419. wc.Encoding = Encoding.GetEncoding("utf-8");
  420. NameValueCollection PostVars = new NameValueCollection();
  421. PostVars.Add("orderNumber", orderNumber);
  422. PostVars.Add("actionName", actionName);
  423. PostVars.Add("orderRemarks", remark);
  424. string remoteInfo = "";
  425. try
  426. {
  427. byte[] ret = wc.UploadValues(post_url, "POST", PostVars);
  428. remoteInfo = Encoding.GetEncoding("utf-8").GetString(ret);
  429. }
  430. catch (Exception ex)
  431. {
  432. XLog.SaveLog(0, "API_refundOrder:" + ex.Message);
  433. }
  434. }
  435. public static string API_CheckOrderTo(string orderNumber, string spuId, int shopId)
  436. {
  437. List<int> shopIds = new List<int>() { 5, 6, 8, 10, 11, 12, 14, 15, 16, 17, 18, 21, 23, 24, 27, 28, 31, 32, 56, 61, 124, 126, 127, 128 };
  438. string result = "无";
  439. if (!shopIds.Contains(shopId))
  440. {
  441. return result;
  442. }
  443. string post_url = test_baseUrl + "api/originalOrder/discernOrder";
  444. System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // 根据需要选择合适的协议版本
  445. WebClient wc = new WebClient();
  446. wc.Encoding = Encoding.GetEncoding("utf-8");
  447. NameValueCollection PostVars = new NameValueCollection();
  448. PostVars.Add("orderNumber", orderNumber);
  449. PostVars.Add("spuId", spuId);
  450. try
  451. {
  452. byte[] ret = wc.UploadValues(post_url, "POST", PostVars);
  453. string remoteInfo = Encoding.GetEncoding("utf-8").GetString(ret);
  454. designApiResponseVo designApiResponseVo = JsonConvert.DeserializeObject<designApiResponseVo>(remoteInfo);
  455. if (designApiResponseVo.code == 200)
  456. {
  457. result = designApiResponseVo.msg;
  458. }
  459. }
  460. catch (Exception ex)
  461. {
  462. XLog.SaveLog(0, "API_refundOrder:" + ex.Message);
  463. }
  464. return result;
  465. }
  466. public static string API_GetPrintData_Refund(CeErpTradeCell ceErpTradeCell)
  467. {
  468. string post_url = pUrl + "refund";
  469. //json参数
  470. List<string> postLst = new List<string>();
  471. Boolean isOldCustomerText = false;
  472. Boolean isReturn = false;
  473. Boolean isGai = false;
  474. if (ceErpTradeCell.IsOldCustomer == 1)
  475. {
  476. isOldCustomerText = true;
  477. }
  478. if (ceErpTradeCell.IsReturn > 0)
  479. {
  480. isReturn = true;
  481. }
  482. if (ceErpTradeCell.MemoOpt == 1)
  483. {
  484. isGai = true;
  485. }
  486. CeErpTrade ceErpTrade = CeErpTrade.Get(ceErpTradeCell.tid);
  487. CeErpShop ceErpShop = CeErpShop.Get(ceErpTradeCell.ShopId);
  488. var res_obj = new
  489. {
  490. outId = ceErpTradeCell.ID,
  491. productId = ceErpTradeCell.ProductId,
  492. payment = ceErpTradeCell.payment,
  493. isUrgent = ceErpTradeCell.IsUrgency,
  494. customerMemo = ceErpTradeCell.CustomerMemo,
  495. shopName = ceErpShop.ShopName,
  496. buyerNick = ceErpTrade.buyer_nick != "" ? ceErpTrade.buyer_nick : "lingtao",
  497. receiverName = ceErpTrade.receiver_name,
  498. receiverMobile = ceErpTrade.receiver_mobile,
  499. receiverState = ceErpTrade.receiver_state,
  500. receiverCity = ceErpTrade.receiver_city,
  501. receiverDistrict = ceErpTrade.receiver_district,
  502. receiverAddress = ceErpTrade.receiver_address,
  503. tids = ceErpTradeCell.ctid,
  504. isOldUser = isOldCustomerText,
  505. sellerMemo = ceErpTradeCell.seller_memo,
  506. isChange = isGai,
  507. isBack = isReturn,
  508. tid = ceErpTradeCell.tid
  509. };
  510. string ro_json = JsonConvert.SerializeObject(res_obj);
  511. //;***************************************************
  512. ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
  513. HttpItem item = new HttpItem()
  514. {
  515. URL = post_url,
  516. Method = "POST",
  517. Postdata = ro_json
  518. };
  519. item.PostEncoding = Encoding.UTF8;
  520. HttpResult hResult = tb_http.GetHtml(item);
  521. return hResult.Html;
  522. }
  523. public static string API_GetPrintData_ModifyOrder(string tid, string seller_memo, Boolean isGai, Boolean isReturn, string returnReason = "")
  524. {
  525. string post_url = pUrl + "modify";
  526. //json参数
  527. List<string> postLst = new List<string>();
  528. CeErpTradeCell ceErpTradeCell = CeErpTradeCell.GetByCtid(tid);
  529. CeErpShop ceErpShop = null;
  530. if (ceErpTradeCell != null)
  531. {
  532. ceErpShop = CeErpShop.Get(ceErpTradeCell.ShopId);
  533. }
  534. var res_obj = new
  535. {
  536. outId = tid,
  537. orderText = seller_memo,
  538. isChange = isGai,
  539. isBack = isReturn,
  540. returnReason = returnReason,
  541. };
  542. string ro_json = JsonConvert.SerializeObject(res_obj);
  543. //***************************************************
  544. ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
  545. HttpItem item = new HttpItem()
  546. {
  547. URL = post_url,
  548. Method = "POST",
  549. Postdata = ro_json
  550. };
  551. item.PostEncoding = Encoding.UTF8;
  552. HttpResult hResult = tb_http.GetHtml(item);
  553. return hResult.Html;
  554. }
  555. }
  556. }