diff --git a/Myshipping.Application/Entity/BookingOrder.cs b/Myshipping.Application/Entity/BookingOrder.cs index af43b196..59b39bc6 100644 --- a/Myshipping.Application/Entity/BookingOrder.cs +++ b/Myshipping.Application/Entity/BookingOrder.cs @@ -18,6 +18,7 @@ namespace Myshipping.Application.Entity /// /// 业务状态 /// + [Description("业务状态")] public string BSSTATUS { get; set; } /// /// 业务状态名称 diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index eddb36af..46f732d2 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -204,24 +204,29 @@ namespace Myshipping.Application { JsonUtil.PropToUpper(input, "ORDNO", "BSSTATUS", "YardContract", "YardContractTel", "YardContractEmail"); JsonUtil.TrimFields(input); - ////// - var groupList = input.ctnInputs.Where(x => x.CTNNUM > 0).GroupBy(c => c.CTNALL).Select(g => $"{g.Key}*{g.Sum(gg => gg.CTNNUM)}"); - input.CNTRTOTAL = string.Join(" / ", groupList); + if (input.ctnInputs!=null) { + var groupList = input.ctnInputs.Where(x => x.CTNNUM > 0).GroupBy(c => c.CTNALL).Select(g => $"{g.Key}*{g.Sum(gg => gg.CTNNUM)}"); + input.CNTRTOTAL = string.Join(" / ", groupList); + } + var entity = input.Adapt(); await _rep.InsertAsync(entity); - foreach (var item in input.ctnInputs) - { - var ctnentity = item.Adapt(); - ctnentity.BILLID = entity.Id; - await _repCtn.InsertAsync(ctnentity); - foreach (var it in item.ctnDetailInputs) + if (input.ctnInputs != null) { + foreach (var item in input.ctnInputs) { - var ctndetail = it.Adapt(); - ctndetail.CTNID = ctnentity.Id; - await _ctndetailrep.InsertAsync(ctndetail); + var ctnentity = item.Adapt(); + ctnentity.BILLID = entity.Id; + await _repCtn.InsertAsync(ctnentity); + foreach (var it in item.ctnDetailInputs) + { + var ctndetail = it.Adapt(); + ctndetail.CTNID = ctnentity.Id; + await _ctndetailrep.InsertAsync(ctndetail); + } } } + ////添加booking日志 await _bookinglog.InsertAsync(new BookingLog { @@ -261,26 +266,32 @@ namespace Myshipping.Application JsonUtil.PropToUpper(input, "ORDNO", "BSSTATUS", "YardContract", "YardContractTel", "YardContractEmail"); JsonUtil.TrimFields(input); - var groupList = input.ctnInputs.Where(x => x.CTNNUM > 0).GroupBy(c => c.CTNALL).Select(g => $"{g.Key}*{g.Sum(gg => gg.CTNNUM)}"); - input.CNTRTOTAL = string.Join(" / ", groupList); + if (input.ctnInputs!=null) { + var groupList = input.ctnInputs.Where(x => x.CTNNUM > 0).GroupBy(c => c.CTNALL).Select(g => $"{g.Key}*{g.Sum(gg => gg.CTNNUM)}"); + input.CNTRTOTAL = string.Join(" / ", groupList); + + } var main = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); var entity = input.Adapt(); await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == input.Id).Select(x => x.Id).ToListAsync(); await _repCtn.DeleteAsync(x => x.BILLID == input.Id); await _ctndetailrep.DeleteAsync(x => ctnlist.Contains((long)x.CTNID)); - foreach (var item in input.ctnInputs) - { - var ctnentity = item.Adapt(); - ctnentity.BILLID = entity.Id; - await _repCtn.InsertAsync(ctnentity); - foreach (var it in item.ctnDetailInputs) + if (input.ctnInputs != null) { + foreach (var item in input.ctnInputs) { - var ctndetail = it.Adapt(); - ctndetail.CTNID = ctnentity.Id; - await _ctndetailrep.InsertAsync(ctndetail); + var ctnentity = item.Adapt(); + ctnentity.BILLID = entity.Id; + await _repCtn.InsertAsync(ctnentity); + foreach (var it in item.ctnDetailInputs) + { + var ctndetail = it.Adapt(); + ctndetail.CTNID = ctnentity.Id; + await _ctndetailrep.InsertAsync(ctndetail); + } } } + bool flag = true; long bid = 0; foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(entity)) @@ -321,7 +332,7 @@ namespace Myshipping.Application await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail { PId = bid, - Field = name, + Field = descriptor.Description, OldValue = _oldvalue, NewValue = _value, }); diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderDto.cs index 32fe0b59..b72063ea 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderDto.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderDto.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using Myshipping.Core; namespace Myshipping.Application @@ -17,6 +18,7 @@ namespace Myshipping.Application /// /// 业务编号 /// + [Description("业务编号")] public string BSNO { get; set; } /// /// 业务状态