|
|
|
@ -2822,6 +2822,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
return DataResult.Successed(string.Empty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 检索舱位对应的订舱订单(BY 订舱编号)
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 检索舱位对应的订舱订单(BY 订舱编号)
|
|
|
|
|
/// </summary>
|
|
|
|
@ -2829,10 +2830,46 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
/// <param name="tenantId">租户ID</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
|
|
public async Task<BookingSlotWithOrderDto> SearchBookingSlotWithOrderByNo(string slotBookingNo, long tenantId)
|
|
|
|
|
public async Task<DataResult<BookingSlotWithOrderDto>> SearchBookingSlotWithOrderByNo(string slotBookingNo, long tenantId)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
BookingSlotWithOrderDto dto = null;
|
|
|
|
|
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
var slotInfo = await tenantDb.Queryable<BookingSlotBase>().FirstAsync(a => a.SlotBookingNo == slotBookingNo && a.Deleted == false);
|
|
|
|
|
|
|
|
|
|
if (slotInfo == null)
|
|
|
|
|
{
|
|
|
|
|
Logger.Log(NLog.LogLevel.Info, $"slotBookingNo={slotBookingNo} 获取舱位失败,舱位不存在或已作废");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var list = tenantDb.Queryable<BookingSlotAllocation>().Where(a => a.SlotBookingNo == slotBookingNo && a.Deleted == false).ToList();
|
|
|
|
|
|
|
|
|
|
dto = new BookingSlotWithOrderDto
|
|
|
|
|
{
|
|
|
|
|
BookingSlotId = slotInfo.Id,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
dto.HasBookingOrder = true;
|
|
|
|
|
|
|
|
|
|
var bkNoList = list.Select(x => x.BookingId).ToList();
|
|
|
|
|
var bkList = tenantDb.Queryable<SeaExport>().Where(a => bkNoList.Contains(a.Id) && a.Deleted == false).ToList();
|
|
|
|
|
|
|
|
|
|
if (bkList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
dto.BookingOrderList = bkList.Select(x => x.Id).ToList();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dto.BookingOrderList = new List<long>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<BookingSlotWithOrderDto>.Success(dto);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 导入舱位
|
|
|
|
|
/// <summary>
|
|
|
|
@ -3170,131 +3207,120 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 导出舱位为Excel
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input">请求参数</param>
|
|
|
|
|
/// <param name="querySearch">请求参数</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<string>> ExportOrder(BookingSlotBasePageInput input)
|
|
|
|
|
public async Task<DataResult<string>> ExportOrder(PageRequest querySearch)
|
|
|
|
|
{
|
|
|
|
|
ISugarQueryable<BookingSlotBase> select = null;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
// 箱型筛选
|
|
|
|
|
string[] ctnCodeArr = null;
|
|
|
|
|
if (!string.IsNullOrEmpty(input.CTN_STAT))
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
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)))
|
|
|
|
|
{
|
|
|
|
|
ctnCodeArr = input.CTN_STAT.Split(',');
|
|
|
|
|
select = tenantDb.Queryable<BookingSlotBase>().InnerJoin<BookingSlotCtn>((u, c) => u.Id == c.SlotId);
|
|
|
|
|
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);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
if (whereList.Any(t => ((ConditionalModel)t).FieldName.Equals("labelIdArray", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
select = tenantDb.Queryable<BookingSlotBase>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
select = select.WhereIF(!string.IsNullOrEmpty(input.SLOT_BOOKING_NO), u => u.SlotBookingNo.Contains(input.SLOT_BOOKING_NO))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.SLOT_BOOKING_NO), u => u.SlotBookingNo.Contains(input.SLOT_BOOKING_NO))
|
|
|
|
|
.WhereIF(input.STATUS == 1, u => !u.IsCancellation)
|
|
|
|
|
.WhereIF(input.STATUS == 2, u => u.IsCancellation)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.VESSEL), u => u.Vessel.Contains(input.VESSEL))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.VOYNO), u => u.Voyno.Contains(input.VOYNO))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.PORTDISCHARGE), u => u.PORTDISCHARGE.Contains(input.PORTDISCHARGE))
|
|
|
|
|
|
|
|
|
|
.WhereIF(input.ETD_START.HasValue, u => u.ETD >= input.ETD_START.Value)
|
|
|
|
|
.WhereIF(input.ETD_END.HasValue, u => u.ETD < input.ETD_END.Value.AddDays(1))
|
|
|
|
|
.WhereIF(input.ETA_START.HasValue, u => u.ETA >= input.ETA_START.Value)
|
|
|
|
|
.WhereIF(input.ETA_END.HasValue, u => u.ETA < input.ETA_END.Value.AddDays(1))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CreatedUserName), u => u.CreatedUserName.Contains(input.CreatedUserName))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.UpdatedUserName), u => u.UpdatedUserName.Contains(input.UpdatedUserName))
|
|
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CARRIER), u => u.CARRIER.Contains(input.CARRIER))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CONTRACT_NO), u => u.CONTRACT_NO.Contains(input.CONTRACT_NO))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.SI_RLT_STAT), u => u.SI_RLT_STAT == input.SI_RLT_STAT)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.VGM_RLT_STAT), u => u.VGM_RLT_STAT == input.VGM_RLT_STAT)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CARRIAGE_TYPE), u => u.CARRIAGE_TYPE == input.CARRIAGE_TYPE)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.BOOKING_SLOT_TYPE), u => u.BOOKING_SLOT_TYPE == input.BOOKING_SLOT_TYPE)
|
|
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME))
|
|
|
|
|
.WhereIF(input.WEEK_AT != null, u => u.WEEK_AT == input.WEEK_AT)
|
|
|
|
|
|
|
|
|
|
//.WhereIF(isEnableCustomerAuthority, u => SqlFunc.Subqueryable<BookingSlotAllocation>()
|
|
|
|
|
// .Where(x => x.BOOKING_SLOT_ID == u.Id)
|
|
|
|
|
// .NotAny()
|
|
|
|
|
// || SqlFunc.Subqueryable<BookingSlotAllocation>()
|
|
|
|
|
// .Where(x => x.BOOKING_SLOT_ID == u.Id
|
|
|
|
|
// && userList.Contains((long)x.CreatedUserId)
|
|
|
|
|
// || userListStr.Contains(x.OPID)
|
|
|
|
|
// || userListStr.Contains(x.SALEID)
|
|
|
|
|
// || userListStr.Contains(x.DOCID)
|
|
|
|
|
// || userListStr.Contains(x.CUSTSERVICEID))
|
|
|
|
|
// .Any())
|
|
|
|
|
// 标签筛选
|
|
|
|
|
.WhereIF(input.LabelIdArray != null && input.LabelIdArray.Length > 0,
|
|
|
|
|
u => SqlFunc.Subqueryable<BookingLabelAllocation>()
|
|
|
|
|
.Where(x => x.BusinessId == u.Id && input.LabelIdArray.Contains(x.LabelId))
|
|
|
|
|
.Any());
|
|
|
|
|
|
|
|
|
|
if (ctnCodeArr != null && ctnCodeArr.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
var tempSelect = select as ISugarQueryable<BookingSlotBase, BookingSlotCtn>;
|
|
|
|
|
tempSelect.Where((u, c) => ctnCodeArr.Contains(c.CTNCODE));
|
|
|
|
|
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 select = tenantDb.Queryable<BookingSlotBase>()
|
|
|
|
|
.LeftJoin<BookingSlotCtn>((a, b) => a.Id == b.SlotId)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.WhereIF(ctnCodeArr != null && ctnCodeArr.Count > 0, (a, b) => b != null
|
|
|
|
|
&& !string.IsNullOrWhiteSpace(b.CtnCode)
|
|
|
|
|
&& 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>().Distinct();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var sql = select.OrderByDescending(u => u.CreatedTime).ToSqlString();
|
|
|
|
|
|
|
|
|
|
var entities = await select.OrderByDescending(u => u.Id).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var data = entities.Adapt<List<BookingSlotBaseListOutput>>();
|
|
|
|
|
var data = entities.Adapt<List<BookingSlotBaseDto>>();
|
|
|
|
|
|
|
|
|
|
var slotIds = entities.Select(x => x.Id);
|
|
|
|
|
|
|
|
|
|
if (slotIds.Any())
|
|
|
|
|
{
|
|
|
|
|
// 查询舱位绑定的销售信息,赋值到舱位对象中
|
|
|
|
|
List<BookingSlotSaleInfoDto> allocationInfoList = await _repAllocation.AsQueryable()
|
|
|
|
|
.Where(x => slotIds.Contains(x.BOOKING_SLOT_ID))
|
|
|
|
|
List<BookingSlotSaleInfoDto> allocationInfoList = await tenantDb.Queryable<BookingSlotAllocation>()
|
|
|
|
|
.Where(x => slotIds.Contains(x.BookingSlotId))
|
|
|
|
|
.Select(x => new BookingSlotSaleInfoDto
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
BOOKING_ID = x.BOOKING_ID,
|
|
|
|
|
BOOKING_SLOT_ID = x.BOOKING_SLOT_ID,
|
|
|
|
|
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,
|
|
|
|
|
SALE_TIME = x.SALE_TIME,
|
|
|
|
|
SHIPPER = x.SHIPPER,
|
|
|
|
|
GOODSNAME = x.GOODSNAME,
|
|
|
|
|
SELLING_PRICE = x.SELLING_PRICE
|
|
|
|
|
BookingId = x.BookingId,
|
|
|
|
|
BookingSlotId = x.BookingSlotId,
|
|
|
|
|
CustomerId = x.CustomerId,
|
|
|
|
|
CustomerName = x.CustomerName,
|
|
|
|
|
CustServiceId = x.CustService,
|
|
|
|
|
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
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
if (allocationInfoList.Any())
|
|
|
|
|
{
|
|
|
|
|
// 判断是否启用了委托单位查看控制权限
|
|
|
|
|
var tenantParamList = await _cache.GetAllTenantParam();
|
|
|
|
|
var isEnableCustomerAuthority = tenantParamList.FirstOrDefault(x => x.TenantId == UserManager.TENANT_ID
|
|
|
|
|
&& x.ParaCode == TenantParamCode.IS_ENABLE_CUSTOMER_AUTHORITY)?.ItemCode == "YES";
|
|
|
|
|
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 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var saleInfoGroup = allocationInfoList.GroupBy(x => x.BOOKING_SLOT_ID);
|
|
|
|
|
|
|
|
|
|
List<long> userList = new List<long>();
|
|
|
|
|
List<string> userListStr = new List<string>();
|
|
|
|
|
//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)
|
|
|
|
@ -3302,24 +3328,24 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
// 遍历销售信息,如果销售信息中的“销售、操作、单证、客服、创建人”中不在当前登陆人的权限范围,则隐藏客户信息
|
|
|
|
|
foreach (BookingSlotSaleInfoDto saleInfoItem in item)
|
|
|
|
|
{
|
|
|
|
|
if (!userList.Contains(saleInfoItem.CreatedUserId ?? 0)
|
|
|
|
|
&& !userListStr.Contains(saleInfoItem.OPID)
|
|
|
|
|
&& !userListStr.Contains(saleInfoItem.DOCID)
|
|
|
|
|
&& !userListStr.Contains(saleInfoItem.SALEID)
|
|
|
|
|
&& !userListStr.Contains(saleInfoItem.CUSTSERVICEID))
|
|
|
|
|
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 = "--";
|
|
|
|
|
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 = "--";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3334,7 +3360,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
|
|
|
|
|
// 查询舱位绑定的标签信息,赋值到舱位对象中
|
|
|
|
|
var labelCacheList = await _bookingLabelService.List(1);
|
|
|
|
|
var labelAllocationList = await _repLabelAllocation.AsQueryable()
|
|
|
|
|
var labelAllocationList = await tenantDb.Queryable<BookingLabelAllocation>()
|
|
|
|
|
.Where(x => slotIds.Contains(x.BusinessId))
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
if (labelAllocationList.Any())
|
|
|
|
@ -3347,7 +3373,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
{
|
|
|
|
|
slot.LabelList = item.Select(x =>
|
|
|
|
|
{
|
|
|
|
|
var labelCache = labelCacheList.FirstOrDefault(l => l.Id == x.LabelId);
|
|
|
|
|
var labelCache = labelCacheList.Data.FirstOrDefault(l => l.Id == x.LabelId);
|
|
|
|
|
if (labelCache != null)
|
|
|
|
|
{
|
|
|
|
|
return new BookingLabelBaseDto
|
|
|
|
@ -3367,16 +3393,24 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var opt = App.GetOptions<PrintTemplateOptions>();
|
|
|
|
|
var dirAbs = opt.basePath;
|
|
|
|
|
if (string.IsNullOrEmpty(dirAbs))
|
|
|
|
|
{
|
|
|
|
|
dirAbs = App.WebHostEnvironment.WebRootPath;
|
|
|
|
|
}
|
|
|
|
|
var fileAbsPath = Path.Combine(dirAbs, "upload/printtemplate/舱位信息导出模板.xlsx");
|
|
|
|
|
string fileRoot = AppSetting.app(new string[] { "FileSettings", "BasePath" });
|
|
|
|
|
string relativePath = AppSetting.app(new string[] { "FileSettings", "RelativePath" });
|
|
|
|
|
|
|
|
|
|
var tempDic = Path.Combine(fileRoot, relativePath, DateTime.Now.Ticks.ToString());
|
|
|
|
|
Directory.CreateDirectory(tempDic);
|
|
|
|
|
var fileAbsPath = Path.Combine(tempDic, "");
|
|
|
|
|
|
|
|
|
|
//var opt = App.GetOptions<PrintTemplateOptions>();
|
|
|
|
|
//var dirAbs = opt.basePath;
|
|
|
|
|
//if (string.IsNullOrEmpty(dirAbs))
|
|
|
|
|
//{
|
|
|
|
|
// dirAbs = App.WebHostEnvironment.WebRootPath;
|
|
|
|
|
//}
|
|
|
|
|
//var fileAbsPath = Path.Combine(dirAbs, "upload/printtemplate/舱位信息导出模板.xlsx");
|
|
|
|
|
if (!File.Exists(fileAbsPath))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("舱位导出模板文件不存在");
|
|
|
|
|
//舱位台账导出模板【舱位台账导出模板】文件不存在
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotExportTemplateNull)));
|
|
|
|
|
}
|
|
|
|
|
var fs = new FileStream(fileAbsPath, FileMode.Open);
|
|
|
|
|
var excelwork = new XSSFWorkbook(fs);
|
|
|
|
@ -3385,7 +3419,9 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
var rowIndex = 1;
|
|
|
|
|
var dateStr = "yyyy-MM-dd";
|
|
|
|
|
var dateTimeStr = "yyyy-MM-dd HH:mm:ss";
|
|
|
|
|
foreach (BookingSlotBaseListOutput item in data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (BookingSlotBaseDto item in data)
|
|
|
|
|
{
|
|
|
|
|
var row = sheet.GetRow(rowIndex);
|
|
|
|
|
if (row == null)
|
|
|
|
@ -3402,42 +3438,42 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
}
|
|
|
|
|
var value = i switch
|
|
|
|
|
{
|
|
|
|
|
0 => item.SLOT_BOOKING_NO,
|
|
|
|
|
1 => item.CARRIER,
|
|
|
|
|
2 => item.VESSEL,
|
|
|
|
|
3 => item.VOYNO,
|
|
|
|
|
4 => item.CONTRACT_NO,
|
|
|
|
|
5 => item.BOOKING_SLOT_TYPE_NAME,
|
|
|
|
|
0 => item.SlotBookingNo,
|
|
|
|
|
1 => item.CarrierCode,
|
|
|
|
|
2 => item.Vessel,
|
|
|
|
|
3 => item.Voyno,
|
|
|
|
|
4 => item.ContractNo,
|
|
|
|
|
5 => item.BookingSlotType,
|
|
|
|
|
6 => item.ETD?.ToString(dateTimeStr),
|
|
|
|
|
7 => item.ETA?.ToString(dateTimeStr),
|
|
|
|
|
8 => item.BOOKING_PARTY,
|
|
|
|
|
9 => item.IS_CANCELLATION ? "是" : "",
|
|
|
|
|
10 => item.PLACERECEIPT,
|
|
|
|
|
11 => item.PLACEDELIVERY,
|
|
|
|
|
12 => item.PORTLOAD,
|
|
|
|
|
13 => item.PORTDISCHARGE,
|
|
|
|
|
14 => item.CTN_STAT,
|
|
|
|
|
15 => item.WEEK_AT?.ToString(),
|
|
|
|
|
16 => item.SI_CUT_DATE?.ToString(dateTimeStr),
|
|
|
|
|
17 => item.VGM_SUBMISSION_CUT_DATE?.ToString(dateTimeStr),
|
|
|
|
|
18 => item.CY_CUT_DATE?.ToString(dateTimeStr),
|
|
|
|
|
19 => item.MANIFEST_CUT_DATE?.ToString(dateTimeStr),
|
|
|
|
|
20 => item.MDGF_CUT_DATE?.ToString(dateTimeStr),
|
|
|
|
|
21 => item.LANENAME,
|
|
|
|
|
22 => item.DETENSION_FREE_DAYS?.ToString(),
|
|
|
|
|
23 => item.CreatedTime?.ToString(dateTimeStr),
|
|
|
|
|
24 => item.VGM_RLT_STAT,
|
|
|
|
|
25 => item.SI_RLT_STAT,
|
|
|
|
|
26 => item.TAKE_CTN_RLT_STAT,
|
|
|
|
|
27 => item.RETURN_CTN_RLT_STAT,
|
|
|
|
|
28 => item.NOMINATION_RLT_STAT,
|
|
|
|
|
29 => item.AMENDMENT_RLT_STAT,
|
|
|
|
|
30 => item.CANCELLATION_RLT_STAT,
|
|
|
|
|
31 => item.DISCHARGE_FULL_RLT_STAT,
|
|
|
|
|
32 => item.GATE_OUTFULL_RLT_STAT,
|
|
|
|
|
8 => item.BookingParty,
|
|
|
|
|
9 => item.IsCancellation ? "是" : "",
|
|
|
|
|
10 => item.PlaceReceipt,
|
|
|
|
|
11 => item.PlaceDelivery,
|
|
|
|
|
12 => item.PortLoad,
|
|
|
|
|
13 => item.PortDischarge,
|
|
|
|
|
14 => item.CtnStat,
|
|
|
|
|
15 => item.WeekAt?.ToString(),
|
|
|
|
|
16 => item.SICutDate?.ToString(dateTimeStr),
|
|
|
|
|
17 => item.VGMSubmissionCutDate?.ToString(dateTimeStr),
|
|
|
|
|
18 => item.CYCutDate?.ToString(dateTimeStr),
|
|
|
|
|
19 => item.ManifestCutDate?.ToString(dateTimeStr),
|
|
|
|
|
20 => item.MDGFCutDate?.ToString(dateTimeStr),
|
|
|
|
|
21 => item.LaneName,
|
|
|
|
|
22 => item.DetensionFreeDays?.ToString(),
|
|
|
|
|
23 => item.CreateTime.ToString(dateTimeStr),
|
|
|
|
|
24 => item.VGMRltStat,
|
|
|
|
|
25 => item.SIRltStat,
|
|
|
|
|
26 => item.TakeCtnRltStat,
|
|
|
|
|
27 => item.ReturnCtnRltStat,
|
|
|
|
|
28 => item.NominationRltStat,
|
|
|
|
|
29 => item.AmendmentRltStat,
|
|
|
|
|
30 => item.CancellationRltStat,
|
|
|
|
|
31 => item.DischargeFullRltStat,
|
|
|
|
|
32 => item.GateOutFullRltStat,
|
|
|
|
|
33 => "",
|
|
|
|
|
34 => item.REMARK,
|
|
|
|
|
35 => item.PRICE_CALCULATION_DATE?.ToString(dateStr),
|
|
|
|
|
34 => item.Remark,
|
|
|
|
|
35 => item.PriceCalculationDate?.ToString(dateStr),
|
|
|
|
|
_ => ""
|
|
|
|
|
};
|
|
|
|
|
cell.SetCellValue(value);
|
|
|
|
@ -3462,13 +3498,13 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
}
|
|
|
|
|
var value2 = i switch
|
|
|
|
|
{
|
|
|
|
|
36 => saleItem.CUSTOMERNAME,
|
|
|
|
|
37 => saleItem.CUSTSERVICE,
|
|
|
|
|
38 => saleItem.SALE,
|
|
|
|
|
39 => saleItem.SHIPPER,
|
|
|
|
|
40 => saleItem.GOODSNAME,
|
|
|
|
|
41 => saleItem.SELLING_PRICE?.ToString(),
|
|
|
|
|
42 => saleItem.SALE_TIME?.ToString(dateTimeStr),
|
|
|
|
|
36 => saleItem.CustomerName,
|
|
|
|
|
37 => saleItem.CustService,
|
|
|
|
|
38 => saleItem.Sale,
|
|
|
|
|
39 => saleItem.Shipper,
|
|
|
|
|
40 => saleItem.GoodsName,
|
|
|
|
|
41 => saleItem.SellingPrice?.ToString(),
|
|
|
|
|
42 => saleItem.SaleTime?.ToString(dateTimeStr),
|
|
|
|
|
_ => ""
|
|
|
|
|
};
|
|
|
|
|
cell2.SetCellValue(value2);
|
|
|
|
@ -3483,20 +3519,18 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
rowIndex++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var fileFullPath = Path.Combine(App.WebHostEnvironment.WebRootPath, App.GetOptions<TempFileOptions>().Path);//服务器路径
|
|
|
|
|
if (!Directory.Exists(fileFullPath))
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(fileFullPath);
|
|
|
|
|
}
|
|
|
|
|
//var fileFullPath = Path.Combine(App.WebHostEnvironment.WebRootPath, App.GetOptions<TempFileOptions>().Path);//服务器路径
|
|
|
|
|
//if (!Directory.Exists(fileFullPath))
|
|
|
|
|
//{
|
|
|
|
|
// Directory.CreateDirectory(fileFullPath);
|
|
|
|
|
//}
|
|
|
|
|
var fileName = $"舱位导出_{DateTime.Now.ToString("yyyyMMdd-HHmmss")}.xlsx";//名称
|
|
|
|
|
var filestream = new FileStream(Path.Combine(fileFullPath, fileName), FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
|
|
|
|
var filestream = new FileStream(Path.Combine("", fileName), FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
|
|
|
|
excelwork.Write(filestream);
|
|
|
|
|
|
|
|
|
|
await Task.Delay(2000);
|
|
|
|
|
//return HttpUtility.UrlEncode(fileName, Encoding.GetEncoding("UTF-8"));
|
|
|
|
|
return fileName;*/
|
|
|
|
|
|
|
|
|
|
return DataResult<string>.Success(string.Empty);
|
|
|
|
|
return DataResult<string>.Success(fileName);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|