增加交易唯一码,方便在网络状态不佳的情况下重新获取操作结果

This commit is contained in:
qmj
2026-05-26 08:45:24 +08:00
parent 8208ba7488
commit 42e6579447
30 changed files with 2891 additions and 374 deletions
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UFIDA.U8.Framework.Api.ControlObject.Common;
using UFIDA.U8.Framework.Api.ControlObject.Entity;
using UFIDA.U8.Framework.Api.ControlObject.U8M;
namespace UFIDA.U8.Framework.Api.ControlObject.AA
{
/// <summary>
/// 基础资料
/// </summary>
public class IClsCommon
{
public async Task<BaseResult<string>> Add(BaseLogin baseLogin,string cCardNum,Dictionary<string,object> input)
{
var com = "U8SrvTrans.IClsCommon".GetComObject();
com.InitNew(baseLogin._vbLogin);
var xml = $@"<fitem citem_class=""04"" citem_name=""testjxc"" citem_text=""项目名称"" crule=""1"" ctable=""fitemss04"" cClasstable=""fitemss04class"">
<structure>
<field citem_sqr=""1"" cfield_name=""i_id"" ctext=""自动编号"" imode=""0"" itype=""1"" ilength =""4"" iscale=""0"" blist=""0"" bsum=""0"" bref=""0"" isubitem=""0"" idefine="""" bprimarykey=""0"" isource="""" ctablename="""" cfieldname=""0"" iwidth=""1500"" ialign=""1"" />
<field citem_sqr=""2"" cfield_name=""citemcode"" ctext=""项目编号"" imode=""1"" itype=""3"" ilength =""60"" iscale=""0"" blist=""1"" bsum=""0"" bref=""1"" isubitem=""0"" idefine="""" bprimarykey=""0"" isource="""" ctablename="""" cfieldname=""0"" iwidth=""1500"" ialign=""1"" />
<field citem_sqr=""3"" cfield_name=""citemname"" ctext=""项目名称"" imode=""2"" itype=""3"" ilength =""255"" iscale=""0"" blist=""1"" bsum=""0"" bref=""1"" isubitem=""0"" idefine="""" bprimarykey=""0"" isource="""" ctablename="""" cfieldname=""0"" iwidth=""1500"" ialign=""1"" /> <field citem_sqr=""4"" cfield_name=""bclose"" ctext=""是否结算"" imode=""3"" itype=""5"" ilength =""1"" iscale=""0"" blist=""0"" bsum=""0"" bref=""1"" isubitem=""0"" idefine="""" bprimarykey=""0"" isource="""" ctablename="""" cfieldname=""0"" iwidth=""1500"" ialign=""1"" />
<field citem_sqr=""5"" cfield_name=""citemccode"" ctext=""所属分类码"" imode=""4"" itype=""3"" ilength =""22"" iscale=""0"" blist=""0"" bsum=""0"" bref=""1"" isubitem=""0"" idefine="""" bprimarykey=""0"" isource="""" ctablename="""" cfieldname=""0"" iwidth=""1500"" ialign=""1"" />
<field citem_sqr=""6"" cfield_name=""iotherused"" ctext=""其他系统是否使用"" imode=""5"" itype=""1"" ilength =""4"" iscale=""0"" blist=""0"" bsum=""0"" bref=""0"" isubitem=""0"" idefine="""" bprimarykey=""0"" isource="""" ctablename="""" cfieldname=""0"" iwidth=""1500"" ialign=""1"" />
</structure>
<itemclass citemccode=""04"" citemcname=""testjxc"" iitemcgrade="""" bitemcend="""" ctable=""fitemss04class""> </itemclass>
</fitem>";
var res = new BaseResult<string>();
var smg = "";
res.bSuccess = com.Add(xml, "fitem", ref smg);
if (!res.bSuccess)
{
res.result = smg;
}
return res;
}
}
}
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UFIDA.U8.Framework.Api.ControlObject.Common;
using UFIDA.U8.Framework.Api.ControlObject.Entity;
using UFIDA.U8.Framework.Api.ControlObject.U8M;
namespace UFIDA.U8.Framework.Api.ControlObject.AA.U8PzInsert
{
public class IFitem
{
public async Task<BaseResult<string>> Transact(BaseLogin baseLogin, string cCardNum, Dictionary<string, object> input)
{
var com = "U8PzInsert.IFitem".GetComObject();
//com.InitNew(baseLogin._vbLogin);
var xml = $@"<ufinterface roottag=""fitem"" docid="""" proc=""Add"" billtype="""" receiver="""" sender="""" codeexchanged="""" exportneedexch="""">
<fitem citem_class=""04"" citem_name=""testjxc"" citem_text=""项目名称"" crule=""1"">
<structure>
<field citem_sqr=""1"" cfield_name=""i_id"" ctext=""自动编号"" imode=""0"" itype=""1"" ilength =""4"" iscale=""0"" blist=""0"" bsum=""0"" bref=""0"" isubitem=""0"" idefine="""" bprimarykey=""0"" isource="""" ctablename="""" cfieldname=""0"" iwidth=""1500"" ialign=""1"" />
<field citem_sqr=""2"" cfield_name=""citemcode"" ctext=""项目编号"" imode=""1"" itype=""3"" ilength =""60"" iscale=""0"" blist=""1"" bsum=""0"" bref=""1"" isubitem=""0"" idefine="""" bprimarykey=""0"" isource="""" ctablename="""" cfieldname=""0"" iwidth=""1500"" ialign=""1"" />
<field citem_sqr=""3"" cfield_name=""citemname"" ctext=""项目名称"" imode=""2"" itype=""3"" ilength =""255"" iscale=""0"" blist=""1"" bsum=""0"" bref=""1"" isubitem=""0"" idefine="""" bprimarykey=""0"" isource="""" ctablename="""" cfieldname=""0"" iwidth=""1500"" ialign=""1"" /> <field citem_sqr=""4"" cfield_name=""bclose"" ctext=""是否结算"" imode=""3"" itype=""5"" ilength =""1"" iscale=""0"" blist=""0"" bsum=""0"" bref=""1"" isubitem=""0"" idefine="""" bprimarykey=""0"" isource="""" ctablename="""" cfieldname=""0"" iwidth=""1500"" ialign=""1"" />
<field citem_sqr=""5"" cfield_name=""citemccode"" ctext=""所属分类码"" imode=""4"" itype=""3"" ilength =""22"" iscale=""0"" blist=""0"" bsum=""0"" bref=""1"" isubitem=""0"" idefine="""" bprimarykey=""0"" isource="""" ctablename="""" cfieldname=""0"" iwidth=""1500"" ialign=""1"" />
<field citem_sqr=""6"" cfield_name=""iotherused"" ctext=""其他系统是否使用"" imode=""5"" itype=""1"" ilength =""4"" iscale=""0"" blist=""0"" bsum=""0"" bref=""0"" isubitem=""0"" idefine="""" bprimarykey=""0"" isource="""" ctablename="""" cfieldname=""0"" iwidth=""1500"" ialign=""1"" />
</structure>
<itemclass citemccode=""04"" citemcname=""testjxc"" iitemcgrade="""" bitemcend=""""> </itemclass>
</fitem>
</ufinterface>";
var res = new BaseResult<string>();
var smg = "";
smg = com.Transact(xml, baseLogin._vbLogin);
if (!res.bSuccess)
{
res.result = smg;
}
return res;
}
}
}
@@ -160,7 +160,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.AP
bodys.Add(body);
var res2=await clsVouchFacade.SaveVouch(login, newInput, "收款单", true, "cVouchID");
var res2=await clsVouchFacade.SaveVouch(login, newInput, "收款单", true,false /*"cVouchID"*/);
@@ -0,0 +1,47 @@
using log4net;
using MSXML2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using UFIDA.U8.Framework.Api.ControlObject.Common;
using UFIDA.U8.Framework.Api.ControlObject.Entity;
using UFIDA.U8.Framework.Api.ControlObject.U8M;
namespace UFIDA.U8.Framework.Api.ControlObject.AP
{
public class clsApplyPayCO
{
private readonly ILog _logInfo = LogManager.GetLogger("logInfo");
public async Task<BaseResult<string>> SaveVoucher(BaseLogin baseLogin, Dictionary<string, object> input, string SysId = null, bool IsAdd = true)
{
try
{
var co = "UFAPApplyPay.clsApplyPayCO".GetComObject();
var errorMsg = "";
_logInfo.Debug("开始输出登录信息");
_logInfo.Debug(baseLogin._vbLogin.userToken);
co.DoInit(baseLogin._vbLogin, baseLogin.Connection, SysId);
IXMLDOMDocument2 domHead = new DOMDocument();
IXMLDOMDocument2 domBody = new DOMDocument();
return null;
}
catch (Exception ex)
{
await Task.Delay(1);
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
}
}
}
}
@@ -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 };
}
@@ -13,28 +13,31 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
{
public class BEHelper
{
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
protected readonly ILog _logInfo = LogManager.GetLogger("logInfo");
private readonly dynamic _be;
private readonly PropertyInfo[] _props;
private string _invCode;
private string _free1;
private string _free2;
private string _free3;
private string _free4;
private string _free5;
private string _free6;
private string _free7;
private string _free8;
private string _free9;
private string _free10;
private string _invCode="";
private string _free1 = "";
private string _free2 = "";
private string _free3 = "";
private string _free4 = "";
private string _free5 = "";
private string _free6 = "";
private string _free7 = "";
private string _free8 = "";
private string _free9 = "";
private string _free10 = "";
private int _bomVersion;
private readonly string _cCardNum;
public BEHelper(dynamic be)
public BEHelper(dynamic be, string cCardNum="")
{
_be = be;
var tp = be.GetType();
_props = tp.GetProperties();
_cCardNum = cCardNum;
}
public void SetValue(Dictionary<string,object> dictionary)
@@ -42,7 +45,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
foreach (var key in dictionary.Keys)
{
if(key != "body")
logInfo.Debug($"正在设置字段:{key}--{dictionary[key]}");
_logInfo.Debug($"正在设置字段:{key}--{dictionary[key]}");
if (key.Contains("define") && !key.Contains("chdefine") && !key.Contains("cbdefine"))
{
@@ -60,7 +63,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
{
_be.ExtendUserDefineItem[defineCode] = dictionary[key];
}
} else if (key.Contains("cbdefine"))
}
else if (key.Contains("cbdefine"))
{
var defineCode = int.Parse(key.Replace("cbdefine", ""));
@@ -68,7 +72,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
{
_be.ExtendUserDefineItem[defineCode] = dictionary[key];
}
}else if (key.Contains("free"))
}
else if (key.Contains("free"))
{
var freeCode = int.Parse(key.Replace("free", ""));
@@ -80,7 +85,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
if (string.Equals(key, "invCode", StringComparison.OrdinalIgnoreCase))
{
_invCode = $"{dictionary[key]}";
}else if (string.Equals(key, "bomversion", StringComparison.OrdinalIgnoreCase))
}
else if (string.Equals(key, "bomversion", StringComparison.OrdinalIgnoreCase))
{
_bomVersion = int.Parse($"{dictionary[key]}");
}
@@ -141,5 +147,14 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
{
_be.SetBomId(_be.PartId, _bomVersion);
}
public void SetMoAllocateId()
{
if (_cCardNum == "MO39")
{
_be.SetMoAllocateId(_be.PartId);
}
}
}
}
@@ -1,17 +1,15 @@
using System;
using ADODB;
using GetComObj;
using log4net;
using Microsoft.VisualBasic.CompilerServices;
using MSXML2;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Web.UI.WebControls;
using ADODB;
using GetComObj;
using log4net;
using Microsoft.VisualBasic.CompilerServices;
using MSXML2;
using Newtonsoft.Json.Linq;
using UFIDA.U8.Framework.Api.Common.Entity;
using UFIDA.U8.Framework.Api.ControlObject.Entity;
using UFIDA.U8.Framework.Api.ControlObject.Json;
@@ -89,7 +87,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
return obj;
}
public static dynamic ToVoucherData(this Dictionary<string,object> dict,dynamic obj)
public static dynamic ToVoucherData(this Dictionary<string, object> dict, dynamic obj)
{
foreach (var dictKey in dict.Keys)
{
@@ -215,7 +213,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
// //}
//}
public static IXMLDOMDocument2 ToDocument2(this Dictionary<string,object> dictionary,IXMLDOMDocument2 domDocument2=null)
public static IXMLDOMDocument2 ToDocument2(this Dictionary<string, object> dictionary, IXMLDOMDocument2 domDocument2 = null)
{
if (domDocument2 == null)
@@ -233,7 +231,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
}
public static IXMLDOMNode SetRowData(this Dictionary<string, object> dictionary, IXMLDOMDocument2 domDocument2 = null,string bodyKey="body")
public static IXMLDOMNode SetRowData(this Dictionary<string, object> dictionary, IXMLDOMDocument2 domDocument2 = null, string bodyKey = "body")
{
if (domDocument2 == null)
{
@@ -244,7 +242,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
foreach (var key in dictionary.Keys)
{
if(key==bodyKey)
if (key == bodyKey)
continue;
var attr = domDocument2.createAttribute(key);
@@ -304,16 +302,16 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
return root;
}
public static object SetDomKeyValue(this IXMLDOMDocument2 domDocument2,string key,object value)
public static object SetDomKeyValue(this IXMLDOMDocument2 domDocument2, string key, object value)
{
var node= domDocument2.selectSingleNode("//z:row");
var node = domDocument2.selectSingleNode("//z:row");
if (node == null)
return null;
var attr = domDocument2.createAttribute(key);
attr.nodeValue=value;
attr.nodeValue = value;
node.attributes.setNamedItem(attr);
@@ -325,9 +323,9 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
{
if (dictionary.ContainsKey(bodyKey))
{
var body= dictionary[bodyKey].ToJson().ToList<Dictionary<string,object>>();
var body = dictionary[bodyKey].ToJson().ToList<Dictionary<string, object>>();
dictionary[bodyKey] = body;
dictionary[bodyKey] = body;
}
}
@@ -568,9 +566,11 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
var val = cPrecision == null
? dt.Compute(calcFormula, "")
: Math.Round(Convert.ToDecimal(dt.Compute(calcFormula, "")), cPrecision ?? 6); //计算公式结果
: Math.Round(Convert.ToDecimal(dt.Compute(calcFormula, "")), cPrecision ?? 6, MidpointRounding.AwayFromZero); //计算公式结果
dict[def.FieldName] = val;
_logInfo.Debug($"字段:{def.FieldName}公式:{calcFormula},公式结果:{val}");
}
catch (Exception ex)
{
@@ -657,7 +657,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
/// <param name="cCardNum">单据类型编码</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public static VouchersInfo GetVouchers(Connection conn,string cCardNum)
public static VouchersInfo GetVouchers(Connection conn, string cCardNum)
{
if (conn == null) throw new ArgumentNullException(nameof(conn));
if (cCardNum == null) throw new ArgumentNullException(nameof(cCardNum));
@@ -698,7 +698,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
}
res.cCodeFieldName = codeName;
res.voucherIdFieldName= $"{rst.Fields["VchTblPrimarykeyNames"].Value}";
res.voucherIdFieldName = $"{rst.Fields["VchTblPrimarykeyNames"].Value}";
rst.Close();
@@ -713,7 +713,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
/// <param name="vouchers">单据配置信息</param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public static string GetVoucherCode(Connection conn,object voucherId, VouchersInfo vouchers)
public static string GetVoucherCode(Connection conn, object voucherId, VouchersInfo vouchers)
{
if (conn == null) throw new ArgumentNullException(nameof(conn));
if (voucherId == null) throw new ArgumentNullException(nameof(voucherId));
@@ -742,6 +742,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
var cCode = $"{rst.Fields["cCode"].Value}";
rst.Close();
return cCode;
}
@@ -785,6 +787,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
var voucherId = rst.Fields["ID"].Value;
rst.Close();
return voucherId;
}
@@ -797,7 +801,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
/// <param name="eventId">事件Id</param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public static string GetEventId(Connection conn, string cCardNum,string eventId,bool bUAP =false)
public static string GetEventId(Connection conn, string cCardNum, string eventId, bool bUAP = false)
{
if (conn == null) throw new ArgumentNullException(nameof(conn));
if (cCardNum == null) throw new ArgumentNullException(nameof(cCardNum));
@@ -824,11 +828,13 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
var voucherId = rst.Fields["cBizEventId"].Value;
rst.Close();
return voucherId;
}
public static string GetVoucherWhereSqlByCode(VouchersInfo vouchers,string cVoucherCode)
public static string GetVoucherWhereSqlByCode(VouchersInfo vouchers, string cVoucherCode)
{
var tableName = vouchers.cBTTblName;
var fieldName = vouchers.voucherIdFieldName;
@@ -865,11 +871,11 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
return $"{cDefWhere} AND {tableName}.{fieldName}='{voucherId}'";
}
public static string GetQuerySql(VouchersInfo vouchers, Dictionary<string, object> input, string cCardPostion="H")
public static string GetQuerySql(VouchersInfo vouchers, Dictionary<string, object> input, string cCardPostion = "H")
{
var cBTQName = vouchers.cBTQName;
var cBWQName = vouchers.cBWQName;
var voucherIdFieldName = vouchers.voucherIdFieldName;
var tableName = cBTQName;
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UFIDA.U8.Framework.Api.ControlObject.Entity
namespace UFIDA.U8.Framework.Api.ControlObject.Entity
{
public class BaseResult<T>
{
@@ -12,6 +6,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Entity
public string message { get; set; }
public string voucherCode { get; set; }
public string voucherId { get; set; }
public string tradeid { get; set; }
public T result { get; set; }
}
}
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UFIDA.U8.Framework.Api.ControlObject.Entity
{
/// <summary>
/// 令牌构造参数
/// </summary>
public class UserTokenInfo
{
/// <summary>
/// 系统号
/// </summary>
public string cAccId { get; set; }
/// <summary>
/// 用户令牌
/// </summary>
public string userToken { get; set; }
/// <summary>
/// 登录参数
/// </summary>
public LoginParamter loginParamter { get; set; }
}
}
@@ -1,27 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UFIDA.U8.Framework.Api.ControlObject.SA
namespace UFIDA.U8.Framework.Api.ControlObject.SA
{
public enum VoucherTypeSA
{
/// <summary>
/// 发货单蓝字
/// </summary>
DispatchBlue=9,
SaleBillSpecBlue = 0,
SaleBillSpecRed = 1,
SaleBillCommBlue = 2,
SaleBillCommRed = 3,
SaleBillDirect = 4,
SaleBillSpecBlue = 0,
SaleBillSpecRed = 1
SARetailBlue = 5,
SARetailRed = 6,
SAMoveBlue = 7,
SAMoveRed = 8,
/// <summary>
/// 发货单蓝字
/// </summary>
DispatchBlue = 9,
DispatchRed = 10,
DispatchFIRST = 11,
SODetails = 12,
ExpenseVouch = 13,
SalePayVouch = 14,
WTDispatchBlue = 15,
WTDispatchRed = 16,
EntrustBlue = 17,
EntrustRed = 18,
WrapLease = 19,
WrapLeaseTH = 20,
SAQuo = 21,
WTTZ = 22,
WTDXQC = 23,
SaleOutVouch = 24,
PurZYBillVouch = 25,
PurPTBillVouch = 26,
PurYFBillVouch = 27,
PurOrderVouch = 28,
omOrderVouch = 29,
moOrderVouch = 30,
MeterOutVouch = 31,
FinGdInVouch = 32,
PurChInVouch = 33,
ReturnsApplyVouch = 34,
}
}
@@ -24,7 +24,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
/// </summary>
public class USERPCO
{
private readonly ILog _logInfo = LogManager.GetLogger("_logInfo");
private readonly ILog _logInfo = LogManager.GetLogger("logInfo");
/// <summary>
/// 新增单据
@@ -171,13 +171,14 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
throw new Exception("审核单据时发生异常,请检查数据");
}
_logInfo.Debug($"当前单据号:{res.voucherCode},操作完成,操作结果:成功!------[{vouchId}]------[{errorMsg}]------[{domMsg.xml}]");
_logInfo.Debug($"当前单据号:{res.voucherCode},操作完成,操作结果:成功!------[{vouchId}]------[{errorMsg}]------[{bVerify}]------[{cCardNum}]------[{domMsg.xml}]");
if (bVerify && cCardNum=="0304")
{
_logInfo.Debug($"0304,当前单据号:{res.voucherCode},开始审核其他出入库单据");
var strSql = $"select ID,cCode from RdRecord09 where (isnull(iverifystate,0)=0 or dVeriDate is null) and cSource='调拨' and cBusCode='{res.voucherCode}'";
var strSql = $"select ID,cCode,ufts from KCOtherOutH where (isnull(iverifystate,0)=0 or dVeriDate is null) and cSource='调拨' and cBusCode='{res.voucherCode}'";
var rst = new Recordset();
@@ -187,13 +188,16 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
{
var outId = $"{rst.Fields["ID"].Value}";
var outCode = $"{rst.Fields["cCode"].Value}";
var ufts = $"{rst.Fields["ufts"].Value}";
rst.Close();
errorMsg = "";
domMsg = new DOMDocument();
_logInfo.Debug($"0304,当前单据号:{res.voucherCode},其他出库单:{outCode},开始审核其他出库单");
var resOut = co.Verify("09", outId, ref errorMsg, baseLogin.Connection, null, ref domMsg);
var resOut = co.Verify("09", outId, ref errorMsg, baseLogin.Connection, ufts, ref domMsg);
if (!resOut)
{
@@ -208,10 +212,12 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
_logInfo.Debug($"0304,当前单据号:{res.voucherCode},其他出库单:{outCode},审核其他出库单完成,操作结果:成功!------[{outId}]------[{errorMsg}]------[{domMsg.xml}]");
}
else
{
rst.Close();
}
rst.Close();
strSql = $"select ID,cCode from RdRecord08 where (isnull(iverifystate,0)=0 or dVeriDate is null) and cSource='调拨' and cBusCode='{res.voucherCode}'";
strSql = $"select ID,cCode,ufts from KCOtherInH where (isnull(iverifystate,0)=0 or dVeriDate is null) and cSource='调拨' and cBusCode='{res.voucherCode}'";
var rst2 = new Recordset();
@@ -221,13 +227,16 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
{
var inId = $"{rst2.Fields["ID"].Value}";
var inCode = $"{rst2.Fields["cCode"].Value}";
var ufts = $"{rst2.Fields["ufts"].Value}";
rst2.Close();
errorMsg = "";
domMsg = new DOMDocument();
_logInfo.Debug($"0304,当前单据号:{res.voucherCode},其他入库单:{inId},开始审核其他入库单");
var resIn = co.Verify("08", inId, ref errorMsg, baseLogin.Connection, null, ref domMsg);
var resIn = co.Verify("08", inId, ref errorMsg, baseLogin.Connection, ufts, ref domMsg);
if (!resIn)
{
@@ -242,10 +251,68 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
_logInfo.Debug($"0304,当前单据号:{res.voucherCode},其他入库单:{inCode},审核其他入库单完成,操作结果:成功!------[{inId}]------[{errorMsg}]------[{domMsg.xml}]");
}
rst2.Close();
else
{
rst2.Close();
}
}
if(bVerify && cCardNum == "0411")
{
_logInfo.Debug($"0411,当前单据号:{res.voucherCode},开始审核材料出库单");
var strSql = $"select ID,cCode,ufts from RecordOutQ where (isnull(iverifystate,0)=0 or dVeriDate is null) and cSource='产成品入库单' and cBusCode='{res.voucherCode}'";
var rst = new Recordset();
rst.Open(strSql, baseLogin.Connection);
if (!rst.BOF && !rst.EOF)
{
var outId = $"{rst.Fields["ID"].Value}";
var outCode = $"{rst.Fields["cCode"].Value}";
var ufts = $"{rst.Fields["ufts"].Value}";
rst.Close();
errorMsg = "";
domMsg = new DOMDocument();
_logInfo.Debug($"0411,当前单据号:{res.voucherCode},材料出库单:{outCode},开始审核材料出库单");
var resOut = co.Verify("11", outId, ref errorMsg, baseLogin.Connection, ufts, ref domMsg);
if (!resOut)
{
if (!string.IsNullOrWhiteSpace(errorMsg))
{
_logInfo.Error($"第1次审核出错,错误信息:{errorMsg}");
resOut = co.Verify("11", outId, ref errorMsg, baseLogin.Connection, ufts, ref domMsg);
if (!resOut)
{
if (!string.IsNullOrWhiteSpace(errorMsg))
{
throw new Exception($"审核材料出库单时发生异常,错误信息:{errorMsg}");
}
}
}
if (!string.IsNullOrWhiteSpace(domMsg.xml))
throw new Exception($"审核材料出库单时发生异常,零出库控制:{domMsg.xml}");
throw new Exception("审核材料出库单时发生异常,请检查数据");
}
_logInfo.Debug($"0411,当前单据号:{res.voucherCode},材料出库单:{outCode},审核材料出库单完成,操作结果:成功!------[{outId}]------[{errorMsg}]------[{domMsg.xml}]");
}
else
{
rst.Close();
}
}
//try
//{
// var strSql = $"UPDATE {vouchers.cBTTblName} SET cHandler = '{dictionary["cmaker"]}' WHERE {vouchers.voucherIdFieldName}={vouchId}";
@@ -480,6 +547,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
rst.MoveFirst();
object curId = rst.Fields["ID"].Value;
rst.Close();
var verifyResult = await Verify(co, conn, sVouchType, cCode, curId, bCheck, bBeforCheckStock, bList);
resList.Add(verifyResult);
@@ -557,6 +626,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
rst.MoveFirst();
var cCode = $"{rst.Fields["cCode"].Value}";
rst.Close();
var verifyResult = await Verify(co, conn, sVouchType, cCode, vouchId, bCheck, bBeforCheckStock, bList);
resList.Add(verifyResult);
@@ -965,6 +1036,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
rst.MoveFirst();
object curId = rst.Fields["ID"].Value;
rst.Close();
var verifyResult = await UnVerify(co, conn, sVouchType, cCode, curId, bCheck, bBeforCheckStock, bList);
return verifyResult;
@@ -1033,6 +1106,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
rst.MoveFirst();
var cCode = $"{rst.Fields["cCode"].Value}";
rst.Close();
var verifyResult = await UnVerify(co, conn, sVouchType, cCode, vouchId, bCheck, bBeforCheckStock, bList);
return verifyResult;
@@ -1165,6 +1240,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
rst.MoveFirst();
object curId = rst.Fields["ID"].Value;
rst.Close();
var verifyResult = await Delete(co, conn, sVouchType, cCode, curId, bCheck, bBeforCheckStock, bList);
resList.Add(verifyResult);
@@ -1242,6 +1319,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
rst.MoveFirst();
var cCode = $"{rst.Fields["cCode"].Value}";
rst.Close();
var verifyResult = await Delete(co, conn, sVouchType, cCode, vouchId, bCheck, bBeforCheckStock, bList);
resList.Add(verifyResult);
@@ -1312,6 +1391,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
rst.MoveFirst();
object curId = rst.Fields["ID"].Value;
rst.Close();
var verifyResult = await Delete(co, conn, sVouchType, cCode, curId, bCheck, bBeforCheckStock, bList);
return verifyResult;
@@ -1,6 +1,7 @@
using System;
using ADODB;
using ADODB;
using log4net;
using System;
using System.Web.UI.WebControls;
using UFIDA.U8.Framework.Api.ControlObject.Entity;
using UFSoft.U8.Framework.BizBase;
using UFSoft.U8.Framework.ContextSrv;
@@ -81,32 +82,20 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
/// </summary>
public IContextContainer callar { get; set; }
/// <summary>
/// 登录参数
/// </summary>
public LoginParamter paramters { get; set; }
/// <summary>
/// 初始化生产制造上下文
/// </summary>
/// <param name="paramter">登录参数</param>
/// <param name="bMon"></param>
/// <param name="traceTimes"></param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="Exception"></exception>
public void Init(LoginParamter paramter, bool bMon = true, int traceTimes = 0)
public void Init(LoginParamter paramter, bool bMon = true)
{
var lastError = "";
if (traceTimes > 5)
{
if (string.IsNullOrWhiteSpace(lastError))
{
throw new Exception("U8登录异常");
}
else
{
throw new Exception(lastError);
}
}
try
{
//if (!string.IsNullOrWhiteSpace(ThreadContext.ServerToken))
@@ -121,6 +110,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
if (paramter == null) throw new ArgumentNullException(nameof(paramter));
paramters = paramter;
if (!string.IsNullOrWhiteSpace(Cryptography.m_userToken))
{
Cryptography.m_userToken = "";
@@ -391,14 +382,138 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
}
catch (Exception ex)
{
_logInfo.Error($"重试次数:{traceTimes},错误信息:{ex.Message}", ex);
lastError = ex.Message;
_logInfo.Error($"U8登录失败,错误信息:{ex.Message}", ex);
throw;
//Init(paramter, bMon, traceTimes + 1);
}
}
/// <summary>
/// 初始化生产制造上下文
/// </summary>
/// <param name="userToken">令牌</param>
/// <param name="bMon"></param>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="Exception"></exception>
public void Init(UserTokenInfo userToken, bool bMon = true)
{
try
{
if (userToken == null) throw new ArgumentNullException(nameof(userToken));
if (!string.IsNullOrWhiteSpace(Cryptography.m_userToken))
{
Cryptography.m_userToken = "";
}
userToken.loginParamter.pDate = $"{DateTime.Today:yyyy-MM-dd}";
userToken.loginParamter.pYearId = $"{DateTime.Today.Year}";
paramters = userToken.loginParamter;
_vbLogin = new VBLogin();
_vbLogin.ClearError();
_logInfo.Debug($"VB--开始进行U8登录:{userToken.userToken}");
if (!_vbLogin.ConstructLogin(userToken.userToken))
{
_logInfo.Debug($"VB--U8登录失败,错误信息:{_vbLogin.ShareString}");
_logInfo.Debug($"VB--开始重新进行U8登录:{userToken.loginParamter.cSrv}--{userToken.loginParamter.pUserId}--{userToken.loginParamter.pAccId}");
_vbLogin=new VBLogin();
_vbLogin.ClearError();
if (!_vbLogin.Login(userToken.loginParamter.pSubId, userToken.loginParamter.pAccId, userToken.loginParamter.pYearId, userToken.loginParamter.pUserId, userToken.loginParamter.pPassword, userToken.loginParamter.pDate, userToken.loginParamter.cSrv, userToken.loginParamter.cSerial) && string.IsNullOrWhiteSpace(_vbLogin.userToken))
{
throw new Exception($"U8登录失败---{_vbLogin.ShareString}");
}
}
_logInfo.Debug($"VB--开始创建连接对象:{_vbLogin.userToken}");
Connection = new Connection();
Connection.Open(_vbLogin.UfDbName);
_logInfo.Debug("VB--完成登录进程");
if (bMon)
{
_logInfo.Debug($"NET--开始进行U8登录:{_vbLogin.userToken}");
_netLogin = new NetLogin();
_productContext = _netLogin.Login("DP", _vbLogin.userToken);
if (_productContext == null)
{
_logInfo.Debug($"Net--U8上下文构建失败---{_netLogin.ErrDescript}");
if (!_netLogin.login(userToken.loginParamter.pSubId, userToken.loginParamter.pUserId, userToken.loginParamter.pPassword, userToken.loginParamter.cSrv, userToken.loginParamter.pDate, userToken.loginParamter.pAccId, userToken.loginParamter.cSerial) && string.IsNullOrWhiteSpace(_netLogin.userToken))
{
#if DEBUG
_logInfo.Debug($"Net--使用用户登录--U8上下文构建失败---{_netLogin.ErrDescript}");
#else
throw new Exception($"Net--U8登录失败---{_netLogin.ErrDescript}");
#endif
}
_logInfo.Debug($"Net--开始进行上下文构建:{_netLogin.userToken}");
_productContext = _netLogin.SubLogin("DP") ?? _netLogin.Login("DP", _vbLogin.userToken);
}
if (_productContext == null)
{
_logInfo.Debug($"Net--构建上下文--U8上下文构建失败---{_netLogin.ErrDescript}");
}
#region U8 18.0时需要取消注释
_logInfo.Debug($"U8M--正在创建应用池:{_netLogin.userToken}");
var info = U8LoginInfo.CreateInstance(_netLogin.userToken);
U8LoginInfoPool.Add(_netLogin.userToken, info);
_logInfo.Debug($"U8M--创建应用池:{info.U8LoginToken}");
_logInfo.Debug($"U8M--正在设置线程登录信息:{_netLogin.userToken}");
ThreadContext.SetLoginInfo(_netLogin.userToken);
_logInfo.Debug($"U8M--设置线程登录信息:{_netLogin.userToken}");
#endregion
#region U8 18.0时需要注释
//_logInfo.Debug($"Net--开始进行上下文刷新:{_productContext.calledContext.token}");
//ClientUserContext.Instance.RefreshContext();
#endregion
_logInfo.Debug("Net--完成生产制造登录进程");
_logInfo.Debug("Net--构建制造上下文");
callar = new DefaultContextContainer();
_logInfo.Debug("Net--构建制造上下文成功");
}
}
catch (Exception ex)
{
_logInfo.Error($"U8登录失败,错误信息:{ex.Message}", ex);
throw;
//Init(paramter, bMon, traceTimes + 1);
}
}
/// <summary>
/// 初始化登录信息
/// </summary>
@@ -757,9 +872,26 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
/// </summary>
public void ShutDown()
{
U8LoginInfoPool.Remove(_netLogin.userToken);
try
{
Connection.Close();
}
catch
{
}
Connection = null;
try
{
U8LoginInfoPool.Remove(_netLogin.userToken);
}
catch
{
}
ThreadContext.ServerToken = null;
_vbLogin?.ShutDown();
@@ -786,6 +918,27 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
return _vbLogin.get_cAcc_Id() == cAccId;
}
public void ReSetConnection()
{
if (this.Connection != null)
{
try
{
Connection.Close();
}
catch
{
}
Connection = null;
}
Connection=new Connection();
Connection.Open(_vbLogin.UfDbName);
}
/// <summary>
/// 清理登录上下文
/// </summary>
@@ -798,5 +951,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
_netLogin?.ShutDown();
_netLogin = null;
}
}
}
@@ -9,8 +9,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
{
public interface IBaseBF
{
BaseResult<string> Save(BaseLogin baseLogin,string cCardNum, Dictionary<string, object> input);
BaseResult<string> Save(BaseLogin baseLogin,string cCardNum, Dictionary<string, object> input, bool bVerify = false);
BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, List<Dictionary<string, object>> inputs);
BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, List<Dictionary<string, object>> inputs, bool bVerify = false);
}
}
@@ -0,0 +1,436 @@
using log4net;
using System;
using System.Collections.Generic;
using System.Reflection;
using UFIDA.U8.Framework.Api.ControlObject.Common;
using UFIDA.U8.Framework.Api.ControlObject.Entity;
using UFIDA.U8.Framework.Api.ControlObject.Json;
using UFSoft.U8.Framework.BizBase;
using UFSoft.U8.Framework.ContextSrv;
using UFSoft.U8.U8M.BFDispatcher;
using UFSoft.U8.U8M.Common;
using UFSoft.U8.U8M.DOSchema.MO;
using UFSoft.U8.U8M.Exceptions;
namespace UFIDA.U8.Framework.Api.ControlObject.U8M.MO
{
/// <summary>
/// 补料申请单(MO39)
/// </summary>
public class ReplenishApply
{
//日志组件
private readonly ILog _logInfo = LogManager.GetLogger("logInfo");
/// <summary>
/// 获取空数据源
/// </summary>
/// <param name="callar"></param>
/// <param name="cCardNum"></param>
/// <returns></returns>
private ReplenishApplyDs GetEmptyDs(IContextContainer callar, string cCardNum)
{
try
{
_logInfo.Debug($"获取空数据集-----{cCardNum}");
var ds = MOMExecutor.BFReplenishApply_LoadData("LoadFirst", 0, "", callar);
if (ds == null)
return new ReplenishApplyDs();
#region 清除数据集里的数据
_logInfo.Debug("清空数据集-----mom_replenishapplydtl_ExtraDefine");
if (ds.Tables.Contains("mom_replenishapplydtl_ExtraDefine"))
{
ds.Tables["mom_replenishapplydtl_ExtraDefine"].Clear();
}
_logInfo.Debug("清空数据集-----mom_replenishapply_ExtraDefine");
if (ds.Tables.Contains("mom_replenishapply_ExtraDefine"))
{
ds.Tables["mom_replenishapply_ExtraDefine"].Clear();
}
_logInfo.Debug("清空数据集-----ReplenishApplyDTL,ReplenishApply");
ds.ReplenishApplyDTL.Clear();
ds.ReplenishApply.Clear();
#endregion
return ds;
}
catch
{
throw;
}
}
/// <summary>
/// 填充DataSet数据
/// </summary>
/// <param name="callar"></param>
/// <param name="cCardNum"></param>
/// <param name="docNoParam"></param>
/// <param name="input"></param>
/// <returns></returns>
private ReplenishApplyDs GetVoucherDs(IContextContainer callar, string cCardNum, AutoDocNoGenerateParam docNoParam, Dictionary<string, object> input)
{
_logInfo.Debug("获取空数据集");
var ds = GetEmptyDs(callar, cCardNum);
var head = ds.ReplenishApply.NewReplenishApplyRow();
ds.ReplenishApply.AddReplenishApplyRow(head);
//_logInfo.Debug($"获取单号规则-----{cCardNum}-----{docNoParam.Paramaters.ToJson()}");
//var hsTable = U8MCommonExecutor.BFVoucher_GetVoucherIDFormula(cCardNum, callar);
//_logInfo.Debug($"获取单号-----{cCardNum}-----{hsTable.ToJson()}");
//var docNo = U8MCommonExecutor.BFVoucher_GetVoucherID(cCardNum, hsTable, false, callar);
var docNo = "";
_logInfo.Debug("BE处理中");
var be = new UFSoft.U8.MO.BE.ReplenishApply(ds);
be.DocCode = "";
_logInfo.Debug("填充表头参数");
var beHead = new BEHelper(be);
beHead.SetValue(input);
if (string.IsNullOrWhiteSpace(be.DocCode))
{
_logInfo.Debug($"设置单号:{docNo}");
be.DocCode = docNo;
}
var bodys = input["body"] as List<Dictionary<string, object>> ?? $"{input["body"]}".ToObject<List<Dictionary<string, object>>>();
_logInfo.Debug("填充表体参数");
for (var i = 0; i < bodys.Count; i++)
{
var body = bodys[i];
var detail = be.ReplenishApplyDTLs[i];
var beBody = new BEHelper(detail, "MO39");
beBody.SetValue(body);
beBody.SetPartId();
}
_logInfo.Debug($"获取数据集:{be.DataObject.ToJson()}");
ds = (ReplenishApplyDs)be.DataObject;
return ds;
}
public BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, Dictionary<string, object> input, bool bVerify = false)
{
try
{
var callar = new DefaultContextContainer();
var docNoParam = new AutoDocNoGenerateParam(EnumAutoDocNoType.HandAuto, cCardNum, false)
{
IsCurrentDocNoByHand = false
};
var ds = GetVoucherDs(callar, cCardNum, docNoParam, input);
if (ds == null)
{
throw new Exception("未能构建数据集");
}
_logInfo.Debug($"单据编码:{cCardNum},开始保存");
var id = MOMExecutor.BFReplenishApply_Save(ds, docNoParam, callar);
if (id > 0)
{
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById", id, "", callar);
if (bVerify)
{
try
{
MOMExecutor.BFReplenishApply_ChangeStatus(id, 1, resDs.ReplenishApply[0].Ufts, callar);
}
catch (Exception ex)
{
throw new Exception($"审核时发生异常:{ex.Message}");
}
}
_logInfo.Debug($"单据编码:{cCardNum},保存完成,id:{id},单号:{resDs.ReplenishApply[0].DocCode}");
return new BaseResult<string> { bSuccess = true, message = "保存成功", result = $"{id}", voucherCode = resDs.ReplenishApply[0].DocCode, voucherId = $"{id}" };
}
throw new Exception("保存失败,U8未能返回制单结果");
}
catch (U8MReferenceBENotExistException ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
}
catch (TargetInvocationException ex)
{
if (ex.InnerException is U8MReferenceBENotExistException)
{
_logInfo.Error(ex.InnerException.Message, ex.InnerException);
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.InnerException.Message };
}
else
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
}
}
catch (Exception ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
}
}
public BaseResult<string> Verify(BaseLogin baseLogin, int voucherId)
{
try
{
if (voucherId <= 0)
throw new Exception("没有需要审核的数据");
var callar = new DefaultContextContainer();
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById", voucherId, "", callar);
MOMExecutor.BFReplenishApply_ChangeStatus(voucherId, 1, resDs.ReplenishApply[0].Ufts, callar);
return new BaseResult<string> { bSuccess = true, message = "审核成功", result = $"{voucherId}" };
}
catch (U8MReferenceBENotExistException ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "审核失败", result = ex.Message };
}
catch (Exception ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "审核失败", result = ex.Message };
}
}
public BaseResult<string> Verify(BaseLogin baseLogin, string voucherCode)
{
try
{
if (string.IsNullOrWhiteSpace(voucherCode))
throw new Exception("没有需要审核的数据");
var callar = new DefaultContextContainer();
var voucherId = MOMExecutor.BFReplenishApply_GetIdByCode(voucherCode, callar);
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById", voucherId, "", callar);
MOMExecutor.BFReplenishApply_ChangeStatus(voucherId, 1, resDs.ReplenishApply[0].Ufts, callar);
return new BaseResult<string> { bSuccess = true, message = "审核成功", result = $"{voucherId}" };
}
catch (U8MReferenceBENotExistException ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "审核失败", result = ex.Message };
}
catch (Exception ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "审核失败", result = ex.Message };
}
}
public BaseResult<string> UnVerify(BaseLogin baseLogin, int voucherId)
{
try
{
if (voucherId <= 0)
throw new Exception("没有需要弃审的数据");
var callar = new DefaultContextContainer();
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById", voucherId, "", callar);
MOMExecutor.BFReplenishApply_ChangeStatus(voucherId, 2, resDs.ReplenishApply[0].Ufts, callar);
return new BaseResult<string> { bSuccess = true, message = "弃审成功", result = $"{voucherId}" };
}
catch (U8MReferenceBENotExistException ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "弃审失败", result = ex.Message };
}
catch (Exception ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "弃审失败", result = ex.Message };
}
}
public BaseResult<string> UnVerify(BaseLogin baseLogin, string voucherCode)
{
try
{
if (string.IsNullOrWhiteSpace(voucherCode))
throw new Exception("没有需要审核的数据");
var callar = new DefaultContextContainer();
var voucherId = MOMExecutor.BFReplenishApply_GetIdByCode(voucherCode, callar);
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById", voucherId, "", callar);
MOMExecutor.BFReplenishApply_ChangeStatus(voucherId, 2, resDs.ReplenishApply[0].Ufts, callar);
return new BaseResult<string> { bSuccess = true, message = "弃审成功", result = $"{voucherId}" };
}
catch (U8MReferenceBENotExistException ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "弃审失败", result = ex.Message };
}
catch (Exception ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "弃审失败", result = ex.Message };
}
}
public BaseResult<string> Delete(BaseLogin baseLogin, string cCardNum, long voucherId)
{
try
{
if (voucherId <= 0)
throw new Exception("没有需要删除的数据");
var callar = new DefaultContextContainer();
var docNoParam = new AutoDocNoGenerateParam(EnumAutoDocNoType.HandAuto, cCardNum, false)
{
IsCurrentDocNoByHand = false
};
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById",(int)voucherId, "", callar);
if(resDs == null)
throw new Exception($"未查询到单据ID为{voucherId}的单据");
if(resDs.ReplenishApplyDTL!=null && resDs.ReplenishApplyDTL.Count > 0)
{
for(var i= resDs.ReplenishApplyDTL.Count - 1; i >= 0; i--)
{
resDs.ReplenishApplyDTL.Rows[i].Delete();
}
}
resDs.ReplenishApply[0].Delete();
MOMExecutor.BFReplenishApply_Save(resDs, docNoParam, callar);
return new BaseResult<string> { bSuccess = true, message = "删除成功", result = $"{voucherId}" };
}
catch (U8MReferenceBENotExistException ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "删除失败", result = ex.Message };
}
catch (Exception ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "删除失败", result = ex.Message };
}
}
public BaseResult<string> Delete(BaseLogin baseLogin, string cCardNum, string voucherCode)
{
try
{
if (string.IsNullOrWhiteSpace(voucherCode))
throw new Exception("没有需要删除的数据");
var callar = new DefaultContextContainer();
var docNoParam = new AutoDocNoGenerateParam(EnumAutoDocNoType.HandAuto, cCardNum, false)
{
IsCurrentDocNoByHand = false
};
var voucherId= MOMExecutor.BFReplenishApply_GetIdByCode(voucherCode, callar);
var resDs = MOMExecutor.BFReplenishApply_LoadData("LoadById", voucherId, "", callar);
if (resDs == null)
throw new Exception($"未查询到单据ID为{voucherId}的单据");
if (resDs.ReplenishApplyDTL != null && resDs.ReplenishApplyDTL.Count > 0)
{
for (var i = resDs.ReplenishApplyDTL.Count - 1; i >= 0; i--)
{
resDs.ReplenishApplyDTL.Rows[i].Delete();
}
}
resDs.ReplenishApply[0].Delete();
MOMExecutor.BFReplenishApply_Save(resDs, docNoParam, callar);
return new BaseResult<string> { bSuccess = true, message = "删除成功", result = $"{voucherId}" };
}
catch (U8MReferenceBENotExistException ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "删除失败", result = ex.Message };
}
catch (Exception ex)
{
_logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = false, message = "删除失败", result = ex.Message };
}
}
}
}
@@ -146,7 +146,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, Dictionary<string, object> input)
public BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, Dictionary<string, object> input, bool bVerify = false)
{
try
{
@@ -213,7 +213,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
/// <param name="cCardNum"></param>
/// <param name="inputs"></param>
/// <returns></returns>
public BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, List<Dictionary<string, object>> inputs)
public BaseResult<string> Save(BaseLogin baseLogin, string cCardNum, List<Dictionary<string, object>> inputs, bool bVerify = false)
{
var idList = new List<int>();
@@ -107,9 +107,11 @@
</Reference>
<Reference Include="UFIDA.U8.Portal.MTC.Design">
<HintPath>D:\U8SOFT\Portal\UFIDA.U8.Portal.MTC.Design.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UFSoft.U8.BO.BE">
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.BO.BE.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UFSoft.U8.Framework.BE">
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.Framework.BE.dll</HintPath>
@@ -161,6 +163,10 @@
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.U8M.BE.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UFSoft.U8.U8M.BF">
<HintPath>..\..\..\U8SOFT\U8M\UFSoft.U8.U8M.BF.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UFSoft.U8.U8M.BFDispatcher">
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.U8M.BFDispatcher.dll</HintPath>
<Private>False</Private>
@@ -191,6 +197,9 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AA\IClsCommon.cs" />
<Compile Include="AA\U8PzInsert\IFitem.cs" />
<Compile Include="AP\clsApplyPayCO.cs" />
<Compile Include="AP\clsCloseBil.cs" />
<Compile Include="AP\clsVouchFacade.cs" />
<Compile Include="AP\Entity\VoucherData.cs" />
@@ -202,6 +211,7 @@
<Compile Include="Common\CommonHelper.cs" />
<Compile Include="Entity\AuditBizEvents.cs" />
<Compile Include="Entity\Exch.cs" />
<Compile Include="Entity\UserTokenInfo.cs" />
<Compile Include="Entity\VouchersInfo.cs" />
<Compile Include="Json\JsonHelper.cs" />
<Compile Include="Entity\BaseResult.cs" />
@@ -219,12 +229,11 @@
<Compile Include="U8M\IBaseBF.cs" />
<Compile Include="U8M\MOrder.cs" />
<Compile Include="U8M\MoRoutingBill.cs" />
<Compile Include="U8M\MO\ReplenishApply.cs" />
<Compile Include="U8M\StandardBom.cs" />
<Compile Include="Workflow\ServiceProxy.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="AA\" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />