OrderController.cs 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043
  1. using Microsoft.AspNetCore.Mvc;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Threading.Tasks;
  6. using XYY.Api.Order.Model.Order;
  7. using XYY.Common.Standard;
  8. using XYY.Core.Standard.Data.Infrastructure;
  9. using XYY.Core.Standard.Mvc;
  10. using XYY.Service.Standard.Order;
  11. using XYY.TaskTrack.Standard;
  12. using XYY.Model.Standard.Channel;
  13. using XYY.Service.Standard.ChannelApi.Base;
  14. using Dapper;
  15. using XYY.Authentication.Standard;
  16. using Microsoft.AspNetCore.Authorization;
  17. using XYY.Core.Standard.ExcelHelper.MSExcelHelper;
  18. using XYY.Model.Standard.Dto.order;
  19. using XYY.Service.Standard.ChannelApi.Itdida;
  20. using XYY.Data.Standard.Order;
  21. using XYY.Service.Standard.Channel;
  22. using static XYY.Service.Standard.Finance.Charging.Express.ExpressFeeChargesService;
  23. using XYY.Data.Standard.Channel;
  24. using System.IO;
  25. using XYY.Service.Standard.ChannelApi.Winit.LMAApi;
  26. using XYY.Model.Standard.Order;
  27. using static XYY.Service.Standard.ChannelApi.HangLe.Api;
  28. using System.Threading.Channels;
  29. using XYY.Model.Standard.Dto.Channel;
  30. using Antlr.Runtime.Misc;
  31. using Nest;
  32. using Microsoft.Extensions.Logging;
  33. using Newtonsoft.Json;
  34. using Microsoft.Extensions.Caching.Memory;
  35. using static Aliyun.OSS.Model.CreateSelectObjectMetaInputFormatModel;
  36. namespace XYY.Api.Order.Controllers
  37. {
  38. [Route("api/[controller]/[action]")]
  39. [ApiController]
  40. public class OrderController : ApiControllerBase
  41. {
  42. private IOrderService _orderService;
  43. private IMQManager _mQManager;
  44. private IUnitOfWork _unitOfWork;
  45. //private FiddlerClient _fiddlerClient;
  46. private IEnumerable<IBaseApi> _baseApis;
  47. private IOrderRepository _orderRepository;
  48. private IChannelService _channelService;
  49. ICustomerLazyService customerLazyService;
  50. private IMoreThanOneTicketService _mpsService;
  51. private IOrderGoodsRepository _orderGoodsRepository;
  52. private ILogistics_ChannelRepository _ChannelRepository;
  53. IOrder_OrderPrintQtyRepository _order_OrderPrintQtyRepository;
  54. Microsoft.Extensions.Caching.Distributed.IDistributedCache _distributed;
  55. IUser_CustomerDeclarationsRepository _CustomerDeclarationsRepository;
  56. private ILogger<UploadResult> _dataUpdateLogger;
  57. private IEnumerable<IManifestApi> _manifestApis;
  58. public OrderController(IOrderService orderService, IMQManager mQManager, IUnitOfWork unitOfWork
  59. //, FiddlerClient fiddlerClient
  60. , IEnumerable<IBaseApi> baseApis
  61. , IOrderRepository orderRepository, Microsoft.Extensions.Caching.Distributed.IDistributedCache distributed, IChannelService channelService, IMoreThanOneTicketService mpsService, IOrderGoodsRepository orderGoodsRepository, ILogistics_ChannelRepository channelRepository, IOrder_OrderPrintQtyRepository order_OrderPrintQtyRepository, ICustomerLazyService customerLazyService, ILogger<UploadResult> dataUpdateLogger, IUser_CustomerDeclarationsRepository customerDeclarationsRepository, IEnumerable<IManifestApi> manifestApis)
  62. {
  63. _orderService = orderService;
  64. _mQManager = mQManager;
  65. _unitOfWork = unitOfWork;
  66. //_fiddlerClient = fiddlerClient;
  67. _baseApis = baseApis;
  68. _orderRepository = orderRepository;
  69. _distributed = distributed;
  70. _channelService = channelService;
  71. _mpsService = mpsService;
  72. _orderGoodsRepository = orderGoodsRepository;
  73. _ChannelRepository = channelRepository;
  74. _order_OrderPrintQtyRepository = order_OrderPrintQtyRepository;
  75. this.customerLazyService = customerLazyService;
  76. _dataUpdateLogger = dataUpdateLogger;
  77. _CustomerDeclarationsRepository = customerDeclarationsRepository;
  78. _manifestApis = manifestApis;
  79. }
  80. public async Task<IActionResult> GetFP(FBRequest request)
  81. {
  82. ItdidaApi itdidaApi = new ItdidaApi(_orderRepository, _distributed);
  83. byte[] data = await itdidaApi.GetFP(request.Channel, request.TrackingNumber);
  84. string base64 = Convert.ToBase64String(data);
  85. return Ok(base64);
  86. }
  87. public async Task<IActionResult> GetK5FP(FPRequest request)
  88. {
  89. Service.Standard.ChannelApi.K5.Api k5 = new Service.Standard.ChannelApi.K5.Api(_order_OrderPrintQtyRepository);
  90. byte[] data = await k5.GetFP(request.Channel, request.order);
  91. string base64 = Convert.ToBase64String(data);
  92. return Ok(base64);
  93. }
  94. public async Task<IActionResult> GetDGFedexFP(FPRequest request)
  95. {
  96. Service.Standard.ChannelApi.ChinaPost.GatewayApi api = new Service.Standard.ChannelApi.ChinaPost.GatewayApi(_order_OrderPrintQtyRepository, _CustomerDeclarationsRepository);
  97. byte[] data = await api.GetFP(request.Channel, request.order);
  98. string base64 = Convert.ToBase64String(data);
  99. return Ok(base64);
  100. }
  101. public async Task<IActionResult> PostManifest()
  102. {
  103. var channels = await _channelService.CacheGetAllChannel();
  104. var pbchannels = channels.Where(x => x.ServiceCode == "PitneyBowes");
  105. foreach (var channel in pbchannels)
  106. {
  107. XYY.Service.Standard.ChannelApi.PitneyBowes.Api api = new Service.Standard.ChannelApi.PitneyBowes.Api();
  108. var result = await api.Manifest(channel);
  109. }
  110. return Ok();
  111. }
  112. public async Task<IActionResult> GetPBTracking(PBTrackingRequest request)
  113. {
  114. XYY.Service.Standard.ChannelApi.PitneyBowes.Api api = new Service.Standard.ChannelApi.PitneyBowes.Api();
  115. var response = await api.GetTracking(request.TrackingNumber, new Logistics_Channel());
  116. return Ok(response);
  117. }
  118. public async Task<IActionResult> ContainerManifest(ContainerManifestRequest request)
  119. {
  120. if (request.Details.Count == 0)
  121. throw new Exception("必须传入明细");
  122. XYY.Service.Standard.ChannelApi.PitneyBowes.Api api = new Service.Standard.ChannelApi.PitneyBowes.Api();
  123. var result = await api.ContainerManifest(request.BoxNumber, request.Port, request.Channel, request.Details);
  124. var data = Convert.FromBase64String(result.labelData);
  125. return File(data, "application/pdf");
  126. }
  127. public async Task<IActionResult> GetRemote()
  128. {
  129. Order_Order order = new Order_Order();
  130. order.ReceiverCity = "NORTH POLE";
  131. order.ReceiverState = "AK";
  132. order.ReceiverCountryCode = "US";
  133. order.ReceiverStreet = "3051 Victoria Circle";
  134. order.ReceiverPhone = "+19073478300";
  135. order.ReceiverZipCode = "99705";
  136. Logistics_Channel channel = await _ChannelRepository.GetAsync(583);
  137. ItdidaApi itdidaApi = new ItdidaApi(_orderRepository, _distributed);
  138. var c = await itdidaApi.GetRemote(channel, order);
  139. return Ok();
  140. }
  141. public async Task<IActionResult> GetTracking(TrackingRequest request)
  142. {
  143. XYY.Service.Standard.ChannelApi.PitneyBowes.Api api = new Service.Standard.ChannelApi.PitneyBowes.Api();
  144. var result = await api.GetTracking(request.TrackingNumber, request.Channel);
  145. return Ok(result);
  146. }
  147. public class StreeReplate
  148. {
  149. public string Ori
  150. {
  151. get; set;
  152. }
  153. public string Replete
  154. {
  155. get; set;
  156. }
  157. public string Stree1
  158. {
  159. get; set;
  160. }
  161. public string Stree2
  162. {
  163. get; set;
  164. }
  165. }
  166. public async Task<IActionResult> GetStreeReplate(List<String> souces)
  167. {
  168. List<StreeReplate> streeReplates = new List<StreeReplate>();
  169. foreach (var s in souces)
  170. {
  171. StreeReplate replate = new StreeReplate();
  172. replate.Ori = s;
  173. string r2 =
  174. s
  175. .ReplateExp("Road", "Rd")
  176. .ReplateExp("Street", "St")
  177. .ReplateExp("Drive", "Dr")
  178. .ReplateExp("Avenue", "Ave")
  179. .ReplateExp("Freeway", "Fwy")
  180. .ReplateExp("Alley", "Aly")
  181. .ReplateExp("apartment", "apt")
  182. .ReplateExp("Boulevard", "BLVD")
  183. .ReplateExp("north", "N")
  184. .ReplateExp("South", "S")
  185. .ReplateExp("west", "W")
  186. .ReplateExp("east", "E");
  187. replate.Replete = r2;
  188. replate.Stree1 = r2;
  189. if (r2.Length > 32)
  190. {
  191. if (r2.Split(' ').Count(x => string.Equals(x, "apt", StringComparison.OrdinalIgnoreCase)) >= 1)
  192. {
  193. replate.Stree1 = (r2.Substring(0, r2.IndexOf("apt", StringComparison.OrdinalIgnoreCase))).Trim();
  194. replate.Stree2 = (r2.Substring(r2.IndexOf("apt", StringComparison.OrdinalIgnoreCase))).Trim();
  195. }
  196. if (replate.Stree1.Length > 32 || replate.Stree2.Length > 32)
  197. {
  198. string[] addressList = XYY.Core.Standard.ExtendMethods.StringExtendMethods.ToArray2(r2, 32);
  199. replate.Stree1 = addressList[0].Trim();
  200. replate.Stree2 = addressList.Length > 1 ? addressList[1].Trim() : "";
  201. }
  202. }
  203. streeReplates.Add(replate);
  204. }
  205. System.Text.StringBuilder sb = new System.Text.StringBuilder();
  206. System.IO.StringWriter stringWriter = new System.IO.StringWriter(sb);
  207. CsvHelper.CsvWriter csvWriter = new CsvHelper.CsvWriter(stringWriter, System.Globalization.CultureInfo.InvariantCulture);
  208. csvWriter.WriteRecords(streeReplates);
  209. csvWriter.Dispose();
  210. System.IO.File.WriteAllText(@"d:\stree.csv", sb.ToString());
  211. return Ok();
  212. }
  213. public class TrackingRequest
  214. {
  215. public string TrackingNumber { get; set; }
  216. public Logistics_Channel? Channel { get; set; }
  217. }
  218. public class ContainerManifestRequest
  219. {
  220. public string BoxNumber
  221. {
  222. get; set;
  223. }
  224. public Logistics_Channel? Channel
  225. {
  226. get; set;
  227. }
  228. public List<string> Details
  229. {
  230. get; set;
  231. }
  232. public string Port
  233. {
  234. get; set;
  235. }
  236. }
  237. public async Task<IActionResult> GetUPSFee([FromBody] DataUploadRequest request)
  238. {
  239. var chanel = (await _channelService.CacheGetAllChannel()).Where(x => x.Id == 460).First();
  240. request.arg = new ExtendArg
  241. {
  242. Order = new XYY.Model.Standard.MpsOrder.Order_MpsOrder
  243. {
  244. Boxs = new List<XYY.Model.Standard.MpsOrder.Order_MpsOrderBox>
  245. {
  246. }
  247. }
  248. };
  249. int vweight = (int)Math.Round(request.order.Width * request.order.Length * request.order.Height / 9.0m, MidpointRounding.AwayFromZero);
  250. request.order.CustomerWeight = vweight > request.order.CustomerWeight ? vweight : request.order.CustomerWeight;
  251. request.arg.Order.Boxs.Add(new XYY.Model.Standard.MpsOrder.Order_MpsOrderBox
  252. {
  253. OpInputWeight = request.order.CustomerWeight / 1000.0m,
  254. OpLength = request.order.Length,
  255. OpHeight = request.order.Height,
  256. OpWidth = request.order.Width,
  257. Goods = new List<XYY.Model.Standard.MpsOrder.Order_MpsOrderGoods>
  258. {
  259. new XYY.Model.Standard.MpsOrder.Order_MpsOrderGoods
  260. {
  261. CnName = "试算",
  262. EnName="test",
  263. HsCode="000000000",
  264. Quantity=1
  265. }
  266. }
  267. });
  268. request.order.CustomerId = 698;
  269. XYY.Service.Standard.ChannelApi.dorje56.Api api = new Service.Standard.ChannelApi.dorje56.Api();
  270. var price = await api.SS(request.order, request.goods, chanel, request.arg);
  271. if (!string.IsNullOrEmpty(price.message))
  272. {
  273. throw new Exception(price.message);
  274. }
  275. bool IsResidential = price.warnings.Any(x => x.message.Contains("Ship To Address Classification is changed from Commercial to Residential"));
  276. string url = "http://api.smp.xingyunyi.cn/Compute";
  277. List<SMPCP> cp = new List<SMPCP>();
  278. cp.Add(new SMPCP
  279. {
  280. ZipCode = request.order.ReceiverZipCode,
  281. City = String.Empty,
  282. State = String.Empty,
  283. Stree = String.Empty,
  284. ComputeDate = DateTime.Now.ToString_yyyyMMdd(),
  285. CountryCode = request.order.ReceiverCountryCode,
  286. ExpenseItemId = 224,
  287. Length = request.order.Length.ToString(),
  288. Width = request.order.Width.ToString(),
  289. Height = request.order.Height.ToString(),
  290. GoodsDeclareValue = 0.ToString(),
  291. M3 = 0.ToString(),
  292. Port = "LAX",
  293. TrackingNumber = String.Empty,
  294. Weight = (request.order.CustomerWeight).ToString(),
  295. OrderQty = 1.ToString(),
  296. IsResidential = IsResidential,
  297. Zone = ""
  298. });
  299. RestSharp.RestClient client = new RestSharp.RestClient(url);
  300. RestSharp.RestRequest restRequest = new RestSharp.RestRequest(RestSharp.Method.POST);
  301. restRequest.AddJsonBody(cp.ToArray());
  302. var response = client.Execute(restRequest);
  303. if (response.StatusCode == System.Net.HttpStatusCode.OK)
  304. {
  305. var model = Newtonsoft.Json.JsonConvert.DeserializeObject<SMPCR>(response.Content);
  306. if (model.success)
  307. {
  308. var shopFee = model.data.FirstOrDefault(x => x.ExpenseName == "UPS运费");
  309. if (shopFee == null)
  310. return Error("未返回UPS运费");
  311. if (!shopFee.IsSuccess)
  312. return Error("运费计算失败:" + shopFee.Message);
  313. //原币种结算
  314. var fee = new
  315. {
  316. Fee = model.data.Sum(x => x.AmountinOriginalCurrency),
  317. FeeCurrency = model.data.FirstOrDefault().BillCurrency,
  318. Weight = Math.Ceiling(request.order.CustomerWeight / 453.59237m),
  319. WeightUnit = "磅",
  320. FeeDetail = model.data.Where(x => x.IsSuccess && x.AmountinOriginalCurrency > 0)
  321. .Select(x => new
  322. {
  323. x.ExpenseName,
  324. x.BillCurrency,
  325. Amountin = (decimal)Math.Round(x.AmountinOriginalCurrency, 4, MidpointRounding.AwayFromZero)
  326. })
  327. };
  328. return Ok(fee);
  329. }
  330. else
  331. {
  332. return Error(model.message);
  333. }
  334. }
  335. return Ok();
  336. }
  337. public async Task<IActionResult> GetUPSAddreeIsResidential([FromBody] DataUploadRequest request)
  338. {
  339. //州名处理
  340. XYY.Service.Standard.ChannelApi.dorje56.Api api = new Service.Standard.ChannelApi.dorje56.Api();
  341. var price = await api.SS(request.order, request.goods, request.channel, request.arg);
  342. if (price.success)
  343. {
  344. return Ok(price.warnings.Any(x => x.message.Contains("Ship To Address Classification is changed from Commercial to Residential")));
  345. }
  346. else
  347. {
  348. if (price.message == "无效的产品代码")
  349. {
  350. return Ok(true);
  351. }
  352. return Error("获取计费信息失败:" +
  353. price.message);
  354. }
  355. }
  356. public async Task<IActionResult> AsyncCustomerLastTrackingNumber()
  357. {
  358. var s = await customerLazyService.AsyncLastTrackingNumber();
  359. return Ok(s);
  360. }
  361. public async Task<IActionResult> AsyncCustomerFirstESBTracking()
  362. {
  363. var e = await customerLazyService.AsyncFirstESBTracking();
  364. return Ok(e);
  365. }
  366. [AllowAnonymous]
  367. [HttpGet]
  368. public async Task<IActionResult> TestOrderAddress()
  369. {
  370. string textRegext = @"^[A-Za-z0-9/\-,.&'<>() ]+$";
  371. System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(textRegext);
  372. string s = "asdfsadfasdf.,112312 -/&<>()";
  373. return Ok(new { soure = s, isok = r.IsMatch(s) });
  374. }
  375. [AllowAnonymous]
  376. [HttpGet]
  377. public async Task<IActionResult> TestOrderOperation()
  378. {
  379. var channel = await _unitOfWork.QueryBySqlAsync<Logistics_Channel>(" select top 100 * from Logistics_Channel(nolock) where Id=611 ");
  380. var order = await _unitOfWork.QueryBySqlAsync<Order_Order>(" select top 100 * from Order_Order(nolock) where Id=222712850 ");
  381. var goods = await _unitOfWork.QueryBySqlAsync<Order_OrderGoods>(" select * from Order_OrderGoods(nolock) where OrderId=222712850 ");
  382. var box = await _unitOfWork.QueryBySqlAsync<Logistics_Box>(" select * from Logistics_Box(nolock) where boxnumber='B231101007702' ");
  383. #region AMS
  384. Service.Standard.ChannelApi.VE.Api api = new Service.Standard.ChannelApi.VE.Api(_order_OrderPrintQtyRepository);
  385. //await api.CreateDeclaration(order.First(), goods.ToList(), channel.First());
  386. //await api.CancelDeclaration(channel.First().ApiHost,channel.First().ApiSecret, "XYYEX0030976426YQ");
  387. //await api.NewDeclaration(order.First(), goods.ToList(), channel.First());
  388. await api.PushBoxInfo(channel.First(), box.First(), 819);
  389. //await api.Association_BoxAndOrder(channel.First(), "B231030019402", "XYYEX0030976426YQ");
  390. //await api.GetChannelOrderInfo(channel.First(), "XYYEX0030976426YQ");
  391. #endregion
  392. //var baseApi = _baseApis.Where(x => x.ServiceName == channel.First().ServiceCode).FirstOrDefault();
  393. //await _orderService.DataUpload(order.First(), goods.ToList(), channel.First(), new ExtendArg() { });
  394. return Ok();
  395. }
  396. [AllowAnonymous]
  397. [HttpGet]
  398. public async Task<IActionResult> testDeAddress()
  399. {
  400. var channel = (await _unitOfWork.QueryBySqlAsync<Logistics_Channel>(" select top 100 * from Logistics_Channel(nolock) where Id=683 ")).FirstOrDefault();
  401. var order = (await _unitOfWork.QueryBySqlAsync<Order_Order>(" select top 100 * from Order_Order(nolock) where Id=223713094 ")).FirstOrDefault();
  402. var goods = await _unitOfWork.QueryBySqlAsync<Order_OrderGoods>(" select * from Order_OrderGoods(nolock) where OrderId=223713094 ");
  403. //需要测试的地址
  404. var deAddres = await _unitOfWork.QueryBySqlAsync<dynamic>(" select * from lzktemp_Veaddr20240102(nolock) where ''=isnull(是否成功,'') ");
  405. //强制使用测试环境
  406. channel.ApiHost = "https://app-sandbox.viaeurope.com"; channel.ApiSecret = "2a6c33e154f5ca571ac29584bbb248c4";
  407. Service.Standard.ChannelApi.VE.Api api = new Service.Standard.ChannelApi.VE.Api(_order_OrderPrintQtyRepository);
  408. foreach (var item in deAddres)
  409. {
  410. string result = "是"; string resultJson = string.Empty;
  411. try
  412. {
  413. order.ReceiverName = item.收件人;
  414. order.ReceiverPhone = ((string)item.收件人电话).Replace("'", "");
  415. order.ReceiverEmail = item.收件人邮箱;
  416. order.ReceiverState = item.收件人州;
  417. order.ReceiverCity = item.收件人城市;
  418. order.ReceiverStreet = item.收件人地址;
  419. order.CustomerWeight = Convert.ToInt32(item.客户重量);
  420. order.ReceiverZipCode = ((string)item.收件人邮编).PadLeft(5, '0');
  421. var resultInfo = await api.DataUpload(order, goods.ToList(), channel, new ExtendArg());
  422. resultJson = JsonConvert.SerializeObject(resultInfo);
  423. }
  424. catch (Exception ex)
  425. {
  426. result = "否"; resultJson = ex.Message;
  427. }
  428. await _unitOfWork.ExecuteAsync($" update lzktemp_Veaddr20240102 set 是否成功='{result}',执行结果=@resultJson where 客单号='{item.客单号}' ", new { resultJson = resultJson });
  429. }
  430. return Ok();
  431. }
  432. /// <summary>
  433. /// wms头程转运,推送ams箱子信息按钮,调用此方法
  434. /// </summary>
  435. /// <param name="boxId"></param>
  436. /// <returns></returns>
  437. public async Task<IActionResult> PushAMSBoxData(IEnumerable<int> boxId)
  438. {
  439. //渠道写死
  440. var channel = await _unitOfWork.QueryBySqlAsync<Logistics_Channel>(" select * from Logistics_Channel(nolock) where ServiceCode='VE' ");
  441. var box = await _unitOfWork.QueryBySqlAsync<AMSBox>($" select * from Logistics_Box(nolock) where Id in @boxId and ChannelId in @ChannelId and 0=ISNULL(IsAMSPost,0) ", null, new { boxId = boxId, ChannelId = channel.Select(x => x.Id) });
  442. if (box == null || box.Count() == 0) { return Ok(Tuple.Create<bool, string>(false, "箱子均不属于ams,或均已推送!请确认后提交!")); }
  443. var orders = await _unitOfWork.QueryBySqlAsync<Order_Order>(@" select distinct a.BoxNumber,c.* from Logistics_Box(nolock) a
  444. left join Logistics_BoxDetail(nolock) b on b.BoxId=a.Id
  445. left join Order_Order(nolock)c on c.id=b.orderId
  446. where a.Id in @boxId ", null, new { boxId = boxId });
  447. foreach (var item in box)
  448. {
  449. item.orders.AddRange(orders.Where(x => x.BoxNumber == item.BoxNumber));
  450. }
  451. var boxGroupChannelId = box.GroupBy(x => x.ChannelId);
  452. List<BagDeclareErrosResult> results = new List<BagDeclareErrosResult>();
  453. Tuple<bool, string> tuple = new Tuple<bool, string>(true, "推送成功");
  454. Service.Standard.ChannelApi.VE.Api api = new Service.Standard.ChannelApi.VE.Api(_order_OrderPrintQtyRepository);
  455. foreach (var item in boxGroupChannelId)
  456. {
  457. var tempBox = item.ToList();
  458. var result = await api.XYYPushBoxInfo(channel.Where(x => x.Id == item.Key).FirstOrDefault(), tempBox);
  459. if (result != null && result.Count > 0)
  460. {
  461. results.AddRange(result);
  462. //有失败的数据
  463. tempBox.RemoveAll(x => result.Select(y => y.BoxNumber).Contains(x.BoxNumber));
  464. }
  465. if (tempBox != null && tempBox.Count() > 0)
  466. {
  467. //更新推送成功标识
  468. await _unitOfWork.ExecuteAsync("update Logistics_Box set IsAMSPost=1 where Id in @id", new { id = tempBox.Select(x => x.Id) });
  469. }
  470. }
  471. if (results != null && results.Count > 0)
  472. {
  473. tuple = Tuple.Create<bool, string>(false, string.Join(",\r\n", results.Select(x => x.ErrorMessage)));
  474. }
  475. return Ok(tuple);
  476. }
  477. public async Task<IActionResult> DataUpload([FromBody] DataUploadRequest request)
  478. {
  479. return Ok(await _orderService.DataUpload(request.order, request.goods, request.channel, request.arg));
  480. }
  481. // #region Api调试代码
  482. // // 测试 DataUpload 接口后续
  483. // public async Task<IActionResult> TestDataUpload()
  484. // {
  485. // DataUploadRequest dataUploadRequest = new DataUploadRequest();
  486. // int order_orderId = 208273236;
  487. // dataUploadRequest.order = (_unitOfWork.QueryBySqlAsync<Order_Order>($"select *from Order_Order where Id={order_orderId}")).Result.FirstOrDefault();
  488. // dataUploadRequest.goods = (_unitOfWork.QueryBySqlAsync<Order_OrderGoods>($"select *from Order_OrderGoods where OrderId={order_orderId}")).Result.ToList();
  489. // dataUploadRequest.channel = (_unitOfWork.QueryBySqlAsync<Logistics_Channel>("select *from Logistics_Channel where Id=122")).Result.FirstOrDefault();
  490. // dataUploadRequest.arg = new ExtendArg();
  491. // UploadResult data1 = new UploadResult();
  492. // try
  493. // {
  494. // data1 = await _orderService.DataUpload(dataUploadRequest.order, dataUploadRequest.goods, dataUploadRequest.channel, dataUploadRequest.arg);
  495. // }
  496. // catch (Exception ex)
  497. // {
  498. // }
  499. // //测试 DrawPdfLabel 接口后续
  500. // var baseApi = _baseApis.Where(x => x.ServiceName == dataUploadRequest.channel.ServiceCode).FirstOrDefault();
  501. // try
  502. // {
  503. // var data2 = baseApi.DrawPdfLabel(data1, dataUploadRequest.channel, dataUploadRequest.order, dataUploadRequest.goods);
  504. // return Ok(data2);
  505. // }
  506. // catch (Exception ex)
  507. // {
  508. // throw ex;
  509. // }
  510. // }
  511. public async Task<IActionResult> AutoCancelOrder()
  512. {
  513. string sql = @"select a.Id,a.OrderId Order_OrderId,a.TrackingNumber,a.SystemNo,b.ServiceCode,b.PublicName,b.ApiHost,b.ApiKey,b.ApiSecret,a.ServicesOrderNo,a.ServiceOrderNumber3
  514. from Logistics_RepleatChannelRecord a
  515. join Logistics_Channel b on b.Id=a.ChannelId
  516. where a.CancelState=0
  517. union
  518. select a.Id,a.OrderId Order_OrderId,a.TrackingNumber,a.SystemNo,b.ServiceCode,b.PublicName,b.ApiHost,b.ApiKey,b.ApiSecret,a.ServicesOrderNo,a.ServiceOrderNumber3
  519. from Logistics_RepleatChannelRecord a
  520. join Logistics_Channel b on b.Id=a.ChannelId
  521. where a.CancelState=500 and ExecutionCount<3 ";
  522. List<logistics_ChannelCancel> logistics_ChannelCancels = (await _unitOfWork.QueryBySqlAsync<logistics_ChannelCancel>(sql)).ToList();
  523. foreach (var item in logistics_ChannelCancels)
  524. {
  525. try
  526. {
  527. var baseApi = _baseApis.Where(x => x.ServiceName == item.ServiceCode).FirstOrDefault();
  528. await baseApi.CannelOrdersByModel(item);
  529. item.UpdateTime = DateTime.Now;
  530. item.ResultState = ResultStateEnum.成功.GetValue();
  531. item.ResultMessage = "成功";
  532. }
  533. catch (Exception ex)
  534. {
  535. if (ex is NotImplementedException) { item.ResultState = ResultStateEnum.成功.GetValue(); item.ResultMessage = ex.Message; }
  536. else { item.ResultState = ResultStateEnum.异常.GetValue(); item.ResultMessage = ex.Message; }
  537. continue;//异常进行下一个,记录以数据表为准
  538. }
  539. }
  540. //对数据做批量更新
  541. string updateSql = " Update Logistics_RepleatChannelRecord set CancelState=@ResultState,ExecutionCount=ExecutionCount+1,ResultMessage=@ResultMessage where Id =@Id ";
  542. await _unitOfWork.ExecuteAsync(updateSql, logistics_ChannelCancels);
  543. return Ok();
  544. }
  545. public async Task<IActionResult> TestGetLabel()
  546. {
  547. //XYY.Service.Standard.ChannelApi.WeaShip.Api api = new Service.Standard.ChannelApi.WeaShip.Api(null);
  548. //byte[] data = await api.DrawPdfLabel(new UploadResult { ServiceOrderNumber = "WEAIT1092000002YQ" },
  549. // _channelService.CacheGetAllChannel().Result.ToList().First(x => x.Id == 637), null, null);
  550. //System.IO.File.WriteAllBytes(@"E:\1.pdf", data);
  551. return Ok();
  552. }
  553. //测试 CannelOrdersByModel
  554. public async Task<IActionResult> TestCannelOrdersByModel(List<string> SysmteNos)
  555. {
  556. string sql = @$"select a.Id Order_OrderId,a.TrackingNumber,a.SystemNo,b.ServiceCode,b.PublicName,b.ApiHost,b.ApiKey,b.ApiSecret,28256 OperationUserId,'{DateTime.Now}' CreateTime,'刘正凯' CreateUserName,'刘正凯' UpdateUserName,a.ServicesOrderNo,a.ServiceOrderNumber3 from Order_Order a
  557. join Logistics_Channel b on b.Id=a.ChannelId
  558. where a.SystemNo in @SystemNo or a.TrackingNumber in @SystemNo or a.TransferNumber in @SystemNo ";//小于三或者等于四,才可以取消
  559. List<logistics_ChannelCancel> logistics_ChannelCancels = (await _unitOfWork.QueryBySqlAsync<logistics_ChannelCancel>(sql, null,
  560. new { SystemNo = SysmteNos })).ToList();
  561. foreach (var item in logistics_ChannelCancels)
  562. {
  563. try
  564. {
  565. var baseApi = _baseApis.Where(x => x.ServiceName == item.ServiceCode).FirstOrDefault();
  566. await baseApi.CannelOrdersByModel(item);
  567. item.UpdateTime = DateTime.Now;
  568. }
  569. catch (Exception ex)
  570. {
  571. item.ResultState = ResultStateEnum.异常.GetValue(); item.ResultMessage = ex.Message;
  572. continue;//异常进行下一个,记录以数据表为准
  573. }
  574. }
  575. return Ok();
  576. }
  577. // #endregion
  578. public async Task<IActionResult> DrawPdfLabel(DrawPdfLabelRequest request)
  579. {
  580. return Ok(await _orderService.DrawPdfLabel(request.result, request.channel, request.order, request.goods));
  581. }
  582. public async Task<IActionResult> AsyncServiceTrackingNumber(int qty)
  583. {
  584. return Ok(await _orderService.AsyncServiceTrackingNumber(qty));
  585. }
  586. public class CancenOrderDto
  587. {
  588. public List<string> SysmteNos
  589. {
  590. get; set;
  591. }
  592. }
  593. public async Task<IActionResult> CancelOrders(CancenOrderDto cancenOrderDto)
  594. {
  595. var c = await _ChannelRepository.GetAsync(398);
  596. await _orderService.CancelOrders(cancenOrderDto.SysmteNos, c);
  597. return Ok();
  598. }
  599. public async Task<IActionResult> CancelOrdersByNoStr(CancenOrderDto cancenOrderDto)
  600. {
  601. cancenOrderDto.SysmteNos.RemoveAll(x => string.IsNullOrEmpty(x));
  602. await _mQManager.Publish<CancelOrderJobMessage>(
  603. new CancelOrderJobMessage
  604. {
  605. SysmteNos = cancenOrderDto.SysmteNos,
  606. UserId = _unitOfWork.CurrentId ?? 0,
  607. UserName = _unitOfWork.CurrentName,
  608. CreateTime = DateTime.Now
  609. }, null);
  610. //await _orderService.CancelOrdersByNoStr(cancenOrderDto.SysmteNos);
  611. var returnList = await _orderService.GetPackingOrderId(cancenOrderDto.SysmteNos);
  612. return Ok(returnList);
  613. }
  614. public async Task<IActionResult> AddZZEUBOrder(string ladingNumber)
  615. {
  616. await _mQManager.Publish(new AddHNJobMessage { LadingNumber = ladingNumber }, null);
  617. return Ok();
  618. }
  619. public async Task<IActionResult> GetZZEUBOrder(string ladingNumber)
  620. {
  621. var data = await _orderService.GetZZESBUpdateData(ladingNumber);
  622. return Ok(data);
  623. }
  624. public async Task<IActionResult> OrderDeclare(List<Order_Order> orders)
  625. {
  626. string batchNo = DateTime.Now.ToString("CAyyyyMMddHHmmss");
  627. XYY.Service.Standard.ChannelApi.UBI.Api api = new Service.Standard.ChannelApi.UBI.Api(null);
  628. int batchQty = 40;
  629. int qty = (int)Math.Ceiling(orders.Count() / 40.0);
  630. var channel = await _ChannelRepository.GetAsync(581);
  631. int start = 5;
  632. List<BagDeclareErrosResult> bagDeclareErros = new List<BagDeclareErrosResult>();
  633. for (int i = 0; i < qty; i++)
  634. {
  635. string boxNumber = "Box" + batchNo + (start + i + 1);
  636. var declareList = orders.Skip(i * 40).Take(40).ToList();
  637. var err = await api.Declare(declareList.Select(x => x.TrackingNumber).ToList(), declareList.Sum(y => y.ActualWeight.Value) / 1000.0m,
  638. batchNo, boxNumber, channel.ServiceChannelCode, channel);
  639. bagDeclareErros.AddRange(err);
  640. }
  641. return Ok(bagDeclareErros);
  642. }
  643. /// <summary>
  644. ///
  645. /// </summary>
  646. /// <param name="channelId"></param>
  647. /// <returns></returns>
  648. [ActionName("ConfimOrders")]
  649. public async Task<IActionResult> ConfimOrders(int qty = 100)
  650. {
  651. List<OrderConfimResult> cq = new List<OrderConfimResult>();
  652. await _orderService.OrderConfim(qty);
  653. return Ok();
  654. }
  655. [HttpPost]
  656. [AllowAnonymous]
  657. public async Task<IActionResult> ConfimChannelOrders(ConfimChannelOrderParam param)
  658. {
  659. List<string> numbers = param.TrackingNumbers;
  660. string channelServiceCode = param.ChannelServiceCode;
  661. await _orderService.ConfimChannelOrders(numbers, channelServiceCode);
  662. return Ok();
  663. }
  664. [HttpPost]
  665. [AllowAnonymous]
  666. public async Task<IActionResult> ConfimChannelOrdersByBox(ConfimChannelOrderParamByBox param)
  667. {
  668. List<int> boxIds = param.BoxIds;
  669. await _orderService.ConfimChannelOrdersByBox(boxIds);
  670. return Ok();
  671. }
  672. [ActionName("BagConfim")]
  673. public async Task<IActionResult> BagConfim()
  674. {
  675. await _orderService.BagConfim();
  676. return Ok();
  677. }
  678. [ActionName("BagConfimWithAwb")]
  679. [HttpGet]
  680. public async Task<IActionResult> BagConfimWithAwb(string awb)
  681. {
  682. await _orderService.BagConfimWithAwb(awb);
  683. return Ok();
  684. }
  685. [HttpGet]
  686. [ActionName("BagConfimWithBoxNumber")]
  687. public async Task<IActionResult> BagConfimWithBoxNumber(string boxNumber)
  688. {
  689. await _orderService.BagConfimWithBoxNumber(boxNumber);
  690. return Ok();
  691. }
  692. [ActionName("CannelOrderByNumber")]
  693. public async Task<IActionResult> CannelOrderByNumber(string systemNo)
  694. {
  695. List<string> orders = new List<string> { systemNo };
  696. var data = await _orderService.CancelOrdersByNoStr(orders);
  697. return Ok(data);
  698. }
  699. public async Task<IActionResult> TestConfimOrder()
  700. {
  701. XYY.Service.Standard.ChannelApi.IMG.Api api = new Service.Standard.ChannelApi.IMG.Api();
  702. //await api.Confims(new List<string>(), await _ChannelRepository.GetAsync(500));
  703. return Ok();
  704. }
  705. [ActionName("CustomerConfim")]
  706. public async Task<IActionResult> CustomerConfim(int qty = 100)
  707. {
  708. await _orderService.CustomerConfim(qty);
  709. return Ok();
  710. }
  711. /// <summary>
  712. /// 获取预报日志
  713. /// </summary>
  714. /// <param name="queryModel"></param>
  715. /// <returns></returns>
  716. public async Task<IActionResult> GetBagDeclareLogs(QueryModel queryModel)
  717. {
  718. var result = await _orderService.GetBagDeclareLogs(queryModel);
  719. return Ok(result);
  720. }
  721. public class BagApiRequset
  722. {
  723. public string laddingBillNumber { get; set; }
  724. public string serviceCode
  725. {
  726. get; set;
  727. }
  728. }
  729. [HttpPost]
  730. /// <summary>
  731. /// 获取预报日志
  732. /// </summary>
  733. /// <param name="queryModel"></param>
  734. /// <returns></returns>
  735. public async Task<IActionResult> GetBagDeclareError(BagApiRequset bagApiRequset)
  736. {
  737. var result = await _orderService.GetBagDeclareError(bagApiRequset.laddingBillNumber, bagApiRequset.serviceCode);
  738. return Ok(result);
  739. }
  740. [HttpPost]
  741. public async Task<IActionResult> JTTest()
  742. {
  743. var api = new XYY.Service.Standard.ChannelApi.JiTu.Api();
  744. var obj = new
  745. {
  746. customerid = "SJ00021560",
  747. country = "US"
  748. };
  749. string json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
  750. var msg = api.Send("9e3e3ff4f1193880f3dc3527c6c68e19", "LangTian", json, "OBTAINTRANSPORT", "https://api.yl-scm.com/yunlu-order-web/baseData/baseDataAction!findTransportList.action");
  751. return Ok(msg);
  752. }
  753. [HttpPost]
  754. /// <summary>
  755. /// 提单号重新申报
  756. /// </summary>
  757. /// <param name="laddingBillNumber"></param>
  758. /// <returns></returns>
  759. public async Task<IActionResult> ReBagDeclare(BagApiRequset bagApiRequset)
  760. {
  761. await _orderService.ReBagDeclare(bagApiRequset.laddingBillNumber, bagApiRequset.serviceCode);
  762. return Ok();
  763. }
  764. public async Task<IActionResult> UpdateLoadOrder()
  765. {
  766. var filelist = (await Request.ReadFormAsync()).Files;
  767. if (filelist != null && filelist.Count > 0)
  768. {
  769. var file = filelist[0];
  770. await _orderService.THInputOrder(file.OpenReadStream());
  771. return Ok();
  772. }
  773. else
  774. {
  775. return Error("请上传一个文件");
  776. }
  777. }
  778. public async Task<IActionResult> ImportPPXFba()
  779. {
  780. var filelist = (await Request.ReadFormAsync()).Files;
  781. if (filelist != null && filelist.Count > 0)
  782. {
  783. var file = filelist[0];
  784. await _orderService.ImportPPXFba(file.OpenReadStream());
  785. return Ok();
  786. }
  787. else
  788. {
  789. return Error("请上传一个文件");
  790. }
  791. }
  792. public async Task<IActionResult> QueryOverCancelOrders(QueryModel queryModel)
  793. {
  794. return Ok(await _orderService.QueryOverCancelOrders(queryModel));
  795. }
  796. [HttpPost]
  797. public async Task<IActionResult> GetIBBagLabels(GetIBBagLabelParam param)
  798. {
  799. List<int> boxIds = param.BoxIds;
  800. try
  801. {
  802. var labelDatas = await _orderService.GetIBBagLabel(boxIds);
  803. if (labelDatas == null)
  804. {
  805. return Error("获取大包面单失败,无面单数据,请查看记录");
  806. }
  807. else if (labelDatas.Any(i => i.Success))
  808. {
  809. var successLabels = labelDatas.Where(i => i.Success).Select(i => i.LabelContent);
  810. return Ok(successLabels);
  811. }
  812. else
  813. {
  814. string msg = string.Join(",", labelDatas.Select(i => i.Message));
  815. return Ok($"获取大包面单全部失败,请查看记录:{msg}");
  816. }
  817. }
  818. catch (Exception ex)
  819. {
  820. return Error($"获取大包面单失败:{ex.Message}");
  821. }
  822. }
  823. public async Task<IActionResult> CancelIBBagLabel(CancelIBBagLabelParam param)
  824. {
  825. await _orderService.CancelIBBagLabel(param.BoxIds);
  826. return Ok();
  827. }
  828. [HttpPost]
  829. public async Task<IActionResult> GetOrderPager(QueryModel queryModel)
  830. {
  831. var result = await _orderService.GetOrderPager(queryModel);
  832. return Ok(result);
  833. }
  834. [HttpPost]
  835. public async Task<IActionResult> GetOrderQty(QueryModel qm)
  836. {
  837. var u = User.GetUserContent();
  838. var first = qm.QueryParamer.Where(x => x.Filed == "OrderStatus").FirstOrDefault();
  839. if (first != null)
  840. {
  841. qm.QueryParamer.Remove(first);
  842. }
  843. var list = await _orderService.GetOrderQty(qm);
  844. return Ok(list);
  845. }
  846. public async Task<IActionResult> Get(int Id)
  847. {
  848. var result = await _orderService.Get(Id);
  849. return Ok(result);
  850. }
  851. public async Task<IActionResult> GetCustomerDraftOrder(int id)
  852. {
  853. var order = await _orderService.GetCustomerDraftOrder(id);
  854. return Ok(order);
  855. }
  856. [AllowAnonymous]
  857. public async Task<IActionResult> OutData(QueryModel queryModel)
  858. {
  859. var u = User.GetUserContent();
  860. var list = await _orderService.GetCustomerOrderList(queryModel);
  861. var ms = new MSExcelHelper();
  862. var data = ms.OutDataAsByte<OutDataInfo, CustomerOrder>(list);
  863. var utc = DateTime.Now.ToFileTimeUtc();
  864. return File($"{utc}.xlsx", data);
  865. }
  866. public class OutDataInfo : MSExcelClassMapping<CustomerOrder>
  867. {
  868. public OutDataInfo()
  869. {
  870. Map(x => x.CustomerOrderNo).Name("客户单号");
  871. Map(x => x.SaelOrderNo).Name("平台订单号");
  872. Map(x => x.TrackingNumber).Name("服务商单号");
  873. Map(x => x.TransferNumber).Name("行运易单号");
  874. Map(x => x.ReceiverCountryCode).Name("国家/地区");
  875. Map(x => x.CreateTime).Name("下单时间");
  876. Map(x => x.ReceiveTime).Name("称重时间");
  877. Map(x => x.CustomerWeight).Name("下单重");
  878. Map(x => x.OPWeight).Name("计费重");
  879. Map(x => x.Quantity).Name("件数");
  880. Map(x => x.CFright).Name("预计费用");
  881. Map(x => x.ChannelName).Name("产品名称");
  882. Map(x => x.ReceiverName).Name("收件人");
  883. Map(x => x.ReceiverState).Name("收件人省份");
  884. Map(x => x.ReceiverCity).Name("收件人城市");
  885. Map(x => x.ReceiverStreet).Name("收件人地址");
  886. Map(x => x.House).Name("收件人门牌号");
  887. Map(x => x.ReceiverZipCode).Name("收件人邮编");
  888. Map(x => x.ReceiverPhone).Name("收件人电话");
  889. Map(x => x.ioss).Name("含IOSS");
  890. Map(x => x.LatestLogisticsStatus).Name("最新物流状态");
  891. Map(x => x.LastMessage).Name("最新物流信息");
  892. Map(x => x.LatestLogisticsTime).Name("最新物流时间");
  893. }
  894. }
  895. [AllowAnonymous]
  896. [HttpPost]
  897. public async Task<IActionResult> TestMps()
  898. {
  899. var mpsOrder = await _mpsService.Get(220222937, 0);
  900. if (mpsOrder == null)
  901. {
  902. return Ok();
  903. }
  904. var orders = await _orderRepository.QueryAsync(i => i.CustomerOrderNo == mpsOrder.CustomerOrderNumber);
  905. var order = orders.FirstOrDefault();
  906. var orderGoods = await _orderGoodsRepository.QueryAsync(i => i.OrderId == order.Id);
  907. var channel = await _ChannelRepository.GetAsync(493);
  908. ExtendArg arg = new ExtendArg { Order = mpsOrder };
  909. var result = await _orderService.DataUpload(order, orderGoods.ToList(), channel, arg);
  910. return Ok(result);
  911. }
  912. [AllowAnonymous]
  913. [HttpPost]
  914. [HttpGet]
  915. public async Task<IActionResult> TestWinitChangeWeight(string serviceNumber, int weight)
  916. {
  917. LMAApi lma = new LMAApi(_orderRepository);
  918. //throw new Exception("");
  919. var result = lma.BagDeclare(new XYY.Model.Standard.Order.BagDeclareRequest
  920. {
  921. BatchDeclare = new Dictionary<string, List<XYY.Model.Standard.Order.BoxDetailItem>>
  922. {
  923. { "test",new List<XYY.Model.Standard.Order.BoxDetailItem>{
  924. new XYY.Model.Standard.Order.BoxDetailItem{ ServiceNo = serviceNumber, ActualWeight = weight
  925. } }
  926. }
  927. }
  928. });
  929. return Ok(result);
  930. }
  931. /// <summary>
  932. /// 订单确认 推送
  933. /// </summary>
  934. /// <remarks>目前仅万邑通和派送翼有此服务</remarks>
  935. /// <returns></returns>
  936. public async Task<IActionResult> ChannelManifest([FromBody] DataUploadRequest request)
  937. {
  938. ApiJsonModel apiJsonModel = new ApiJsonModel();
  939. var baseApi = _manifestApis.Where(x => x.ServiceName == request.channel.ServiceCode).FirstOrDefault();
  940. if (baseApi == null)
  941. {
  942. apiJsonModel.code = System.Net.HttpStatusCode.InternalServerError;
  943. apiJsonModel.success = false;
  944. apiJsonModel.message = "订单对应的产品,未找到相关的API服务";
  945. }
  946. else
  947. {
  948. try
  949. {
  950. string result = await baseApi.ManifestPush(new ManifestParam() { Order = request.order, Channel = request.channel });
  951. apiJsonModel.code = System.Net.HttpStatusCode.OK;
  952. apiJsonModel.success = true;
  953. apiJsonModel.message = result;
  954. }
  955. catch (Exception ex)
  956. {
  957. apiJsonModel.code = System.Net.HttpStatusCode.InternalServerError;
  958. apiJsonModel.success = false;
  959. apiJsonModel.message = ex.Message;
  960. }
  961. }
  962. return Ok(apiJsonModel);
  963. }
  964. }
  965. }