|
|
|
@ -824,6 +824,22 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
|
|
|
|
|
model = entity.Adapt<BookingDeliveryRecordDto>();
|
|
|
|
|
|
|
|
|
|
var ctnList = _bookingDeliveryRecordCtnRep.AsQueryable()
|
|
|
|
|
.Where(a => a.RECORD_ID == id && a.IsDeleted == false).ToList();
|
|
|
|
|
|
|
|
|
|
if (ctnList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
model.ctns = ctnList.Select(a => new BookingDeliveryRecordCtnDto {
|
|
|
|
|
id = a.Id,
|
|
|
|
|
ctnCode = a.CTN_CODE,
|
|
|
|
|
carrierCtnCode = a.CARRIER_CTN_CODE,
|
|
|
|
|
ctnNum = a.CTN_NUM,
|
|
|
|
|
ctnSufferWeight = a.CTN_SUFFER_WEIGHT,
|
|
|
|
|
stuffingMeasurementType = a.STUFFING_MEASUREMENT_TYPE,
|
|
|
|
|
stuffingMeasurementUnit = a.STUFFING_MEASUREMENT_UNIT
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
@ -855,9 +871,76 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
x.BOOKING_REFERENCE,
|
|
|
|
|
x.BookingId,
|
|
|
|
|
x.REQUEST_ACKNOWLEDGEMENT_ID,
|
|
|
|
|
x.STATUS
|
|
|
|
|
x.STATUS,
|
|
|
|
|
x.TenantId,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
if (model.ctns != null && model.ctns.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var ctnEntityList = _bookingDeliveryRecordCtnRep.AsQueryable()
|
|
|
|
|
.Where(a => a.RECORD_ID == entity.Id && a.IsDeleted == false).ToList();
|
|
|
|
|
|
|
|
|
|
model.ctns.ForEach(ctn =>
|
|
|
|
|
{
|
|
|
|
|
if (ctn.id.HasValue && ctn.id.Value > 0)
|
|
|
|
|
{
|
|
|
|
|
if (ctnEntityList.Any(x => x.Id == ctn.id.Value))
|
|
|
|
|
{
|
|
|
|
|
ctnEntityList.Remove(ctnEntityList.FirstOrDefault(x => x.Id == ctn.id.Value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//更新
|
|
|
|
|
var ctnEntity = ctn.Adapt<BookingDeliveryRecordCtn>();
|
|
|
|
|
|
|
|
|
|
ctnEntity.Id = ctn.id.Value;
|
|
|
|
|
ctnEntity.UpdatedTime = nowDate;
|
|
|
|
|
ctnEntity.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
ctnEntity.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
_bookingDeliveryRecordCtnRep.AsUpdateable(ctnEntity).IgnoreColumns(x => new {
|
|
|
|
|
x.CreatedUserId,
|
|
|
|
|
x.CreatedUserName,
|
|
|
|
|
x.CreatedTime,
|
|
|
|
|
x.TenantId,
|
|
|
|
|
x.STUFFING_MEASUREMENT_TYPE,
|
|
|
|
|
x.STUFFING_MEASUREMENT_UNIT
|
|
|
|
|
}).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var ctnEntity = ctn.Adapt<BookingDeliveryRecordCtn>();
|
|
|
|
|
|
|
|
|
|
ctnEntity.RECORD_ID = entity.Id;
|
|
|
|
|
ctnEntity.CreatedTime = nowDate;
|
|
|
|
|
ctnEntity.UpdatedTime = nowDate;
|
|
|
|
|
ctnEntity.CreatedUserId = UserManager.UserId;
|
|
|
|
|
ctnEntity.CreatedUserName = UserManager.Name;
|
|
|
|
|
ctnEntity.STUFFING_MEASUREMENT_TYPE = "WEIGHT";
|
|
|
|
|
ctnEntity.STUFFING_MEASUREMENT_UNIT = "KGS";
|
|
|
|
|
|
|
|
|
|
_bookingDeliveryRecordCtnRep.Insert(ctnEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if(ctnEntityList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
ctnEntityList.ForEach(async ctn => {
|
|
|
|
|
ctn.IsDeleted = true;
|
|
|
|
|
ctn.UpdatedTime = nowDate;
|
|
|
|
|
ctn.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
ctn.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
await _bookingDeliveryRecordCtnRep.AsUpdateable(ctn).UpdateColumns(x => new {
|
|
|
|
|
x.IsDeleted,
|
|
|
|
|
x.UpdatedTime,
|
|
|
|
|
x.UpdatedUserId,
|
|
|
|
|
x.UpdatedUserName
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return model.id.Value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -868,6 +951,7 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
entity.UpdatedTime = nowDate;
|
|
|
|
|
entity.CreatedUserId = UserManager.UserId;
|
|
|
|
|
entity.CreatedUserName = UserManager.Name;
|
|
|
|
|
entity.STATUS = "TEMP";
|
|
|
|
|
|
|
|
|
|
await _bookingDeliveryRecordRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
@ -875,7 +959,6 @@ namespace Myshipping.Application.Service.BookingOrder
|
|
|
|
|
{
|
|
|
|
|
model.ctns.ForEach(ctn =>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var ctnEntity = ctn.Adapt<BookingDeliveryRecordCtn>();
|
|
|
|
|
|
|
|
|
|
ctnEntity.RECORD_ID = entity.Id;
|
|
|
|
|