diff --git a/UFIDA.U8.Framework.Api.ControlObject/PU/clsVoucherCO_PU.cs b/UFIDA.U8.Framework.Api.ControlObject/PU/clsVoucherCO_PU.cs
index 2b49c1b..0462ac1 100644
--- a/UFIDA.U8.Framework.Api.ControlObject/PU/clsVoucherCO_PU.cs
+++ b/UFIDA.U8.Framework.Api.ControlObject/PU/clsVoucherCO_PU.cs
@@ -925,5 +925,200 @@ namespace UFIDA.U8.Framework.Api.ControlObject.PU
return res;
}
+
+ ///
+ /// 批量提交工作流(单号)
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task>> SubmintWf(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, List cCodes, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
+ {
+ _logInfo.Debug("开始输出登录信息");
+ _logInfo.Debug(baseLogin._vbLogin.userToken);
+
+ var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
+
+ var conn = baseLogin.Connection;
+
+ var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
+
+ var resList = new List>();
+
+ foreach (var cCode in cCodes)
+ {
+ try
+ {
+ var strWhere = CommonHelper.GetPUVoucherWhereSqlByCode(vouchers, cCode);
+
+ var curId = CommonHelper.GetVoucherId(conn, cCode, vouchers);
+
+ var verifyResult = await SubmintWf(co, conn, enmVoucherType, cCode, curId, strWhere);
+
+ resList.Add(verifyResult);
+ }
+ catch (Exception ex)
+ {
+ await Task.Delay(1);
+ _logInfo.Error(ex.Message, ex);
+ }
+ }
+
+ return resList;
+ }
+
+ ///
+ /// 批量提交工作流(ID)
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task>> SubmintWf(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, List vouchIds, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
+ {
+ var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
+
+ var conn = baseLogin.Connection;
+
+ var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
+
+ var resList = new List>();
+
+ foreach (var vouchId in vouchIds)
+ {
+ var strWhere = CommonHelper.GetPUVoucherWhereSqlById(vouchers, vouchId);
+
+ var cCode = CommonHelper.GetVoucherCode(conn, vouchId, vouchers);
+
+ var verifyResult = await SubmintWf(co, conn, enmVoucherType, cCode, vouchId, strWhere);
+
+ resList.Add(verifyResult);
+ }
+
+ return resList;
+ }
+
+ ///
+ /// 提交工作流(单号)
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task> SubmintWf(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, string cCode, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
+ {
+ var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
+
+ var conn = baseLogin.Connection;
+
+ var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
+
+ var curId = CommonHelper.GetVoucherId(conn, cCode, vouchers);
+
+ var strWhere = CommonHelper.GetPUVoucherWhereSqlByCode(vouchers, cCode);
+
+ var verifyResult = await SubmintWf(co, conn, enmVoucherType, cCode, curId, strWhere);
+
+ return verifyResult;
+ }
+
+ ///
+ /// 提交工作流(ID)
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task> SubmintWf(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, long vouchId, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
+ {
+ var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
+
+ var conn = baseLogin.Connection;
+
+ var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
+
+ var strWhere = CommonHelper.GetPUVoucherWhereSqlById(vouchers, vouchId);
+
+ var cCode = CommonHelper.GetVoucherCode(conn, vouchId, vouchers);
+
+ var verifyResult = await SubmintWf(co, conn, enmVoucherType, cCode, vouchId, strWhere);
+
+ return verifyResult;
+ }
+
+ ///
+ /// 提交工作流
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task> SubmintWf(dynamic voucherCO, Connection conn, vouchertype sVouchType, string cCode, object vouchId, string strWhere)
+ {
+ IXMLDOMDocument2 domHead = new DOMDocument();
+ IXMLDOMDocument2 domBody = new DOMDocument();
+ IXMLDOMDocument2 domMsg = new DOMDocument();
+
+ _logInfo.Debug("开始获取单据数据...");
+ voucherCO.GetVoucherData(ref domHead, ref domBody, strWhere);
+
+ var res = new BaseResult
+ {
+ voucherCode = cCode,
+ voucherId = $"{vouchId}"
+ };
+
+ var errorMsg = "";
+
+ voucherCO.SubmintWf(domHead, ref errorMsg, vouchId);
+
+ res.bSuccess = string.IsNullOrWhiteSpace(errorMsg);
+
+ if (res.bSuccess)
+ {
+ res.message = "提交成功";
+ res.result = res.voucherId;
+
+ }
+ else
+ {
+ res.message = "提交失败";
+ res.result = string.IsNullOrWhiteSpace(errorMsg) ? "未知错误" : errorMsg;
+ await Task.Delay(1);
+ }
+
+ return res;
+ }
}
}
diff --git a/UFIDA.U8.Framework.Api.ControlObject/SA/ClsVoucherCO_SA.cs b/UFIDA.U8.Framework.Api.ControlObject/SA/ClsVoucherCO_SA.cs
index 01c7853..7b953ce 100644
--- a/UFIDA.U8.Framework.Api.ControlObject/SA/ClsVoucherCO_SA.cs
+++ b/UFIDA.U8.Framework.Api.ControlObject/SA/ClsVoucherCO_SA.cs
@@ -206,7 +206,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.SA
IXMLDOMDocument2 domMsg = new DOMDocument();
_logInfo.Debug("开始获取单据数据...");
- voucherCo.GetVoucherData(ref domHead, ref domBody, vouchId, true, strWhere);
+ voucherCo.GetVoucherData(ref domHead, ref domBody, vouchId, true, "");
var res = new BaseResult
{
diff --git a/UFIDA.U8.Framework.Api.ControlObject/Workflow/ServiceProxy.cs b/UFIDA.U8.Framework.Api.ControlObject/Workflow/ServiceProxy.cs
index 04bd47d..bdd698e 100644
--- a/UFIDA.U8.Framework.Api.ControlObject/Workflow/ServiceProxy.cs
+++ b/UFIDA.U8.Framework.Api.ControlObject/Workflow/ServiceProxy.cs
@@ -2,6 +2,7 @@
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using log4net;
+using Newtonsoft.Json.Linq;
using UFIDA.U8.Audit.ServiceProxy;
using UFIDA.U8.Framework.Api.ControlObject.Common;
using UFIDA.U8.Framework.Api.ControlObject.Entity;
@@ -58,14 +59,26 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Workflow
{
var auditServiceProxy = new AuditServiceProxy();
- var isWfControled = false;
+ var isWfControled = IsFlowEnabled(login, bizObjectId, eventId);
var errMsg = "";
- var res = auditServiceProxy.SubmitApplicationMessage(bizObjectId, eventId, voucherId, login._productContext.calledContext, ref isWfControled, ref errMsg);
-
- if (!res && !string.IsNullOrWhiteSpace(errMsg))
+ if (isWfControled)
{
- throw new Exception(errMsg);
+ var context = new CalledContext() { subId = "PU", token = login.userToken };
+
+ var res = auditServiceProxy.SubmitApplicationMessage(bizObjectId, eventId, voucherId, context,
+ ref isWfControled, ref errMsg);
+
+ if (!res && !string.IsNullOrWhiteSpace(errMsg))
+ {
+ throw new Exception(errMsg);
+ }
+
+ if (!res)
+ {
+ throw new Exception("审批流发生异常");
+ }
+
}
if (!isWfControled && !string.IsNullOrWhiteSpace(errMsg))
@@ -78,12 +91,6 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Workflow
throw new Exception("当前单据无法进入工作流");
}
- if (!res)
- {
- throw new Exception("审批流发生异常");
- }
-
-
return new BaseResult
{
bSuccess = true,
@@ -505,6 +512,98 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Workflow
}
}
+ ///
+ /// #提交审批流#
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task> SubmitResubmitMessage(BaseLogin login, string cCardNum, string voucherCode, bool bUAP = false)
+ {
+ var voucherId = "";
+
+ try
+ {
+ var vouchers = CommonHelper.GetVouchers(login.Connection, cCardNum);
+
+ voucherId = $"{CommonHelper.GetVoucherId(login.Connection, voucherCode, vouchers)}";
+
+ var bizObjectId = cCardNum;
+
+ if (bUAP)
+ {
+ bizObjectId = $"UAPFORM.{bizObjectId}";
+ }
+
+ return await SubmitResubmitMessage(login, bizObjectId, voucherId, 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, object voucherId, bool bUAP = false)
+ {
+ var voucherCode = "";
+
+ try
+ {
+ var vouchers = CommonHelper.GetVouchers(login.Connection, cCardNum);
+
+ voucherCode = $"{CommonHelper.GetVoucherCode(login.Connection, voucherId, vouchers)}";
+
+ var bizObjectId = cCardNum;
+
+ if (bUAP)
+ {
+ bizObjectId = $"UAPFORM.{bizObjectId}";
+ }
+
+
+ return await SubmitResubmitMessage(login, bizObjectId, $"{voucherId}", 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
+ };
+ }
+ }
+
+
///
/// #取得代办任务#
///
diff --git a/UFIDA.U8.Framework.Api/App_Data/API_Meta.db b/UFIDA.U8.Framework.Api/App_Data/API_Meta.db
index e3d12e7..76513c9 100644
Binary files a/UFIDA.U8.Framework.Api/App_Data/API_Meta.db and b/UFIDA.U8.Framework.Api/App_Data/API_Meta.db differ
diff --git a/UFIDA.U8.Framework.Api/App_Data/U8API.xml b/UFIDA.U8.Framework.Api/App_Data/U8API.xml
index dd0c2e5..f819433 100644
--- a/UFIDA.U8.Framework.Api/App_Data/U8API.xml
+++ b/UFIDA.U8.Framework.Api/App_Data/U8API.xml
@@ -991,6 +991,48 @@
为空
+
+
+ 提交工作流(单号)
+
+ 系统号
+ 单据类型编码
+ 单号
+ 红蓝标识:True,蓝字
+ 发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)
+ 业务类型:普通采购,直运采购,受托代销
+ CS 0,BS 1;一般CS
+ 为空
+
+
+
+
+ 提交工作流(ID)
+
+ 系统号
+ 单据类型编码
+ 单据ID
+ 红蓝标识:True,蓝字
+ 发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)
+ 业务类型:普通采购,直运采购,受托代销
+ CS 0,BS 1;一般CS
+ 为空
+
+
+
+
+ 提交工作流(批量)
+
+ 系统号
+ 单据类型编码
+ 报文
+ 红蓝标识:True,蓝字
+ 发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)
+ 业务类型:普通采购,直运采购,受托代销
+ CS 0,BS 1;一般CS
+ 为空
+
+
查询特定单据部分
@@ -1487,7 +1529,6 @@
提交审批流(单号)
- 系统注册号
单据类型编码
单据编号
审批事件
@@ -1516,6 +1557,44 @@
是否UAP单据
+
+
+ 退回提交人后重新提交(单号)
+
+ 单据类型编码
+ 单据ID
+ 系统注册号
+ 是否UAP单据
+
+
+
+
+ 退回提交人后重新提交(单号)
+
+ 单据类型编码
+ 单据编号
+ 是否UAP单据
+
+
+
+
+ 提交审批流(ID)
+
+ 单据类型编码
+ 单据ID
+ 系统注册号
+ 是否UAP单据
+
+
+
+
+ 提交审批流(ID)
+
+ 单据类型编码
+ 单据ID
+ 是否UAP单据
+
+
登录参数
diff --git a/UFIDA.U8.Framework.Api/Controllers/U8/PUController.cs b/UFIDA.U8.Framework.Api/Controllers/U8/PUController.cs
index b08bfe3..779897b 100644
--- a/UFIDA.U8.Framework.Api/Controllers/U8/PUController.cs
+++ b/UFIDA.U8.Framework.Api/Controllers/U8/PUController.cs
@@ -772,7 +772,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
if ((cCodes == null || cCodes.Count <= 0) && (voucherIds == null || voucherIds.Count <= 0))
{
- throw new Exception("没有数据需要弃审");
+ throw new Exception("没有数据需要删除");
}
var strCode = "";
@@ -839,6 +839,226 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
}
}
+ ///
+ /// 提交工作流(单号)
+ ///
+ /// 系统号
+ /// 单据类型编码
+ /// 单号
+ /// 红蓝标识:True,蓝字
+ /// 发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)
+ /// 业务类型:普通采购,直运采购,受托代销
+ /// CS 0,BS 1;一般CS
+ /// 为空
+ ///
+ [HttpGet]
+ [Route("api/U8/PU/{cCardNum}/SubmintWf/Code")]
+ public async Task> SubmintWf(string cAccId, string cCardNum, string cCode, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
+ {
+ try
+ {
+ var db = CommUnit.GetDbClient();
+
+ var workId = SnowFlakeSingle.Instance.NextId();
+
+ _logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:提交工作流,对接账套:{cAccId},单号:{cCode}");
+
+ if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin) || baseLogin == null)
+ {
+ _logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
+
+ baseLogin = new BaseLogin();
+
+ var param = await CommUnit.GetLoginParamter(cAccId);
+
+ if (param == null)
+ {
+ throw new Exception("未能加载指定系统号的登录信息");
+ }
+
+ baseLogin.Init(param, false);
+
+ _cache.Clear();
+
+ _cache.Set($"U8_{cAccId}", baseLogin);
+ }
+
+ _logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
+
+ var voucherInfo = await db.Queryable().FirstAsync(s => s.CardNumber == cCardNum);
+
+ var co = new clsVoucherCO_PU();
+
+ return await co.SubmintWf(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), cCode, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
+ }
+ catch (Exception ex)
+ {
+ _logInfo.Error(ex.Message, ex);
+
+ return new BaseResult { bSuccess = false, message = "提交工作流失败", result = ex.Message };
+ }
+ }
+
+ ///
+ /// 提交工作流(ID)
+ ///
+ /// 系统号
+ /// 单据类型编码
+ /// 单据ID
+ /// 红蓝标识:True,蓝字
+ /// 发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)
+ /// 业务类型:普通采购,直运采购,受托代销
+ /// CS 0,BS 1;一般CS
+ /// 为空
+ ///
+ [HttpGet]
+ [Route("api/U8/PU/{cCardNum}/SubmintWf/ID")]
+ public async Task> SubmintWf(string cAccId, string cCardNum, long voucherId, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
+ {
+ try
+ {
+ var db = CommUnit.GetDbClient();
+
+ var workId = SnowFlakeSingle.Instance.NextId();
+
+ _logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:提交工作流,对接账套:{cAccId},ID:{voucherId}");
+
+ if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
+ {
+ _logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
+
+ baseLogin = new BaseLogin();
+
+ var param = await CommUnit.GetLoginParamter(cAccId);
+
+ if (param == null)
+ {
+ throw new Exception("未能加载指定系统号的登录信息");
+ }
+
+ baseLogin.Init(param, false);
+
+ _cache.Clear();
+
+ _cache.Set($"U8_{cAccId}", baseLogin);
+ }
+
+ _logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
+
+ var voucherInfo = await db.Queryable().FirstAsync(s => s.CardNumber == cCardNum);
+
+ var co = new clsVoucherCO_PU();
+
+ return await co.SubmintWf(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), voucherId, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
+ }
+ catch (Exception ex)
+ {
+ _logInfo.Error(ex.Message, ex);
+
+ return new BaseResult { bSuccess = false, message = "提交工作流失败", result = ex.Message };
+ }
+ }
+
+ ///
+ /// 提交工作流(批量)
+ ///
+ /// 系统号
+ /// 单据类型编码
+ /// 报文
+ /// 红蓝标识:True,蓝字
+ /// 发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)
+ /// 业务类型:普通采购,直运采购,受托代销
+ /// CS 0,BS 1;一般CS
+ /// 为空
+ ///
+ [HttpPost]
+ [Route("api/U8/PU/{cCardNum}/SubmintWf")]
+ public async Task>>> SubmintWf(string cAccId, string cCardNum, [FromBody] STInput input, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
+ {
+ var workId = SnowFlakeSingle.Instance.NextId();
+
+ try
+ {
+ var db = CommUnit.GetDbClient();
+
+ if (input == null)
+ {
+ throw new Exception("参数不能为空");
+ }
+
+ var cCodes = input.cCode;
+
+ var voucherIds = input.voucherId;
+
+ if ((cCodes == null || cCodes.Count <= 0) && (voucherIds == null || voucherIds.Count <= 0))
+ {
+ throw new Exception("没有数据需要提交工作流");
+ }
+
+ var strCode = "";
+ var strId = "";
+
+ var apiType = cCodes == null || cCodes.Count <= 0 ? 1 : 0;
+
+ if (cCodes != null && cCodes.Count > 0)
+ {
+ strCode = string.Join(",", cCodes);
+ }
+
+ if (voucherIds != null && voucherIds.Count > 0)
+ {
+ strId = string.Join(",", voucherIds);
+ }
+
+ _logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:提交工作流,对接账套:{cAccId},单号:{strCode},ID:{strId}");
+
+ if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
+ {
+ _logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
+
+ baseLogin = new BaseLogin();
+
+ var param = await CommUnit.GetLoginParamter(cAccId);
+
+ if (param == null)
+ {
+ throw new Exception("未能加载指定系统号的登录信息");
+ }
+
+ baseLogin.Init(param, false);
+
+ _cache.Clear();
+
+ _cache.Set($"U8_{cAccId}", baseLogin);
+ }
+
+ _logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
+
+ var voucherInfo = await db.Queryable().FirstAsync(s => s.CardNumber == cCardNum);
+
+ var co = new clsVoucherCO_PU();
+
+ var result = apiType == 0
+ ? await co.Delete(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), cCodes, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml)
+ : await co.Delete(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), voucherIds, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
+
+ var res = new BaseResult>>()
+ {
+ bSuccess = true,
+ message = "提交工作流完成",
+ result = result
+ };
+
+ return res;
+ }
+ catch (Exception ex)
+ {
+ _logInfo.Error(ex.Message, ex);
+
+ return new BaseResult>> { bSuccess = false, message = ex.Message, result = null };
+ }
+ }
+
///
/// 查询特定单据部分
///
diff --git a/UFIDA.U8.Framework.Api/Controllers/U8/WorkflowController.cs b/UFIDA.U8.Framework.Api/Controllers/U8/WorkflowController.cs
index 2885dbb..20d974f 100644
--- a/UFIDA.U8.Framework.Api/Controllers/U8/WorkflowController.cs
+++ b/UFIDA.U8.Framework.Api/Controllers/U8/WorkflowController.cs
@@ -53,8 +53,6 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
_logInfo.Debug($"当前接口:api/U8/Workflow/SubmitApplicationMessage/Code,对接账套:{cAccId},单据:{cCardNum},事件:{eventId},单据编号:{cCode}");
- var db = CommUnit.GetDbClient();
-
var workId = SnowFlakeSingle.Instance.NextId();
_logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:提交审批流,对接账套:{cAccId},单据编号:{cCode}");
@@ -95,7 +93,6 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
///
/// 提交审批流(单号)
///
- /// 系统注册号
/// 单据类型编码
/// 单据编号
/// 审批事件
@@ -177,8 +174,6 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
return await SubmitApplicationMessageToken(cCardNum, voucherId, eventId, bUap);
}
- var db = CommUnit.GetDbClient();
-
var workId = SnowFlakeSingle.Instance.NextId();
_logInfo.Debug($"当前接口:api/U8/Workflow/SubmitApplicationMessage/Code,作业Id:{workId},对接账套:{cAccId},单据:{cCardNum},事件:{eventId},单据ID:{voucherId}");
@@ -281,5 +276,246 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
}
}
+ ///
+ /// 退回提交人后重新提交(单号)
+ ///
+ /// 单据类型编码
+ /// 单据ID
+ /// 系统注册号
+ /// 是否UAP单据
+ ///
+ [HttpGet]
+ [Route("api/U8/Workflow/SubmitResubmitMessage/Code")]
+ public async Task> SubmitResubmitMessage(string cAccId, string cCardNum, string cCode, bool bUap = false)
+ {
+ try
+ {
+ if (Request.Headers.TryGetValues("userToken", out var userToken))
+ {
+ return await SubmitResubmitMessageToken(cCardNum, cCode, bUap);
+ }
+
+ _logInfo.Debug($"当前接口:api/U8/Workflow/SubmitResubmitMessage/Code,对接账套:{cAccId},单据:{cCardNum},单据编号:{cCode}");
+
+ var workId = SnowFlakeSingle.Instance.NextId();
+
+ _logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:提交审批流,对接账套:{cAccId},单据编号:{cCode}");
+
+ if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
+ {
+ _logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
+
+ baseLogin = new BaseLogin();
+
+ var param = await CommUnit.GetLoginParamter(cAccId);
+
+ if (param == null)
+ {
+ throw new Exception("未能加载指定系统号的登录信息");
+ }
+
+ baseLogin.Init(param, true);
+
+ _cache.Clear();
+
+ _cache.Set($"U8_{cAccId}", baseLogin);
+ }
+
+ var services = new ServiceProxy();
+
+ return await services.SubmitResubmitMessage(baseLogin, cCardNum, cCode, bUap);
+ }
+ catch (Exception ex)
+ {
+ _logInfo.Error(ex.Message, ex);
+
+ return new BaseResult { bSuccess = false, message = ex.Message, result = ex.StackTrace };
+
+ }
+ }
+
+ ///
+ /// 退回提交人后重新提交(单号)
+ ///
+ /// 单据类型编码
+ /// 单据编号
+ /// 是否UAP单据
+ ///
+ [HttpGet]
+ [Route("api/U8/Workflow/SubmitResubmitMessage/Code/Token")]
+ public async Task> SubmitResubmitMessageToken(string cCardNum, string cCode, bool bUap = false)
+ {
+ try
+ {
+ var userToken = Request.Headers.GetValues("userToken").First();
+
+ if (string.IsNullOrWhiteSpace(userToken))
+ {
+ throw new Exception("校验userToken失败");
+ }
+
+ _logInfo.Debug($"当前接口:api/U8/Workflow/SubmitResubmitMessage/Code/{userToken},单据:{cCardNum},单据编号:{cCode}");
+
+ var output = CommUnit.GetDecrypt(userToken).ToObject();
+
+ var token = CommUnit.GetDecrypt(output.userToken);
+
+ var workId = SnowFlakeSingle.Instance.NextId();
+
+ _logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:新增,对接账套:{output.cAccId},单据编号:{cCode}");
+
+ if (!_cache.TryGetValue($"U8_{userToken}_{output.cAccId}", out BaseLogin baseLogin))
+ {
+ _logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
+
+ baseLogin = new BaseLogin();
+
+ baseLogin.Init(token, true, 5);
+
+ try
+ {
+ _cache.Remove($"U8_{userToken}_{output.cAccId}");
+ }
+ catch
+ {
+ _logInfo.Debug($"不存在[U8_{userToken}_{output.cAccId}]的缓存");
+ }
+
+ _cache.Set($"U8_{userToken}_{output.cAccId}", baseLogin);
+ }
+
+ var services = new ServiceProxy();
+
+ return await services.SubmitResubmitMessage(baseLogin, cCardNum, cCode, bUap);
+ }
+ catch (Exception ex)
+ {
+ _logInfo.Error(ex.Message, ex);
+
+ return new BaseResult { bSuccess = false, message = ex.Message, result = ex.StackTrace };
+
+ }
+ }
+
+ ///
+ /// 提交审批流(ID)
+ ///
+ /// 单据类型编码
+ /// 单据ID
+ /// 系统注册号
+ /// 是否UAP单据
+ ///
+ [HttpGet]
+ [Route("api/U8/Workflow/SubmitResubmitMessage/ID")]
+ public async Task> SubmitResubmitMessage(string cAccId, string cCardNum, long voucherId, bool bUap = false)
+ {
+ try
+ {
+ if (Request.Headers.TryGetValues("userToken", out var userToken))
+ {
+ return await SubmitResubmitMessageToken(cCardNum, voucherId, bUap);
+ }
+
+ var workId = SnowFlakeSingle.Instance.NextId();
+
+ _logInfo.Debug($"当前接口:api/U8/Workflow/SubmitApplicationMessage/Code,作业Id:{workId},对接账套:{cAccId},单据:{cCardNum},单据ID:{voucherId}");
+
+ if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
+ {
+ _logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
+
+ baseLogin = new BaseLogin();
+
+ var param = await CommUnit.GetLoginParamter(cAccId);
+
+ if (param == null)
+ {
+ throw new Exception("未能加载指定系统号的登录信息");
+ }
+
+ baseLogin.Init(param, false);
+
+ _cache.Clear();
+
+ _cache.Set($"U8_{cAccId}", baseLogin);
+ }
+
+ var services = new ServiceProxy();
+
+ return await services.SubmitResubmitMessage(baseLogin, cCardNum, voucherId, bUap);
+ }
+ catch (Exception ex)
+ {
+ _logInfo.Error(ex.Message, ex);
+
+ return new BaseResult { bSuccess = false, message = ex.Message, result = ex.StackTrace };
+
+ }
+ }
+
+ ///
+ /// 提交审批流(ID)
+ ///
+ /// 单据类型编码
+ /// 单据ID
+ /// 是否UAP单据
+ ///
+ [HttpGet]
+ [Route("api/U8/Workflow/SubmitResubmitMessage/ID/Token")]
+ public async Task> SubmitResubmitMessageToken(string cCardNum, long voucherId, bool bUap = false)
+ {
+ try
+ {
+ var userToken = Request.Headers.GetValues("userToken").First();
+
+ if (string.IsNullOrWhiteSpace(userToken))
+ {
+ throw new Exception("校验userToken失败");
+ }
+
+ _logInfo.Debug($"当前接口:api/U8/Workflow/SubmitApplicationMessage/ID/{userToken},单据:{cCardNum},单据ID:{voucherId}");
+
+ var output = CommUnit.GetDecrypt(userToken).ToObject();
+
+ var token = CommUnit.GetDecrypt(output.userToken);
+
+ var workId = SnowFlakeSingle.Instance.NextId();
+
+ _logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:新增,对接账套:{output.cAccId},单据ID:{voucherId}");
+
+ if (!_cache.TryGetValue($"U8_{userToken}_{output.cAccId}", out BaseLogin baseLogin))
+ {
+ _logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
+
+ baseLogin = new BaseLogin();
+
+ baseLogin.Init(token, true, 5);
+
+ try
+ {
+ _cache.Remove($"U8_{userToken}_{output.cAccId}");
+ }
+ catch
+ {
+ _logInfo.Debug($"不存在[U8_{userToken}_{output.cAccId}]的缓存");
+ }
+
+ _cache.Set($"U8_{userToken}_{output.cAccId}", baseLogin);
+ }
+
+ var services = new ServiceProxy();
+
+ return await services.SubmitResubmitMessage(baseLogin, cCardNum, voucherId, bUap);
+ }
+ catch (Exception ex)
+ {
+ _logInfo.Error(ex.Message, ex);
+
+ return new BaseResult { bSuccess = false, message = ex.Message, result = ex.StackTrace };
+
+ }
+ }
+
+
}
}