修改服务项目

dev
jianghaiqing 5 days ago
parent 836db9e47b
commit 724dea7bb8

@ -1894,6 +1894,29 @@ public static class MultiLanguageConst
[Description("状态已选择包含子状态,子状态列表不能为空")]
public const string ServiceWorkFlowBaseSaveIsSub = "ServiceProject_SaveIsSub";
/// <summary>
/// 当前服务项目已关联服务流程,不能修改
/// </summary>
[Description("当前服务项目已关联服务流程,不能修改")]
public const string ServiceWorkFlowBaseHasRelateWFActNotSetUnEnable = "ServiceWorkFlowBase_HasRelateWFActNotSetUnEnable";
/// <summary>
///服务流程代码和状态名称不能小于2个字符不能修改
/// </summary>
[Description("服务项目代码和状态名称不能小于2个字符不能修改")]
public const string ServiceWorkFlowBaseCodeNameLessTwoChar = "ServiceWorkFlowBase_HasRelateWFAct";
/// <summary>
/// 服务流程主键不能为空
/// </summary>
[Description("服务流程主键不能为空")]
public const string ServiceWorkFlowBaseSavePKIDNull = "ServiceWorkFlowBase_SavePKIDNull";
/// <summary>
/// 状态获取失败,状态信息不存在或已作废
/// </summary>
[Description("状态获取失败,状态信息不存在或已作废")]
public const string ServiceWorkFlowBaseEntityNull = "ServiceWorkFlowBase_EntityNull";
#endregion
}

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos
{
/// <summary>
/// 状态值类型枚举
/// </summary>
public enum StatusSKUValTypeEnum
{
/// <summary>
/// 日期
/// </summary>
[Description("日期")]
DATETIME,
/// <summary>
/// 已提交
/// </summary>
[Description("字符")]
STRING,
}
}

