apiCaiYingTong.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. using BizCom;
  2. using Newtonsoft.Json;
  3. using Newtonsoft.Json.Linq;
  4. using NHibernate.Cfg.MappingSchema;
  5. using NPOI.OpenXmlFormats.Shared;
  6. using NPOI.SS.Formula.Functions;
  7. using SiteCore.taoObj;
  8. using SQLData;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Data;
  12. using System.IO;
  13. using System.Linq;
  14. using System.Net;
  15. using System.Reflection;
  16. using System.Reflection.Emit;
  17. using System.Security.Cryptography;
  18. using System.Text;
  19. using System.Web;
  20. using Utils;
  21. using static SiteCore.taoObj.Api_waybill_code_response_Obj;
  22. using static SiteCore.taoObj.work_core_vo;
  23. namespace SiteCore.Handler
  24. {
  25. public class apiCaiYingTong : BaseHandler, IHttpHandler
  26. {
  27. public void ProcessRequest(HttpContext context)
  28. {
  29. if (UrlParmsCheck("t"))
  30. {
  31. String tname = GetString("t");
  32. MethodInfo method;
  33. Type type = this.GetType();
  34. method = type.GetMethod(tname);
  35. con = context;
  36. if (method == null)
  37. {
  38. conError("找不到对应方法,服务器返回错误");
  39. return;
  40. }
  41. successFlag = false;
  42. context.Response.ContentType = "application/json";
  43. context.Response.Headers.Set("Access-Control-Allow-Origin", "*");
  44. try
  45. {
  46. method.Invoke(this, null);
  47. }
  48. catch (Exception ex)
  49. {
  50. conError("处理接口错误,服务器返回错误");
  51. }
  52. finally
  53. {
  54. //AfterInvoke(methodName);
  55. }
  56. //if (!successFlag) returnErrorMsg("服务器返回错误");
  57. }
  58. }
  59. static string appID = "1823193185001";
  60. //***************************************************
  61. //static string signkey = "fed5be35cf5bd04b14dcfff984f861dd";
  62. static HttpHelper tb_http = new HttpHelper();
  63. static string merSecret = "D8FF9498A5A2E6A6B4CB6EF88DB1DC35";
  64. static string pUrl = "https://front.lingtao8.com/designRest.htm";
  65. //static string pUrl = "https://localhost:8999/designRest.htm";
  66. //static string pUrl = "http://yi.yhmwacg.cn/designRest.htm";
  67. public static int DateTimeToUnixTime(DateTime dateTime)
  68. {
  69. return (int)(dateTime - TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1))).TotalSeconds;
  70. }
  71. //public static string ToUrlParams(object jsonObject)
  72. //{
  73. // var queryString = System.Web.HttpUtility.ParseQueryString(string.Empty); // 遍历JSON对象的属性,并添加到查询字符串中
  74. // foreach (var property in jsonObject.GetType().GetProperties())
  75. // {
  76. // queryString[property.Name] = property.GetValue(jsonObject)?.ToString() ?? string.Empty;
  77. // }
  78. // return queryString.ToString();
  79. //}
  80. public static Dictionary<string, object> ToDictionary(object obj)
  81. {
  82. var type = obj.GetType();
  83. var properties = type.GetProperties();
  84. var dictionary = new Dictionary<string, object>();
  85. foreach (var property in properties)
  86. {
  87. var value = property.GetValue(obj);
  88. dictionary.Add(property.Name, value);
  89. }
  90. return dictionary;
  91. }
  92. public static string ToUrlParams(Dictionary<string, object> jsonObject)
  93. {
  94. var queryString = new System.Collections.Specialized.NameValueCollection();
  95. // 遍历JSON对象的属性,并添加到查询字符串中
  96. foreach (var property in jsonObject)
  97. {
  98. var value = property.Value;
  99. if (value != null)
  100. {
  101. // 如果属性值不为null,则添加到查询字符串中
  102. if (value is System.Collections.IEnumerable && !(value is string))
  103. {
  104. // 如果是数组或集合类型,需要进一步处理
  105. var index = 0;
  106. foreach (var item in (System.Collections.IEnumerable)value)
  107. {
  108. queryString.Add(property.Key + "[" + index + "]", item != null ? item.ToString() : string.Empty);
  109. index++;
  110. }
  111. }
  112. else
  113. {
  114. // 普通属性
  115. queryString.Add(property.Key, value.ToString());
  116. }
  117. }
  118. }
  119. // 获取最终的查询字符串
  120. return string.Join("&", queryString.AllKeys.Select(key => key + "=" + queryString[key]));
  121. }
  122. public static string createSignCode(string method, string timeStr, string design_app_id, string design_secret)
  123. {
  124. byte[] use_bytes;
  125. //query.Append(secret);
  126. //预留看一下到时候签名怎么用md5加密;***************************************************
  127. string encryStr = design_secret + method + timeStr + design_app_id + design_secret;
  128. MD5 md5 = MD5.Create();
  129. use_bytes = md5.ComputeHash(Encoding.UTF8.GetBytes(encryStr));
  130. StringBuilder result = new StringBuilder();
  131. for (int i = 0; i < use_bytes.Length; i++)
  132. {
  133. result.Append(use_bytes[i].ToString("x2"));
  134. }
  135. string singResult = result.ToString();
  136. return singResult.Replace("-", "");
  137. //return bytes.ToString();
  138. }
  139. //http://47.114.150.226:88/Handler/apiDesign.ashx?t=DesignSys_AddLog post请求参数(参数放body中):string tid(淘宝订单号)string userName(操作用户)string con(日志内容)int orderState(订单状态)
  140. public void DesignSys_AddLog()
  141. {
  142. if (UrlPostParmsCheck("tid"))
  143. {
  144. try
  145. {
  146. //HttpContext.Current.Request.BinaryRead()
  147. string tid = GetPostString("tid");
  148. string userName = GetPostString("userName");
  149. int orderState = GetPostInt("orderState");
  150. string con = GetPostString("con");
  151. //returnErrorMsg(tid + "," + userName + "," + orderState + "," + con);
  152. //return;
  153. try
  154. {
  155. CeErpTradeCell ceErpTradeCell = CeErpTradeCell.GetByCtid(tid);
  156. if (ceErpTradeCell != null)
  157. {
  158. if (userName != "")
  159. {
  160. CeErpUser ceErpUser = CeErpUser.GetByUserName(userName);
  161. if (ceErpUser != null)
  162. {
  163. LogHelper.addLog(tid, ceErpUser.ID, con, orderState);
  164. return;
  165. }
  166. else
  167. {
  168. returnErrorMsg("找不到对应用户");
  169. return;
  170. }
  171. }
  172. returnErrorMsg("找不到对应用户");
  173. }
  174. else
  175. {
  176. returnErrorMsg("找不到对应订单记录,核对淘宝订单号");
  177. }
  178. }
  179. catch (Exception ex)
  180. {
  181. XLog.SaveLog(0, "xxxxx," + ex.Message);
  182. }
  183. }
  184. catch (Exception ex)
  185. {
  186. XLog.SaveLog(0, ex.Message);
  187. }
  188. return;
  189. }
  190. returnErrorMsg("缺少必要的参数");
  191. }
  192. public void shipments_Api()
  193. {
  194. string tid = GetString("tid");
  195. string comCode = GetString("comCode");
  196. string out_Sid = GetString("out_Sid");
  197. string curUseWayBillCode = out_Sid;
  198. string cpCode = comCode;
  199. CeErpTradeCell entity = CeErpTradeCell.GetByCtid(tid);
  200. if (entity == null)
  201. {
  202. entity = CeErpTradeCell.GetByCode(tid);
  203. }
  204. if (entity != null)
  205. {
  206. CeErpTrade mainEn = CeErpTrade.Get(entity.tid);
  207. string posCode = mainEn.posCode;
  208. string apires = API_LogisticsOnlineSend(tid, posCode, comCode, out_Sid);
  209. CeErpMessageAPI ceErpMessageAPI = new CeErpMessageAPI();
  210. JObject jsonObject = new JObject
  211. {
  212. { "tid", tid},
  213. { "pCode", posCode},
  214. { "comCode", comCode },
  215. { "out_Sid", out_Sid }
  216. };
  217. ceErpMessageAPI.ctid = tid;
  218. ceErpMessageAPI.tid = tid;
  219. ceErpMessageAPI.creationtime = DateTime.Now;
  220. ceErpMessageAPI.content = apires;
  221. ceErpMessageAPI.Create();
  222. if (mainEn != null && entity.OrderState == 6 && apires.IndexOf("发货成功") != -1)
  223. {
  224. try
  225. {
  226. entity.OutSid = curUseWayBillCode;
  227. entity.OrderState = 7;
  228. entity.IsUrgency = false;
  229. entity.LastBillCpCode = "";
  230. entity.LastBillWaybillCode = "";
  231. entity.FinishDeliveryTime = DateTime.Now;
  232. entity.IsReturn = 0;
  233. entity.MemoOpt = 0;
  234. entity.Update();
  235. //还要插入快递信息到 快递信息表
  236. CeErpExpressInfo exinfo = new CeErpExpressInfo();
  237. exinfo.tid = entity.ctid;
  238. exinfo.out_sid = entity.OutSid;
  239. exinfo.company_code = cpCode;
  240. exinfo.company_name = cpCode;
  241. exinfo.supplierUserName = commonHelper.getSupplierNameById(entity.SupplierId);
  242. exinfo.deliveryType = "发货成功";
  243. exinfo.print_time = DateTime.Now;
  244. exinfo.printUser = "彩印通接口";
  245. exinfo.Create();
  246. commonHelper.UpdateRelationOrder(entity.ctid);
  247. CeErpSukuraData.createInfo(entity.ctid, 4);
  248. commonHelper.insertToBuchaForDelivery(mainEn.tid, mainEn.posCode, cpCode, curUseWayBillCode);
  249. }
  250. catch (Exception ex)
  251. {
  252. XLog.SaveLog(0, "发货成功后更新数据失败," + ex.Message);
  253. }
  254. }
  255. else if (mainEn.status == "SHIPPED" || mainEn.status == "PART_SHIPPED" || entity.OrderState >= 7) //已发货的不处理直接返回面单
  256. {
  257. entity.OutSid = (entity.OutSid + "," + curUseWayBillCode);
  258. if (entity.OrderState == 6)
  259. {
  260. entity.OrderState = 7;
  261. }
  262. entity.FinishDeliveryTime = DateTime.Now;
  263. entity.Update();
  264. CeErpExpressInfo exinfo = new CeErpExpressInfo();
  265. exinfo.tid = entity.ctid;
  266. exinfo.out_sid = entity.OutSid;
  267. exinfo.company_code = cpCode;
  268. exinfo.company_name = cpCode;
  269. exinfo.supplierUserName = commonHelper.getSupplierNameById(entity.SupplierId);
  270. exinfo.deliveryType = "发货成功";
  271. exinfo.print_time = DateTime.Now;
  272. exinfo.printUser = "彩印通接口";
  273. exinfo.Create();
  274. commonHelper.UpdateRelationOrder(entity.ctid);
  275. //不处理
  276. }
  277. else
  278. {
  279. entity.LastBillCpCode = cpCode;
  280. entity.LastBillWaybillCode = curUseWayBillCode;
  281. entity.Update();
  282. string errmsg = commonHelper.KeepChinese(apires);
  283. //returnErrorMsg("同步淘宝发货失败!"+ errmsg);
  284. XLog.SaveLog(0, "打单后发货失败," + entity.tid + "," + curUseWayBillCode + "," + apires);
  285. }
  286. returnSuccessMsg(apires);
  287. LogHelper.addLog(entity.ctid, 0, "彩印通发货-" + comCode + "-" + out_Sid, entity.OrderState);
  288. return;
  289. }
  290. else
  291. {
  292. returnErrorMsg("找不到对应订单记录,核对淘宝订单号");
  293. return;
  294. }
  295. return;
  296. }
  297. public void waybill_Api()
  298. {
  299. string tid = GetString("tid");
  300. string cpCode = GetString("cpCode");
  301. CeErpTradeCell entity = CeErpTradeCell.GetByCtid(tid);
  302. if (entity != null)
  303. {
  304. bool isUseLastWayBillCode = true;
  305. if ((entity.OrderState == 7 || entity.OrderState == 6))
  306. {
  307. isUseLastWayBillCode = false;
  308. }
  309. else
  310. {
  311. returnErrorMsg("订单状态错误无法获取面单");
  312. return;
  313. }
  314. if (entity.IsSF > 0 && cpCode.IndexOf("SF") == -1)
  315. {
  316. returnErrorMsg("此单标记使用顺丰发货,不能使用其他快递");
  317. return;
  318. }
  319. string res = "";
  320. Api_waybill_code_response_Obj fullObj = null;
  321. string pData_str = "";
  322. string curUseWayBillCode = "";
  323. if (isUseLastWayBillCode == false)
  324. {
  325. res = apiHelper.API_GetWaybill(cpCode, tid);
  326. try
  327. {
  328. if (res.IndexOf("failure") != -1)
  329. {
  330. //int idx = res.IndexOf("sub_message");
  331. //int idx2 = res.IndexOf("flag");
  332. //string emsg = res.Substring(idx + 14, idx2 - idx - 17);
  333. string errMsgNeed = commonHelper.KeepChinese(res);
  334. var res_objd = new
  335. {
  336. restype = 0,
  337. data = "获取面单失败" + errMsgNeed
  338. };
  339. string ro_jsond = JsonConvert.SerializeObject(res_objd);
  340. returnSuccess(ro_jsond);
  341. if (res.IndexOf("停发") != -1)
  342. {
  343. entity.UnusualCon = "物流停发";
  344. entity.Update();
  345. }
  346. //returnErrorMsg("获取面单失败,"+emsg);
  347. XLog.SaveLog(0, "获取面单失败" + res);
  348. return;
  349. }
  350. else if (res.IndexOf("errorMsg") != -1)
  351. {
  352. //int idx = res.IndexOf("errorMsg");
  353. //int idx2 = res.IndexOf("}]}");
  354. //string emsg = res.Substring(idx + 11, idx2 - idx - 12);
  355. string errMsgNeed = commonHelper.KeepChinese(res);
  356. var res_objf = new
  357. {
  358. restype = 0,
  359. data = "获取面单失败2" + errMsgNeed
  360. };
  361. string ro_jsonf = JsonConvert.SerializeObject(res_objf);
  362. if (res.IndexOf("停发") != -1)
  363. {
  364. entity.UnusualCon = "物流停发";
  365. entity.Update();
  366. CeErpTrade trade = CeErpTrade.Get(entity.tid);
  367. if (trade != null)
  368. {
  369. string apires = apiHelper.API_TradeMemoUpdate(trade.tid, trade.posCode, "", trade.seller_memo + "-" + entity.UnusualCon);
  370. }
  371. }
  372. returnSuccess(ro_jsonf);
  373. //returnErrorMsg("获取面单失败," + emsg);
  374. XLog.SaveLog(0, "获取面单失败2" + res);
  375. return;
  376. }
  377. res = tmcHelper.GetUTF8String(Encoding.UTF8.GetBytes(res));
  378. //res = res.Replace(" ", "");
  379. fullObj = JsonConvert.DeserializeObject<Api_waybill_code_response_Obj>(res);
  380. }
  381. catch (Exception ex)
  382. {
  383. XLog.SaveLog(0, "生成fullObj" + res);
  384. var res_objf = new
  385. {
  386. restype = 0,
  387. data = "生成fullObj发生错误" + ex.Message
  388. };
  389. string ro_jsonf = JsonConvert.SerializeObject(res_objf);
  390. returnSuccess(ro_jsonf);
  391. return;
  392. }
  393. if (fullObj.response.data.content.Count > 0)
  394. {
  395. ContentItem codeObj = fullObj.response.data.content[0];
  396. if (cpCode.IndexOf("SFFQ-") != -1)
  397. {
  398. pData_str = apiHelper.API_GetPrintData_SF(codeObj.waybillCode);
  399. }
  400. else
  401. pData_str = apiHelper.API_GetPrintData(codeObj.waybillCode);
  402. curUseWayBillCode = codeObj.waybillCode;
  403. LogHelper.addLog(entity.ctid, 0, "彩印通获取面单成功-" + cpCode + "-" + curUseWayBillCode, entity.OrderState);
  404. returnSuccess(pData_str);
  405. return;
  406. }
  407. else
  408. {
  409. XLog.SaveLog(0, "生成fullObj找不到快递单号waybillCode" + res);
  410. var res_objf = new
  411. {
  412. restype = 0,
  413. data = "生成fullObj找不到快递单号waybillCode"
  414. };
  415. string ro_jsonf = JsonConvert.SerializeObject(res_objf);
  416. returnSuccess(ro_jsonf);
  417. return;
  418. }
  419. }
  420. else
  421. {
  422. //使用上次打印的快递单号
  423. if (cpCode == "SFFQ-LY")
  424. {
  425. pData_str = apiHelper.API_GetPrintData_SF(entity.LastBillWaybillCode);
  426. }
  427. else
  428. pData_str = apiHelper.API_GetPrintData(entity.LastBillWaybillCode);
  429. curUseWayBillCode = entity.LastBillWaybillCode;
  430. }
  431. if (pData_str.IndexOf("props") == -1 && pData_str.IndexOf("printData") == -1)
  432. {
  433. var res_obje = new
  434. {
  435. restype = 0,
  436. data = "获取加密打印数据失败"
  437. };
  438. string ro_jsone = JsonConvert.SerializeObject(res_obje);
  439. returnSuccess(ro_jsone);
  440. entity.LastBillCpCode = cpCode;
  441. entity.LastBillWaybillCode = curUseWayBillCode;
  442. entity.Update();
  443. XLog.SaveLog(0, "获取加密打印数据失败" + curUseWayBillCode + pData_str);
  444. //returnErrorMsg("获取加密打印数据失败");
  445. return;
  446. }
  447. }
  448. else
  449. {
  450. returnErrorMsg("找不到对应订单记录,核对淘宝订单号");
  451. return;
  452. }
  453. return;
  454. }
  455. //http://47.114.150.226:88/Handler/apiCaiYingTong.ashx?t=afterCytSale ctid status supmemo
  456. public void afterCytSale()
  457. {
  458. string ctid = GetString("ctid");
  459. int st = GetInt("status");
  460. string afmemo = GetString("supmemo");
  461. string id = "0";
  462. CeErpTradeCell entity = CeErpTradeCell.GetByCtid(ctid);
  463. if (entity == null)
  464. {
  465. entity = CeErpTradeCell.GetByCode(ctid);
  466. if (entity == null)
  467. {
  468. returnErrorMsg("找不到订单记录");
  469. return;
  470. }
  471. }
  472. CeErpTradeResponsible ceErpTradeResponsible = CeErpTradeResponsible.GetByUserId(entity.ctid, 64, 1, 0);
  473. if (ceErpTradeResponsible == null)
  474. {
  475. ceErpTradeResponsible = CeErpTradeResponsible.GetByUserId(entity.ctid, 80, 1, 0);
  476. }
  477. if (ceErpTradeResponsible != null)
  478. {
  479. id = ceErpTradeResponsible.ID.ToString();
  480. if (ceErpTradeResponsible.VerifyState == 1)
  481. {
  482. returnErrorMsg("已超时自动认可");
  483. return;
  484. }
  485. }
  486. if (entity != null && ceErpTradeResponsible != null)
  487. {
  488. if (entity.AfterSaleState != 3 || ceErpTradeResponsible.VerifyState != 0)
  489. {
  490. returnErrorMsg("此单售后当前状态不可操作!");
  491. return;
  492. }
  493. entity.AfterSaleSupplierState = st;
  494. entity.AfterSaleSupplierMemo = afmemo;
  495. if (st == 1)
  496. {
  497. ceErpTradeResponsible.VerifyState = 1;
  498. ceErpTradeResponsible.VerifyTime = DateTime.Now;
  499. ceErpTradeResponsible.Update();
  500. bool isAll = commonHelper.tradeResponsibleAll(entity);
  501. if (isAll)
  502. {
  503. entity.AfterSaleState = 4;
  504. entity.AfterSaleSupplierState = 1;
  505. }
  506. }
  507. else
  508. {
  509. CeErpTradeResponsible.dateByTid(entity.ctid);
  510. string numSql = string.Format("SELECT COUNT ( * ) AS BackNum FROM dbo.Ce_ErpTradeAfterSaleLog WHERE tid = '{0}' AND Con in ('彩印通接口供应商不认可')", ceErpTradeResponsible.tid);
  511. DataTable dt = DbHelper.DbConn.ExecuteDataset(numSql).Tables[0];
  512. int num = Convert.ToInt32(dt.Rows[0]["BackNum"]);
  513. if (num <= 1)
  514. {
  515. entity.AfterSaleState = 1;
  516. }
  517. else
  518. {
  519. entity.AfterSaleState = 5;
  520. }
  521. CeErpTradeAfterSaleExtend ceErpTradeAfterSaleExtend = CeErpTradeAfterSaleExtend.getByTid(entity.ctid);
  522. if (ceErpTradeAfterSaleExtend != null)
  523. {
  524. }
  525. else
  526. {
  527. ceErpTradeAfterSaleExtend = new CeErpTradeAfterSaleExtend();
  528. ceErpTradeAfterSaleExtend.tid = entity.ctid;
  529. ceErpTradeAfterSaleExtend.Create();
  530. }
  531. }
  532. if (entity.AfterSaleState == 4)
  533. {
  534. LogHelper.addLog(entity.tid, 0, "彩印通接口完成售后", 0, 3);
  535. if (entity.AfterSaleReason.IndexOf("设计") > 0 || entity.AfterSalePayment > 0)
  536. {
  537. LogHelper.addDesignerBillLog(entity.tid, 0, "彩印通接口售后取消设计费", "彩印通接口", 1);
  538. }
  539. ApiVo apiVo = new ApiVo();
  540. apiVo.orderNumber = entity.ctid;
  541. apiVo.actionName = "afterOver";
  542. designHelper.API_WorkCore(apiVo); //afterOver
  543. }
  544. entity.Update();
  545. returnSuccessMsg("操作成功!");
  546. CeErpSukuraData.createInfo(entity.ctid, 8);
  547. LogHelper.addLog(entity.ctid, 0, "彩印通接口供应商" + (st == 1 ? "认可" : ("不认可," + afmemo)), 0, 3);
  548. LogHelper.AddAfterSaleLog(entity.ctid, Convert.ToInt32(id), "彩印通接口供应商" + (st == 1 ? "认可" : "不认可"), 0, st == 1 ? 0 : 1, afmemo);
  549. return;
  550. }
  551. returnErrorMsg("找不到订单记录");
  552. }
  553. //http://47.114.150.226:88/Handler/apiCaiYingTong.ashx?t=getMergeOrders orderSn
  554. public void getMergeOrders()
  555. {
  556. string orderSn = GetString("orderSn");
  557. CeErpTradeCell ceErpTradeCell = CeErpTradeCell.GetByCode(orderSn);
  558. if (ceErpTradeCell == null)
  559. {
  560. ceErpTradeCell = CeErpTradeCell.GetByCtid(orderSn);
  561. }
  562. if (ceErpTradeCell == null)
  563. {
  564. returnErrorMsg("查无订单!");
  565. return;
  566. }
  567. if (ceErpTradeCell.SupplierId != 64)
  568. {
  569. returnErrorMsg("查无订单!");
  570. return;
  571. }
  572. CeErpTrade ceErpTrade = CeErpTrade.Get(ceErpTradeCell.tid);
  573. DataTable dt = commonHelper.getSameOrderList(ceErpTradeCell, ceErpTrade);
  574. if (dt != null && dt.Rows.Count > 1)
  575. {
  576. ReturnSuccess("{" + string.Format("\"data\":{0}", Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt)) + "}");
  577. return;
  578. }
  579. ReturnSuccess("{" + string.Format("\"data\":{0}", Utils.Serialization.JsonString.DataTable2MiniAjaxJson(new DataTable())) + "}");
  580. return;
  581. }
  582. public static string API_LogisticsOnlineSend(string orderid, string pCode, string comCode, string out_Sid)
  583. {
  584. if (string.IsNullOrWhiteSpace(orderid) || string.IsNullOrWhiteSpace(pCode) || string.IsNullOrWhiteSpace(comCode) || string.IsNullOrWhiteSpace(out_Sid))
  585. {
  586. return "参数不完整";
  587. }
  588. List<string> postLst = new List<string>();
  589. var res_obj = new
  590. {
  591. refOid = orderid,
  592. posCode = pCode,
  593. packages = new[]
  594. {
  595. new{ outSid=out_Sid,companyCode=comCode}
  596. }
  597. };
  598. string ro_json = JsonConvert.SerializeObject(res_obj);
  599. string res = apiHelper.Base_Request(ro_json, "ds.omni.erp.third.order.send");
  600. return res;
  601. }
  602. }
  603. }