zhangxiaofeng 4 months ago
commit 8f1b71c668

@ -207,6 +207,9 @@ public static class MultiLanguageConst
[Description("权限模块不存在")] [Description("权限模块不存在")]
public const string PermissionNotExist = "Permission_NotExist"; public const string PermissionNotExist = "Permission_NotExist";
[Description("此模块未授权")]
public const string ModuleUnauthorized = "Module_Unauthorized";
[Description("数据权限已存在")] [Description("数据权限已存在")]
public const string DataRuleExist = "Data_Rule_Exist"; public const string DataRuleExist = "Data_Rule_Exist";
@ -1413,7 +1416,11 @@ public static class MultiLanguageConst
[Description("获取舱位变更比对结果错误,比对内容不存在")] [Description("获取舱位变更比对结果错误,比对内容不存在")]
public const string BookingSlotCompareJsonNull = "BookingSlot_CompareJsonNull"; public const string BookingSlotCompareJsonNull = "BookingSlot_CompareJsonNull";
/// <summary>
/// 舱位台账导出模板【舱位台账导出模板】文件不存在
/// </summary>
[Description("舱位台账导出模板【舱位台账导出模板】文件不存在")]
public const string BookingSlotExportTemplateNull = "BookingSlot_ExportTemplateNull";
#endregion #endregion

@ -88,6 +88,17 @@ public class DataResult : DataResult<object>
return new DataResult(ResultCode.Success, message, multiCode); return new DataResult(ResultCode.Success, message, multiCode);
} }
public static DataResult SuccessedWithDesc(string fieldName)
{
var fieldInfo = typeof(MultiLanguageConst).GetField(fieldName) ?? throw new ArgumentException($"不存在的常量:{fieldName}", fieldName);
var attribute = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
var desc = attribute?.Description ?? string.Empty;
var value = fieldInfo.GetValue(null) as string ?? string.Empty;
return Successed(desc, value);
}
/// <summary> /// <summary>
/// 其他操作 /// 其他操作
/// </summary> /// </summary>
@ -170,7 +181,7 @@ public class DataResult : DataResult<object>
var desc = attribute?.Description ?? string.Empty; var desc = attribute?.Description ?? string.Empty;
var value = fieldInfo.GetValue(null) as string ?? string.Empty; var value = fieldInfo.GetValue(null) as string ?? string.Empty;
return Failed(desc, fieldName); return Failed(desc, value);
} }
} }
@ -269,7 +280,7 @@ public class DataResult<TData> : IDataResult<ResultCode, TData>
/// <summary> /// <summary>
/// 附加数据 /// 附加数据
/// </summary> /// </summary>
public Dictionary<string,object>? AdditionalData { get; set; } public Dictionary<string, object>? AdditionalData { get; set; }
/// <summary> /// <summary>
/// 返回成功的结果 /// 返回成功的结果

@ -66,7 +66,7 @@ namespace DS.WMS.Core.Fee.Method
if (!request.QueryCondition.IsNullOrEmpty()) if (!request.QueryCondition.IsNullOrEmpty())
{ {
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); var whereList = request.GetConditionalModels(Db);
queryList = queryList.Where(whereList); queryList = queryList.Where(whereList);
} }

