增加交易唯一码,方便在网络状态不佳的情况下重新获取操作结果
This commit is contained in:
@@ -17,7 +17,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.AP
|
||||
{
|
||||
public class clsVouchFacade
|
||||
{
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
private readonly ILog _logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
/// <summary>
|
||||
/// 保存单据
|
||||
@@ -30,92 +30,50 @@ namespace UFIDA.U8.Framework.Api.ControlObject.AP
|
||||
/// <param name="bPrintDom"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<BaseResult<string>> SaveVouch(BaseLogin login, Dictionary<string, object> input,string VouchClass,bool bGetCode=false,string codeKey="",bool bPrintDom=false)
|
||||
public async Task<BaseResult<string>> SaveVouch(BaseLogin baseLogin, Dictionary<string, object> input,string VouchClass,bool IsAdd = true,bool bVerify=false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var clsVouchFacade = $"UFAPBO.clsVouchFacade".GetComObject();
|
||||
var clsVouchFacade = $"UFAPApplyPay.clsVouchFacade".GetComObject();
|
||||
|
||||
clsVouchFacade.Init(VouchClass, login._vbLogin);
|
||||
clsVouchFacade.init(VouchClass, baseLogin._vbLogin, baseLogin.Connection);
|
||||
|
||||
IXMLDOMDocument2 domHead = new DOMDocument();
|
||||
IXMLDOMDocument2 domBody = new DOMDocument();
|
||||
|
||||
var errMsg = "";
|
||||
|
||||
//if (!clsVouchFacade.GetVouchData("0", ref domHead, ref domBody, ref errMsg))
|
||||
//{
|
||||
// throw new Exception(errMsg);
|
||||
//}
|
||||
_logInfo.Debug("填充表头DOM...");
|
||||
|
||||
domHead = input.ToDocument2(domHead);
|
||||
|
||||
if (!input.TryGetValue("body", out var bodys))
|
||||
{
|
||||
await Task.Delay(1);
|
||||
throw new Exception("无法获取表体数据");
|
||||
}
|
||||
|
||||
if (!(bodys is List<Dictionary<string, object>> dictionarys) || dictionarys.Count <= 0)
|
||||
{
|
||||
throw new Exception("无法获取表体数据");
|
||||
throw new Exception("无法获取表体数据");
|
||||
}
|
||||
|
||||
//if (bGetCode)
|
||||
//{
|
||||
// var cardNum = "";
|
||||
|
||||
// switch (VouchClass)
|
||||
// {
|
||||
// case "收款单":
|
||||
// cardNum = "AR48";
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
|
||||
// //var clsBillComponent = "UFBillComponent.clsBillComponent".GetComObject();
|
||||
|
||||
// //if (!clsBillComponent.InitBill(login._vbLogin.UfDbName, cardNum))
|
||||
// //{
|
||||
// // throw new Exception("初始化单据编号组件失败");
|
||||
// //}
|
||||
|
||||
// //var newCode = clsBillComponent.GetNumber(clsBillComponent.GetBillFormat());
|
||||
|
||||
// var newCode = "0000000001";
|
||||
|
||||
// logInfo.Debug($"获取新单号:{newCode}");
|
||||
|
||||
// if (!string.IsNullOrWhiteSpace(newCode))
|
||||
// {
|
||||
// CommonHelper.SetDomKeyValue(domHead, codeKey, newCode);
|
||||
// }
|
||||
|
||||
// input[codeKey] = newCode;
|
||||
//}
|
||||
|
||||
logInfo.Debug("填充表体DOM...");
|
||||
_logInfo.Debug("填充表体DOM...");
|
||||
domBody = dictionarys.ToDocument2(domBody);
|
||||
|
||||
if (bPrintDom)
|
||||
{
|
||||
logInfo.Debug("开始输入DOM...");
|
||||
|
||||
logInfo.Debug(domHead.xml);
|
||||
|
||||
logInfo.Debug(domBody.xml);
|
||||
}
|
||||
|
||||
var res = new BaseResult<string>();
|
||||
|
||||
res.bSuccess = clsVouchFacade.SaveVouch(domHead, domBody, ref errMsg);
|
||||
res.bSuccess = clsVouchFacade.SaveVouch(domHead, domBody, ref errMsg, IsAdd);
|
||||
|
||||
if (!res.bSuccess)
|
||||
{
|
||||
throw new Exception(errMsg);
|
||||
}
|
||||
|
||||
if (bVerify)
|
||||
{
|
||||
clsVouchFacade.Verify();
|
||||
}
|
||||
|
||||
res.message = "保存成功";
|
||||
res.voucherCode = "";
|
||||
res.voucherId = "";
|
||||
@@ -127,7 +85,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.AP
|
||||
{
|
||||
await Task.Delay(1);
|
||||
|
||||
logInfo.Error(ex.Message, ex);
|
||||
_logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user