|
|
|
@ -111,6 +111,8 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<BookingGoodsStatus> _goodsStatus;
|
|
|
|
|
private readonly SqlSugarRepository<BookingGoodsStatusConfig> _goodsStatusConfig;
|
|
|
|
|
private readonly SqlSugarRepository<DjyCustomer> _djycustomer;
|
|
|
|
|
private readonly SqlSugarRepository<BookingTemplate> _bookingTemplate;
|
|
|
|
|
private readonly SqlSugarRepository<ParaGoodsInfo> _paraGoodsInfoRepository;
|
|
|
|
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
|
|
|
|
private readonly IBookingGoodsStatusConfigService _GoodsConfig;
|
|
|
|
|
const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING";
|
|
|
|
@ -121,12 +123,12 @@ namespace Myshipping.Application
|
|
|
|
|
SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail, SqlSugarRepository<BookingRemark> bookingremark,
|
|
|
|
|
SqlSugarRepository<BookingFile> bookingfile, SqlSugarRepository<DjyUserConfig> repUserConfig, SqlSugarRepository<BookingPrintTemplate> repPrint,
|
|
|
|
|
SqlSugarRepository<SysDictData> dicdata, SqlSugarRepository<BookingStatusLog> statuslog, SqlSugarRepository<BookingStatusLogDetail> statuslogdetail,
|
|
|
|
|
ILogger<BookingOrderService> logger, ISysCacheService cache, IDjyWebsiteAccountConfigService webAccountConfig, ISysDataUserMenu right,
|
|
|
|
|
SqlSugarRepository<BookingPrintTemplate> repPrintTemplate, SqlSugarRepository<BookingLetteryard> repLetterYard, SqlSugarRepository<SysUser> repUser,
|
|
|
|
|
ILogger<BookingOrderService> logger, ISysCacheService cache, IDjyWebsiteAccountConfigService webAccountConfig, ISysDataUserMenu right, SqlSugarRepository<ParaGoodsInfo> paraGoodsInfoRepository,
|
|
|
|
|
SqlSugarRepository<BookingPrintTemplate> repPrintTemplate, SqlSugarRepository<BookingLetteryard> repLetterYard, SqlSugarRepository<SysUser> repUser, SqlSugarRepository<BookingTemplate> bookingTemplate,
|
|
|
|
|
SqlSugarRepository<BookingOrderUrl> repOrderUrl, SqlSugarRepository<BookingOrderContact> repOrderContact, SqlSugarRepository<BookingSampleBill> repSampleBill, SqlSugarRepository<DjyCustomer> djycustomer,
|
|
|
|
|
SqlSugarRepository<BookingExcelTemplate> excelrep, SqlSugarRepository<DjyUserMailAccount> repUserMail, SqlSugarRepository<BookingGoodsStatus> goodsStatus, SqlSugarRepository<BookingGoodsStatusConfig> goodsStatusConfig,
|
|
|
|
|
SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<BookingStatus> repBookingStatus, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingServiceItem> serviceItem,
|
|
|
|
|
IHttpContextAccessor httpContextAccessor,IBookingGoodsStatusConfigService GoodsConfig)
|
|
|
|
|
IHttpContextAccessor httpContextAccessor, IBookingGoodsStatusConfigService GoodsConfig)
|
|
|
|
|
{
|
|
|
|
|
this._logger = logger;
|
|
|
|
|
this._rep = rep;
|
|
|
|
@ -157,7 +159,9 @@ namespace Myshipping.Application
|
|
|
|
|
this._serviceItem = serviceItem;
|
|
|
|
|
this._goodsStatus = goodsStatus;
|
|
|
|
|
this._goodsStatusConfig = goodsStatusConfig;
|
|
|
|
|
this._bookingTemplate = bookingTemplate;
|
|
|
|
|
this._djycustomer = djycustomer;
|
|
|
|
|
this._paraGoodsInfoRepository = paraGoodsInfoRepository;
|
|
|
|
|
_httpContextAccessor = httpContextAccessor;
|
|
|
|
|
_GoodsConfig = GoodsConfig;
|
|
|
|
|
}
|
|
|
|
@ -180,6 +184,8 @@ namespace Myshipping.Application
|
|
|
|
|
var ftoday = DateTime.Now.AddDays(-15);
|
|
|
|
|
var etoday = DateTime.Now.AddDays(15);
|
|
|
|
|
//List<long> userlist = await DataFilterExtensions.GetDataScopeIdList();
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
|
var entities = await _rep.AsQueryable()
|
|
|
|
|
.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)
|
|
|
|
@ -329,22 +335,47 @@ namespace Myshipping.Application
|
|
|
|
|
.OrderBy(PageInputOrder.OrderBuilder(input.SortField, input.DescSort))
|
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
var list = entities.Adapt<SqlSugarPagedList<PageBookingOrder>>();
|
|
|
|
|
|
|
|
|
|
var status = await _repBookingStatus.AsQueryable().ToListAsync();
|
|
|
|
|
var remark = await _bookingremark.AsQueryable().ToListAsync();
|
|
|
|
|
|
|
|
|
|
var itgoodsStatus = _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
|
|
|
|
|
(goods, config) => config.Id == goods.ConfigId).
|
|
|
|
|
OrderBy((goods, config) => config.Sort).
|
|
|
|
|
Select((goods, config) => new
|
|
|
|
|
{
|
|
|
|
|
bookingid = goods.bookingId,
|
|
|
|
|
ConfigId = config.Id,
|
|
|
|
|
SystemCode = config.SystemCode,
|
|
|
|
|
StatusName = config.StatusName,
|
|
|
|
|
FinishTime = goods.FinishTime,
|
|
|
|
|
ExtData = goods.ExtData,
|
|
|
|
|
Remark = goods.Remark,
|
|
|
|
|
CreatedUserId = config.CreatedUserId,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
var itconfigs = _goodsStatusConfig.AsQueryable().Select(config => new
|
|
|
|
|
{
|
|
|
|
|
bookingid = "",
|
|
|
|
|
ConfigId = config.Id,
|
|
|
|
|
SystemCode = config.SystemCode,
|
|
|
|
|
StatusName = config.StatusName,
|
|
|
|
|
FinishTime = "",
|
|
|
|
|
ExtData = "",
|
|
|
|
|
Remark = "",
|
|
|
|
|
CreatedUserId = config.CreatedUserId,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var item in list.Items)
|
|
|
|
|
{
|
|
|
|
|
var sta = status.Where(x => x.BookingId == item.Id).ToList();
|
|
|
|
|
var sta = _repBookingStatus.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id).ToList();
|
|
|
|
|
if (sta != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
item.bookstatus = sta;
|
|
|
|
|
}
|
|
|
|
|
var st = remark.Where(x => x.PId == item.Id).ToList();
|
|
|
|
|
var st = _bookingremark.AsQueryable().Filter(null, true).Where(x => x.PId == item.Id).ToList();
|
|
|
|
|
if (st != null)
|
|
|
|
|
{
|
|
|
|
|
item.bookremark = st;
|
|
|
|
@ -357,6 +388,37 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
item.ETA = Convert.ToDateTime(item.ETA).ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
var itgoods = itgoodsStatus.Where(x => x.CreatedUserId == item.CreatedUserId && x.bookingid == item.Id).OrderBy(x => x.Sort).
|
|
|
|
|
Select(x => new GoodsStatusList
|
|
|
|
|
{
|
|
|
|
|
ConfigId = x.ConfigId,
|
|
|
|
|
StatusName = x.StatusName,
|
|
|
|
|
SystemCode = x.SystemCode,
|
|
|
|
|
FinishTime = x.FinishTime,
|
|
|
|
|
ExtData = x.ExtData,
|
|
|
|
|
Remark = x.Remark,
|
|
|
|
|
Sort = x.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort).
|
|
|
|
|
Select(x => new GoodsStatusList
|
|
|
|
|
{
|
|
|
|
|
ConfigId = x.ConfigId,
|
|
|
|
|
StatusName = x.StatusName,
|
|
|
|
|
SystemCode = x.SystemCode,
|
|
|
|
|
FinishTime = null,
|
|
|
|
|
ExtData = x.ExtData,
|
|
|
|
|
Remark = x.Remark,
|
|
|
|
|
Sort=x.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var ii in itgoods)
|
|
|
|
|
{
|
|
|
|
|
itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
item.GoodsStatusList = itgoods.Union<GoodsStatusList>(itconfig).OrderBy(x=>x.Sort).ToList();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
@ -766,11 +828,6 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新订舱
|
|
|
|
|
/// </summary>
|
|
|
|
@ -1260,7 +1317,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
|
[HttpPost("/BookingOrder/SaveGoodsStatus")]
|
|
|
|
|
public async Task SaveGoodsStatus(GoodsStatusDtoList input)
|
|
|
|
|
public async Task<dynamic> SaveGoodsStatus(GoodsStatusDtoList input)
|
|
|
|
|
{
|
|
|
|
|
if (input.BookingId == null || input.BookingId == 0)
|
|
|
|
|
{
|
|
|
|
@ -1278,6 +1335,53 @@ namespace Myshipping.Application
|
|
|
|
|
await _goodsStatus.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
var userid = _rep.Where(x => x.Id == input.BookingId).Select(x => x.CreatedUserId).First();
|
|
|
|
|
if (userid != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
|
|
|
|
|
(goods, config) => config.Id == goods.ConfigId).Where((goods, config) => config.CreatedUserId == userid && goods.bookingId == input.BookingId).
|
|
|
|
|
OrderBy((goods, config) => config.Sort).
|
|
|
|
|
Select((goods, config) => new GoodsStatusQuery
|
|
|
|
|
{
|
|
|
|
|
ConfigId = config.Id,
|
|
|
|
|
SystemCode = config.SystemCode,
|
|
|
|
|
StatusName = config.StatusName,
|
|
|
|
|
FinishTime = goods.FinishTime,
|
|
|
|
|
FinishUser = goods.FinishUser,
|
|
|
|
|
FinishUserId = goods.FinishUserId,
|
|
|
|
|
IsPublic = goods.IsPublic,
|
|
|
|
|
ExtData = goods.ExtData,
|
|
|
|
|
Remark = goods.Remark,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var config = _goodsStatusConfig.AsQueryable().Where(config => config.CreatedUserId == userid).ToList().Select(config => new GoodsStatusQuery
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ConfigId = config.Id,
|
|
|
|
|
SystemCode = config.SystemCode,
|
|
|
|
|
StatusName = config.StatusName,
|
|
|
|
|
FinishTime = null,
|
|
|
|
|
FinishUser = null,
|
|
|
|
|
FinishUserId = null,
|
|
|
|
|
IsPublic = false,
|
|
|
|
|
ExtData = null,
|
|
|
|
|
Remark = null,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
config.RemoveAll(x => x.ConfigId == item.ConfigId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list.Union<GoodsStatusQuery>(config).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
@ -1292,8 +1396,8 @@ namespace Myshipping.Application
|
|
|
|
|
if (userid != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list= await _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
|
|
|
|
|
( goods,config) => config.Id == goods.ConfigId).Where((goods,config ) => config.CreatedUserId == userid&& goods.bookingId==bookingId).
|
|
|
|
|
var list = await _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
|
|
|
|
|
(goods, config) => config.Id == goods.ConfigId).Where((goods, config) => config.CreatedUserId == userid && goods.bookingId == bookingId).
|
|
|
|
|
OrderBy((goods, config) => config.Sort).
|
|
|
|
|
Select((goods, config) => new GoodsStatusQuery
|
|
|
|
|
{
|
|
|
|
@ -1305,11 +1409,12 @@ namespace Myshipping.Application
|
|
|
|
|
FinishUserId = goods.FinishUserId,
|
|
|
|
|
IsPublic = goods.IsPublic,
|
|
|
|
|
ExtData = goods.ExtData,
|
|
|
|
|
Remark = goods.Remark
|
|
|
|
|
Remark = goods.Remark,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var config = _goodsStatusConfig.AsQueryable().Where(config => config.CreatedUserId == userid).ToList().Select(config => new GoodsStatusQuery
|
|
|
|
|
var config = _goodsStatusConfig.AsQueryable().Where(config => config.CreatedUserId == userid).ToList().Select(config => new GoodsStatusQuery
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ConfigId = config.Id,
|
|
|
|
@ -1320,16 +1425,17 @@ namespace Myshipping.Application
|
|
|
|
|
FinishUserId = null,
|
|
|
|
|
IsPublic = false,
|
|
|
|
|
ExtData = null,
|
|
|
|
|
Remark = null
|
|
|
|
|
Remark = null,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
config.RemoveAll(x => x.ConfigId==item.ConfigId);
|
|
|
|
|
config.RemoveAll(x => x.ConfigId == item.ConfigId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list.Union<dynamic>(config);
|
|
|
|
|
return list.Union<GoodsStatusQuery>(config).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
@ -4993,6 +5099,7 @@ namespace Myshipping.Application
|
|
|
|
|
OrderBy((goods, config) => config.Sort).
|
|
|
|
|
Select((goods, config) => new GoodsStatusQuery
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ConfigId = config.Id,
|
|
|
|
|
SystemCode = config.SystemCode,
|
|
|
|
|
StatusName = config.StatusName,
|
|
|
|
@ -5001,8 +5108,8 @@ namespace Myshipping.Application
|
|
|
|
|
FinishUserId = goods.FinishUserId,
|
|
|
|
|
IsPublic = goods.IsPublic,
|
|
|
|
|
ExtData = goods.ExtData,
|
|
|
|
|
Remark = goods.Remark
|
|
|
|
|
|
|
|
|
|
Remark = goods.Remark,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var config = _goodsStatusConfig.AsQueryable().Where(config => config.CreatedUserId == userid).ToList().Select(config => new GoodsStatusQuery
|
|
|
|
@ -5016,7 +5123,8 @@ namespace Myshipping.Application
|
|
|
|
|
FinishUserId = null,
|
|
|
|
|
IsPublic = false,
|
|
|
|
|
ExtData = null,
|
|
|
|
|
Remark = null
|
|
|
|
|
Remark = null,
|
|
|
|
|
Sort = config.Sort
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var item in GoodsStatus)
|
|
|
|
@ -5027,7 +5135,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
allData.GoodsStatus= GoodsStatus.Union<GoodsStatusQuery>(config).ToList();
|
|
|
|
|
allData.GoodsStatus = GoodsStatus.Union<GoodsStatusQuery>(config).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -5043,28 +5151,55 @@ namespace Myshipping.Application
|
|
|
|
|
///获取下拉前10条接口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/BookingOrder/GetAllSelectData")]
|
|
|
|
|
public async Task<dynamic> GetAllSelectData()
|
|
|
|
|
{
|
|
|
|
|
////报关行
|
|
|
|
|
var BGH= _djycustomer.Where(x => x.PropString == "customs_broker").Take(10).ToList();
|
|
|
|
|
var BGH = _djycustomer.Where(x => x.PropString == "customs_broker").Take(10).ToList();
|
|
|
|
|
|
|
|
|
|
//车队
|
|
|
|
|
var CD = _djycustomer.Where(x => x.PropString == "fleet").Take(10).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//国外代理
|
|
|
|
|
var GWDL = _djycustomer.Where(x => x.PropString == "out_agent").Take(10).ToList();
|
|
|
|
|
|
|
|
|
|
//仓库
|
|
|
|
|
var CK = _djycustomer.Where(x => x.PropString == "warehouse").Take(10).ToList();
|
|
|
|
|
|
|
|
|
|
var Portload = _cache.GetAllCodePortLoad().Result.Take(10).ToList();
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Port = _cache.GetAllCodePort().Result.Take(10).ToList();
|
|
|
|
|
|
|
|
|
|
var Template = _bookingTemplate.AsQueryable().Take(10).ToList();
|
|
|
|
|
|
|
|
|
|
var Customer = _djycustomer.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID).Take(10).ToList();
|
|
|
|
|
|
|
|
|
|
var Forwarder = _cache.GetAllCodeForwarder().Result.Take(10).ToList();
|
|
|
|
|
var Contractno = _paraGoodsInfoRepository.AsQueryable().OrderBy("GOODS_CODE asc").Take(50).ToList().Select(t => t.Adapt<ParaGoodsShowDto>()).ToList();
|
|
|
|
|
var superAdmin = UserManager.IsSuperAdmin;
|
|
|
|
|
|
|
|
|
|
var User = _repUser.AsQueryable().InnerJoin<SysEmp>((u, e) => u.Id == e.Id)
|
|
|
|
|
.InnerJoin<SysOrg>((u, e, o) => e.OrgId == o.Id)
|
|
|
|
|
.InnerJoin<SysTenant>((u, e, o, t) => u.TenantId == t.Id)
|
|
|
|
|
.Where((u, e, o) => u.AdminType == AdminType.None)
|
|
|
|
|
.Select<UserOutput>("u.*,t.Name As TenantName ").ToDataFilter("u", "Id", FilterType.User).Take(10).ToList();
|
|
|
|
|
|
|
|
|
|
dynamic obj = new
|
|
|
|
|
{
|
|
|
|
|
BGH = BGH,
|
|
|
|
|
CD = CD,
|
|
|
|
|
GWDL = GWDL,
|
|
|
|
|
CK = CK,
|
|
|
|
|
Portload = Portload,
|
|
|
|
|
Port = Port,
|
|
|
|
|
Template = Template,
|
|
|
|
|
Customer = Customer,
|
|
|
|
|
Contractno = Contractno,
|
|
|
|
|
User = User
|
|
|
|
|
};
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|