@ -42,7 +42,7 @@ namespace DS.WMS.Core.Fee.Method
{ {
long UserId = long.Parse(User.UserId); long UserId = long.Parse(User.UserId);
//序列化查询条件 //序列化查询条件
var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); var whereList = request.GetConditionalModels(Db);
var data = await TenantDb.Queryable<FeeRecord>() var data = await TenantDb.Queryable<FeeRecord>()
.Where(x => x.IsOpen || (!x.IsOpen && x.CreateBy == UserId)) .Where(x => x.IsOpen || (!x.IsOpen && x.CreateBy == UserId))
.Where(whereList) .Where(whereList)

@ -23,7 +23,7 @@ public class ClientFlowInstanceService : FlowInstanceService, IClientFlowInstanc
saasService = serviceProvider.GetRequiredService<ISaasDbService>(); saasService = serviceProvider.GetRequiredService<ISaasDbService>();
} }
protected override FlowInstance BuildInstance(CreateFlowInstanceReq req) protected override FlowInstance? BuildInstance(CreateFlowInstanceReq req)
{ {
if (string.IsNullOrEmpty(req.TemplateId.ToString())) if (string.IsNullOrEmpty(req.TemplateId.ToString()))
return null; return null;

@ -1,4 +1,3 @@
using System.Text;
using DS.Module.Core; using DS.Module.Core;
using DS.Module.Core.Extensions; using DS.Module.Core.Extensions;
using DS.Module.UserModule; using DS.Module.UserModule;
@ -78,7 +77,7 @@ public class FlowInstanceService : IFlowInstanceService
} }
} }
protected virtual FlowInstance BuildInstance(CreateFlowInstanceReq req) protected virtual FlowInstance? BuildInstance(CreateFlowInstanceReq req)
{ {
if (string.IsNullOrEmpty(req.TemplateId.ToString())) if (string.IsNullOrEmpty(req.TemplateId.ToString()))
return null; return null;

@ -6,6 +6,46 @@ using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos namespace DS.WMS.Core.Op.Dtos
{ {
/// <summary>
/// 订阅的列表
/// </summary>
public class BillTraceSendReq
{
/// <summary>
/// 业务主键
/// </summary>
public string BusinessId { get; set; }
/// <summary>
/// 提单号ONEYTA3ZR0262300
/// </summary>
public string MBLNO { get; set; }
/// <summary>
/// 场站名称,例:外运场站
/// </summary>
public string Yard { get; set; }
/// <summary>
/// 场站Id
/// </summary>
public long YardId { get; set; }
/// <summary>
/// 船公司Id
/// </summary>
public long CarrierId { get; set; }
/// <summary>
/// 船公司名称ONE
/// </summary>
public string Carrier { get; set; }
/// <summary>
/// 是否订阅港后的运踪默认为false
/// </summary>
public bool isBook { get; set; }
/// <summary>
/// 是否订阅港前运踪默认为true
/// </summary>
public bool IsFrontPort { get; set; }
}
/// <summary> /// <summary>
/// 订阅的列表 /// 订阅的列表
/// </summary> /// </summary>

@ -378,6 +378,50 @@ namespace DS.WMS.Core.Op.Dtos
/// </summary> /// </summary>
public List<BookingLabelBaseDto> LabelList { get; set; } public List<BookingLabelBaseDto> LabelList { get; set; }
/// <summary>
/// VGM回执
/// </summary>
public string VGMRltStat { get; set; }
/// <summary>
/// SI回执
/// </summary>
public string SIRltStat { get; set; }
/// <summary>
/// 提箱回执
/// </summary>
public string TakeCtnRltStat { get; set; }
/// <summary>
/// 还箱回执
/// </summary>
public string ReturnCtnRltStat { get; set; }
/// <summary>
/// 预甩回执
/// </summary>
public string NominationRltStat { get; set; }
/// <summary>
/// BC变更回执
/// </summary>
public string AmendmentRltStat { get; set; }
/// <summary>
/// BC取消回执
/// </summary>
public string CancellationRltStat { get; set; }
/// <summary>
/// 目的港卸船未提货回执
/// </summary>
public string DischargeFullRltStat { get; set; }
/// <summary>
/// 目的港提箱未还空箱回执
/// </summary>
public string GateOutFullRltStat { get; set; }
} }
/// <summary> /// <summary>

@ -27,5 +27,10 @@ namespace DS.WMS.Core.Op.Dtos.TaskInteraction
/// 任务状态 /// 任务状态
/// </summary> /// </summary>
public TaskStatusEnum TaskStatus { get; set; } public TaskStatusEnum TaskStatus { get; set; }
/// <summary>
/// 当任务完成时是否根据任务类型自动创建下一任务默认为true
/// </summary>
public bool AutoCreateNext { get; set; } = true;
} }
} }

