optimize
wet 2 years ago
parent 4edb266d21
commit a39c11ab23

@ -173,7 +173,7 @@ namespace Myshipping.Application
var etoday = DateTime.Now.AddDays(15);
//List<long> userlist = await DataFilterExtensions.GetDataScopeIdList();
var entities = await _rep.AsQueryable()
.WhereIF(input.firstFlag, x=>x.ETD<= etoday&&x.ETD>=ftoday||x.ETD==null)
.WhereIF(input.firstFlag, x=>x.ETD<= etoday||x.ETD>=ftoday||x.ETD==null)
.WhereIF(string.IsNullOrWhiteSpace(input.HBLNO), x => x.ParentId == 0 || x.ParentId == null)
.WhereIF(pidlist != null && pidlist.Count > 0, x => pidlist.Contains(x.Id))
.WhereIF(!string.IsNullOrWhiteSpace(input.BSNO), u => u.BSNO.Contains(input.BSNO))

@ -190,11 +190,10 @@ namespace Myshipping.Application
{
throw Oops.Bah("当前提单号已存在,请勿重复录入!");
}
var entity = model.Adapt<BookingOrder>();
entity.CreatedUserId = user.Result.Id;
entity.CreatedUserName = user.Result.Name;
entity.CreatedUserName = user.Result.Name.ToString();
entity.CreatedTime = DateTime.Now;
entity.ParentId =0;
await _rep.InsertAsync(entity);
@ -204,6 +203,8 @@ namespace Myshipping.Application
{
var ctnentity = item.Adapt<BookingCtn>();
ctnentity.BILLID = entity.Id;
ctnentity.CreatedUserId = user.Result.Id;
ctnentity.CreatedUserName = user.Result.Name;
await _repCtn.InsertAsync(ctnentity);
//这里保存有可能没有添加多品名,所有箱下没有货物信息
@ -213,6 +214,8 @@ namespace Myshipping.Application
{
var ctndetail = it.Adapt<BookingCtnDetail>();
ctndetail.CTNID = ctnentity.Id;
ctndetail.CreatedUserId = user.Result.Id;
ctndetail.CreatedUserName = user.Result.Name;
await _ctndetailrep.InsertAsync(ctndetail);
}
}
@ -229,6 +232,8 @@ namespace Myshipping.Application
ediExtEntity.CreatedUserId = user.Result.Id;
ediExtEntity.CreatedUserName = user.Result.Name;
ediExtEntity.CreatedTime = DateTime.Now;
ediExtEntity.CreatedUserId = user.Result.Id;
ediExtEntity.CreatedUserName = user.Result.Name;
await _bookingEDIExt.InsertAsync(ediExtEntity);
}
////添加booking日志
@ -283,6 +288,8 @@ namespace Myshipping.Application
{
var ctnentity = item.Adapt<BookingCtn>();
ctnentity.BILLID = fdentity.Id;
ctnentity.CreatedUserId = user.Result.Id;
ctnentity.CreatedUserName = user.Result.Name;
await _repCtn.InsertAsync(ctnentity);
//这里保存有可能没有添加多品名,所有箱下没有货物信息
@ -292,6 +299,9 @@ namespace Myshipping.Application
{
var ctndetail = dit.Adapt<BookingCtnDetail>();
ctndetail.CTNID = ctnentity.Id;
ctndetail.CreatedUserId = user.Result.Id;
ctndetail.CreatedUserName = user.Result.Name;
await _ctndetailrep.InsertAsync(ctndetail);
}
}
@ -376,6 +386,8 @@ namespace Myshipping.Application
{
var ctnentity = item.Adapt<BookingCtn>();
ctnentity.BILLID = main.Id;
ctnentity.CreatedUserId = user.Result.Id;
ctnentity.CreatedUserName = user.Result.Name;
await _repCtn.InsertAsync(ctnentity);
if (item.ctnDetailInputs != null)
{
@ -383,6 +395,9 @@ namespace Myshipping.Application
{
var ctndetail = it.Adapt<BookingCtnDetail>();
ctndetail.CTNID = ctnentity.Id;
ctndetail.CreatedUserId = user.Result.Id;
ctndetail.CreatedUserName = user.Result.Name;
await _ctndetailrep.InsertAsync(ctndetail);
}
}
@ -410,7 +425,8 @@ namespace Myshipping.Application
var currEdiExtEntity = model.BookingEDIExt.Adapt<BookingEDIExt>();
currEdiExtEntity.Id = ediExtEntity.Id;
currEdiExtEntity.UpdatedUserId = user.Result.Id;
currEdiExtEntity.UpdatedTime = DateTime.Now;
await _bookingEDIExt.AsUpdateable(currEdiExtEntity).IgnoreColumns(it => new
{
it.BookingId,
@ -518,6 +534,8 @@ namespace Myshipping.Application
{
var ctnentity = item.Adapt<BookingCtn>();
ctnentity.BILLID = fdmain.Id;
ctnentity.CreatedUserId = user.Result.Id;
ctnentity.CreatedUserName = user.Result.Name;
await _repCtn.InsertAsync(ctnentity);
if (it.ctnDetailInputs != null)
{
@ -525,6 +543,8 @@ namespace Myshipping.Application
{
var ctndetail = it_.Adapt<BookingCtnDetail>();
ctndetail.CTNID = ctnentity.Id;
ctndetail.CreatedUserId = user.Result.Id;
ctndetail.CreatedUserName = user.Result.Name;
await _ctndetailrep.InsertAsync(ctndetail);
}
}
@ -548,6 +568,8 @@ namespace Myshipping.Application
{
var ctnentity = item.Adapt<BookingCtn>();
ctnentity.BILLID = fdentity.Id;
ctnentity.CreatedUserId = user.Result.Id;
ctnentity.CreatedUserName = user.Result.Name;
await _repCtn.InsertAsync(ctnentity);
//这里保存有可能没有添加多品名,所有箱下没有货物信息
@ -557,6 +579,8 @@ namespace Myshipping.Application
{
var ctndetail = dit.Adapt<BookingCtnDetail>();
ctndetail.CTNID = ctnentity.Id;
ctndetail.CreatedUserId = user.Result.Id;
ctndetail.CreatedUserName = user.Result.Name;
await _ctndetailrep.InsertAsync(ctndetail);
}
}

@ -346,7 +346,12 @@ public static class SqlSugarSetup
}
if (entityInfo.PropertyName == "CreatedUserName")
entityInfo.SetValue(App.User.FindFirst(ClaimConst.CLAINM_NAME)?.Value);
{
var CreatedUserName = ((dynamic)entityInfo.EntityValue).CreatedUserName;
if (string.IsNullOrEmpty(CreatedUserName))
entityInfo.SetValue(App.User.FindFirst(ClaimConst.CLAINM_NAME)?.Value);
}
}
}
// 更新操作
@ -355,9 +360,19 @@ public static class SqlSugarSetup
if (entityInfo.PropertyName == "UpdatedTime")
entityInfo.SetValue(DateTime.Now);
if (entityInfo.PropertyName == "UpdatedUserId")
entityInfo.SetValue(App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value);
{
var UpdatedUserId = ((dynamic)entityInfo.EntityValue).UpdatedUserId;
if (UpdatedUserId == null || UpdatedUserId == 0)
entityInfo.SetValue(App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value);
}
if (entityInfo.PropertyName == "UpdatedUserName")
entityInfo.SetValue(App.User?.FindFirst(ClaimConst.CLAINM_NAME)?.Value);
{
var UpdatedUserName = ((dynamic)entityInfo.EntityValue).UpdatedUserName;
if (string.IsNullOrEmpty(UpdatedUserName))
entityInfo.SetValue(App.User?.FindFirst(ClaimConst.CLAINM_NAME)?.Value);
}
}
};

Loading…
Cancel
Save