|
@@ -12,6 +12,7 @@ namespace DataTransmission.Joint
|
|
|
public class Delay
|
|
|
{
|
|
|
private readonly CommonTool tool = new CommonTool();
|
|
|
+ private readonly Workflow workflow = new Workflow();
|
|
|
|
|
|
public DataTable GetDelay(string flowId)
|
|
|
{
|
|
@@ -20,7 +21,7 @@ namespace DataTransmission.Joint
|
|
|
return tool.GetDataTable(sql, conn);
|
|
|
}
|
|
|
|
|
|
- public string GetDelaySql(DataTable data, DataRow row, string orderId, DataTable org, DataTable user) {
|
|
|
+ public string GetDelaySql(DataTable data, DataRow row, string orderId, DataTable org, DataTable user,DataRow delayModule) {
|
|
|
var delayNum = 0;
|
|
|
var pgDelaySql = string.Empty;
|
|
|
foreach (DataRow delay in data.Rows)
|
|
@@ -47,6 +48,7 @@ namespace DataTransmission.Joint
|
|
|
if (applyUser != null)
|
|
|
{
|
|
|
model.EmployeeId = applyUser["Id"].ToString();
|
|
|
+ model.EmployeeName = applyUser["Name"].ToString();
|
|
|
model.CreatorId = applyUser["Id"].ToString();
|
|
|
model.CreatorName = applyUser["Name"].ToString();
|
|
|
}
|
|
@@ -56,20 +58,28 @@ namespace DataTransmission.Joint
|
|
|
model.DelayState = (Enum.EDelayState)int.Parse(delay["FPE_AuditFlag"].ToString());
|
|
|
model.CreationTime = DateTime.Parse(delay["FPE_FPDate"].ToString());
|
|
|
|
|
|
- //if (delayNum == 0)
|
|
|
- //{
|
|
|
- // pgDelaySql = $@"INSERT INTO ""public"".""order_delay"" (""Id"", ""No"", ""OrderId"", ""ApplyDelayTime"", ""ApplyOrgCode"", ""ApplyOrgName"", ""EmployeeId"", ""DelayNum"", ""DelayUnit"", ""DelayReason"",
|
|
|
- // ""BeforeDelay"", ""AfterDelay"", ""DelayState"", ""IsProDelay"", ""CreationTime"", ""CreatorOrgId"", ""CreatorId"", ""AreaId"", ""CreatorOrgName"", ""CreatorName"", ""CreatorOrgLevel"",
|
|
|
- // ""WorkflowId"", ""FileJson"", ""EmployeeName"", ""ExpiredTimeConfigId"", ""FlowedOrgIds"", ""FlowedUserIds"", ""LastModificationTime"", ""IsDeleted"", ""DeletionTime"") VALUES
|
|
|
- // ('{delayId}', '{row["FSH_Code"].ToString().Trim()}', '{orderId}', '{delay["FPE_FPDate"]}', '{VisitOrgCode}', '{delay["FPE_BMName"]}', '{EmployeeId}', '{delay["FPE_SLimits"]}', 2, '{delay["FPE_Reson"]}',
|
|
|
- // NULL, '{delay["FPE_STTime"]}',{(int)model.DelayState}, 'f', '{delay["FPE_FPDate"]}', '{VisitOrgCode}', '08dc10ec-2dd8-4383-8426-b194c4f5e917', '', '{delay["FPE_BMName"]}', '张晓梅1', 1, '', NULL, '{delay["FPE_UserName"]}', NULL, NULL,NULL, NULL, 'f', NULL)";
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // pgDelaySql += $@",('{delayId}', '{row["FSH_Code"].ToString().Trim()}', '{orderId}', '{delay["FPE_FPDate"]}', '{VisitOrgCode}', '{delay["FPE_BMName"]}', '{EmployeeId}', '{delay["FPE_SLimits"]}', 2, '{delay["FPE_Reson"]}', NULL, '{delay["FPE_STTime"]}',
|
|
|
- // 1, 'f', '{delay["FPE_FPDate"]}', '{VisitOrgCode}', '08dc10ec-2dd8-4383-8426-b194c4f5e917', '', '{delay["FPE_BMName"]}', '张晓梅1', 1, '', NULL, '{delay["FPE_UserName"]}', NULL, NULL, NULL, NULL, 'f', NULL)";
|
|
|
- //}
|
|
|
+ if (delayNum == 0)
|
|
|
+ {
|
|
|
+ pgDelaySql = $@"INSERT INTO ""public"".""order_delay"" (""Id"", ""No"", ""OrderId"", ""ApplyDelayTime"", ""ApplyOrgCode"", ""ApplyOrgName"", ""EmployeeId"", ""DelayNum"", ""DelayUnit"", ""DelayReason"",
|
|
|
+ ""BeforeDelay"", ""AfterDelay"", ""DelayState"", ""IsProDelay"", ""CreationTime"", ""CreatorOrgId"", ""CreatorId"", ""AreaId"", ""CreatorOrgName"", ""CreatorName"",
|
|
|
+ ""CreatorOrgLevel"", ""WorkflowId"", ""FileJson"", ""EmployeeName"", ""ExpiredTimeConfigId"", ""FlowedOrgIds"", ""FlowedUserIds"", ""LastModificationTime"", ""IsDeleted"", ""DeletionTime"") VALUES
|
|
|
+ ('{model.Id}', '{model.No}', '{model.OrderId}', '{model.ApplyDelayTime}', '{model.ApplyOrgCode}', '{model.ApplyOrgName}', '{model.EmployeeId}', '{model.DelayNum}', 2, '{model.DelayReason}',
|
|
|
+ NULL, '{model.AfterDelay}',{(int)model.DelayState}, 'f', '{model.CreationTime}', '{model.CreatorOrgId}', '{model.CreatorId}', '{model.AreaId}', '{model.CreatorOrgName}', '{model.CreatorName}',
|
|
|
+ {model.CreatorOrgLevel}, '', NULL, '{model.EmployeeName}', NULL, NULL,NULL, NULL, 'f', NULL)";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pgDelaySql += $@",('{model.Id}', '{model.No}', '{model.OrderId}', '{model.ApplyDelayTime}', '{model.ApplyOrgCode}', '{model.ApplyOrgName}', '{model.EmployeeId}', '{model.DelayNum}', 2, '{model.DelayReason}',
|
|
|
+ NULL, '{model.AfterDelay}',{(int)model.DelayState}, 'f', '{model.CreationTime}', '{model.CreatorOrgId}', '{model.CreatorId}', '{model.AreaId}', '{model.CreatorOrgName}', '{model.CreatorName}',
|
|
|
+ {model.CreatorOrgLevel}, '', NULL, '{model.EmployeeName}', NULL, NULL, NULL, NULL, 'f', NULL)";
|
|
|
+ }
|
|
|
delayNum++;
|
|
|
+
|
|
|
+ var pgDelayWorkflow = workflow.GetWorkflow(row["FSH_FlowID"].ToString(), "CityHotline");
|
|
|
+ var pgDelayWorkflowSql = workflow.GetWorkflowSql(pgDelayWorkflow, row, orderId, org, user, delayModule, model);
|
|
|
+ if (!string.IsNullOrEmpty(pgDelayWorkflowSql)) {
|
|
|
+ pgDelaySql += pgDelayWorkflowSql;
|
|
|
+ }
|
|
|
}
|
|
|
return pgDelaySql += ";";
|
|
|
}
|