提交测试
This commit is contained in:
@@ -24,13 +24,15 @@ 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,bool bAudit=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,bool bPrintDom=false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var co = "USERPCO.VoucherCO".GetComObject();
|
||||
|
||||
var errorMsg = "";
|
||||
logInfo.Debug("开始输出登录信息");
|
||||
logInfo.Debug(baseLogin._vbLogin.userToken);
|
||||
|
||||
if (!co.IniLogin(baseLogin._vbLogin, ref errorMsg))
|
||||
{
|
||||
@@ -43,10 +45,32 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
IXMLDOMDocument2 domPosition = new DOMDocument();
|
||||
|
||||
errorMsg = "";
|
||||
if (!co.GetDefaultVoucherDom(sVouchType, cCardNum, ref domHead, ref domBody, ref domPosition, ref errorMsg) || !string.IsNullOrWhiteSpace(errorMsg))
|
||||
|
||||
try
|
||||
{
|
||||
throw new Exception(errorMsg);
|
||||
logInfo.Debug("开始获取单据默认模板...");
|
||||
if (!co.GetDefaultVoucherDom(sVouchType, cCardNum, ref domHead, ref domBody, ref domPosition,
|
||||
ref errorMsg) || !string.IsNullOrWhiteSpace(errorMsg))
|
||||
{
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error($"获取单据默认模板失败,错误信息:{ex.Message}", ex);
|
||||
|
||||
errorMsg = "";
|
||||
|
||||
logInfo.Debug($"开始读取单据数据,当前单据编码:{cCardNum}");
|
||||
|
||||
if (!co.Load(sVouchType, "1=2", ref domHead, ref domBody, ref domPosition, ref errorMsg, true) || !string.IsNullOrWhiteSpace(errorMsg))
|
||||
{
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
logInfo.Debug("填充表头DOM...");
|
||||
|
||||
domHead = dictionary.ToDocument2(domHead);
|
||||
|
||||
@@ -75,18 +99,45 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
logInfo.Debug("填充表体DOM...");
|
||||
domBody = dictionarys.ToDocument2(domBody);
|
||||
|
||||
IXMLDOMDocument2 domMsg = new DOMDocument();
|
||||
errorMsg = "";
|
||||
baseLogin.Connection.BeginTrans();
|
||||
var vouchId = "";
|
||||
object vouchId = "";
|
||||
|
||||
var res = new BaseResult<string>();
|
||||
try
|
||||
{
|
||||
if (bPrintDom)
|
||||
{
|
||||
logInfo.Debug("开始输入DOM...");
|
||||
|
||||
logInfo.Debug(domHead.xml);
|
||||
|
||||
logInfo.Debug(domBody.xml);
|
||||
}
|
||||
|
||||
logInfo.Debug("执行插入操作...");
|
||||
var cmd = new Command
|
||||
{
|
||||
CommandText = "Select '开始执行插入操作'",
|
||||
ActiveConnection = baseLogin.Connection
|
||||
};
|
||||
object rsts = new Recordset();
|
||||
cmd.Execute(out rsts);
|
||||
res.bSuccess = co.Insert(sVouchType, domHead, domBody, domPosition, ref errorMsg, baseLogin.Connection, ref vouchId, ref domMsg, bCheck, bBeforCheckStock, bIsRedVouch, sAddedState, bReMote);
|
||||
|
||||
if (res.bSuccess)
|
||||
{
|
||||
logInfo.Debug($"操作完成,操作结果:成功!------[{vouchId}]------[{errorMsg}]------[{domMsg.xml}]");
|
||||
}
|
||||
else
|
||||
{
|
||||
logInfo.Debug($"操作完成,操作结果:失败!------[{vouchId}]------[{errorMsg}]------[{domMsg.xml}]");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -166,7 +217,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
}
|
||||
|
||||
res.message = "新增成功";
|
||||
res.result = vouchId;
|
||||
res.result =$"{vouchId}" ;
|
||||
|
||||
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user