123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using Abp;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DataTransmission.Joint
- {
- public class Delay
- {
- private readonly CommonTool tool = new CommonTool();
- public DataTable GetDelay(string flowId)
- {
- var conn = tool.GetConSqlServer();
- var sql = $@" SELECT * FROM dbo.Flow11_Postpone WHERE FPE_FlowID = {flowId} AND FPE_AuditFlag IN (1) ";
- return tool.GetDataTable(sql, conn);
- }
- public string GetDelaySql(DataTable data, DataRow row, string orderId, DataTable org, DataTable user) {
- var delayNum = 0;
- var pgDelaySql = string.Empty;
- foreach (DataRow delay in data.Rows)
- {
- var delayId = SequentialGuidGenerator.Instance.Create().ToString("D");
- var EmployeeId = delay["FPE_UserID"].ToString();
- var VisitOrgCode = delay["FPE_BMID"].ToString();
- try
- {
- DataRow userRow = user.AsEnumerable().First(x => x.Field<int>("OldUserId").ToString() == delay["FPE_UserID"].ToString());
- EmployeeId = string.IsNullOrEmpty(userRow?["Id"].ToString()) ? "NULL" : userRow?["Id"].ToString();
- DataRow ogrRow = org.AsEnumerable().First(x => x.Field<int>("oldBmid").ToString() == delay["FPE_BMID"].ToString());
- VisitOrgCode = string.IsNullOrEmpty(ogrRow?["Id"].ToString()) ? delay["FPE_BMID"].ToString() : ogrRow?["Id"].ToString();
- }
- catch (Exception e)
- {
- tool.SaveLog(" DelayMessage :" + e.Message + ";FPE_BMID:" + delay["FPE_BMID"].ToString() + "FPE_UserID:"+ delay["FPE_UserID"].ToString() + " ;", 1);
- }
-
- 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"]}',
- 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)";
- }
- 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)";
- }
- delayNum++;
- }
- return pgDelaySql += ";";
- }
- }
- }
|