diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 8a9daa37..364d06fd 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -987,7 +987,7 @@ namespace Myshipping.Application { if (App.Configuration["ServiceStatusOpenAuto"] == "1") { - await SetGoodsStatusCancel("YDC",Id); + await SetGoodsStatusCancel("YDC", Id); await SetBookingOrderGoodsStatus(Id); } @@ -9061,10 +9061,10 @@ HLCUTA12307DPXJ3 以这票为例 6个柜 /// /// 提箱小票CMA /// - /// + /// /// [HttpPost("/BookingOrder/SaveBookingTxxp")] - public async Task SaveBookingTxxp(string Ids) + public async Task SaveBookingTxxp(long Id) { //获取url var url = _cache.GetAllDictData().Result.Where(x => x.TypeCode == "bookingTxxpUrl").Select(x => x.Value).FirstOrDefault(); @@ -9074,71 +9074,82 @@ HLCUTA12307DPXJ3 以这票为例 6个柜 { throw Oops.Bah(BookingErrorCode.BOOK119); } - var arr = Ids.Split(","); - if (arr.Count() > 0) + + + + var order = _rep.FirstOrDefault(x => x.Id == Id); + //条件判断 目前只支持CMA 的数据 + if (order.CARRIERID != "CMA") { - foreach (var ar in arr) + throw Oops.Bah("船公司目前只支持CMA"); + } + if (string.IsNullOrEmpty(order.VESSEL)) + { + throw Oops.Bah("船名不能为空"); + } + if (string.IsNullOrEmpty(order.MBLNO)) + { + throw Oops.Bah("船名不能为空"); + } + var json = new + { + custname = "DJY", + custpsw = "123", + username = ytAcc.Account, + password = ytAcc.Password, + company = "CMA", + vessel = order.VESSEL + }.ToJsonString(); + BookingExtendState extends = new BookingExtendState(); + var rtn = await url.SetBody(json).PostAsStringAsync(); + JObject jobjRtn = JObject.Parse(rtn); + var status = jobjRtn.GetValue("status").ToString(); + if (status != "1") + { + //不等于1 返回结果错误 + throw Oops.Bah(jobjRtn.GetValue("message").ToString()); + } + else + { + var jarrData = jobjRtn.GetValue("message") as JArray; + foreach (JObject item in jarrData) { - long Id = Convert.ToInt64(ar); - var order = _rep.FirstOrDefault(x => x.Id == Id); - //条件判断 目前只支持CMA 的数据 - if (order.CARRIERID != "CMA") - { - throw Oops.Bah("船公司目前只支持CMA"); - } - if (string.IsNullOrEmpty(order.VESSEL)) + //订舱号(单号) + var mb = item.GetStringValue("bookingno"); //提单号 + if (mb == order.MBLNO) { - throw Oops.Bah("船名不能为空"); - } - if (string.IsNullOrEmpty(order.MBLNO)) - { - throw Oops.Bah("船名不能为空"); - } - var json = new - { - custname = "DJY", - custpsw = "123", - username = ytAcc.Account, - password = ytAcc.Password, - company = "CMA", - vessel = order.VESSEL - }.ToJsonString(); - var rtn = await url.SetBody(json).PostAsStringAsync(); - JObject jobjRtn = JObject.Parse(rtn); - var status = jobjRtn.GetValue("status").ToString(); - if (status != "1") - { - ///不等于1 返回结果错误 - throw Oops.Bah(jobjRtn.GetValue("message").ToString()); - } - else - { - var jarrData = jobjRtn.GetValue("message") as JArray; - foreach (JObject item in jarrData) - { - //订舱号(单号) - var mb = item.GetStringValue("bookingno"); //提单号 - if (mb == order.MBLNO) - { - var noApply = item.GetIntValue("noApply"); //未申请 - var applyNoPrint = item.GetIntValue("applyNoPrint"); //已申请未打印 - var print = item.GetIntValue("print"); //已打印 - await _repextendstate.InsertAsync(new BookingExtendState - { - bookingId = Id, - noApply = noApply, - applyNoPrint = applyNoPrint, - print = print - }); - } + var noApply = item.GetIntValue("noApply"); //未申请 + var applyNoPrint = item.GetIntValue("applyNoPrint"); //已申请未打印 + var print = item.GetIntValue("print"); //已打印 + extends = _repextendstate.FirstOrDefault(x => x.bookingId == Id); + if (extends == null) + { + extends.bookingId = Id; + extends.noApply = noApply; + extends.applyNoPrint = applyNoPrint; + extends.print = print; + await _repextendstate.InsertAsync(extends); } - } + else + { + extends.noApply = noApply; + extends.applyNoPrint = applyNoPrint; + extends.print = print; + await _repextendstate.AsUpdateable(extends).IgnoreColumns().ExecuteCommandAsync(); + } + } } } + + + return extends; + + + }