提交测试

This commit is contained in:
敏健 邱
2024-12-15 14:45:55 +08:00
parent 7f138d24c2
commit 55410bf38e
9 changed files with 83 additions and 33 deletions
@@ -8,6 +8,7 @@ using System.Text;
using System.Web.UI.WebControls;
using ADODB;
using GetComObj;
using log4net;
using MSXML2;
using Newtonsoft.Json.Linq;
using UFIDA.U8.Framework.Api.Common.Entity;
@@ -18,6 +19,10 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
{
public static class CommonHelper
{
/// <summary>
/// 日志组件
/// </summary>
private static readonly ILog logInfo = LogManager.GetLogger("logInfo");
public static void SetPropValue(this PropertyInfo prop, object obj, object value)
{
@@ -281,6 +286,23 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
return root;
}
public static object SetDomKeyValue(this IXMLDOMDocument2 domDocument2,string key,object value)
{
var node= domDocument2.selectSingleNode("//z:row");
if (node == null)
return null;
var attr = domDocument2.createAttribute(key);
attr.nodeValue=value;
node.attributes.setNamedItem(attr);
return value;
}
public static void ResetDictionary(this Dictionary<string, object> dictionary, string bodyKey = "body")
{
if (dictionary.ContainsKey(bodyKey))
@@ -18,7 +18,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 sVouchType,bool bGetCode=false,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 sVouchType,bool bGetCode=false,string codeKey="",bool bCheck=true,bool bBeforCheckStock=true,bool bIsRedVouch=false,string sAddedState="", bool bReMote=false)
{
try
{
@@ -46,6 +46,18 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
throw new Exception("无法获取表体数据");
}
if (bGetCode && !string.IsNullOrWhiteSpace(codeKey))
{
errorMsg = "";
var newCode = co.GetNewVouchCode(sVouchType, domHead, ref errorMsg);
logInfo.Debug($"获取新单号:{newCode}");
//if (!string.IsNullOrWhiteSpace(newCode))
//{
// object value = domHead.SetDomKeyValue(codeKey, newCode);
//}
}
var domBody = dictionarys.ToDocument2();
IXMLDOMDocument2 domPosition = new DOMDocument();
@@ -57,7 +69,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
var res = new BaseResult<string>();
try
{
res.bSuccess = co.Update(sVouchType, domHead, domBody, domPosition, ref errorMsg, baseLogin.Connection, ref vouchId, ref domMsg, bCheck, bBeforCheckStock, bIsRedVouch, sAddedState, bReMote);
res.bSuccess = co.Insert(sVouchType, domHead, domBody, domPosition, ref errorMsg, baseLogin.Connection, ref vouchId, ref domMsg, bCheck, bBeforCheckStock, bIsRedVouch, sAddedState, bReMote);
}
catch (Exception ex)
{