提交测试
This commit is contained in:
@@ -4,11 +4,15 @@ using MSXML2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Common;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Json;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||
// ReSharper disable StringLiteralTypo
|
||||
// ReSharper disable CommentTypo
|
||||
// ReSharper disable IdentifierTypo
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
{
|
||||
@@ -20,7 +24,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
|
||||
public async Task<BaseResult<string>> Insert(BaseLogin baseLogin, Dictionary<string, object> dictionary,string cCardNum, string sVouchType,bool bGetCode=false,string codeKey="",bool bCheck=true,bool bBeforCheckStock=true,bool bIsRedVouch=false,string sAddedState="", bool bReMote=false)
|
||||
public async Task<BaseResult<string>> Insert(BaseLogin baseLogin, Dictionary<string, object> dictionary,string cCardNum, string sVouchType,bool bGetCode=false,string codeKey="",bool bCheck=true,bool bBeforCheckStock=true,bool bIsRedVouch=false,string sAddedState="", bool bReMote=false,bool bAudit=false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -67,7 +71,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(newCode))
|
||||
{
|
||||
object value = CommonHelper.SetDomKeyValue(domHead, codeKey, newCode);
|
||||
CommonHelper.SetDomKeyValue(domHead, codeKey, newCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,67 +88,87 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
{
|
||||
res.bSuccess = co.Insert(sVouchType, domHead, domBody, domPosition, ref errorMsg, baseLogin.Connection, ref vouchId, ref domMsg, bCheck, bBeforCheckStock, bIsRedVouch, sAddedState, bReMote);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
|
||||
res.message = errorMsg;
|
||||
|
||||
if (res.bSuccess && bAudit)
|
||||
{
|
||||
errorMsg = "";
|
||||
|
||||
if (!co.Verify(sVouchType, vouchId,ref errorMsg, baseLogin.Connection))
|
||||
{
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(errorMsg))
|
||||
throw new Exception(errorMsg);
|
||||
|
||||
throw new Exception("审核单据时发生异常,请检查数据");
|
||||
}
|
||||
}
|
||||
|
||||
if (!res.bSuccess)
|
||||
{
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(errorMsg))
|
||||
throw new Exception(errorMsg);
|
||||
|
||||
throw new Exception(domMsg.xml);
|
||||
}
|
||||
|
||||
baseLogin.Connection.CommitTrans();
|
||||
|
||||
if (!res.bSuccess)
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WITH(NOLOCK) WHERE CardNumber='{cCardNum}'", baseLogin.Connection);
|
||||
|
||||
if (rst.BOF || rst.EOF)
|
||||
{
|
||||
res.message = "新增失败";
|
||||
res.result = errorMsg;
|
||||
res.bSuccess = false;
|
||||
res.result = $"已在U8生成单据ID为{vouchId}的单据,但是未能查询到该单据的配置信息!";
|
||||
}
|
||||
else
|
||||
{
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{cCardNum}'", baseLogin.Connection);
|
||||
|
||||
if (rst.BOF || rst.EOF)
|
||||
rst.MoveFirst();
|
||||
var fieldName = $"{rst.Fields["VchTblPrimarykeyNames"].Value}";
|
||||
var codeName = $"{rst.Fields["ReceiptNOFieldName"].Value}";
|
||||
if (string.IsNullOrWhiteSpace(fieldName) || string.IsNullOrWhiteSpace(codeName))
|
||||
{
|
||||
res.bSuccess = false;
|
||||
res.result = $"已在U8生成单据ID为{vouchId}的单据,但是未能查询到该单据的配置信息!";
|
||||
res.voucherCode = $"{res.voucherId}";
|
||||
}
|
||||
else
|
||||
{
|
||||
rst.MoveFirst();
|
||||
var fieldName = $"{rst.Fields["VchTblPrimarykeyNames"].Value}";
|
||||
var codeName = $"{rst.Fields["ReceiptNOFieldName"].Value}";
|
||||
if (string.IsNullOrWhiteSpace(fieldName) || string.IsNullOrWhiteSpace(codeName))
|
||||
if (codeName.Contains("{##}"))
|
||||
{
|
||||
res.voucherCode = $"{res.voucherId}";
|
||||
codeName = codeName.Split('{', '#', '#', '}')[0];
|
||||
}
|
||||
|
||||
var strSql = $"SELECT {codeName} AS cCode FROM {rst.Fields["BTTblName"].Value} WITH(NOLOCK) WHERE {fieldName}='{vouchId}'";
|
||||
rst.Close();
|
||||
|
||||
rst.Open(strSql, baseLogin.Connection);
|
||||
|
||||
if (rst.EOF || rst.BOF)
|
||||
{
|
||||
res.voucherCode = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (codeName.Contains("{##}"))
|
||||
{
|
||||
codeName = codeName.Split('{', '#', '#', '}')[0];
|
||||
}
|
||||
|
||||
var strSql = $"SELECT {codeName} AS cCode FROM {rst.Fields["BTTblName"].Value} WHERE {fieldName}='{vouchId}'";
|
||||
rst.Close();
|
||||
|
||||
rst.Open(strSql, baseLogin.Connection);
|
||||
|
||||
if (rst.EOF || rst.BOF)
|
||||
{
|
||||
res.voucherCode = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
rst.MoveFirst();
|
||||
res.voucherCode = $"{rst.Fields["cCode"].Value}";
|
||||
}
|
||||
rst.MoveFirst();
|
||||
res.voucherCode = $"{rst.Fields["cCode"].Value}";
|
||||
}
|
||||
}
|
||||
|
||||
res.message = "新增成功";
|
||||
res.result = vouchId;
|
||||
}
|
||||
|
||||
res.message = "新增成功";
|
||||
res.result = vouchId;
|
||||
|
||||
|
||||
return res;
|
||||
|
||||
//var bodys = dictionary.TryGetValue() dictionary["body"];
|
||||
@@ -205,7 +229,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
|
||||
domBody = bodys.ToDocument2(domBody);
|
||||
|
||||
IXMLDOMDocument2 domMsg = new DOMDocument();
|
||||
//IXMLDOMDocument2 domMsg = new DOMDocument();
|
||||
|
||||
errorMsg = "";
|
||||
baseLogin.Connection.BeginTrans();
|
||||
@@ -216,10 +240,10 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
{
|
||||
res.bSuccess = co.Update(sVouchType, domHead, domBody, domPosition);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
|
||||
if (!res.bSuccess)
|
||||
|
||||
Reference in New Issue
Block a user