修改服务项目

dev
jianghaiqing 1 week ago
parent 836db9e47b
commit 724dea7bb8

@ -1894,6 +1894,29 @@ public static class MultiLanguageConst
[Description("状态已选择包含子状态,子状态列表不能为空")] [Description("状态已选择包含子状态,子状态列表不能为空")]
public const string ServiceWorkFlowBaseSaveIsSub = "ServiceProject_SaveIsSub"; 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 #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>(); saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
} }
/*
#region 保存 #region 保存
/// <summary> /// <summary>
/// 保存 /// 保存
/// </summary> /// </summary>
/// <param name="info">服务流程详情</param> /// <param name="info">服务流程详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
public async Task<DataResult<long>> Save(ServiceWorkFlowBaseDto info) public async Task<DataResult<string>> Save(ServiceWorkFlowBaseDto info)
{ {
return await InnerSave(info); return await InnerSave(info);
} }
@ -65,7 +65,7 @@ namespace DS.WMS.Core.Op.Method
/// <param name="info">服务流程详情</param> /// <param name="info">服务流程详情</param>
/// <param name="isSetEnable">是否启用</param> /// <param name="isSetEnable">是否启用</param>
/// <returns>返回派车Id</returns> /// <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); 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)) 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) => 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; currVersion = entity.DEVELOP_VERSION;
//批量删除服务流程与服务项目关系(物理删除) //批量删除服务流程与服务项目关系(物理删除)
tenantDb.Deleteable<ServiceWorkFlowProjectRelation>().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand(); tenantDb.Deleteable<ServiceWorkFlowProjectRelation>().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
//批量删除服务流程与服务活动关系(物理删除) //批量删除服务流程与服务活动关系(物理删除)
_serviceWorkFlowActivitiesRelationRepository.EntityContext.Deleteable<ServiceWorkFlowActivitiesRelation>() tenantDb.Deleteable<ServiceWorkFlowActivitiesRelation>().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
.EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
//批量删除服务流程活动与子活动的关系(物理删除) //批量删除服务流程活动与子活动的关系(物理删除)
_serviceWorkFlowActivitiesSubRelationRepository.EntityContext.Deleteable<ServiceWorkFlowActivitiesSubRelation>() tenantDb.Deleteable<ServiceWorkFlowActivitiesSubRelation>().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
.EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
//批量删除服务流程与服务流程活动触发器关系(物理删除) //批量删除服务流程与服务流程活动触发器关系(物理删除)
_serviceWorkFlowActivitiesTriggerRelationRepository.EntityContext.Deleteable<ServiceWorkFlowActivitiesTriggerRelation>() tenantDb.Deleteable<ServiceWorkFlowActivitiesTriggerRelation>().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == currVersion).ExecuteCommand();
.EnableQueryFilter().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 WF_VERSION = currVersion
}; };
await _serviceWorkFlowActivitiesRelationRepository.InsertAsync(wfRelationActivities); await tenantDb.Insertable<ServiceWorkFlowActivitiesRelation>(wfRelationActivities).ExecuteCommandAsync();
//处理子状态 //处理子状态
if (sku.IsContainsSub == 1) if (sku.IsContainsSub == 1)
@ -290,7 +285,7 @@ namespace DS.WMS.Core.Op.Method
WF_VERSION = currVersion WF_VERSION = currVersion
}; };
await _serviceWorkFlowActivitiesSubRelationRepository.InsertAsync(wfRelationActivitiesSub); await tenantDb.Insertable<ServiceWorkFlowActivitiesSubRelation>(wfRelationActivitiesSub).ExecuteCommandAsync();
if (sub != null && sub.StatusTriggerList != null && sub.StatusTriggerList.Count > 0) if (sub != null && sub.StatusTriggerList != null && sub.StatusTriggerList.Count > 0)
{ {
@ -305,7 +300,7 @@ namespace DS.WMS.Core.Op.Method
WF_VERSION = currVersion 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 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 #endregion
@ -343,61 +338,112 @@ namespace DS.WMS.Core.Op.Method
/// <returns></returns> /// <returns></returns>
private void ValidateServiceWorkFlow(ServiceWorkFlowBaseInfo entity, TrackingOperateTypeEnum opTypeEnum) private void ValidateServiceWorkFlow(ServiceWorkFlowBaseInfo entity, TrackingOperateTypeEnum opTypeEnum)
{ {
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (opTypeEnum == TrackingOperateTypeEnum.Save) 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) 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 #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
/// <summary> /// <summary>
/// 保存并启用 /// 保存并启用
/// </summary> /// </summary>
/// <param name="info">服务流程详情</param> /// <param name="info">服务流程详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<DataResult<long>> SaveAndEnable(ServiceWorkFlowBaseDto info); public async Task<DataResult<string>> SaveAndEnable(ServiceWorkFlowBaseDto info)
{
return null;
}
/// <summary> /// <summary>
/// 启用 /// 启用
/// </summary> /// </summary>
/// <param name="pkIds">服务流程主键数组</param> /// <param name="pkIds">服务流程主键数组</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<DataResult<string>> SetEnable(string[] pkIds); public async Task<DataResult<string>> SetEnable(string[] pkIds)
{
return null;
}
/// <summary> /// <summary>
/// 取消启用 /// 取消启用
/// </summary> /// </summary>
/// <param name="pkIds">服务流程主键数组</param> /// <param name="pkIds">服务流程主键数组</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<DataResult<string>> SetUnEnable(string[] pkIds); public async Task<DataResult<string>> SetUnEnable(string[] pkIds)
{
return null;
}
/// <summary> /// <summary>
/// 删除 /// 删除
/// </summary> /// </summary>
/// <param name="pkIds">服务流程主键数组</param> /// <param name="pkIds">服务流程主键数组</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<DataResult<string>> Delete(string[] pkIds); public async Task<DataResult<string>> Delete(string[] pkIds)
{
return null;
}
/// <summary> /// <summary>
/// 复制 /// 复制
/// </summary> /// </summary>
/// <param name="pkId">服务流程主键</param> /// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<DataResult<long>> Copy(string pkId); public async Task<DataResult<long>> Copy(string pkId)
{
return null;
}
/// <summary> /// <summary>
/// 获取服务流程详情 /// 获取服务流程详情
/// </summary> /// </summary>
/// <param name="pkId">服务流程主键</param> /// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<DataResult<ServiceWorkFlowBaseShowDto>> GetInfo(string pkId); public async Task<DataResult<ServiceWorkFlowBaseShowDto>> GetInfo(string pkId)
{
return null;
}
/// <summary> /// <summary>
/// 检索服务流程列表 /// 检索服务流程列表
@ -405,14 +451,20 @@ namespace DS.WMS.Core.Op.Method
/// <param name="queryItem">检索值</param> /// <param name="queryItem">检索值</param>
/// <param name="topNum">最大返回行数默认15</param> /// <param name="topNum">最大返回行数默认15</param>
/// <returns>返回回执</returns> /// <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>
/// 服务流程台账查询 /// 服务流程台账查询
/// </summary> /// </summary>
/// <param name="QuerySearch">服务流程台账查询请求</param> /// <param name="QuerySearch">服务流程台账查询请求</param>
/// <returns>返回结果</returns> /// <returns>返回结果</returns>
Task<SqlSugarPagedList<ServiceWorkFlowBasePageDto>> GetPageAsync(QueryServiceWorkFlowBaseDto QuerySearch); public async Task<SqlSugarPagedList<ServiceWorkFlowBasePageDto>> GetPageAsync(QueryServiceWorkFlowBaseDto QuerySearch)
{
return null;
}
/// <summary> /// <summary>
@ -420,7 +472,10 @@ namespace DS.WMS.Core.Op.Method
/// </summary> /// </summary>
/// <param name="pkIds">服务流程主键数组</param> /// <param name="pkIds">服务流程主键数组</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<DataResult<string>> PublishRelease(string[] pkIds); public async Task<DataResult<string>> PublishRelease(string[] pkIds)
{
return null;
}
/// <summary> /// <summary>
@ -428,21 +483,30 @@ namespace DS.WMS.Core.Op.Method
/// </summary> /// </summary>
/// <param name="pkId">服务流程主键</param> /// <param name="pkId">服务流程主键</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<DataResult<ServiceWorkFlowRunDto>> GetShowTimeLine(string pkId); public async Task<DataResult<ServiceWorkFlowRunDto>> GetShowTimeLine(string pkId)
{
return null;
}
/// <summary> /// <summary>
/// 保存服务流程活动 /// 保存服务流程活动
/// </summary> /// </summary>
/// <param name="info">保存服务流程活动详情</param> /// <param name="info">保存服务流程活动详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<DataResult<long>> SaveWFActivities(ServiceWorkFlowActivitiesDto info); public async Task<DataResult<long>> SaveWFActivities(ServiceWorkFlowActivitiesDto info)
{
return null;
}
/// <summary> /// <summary>
/// 通过服务活动主键获取所有相关服务流程列表 /// 通过服务活动主键获取所有相关服务流程列表
/// </summary> /// </summary>
/// <param name="activitiesArgs">服务活动主键数组</param> /// <param name="activitiesArgs">服务活动主键数组</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<DataResult<List<ServiceProjectBaseShowDto>>> GetServiceWorkFlowListByActivities(string[] activitiesArgs); public async Task<DataResult<List<ServiceProjectBaseShowDto>>> GetServiceWorkFlowListByActivities(string[] activitiesArgs)
{
return null;
}
/// <summary> /// <summary>
/// 检索服务流程活动列表 /// 检索服务流程活动列表
@ -450,7 +514,10 @@ namespace DS.WMS.Core.Op.Method
/// <param name="queryItem">检索值</param> /// <param name="queryItem">检索值</param>
/// <param name="topNum">最大返回行数默认15</param> /// <param name="topNum">最大返回行数默认15</param>
/// <returns>返回回执</returns> /// <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> /// <summary>
/// 检索可用的服务项目列表 /// 检索可用的服务项目列表
@ -458,7 +525,10 @@ namespace DS.WMS.Core.Op.Method
/// <param name="tenantId">租户ID</param> /// <param name="tenantId">租户ID</param>
/// <param name="isAvoidCache">是否不从缓存取值</param> /// <param name="isAvoidCache">是否不从缓存取值</param>
/// <returns>返回回执</returns> /// <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> /// <summary>
/// 检索可用的服务项目和状态列表 /// 检索可用的服务项目和状态列表
@ -466,21 +536,29 @@ namespace DS.WMS.Core.Op.Method
/// <param name="tenantId">租户ID</param> /// <param name="tenantId">租户ID</param>
/// <param name="isAvoidCache">是否不从缓存取值</param> /// <param name="isAvoidCache">是否不从缓存取值</param>
/// <returns>返回回执</returns> /// <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>
/// 获取可用的服务项目字典列表 /// 获取可用的服务项目字典列表
/// </summary> /// </summary>
/// <param name="isAvoidCache">是否重新加载缓存</param> /// <param name="isAvoidCache">是否重新加载缓存</param>
/// <returns></returns> /// <returns></returns>
Task<DataResult<List<DictTreeOutput>>> GetEnableProjectDictTreeList(bool isAvoidCache = false); public async Task<DataResult<List<DictTreeOutput>>> GetEnableProjectDictTreeList(bool isAvoidCache = false)
{
return null;
}
/// <summary> /// <summary>
/// 获取可用的服务状态字典列表 /// 获取可用的服务状态字典列表
/// </summary> /// </summary>
/// <param name="isAvoidCache">是否重新加载缓存</param> /// <param name="isAvoidCache">是否重新加载缓存</param>
/// <returns></returns> /// <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(); entity.PK_ID = SnowFlakeSingle.Instance.NextId().ToString();
tenantDb.Insertable<StatusSkuBaseInfo>(entity); tenantDb.Insertable<StatusSkuBaseInfo>(entity).ExecuteCommand();
} }
else else
{ {

Loading…
Cancel
Save