From 71ca541865b8f08537ed9ff578378fe37d6e5843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=95=8F=E5=81=A5=20=E9=82=B1?= Date: Sat, 24 May 2025 23:48:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=89=B9=E6=B5=81CO=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...FIDA.U8.Framework.Api.ControlObject.csproj | 3 + .../Workflow/ServiceProxy.cs | 416 ++++++++++++++++-- UFIDA.U8.Framework.Api/App_Data/API_Meta.db | Bin 77824 -> 77824 bytes 3 files changed, 387 insertions(+), 32 deletions(-) diff --git a/UFIDA.U8.Framework.Api.ControlObject/UFIDA.U8.Framework.Api.ControlObject.csproj b/UFIDA.U8.Framework.Api.ControlObject/UFIDA.U8.Framework.Api.ControlObject.csproj index 602aaff..f227794 100644 --- a/UFIDA.U8.Framework.Api.ControlObject/UFIDA.U8.Framework.Api.ControlObject.csproj +++ b/UFIDA.U8.Framework.Api.ControlObject/UFIDA.U8.Framework.Api.ControlObject.csproj @@ -102,6 +102,9 @@ D:\U8SOFT\Workflow\Lib\UFIDA.U8.Audit.ServiceProxy.dll False + + D:\U8SOFT\Portal\UFIDA.U8.Portal.MTC.Design.dll + D:\U8SOFT\U8M\UFSoft.U8.BO.BE.dll diff --git a/UFIDA.U8.Framework.Api.ControlObject/Workflow/ServiceProxy.cs b/UFIDA.U8.Framework.Api.ControlObject/Workflow/ServiceProxy.cs index 495c62d..e74f273 100644 --- a/UFIDA.U8.Framework.Api.ControlObject/Workflow/ServiceProxy.cs +++ b/UFIDA.U8.Framework.Api.ControlObject/Workflow/ServiceProxy.cs @@ -1,29 +1,35 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; -using ADODB; using log4net; using UFIDA.U8.Audit.ServiceProxy; using UFIDA.U8.Framework.Api.ControlObject.Entity; using UFIDA.U8.Framework.Api.ControlObject.U8M; -using UFSoft.U8.Framework.ContextSrv; -using UFSoft.U8.Framework.LoginContext; +// ReSharper disable IdentifierTypo namespace UFIDA.U8.Framework.Api.ControlObject.Workflow { + /// + /// 工作流 + /// public class ServiceProxy { - protected readonly ILog logInfo = LogManager.GetLogger("logInfo"); + private readonly ILog _logInfo = LogManager.GetLogger("_logInfo"); + /// + /// #是否启用审批流# + /// + /// + /// + /// + /// + /// public bool IsFlowEnabled(BaseLogin login, string bizObjectId, string eventId) { var auditServiceProxy = new AuditServiceProxy(); var errMsg = ""; var res = auditServiceProxy.IsFlowEnabled(bizObjectId, eventId, login._productContext.calledContext, ref errMsg); - if (!res && !string.IsNullOrWhiteSpace(errMsg)) + if (!string.IsNullOrWhiteSpace(errMsg)) { throw new Exception(errMsg); } @@ -31,33 +37,51 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Workflow return res; } - public BaseResult SubmitApplicationMessage(BaseLogin login, string bizObjectId, string eventId, string voucherId,string voucherCode) + /// + /// #提交审批流# + /// + /// + /// + /// + /// + /// + /// + /// + public async Task> SubmitApplicationMessage(BaseLogin login, string bizObjectId, string eventId, string voucherId,string voucherCode) { try { var auditServiceProxy = new AuditServiceProxy(); - var isWFControled = false; + + var isWfControled = false; var errMsg = ""; - var res = auditServiceProxy.SubmitApplicationMessage(bizObjectId, eventId, voucherId, login._productContext.calledContext, ref isWFControled, ref errMsg); + + var res = auditServiceProxy.SubmitApplicationMessage(bizObjectId, eventId, voucherId, login._productContext.calledContext, ref isWfControled, ref errMsg); if (!res && !string.IsNullOrWhiteSpace(errMsg)) { throw new Exception(errMsg); } - if (!isWFControled && !string.IsNullOrWhiteSpace(errMsg)) + if (!isWfControled && !string.IsNullOrWhiteSpace(errMsg)) { throw new Exception(errMsg); } - if (!isWFControled) + if (!isWfControled) { throw new Exception("当前单据无法进入工作流"); } - return new BaseResult() + if (!res) { - bSuccess = res, + throw new Exception("审批流发生异常"); + } + + + return new BaseResult + { + bSuccess = true, message = "提交成功", result = "提交成功", voucherId = voucherId, @@ -67,8 +91,11 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Workflow } catch (Exception ex) { - logInfo.Error($"审批流异常:{ex.Message}", ex); - return new BaseResult() + _logInfo.Error($"审批流异常:{ex.Message}", ex); + + await Task.Delay(1); + + return new BaseResult { bSuccess = false, message = "提交失败", voucherCode = voucherCode, voucherId = voucherId, result = ex.Message @@ -76,28 +103,353 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Workflow } } - - public string GetBizObjectId(Connection conn,string cCardNum) + /// + /// #单据审核# + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public async Task> Audit(BaseLogin login, string cCardNum, short action, short state, string opinion, string voucherId, string voucherCode) { - var rst = new Recordset(); - - - var strSql = $"SELECT cHeadBusObjectId FROM dbo.vouchers WHERE CardNumber='{cCardNum}'"; - - rst.Open(strSql,conn); - - if (rst.EOF || rst.BOF) + try { - throw new Exception($"未查询到单据类型编码{cCardNum}的配置信息"); + var keySet = $@""; + + var auditServiceProxy = new AuditServiceProxy(); + var errMsg = ""; + var res = auditServiceProxy.Audit(keySet, action, state, opinion, login._productContext.calledContext, ref errMsg); + + if (!res && !string.IsNullOrWhiteSpace(errMsg)) + { + throw new Exception(errMsg); + } + + if (!string.IsNullOrWhiteSpace(errMsg)) + { + throw new Exception(errMsg); + } + + if (!res) + { + throw new Exception("审批流发生异常"); + } + + return new BaseResult + { + bSuccess = true, + message = "审核成功", + result = "审核成功", + voucherId = voucherId, + voucherCode = voucherCode + }; + } + catch (Exception ex) + { + _logInfo.Error($"审批流异常:{ex.Message}", ex); - rst.MoveFirst(); + await Task.Delay(1); - var res = $"{rst.Fields["cHeadBusObjectId"].Value}"; + return new BaseResult + { + bSuccess = false, + message = "审核失败", + voucherCode = voucherCode, + voucherId = voucherId, + result = ex.Message + }; + } + } - rst.Close(); + /// + /// #单据弃审# + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public async Task> Abandon(BaseLogin login, string cCardNum, short action, short state, string opinion, string voucherId, string voucherCode) + { + try + { + var keySet = $@""; - return res; + var auditServiceProxy = new AuditServiceProxy(); + var errMsg = ""; + var res = auditServiceProxy.Abandon(keySet, opinion, state, login._productContext.calledContext, ref errMsg); + + if (!res && !string.IsNullOrWhiteSpace(errMsg)) + { + throw new Exception(errMsg); + } + + if (!string.IsNullOrWhiteSpace(errMsg)) + { + throw new Exception(errMsg); + } + + if (!res) + { + throw new Exception("审批流发生异常"); + } + + return new BaseResult + { + bSuccess = true, + message = "弃审成功", + result = "弃审成功", + voucherId = voucherId, + voucherCode = voucherCode + }; + + } + catch (Exception ex) + { + _logInfo.Error($"审批流异常:{ex.Message}", ex); + + await Task.Delay(1); + + return new BaseResult + { + bSuccess = false, + message = "审核失败", + voucherCode = voucherCode, + voucherId = voucherId, + result = ex.Message + }; + } + } + + /// + /// #流程撤销# + /// + /// + /// + /// + /// + /// + /// + /// + public async Task> RevokeAudition(BaseLogin login, string cCardNum, string bizObjectId, string eventId, string voucherId, string voucherCode) + { + try + { + var auditServiceProxy = new AuditServiceProxy(); + + var data = ""; + var errMsg = ""; + + var res = auditServiceProxy.RevokeAudition(bizObjectId, eventId, voucherId, cCardNum,voucherCode,ref data,login._productContext.calledContext, ref errMsg); + + if (!res && !string.IsNullOrWhiteSpace(errMsg)) + { + throw new Exception(errMsg); + } + + if (!string.IsNullOrWhiteSpace(errMsg)) + { + throw new Exception(errMsg); + } + + if (!res) + { + throw new Exception("审批流发生异常"); + } + + return new BaseResult + { + bSuccess = true, + message = "撤销成功", + result = "撤销成功", + voucherId = voucherId, + voucherCode = voucherCode + }; + + } + catch (Exception ex) + { + _logInfo.Error($"审批流异常:{ex.Message}", ex); + + await Task.Delay(1); + + return new BaseResult + { + bSuccess = false, + message = "撤销失败", + voucherCode = voucherCode, + voucherId = voucherId, + result = ex.Message + }; + } + } + + /// + /// #取得审批历史进程信息# + /// + /// + /// + /// + /// + /// + /// + public async Task> GetAuditedHistoryXml(BaseLogin login, string cCardNum, string voucherId, string voucherCode) + { + try + { + var auditServiceProxy = new AuditServiceProxy(); + + var res = auditServiceProxy.GetAuditedHistoryXml(voucherId, cCardNum, login._productContext.calledContext); + + if (string.IsNullOrWhiteSpace(res)) + { + throw new Exception("未能取得审批历史进程信息"); + } + + return new BaseResult + { + bSuccess = true, + message = "获取成功", + result = res, + voucherId = voucherId, + voucherCode = voucherCode + }; + + } + catch (Exception ex) + { + _logInfo.Error($"审批流异常:{ex.Message}", ex); + + await Task.Delay(1); + + return new BaseResult + { + bSuccess = false, + message = "获取失败", + voucherCode = voucherCode, + voucherId = voucherId, + result = ex.Message + }; + } + } + + /// + /// #退回提交人后重新提交# + /// + /// + /// + /// + /// + /// + public async Task> SubmitResubmitMessage(BaseLogin login, string cCardNum, string voucherId, string voucherCode) + { + try + { + var auditServiceProxy = new AuditServiceProxy(); + + var keySet = $@""; + + var errMsg = ""; + + var res = auditServiceProxy.SubmitResubmitMessage(keySet, login._productContext.calledContext,ref errMsg); + + if (!res && !string.IsNullOrWhiteSpace(errMsg)) + { + throw new Exception(errMsg); + } + + if (!string.IsNullOrWhiteSpace(errMsg)) + { + throw new Exception(errMsg); + } + + if (!res) + { + throw new Exception("审批流发生异常"); + } + + return new BaseResult + { + bSuccess = true, + message = "提交成功", + result = "提交成功", + voucherId = voucherId, + voucherCode = voucherCode + }; + } + catch (Exception ex) + { + _logInfo.Error($"审批流异常:{ex.Message}", ex); + + await Task.Delay(1); + + return new BaseResult + { + bSuccess = false, + message = "提交失败", + voucherCode = voucherCode, + voucherId = voucherId, + result = ex.Message + }; + } + } + + /// + /// #取得代办任务# + /// + /// + /// + /// + public async Task> GetTasks(BaseLogin login, bool hasDone) + { + try + { + var auditServiceProxy = new AuditServiceProxy(); + + var errMsg = ""; + + var res = auditServiceProxy.GetTasks(hasDone, login._productContext.calledContext, ref errMsg); + + if (!string.IsNullOrWhiteSpace(errMsg)) + { + throw new Exception(errMsg); + } + + if (string.IsNullOrWhiteSpace(res)) + { + throw new Exception("审批流发生异常"); + } + + return new BaseResult + { + bSuccess = true, + message = "提交成功", + result = res + }; + } + catch (Exception ex) + { + _logInfo.Error($"审批流异常:{ex.Message}", ex); + + await Task.Delay(1); + + return new BaseResult + { + bSuccess = false, + message = "获取失败", + result = ex.Message + }; + } } } } diff --git a/UFIDA.U8.Framework.Api/App_Data/API_Meta.db b/UFIDA.U8.Framework.Api/App_Data/API_Meta.db index 7bbfe91e4bb6b1e4c36609df8493404e2c45db95..065dcc6fd0b592df3bab8091927eb5e31b1bedc6 100644 GIT binary patch delta 329 zcmaJ+J5EC}5KKfU5WIvo3Ku{~;N7*o-UcGk=K$&KwM}S{_*66rP=i1;w3L)l4!{X$ zI6;oW6BQLxj7Fo;jApU!E!Mr~QFrpPce*+09Nu0o^Y?Lgu;P=i@lLOqZuCC}pZ!@g zUEYnF*MrBS`Th2w=?s7Ius_@yUf*1uU!48V#@ec63R(@;SBnV=EITh*ZFNlSKqYW; z97$^OSlDJou%acPH;CW>TTA8?a)k;Oj4>Hn1*9RNcqQfP6B|!KLr4^bu|z1rfRICC zV>B4dQHYZIP@D&ePNK$45Zg&@Yn>|`vnoLwE&vG~i9)ShOAy^