@ -153,7 +153,7 @@ namespace DS.WMS.Core.Op.Interface
/// <param name="tenantId">租户ID</param> /// <param name="tenantId">租户ID</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<BookingSlotWithOrderDto> SearchBookingSlotWithOrderByNo(string slotBookingNo, long tenantId); Task<DataResult<BookingSlotWithOrderDto>> SearchBookingSlotWithOrderByNo(string slotBookingNo, long tenantId);
/// <summary> /// <summary>
/// 请求BC比对 /// 请求BC比对
@ -214,9 +214,9 @@ namespace DS.WMS.Core.Op.Interface
/// <summary> /// <summary>
/// 导出舱位为Excel /// 导出舱位为Excel
/// </summary> /// </summary>
/// <param name="input">请求参数</param> /// <param name="querySearch">请求参数</param>
/// <returns></returns> /// <returns></returns>
Task<DataResult<string>> ExportOrder(BookingSlotBasePageInput input); Task<DataResult<string>> ExportOrder(PageRequest querySearch);
/// <summary> /// <summary>
/// 作废舱位(可以批量) /// 作废舱位(可以批量)

@ -81,7 +81,7 @@ public interface ISeaExportService
/// </summary> /// </summary>
/// <param name="req"></param> /// <param name="req"></param>
/// <returns></returns> /// <returns></returns>
public Task<DataResult<string>> SendOrUpdateTrace(List<BillTraceReq> req); public Task<DataResult<string>> SendOrUpdateTrace(List<BillTraceSendReq> req);
/// <summary> /// <summary>
/// 运踪退订 /// 运踪退订
/// </summary> /// </summary>

@ -1,10 +1,18 @@
namespace DS.WMS.Core.Op.Interface.TaskInteraction using DS.Module.Core;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
namespace DS.WMS.Core.Op.Interface.TaskInteraction
{ {
/// <summary> /// <summary>
/// 海运出口交互任务 /// 海运出口交互任务
/// </summary> /// </summary>
public interface ISeaExportTaskService : ITaskService public interface ISeaExportTaskService : ITaskService
{ {
/// <summary>
/// 创建关联子任务
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Task<DataResult> CreateSubTaskAsync(IEnumerable<TaskCreationRequest> request);
} }
} }

@ -21,8 +21,9 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// 设置任务状态 /// 设置任务状态
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="useTransaction">是否使用事务</param>
/// <returns></returns> /// <returns></returns>
Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request); Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request, bool useTransaction = true);
/// <summary> /// <summary>
/// 审批完成回调更新 /// 审批完成回调更新

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

@ -6,6 +6,7 @@ using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Interface; using DS.WMS.Core.Op.Interface;
using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.Sys.Entity;
using Masuit.Tools;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -173,7 +174,7 @@ namespace DS.WMS.Core.Op.Method
} }
filesPath.Add(fileSaveName); filesPath.Add(fileSaveName);
} }
return await Task.FromResult(DataResult<string>.Success("批量上传成功", filesPath.ToString())); return await Task.FromResult(DataResult<string>.Success(string.Join(",",filesPath.ToArray())));
//return await Task.FromResult(DataResult<string>.Success(fileRelaPath)); //return await Task.FromResult(DataResult<string>.Success(fileRelaPath));
} }
/// <summary> /// <summary>

@ -235,6 +235,10 @@ namespace DS.WMS.Core.Op.Method
} }
var fPath = "upload/printtemplate/箱满舱上传Excel模板.xls"; var fPath = "upload/printtemplate/箱满舱上传Excel模板.xls";
var fileAbsPath = Path.Combine(dirAbs, fPath); var fileAbsPath = Path.Combine(dirAbs, fPath);
if (!File.Exists(fileAbsPath))
{
return await Task.FromResult(DataResult<string>.Failed("未配置箱满舱上传Excel模板"));
}
_logger.Info($"准备调用EXCEL"); _logger.Info($"准备调用EXCEL");
var file = new FileStream(fileAbsPath, FileMode.Open); var file = new FileStream(fileAbsPath, FileMode.Open);
var excelwork = new HSSFWorkbook(file); var excelwork = new HSSFWorkbook(file);

