diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesRelation.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesRelation.cs
index e8e0ca89..74a0681d 100644
--- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesRelation.cs
+++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesRelation.cs
@@ -44,5 +44,10 @@ namespace Myshipping.Application
/// 值类型 STRING-字符 DATETIME-日期
///
public string VAL_TYPE { get; set; }
+
+ ///
+ /// 流程版本号
+ ///
+ public string WF_VERSION { get; set; }
}
}
diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesSubRelation.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesSubRelation.cs
index c5a82824..bcd149fc 100644
--- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesSubRelation.cs
+++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowActivitiesSubRelation.cs
@@ -44,5 +44,10 @@ namespace Myshipping.Application
/// 值类型 STRING-字符 DATETIME-日期
///
public string VAL_TYPE { get; set; }
+
+ ///
+ /// 流程版本号
+ ///
+ public string WF_VERSION { get; set; }
}
}
diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowProjectRelation.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowProjectRelation.cs
index d749d35c..7d647677 100644
--- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowProjectRelation.cs
+++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowProjectRelation.cs
@@ -32,5 +32,10 @@ namespace Myshipping.Application.Entity
/// 服务项目主键
///
public string SERVICE_PROJECT_ID { get; set; }
+
+ ///
+ /// 流程版本号
+ ///
+ public string WF_VERSION { get; set; }
}
}
diff --git a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowReleaseInfo.cs b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowReleaseInfo.cs
index c5a7e178..69b01ff4 100644
--- a/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowReleaseInfo.cs
+++ b/Myshipping.Application/Entity/TrackingSystem/ServiceWorkFlowReleaseInfo.cs
@@ -38,7 +38,7 @@ namespace Myshipping.Application.Entity
///
/// 发布人
///
- public string PUBLISH_ER { get; set; }
+ public long PUBLISH_ER { get; set; }
///
/// 发布人名称
diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs
index 0d3d1d8b..7ecc114b 100644
--- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs
+++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs
@@ -41,7 +41,8 @@ namespace Myshipping.Application
SqlSugarRepository serviceWorkFlowActivitiesInfoRepository,
SqlSugarRepository serviceWorkFlowProjectRelationRepository,
SqlSugarRepository serviceWorkFlowActivitiesRelationRepository,
- SqlSugarRepository serviceWorkFlowActivitiesSubRelationRepository)
+ SqlSugarRepository serviceWorkFlowActivitiesSubRelationRepository,
+ SqlSugarRepository serviceWorkFlowReleaseInfoRepository)
{
_serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository;
_serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository;
@@ -50,6 +51,7 @@ namespace Myshipping.Application
_logger = logger;
_serviceWorkFlowActivitiesSubRelationRepository = serviceWorkFlowActivitiesSubRelationRepository;
+ _serviceWorkFlowReleaseInfoRepository = serviceWorkFlowReleaseInfoRepository;
}
///
@@ -238,15 +240,15 @@ namespace Myshipping.Application
//批量删除服务流程与服务项目关系(物理删除)
_serviceWorkFlowProjectRelationRepository.EntityContext.Deleteable()
- .EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID).ExecuteCommand();
+ .EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == "DEVELOP").ExecuteCommand();
//批量删除服务流程与服务活动关系(物理删除)
_serviceWorkFlowActivitiesRelationRepository.EntityContext.Deleteable()
- .EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID).ExecuteCommand();
+ .EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == "DEVELOP").ExecuteCommand();
//批量删除服务流程活动与子活动的关系(物理删除)
_serviceWorkFlowActivitiesSubRelationRepository.EntityContext.Deleteable()
- .EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID).ExecuteCommand();
+ .EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == "DEVELOP").ExecuteCommand();
}
//服务流程与服务项目关系
@@ -256,6 +258,7 @@ namespace Myshipping.Application
PK_ID = IDGen.NextID().ToString(),
SERVICE_WORKFLOW_ID = entity.PK_ID,
SERVICE_PROJECT_ID = info.ServiceProject.PKId,
+ WF_VERSION = "DEVELOP"
};
//插入关系
@@ -273,7 +276,8 @@ namespace Myshipping.Application
SERVICE_ACTIVITIES_ID = sku.PKId,
SORT_NO = sku.SortNo,
IS_CONTAINS_SUB = sku.IsContainsSub,
- VAL_TYPE = !string.IsNullOrWhiteSpace(sku.ValType)? sku.ValType: StatusSKUValTypeEnum.DATETIME.ToString()
+ VAL_TYPE = !string.IsNullOrWhiteSpace(sku.ValType)? sku.ValType: StatusSKUValTypeEnum.DATETIME.ToString(),
+ WF_VERSION = "DEVELOP"
};
await _serviceWorkFlowActivitiesRelationRepository.InsertAsync(wfRelationActivities);
@@ -288,7 +292,8 @@ namespace Myshipping.Application
SERVICE_WORKFLOW_ID = entity.PK_ID,
SERVICE_ACTIVITIES_ID = sku.PKId,
SUB_SERVICE_ACTIVITIES_ID = sub.PKId,
- SORT_NO = sub.SortNo
+ SORT_NO = sub.SortNo,
+ WF_VERSION = "DEVELOP"
};
await _serviceWorkFlowActivitiesSubRelationRepository.InsertAsync(wfRelationActivitiesSub);
@@ -998,15 +1003,41 @@ namespace Myshipping.Application
if (model == null)
throw Oops.Oh($"服务流程获取失败,服务流程信息不存在或已作废", typeof(InvalidOperationException));
+ var lastReleaseInfo = _serviceWorkFlowReleaseInfoRepository.AsQueryable()
+ .First(a => a.SERVICE_WORKFLOW_ID == model.PK_ID && a.IS_DEL == 0);
+ int currNum = lastReleaseInfo == null ? 1 : lastReleaseInfo.TOTAL_NUM;
-
+ ServiceWorkFlowReleaseInfo releaseInfo = new ServiceWorkFlowReleaseInfo
+ {
+ PK_ID = IDGen.NextID().ToString(),
+ SERVICE_WORKFLOW_ID = model.PK_ID,
+ LAST_PK_ID = lastReleaseInfo.PK_ID,
+ PUBLISH_DATE = DateTime.Now,
+ IS_DEL = 0,
+ PUBLISH_ER = UserManager.UserId,
+ PUBLISH_NAME = UserManager.Name,
+ TOTAL_NUM = currNum + 1,
+ };
+
+ //写入发布表
+ _serviceWorkFlowReleaseInfoRepository.Insert(releaseInfo);
+
+ model.RELEASE_VERSION = releaseInfo.RELEASE_VERSION;
model.UpdatedTime = DateTime.Now;
model.UpdatedUserId = UserManager.UserId;
model.UpdatedUserName = UserManager.Name;
+ await _serviceWorkFlowBaseRepository.AsUpdateable(model).UpdateColumns(it => new
+ {
+ it.RELEASE_VERSION,
+ it.UpdatedTime,
+ it.UpdatedUserId,
+ it.UpdatedUserName,
+ }).ExecuteCommandAsync();
+
result.succ = true;
- result.msg = "执行成功";
+ result.msg = "发布成功";
}
catch (Exception ex)