|
|
@ -109,6 +109,13 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
//船公司基础映射模块
|
|
|
|
//船公司基础映射模块
|
|
|
|
const string CONST_MAPPING_CARRIER_MODULE = "CarrierBaseMapping";
|
|
|
|
const string CONST_MAPPING_CARRIER_MODULE = "CarrierBaseMapping";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* 是否启用委托单位权限显示控制
|
|
|
|
|
|
|
|
开启此参数后,在部分接口查询数据时会根据当前登陆人的权限范围来决定返回哪些委托单位,
|
|
|
|
|
|
|
|
如委托单位管理台账查询接口、委托单位下拉查询接口、舱位管理台账查询接口、舱位管理详情查询接口等
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
const string IS_ENABLE_CUSTOMER_AUTHORITY = "IS_ENABLE_CUSTOMER_AUTHORITY";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BookingSlotService(IServiceProvider serviceProvider)
|
|
|
|
public BookingSlotService(IServiceProvider serviceProvider)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -3470,14 +3477,176 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
//序列化查询条件
|
|
|
|
//序列化查询条件
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(querySearch.QueryCondition);
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(querySearch.QueryCondition);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<string> ctnCodeArr = new List<string>();
|
|
|
|
|
|
|
|
List<long> labelIdArray = new List<long>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (whereList.Any(t => ((ConditionalModel)t).FieldName.Equals("ctnStat", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var codList = whereList.Where(t => ((ConditionalModel)t).FieldName.Equals("ctnStat", StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctnCodeArr = codList.Select(t => ((ConditionalModel)t).FieldValue).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
codList.ForEach(t =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
whereList.Remove(t);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (whereList.Any(t => ((ConditionalModel)t).FieldName.Equals("labelIdArray", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var codList = whereList.Where(t => ((ConditionalModel)t).FieldName.Equals("labelIdArray", StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
labelIdArray = codList.Select(t => long.Parse(((ConditionalModel)t).FieldValue)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
codList.ForEach(t =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
whereList.Remove(t);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var result = tenantDb.Queryable<BookingSlotBase>()
|
|
|
|
var result = tenantDb.Queryable<BookingSlotBase>()
|
|
|
|
.InnerJoin<BookingSlotCtn>((a, b) => a.Id == b.SlotId)
|
|
|
|
.LeftJoin<BookingSlotCtn>((a, b) => a.Id == b.SlotId)
|
|
|
|
.Select<BookingSlotBaseDto>()
|
|
|
|
.Where(whereList)
|
|
|
|
.Where(whereList);
|
|
|
|
.WhereIF(ctnCodeArr != null && ctnCodeArr.Count > 0, (a, b) => b != null
|
|
|
|
//.ToQueryPageAsync(request.PageCondition);
|
|
|
|
&& !string.IsNullOrWhiteSpace(b.CtnCode)
|
|
|
|
var list = result.ToList();
|
|
|
|
&& ctnCodeArr.Contains(b.CtnCode) && b.Deleted == false)
|
|
|
|
|
|
|
|
.WhereIF(labelIdArray != null && labelIdArray.Count > 0,
|
|
|
|
|
|
|
|
a => SqlFunc.Subqueryable<BookingLabelAllocation>()
|
|
|
|
|
|
|
|
.Where(x => x.BusinessId == a.Id && labelIdArray.Contains(x.LabelId))
|
|
|
|
|
|
|
|
.Any())
|
|
|
|
|
|
|
|
.Select<BookingSlotBaseDto>();
|
|
|
|
|
|
|
|
|
|
|
|
var data = await result.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
var data = await result.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var slotIds = data.Data.Select(x => x.Id);
|
|
|
|
|
|
|
|
if (slotIds.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// 查询舱位绑定的销售信息,赋值到舱位对象中
|
|
|
|
|
|
|
|
List<BookingSlotSaleInfoDto> allocationInfoList = await tenantDb.Queryable<BookingSlotAllocation>()
|
|
|
|
|
|
|
|
.Where(x => slotIds.Contains(x.BookingSlotId))
|
|
|
|
|
|
|
|
.Select(x => new BookingSlotSaleInfoDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
|
|
|
BookingId = x.BookingId,
|
|
|
|
|
|
|
|
BookingSlotId = x.BookingSlotId,
|
|
|
|
|
|
|
|
CustomerId = x.CustomerId,
|
|
|
|
|
|
|
|
CustomerName = x.CustomerName,
|
|
|
|
|
|
|
|
CustServiceId = x.CustServiceId,
|
|
|
|
|
|
|
|
CustService = x.CustService,
|
|
|
|
|
|
|
|
SaleId = x.SaleId,
|
|
|
|
|
|
|
|
Sale = x.Sale,
|
|
|
|
|
|
|
|
OpId = x.OpId,
|
|
|
|
|
|
|
|
Op = x.Op,
|
|
|
|
|
|
|
|
DocId = x.DocId,
|
|
|
|
|
|
|
|
Doc = x.Doc,
|
|
|
|
|
|
|
|
Business = x.Business,
|
|
|
|
|
|
|
|
BusinessId = x.BusinessId,
|
|
|
|
|
|
|
|
SaleTime = x.SaleTime,
|
|
|
|
|
|
|
|
Shipper = x.Shipper,
|
|
|
|
|
|
|
|
GoodsName = x.GoodsName,
|
|
|
|
|
|
|
|
SellingPrice = x.SellingPrice,
|
|
|
|
|
|
|
|
CreateBy = x.CreateBy
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (allocationInfoList.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var paramConfig = _configService.GetConfig(IS_ENABLE_CUSTOMER_AUTHORITY, long.Parse(user.TenantId), false).GetAwaiter().GetResult()?.Data?.Value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 判断是否启用了委托单位查看控制权限
|
|
|
|
|
|
|
|
bool isEnableCustomerAuthority = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(paramConfig.Equals("ENABLE",StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
isEnableCustomerAuthority = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<long> userList = null;
|
|
|
|
|
|
|
|
List<string> userListStr = null;
|
|
|
|
|
|
|
|
//if (isEnableCustomerAuthority)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// userList = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuDjyCustomer);
|
|
|
|
|
|
|
|
// if (userList == null || userList.Count == 0)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// isEnableCustomerAuthority = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// else
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// userListStr = userList.Select(x => x.ToString()).ToList();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
var saleInfoGroup = allocationInfoList.GroupBy(x => x.BookingSlotId);
|
|
|
|
|
|
|
|
foreach (var item in saleInfoGroup)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (isEnableCustomerAuthority)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// 遍历销售信息,如果销售信息中的“销售、操作、单证、客服、创建人”中不在当前登陆人的权限范围,则隐藏客户信息
|
|
|
|
|
|
|
|
foreach (BookingSlotSaleInfoDto saleInfoItem in item)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!userList.Contains(saleInfoItem.CreateBy)
|
|
|
|
|
|
|
|
&& !userListStr.Contains(saleInfoItem.OpId)
|
|
|
|
|
|
|
|
&& !userListStr.Contains(saleInfoItem.DocId)
|
|
|
|
|
|
|
|
&& !userListStr.Contains(saleInfoItem.SaleId)
|
|
|
|
|
|
|
|
&& !userListStr.Contains(saleInfoItem.CustServiceId))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
saleInfoItem.CustomerId = 0;
|
|
|
|
|
|
|
|
saleInfoItem.CustomerName = "--";
|
|
|
|
|
|
|
|
saleInfoItem.OpId = "";
|
|
|
|
|
|
|
|
saleInfoItem.Op = "--";
|
|
|
|
|
|
|
|
saleInfoItem.DocId = "";
|
|
|
|
|
|
|
|
saleInfoItem.Doc = "--";
|
|
|
|
|
|
|
|
saleInfoItem.SaleId = "";
|
|
|
|
|
|
|
|
saleInfoItem.Sale = "--";
|
|
|
|
|
|
|
|
saleInfoItem.Shipper = "--";
|
|
|
|
|
|
|
|
saleInfoItem.GoodsName = "--";
|
|
|
|
|
|
|
|
saleInfoItem.CustServiceId = "";
|
|
|
|
|
|
|
|
saleInfoItem.CustService = "--";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var slot = data.Data.FirstOrDefault(x => x.Id == item.Key);
|
|
|
|
|
|
|
|
if (slot != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
slot.BookingSlotSaleInfoList = item.ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询舱位绑定的标签信息,赋值到舱位对象中
|
|
|
|
|
|
|
|
var labelCacheList = await _bookingLabelService.List(1);
|
|
|
|
|
|
|
|
var labelAllocationList = await tenantDb.Queryable<BookingLabelAllocation>()
|
|
|
|
|
|
|
|
.Where(x => slotIds.Contains(x.BusinessId))
|
|
|
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
|
if (labelAllocationList.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var labelInfoGroup = labelAllocationList.GroupBy(x => x.BusinessId);
|
|
|
|
|
|
|
|
foreach (var item in labelInfoGroup)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var slot = data.Data.FirstOrDefault(x => x.Id == item.Key);
|
|
|
|
|
|
|
|
if (slot != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
slot.LabelList = item.Select(x =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var labelCache = labelCacheList.Data.FirstOrDefault(l => l.Id == x.LabelId);
|
|
|
|
|
|
|
|
if (labelCache != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return new BookingLabelBaseDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = x.LabelId,
|
|
|
|
|
|
|
|
Name = labelCache.Name,
|
|
|
|
|
|
|
|
Color = labelCache.Color,
|
|
|
|
|
|
|
|
Scope = labelCache.Scope
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
slot.LabelList.RemoveAll(x => x == null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|