@ -20,7 +20,7 @@ namespace DS.WMS.Core.Op.Method
/// </summary> /// </summary>
/// <param name="req"></param> /// <param name="req"></param>
/// <returns></returns> /// <returns></returns>
public async Task<DataResult<string>> SendOrUpdateTrace(List<BillTraceReq> req) public async Task<DataResult<string>> SendOrUpdateTrace(List<BillTraceSendReq> req)
{ {
if (req.Count == 0) if (req.Count == 0)
{ {
@ -37,7 +37,9 @@ namespace DS.WMS.Core.Op.Method
List<BillTraceReq> billTraceList = new List<BillTraceReq>(); List<BillTraceReq> billTraceList = new List<BillTraceReq>();
foreach (var item in req) foreach (var item in req)
{ {
if (!string.IsNullOrWhiteSpace(item.CARRIERID)) var yardCode = seaComService.GetClientCode(item.YardId, tenantDb);
var carrierCode = seaComService.GetClientCode(item.CarrierId, tenantDb);
if (!string.IsNullOrWhiteSpace(item.CarrierId.ToString()))
{ {
var et = await tenantDb.Queryable<BookingStatus>().Where(x => x.StatusCode == "status_mudigang" && x.BusinessId == Convert.ToInt64(item.BusinessId)).FirstAsync(); var et = await tenantDb.Queryable<BookingStatus>().Where(x => x.StatusCode == "status_mudigang" && x.BusinessId == Convert.ToInt64(item.BusinessId)).FirstAsync();
if (et != null) if (et != null)
@ -46,7 +48,7 @@ namespace DS.WMS.Core.Op.Method
} }
} }
if (!string.IsNullOrWhiteSpace(item.YardCode)) if (!string.IsNullOrWhiteSpace(item.YardId.ToString()))
{ {
var et = await tenantDb.Queryable<BookingStatus>().Where(x => x.StatusCode == "status_qiyungang" && x.BusinessId == Convert.ToInt64(item.BusinessId)).FirstAsync(); var et = await tenantDb.Queryable<BookingStatus>().Where(x => x.StatusCode == "status_qiyungang" && x.BusinessId == Convert.ToInt64(item.BusinessId)).FirstAsync();
if (et != null) if (et != null)
@ -55,42 +57,42 @@ namespace DS.WMS.Core.Op.Method
} }
} }
if (item.isBook && (string.IsNullOrWhiteSpace(item.CARRIERID) || string.IsNullOrWhiteSpace(item.CARRIER) || string.IsNullOrWhiteSpace(item.MBLNO))) if (item.isBook && (string.IsNullOrWhiteSpace(carrierCode) || string.IsNullOrWhiteSpace(item.Carrier) || string.IsNullOrWhiteSpace(item.MBLNO)))
{ {
return await Task.FromResult(DataResult<string>.Failed("订阅目的港船公司或提单号不能为空!")); return await Task.FromResult(DataResult<string>.Failed("订阅目的港船公司或提单号不能为空!"));
} }
if (!item.isBook && (string.IsNullOrWhiteSpace(item.YARD) || string.IsNullOrWhiteSpace(item.YardCode) || string.IsNullOrWhiteSpace(item.MBLNO))) if (!item.isBook && (string.IsNullOrWhiteSpace(item.Yard) || string.IsNullOrWhiteSpace(yardCode) || string.IsNullOrWhiteSpace(item.MBLNO)))
{ {
return await Task.FromResult(DataResult<string>.Failed("订阅港前数据提单号或场站不能为空!")); return await Task.FromResult(DataResult<string>.Failed("订阅港前数据提单号或场站不能为空!"));
} }
var yardMap = tenantDb.Queryable<MappingYard>().Where(x => x.Code == item.YardCode && x.Module == "BillTrace").First(); var yardMap = tenantDb.Queryable<MappingYard>().Where(x => x.Code == yardCode && x.Module == "BillTrace").First();
if (yardMap.IsNull()) if (yardMap.IsNull())
{ {
return await Task.FromResult(DataResult<string>.Failed($"场站代号配置未找到:{item.YardCode}")); return await Task.FromResult(DataResult<string>.Failed($"场站代号配置未找到:{yardCode}"));
} }
billTraceList.Add(new BillTraceReq billTraceList.Add(new BillTraceReq
{ {
BusinessId = item.BusinessId, BusinessId = item.BusinessId,
MBLNO = item.MBLNO, MBLNO = item.MBLNO,
YARD = item.YARD == "" ? null : item.YARD, YARD = item.Yard == "" ? null : item.Yard,
YardCode = yardMap.MapCode == "" ? null : yardMap.MapCode, YardCode = yardMap.MapCode == "" ? null : yardMap.MapCode,
CARRIER = item.CARRIER == "" ? null : item.CARRIER, CARRIER = item.Carrier == "" ? null : item.Carrier,
CARRIERID = item.CARRIERID == "" ? null : item.CARRIERID, CARRIERID = carrierCode == "" ? null : carrierCode,
isBook = item.isBook isBook = item.isBook
}); });
var status = string.Empty; var status = string.Empty;
var IsBookingYZ = String.Empty; var IsBookingYZ = String.Empty;
if (!string.IsNullOrWhiteSpace(item.YardCode) && !string.IsNullOrWhiteSpace(item.CARRIERID)) if (!string.IsNullOrWhiteSpace(yardCode) && !string.IsNullOrWhiteSpace(carrierCode))
{ {
status = "订阅起运港,目的港"; status = "订阅起运港,目的港";
IsBookingYZ = "3"; IsBookingYZ = "3";
} }
else if (string.IsNullOrWhiteSpace(item.YardCode) && !string.IsNullOrWhiteSpace(item.CARRIERID)) else if (string.IsNullOrWhiteSpace(yardCode) && !string.IsNullOrWhiteSpace(carrierCode))
{ {
status = "订阅目的港"; status = "订阅目的港";
IsBookingYZ = "2"; IsBookingYZ = "2";
} }
else if (!string.IsNullOrWhiteSpace(item.YardCode) && string.IsNullOrWhiteSpace(item.CARRIERID)) else if (!string.IsNullOrWhiteSpace(yardCode) && string.IsNullOrWhiteSpace(carrierCode))
{ {
status = "订阅起运港"; status = "订阅起运港";
IsBookingYZ = "1"; IsBookingYZ = "1";

@ -55,10 +55,9 @@ namespace DS.WMS.Core.Op.Method
.InnerJoin<SysDictType>((a, b) => a.TypeId == b.Id).Where((a, b) => b.Code == "txxp_carrier_list").Select((a, b) => a.Value).ToList(); .InnerJoin<SysDictType>((a, b) => a.TypeId == b.Id).Where((a, b) => b.Code == "txxp_carrier_list").Select((a, b) => a.Value).ToList();
var carrCode = seaComService.GetClientCode(order.CarrierId, tenantDb); var carrCode = seaComService.GetClientCode(order.CarrierId, tenantDb);
if (!allowCarrier.Contains(carrCode)) if (!allowCarrier.Contains(carrCode))
return await Task.FromResult(DataResult<string>.Failed("不支持的船公司")); return await Task.FromResult(DataResult<string>.Failed("不支持的船公司:"+ carrCode));
var carrMap = tenantDb.Queryable<MappingCarrier>().Where(y => y.Code == carrCode && y.Module == "BookingTxxp").First();
var carrMap = tenantDb.Queryable<MappingCarrier>().Where(y => y.Code == order.Carrier && y.Module == "BookingTxxp").First();
if (carrMap != null) if (carrMap != null)
{ {
carrCode = carrMap.MapCode; carrCode = carrMap.MapCode;
@ -88,8 +87,8 @@ namespace DS.WMS.Core.Op.Method
return await Task.FromResult(DataResult<string>.Failed(String.Format("场站EDI配置未找到{0}", $"{order.Yard} {order.Carrier}(提箱小票)"))); return await Task.FromResult(DataResult<string>.Failed(String.Format("场站EDI配置未找到{0}", $"{order.Yard} {order.Carrier}(提箱小票)")));
} }
//var yardCode = seaComService.GetClientCode(order.YardId, tenantDb);
var yardset = yardsetList.FirstOrDefault(x => x.Code == order.Carrier); var yardset = yardsetList.FirstOrDefault(x => x.Code == carrCode);
if (yardset == null) if (yardset == null)
{ {
yardset = yardsetList.FirstOrDefault(x => x.Code == null || x.Code == ""); yardset = yardsetList.FirstOrDefault(x => x.Code == null || x.Code == "");

@ -147,7 +147,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
protected override async Task OnTaskStatusChanged(TaskUpdateRequest request) protected override async Task OnTaskStatusChanged(TaskUpdateRequest request)
{ {
//放舱结束,根据业务所选服务,生成子任务 //放舱结束,根据业务所选服务,生成子任务
if (request.TaskType == TaskBaseTypeEnum.WAIT_SPACE_RELEASE) if (request.TaskType == TaskBaseTypeEnum.WAIT_SPACE_RELEASE && request.TaskStatus == TaskStatusEnum.Complete)
{ {
var list = await GetSubRequestAsync(request.BusinessId, request.BusinessType); var list = await GetSubRequestAsync(request.BusinessId, request.BusinessType);
await CreateSubTaskAsync(list); await CreateSubTaskAsync(list);

@ -1,5 +1,6 @@
using DS.Module.Core; using DS.Module.Core;
using DS.Module.Core.Extensions; using DS.Module.Core.Extensions;
using DS.Module.Core.Helpers;
using DS.WMS.Core.Fee.Method; using DS.WMS.Core.Fee.Method;
using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Op.Dtos.TaskInteraction; using DS.WMS.Core.Op.Dtos.TaskInteraction;
@ -20,6 +21,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// </summary> /// </summary>
public abstract class TaskService : FeeServiceBase, ITaskService public abstract class TaskService : FeeServiceBase, ITaskService
{ {
const long PERMISSION_ID = 1815294400855674880;
/// <summary> /// <summary>
/// 任务管理服务 /// 任务管理服务
/// </summary> /// </summary>
@ -34,6 +37,26 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
ManagerService = provider.GetRequiredService<ITaskManageService>(); ManagerService = provider.GetRequiredService<ITaskManageService>();
} }
/// <summary>
/// 确保任务交互模块已授权
/// </summary>
/// <returns></returns>
protected virtual async Task<bool> EnsureModuleAuthorized()
{
//if (!await Db.Queryable<SysPermissionTenant>().AnyAsync(x => x.PermissionId == PERMISSION_ID))
// return false;
long tid = long.Parse(User.TenantId);
var authStr = await Db.Queryable<SysTenantPermissionAuth>().Where(x => x.PermissionId == PERMISSION_ID && x.TenantId == tid &&
SqlFunc.Subqueryable<SysPermissionTenant>().Where(spt => spt.PermissionId == x.PermissionId).Any())
.Select(x => x.AuthNum).FirstAsync();
if (authStr.IsNullOrEmpty())
return false;
var appSecret = await Db.Queryable<SysTenant>().Where(x => x.Id == tid).Select(x => x.AppSecret).FirstAsync();
return int.TryParse(EncrypteHelper.DecryptData(authStr, appSecret), out int authNum) && authNum > 0;
}
/// <summary> /// <summary>
/// 创建关联任务 /// 创建关联任务
/// </summary> /// </summary>
@ -42,6 +65,9 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// <returns></returns> /// <returns></returns>
public async Task<DataResult> CreateTaskAsync(TaskCreationRequest request, bool useTransaction = true) public async Task<DataResult> CreateTaskAsync(TaskCreationRequest request, bool useTransaction = true)
{ {
if (!await EnsureModuleAuthorized())
return DataResult.SuccessedWithDesc(nameof(MultiLanguageConst.ModuleUnauthorized));
var task = await GetTaskAsync(request.BusinessId, request.BusinessType, request.TaskType); var task = await GetTaskAsync(request.BusinessId, request.BusinessType, request.TaskType);
if (task != null) if (task != null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Task_Exists)); return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Task_Exists));
@ -146,10 +172,16 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// 设置任务状态 /// 设置任务状态
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="useTransaction">是否使用事务</param>
/// <returns></returns> /// <returns></returns>
public async Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request) public async Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request, bool useTransaction = true)
{ {
await TenantDb.Ado.BeginTranAsync(); if (!await EnsureModuleAuthorized())
return DataResult.SuccessedWithDesc(nameof(MultiLanguageConst.ModuleUnauthorized));
if (useTransaction)
await TenantDb.Ado.BeginTranAsync();
try try
{ {
var result = await ManagerService.SetTaskStatus(request.BusinessId, request.TaskType, request.TaskStatus, DateTime.Now); var result = await ManagerService.SetTaskStatus(request.BusinessId, request.TaskType, request.TaskStatus, DateTime.Now);
@ -161,7 +193,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (task == null) if (task == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData)); return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData));
if (task.TaskStatus!= request.TaskStatus) if (task.TaskStatus != request.TaskStatus)
await OnTaskStatusChanged(request); await OnTaskStatusChanged(request);
task.TaskStatus = request.TaskStatus; task.TaskStatus = request.TaskStatus;
@ -170,7 +202,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (task.TaskStatus == TaskStatusEnum.Complete) if (task.TaskStatus == TaskStatusEnum.Complete)
{ {
//若存在下一任务,则继续创建 //若存在下一任务,则继续创建
if (task.NextType.HasValue) if (task.NextType.HasValue && request.AutoCreateNext)
{ {
var req = new TaskCreationRequest var req = new TaskCreationRequest
{ {
@ -182,12 +214,16 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
} }
} }
await TenantDb.Ado.CommitTranAsync(); if (useTransaction)
await TenantDb.Ado.CommitTranAsync();
return DataResult.Success; return DataResult.Success;
} }
catch (Exception ex) catch (Exception ex)
{ {
await TenantDb.Ado.RollbackTranAsync(); if (useTransaction)
await TenantDb.Ado.RollbackTranAsync();
await ex.LogAsync(Db); await ex.LogAsync(Db);
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
} }
@ -223,6 +259,13 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
}); });
} }
/// <summary>
/// 获取指定类型的业务关联任务
/// </summary>
/// <param name="id">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="taskType">任务类型</param>
/// <returns></returns>
protected internal async Task<BusinessTask> GetTaskAsync(long id, BusinessType businessType, TaskBaseTypeEnum taskType) protected internal async Task<BusinessTask> GetTaskAsync(long id, BusinessType businessType, TaskBaseTypeEnum taskType)
{ {
return await TenantDb.Queryable<BusinessTask>().FirstAsync(x => return await TenantDb.Queryable<BusinessTask>().FirstAsync(x =>

@ -12,10 +12,10 @@ public class UserViewModel
/// </summary> /// </summary>
public string UserCode { get; set; } public string UserCode { get; set; }
/// <summary> ///// <summary>
/// 密码 ///// 密码
/// </summary> ///// </summary>
public string Password { get; set; } //public string Password { get; set; }
/// <summary> /// <summary>
///姓名 ///姓名

@ -239,7 +239,7 @@ namespace DS.WMS.OpApi.Controllers
[Route("SearchBookingSlotWithOrderByNo")] [Route("SearchBookingSlotWithOrderByNo")]
public async Task<DataResult<BookingSlotWithOrderDto>> SearchBookingSlotWithOrderByNo([FromQuery] string slotBookingNo, [FromQuery] long tenantId) public async Task<DataResult<BookingSlotWithOrderDto>> SearchBookingSlotWithOrderByNo([FromQuery] string slotBookingNo, [FromQuery] long tenantId)
{ {
return null; //await _bookingSlotService.SearchBookingSlotWithOrderByNo(slotBookingNo, tenantId); return await _bookingSlotService.SearchBookingSlotWithOrderByNo(slotBookingNo, tenantId);
} }
#endregion #endregion
@ -371,5 +371,19 @@ namespace DS.WMS.OpApi.Controllers
return await _bookingSlotService.GetAvailableCtnsBySlot(slotId); return await _bookingSlotService.GetAvailableCtnsBySlot(slotId);
} }
#endregion #endregion
#region 导出舱位为Excel
/// <summary>
/// 导出舱位为Excel
/// </summary>
/// <param name="querySearch">请求参数</param>
/// <returns>返回文件链接</returns>
[HttpPost]
[Route("ExportOrder")]
public async Task<DataResult<string>> ExportOrder([FromBody] PageRequest querySearch)
{
return await _bookingSlotService.ExportOrder(querySearch);
}
#endregion
} }
} }