@ -45,14 +45,14 @@ namespace DS.WMS.Core.Op.Method
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
/*
#region 保存
/// <summary>
/// 保存
/// </summary>
/// <param name="info">服务流程详情</param>
/// <returns>返回回执</returns>
public async Task<DataResult<long>> Save(ServiceWorkFlowBaseDto info)
public async Task<DataResult<string>> Save(ServiceWorkFlowBaseDto info)
{
return await InnerSave(info);
}
@ -65,7 +65,7 @@ namespace DS.WMS.Core.Op.Method
/// <param name="info">服务流程详情</param>
/// <param name="isSetEnable">是否启用</param>
/// <returns>返回派车Id</returns>
private async Task<DataResult<long>> InnerSave(ServiceWorkFlowBaseDto info, bool isSetEnable = false)
private async Task<DataResult<string>> InnerSave(ServiceWorkFlowBaseDto info, bool isSetEnable = false)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
@ -116,13 +116,12 @@ namespace DS.WMS.Core.Op.Method
{
//状态必需指定大于零的顺序号
}
throw Oops.Oh($"状态必需指定大于零的顺序号", typeof(InvalidOperationException));
if (info.StatusSkuList.GroupBy(a => a.SortNo).Any(a => a.ToList().Count > 1))
{
//状态顺序号不能重复
}
throw Oops.Oh($"状态顺序号不能重复", typeof(InvalidOperationException));
info.StatusSkuList = info.StatusSkuList.OrderBy(a => a.SortNo).Select((a, idx) =>
{
@ -226,20 +225,16 @@ namespace DS.WMS.Core.Op.Method
currVersion = entity.DEVELOP_VERSION;
//批量删除服务流程与服务项目关系(物理删除)
tenantDb.Deleteable<ServiceWorkFlowProjectRelation>().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
//批量删除服务流程与服务活动关系(物理删除)
_serviceWorkFlowActivitiesRelationRepository.EntityContext.Deleteable<ServiceWorkFlowActivitiesRelation>()
.EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
tenantDb.Deleteable<ServiceWorkFlowActivitiesRelation>().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
//批量删除服务流程活动与子活动的关系(物理删除)
_serviceWorkFlowActivitiesSubRelationRepository.EntityContext.Deleteable<ServiceWorkFlowActivitiesSubRelation>()
.EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
tenantDb.Deleteable<ServiceWorkFlowActivitiesSubRelation>().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
//批量删除服务流程与服务流程活动触发器关系(物理删除)
_serviceWorkFlowActivitiesTriggerRelationRepository.EntityContext.Deleteable<ServiceWorkFlowActivitiesTriggerRelation>()
.EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
tenantDb.Deleteable<ServiceWorkFlowActivitiesTriggerRelation>().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
}
//服务流程与服务项目关系
@ -254,7 +249,7 @@ namespace DS.WMS.Core.Op.Method
};
//插入关系
await _serviceWorkFlowProjectRelationRepository.InsertAsync(wfRelationProject);
await tenantDb.Insertable<ServiceWorkFlowProjectRelation>(wfRelationProject).ExecuteCommandAsync();
}
//服务流程与服务活动关系
@ -273,7 +268,7 @@ namespace DS.WMS.Core.Op.Method
WF_VERSION = currVersion
};
await _serviceWorkFlowActivitiesRelationRepository.InsertAsync(wfRelationActivities);
await tenantDb.Insertable<ServiceWorkFlowActivitiesRelation>(wfRelationActivities).ExecuteCommandAsync();
//处理子状态
if (sku.IsContainsSub == 1)
@ -290,8 +285,8 @@ namespace DS.WMS.Core.Op.Method
WF_VERSION = currVersion
};
await _serviceWorkFlowActivitiesSubRelationRepository.InsertAsync(wfRelationActivitiesSub);
await tenantDb.Insertable<ServiceWorkFlowActivitiesSubRelation>(wfRelationActivitiesSub).ExecuteCommandAsync();
if (sub != null && sub.StatusTriggerList != null && sub.StatusTriggerList.Count > 0)
{
sub.StatusTriggerList.ForEach(async trg =>
@ -305,7 +300,7 @@ namespace DS.WMS.Core.Op.Method
WF_VERSION = currVersion
};
await _serviceWorkFlowActivitiesTriggerRelationRepository.InsertAsync(triggerRela);
await tenantDb.Insertable<ServiceWorkFlowActivitiesTriggerRelation>(triggerRela).ExecuteCommandAsync();
});
}
});
@ -324,13 +319,13 @@ namespace DS.WMS.Core.Op.Method
WF_VERSION = currVersion
};
await _serviceWorkFlowActivitiesTriggerRelationRepository.InsertAsync(triggerRela);
await tenantDb.Insertable<ServiceWorkFlowActivitiesTriggerRelation>(triggerRela).ExecuteCommandAsync();
});
}
});
}
return entity.PK_ID;
return DataResult<string>.Success(entity.PK_ID);
}
#endregion
@ -343,17 +338,50 @@ namespace DS.WMS.Core.Op.Method
/// <returns></returns>
private void ValidateServiceWorkFlow(ServiceWorkFlowBaseInfo entity, TrackingOperateTypeEnum opTypeEnum)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (opTypeEnum == TrackingOperateTypeEnum.Save)
{
if (_serviceWorkFlowProjectRelationRepository.AsQueryable().Any(a => a.SERVICE_PROJECT_ID == entity.PK_ID))
if (tenantDb.Queryable<ServiceWorkFlowProjectRelation>().Any(a => a.SERVICE_PROJECT_ID == entity.PK_ID))
{
throw Oops.Oh($"当前服务项目已关联服务流程,不能修改", typeof(InvalidOperationException));
//当前服务项目已关联服务流程,不能修改
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ServiceWorkFlowBaseHasRelateWFActNotSetUnEnable)));
}
if (entity.SERVICE_WORKFLOW_CODE.Length < 2 || entity.SERVICE_WORKFLOW_NAME.Length < 2)
throw Oops.Oh($"服务流程代码和状态名称不能小于2个字符不能修改", typeof(InvalidOperationException));
{
//服务流程代码和状态名称不能小于2个字符不能修改
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ServiceWorkFlowBaseCodeNameLessTwoChar)));
}
}
}
#endregion
#region 单票查询
/// <summary>
/// 单票查询
/// </summary>
/// <param name="pkId">服务流程主键</param>
private ServiceWorkFlowBaseInfo InnerGetInfo(string pkId)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (string.IsNullOrWhiteSpace(pkId))
{
//状态主键不能为空
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ServiceWorkFlowBaseSavePKIDNull)));
}
var model = tenantDb.Queryable<ServiceWorkFlowBaseInfo>().First(a => a.PK_ID == pkId);
if (model == null)
{
//状态获取失败,状态信息不存在或已作废
throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ServiceWorkFlowBaseEntityNull)));
}
return model;
}
#endregion
@ -362,42 +390,60 @@ namespace DS.WMS.Core.Op.Method
/// </summary>
/// <param name="info">服务流程详情</param>
/// <returns>返回回执</returns>
Task<DataResult<long>> SaveAndEnable(ServiceWorkFlowBaseDto info);
public async Task<DataResult<string>> SaveAndEnable(ServiceWorkFlowBaseDto info)
{
return null;
}
/// <summary>
/// 启用
/// </summary>
/// <param name="pkIds">服务流程主键数组</param>
/// <returns>返回回执</returns>
Task<DataResult<string>> SetEnable(string[] pkIds);
public async Task<DataResult<string>> SetEnable(string[] pkIds)
{
return null;
}
/// <summary>
/// 取消启用
/// </summary>
/// <param name="pkIds">服务流程主键数组</param>
/// <returns>返回回执</returns>
Task<DataResult<string>> SetUnEnable(string[] pkIds);
public async Task<DataResult<string>> SetUnEnable(string[] pkIds)
{
return null;
}
/// <summary>
/// 删除
/// </summary>
/// <param name="pkIds">服务流程主键数组</param>
/// <returns>返回回执</returns>
Task<DataResult<string>> Delete(string[] pkIds);
public async Task<DataResult<string>> Delete(string[] pkIds)
{
return null;
}
/// <summary>
/// 复制
/// </summary>
/// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns>
Task<DataResult<long>> Copy(string pkId);
public async Task<DataResult<long>> Copy(string pkId)
{
return null;
}
/// <summary>
/// 获取服务流程详情
/// </summary>
/// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns>
Task<DataResult<ServiceWorkFlowBaseShowDto>> GetInfo(string pkId);
public async Task<DataResult<ServiceWorkFlowBaseShowDto>> GetInfo(string pkId)
{
return null;
}
/// <summary>
/// 检索服务流程列表
@ -405,14 +451,20 @@ namespace DS.WMS.Core.Op.Method
/// <param name="queryItem">检索值</param>
/// <param name="topNum">最大返回行数默认15</param>
/// <returns>返回回执</returns>
Task<DataResult<List<ServiceWorkFlowBaseDto>>> QueryList(string queryItem, int topNum = 15);
public async Task<DataResult<List<ServiceWorkFlowBaseDto>>> QueryList(string queryItem, int topNum = 15)
{
return null;
}
/// <summary>
/// 服务流程台账查询
/// </summary>
/// <param name="QuerySearch">服务流程台账查询请求</param>
/// <returns>返回结果</returns>
Task<SqlSugarPagedList<ServiceWorkFlowBasePageDto>> GetPageAsync(QueryServiceWorkFlowBaseDto QuerySearch);
public async Task<SqlSugarPagedList<ServiceWorkFlowBasePageDto>> GetPageAsync(QueryServiceWorkFlowBaseDto QuerySearch)
{
return null;
}
/// <summary>
@ -420,7 +472,10 @@ namespace DS.WMS.Core.Op.Method
/// </summary>
/// <param name="pkIds">服务流程主键数组</param>
/// <returns>返回回执</returns>
Task<DataResult<string>> PublishRelease(string[] pkIds);
public async Task<DataResult<string>> PublishRelease(string[] pkIds)
{
return null;
}
/// <summary>
@ -428,21 +483,30 @@ namespace DS.WMS.Core.Op.Method
/// </summary>
/// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns>
Task<DataResult<ServiceWorkFlowRunDto>> GetShowTimeLine(string pkId);
public async Task<DataResult<ServiceWorkFlowRunDto>> GetShowTimeLine(string pkId)
{
return null;
}
/// <summary>
/// 保存服务流程活动
/// </summary>
/// <param name="info">保存服务流程活动详情</param>
/// <returns>返回回执</returns>
Task<DataResult<long>> SaveWFActivities(ServiceWorkFlowActivitiesDto info);
public async Task<DataResult<long>> SaveWFActivities(ServiceWorkFlowActivitiesDto info)
{
return null;
}
/// <summary>
/// 通过服务活动主键获取所有相关服务流程列表
/// </summary>
/// <param name="activitiesArgs">服务活动主键数组</param>
/// <returns>返回回执</returns>
Task<DataResult<List<ServiceProjectBaseShowDto>>> GetServiceWorkFlowListByActivities(string[] activitiesArgs);
public async Task<DataResult<List<ServiceProjectBaseShowDto>>> GetServiceWorkFlowListByActivities(string[] activitiesArgs)
{
return null;
}
/// <summary>
/// 检索服务流程活动列表
@ -450,7 +514,10 @@ namespace DS.WMS.Core.Op.Method
/// <param name="queryItem">检索值</param>
/// <param name="topNum">最大返回行数默认15</param>
/// <returns>返回回执</returns>
Task<DataResult<List<StatusSkuBaseDto>>> QueryActivitiesList(string queryItem, int topNum = 15);
public async Task<DataResult<List<StatusSkuBaseDto>>> QueryActivitiesList(string queryItem, int topNum = 15)
{
return null;
}
/// <summary>
/// 检索可用的服务项目列表
@ -458,7 +525,10 @@ namespace DS.WMS.Core.Op.Method
/// <param name="tenantId">租户ID</param>
/// <param name="isAvoidCache">是否不从缓存取值</param>
/// <returns>返回回执</returns>
Task<DataResult<List<ServiceProjectBaseDto>>> GetEnableProjectList(string tenantId, bool isAvoidCache = false);
public async Task<DataResult<List<ServiceProjectBaseDto>>> GetEnableProjectList(string tenantId, bool isAvoidCache = false)
{
return null;
}
/// <summary>
/// 检索可用的服务项目和状态列表
@ -466,21 +536,29 @@ namespace DS.WMS.Core.Op.Method
/// <param name="tenantId">租户ID</param>
/// <param name="isAvoidCache">是否不从缓存取值</param>
/// <returns>返回回执</returns>
Task<DataResult<List<ServiceProjectWithStatusDto>>> GetEnableProjectWithStatusList(string tenantId, bool isAvoidCache = false);
public async Task<DataResult<List<ServiceProjectWithStatusDto>>> GetEnableProjectWithStatusList(string tenantId, bool isAvoidCache = false)
{
return null;
}
/// <summary>
/// 获取可用的服务项目字典列表
/// </summary>
/// <param name="isAvoidCache">是否重新加载缓存</param>
/// <returns></returns>
Task<DataResult<List<DictTreeOutput>>> GetEnableProjectDictTreeList(bool isAvoidCache = false);
public async Task<DataResult<List<DictTreeOutput>>> GetEnableProjectDictTreeList(bool isAvoidCache = false)
{
return null;
}
/// <summary>
/// 获取可用的服务状态字典列表
/// </summary>
/// <param name="isAvoidCache">是否重新加载缓存</param>
/// <returns></returns>
Task<DataResult<List<DictTreeOutput>>> GetEnableStatusDictTreeList(bool isAvoidCache = false);
*/
public async Task<DataResult<List<DictTreeOutput>>> GetEnableStatusDictTreeList(bool isAvoidCache = false)
{
return null;
}
}
}

@ -111,7 +111,7 @@ namespace DS.WMS.Core.Op.Method
{
entity.PK_ID = SnowFlakeSingle.Instance.NextId().ToString();
tenantDb.Insertable<StatusSkuBaseInfo>(entity);
tenantDb.Insertable<StatusSkuBaseInfo>(entity).ExecuteCommand();
}
else
{

Loading…
Cancel
Save