|
|
|
@ -29,6 +29,7 @@ using Masuit.Tools.Systems;
|
|
|
|
|
using Amazon.Runtime.Internal.Util;
|
|
|
|
|
using DS.Module.RedisModule;
|
|
|
|
|
using Fasterflect;
|
|
|
|
|
using AngleSharp.Dom;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Op.Method
|
|
|
|
@ -1617,7 +1618,84 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<DataResult<ServiceWorkFlowRunDto>> GetShowTimeLine(string id)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
var showModel = new ServiceWorkFlowRunDto();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
根据已保存的服务流程生成测试数据
|
|
|
|
|
*/
|
|
|
|
|
var model = InnerGetShowInfo(id);
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
|
|
|
|
{
|
|
|
|
|
showModel.PKId = id;
|
|
|
|
|
|
|
|
|
|
if (model.ServiceProject != null)
|
|
|
|
|
{
|
|
|
|
|
showModel.ServiceProjectName = model.ServiceProject.ServiceProjectName;
|
|
|
|
|
showModel.ServiceProjectCode = model.ServiceProject.ServiceProjectCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (model.StatusSkuList != null && model.StatusSkuList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
int endSortNo = model.StatusSkuList.Max(a => a.SortNo);
|
|
|
|
|
|
|
|
|
|
DateTime startDate = DateTime.Now.AddDays(-(endSortNo + 1));
|
|
|
|
|
|
|
|
|
|
showModel.ActivitiesList = model.StatusSkuList.Select(a => {
|
|
|
|
|
|
|
|
|
|
var runModel = new ServiceWorkFlowActivitiesRunDto
|
|
|
|
|
{
|
|
|
|
|
PKId = Guid.NewGuid().ToString(),
|
|
|
|
|
ActDate = startDate.AddDays(a.SortNo),
|
|
|
|
|
ActId = a.PKId,
|
|
|
|
|
ExecSortNo = a.SortNo,
|
|
|
|
|
ActVal = string.Empty,
|
|
|
|
|
IsStart = (a.SortNo == 1) ? 1 : 0,
|
|
|
|
|
IsEnd = (a.SortNo == endSortNo) ? 1 : 0,
|
|
|
|
|
IsYield = 1,
|
|
|
|
|
RunId = Guid.NewGuid().ToString(),
|
|
|
|
|
ShowName = a.ShowName,
|
|
|
|
|
SourceType = "AUTO",
|
|
|
|
|
StatusSKUCode = a.statusSkuBase.StatusSKUCode,
|
|
|
|
|
StatusSKUId = a.StatusSKUId
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (a.IsContainsSub == 1)
|
|
|
|
|
{
|
|
|
|
|
int endSubSortNo = a.SubList.Max(a => a.SortNo);
|
|
|
|
|
|
|
|
|
|
DateTime startSubDate = DateTime.Now.AddDays(-(endSubSortNo + 1));
|
|
|
|
|
|
|
|
|
|
runModel.SubList = a.SubList.Select(b => {
|
|
|
|
|
var subModel = new ServiceWorkFlowActivitiesRunSubDto
|
|
|
|
|
{
|
|
|
|
|
PKId = Guid.NewGuid().ToString(),
|
|
|
|
|
ActDate = startSubDate.AddDays(b.SortNo),
|
|
|
|
|
ActId = b.PKId,
|
|
|
|
|
ExecSortNo = b.SortNo,
|
|
|
|
|
ActVal = string.Empty,
|
|
|
|
|
IsStart = (b.SortNo == 1) ? 1 : 0,
|
|
|
|
|
IsEnd = (b.SortNo == endSortNo) ? 1 : 0,
|
|
|
|
|
IsYield = 1,
|
|
|
|
|
RunId = Guid.NewGuid().ToString(),
|
|
|
|
|
ShowName = b.ShowName,
|
|
|
|
|
SourceType = "AUTO",
|
|
|
|
|
StatusSKUCode = b.statusSkuBase.StatusSKUCode,
|
|
|
|
|
StatusSKUId = b.StatusSKUId
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return subModel;
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return runModel;
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult<ServiceWorkFlowRunDto>.Success(showModel);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -1629,7 +1707,88 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<DataResult<string>> SaveWFActivities(ServiceWorkFlowActivitiesDto info)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
1、状态有记录。
|
|
|
|
|
2、同一状态不能有相同的显示名称
|
|
|
|
|
3、已经关联服务流程的,并且已经发布的不能修改内容。(只可以新增)
|
|
|
|
|
*/
|
|
|
|
|
var entity = info.Adapt<ServiceWorkFlowActivitiesInfo>();
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(entity.STATUS_SKU_ID))
|
|
|
|
|
{
|
|
|
|
|
//状态信息不能为空
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ServiceWorkFlowBaseStatusNotNull)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(entity.SHOW_NAME) || entity.SHOW_NAME.Length < 2)
|
|
|
|
|
{
|
|
|
|
|
//状态显示名称不能为空,并且不能少于2个字符
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ServiceWorkFlowBaseActNameLessTwoChar)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//同一状态不能有相同的显示名称
|
|
|
|
|
var checkList = tenantDb.Queryable<ServiceWorkFlowActivitiesInfo>()
|
|
|
|
|
.Where(a => a.STATUS_SKU_ID == entity.STATUS_SKU_ID
|
|
|
|
|
&& a.SHOW_NAME == entity.SHOW_NAME && a.PK_ID != entity.PK_ID).ToList();
|
|
|
|
|
|
|
|
|
|
if (checkList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//已存在相同的状态设置,不能保存
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ServiceWorkFlowBaseActStatusSame)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//_logger.LogInformation($"服务项目保存 JSON={JSON.Serialize(entity)} user={UserManager.UserId}");
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(entity.PK_ID))
|
|
|
|
|
{
|
|
|
|
|
entity.PK_ID = SnowFlakeSingle.Instance.NextId().ToString();
|
|
|
|
|
|
|
|
|
|
tenantDb.Insertable<ServiceWorkFlowActivitiesInfo>(entity).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//已经关联服务流程的,并且已经发布的不能修改内容。(只可以新增)
|
|
|
|
|
var wfRelation = tenantDb.Queryable<ServiceWorkFlowActivitiesRelation>()
|
|
|
|
|
.Where(a => a.SERVICE_ACTIVITIES_ID == entity.PK_ID)
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
if (wfRelation.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var currArg = wfRelation.Select(a => a.SERVICE_WORKFLOW_ID).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
if (tenantDb.Queryable<ServiceWorkFlowBaseInfo>().Any(a => currArg.Any(b => b == a.PK_ID)
|
|
|
|
|
&& (!string.IsNullOrWhiteSpace(a.RELEASE_VERSION) || a.IS_LOCK == 1)))
|
|
|
|
|
{
|
|
|
|
|
//当前状态已关联发布流程,不能保存
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ServiceWorkFlowBaseActStatusExists)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
entity.UpdateTime = DateTime.Now;
|
|
|
|
|
entity.UpdateBy = long.Parse(user.UserId);
|
|
|
|
|
entity.UpdateUserName = user.UserName;
|
|
|
|
|
|
|
|
|
|
await tenantDb.Updateable<ServiceWorkFlowActivitiesInfo>(entity).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.CreateTime,
|
|
|
|
|
it.CreateBy,
|
|
|
|
|
it.CreateUserName,
|
|
|
|
|
it.Deleted,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<string>.Success(entity.PK_ID);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Logger.Log(NLog.LogLevel.Info, $"保存服务流程活动异常,原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
return DataResult<string>.Failed($"保存服务流程活动异常,原因:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -1639,22 +1798,190 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="activitiesArgs">服务活动主键数组</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<DataResult<List<ServiceProjectBaseShowDto>>> GetServiceWorkFlowListByActivities(string[] activitiesArgs)
|
|
|
|
|
public async Task<DataResult<List<ServiceWorkFlowBaseShowDto>>> GetServiceWorkFlowListByActivities(string[] activitiesArgs)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
1、通过服务活动ID获取所有关联的服务流程详情列表
|
|
|
|
|
2、轮询服务流程列表,组织详细的服务流程列表
|
|
|
|
|
*/
|
|
|
|
|
var activitiesList = tenantDb.Queryable<ServiceWorkFlowActivitiesRelation>().Filter(null, true)
|
|
|
|
|
.LeftJoin<ServiceWorkFlowBaseInfo>((rela, wf) => rela.SERVICE_WORKFLOW_ID == wf.PK_ID
|
|
|
|
|
&& rela.WF_VERSION == wf.RELEASE_VERSION)
|
|
|
|
|
.Where((rela, wf) => activitiesArgs.Contains(rela.SERVICE_ACTIVITIES_ID)
|
|
|
|
|
&& !wf.Deleted == false && wf.IS_ENABLE == 1)
|
|
|
|
|
.Select((rela, wf) => wf).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
var subActList = tenantDb.Queryable<ServiceWorkFlowActivitiesSubRelation>().Filter(null, true)
|
|
|
|
|
.LeftJoin<ServiceWorkFlowBaseInfo>((rela, wf) => rela.SERVICE_WORKFLOW_ID == wf.PK_ID
|
|
|
|
|
&& rela.WF_VERSION == wf.RELEASE_VERSION)
|
|
|
|
|
.Where((rela, wf) => activitiesArgs.Contains(rela.SUB_SERVICE_ACTIVITIES_ID)
|
|
|
|
|
&& !wf.Deleted == false && wf.IS_ENABLE == 1)
|
|
|
|
|
.Select((rela, wf) => wf).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
if (subActList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
activitiesList.AddRange(subActList);
|
|
|
|
|
//去重
|
|
|
|
|
activitiesList = activitiesList.Distinct().ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (activitiesList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
Logger.Log(NLog.LogLevel.Info, $"{JsonConvert.SerializeObject(activitiesArgs)} 未检索到有效服务流程");
|
|
|
|
|
//未检索到有效服务流程
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ServiceWorkFlowBaseNotAvailableWFlow)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var wfArg = activitiesList.Select(a => a.PK_ID).ToArray();
|
|
|
|
|
|
|
|
|
|
var mergeList =
|
|
|
|
|
tenantDb.Queryable<ServiceWorkFlowBaseInfo>().Filter(null, true)
|
|
|
|
|
.LeftJoin<ServiceWorkFlowActivitiesRelation>((wf, rela) => wf.PK_ID == rela.SERVICE_WORKFLOW_ID
|
|
|
|
|
&& wf.RELEASE_VERSION == rela.WF_VERSION)
|
|
|
|
|
.LeftJoin<ServiceWorkFlowActivitiesInfo>((wf, rela, act) =>
|
|
|
|
|
rela.SERVICE_ACTIVITIES_ID == act.PK_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
|
|
|
|
|
.LeftJoin<StatusSkuBaseInfo>((wf, rela, act, sku) =>
|
|
|
|
|
act.STATUS_SKU_ID == sku.PK_ID)
|
|
|
|
|
.Where((wf) => wfArg.Contains(wf.PK_ID))
|
|
|
|
|
.Select((wf, rela, act, sku) =>
|
|
|
|
|
new { WF = wf, Act = act, Sku = sku, SortNo = rela.SORT_NO, IsSub = rela.IS_CONTAINS_SUB, ValType = rela.VAL_TYPE })
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var mergeSubList =
|
|
|
|
|
tenantDb.Queryable<ServiceWorkFlowBaseInfo>().Filter(null, true)
|
|
|
|
|
.LeftJoin<ServiceWorkFlowActivitiesSubRelation>((wf, rela) => wf.PK_ID == rela.SERVICE_WORKFLOW_ID
|
|
|
|
|
&& wf.RELEASE_VERSION == rela.WF_VERSION)
|
|
|
|
|
.LeftJoin<ServiceWorkFlowActivitiesInfo>((wf, rela, act) =>
|
|
|
|
|
rela.SUB_SERVICE_ACTIVITIES_ID == act.PK_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
|
|
|
|
|
.LeftJoin<StatusSkuBaseInfo>((wf, rela, act, sku) =>
|
|
|
|
|
act.STATUS_SKU_ID == sku.PK_ID)
|
|
|
|
|
.Where((wf) => wfArg.Contains(wf.PK_ID))
|
|
|
|
|
.Select((wf, rela, act, sku) =>
|
|
|
|
|
new { WF = wf, Act = act, Sku = sku, SortNo = rela.SORT_NO, ParentId = rela.SERVICE_ACTIVITIES_ID, ValType = rela.VAL_TYPE })
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var prjectList =
|
|
|
|
|
tenantDb.Queryable<ServiceWorkFlowBaseInfo>().Filter(null, true)
|
|
|
|
|
.LeftJoin<ServiceWorkFlowProjectRelation>((wf, rela) => wf.PK_ID == rela.SERVICE_WORKFLOW_ID
|
|
|
|
|
&& wf.RELEASE_VERSION == rela.WF_VERSION)
|
|
|
|
|
.LeftJoin<ServiceProjectBaseInfo>((wf, rela, prj) =>
|
|
|
|
|
rela.SERVICE_PROJECT_ID == prj.PK_ID)
|
|
|
|
|
.Where((wf) => wfArg.Contains(wf.PK_ID))
|
|
|
|
|
.Select((wf, rela, prj) => new { WF = wf, Rela = rela, Prj = prj }).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var list = mergeList.GroupBy(a => a.WF.PK_ID)
|
|
|
|
|
.Select(a =>
|
|
|
|
|
{
|
|
|
|
|
var model = a.FirstOrDefault().WF;
|
|
|
|
|
|
|
|
|
|
var showModel = model.Adapt<ServiceWorkFlowBaseShowDto>();
|
|
|
|
|
|
|
|
|
|
showModel.StatusSkuList = a.ToList().OrderBy(a => a.SortNo)
|
|
|
|
|
.Select(a =>
|
|
|
|
|
{
|
|
|
|
|
var actModel = a.Act.Adapt<ServiceWorkFlowActivitiesShowDto>();
|
|
|
|
|
|
|
|
|
|
actModel.SortNo = a.SortNo;
|
|
|
|
|
actModel.IsContainsSub = a.IsSub;
|
|
|
|
|
actModel.ValType = a.ValType;
|
|
|
|
|
actModel.statusSkuBase = a.Sku.Adapt<StatusSkuBaseDto>();
|
|
|
|
|
|
|
|
|
|
if (a.IsSub == 1)
|
|
|
|
|
{
|
|
|
|
|
actModel.SubList = mergeSubList.Where(
|
|
|
|
|
b =>
|
|
|
|
|
b.WF.PK_ID == a.WF.PK_ID && b.ParentId == a.Act.PK_ID)
|
|
|
|
|
.OrderBy(b => b.SortNo)
|
|
|
|
|
.Select(b =>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var actModel = b.Act.Adapt<ServiceWorkFlowActivitiesSubShowDto>();
|
|
|
|
|
|
|
|
|
|
actModel.SortNo = b.SortNo;
|
|
|
|
|
actModel.statusSkuBase = b.Sku.Adapt<StatusSkuBaseDto>();
|
|
|
|
|
|
|
|
|
|
return actModel;
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return actModel;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
return showModel;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
list = list.GroupJoin(prjectList, l => l.PKId,
|
|
|
|
|
r => r.WF.PK_ID,
|
|
|
|
|
(l, r) =>
|
|
|
|
|
{
|
|
|
|
|
var currList = r.ToList();
|
|
|
|
|
|
|
|
|
|
l.ServiceProject = currList.FirstOrDefault().Prj.Adapt<ServiceProjectBaseShowDto>();
|
|
|
|
|
|
|
|
|
|
return l;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult<List<ServiceWorkFlowBaseShowDto>>.Success(list);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Logger.Log(NLog.LogLevel.Info, $"获取所有相关服务流程列表异常,原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
return DataResult<List<ServiceWorkFlowBaseShowDto>>.Failed($"获取所有相关服务流程列表异常,原因:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 检索服务流程活动列表
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 检索服务流程活动列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="queryItem">检索值</param>
|
|
|
|
|
/// <param name="topNum">最大返回行数(默认15)</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<DataResult<List<StatusSkuBaseDto>>> QueryActivitiesList(string queryItem, int topNum = 15)
|
|
|
|
|
public async Task<DataResult<List<ServiceWorkFlowActivitiesShowDto>>> QueryActivitiesList(string queryItem, int topNum = 15)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await tenantDb.Queryable<ServiceWorkFlowActivitiesInfo>()
|
|
|
|
|
.LeftJoin<StatusSkuBaseInfo>((act, sku) => act.STATUS_SKU_ID == sku.PK_ID)
|
|
|
|
|
.Where((act, sku) => act.Deleted == false && (string.IsNullOrWhiteSpace(queryItem) || act.SHOW_NAME.Contains(queryItem)))
|
|
|
|
|
.Take(topNum).Select((act, sku) => new { Act = act, SKU = sku }).ToListAsync();
|
|
|
|
|
|
|
|
|
|
List<ServiceWorkFlowActivitiesShowDto> resultList = new List<ServiceWorkFlowActivitiesShowDto>();
|
|
|
|
|
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
resultList = list.Select(a => {
|
|
|
|
|
var info = a.Act.Adapt<ServiceWorkFlowActivitiesShowDto>();
|
|
|
|
|
|
|
|
|
|
info.statusSkuBase = a.SKU.Adapt<StatusSkuBaseDto>();
|
|
|
|
|
|
|
|
|
|
return info;
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<List<ServiceWorkFlowActivitiesShowDto>>.Success(resultList);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Logger.Log(NLog.LogLevel.Info, $"检索服务流程活动列表异常,原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
return DataResult<List<ServiceWorkFlowActivitiesShowDto>>.Failed($"检索服务流程活动列表异常,原因:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 检索可用的服务项目列表
|
|
|
|
@ -1664,9 +1991,27 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<DataResult<List<ServiceProjectBaseDto>>> GetEnableProjectList(string tenantId, bool isAvoidCache = false)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
List<ServiceProjectBaseDto> projectList = _redisService.GetEntity<List<ServiceProjectBaseDto>>($"{CONST_CACHE_ENABLE_PROJECT}_{tenantId}");
|
|
|
|
|
|
|
|
|
|
if (isAvoidCache || projectList == null || projectList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
var statusList = ReloadServiceProjectCacheInfo(tenantId);
|
|
|
|
|
|
|
|
|
|
projectList = statusList.Select(a => new ServiceProjectBaseDto
|
|
|
|
|
{
|
|
|
|
|
PKId = a.ProjectPKId,
|
|
|
|
|
ServiceProjectCode = a.ProjectCode,
|
|
|
|
|
ServiceProjectName = a.ProjectName,
|
|
|
|
|
SortNo = a.SortNo
|
|
|
|
|
}).OrderBy(a => a.SortNo).ToList();
|
|
|
|
|
|
|
|
|
|
_redisService.SetValue($"{CONST_CACHE_ENABLE_PROJECT}_{tenantId}", JsonConvert.SerializeObject(projectList), TimeSpan.FromHours(8).Seconds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<List<ServiceProjectBaseDto>>.Success(projectList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 检索可用的服务项目和状态列表
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 检索可用的服务项目和状态列表
|
|
|
|
|
/// </summary>
|
|
|
|
@ -1675,9 +2020,26 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<DataResult<List<ServiceProjectWithStatusDto>>> GetEnableProjectWithStatusList(string tenantId, bool isAvoidCache = false)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
if (string.IsNullOrWhiteSpace(tenantId))
|
|
|
|
|
{
|
|
|
|
|
//租户ID不能为空
|
|
|
|
|
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ServiceWorkFlowBaseTenantIdNotNull)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<ServiceProjectWithStatusDto> statusList = _redisService.GetEntity<List<ServiceProjectWithStatusDto>>($"{CONST_CACHE_ENABLE_PROJECT_STATUS}_{tenantId}");
|
|
|
|
|
|
|
|
|
|
if (isAvoidCache || statusList == null || statusList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
statusList = ReloadServiceProjectCacheInfo(tenantId);
|
|
|
|
|
|
|
|
|
|
_redisService.SetValue($"{CONST_CACHE_ENABLE_PROJECT_STATUS}_{tenantId}", JsonConvert.SerializeObject(statusList), TimeSpan.FromHours(8).Seconds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<List<ServiceProjectWithStatusDto>>.Success(statusList);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取可用的服务项目字典列表
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取可用的服务项目字典列表
|
|
|
|
|
/// </summary>
|
|
|
|
@ -1685,9 +2047,32 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<List<DictTreeOutput>>> GetEnableProjectDictTreeList(bool isAvoidCache = false)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
List<DictTreeOutput> resultList = new List<DictTreeOutput>();
|
|
|
|
|
|
|
|
|
|
var listRlt = await GetEnableProjectList(user.TenantId, isAvoidCache);
|
|
|
|
|
|
|
|
|
|
if (listRlt.Succeeded && listRlt.Data.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var list = listRlt.Data;
|
|
|
|
|
|
|
|
|
|
resultList.Add(new DictTreeOutput
|
|
|
|
|
{
|
|
|
|
|
Code = "booking_service_item",
|
|
|
|
|
Name = "订舱服务项目",
|
|
|
|
|
Children = list.OrderBy(a => a.SortNo).Select(a => new DictTreeOutput
|
|
|
|
|
{
|
|
|
|
|
Code = a.ServiceProjectCode,
|
|
|
|
|
Name = a.ServiceProjectName
|
|
|
|
|
}).ToList()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<List<DictTreeOutput>>.Success(resultList);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取可用的服务状态字典列表
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取可用的服务状态字典列表
|
|
|
|
|
/// </summary>
|
|
|
|
@ -1695,7 +2080,47 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<List<DictTreeOutput>>> GetEnableStatusDictTreeList(bool isAvoidCache = false)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
List<DictTreeOutput> resultList = new List<DictTreeOutput>();
|
|
|
|
|
|
|
|
|
|
var listRlt = await GetEnableProjectWithStatusList(user.TenantId, isAvoidCache);
|
|
|
|
|
|
|
|
|
|
if (listRlt.Succeeded && listRlt.Data.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var list = listRlt.Data;
|
|
|
|
|
resultList.Add(new DictTreeOutput
|
|
|
|
|
{
|
|
|
|
|
Code = "booking_goods_status",
|
|
|
|
|
Name = "订舱货物状态",
|
|
|
|
|
Children = list.OrderBy(a => a.SortNo).SelectMany(a => {
|
|
|
|
|
var rltList = new List<DictTreeOutput>();
|
|
|
|
|
a.StatusList.ForEach(b =>
|
|
|
|
|
{
|
|
|
|
|
rltList.Add(new DictTreeOutput
|
|
|
|
|
{
|
|
|
|
|
Code = b.StatusSKUCode,
|
|
|
|
|
Name = b.StatusSKUName,
|
|
|
|
|
Remark = b.BackgroundColor
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (b.SubStatusList != null && b.SubStatusList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
rltList.AddRange(b.SubStatusList.Select(c => new DictTreeOutput
|
|
|
|
|
{
|
|
|
|
|
Code = c.StatusSKUCode,
|
|
|
|
|
Name = c.StatusSKUName,
|
|
|
|
|
Remark = c.BackgroundColor
|
|
|
|
|
}).ToList());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return rltList;
|
|
|
|
|
}).ToList()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<List<DictTreeOutput>>.Success(resultList);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|