diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 67d1c7f8..ed47ad7e 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -1046,6 +1046,82 @@ namespace Myshipping.Application await SendBookingOrder(new long[] { order.Id }); } + /// + /// 在订舱台账保存单证备注、操作备注等功能 + /// + /// + /// + [HttpPost("/BookingOrder/SaveDataInList"), AllowAnonymous] + public async Task SaveDataInList(JObject obj) + { + if (!obj.ContainsKey("Id")) + { + throw Oops.Bah("参数有误,没有Id"); + } + + var id = obj.GetLongValue("Id"); + + var order = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == id); + if (order == null) + { + throw Oops.Bah("订舱数据不存在"); + } + + //判断权限,返回null表示有全部权限 + List userlist = await _right.GetDataScopeList(MenuConst.MenuBookingOrder, true); + if (userlist != null && !userlist.Contains(UserManager.UserId)) + { + throw Oops.Bah("无权修改"); + } + + var orderCompare = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == id); + + var propsOrder = typeof(BookingOrder).GetProperties(); + foreach (var property in obj) + { + var propNameLower = property.Key.ToLower(); + var propOrd = propsOrder.FirstOrDefault(p => p.Name.ToLower() == propNameLower); + if (propOrd != null) + { + if (propOrd.PropertyType == typeof(string)) + { + propOrd.SetValue(order, obj.GetStringValue(property.Key)); + } + else if (propOrd.PropertyType == typeof(int) || propOrd.PropertyType == typeof(int?)) + { + propOrd.SetValue(order, obj.GetIntValue(property.Key)); + } + else if (propOrd.PropertyType == typeof(long) || propOrd.PropertyType == typeof(long?)) + { + propOrd.SetValue(order, obj.GetLongValue(property.Key)); + } + else if (propOrd.PropertyType == typeof(DateTime) || propOrd.PropertyType == typeof(DateTime?)) + { + propOrd.SetValue(order, obj.GetDateTimeValue(property.Key)); + } + else if (propOrd.PropertyType == typeof(bool) || propOrd.PropertyType == typeof(bool?)) + { + propOrd.SetValue(order, obj.GetBooleanValue(property.Key)); + } + else if (propOrd.PropertyType == typeof(decimal) || propOrd.PropertyType == typeof(decimal?)) + { + propOrd.SetValue(order, obj.GetDecimalValue(property.Key)); + } + } + } + + JsonUtil.PropToUpper(order, "ORDNO", "BSSTATUS", "YARDID", "YardContract", "YardContractTel", "YardContractEmail", "MARKS", "DESCRIPTION", "CONSIGNEENAME", "SHIPPERNAME", "NOTIFYPARTYNAME", "DZRemark", "CZRemark"); + + order.VERSION = Guid.NewGuid().ToString(); + await _rep.UpdateAsync(order); + + //记录修改日志 + await SaveLog(order, orderCompare); + + //推送东胜 + await SendBookingOrder(new long[] { order.Id }); + } + /// /// 删除订舱 /// @@ -1884,7 +1960,7 @@ namespace Myshipping.Application } - + #endregion #region 放舱(入货通知) @@ -1987,7 +2063,8 @@ namespace Myshipping.Application public async Task SendLetterYard(long bookingId) { var entity = _repLetterYard.AsQueryable().Filter(null, true).First(x => x.BookingId == bookingId); - if (entity!=null) { + if (entity != null) + { var json = entity.ToJsonString(); try { @@ -2020,7 +2097,7 @@ namespace Myshipping.Application } } - + return null; } @@ -7384,6 +7461,8 @@ namespace Myshipping.Application var rtn = await GetYardDataAndMappingSystem(order, false); await _repCtn.DeleteAsync(x => x.BILLID == bookId); + _logger.LogInformation($"{bookId}({order.MBLNO})的箱封号自动引入获取场站数据:{rtn.ToJsonString()}"); + foreach (var item in rtn) { var ctn = new BookingCtn(); @@ -7404,6 +7483,7 @@ namespace Myshipping.Application await _repCtn.InsertAsync(ctn); } + _logger.LogInformation($"{bookId}({order.MBLNO})的箱封号自动引入完成"); } @@ -7755,9 +7835,9 @@ namespace Myshipping.Application [NonAction] public async Task SendBookingOrder(long[] ids) { - var itemcode = App.Configuration["ITEMCODE"].ToString() ; - var BookingOrderMQUri= App.Configuration["SendBookingOrderMQUri"]; - _logger.LogInformation("订舱数据回推地址:" + BookingOrderMQUri+ itemcode); + var itemcode = App.Configuration["ITEMCODE"].ToString(); + var BookingOrderMQUri = App.Configuration["SendBookingOrderMQUri"]; + _logger.LogInformation("订舱数据回推地址:" + BookingOrderMQUri + itemcode); if (!string.IsNullOrEmpty(itemcode) && itemcode == "True") { if (ids.Count() == 0)