@ -11,6 +11,7 @@ namespace DS.WMS.OpApi.Controllers;
/// <summary> /// <summary>
/// 函电信息更改通知服务 /// 函电信息更改通知服务
/// </summary> /// </summary>
[Obsolete]
public class LetterChangeController : ApiController public class LetterChangeController : ApiController
{ {
private readonly IOpLetterChangeService _invokeService; private readonly IOpLetterChangeService _invokeService;

@ -11,6 +11,7 @@ namespace DS.WMS.OpApi.Controllers;
/// <summary> /// <summary>
/// 函电信息电放保函服务 /// 函电信息电放保函服务
/// </summary> /// </summary>
[Obsolete]
public class LetterSurController : ApiController public class LetterSurController : ApiController
{ {
private readonly IOpLetterSurService _invokeService; private readonly IOpLetterSurService _invokeService;

@ -11,6 +11,7 @@ namespace DS.WMS.OpApi.Controllers;
/// <summary> /// <summary>
/// 函电信息派车通知服务 /// 函电信息派车通知服务
/// </summary> /// </summary>
[Obsolete]
public class LetterTruckController : ApiController public class LetterTruckController : ApiController
{ {
private readonly IOpLetterTruckService _invokeService; private readonly IOpLetterTruckService _invokeService;

@ -11,6 +11,7 @@ namespace DS.WMS.OpApi.Controllers;
/// <summary> /// <summary>
/// 函电信息入货通知服务 /// 函电信息入货通知服务
/// </summary> /// </summary>
[Obsolete]
public class LetterYardController : ApiController public class LetterYardController : ApiController
{ {
private readonly IOpLetterYardService _invokeService; private readonly IOpLetterYardService _invokeService;

@ -156,7 +156,7 @@ public class SeaExportController : ApiController
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("SendOrUpdateTrace")] [Route("SendOrUpdateTrace")]
public async Task<DataResult<string>> SendOrUpdateTrace([FromBody]List<BillTraceReq> req) public async Task<DataResult<string>> SendOrUpdateTrace([FromBody]List<BillTraceSendReq> req)
{ {
return await _invokeService.SendOrUpdateTrace(req); return await _invokeService.SendOrUpdateTrace(req);
} }

@ -27,7 +27,7 @@
}, },
"FileSettings": { "FileSettings": {
"BasePath": "", //使 "BasePath": "", //使
"MovePath": "D:\\Code\\DS\\ds8-solution-pro\\ds-wms-service\\DS.WMS.MainApi\\wwwroot\\LinkAttach", "MovePath": "D:\\ds8\\main-api\\wwwroot\\LinkAttach",
"FileType": [ ".xls", ".xlsx", ".pdf", ".jpg", ".png", ".txt", ".pms" ] "FileType": [ ".xls", ".xlsx", ".pdf", ".jpg", ".png", ".txt", ".pms" ]
} }
} }

Loading…
Cancel
Save