采购接口功能全部完成
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.AP.Entity
|
||||
{
|
||||
public class VoucherData
|
||||
{
|
||||
public long Auto_ID { get; set; }
|
||||
public bool bMidifyMainItem { get; set; }
|
||||
public bool bSecurityDeposit { get; set; }
|
||||
public string CBill { get; set; }
|
||||
public string cCancelNo { get; set; }
|
||||
public string cCancelNo_R { get; set; }
|
||||
public string cChanger { get; set; }
|
||||
public string cChangerName { get; set; }
|
||||
public object cDefine1 { get; set; }
|
||||
public object cDefine2 { get; set; }
|
||||
public object cDefine3 { get; set; }
|
||||
public object cDefine4 { get; set; }
|
||||
public object cDefine5 { get; set; }
|
||||
public object cDefine6 { get; set; }
|
||||
public object cDefine7 { get; set; }
|
||||
public object cDefine8 { get; set; }
|
||||
public object cDefine9 { get; set; }
|
||||
public object cDefine10 { get; set; }
|
||||
public object cDefine11 { get; set; }
|
||||
public object cDefine12 { get; set; }
|
||||
public object cDefine13 { get; set; }
|
||||
public object cDefine14 { get; set; }
|
||||
public object cDefine15 { get; set; }
|
||||
public object cDefine16 { get; set; }
|
||||
public string cDeptCode { get; set; }
|
||||
public string cDigest { get; set; }
|
||||
public string cDwCode { get; set; }
|
||||
public string cDwName { get; set; }
|
||||
public string cEndorser { get; set; }
|
||||
public string cEndorserName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
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.AP
|
||||
{
|
||||
public class NoteManageAP
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存票据
|
||||
/// </summary>
|
||||
/// <param name="login"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="bNeedBillClosed"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseResult<string>> NoteSave(BaseLogin login,Dictionary<string,object> input,bool bNeedBillClosed)
|
||||
{
|
||||
try
|
||||
{
|
||||
var clsSysInterface = $"UfHeronReport.clsSysInterface".GetComObject();
|
||||
var clsReportManager = $"UfHeronReport.clsReportManager".GetComObject();
|
||||
var voucherData = $"NoteManageAR.VoucherData".GetComObject();
|
||||
var voucher = $"NoteManageAR.Voucher".GetComObject();
|
||||
|
||||
clsSysInterface.InitInterFace("AP", objLogin: login._vbLogin);
|
||||
|
||||
voucherData = CommonHelper.ToVoucherData(input,voucherData);
|
||||
|
||||
voucher.Init(login._vbLogin, clsReportManager, clsSysInterface);
|
||||
|
||||
var res = new BaseResult<string>();
|
||||
var errMsg = "";
|
||||
|
||||
res.bSuccess = voucher.NoteSave(voucherData, ref errMsg);
|
||||
|
||||
if (!res.bSuccess)
|
||||
{
|
||||
res.message = "保存失败";
|
||||
res.result = errMsg;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
res.message = "保存成功";
|
||||
res.voucherCode = $"{voucherData.CVouchId}";
|
||||
res.voucherId = $"{voucherData.CVouchId}";
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
|
||||
return new BaseResult<string>() { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ADODB;
|
||||
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 NoteManageAR
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存票据
|
||||
/// </summary>
|
||||
/// <param name="login"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="bNeedBillClosed"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseResult<string>> NoteSave(BaseLogin login, Dictionary<string, object> input,bool bNeedBillClosed)
|
||||
{
|
||||
try
|
||||
{
|
||||
//var clsSysInterface = $"UfHeronReport.clsSysInterface".GetComObject();
|
||||
//var clsReportManager = $"UfHeronReport.clsReportManager".GetComObject();
|
||||
|
||||
//var clsCloseBil = $"UFAPBO.clsCloseBil".GetComObject();
|
||||
var clsApNote = $"UFAPBO.clsApNote".GetComObject();
|
||||
var voucherData = $"NoteManageAR.VoucherData".GetComObject();
|
||||
var voucher = $"NoteManageAR.Voucher".GetComObject();
|
||||
var clsPub = $"NoteManageAR.clsPub".GetComObject();
|
||||
//var rpPub = $"UFRPPub.clsPub".GetComObject();
|
||||
|
||||
//clsSysInterface.InitInterFace("AP", adoConn:login.Connection, objLogin: login._vbLogin);
|
||||
|
||||
//var clsReportManager = clsSysInterface.GetReportEngine();
|
||||
|
||||
clsPub.main(login._vbLogin);
|
||||
|
||||
clsPub.bNeedZD = true;
|
||||
|
||||
voucherData = CommonHelper.ToVoucherData(input, voucherData);
|
||||
|
||||
voucherData.FillData(ref voucherData, ref clsPub, true);
|
||||
|
||||
//rpPub.oLogin = login._vbLogin;
|
||||
//rpPub.DBConn = login.Connection;
|
||||
|
||||
//rpPub.InitPubs(login._vbLogin.DataSource, login._vbLogin.get_cAcc_Id(), login._vbLogin.cIYear, $"{login._vbLogin.CurDate:yyyy-MM-dd}");
|
||||
|
||||
|
||||
|
||||
voucher.Init(login._vbLogin,clsPub.RepManager,clsPub.RepSys);
|
||||
|
||||
string pSubId = "AR";
|
||||
object ssDate =$"{login._vbLogin.CurDate:yyyy-MM-dd}" ;
|
||||
|
||||
login._vbLogin.LoginEx(pSubId, ssDate);
|
||||
|
||||
clsApNote.Init(login._vbLogin, clsPub.Conn);
|
||||
|
||||
var res = new BaseResult<string>();
|
||||
var errMsg = "";
|
||||
|
||||
voucher.bNeedBillClosed = bNeedBillClosed;
|
||||
|
||||
Trace.WriteLine($"{clsPub.bNeedZD}");
|
||||
Trace.WriteLine($"{clsPub.cNoteCancelNo}");
|
||||
Trace.WriteLine($"{Microsoft.VisualBasic.Information.TypeName(clsPub.objARAPProxy)}");
|
||||
//voucher.m_bStartFlag = false;
|
||||
//voucher.OneVoucherData = voucherData;
|
||||
//voucher.objPub = clsPub;
|
||||
|
||||
clsPub.Conn.BeginTrans();
|
||||
|
||||
res.bSuccess = voucher.NoteCheck(voucherData, ref errMsg);
|
||||
//res.bSuccess = voucher.VoucherHeadCheck(voucherData,true, ref errMsg);
|
||||
|
||||
if (!res.bSuccess)
|
||||
{
|
||||
clsPub.Conn.RollbackTrans();
|
||||
//login.Connection.RollbackTrans();
|
||||
res.message = "保存失败";
|
||||
res.result = errMsg;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
res.bSuccess = voucher.NoteSave(ref voucherData, ref errMsg);
|
||||
|
||||
if (!res.bSuccess)
|
||||
{
|
||||
clsPub.Conn.RollbackTrans();
|
||||
//login.Connection.RollbackTrans();
|
||||
res.message = "保存失败";
|
||||
res.result = errMsg;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
var clsVouchFacade = new clsVouchFacade();
|
||||
|
||||
var newInput = new Dictionary<string, object>()
|
||||
{
|
||||
{ "dVouchDate", $"{login._vbLogin.CurDate:yyyy-MM-dd}" },
|
||||
{ "cSSName", voucherData.cVouchTypeName },
|
||||
{ "cexch_name", voucherData.cExch_Name },
|
||||
{ "iAmount_f", voucherData.iAmount },
|
||||
{ "iAmount", voucherData.iAmount_Local },
|
||||
{ "cBank", voucherData.cPayBillBank },
|
||||
{ "cBankAccount", voucherData.cPayBillAccount },
|
||||
{ "cNoteNo", voucherData.CVouchId },
|
||||
{ "cDepCode", voucherData.cDeptCode },
|
||||
{ "cDwCode", voucherData.cDwCode },
|
||||
{ "cOperator", voucherData.CBill },
|
||||
{ "cDigest", voucherData.cDigest },
|
||||
{ "bStartFlag", voucher.m_bStartFlag },
|
||||
{ "cVouchType", "48" },
|
||||
{ "cCoVouchType", voucherData.cVouchType },
|
||||
{ "cCoVouchID", voucherData.CVouchId },
|
||||
{ "cFlag", voucherData.cFlag },
|
||||
{ "cSSCode", voucherData.cSettleCode },
|
||||
{ "cPerson", voucherData.cPerson },
|
||||
{ "cNatBank", voucherData.cReceiveBank },
|
||||
{ "cNatBankAccount", voucherData.cReceiveAccount },
|
||||
{ "cCode", voucher.getNoteKm(voucherData.cVouchType) }
|
||||
};
|
||||
|
||||
var bodys = new List<Dictionary<string, object>>();
|
||||
|
||||
var body = new Dictionary<string, object>()
|
||||
{
|
||||
{"editprop","A"},
|
||||
{"cMemo",voucherData.cDigest},
|
||||
{"cCusVen",voucherData.cDwCode},
|
||||
{"iAmt_f",voucherData.iAmount},
|
||||
{"iAmt",voucherData.iAmount_Local},
|
||||
{"cKm",voucher.getNoteKm(voucherData.cVouchType)},
|
||||
{"iRAmt_f",voucherData.iAmount},
|
||||
{"iRAmt",voucherData.iAmount_Local},
|
||||
{"cDepCode",voucherData.cDeptCode},
|
||||
{"cPersonCode",voucherData.cPerson},
|
||||
};
|
||||
|
||||
newInput["body"] = bodys;
|
||||
|
||||
bodys.Add(body);
|
||||
|
||||
var res2=await clsVouchFacade.SaveVouch(login, newInput, "收款单", true, "cVouchID");
|
||||
|
||||
|
||||
|
||||
//var condition = $"<condition cProcStyle=\"48\" cLink=\"{voucherData.cLink}\" cVouchType=\"{voucherData.cVouchType}\" cVouchID=\"{voucherData.CVouchId}\" bFirst=\"False\"/>";
|
||||
|
||||
//res.bSuccess = clsApNote.Sign(condition, ref errMsg);
|
||||
////res.bSuccess = pz_Proc.AP_ZD_One("48", "", $"{voucherData.CVouchId}");
|
||||
////login.Connection.BeginTrans();
|
||||
|
||||
////res.bSuccess = voucher.VoucherHeadSave(voucherData, true, ref errMsg);
|
||||
//Trace.WriteLine($"{voucher.m_strVoucherDirect}");
|
||||
//Trace.WriteLine($"{voucherData.cProcStyle}");
|
||||
|
||||
if (!res2.bSuccess)
|
||||
{
|
||||
clsPub.Conn.RollbackTrans();
|
||||
//login.Connection.RollbackTrans();
|
||||
res.message = "保存失败";
|
||||
res.result = res2.message;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
clsPub.Conn.CommitTrans();
|
||||
//login.Connection.CommitTrans();
|
||||
res.message = "保存成功";
|
||||
res.voucherCode = $"{voucherData.CVouchId}";
|
||||
res.voucherId = $"{voucherData.CVouchId}";
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
|
||||
return new BaseResult<string>() { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using MSXML2;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Common;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||
using System.Collections;
|
||||
|
||||
// ReSharper disable IdentifierTypo
|
||||
// ReSharper disable InconsistentNaming
|
||||
@@ -27,7 +28,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.AP
|
||||
/// <param name="bFirst">是否期初</param>
|
||||
/// <param name="bodyKey">表体数据字段</param>
|
||||
/// <returns></returns>
|
||||
public BaseResult<dynamic> CloseBillSave(BaseLogin baseLogin,Dictionary<string,object> dictionary,string cSubId,bool isAdd=true, bool bFirst=false,string bodyKey="body")
|
||||
public BaseResult<string> CloseBillSave(BaseLogin baseLogin,Dictionary<string,object> dictionary,string cSubId,bool isAdd=true, bool bFirst=false,string bodyKey="body")
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -66,13 +67,13 @@ namespace UFIDA.U8.Framework.Api.ControlObject.AP
|
||||
if (!saveFlag)
|
||||
throw new Exception(errorMessage);
|
||||
|
||||
return new BaseResult<dynamic> { bSuccess = true, message = "保存成功", result = "保存成功" };
|
||||
return new BaseResult<string> { bSuccess = true, message = "保存成功", result = "保存成功" };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<dynamic> { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +141,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.AP
|
||||
/// <param name="isAdd">是否新增</param>
|
||||
/// <param name="bFirst"></param>
|
||||
/// <returns></returns>
|
||||
public BaseResult<dynamic> ApNoteSave(BaseLogin baseLogin, Dictionary<string, object> dictionary, string cSubId, bool isAdd = true, bool bFirst = false)
|
||||
public BaseResult<dynamic> ApNote_SaveVouch(BaseLogin baseLogin, Dictionary<string, object> dictionary, string cSubId, bool isAdd = true, bool bFirst = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -148,103 +149,6 @@ namespace UFIDA.U8.Framework.Api.ControlObject.AP
|
||||
|
||||
var domHead = dictionary.ToDocument2();
|
||||
|
||||
#region 弃用
|
||||
|
||||
|
||||
|
||||
|
||||
//if (cSubId == "AR")
|
||||
//{
|
||||
// //var pub = "NoteManageAR.clsPub".GetComObject();
|
||||
|
||||
// //pub.main(m_Login);
|
||||
|
||||
// //var ar = "NoteManageAR.Voucher".GetComObject();
|
||||
|
||||
// //ar.Init(m_Login, pub.RepSys, pub.RepManager);
|
||||
|
||||
// //var da = new VoucherDataClass();
|
||||
|
||||
// //var apar = new APARHelper(da);
|
||||
|
||||
|
||||
|
||||
// //ar.m_bStartFlag = false;
|
||||
// //ar.bLastYearBill = false;
|
||||
// //ar.m_strCardNum = "RP02";
|
||||
// //ar.m_strVoucherType = "50";
|
||||
// //ar.m_strVoucherDirect = pub.strNoteDirect;
|
||||
|
||||
|
||||
// ////ar.bUpdateiAmount = true;
|
||||
// ////ar.NotExec = true;
|
||||
// ////ar.NotExec = true;
|
||||
// //ar.objPub = pub;
|
||||
|
||||
|
||||
|
||||
// //apar.SetValue(dictionary);
|
||||
|
||||
// //ar.m_strVoucherID = da.CVouchId;
|
||||
// //ar.m_VoucherHead = domHead;
|
||||
// //ar.OneVoucherData = da;
|
||||
|
||||
// //ar.bNeedBillClosed = true;
|
||||
|
||||
// //da.cVouchTypeName = "银行承兑汇票";
|
||||
// //da.cPayBillBank = "华夏银行股份有限公司深圳分行营业部";
|
||||
|
||||
// var msg = "";
|
||||
|
||||
// //logInfo.Debug($"da:{da.ToJson()}");
|
||||
|
||||
// //if (!ar.VoucherHeadCheck(da, true, ref msg))
|
||||
// //{
|
||||
// // throw new Exception(msg);
|
||||
// //}
|
||||
|
||||
// //msg = "";
|
||||
|
||||
// //if (!ar.NoteCheck(da, ref msg))
|
||||
// //{
|
||||
// // throw new Exception(msg);
|
||||
// //}
|
||||
// //msg = "";
|
||||
|
||||
// //if (!ar.NoteSave(da, ref msg))
|
||||
// //{
|
||||
// // throw new Exception(msg);
|
||||
// //}
|
||||
|
||||
// ////ar.re
|
||||
|
||||
|
||||
// ////var bo = "UFAPBO.clsApNote".GetComObject();
|
||||
// //var apPub = "NoteManageAR.PZ_Proc".GetComObject();
|
||||
|
||||
// //apPub.objPub = pub;
|
||||
|
||||
// //var aa=apPub.ProcSign("9A");
|
||||
|
||||
// //var bb = pub.cNoteCancelNo;
|
||||
|
||||
// //var m_conn = new Connection();
|
||||
|
||||
// //m_conn.Open(m_Login.UfDbName);
|
||||
|
||||
// //bo.Init(m_Login, m_conn);
|
||||
|
||||
// //var errorMessage = "";
|
||||
|
||||
// //var saveFlag = bo.Sign($"<condition type=\"1\" cLink=\"AR{da.CVouchId}\" cVouchType=\"{da.cVouchType}\" cVouchID=\"{da.CVouchId}\" />", ref errorMessage);
|
||||
|
||||
// //if (!saveFlag)
|
||||
// // throw new Exception(errorMessage);
|
||||
|
||||
// return new BaseResult<dynamic> { bSuccess = true, message = "保存成功", result = "保存成功" };
|
||||
//}
|
||||
#endregion
|
||||
|
||||
var ap = "UFAPBO.clsAccount_AP".GetComObject();
|
||||
|
||||
var bo = "UFAPBO.clsApNote".GetComObject();
|
||||
@@ -289,24 +193,93 @@ namespace UFIDA.U8.Framework.Api.ControlObject.AP
|
||||
boResult = bo.Init(m_Login, m_conn);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//logInfo.Debug($"ap.Init:{a}");
|
||||
|
||||
//var b=ap.InitSubOption2(cSubId);
|
||||
//logInfo.Debug($"ap.InitSubOption2:{b}");
|
||||
//var c=ap.ARAPStart(cSubId);
|
||||
//logInfo.Debug($"ap.ARAPStart:{c}");
|
||||
|
||||
|
||||
|
||||
//var d=bo.Init(m_Login);
|
||||
|
||||
//logInfo.Debug($"bo.Init:{d}");
|
||||
|
||||
var errorMessage = "";
|
||||
|
||||
var saveFlag = bo.SaveVouch(domHead, ref errorMessage);
|
||||
bool saveFlag = bo.SaveVouch(domHead, ref errorMessage);
|
||||
|
||||
if (!saveFlag)
|
||||
{
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
|
||||
return new BaseResult<dynamic> { bSuccess = true, message = "保存成功", result = "保存成功" };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<dynamic> { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
public BaseResult<dynamic> ApNote_Sign(BaseLogin baseLogin, string cLink, string cSubId, bool isAdd = true, bool bFirst = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var m_Login = baseLogin._vbLogin;
|
||||
|
||||
var ap = "UFAPBO.clsAccount_AP".GetComObject();
|
||||
|
||||
var bo = "UFAPBO.clsApNote".GetComObject();
|
||||
|
||||
bool initResult = ap.Init(m_Login, cSubId);
|
||||
|
||||
if (!initResult)
|
||||
{
|
||||
logInfo.Debug($"1-----初始化参数失败,正在重新初始化");
|
||||
|
||||
initResult = ap.Init(m_Login);
|
||||
|
||||
if (!initResult)
|
||||
{
|
||||
logInfo.Debug($"2-----初始化参数失败");
|
||||
}
|
||||
}
|
||||
|
||||
var m_conn = new Connection();
|
||||
|
||||
m_conn.Open(m_Login.UfDbName);
|
||||
|
||||
|
||||
if (initResult)
|
||||
{
|
||||
bool b = ap.InitSubOption2(cSubId);
|
||||
|
||||
if (!b)
|
||||
{
|
||||
logInfo.Debug($"初始化参数2失败");
|
||||
}
|
||||
|
||||
logInfo.Debug($"调用初始化方法1");
|
||||
|
||||
bo.Init(m_Login, m_conn, ap);
|
||||
}
|
||||
else
|
||||
{
|
||||
logInfo.Debug($"调用初始化方法2");
|
||||
|
||||
bo.Init(m_Login, m_conn);
|
||||
}
|
||||
|
||||
|
||||
var xmlCondition = $"<condition type=\"1\" cLink=\"AR123414125132\" cVouchType=\"50\" cVouchID=\"{123414125132}\" bFirst=\"{bFirst}\"/>";
|
||||
var errorMessage = "";
|
||||
|
||||
bool saveFlag = bo.Sign(xmlCondition, ref errorMessage);
|
||||
|
||||
|
||||
if (!saveFlag)
|
||||
{
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
|
||||
//if (saveFlag)
|
||||
//{
|
||||
// saveFlag = bo.Sign($"<condition type=\"1\" cLink=\"AR{da.CVouchId}\" cVouchType=\"{da.cVouchType}\" cVouchID=\"{da.CVouchId}\" />", ref errorMessage);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
//logInfo.Debug($"bo.SaveVouch:{errorMessage}");
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
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.AP
|
||||
{
|
||||
public class clsCloseBil
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
using ADODB;
|
||||
using log4net;
|
||||
using MSXML2;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
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 clsVouchFacade
|
||||
{
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
public async Task<BaseResult<string>> SaveVouch(BaseLogin login, Dictionary<string, object> input,string VouchClass,bool bGetCode=false,string codeKey="",bool bPrintDom=false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var clsVouchFacade = $"UFAPBO.clsVouchFacade".GetComObject();
|
||||
|
||||
clsVouchFacade.Init(VouchClass, login._vbLogin, login.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);
|
||||
//}
|
||||
|
||||
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("无法获取表体数据");
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
logInfo.Debug($"获取新单号:{newCode}");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(newCode))
|
||||
{
|
||||
CommonHelper.SetDomKeyValue(domHead, codeKey, newCode);
|
||||
}
|
||||
|
||||
input[codeKey] = newCode;
|
||||
}
|
||||
|
||||
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>();
|
||||
|
||||
clsVouchFacade.bOutTrans = true;
|
||||
|
||||
res.bSuccess = clsVouchFacade.SaveVouch(domHead, domBody, ref errMsg);
|
||||
|
||||
if (!res.bSuccess)
|
||||
{
|
||||
throw new Exception(errMsg);
|
||||
}
|
||||
|
||||
res.message = "保存成功";
|
||||
res.voucherCode = "";
|
||||
res.voucherId = "";
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ 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;
|
||||
@@ -81,6 +82,23 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
|
||||
}
|
||||
}
|
||||
|
||||
public static dynamic SetVBPropValue(dynamic obj, string propName, object value)
|
||||
{
|
||||
NewLateBinding.LateSet(obj, null, propName, new[] { value }, null, null);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public static dynamic ToVoucherData(this Dictionary<string,object> dict,dynamic obj)
|
||||
{
|
||||
foreach (var dictKey in dict.Keys)
|
||||
{
|
||||
SetVBPropValue(obj, dictKey, dict[dictKey]);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
//public static void SetPropValue(this PropertyInfo prop, VoucherData obj, object value)
|
||||
//{
|
||||
// if (prop.PropertyType == typeof(string))
|
||||
@@ -631,5 +649,181 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单据配置信息
|
||||
/// </summary>
|
||||
/// <param name="conn">连接对象</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public static VouchersInfo GetVouchers(Connection conn,string cCardNum)
|
||||
{
|
||||
if (conn == null) throw new ArgumentNullException(nameof(conn));
|
||||
if (cCardNum == null) throw new ArgumentNullException(nameof(cCardNum));
|
||||
|
||||
var rst = new Recordset();
|
||||
|
||||
var strSql =
|
||||
$"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName,cDefWhere,cHeadBusObjectId FROM dbo.vouchers WHERE CardNumber='{cCardNum}'";
|
||||
|
||||
rst.Open(strSql, conn);
|
||||
|
||||
if (rst.EOF || rst.BOF)
|
||||
{
|
||||
throw new Exception($"未查询到单据类型编码{cCardNum}的配置信息");
|
||||
}
|
||||
|
||||
rst.MoveFirst();
|
||||
|
||||
var res = new VouchersInfo
|
||||
{
|
||||
cDefWhere = string.IsNullOrWhiteSpace($"{rst.Fields["cDefWhere"].Value}") ? "1=1" : $"{rst.Fields["cDefWhere"].Value}",
|
||||
cBTQName = $"{rst.Fields["BTQName"].Value}",
|
||||
cBTTblName = $"{rst.Fields["BTTblName"].Value}",
|
||||
cBWQName = $"{rst.Fields["BWQName"].Value}",
|
||||
cBWTblName = $"{rst.Fields["BWTblName"].Value}",
|
||||
cVchTblPrimarykeyNames = $"{rst.Fields["VchTblPrimarykeyNames"].Value}",
|
||||
cVchListQName = $"{rst.Fields["VchListQName"].Value}",
|
||||
cCardNumber = $"{rst.Fields["CardNumber"].Value}",
|
||||
cHeadBusObjectId = $"{rst.Fields["cHeadBusObjectId"].Value}",
|
||||
cReceiptNOFieldName = $"{rst.Fields["ReceiptNOFieldName"].Value}"
|
||||
};
|
||||
|
||||
var codeName = $"{rst.Fields["ReceiptNOFieldName"].Value}";
|
||||
|
||||
if (codeName.Contains("{##}"))
|
||||
{
|
||||
codeName = codeName.Split('{', '#', '#', '}')[0];
|
||||
}
|
||||
|
||||
res.cCodeFieldName = codeName;
|
||||
res.voucherIdFieldName= $"{rst.Fields["VchTblPrimarykeyNames"].Value}";
|
||||
|
||||
rst.Close();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单据编号
|
||||
/// </summary>
|
||||
/// <param name="conn">连接对象</param>
|
||||
/// <param name="voucherId">单据Id</param>
|
||||
/// <param name="vouchers">单据配置信息</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
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));
|
||||
if (vouchers == null) throw new ArgumentNullException(nameof(vouchers));
|
||||
|
||||
var tableName = vouchers.cBTTblName;
|
||||
var fieldName = vouchers.voucherIdFieldName;
|
||||
var codeName = vouchers.cCodeFieldName;
|
||||
var cDefWhere = vouchers.cDefWhere;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(cDefWhere))
|
||||
{
|
||||
cDefWhere = "1=1";
|
||||
}
|
||||
|
||||
var strSql = $"SELECT {codeName} AS cCode FROM {tableName} WHERE {cDefWhere} AND {fieldName}='{voucherId}'";
|
||||
|
||||
var rst = new Recordset();
|
||||
|
||||
rst.Open(strSql, conn);
|
||||
|
||||
if (rst.BOF || rst.EOF)
|
||||
{
|
||||
throw new Exception($"没有查询到ID为{voucherId}的单据");
|
||||
}
|
||||
|
||||
var cCode = $"{rst.Fields["cCode"].Value}";
|
||||
|
||||
return cCode;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单据编号
|
||||
/// </summary>
|
||||
/// <param name="conn">连接对象</param>
|
||||
/// <param name="cVoucherCode">单据编号</param>
|
||||
/// <param name="vouchers">单据配置信息</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public static object GetVoucherId(Connection conn, string cVoucherCode, VouchersInfo vouchers)
|
||||
{
|
||||
if (conn == null) throw new ArgumentNullException(nameof(conn));
|
||||
if (cVoucherCode == null) throw new ArgumentNullException(nameof(cVoucherCode));
|
||||
if (vouchers == null) throw new ArgumentNullException(nameof(vouchers));
|
||||
|
||||
var tableName = vouchers.cBTTblName;
|
||||
var fieldName = vouchers.voucherIdFieldName;
|
||||
var codeName = vouchers.cCodeFieldName;
|
||||
var cDefWhere = vouchers.cDefWhere;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(cDefWhere))
|
||||
{
|
||||
cDefWhere = "1=1";
|
||||
}
|
||||
|
||||
var strSql = $"SELECT {fieldName} AS ID FROM {tableName} WHERE {cDefWhere} AND {codeName}='{cVoucherCode}'";
|
||||
|
||||
logInfo.Debug($"查询ID:{strSql}");
|
||||
|
||||
var rst = new Recordset();
|
||||
|
||||
rst.Open(strSql, conn);
|
||||
|
||||
if (rst.BOF || rst.EOF)
|
||||
{
|
||||
throw new Exception($"没有查询到单据编号为{cVoucherCode}的单据");
|
||||
}
|
||||
|
||||
var voucherId = rst.Fields["ID"].Value;
|
||||
|
||||
return voucherId;
|
||||
|
||||
}
|
||||
|
||||
public static string GetVoucherWhereSqlByCode(VouchersInfo vouchers,string cVoucherCode)
|
||||
{
|
||||
var tableName = vouchers.cBTTblName;
|
||||
var fieldName = vouchers.voucherIdFieldName;
|
||||
var codeName = vouchers.cCodeFieldName;
|
||||
var cDefWhere = vouchers.cDefWhere;
|
||||
return $"{cDefWhere} AND {codeName}='{cVoucherCode}'";
|
||||
}
|
||||
|
||||
public static string GetVoucherWhereSqlById(VouchersInfo vouchers, object voucherId)
|
||||
{
|
||||
var tableName = vouchers.cBTTblName;
|
||||
var fieldName = vouchers.voucherIdFieldName;
|
||||
var codeName = vouchers.cCodeFieldName;
|
||||
var cDefWhere = vouchers.cDefWhere;
|
||||
return $"{cDefWhere} AND {fieldName}='{voucherId}'";
|
||||
}
|
||||
|
||||
|
||||
public static string GetPUVoucherWhereSqlByCode(VouchersInfo vouchers, string cVoucherCode)
|
||||
{
|
||||
var tableName = vouchers.cBTQName;
|
||||
var fieldName = vouchers.voucherIdFieldName;
|
||||
var codeName = vouchers.cCodeFieldName;
|
||||
var cDefWhere = vouchers.cDefWhere;
|
||||
return $"{cDefWhere} AND {tableName}.{codeName}='{cVoucherCode}'";
|
||||
}
|
||||
|
||||
public static string GetPUVoucherWhereSqlById(VouchersInfo vouchers, object voucherId)
|
||||
{
|
||||
var tableName = vouchers.cBTQName;
|
||||
var fieldName = vouchers.voucherIdFieldName;
|
||||
var codeName = vouchers.cCodeFieldName;
|
||||
var cDefWhere = vouchers.cDefWhere;
|
||||
return $"{cDefWhere} AND {tableName}.{fieldName}='{voucherId}'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.Entity
|
||||
{
|
||||
public class VouchersInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 单号字段
|
||||
/// </summary>
|
||||
public string cCodeFieldName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id字段
|
||||
/// </summary>
|
||||
public string voucherIdFieldName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 业务对象ID
|
||||
/// </summary>
|
||||
public string cHeadBusObjectId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单据类型编码
|
||||
/// </summary>
|
||||
public string cCardNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表头表名
|
||||
/// </summary>
|
||||
public string cBTTblName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表体表名
|
||||
/// </summary>
|
||||
public string cBWTblName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表头视图名称
|
||||
/// </summary>
|
||||
public string cBTQName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表体视图名称
|
||||
/// </summary>
|
||||
public string cBWQName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表视图名称
|
||||
/// </summary>
|
||||
public string cVchListQName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单据主键字段名
|
||||
/// </summary>
|
||||
public string cVchTblPrimarykeyNames { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单号字段名
|
||||
/// </summary>
|
||||
public string cReceiptNOFieldName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认查询条件
|
||||
/// </summary>
|
||||
public string cDefWhere { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.PU
|
||||
{
|
||||
public enum UseMode
|
||||
{
|
||||
BS = 1,
|
||||
CS=0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,894 @@
|
||||
using ADODB;
|
||||
using log4net;
|
||||
using MSXML2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using UFGeneralFilterOCX;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Common;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.ST;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.PU
|
||||
{
|
||||
/// <summary>
|
||||
/// 采购管理
|
||||
/// </summary>
|
||||
public class clsVoucherCO_PU
|
||||
{
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
private dynamic InitCo(BaseLogin login, vouchertype enmVoucherType, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
var errorMsg = "";
|
||||
|
||||
var infor = "Info_PU.ClsS_Infor".GetComObject();
|
||||
|
||||
errorMsg = infor.Init(login._vbLogin, sBusType);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(errorMsg))
|
||||
{
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var co = "VoucherCO_PU.clsVoucherCO_PU".GetComObject();
|
||||
|
||||
co.Init(enmVoucherType, login._vbLogin, login.Connection, infor, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
return co;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存单据
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="dictionary"></param>
|
||||
/// <param name="cardNumber"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="sBusType"></param>
|
||||
/// <param name="VoucherState"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <param name="bGetCode"></param>
|
||||
/// <param name="codeKey"></param>
|
||||
/// <param name="bAudit"></param>
|
||||
/// <param name="bPrintDom"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseResult<string>> VoucherSave(BaseLogin baseLogin, Dictionary<string, object> dictionary, string cardNumber, vouchertype enmVoucherType, bool bPositive = true, string sBillType = null, string sBusType = null, int VoucherState = 2, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null, bool bGetCode = false, string codeKey = null, bool bAudit = false, bool bPrintDom = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var errorMsg = "";
|
||||
logInfo.Debug("开始输出登录信息");
|
||||
logInfo.Debug(baseLogin._vbLogin.userToken);
|
||||
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
IXMLDOMDocument2 domHead = new DOMDocument();
|
||||
IXMLDOMDocument2 domBody = new DOMDocument();
|
||||
IXMLDOMDocument2 domCur = new DOMDocument();
|
||||
|
||||
logInfo.Debug("开始获取单据默认模板...");
|
||||
co.GetVoucherData(ref domHead, ref domBody, "1=2");
|
||||
|
||||
logInfo.Debug("填充表头DOM...");
|
||||
|
||||
domHead = dictionary.ToDocument2(domHead);
|
||||
|
||||
if (!dictionary.TryGetValue("body", out var bodys))
|
||||
{
|
||||
await Task.Delay(1);
|
||||
throw new Exception("无法获取表体数据");
|
||||
}
|
||||
|
||||
if (!(bodys is List<Dictionary<string, object>> dictionarys) || dictionarys.Count <= 0)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
throw new Exception("无法获取表体数据");
|
||||
}
|
||||
|
||||
if (bGetCode)
|
||||
{
|
||||
errorMsg = "";
|
||||
var newCode = "";
|
||||
|
||||
if (!co.GetVoucherNO(ref domHead, $"{enmVoucherType}", ref errorMsg, ref newCode))
|
||||
{
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
logInfo.Debug($"获取新单号:{newCode}");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(newCode))
|
||||
{
|
||||
domHead.SetDomKeyValue(codeKey, newCode);
|
||||
}
|
||||
}
|
||||
|
||||
logInfo.Debug("填充表体DOM...");
|
||||
domBody = dictionarys.ToDocument2(domBody);
|
||||
|
||||
if (bPrintDom)
|
||||
{
|
||||
logInfo.Debug("开始输入DOM...");
|
||||
|
||||
logInfo.Debug(domHead.xml);
|
||||
|
||||
logInfo.Debug(domBody.xml);
|
||||
}
|
||||
|
||||
object vouchId = "";
|
||||
IXMLDOMDocument2 domMsg = new DOMDocument();
|
||||
IXMLDOMDocument2 curDom = new DOMDocument();
|
||||
|
||||
co.bOutTrans = true;
|
||||
|
||||
baseLogin.Connection.BeginTrans();
|
||||
|
||||
logInfo.Debug($"{baseLogin.Connection.State},{baseLogin.Connection.ConnectionString}");
|
||||
|
||||
logInfo.Debug("开始查询单据配置...");
|
||||
var vouchers = CommonHelper.GetVouchers(baseLogin.Connection, cardNumber);
|
||||
|
||||
var res = new BaseResult<string>();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
logInfo.Debug("开始保存...");
|
||||
errorMsg = co.VoucherSave(ref domHead, ref domBody, VoucherState, ref vouchId, ref curDom, UserMode, sOverDetailsXml, ref domMsg);
|
||||
logInfo.Debug("保存结束...");
|
||||
logInfo.Debug(errorMsg);
|
||||
logInfo.Debug($"{vouchId}");
|
||||
|
||||
res.bSuccess = string.IsNullOrWhiteSpace(errorMsg) && !string.IsNullOrWhiteSpace($"{vouchId}");
|
||||
|
||||
if (!res.bSuccess)
|
||||
{
|
||||
try
|
||||
{
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(errorMsg))
|
||||
{
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(domMsg.xml))
|
||||
{
|
||||
throw new Exception(domMsg.xml);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(curDom.xml))
|
||||
{
|
||||
throw new Exception(curDom.xml);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
res.voucherCode = CommonHelper.GetVoucherCode(baseLogin.Connection, vouchId, vouchers);
|
||||
res.voucherId = $"{vouchId}";
|
||||
res.result = errorMsg;
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
throw;
|
||||
}
|
||||
|
||||
|
||||
if (!res.bSuccess)
|
||||
{
|
||||
res.message = "保存失败";
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
return res;
|
||||
}
|
||||
|
||||
res.message = "保存成功";
|
||||
|
||||
logInfo.Debug($"{baseLogin.Connection.State},{baseLogin.Connection.ConnectionString}");
|
||||
|
||||
var strWhere = CommonHelper.GetVoucherWhereSqlById(vouchers, vouchId);
|
||||
|
||||
if (res.bSuccess && bAudit)
|
||||
{
|
||||
try
|
||||
{
|
||||
errorMsg = Confirm(co, baseLogin.Connection, enmVoucherType, res.voucherCode, res.voucherId, strWhere);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(errorMsg))
|
||||
{
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
res.bSuccess = false;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
logInfo.Debug("提交事务...");
|
||||
|
||||
baseLogin.Connection.CommitTrans();
|
||||
|
||||
return res;
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
await Task.Delay(1);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量审核单据(单号)
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="sCardNum"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="cCodes"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="sBusType"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<List<BaseResult<string>>> Confirm(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, List<string> cCodes, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
logInfo.Debug("开始输出登录信息");
|
||||
logInfo.Debug(baseLogin._vbLogin.userToken);
|
||||
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
|
||||
|
||||
var resList = new List<BaseResult<string>>();
|
||||
|
||||
foreach (var cCode in cCodes)
|
||||
{
|
||||
try
|
||||
{
|
||||
var strWhere = CommonHelper.GetPUVoucherWhereSqlByCode(vouchers, cCode);
|
||||
|
||||
var curId = CommonHelper.GetVoucherId(conn, cCode, vouchers);
|
||||
|
||||
var verifyResult = await Confirm(co, conn, enmVoucherType, cCode, curId, strWhere);
|
||||
|
||||
resList.Add(verifyResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
logInfo.Error(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
return resList;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量审核单据(ID)
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="sCardNum"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="vouchIds"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="sBusType"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<List<BaseResult<string>>> Confirm(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, List<long> vouchIds, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
|
||||
|
||||
var resList = new List<BaseResult<string>>();
|
||||
|
||||
foreach (var vouchId in vouchIds)
|
||||
{
|
||||
var strWhere = CommonHelper.GetPUVoucherWhereSqlById(vouchers, vouchId);
|
||||
|
||||
var cCode = CommonHelper.GetVoucherCode(conn, vouchId, vouchers);
|
||||
|
||||
var verifyResult = await Confirm(co, conn, enmVoucherType, cCode, vouchId, strWhere);
|
||||
|
||||
resList.Add(verifyResult);
|
||||
}
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核单据(单号)
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="sCardNum"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="cCode"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="sBusType"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<BaseResult<string>> Confirm(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, string cCode, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
|
||||
|
||||
var curId = CommonHelper.GetVoucherId(conn, cCode, vouchers);
|
||||
|
||||
var strWhere = CommonHelper.GetPUVoucherWhereSqlByCode(vouchers, cCode);
|
||||
|
||||
var verifyResult = await Confirm(co, conn, enmVoucherType, cCode, curId, strWhere);
|
||||
|
||||
return verifyResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核单据(ID)
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="sCardNum"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="vouchId"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="sBusType"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<BaseResult<string>> Confirm(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, long vouchId, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
|
||||
|
||||
var strWhere = CommonHelper.GetPUVoucherWhereSqlById(vouchers, vouchId);
|
||||
|
||||
var cCode = CommonHelper.GetVoucherCode(conn, vouchId, vouchers);
|
||||
|
||||
var verifyResult = await Confirm(co, conn, enmVoucherType, cCode, vouchId, strWhere);
|
||||
|
||||
return verifyResult;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核单据
|
||||
/// </summary>
|
||||
/// <param name="voucherCO"></param>
|
||||
/// <param name="conn"></param>
|
||||
/// <param name="sVouchType"></param>
|
||||
/// <param name="cCode"></param>
|
||||
/// <param name="vouchId"></param>
|
||||
/// <param name="strWhere"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseResult<string>> Confirm(dynamic voucherCO, Connection conn, vouchertype sVouchType, string cCode, object vouchId, string strWhere)
|
||||
{
|
||||
IXMLDOMDocument2 domHead = new DOMDocument();
|
||||
IXMLDOMDocument2 domBody = new DOMDocument();
|
||||
IXMLDOMDocument2 domMsg = new DOMDocument();
|
||||
|
||||
logInfo.Debug("开始获取单据数据...");
|
||||
voucherCO.GetVoucherData(ref domHead, ref domBody, strWhere);
|
||||
|
||||
var res = new BaseResult<string>
|
||||
{
|
||||
voucherCode = cCode,
|
||||
voucherId = $"{vouchId}"
|
||||
};
|
||||
|
||||
var errorMsg = "";
|
||||
|
||||
switch (sVouchType)
|
||||
{
|
||||
case vouchertype.采购请购单:
|
||||
{
|
||||
#if DEBUG
|
||||
errorMsg = voucherCO.ConfirmApp(ref domHead);
|
||||
#else
|
||||
errorMsg = voucherCO.ConfirmApp(ref domHead, ref domMsg);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case vouchertype.采购订单:
|
||||
{
|
||||
#if DEBUG
|
||||
errorMsg = voucherCO.ConfirmPO(ref domHead, ref domMsg);
|
||||
#else
|
||||
errorMsg = voucherCO.ConfirmPO(ref domHead, ref domMsg,ref domBody);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case vouchertype.采购到货单:
|
||||
{
|
||||
errorMsg = voucherCO.ConfirmArr(ref domHead);
|
||||
break;
|
||||
}
|
||||
case vouchertype.采购发票:
|
||||
{
|
||||
errorMsg = voucherCO.ConfirmBill(ref domHead);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
await Task.Delay(1);
|
||||
errorMsg = "未知业务";
|
||||
break;
|
||||
}
|
||||
|
||||
res.bSuccess = string.IsNullOrWhiteSpace(errorMsg);
|
||||
|
||||
if (res.bSuccess)
|
||||
{
|
||||
res.message = "审核成功";
|
||||
res.result = res.voucherId;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
res.message = "审核失败";
|
||||
res.result = string.IsNullOrWhiteSpace(errorMsg) ? domMsg.xml : errorMsg;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量弃审单据(单号)
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="sCardNum"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="cCodes"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="sBusType"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<List<BaseResult<string>>> CancelConfirm(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, List<string> cCodes, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
logInfo.Debug("开始输出登录信息");
|
||||
logInfo.Debug(baseLogin._vbLogin.userToken);
|
||||
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
|
||||
|
||||
var resList = new List<BaseResult<string>>();
|
||||
|
||||
foreach (var cCode in cCodes)
|
||||
{
|
||||
try
|
||||
{
|
||||
var strWhere = CommonHelper.GetPUVoucherWhereSqlByCode(vouchers, cCode);
|
||||
|
||||
var curId = CommonHelper.GetVoucherId(conn, cCode, vouchers);
|
||||
|
||||
var verifyResult = await CancelConfirm(co, conn, enmVoucherType, cCode, curId, strWhere);
|
||||
|
||||
resList.Add(verifyResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
logInfo.Error(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量弃审单据(ID)
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="sCardNum"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="vouchIds"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<List<BaseResult<string>>> CancelConfirm(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, List<long> vouchIds, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
|
||||
|
||||
var resList = new List<BaseResult<string>>();
|
||||
|
||||
foreach (var vouchId in vouchIds)
|
||||
{
|
||||
var strWhere = CommonHelper.GetPUVoucherWhereSqlById(vouchers, vouchId);
|
||||
|
||||
var cCode = CommonHelper.GetVoucherCode(conn, vouchId, vouchers);
|
||||
|
||||
var verifyResult = await CancelConfirm(co, conn, enmVoucherType, cCode, vouchId, strWhere);
|
||||
|
||||
resList.Add(verifyResult);
|
||||
}
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 弃审单据(单号)
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="sCardNum"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="cCode"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="sBusType"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<BaseResult<string>> CancelConfirm(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, string cCode, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
|
||||
|
||||
var curId = CommonHelper.GetVoucherId(conn, cCode, vouchers);
|
||||
|
||||
var strWhere = CommonHelper.GetPUVoucherWhereSqlByCode(vouchers, cCode);
|
||||
|
||||
var verifyResult = await CancelConfirm(co, conn, enmVoucherType, cCode, curId, strWhere);
|
||||
|
||||
return verifyResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 弃审单据(ID)
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="sCardNum"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="vouchId"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="sBusType"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<BaseResult<string>> CancelConfirm(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, long vouchId, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
|
||||
|
||||
var strWhere = CommonHelper.GetPUVoucherWhereSqlById(vouchers, vouchId);
|
||||
|
||||
var cCode = CommonHelper.GetVoucherCode(conn, vouchId, vouchers);
|
||||
|
||||
var verifyResult = await CancelConfirm(co, conn, enmVoucherType, cCode, vouchId, strWhere);
|
||||
|
||||
return verifyResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 弃审单据
|
||||
/// </summary>
|
||||
/// <param name="voucherCO"></param>
|
||||
/// <param name="conn"></param>
|
||||
/// <param name="sVouchType"></param>
|
||||
/// <param name="cCode"></param>
|
||||
/// <param name="vouchId"></param>
|
||||
/// <param name="strWhere"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseResult<string>> CancelConfirm(dynamic voucherCO, Connection conn, vouchertype sVouchType, string cCode, object vouchId, string strWhere)
|
||||
{
|
||||
IXMLDOMDocument2 domHead = new DOMDocument();
|
||||
IXMLDOMDocument2 domBody = new DOMDocument();
|
||||
IXMLDOMDocument2 domMsg = new DOMDocument();
|
||||
|
||||
logInfo.Debug("开始获取单据数据...");
|
||||
voucherCO.GetVoucherData(ref domHead, ref domBody, strWhere);
|
||||
|
||||
var res = new BaseResult<string>
|
||||
{
|
||||
voucherCode = cCode,
|
||||
voucherId = $"{vouchId}"
|
||||
};
|
||||
|
||||
var errorMsg = "";
|
||||
|
||||
switch (sVouchType)
|
||||
{
|
||||
case vouchertype.采购请购单:
|
||||
{
|
||||
errorMsg = voucherCO.CancelconfirmApp(ref domHead);
|
||||
break;
|
||||
}
|
||||
case vouchertype.采购订单:
|
||||
{
|
||||
#if DEBUG
|
||||
errorMsg = voucherCO.CancelconfirmPO(ref domHead);
|
||||
#else
|
||||
errorMsg = voucherCO.CancelconfirmPO(ref domHead,ref domBody);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case vouchertype.采购到货单:
|
||||
{
|
||||
errorMsg = voucherCO.CancelconfirmArr(ref domHead);
|
||||
break;
|
||||
}
|
||||
case vouchertype.采购发票:
|
||||
{
|
||||
errorMsg = voucherCO.CancelconfirmBill(ref domHead);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
await Task.Delay(1);
|
||||
errorMsg = "未知业务";
|
||||
break;
|
||||
}
|
||||
|
||||
res.bSuccess = string.IsNullOrWhiteSpace(errorMsg);
|
||||
|
||||
if (res.bSuccess)
|
||||
{
|
||||
res.message = "弃审成功";
|
||||
res.result = res.voucherId;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
res.message = "弃审失败";
|
||||
res.result = string.IsNullOrWhiteSpace(errorMsg) ? domMsg.xml : errorMsg;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量删除单据(单号)
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="sCardNum"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="cCodes"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="sBusType"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<List<BaseResult<string>>> Delete(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, List<string> cCodes, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
logInfo.Debug("开始输出登录信息");
|
||||
logInfo.Debug(baseLogin._vbLogin.userToken);
|
||||
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
|
||||
|
||||
var resList = new List<BaseResult<string>>();
|
||||
|
||||
foreach (var cCode in cCodes)
|
||||
{
|
||||
try
|
||||
{
|
||||
var strWhere = CommonHelper.GetPUVoucherWhereSqlByCode(vouchers, cCode);
|
||||
|
||||
var curId = CommonHelper.GetVoucherId(conn, cCode, vouchers);
|
||||
|
||||
var verifyResult = await Delete(co, conn, enmVoucherType, cCode, curId, strWhere);
|
||||
|
||||
resList.Add(verifyResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
logInfo.Error(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量删除单据(ID)
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="sCardNum"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="vouchIds"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<List<BaseResult<string>>> Delete(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, List<long> vouchIds, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
|
||||
|
||||
var resList = new List<BaseResult<string>>();
|
||||
|
||||
foreach (var vouchId in vouchIds)
|
||||
{
|
||||
var strWhere = CommonHelper.GetPUVoucherWhereSqlById(vouchers, vouchId);
|
||||
|
||||
var cCode = CommonHelper.GetVoucherCode(conn, vouchId, vouchers);
|
||||
|
||||
var verifyResult = await Delete(co, conn, enmVoucherType, cCode, vouchId, strWhere);
|
||||
|
||||
resList.Add(verifyResult);
|
||||
}
|
||||
|
||||
return resList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除单据(单号)
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="sCardNum"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="cCode"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="sBusType"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<BaseResult<string>> Delete(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, string cCode, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
|
||||
|
||||
var curId = CommonHelper.GetVoucherId(conn, cCode, vouchers);
|
||||
|
||||
var strWhere = CommonHelper.GetPUVoucherWhereSqlByCode(vouchers, cCode);
|
||||
|
||||
var verifyResult = await Delete(co, conn, enmVoucherType, cCode, curId, strWhere);
|
||||
|
||||
return verifyResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除单据(ID)
|
||||
/// </summary>
|
||||
/// <param name="baseLogin"></param>
|
||||
/// <param name="sCardNum"></param>
|
||||
/// <param name="enmVoucherType"></param>
|
||||
/// <param name="vouchId"></param>
|
||||
/// <param name="bPositive"></param>
|
||||
/// <param name="sBillType"></param>
|
||||
/// <param name="sBusType"></param>
|
||||
/// <param name="UserMode"></param>
|
||||
/// <param name="sOverDetailsXml"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<BaseResult<string>> Delete(BaseLogin baseLogin, string sCardNum, vouchertype enmVoucherType, long vouchId, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
var co = InitCo(baseLogin, enmVoucherType, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var vouchers = CommonHelper.GetVouchers(conn, sCardNum);
|
||||
|
||||
var strWhere = CommonHelper.GetPUVoucherWhereSqlById(vouchers, vouchId);
|
||||
|
||||
var cCode = CommonHelper.GetVoucherCode(conn, vouchId, vouchers);
|
||||
|
||||
var verifyResult = await Delete(co, conn, enmVoucherType, cCode, vouchId, strWhere);
|
||||
|
||||
return verifyResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除单据
|
||||
/// </summary>
|
||||
/// <param name="voucherCO"></param>
|
||||
/// <param name="conn"></param>
|
||||
/// <param name="sVouchType"></param>
|
||||
/// <param name="cCode"></param>
|
||||
/// <param name="vouchId"></param>
|
||||
/// <param name="strWhere"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseResult<string>> Delete(dynamic voucherCO, Connection conn, vouchertype sVouchType, string cCode, object vouchId, string strWhere)
|
||||
{
|
||||
IXMLDOMDocument2 domHead = new DOMDocument();
|
||||
IXMLDOMDocument2 domBody = new DOMDocument();
|
||||
IXMLDOMDocument2 domMsg = new DOMDocument();
|
||||
|
||||
logInfo.Debug("开始获取单据数据...");
|
||||
voucherCO.GetVoucherData(ref domHead, ref domBody, strWhere);
|
||||
|
||||
var res = new BaseResult<string>
|
||||
{
|
||||
voucherCode = cCode,
|
||||
voucherId = $"{vouchId}"
|
||||
};
|
||||
|
||||
var errorMsg = voucherCO.Delete(domHead, domBody);
|
||||
|
||||
res.bSuccess = string.IsNullOrWhiteSpace(errorMsg);
|
||||
|
||||
if (res.bSuccess)
|
||||
{
|
||||
res.message = "删除成功";
|
||||
res.result = res.voucherId;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
res.message = "删除失败";
|
||||
res.result = string.IsNullOrWhiteSpace(errorMsg) ? "未知错误" : errorMsg;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.PU
|
||||
{
|
||||
public enum vouchertype
|
||||
{
|
||||
/// <summary>
|
||||
/// 0 采购请购单
|
||||
/// </summary>
|
||||
采购请购单 = 0,
|
||||
/// <summary>
|
||||
/// 1 采购订单
|
||||
/// </summary>
|
||||
采购订单 = 1,
|
||||
/// <summary>
|
||||
/// 2 采购到货单
|
||||
/// </summary>
|
||||
采购到货单 = 2,
|
||||
/// <summary>
|
||||
/// 3 采购入库单
|
||||
/// </summary>
|
||||
采购入库单 = 3,
|
||||
/// <summary>
|
||||
/// 4 采购发票
|
||||
/// </summary>
|
||||
采购发票 = 4,
|
||||
/// <summary>
|
||||
/// 5 采购结算单
|
||||
/// </summary>
|
||||
采购结算单 = 5,
|
||||
/// <summary>
|
||||
/// 6 PU_STSettle
|
||||
/// </summary>
|
||||
PU_STSettle = 6,
|
||||
/// <summary>
|
||||
/// 7 PU_ManSettle
|
||||
/// </summary>
|
||||
PU_ManSettle = 7,
|
||||
/// <summary>
|
||||
/// 8 VMIUsedVouch
|
||||
/// </summary>
|
||||
VMIUsedVouch = 8,
|
||||
/// <summary>
|
||||
/// 9 供应商资格审批
|
||||
/// </summary>
|
||||
供应商资格审批 = 9,
|
||||
/// <summary>
|
||||
/// 10 供应商供货审批
|
||||
/// </summary>
|
||||
供应商供货审批 = 10,
|
||||
/// <summary>
|
||||
/// 11 PU_FYSettle
|
||||
/// </summary>
|
||||
PU_FYSettle = 11,
|
||||
/// <summary>
|
||||
/// 12 PU_AutoSettle
|
||||
/// </summary>
|
||||
PU_AutoSettle = 12,
|
||||
/// <summary>
|
||||
/// 13 OM_ManSettle
|
||||
/// </summary>
|
||||
OM_ManSettle = 13,
|
||||
/// <summary>
|
||||
/// 14 OM_FYSettle
|
||||
/// </summary>
|
||||
OM_FYSettle = 14,
|
||||
/// <summary>
|
||||
/// 15 供应商存货调价单
|
||||
/// </summary>
|
||||
供应商存货调价单 = 15
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
try
|
||||
{
|
||||
logInfo.Debug("开始获取单据默认模板...");
|
||||
|
||||
if (!co.GetDefaultVoucherDom(sVouchType, cCardNum, ref domHead, ref domBody, ref domPosition,
|
||||
ref errorMsg) || !string.IsNullOrWhiteSpace(errorMsg))
|
||||
{
|
||||
@@ -161,8 +162,8 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
await Task.Delay(1);
|
||||
throw;
|
||||
}
|
||||
|
||||
@@ -171,15 +172,23 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
if (res.bSuccess && bAudit)
|
||||
{
|
||||
errorMsg = "";
|
||||
try
|
||||
{
|
||||
if (!co.Verify(sVouchType, vouchId, ref errorMsg, baseLogin.Connection, null, ref domMsg))
|
||||
{
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
|
||||
if (!co.Verify(sVouchType, vouchId, ref errorMsg, baseLogin.Connection, null, ref domMsg))
|
||||
if (!string.IsNullOrWhiteSpace(errorMsg))
|
||||
throw new Exception(errorMsg);
|
||||
|
||||
throw new Exception("审核单据时发生异常,请检查数据");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(errorMsg))
|
||||
throw new Exception(errorMsg);
|
||||
|
||||
throw new Exception("审核单据时发生异常,请检查数据");
|
||||
res.bSuccess = false;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +215,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
else
|
||||
{
|
||||
rst.MoveFirst();
|
||||
var fieldName = $"{rst.Fields["VchTblPrimarykeyNames"].Value}";
|
||||
var fieldName = $"{rst.Fields["c"].Value}";
|
||||
var codeName = $"{rst.Fields["ReceiptNOFieldName"].Value}";
|
||||
if (string.IsNullOrWhiteSpace(fieldName) || string.IsNullOrWhiteSpace(codeName))
|
||||
{
|
||||
@@ -269,7 +278,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
/// <param name="bUpdateNeedEas"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<BaseResult<string>> Update(BaseLogin baseLogin, Dictionary<string, object> dictionary, string sCardNum, string sVouchType, bool bCheck = true, bool bBeforCheckStock = true, bool bIsRedVouch = false, string sAddedState = "", bool bUpdateNeedEas = true)
|
||||
public async Task<BaseResult<string>> Update(BaseLogin baseLogin, Dictionary<string, object> dictionary, string sCardNum, string sVouchType, bool bCheck = true, bool bBeforCheckStock = true, bool bIsRedVouch = false, string sAddedState = "", bool ccc = true, bool bPrintDom = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -312,6 +321,17 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
|
||||
domBody = bodys.ToDocument2(domBody);
|
||||
|
||||
if (bPrintDom)
|
||||
{
|
||||
logInfo.Debug("开始输入DOM...");
|
||||
|
||||
logInfo.Debug(domHead.xml);
|
||||
|
||||
logInfo.Debug(domBody.xml);
|
||||
|
||||
logInfo.Debug(domPosition.xml);
|
||||
}
|
||||
|
||||
//IXMLDOMDocument2 domMsg = new DOMDocument();
|
||||
|
||||
errorMsg = "";
|
||||
@@ -380,9 +400,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var conn = new Connection();
|
||||
|
||||
conn.Open(baseLogin.UfDbName);
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{sCardNum}'", conn);
|
||||
@@ -459,9 +477,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var conn = new Connection();
|
||||
|
||||
conn.Open(baseLogin.UfDbName);
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{sCardNum}'", conn);
|
||||
@@ -538,9 +554,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var conn = new Connection();
|
||||
|
||||
conn.Open(baseLogin.UfDbName);
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{sCardNum}'", conn);
|
||||
@@ -607,9 +621,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var conn = new Connection();
|
||||
|
||||
conn.Open(baseLogin.UfDbName);
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{sCardNum}'", conn);
|
||||
@@ -726,9 +738,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var conn = new Connection();
|
||||
|
||||
conn.Open(baseLogin.UfDbName);
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{sCardNum}'", conn);
|
||||
@@ -805,9 +815,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var conn = new Connection();
|
||||
|
||||
conn.Open(baseLogin.UfDbName);
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{sCardNum}'", conn);
|
||||
@@ -884,9 +892,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var conn = new Connection();
|
||||
|
||||
conn.Open(baseLogin.UfDbName);
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{sCardNum}'", conn);
|
||||
@@ -953,9 +959,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var conn = new Connection();
|
||||
|
||||
conn.Open(baseLogin.UfDbName);
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{sCardNum}'", conn);
|
||||
@@ -1081,9 +1085,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var conn = new Connection();
|
||||
|
||||
conn.Open(baseLogin.UfDbName);
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{sCardNum}'", conn);
|
||||
@@ -1160,9 +1162,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var conn = new Connection();
|
||||
|
||||
conn.Open(baseLogin.UfDbName);
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{sCardNum}'", conn);
|
||||
@@ -1239,9 +1239,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var conn = new Connection();
|
||||
|
||||
conn.Open(baseLogin.UfDbName);
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{sCardNum}'", conn);
|
||||
@@ -1308,9 +1306,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var conn = new Connection();
|
||||
|
||||
conn.Open(baseLogin.UfDbName);
|
||||
var conn = baseLogin.Connection;
|
||||
|
||||
var rst = new Recordset();
|
||||
rst.Open($"SELECT CardNumber,BTTblName,BTQName,BWTblName,BWQName,VchListQName,VchTblPrimarykeyNames,ReceiptNOFieldName FROM dbo.vouchers WHERE CardNumber='{sCardNum}'", conn);
|
||||
|
||||
@@ -72,6 +72,9 @@
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.9.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Microsoft.VisualBasic.Compatibility" />
|
||||
<Reference Include="Microsoft.VisualBasic.Compatibility.Data" />
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -94,6 +97,10 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UFIDA.U8.Audit.ServiceProxy">
|
||||
<HintPath>D:\U8SOFT\Workflow\Lib\UFIDA.U8.Audit.ServiceProxy.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="UFSoft.U8.BO.BE">
|
||||
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.BO.BE.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -177,23 +184,33 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AP\clsCloseBil.cs" />
|
||||
<Compile Include="AP\clsVouchFacade.cs" />
|
||||
<Compile Include="AP\Entity\VoucherData.cs" />
|
||||
<Compile Include="AP\NoteManageAR.cs" />
|
||||
<Compile Include="AP\NoteManageAP.cs" />
|
||||
<Compile Include="AP\UFAPBO.cs" />
|
||||
<Compile Include="Common\APARHelper.cs" />
|
||||
<Compile Include="Common\BEHelper.cs" />
|
||||
<Compile Include="Common\CommonHelper.cs" />
|
||||
<Compile Include="Entity\Exch.cs" />
|
||||
<Compile Include="Entity\VouchersInfo.cs" />
|
||||
<Compile Include="Json\JsonHelper.cs" />
|
||||
<Compile Include="Entity\BaseResult.cs" />
|
||||
<Compile Include="Entity\LoginParamter.cs" />
|
||||
<Compile Include="Entity\StatusEnum.cs" />
|
||||
<Compile Include="Entity\SysU8AccountConfig.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="PU\clsVoucherCO_PU.cs" />
|
||||
<Compile Include="PU\UseMode.cs" />
|
||||
<Compile Include="ST\USERPCO.cs" />
|
||||
<Compile Include="PU\vouchertype.cs" />
|
||||
<Compile Include="U8M\BaseLogin.cs" />
|
||||
<Compile Include="U8M\IBaseBF.cs" />
|
||||
<Compile Include="U8M\MOrder.cs" />
|
||||
<Compile Include="U8M\MoRoutingBill.cs" />
|
||||
<Compile Include="U8M\StandardBom.cs" />
|
||||
<Compile Include="Workflow\ServiceProxy.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="AA\" />
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ADODB;
|
||||
using log4net;
|
||||
using UFIDA.U8.Audit.ServiceProxy;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||
using UFSoft.U8.Framework.ContextSrv;
|
||||
using UFSoft.U8.Framework.LoginContext;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.Workflow
|
||||
{
|
||||
public class ServiceProxy
|
||||
{
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
public bool IsFlowEnabled(BaseLogin login, string bizObjectId, string eventId)
|
||||
{
|
||||
var auditServiceProxy = new AuditServiceProxy();
|
||||
var errMsg = "";
|
||||
var res = auditServiceProxy.IsFlowEnabled(bizObjectId, eventId, login._productContext.calledContext, ref errMsg);
|
||||
|
||||
if (!res && !string.IsNullOrWhiteSpace(errMsg))
|
||||
{
|
||||
throw new Exception(errMsg);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public BaseResult<string> SubmitApplicationMessage(BaseLogin login, string bizObjectId, string eventId, string voucherId,string voucherCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
var auditServiceProxy = new AuditServiceProxy();
|
||||
var isWFControled = false;
|
||||
var errMsg = "";
|
||||
var res = auditServiceProxy.SubmitApplicationMessage(bizObjectId, eventId, voucherId, login._productContext.calledContext, ref isWFControled, ref errMsg);
|
||||
|
||||
if (!res && !string.IsNullOrWhiteSpace(errMsg))
|
||||
{
|
||||
throw new Exception(errMsg);
|
||||
}
|
||||
|
||||
if (!isWFControled && !string.IsNullOrWhiteSpace(errMsg))
|
||||
{
|
||||
throw new Exception(errMsg);
|
||||
}
|
||||
|
||||
if (!isWFControled)
|
||||
{
|
||||
throw new Exception("当前单据无法进入工作流");
|
||||
}
|
||||
|
||||
return new BaseResult<string>()
|
||||
{
|
||||
bSuccess = res,
|
||||
message = "提交成功",
|
||||
result = "提交成功",
|
||||
voucherId = voucherId,
|
||||
voucherCode = voucherCode
|
||||
};
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error($"审批流异常:{ex.Message}", ex);
|
||||
return new BaseResult<string>()
|
||||
{
|
||||
bSuccess = false, message = "提交失败", voucherCode = voucherCode, voucherId = voucherId,
|
||||
result = ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string GetBizObjectId(Connection conn,string cCardNum)
|
||||
{
|
||||
var rst = new Recordset();
|
||||
|
||||
|
||||
var strSql = $"SELECT cHeadBusObjectId FROM dbo.vouchers WHERE CardNumber='{cCardNum}'";
|
||||
|
||||
rst.Open(strSql,conn);
|
||||
|
||||
if (rst.EOF || rst.BOF)
|
||||
{
|
||||
throw new Exception($"未查询到单据类型编码{cCardNum}的配置信息");
|
||||
}
|
||||
|
||||
rst.MoveFirst();
|
||||
|
||||
var res = $"{rst.Fields["cHeadBusObjectId"].Value}";
|
||||
|
||||
rst.Close();
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,8 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Web.UI.WebControls;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.AP;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Models;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Json;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.Tests.Controllers
|
||||
@@ -20,14 +21,12 @@ namespace UFIDA.U8.Framework.Api.Tests.Controllers
|
||||
baseLogin.Init(
|
||||
new LoginParamter()
|
||||
{
|
||||
cSerial = "", cSrv = "192.168.50.31", pAccId = "(default)@801", pDate = "2015-07-01",
|
||||
pPassword = "", pSubId = "DP", pUserId = "demo", pYearId = "2015"
|
||||
cSerial = "", cSrv = "192.168.50.5", pAccId = "(default)@801", pDate = "2014-12-31",
|
||||
pPassword = "", pSubId = "DP", pUserId = "demo", pYearId = "2014"
|
||||
}, false);
|
||||
|
||||
var bo = new UFAPBO();
|
||||
var bo = new NoteManageAR();
|
||||
|
||||
var dd = new List<Dictionary<string, object>>();
|
||||
|
||||
var da = new Dictionary<string, object>(){
|
||||
{ "bPrePay", 0 },
|
||||
{ "iType", 0 },
|
||||
@@ -46,40 +45,10 @@ namespace UFIDA.U8.Framework.Api.Tests.Controllers
|
||||
{ "cPersonCode", "00043" }
|
||||
}; ;
|
||||
|
||||
dd.Add(da);
|
||||
|
||||
//var res= bo.NoteSave(baseLogin, da );
|
||||
|
||||
var dict = new Dictionary<string, object>()
|
||||
{
|
||||
{ "cVouchType", "49" },
|
||||
{ "cVouchID", "0000000030" },
|
||||
{ "dVouchDate", "2015-07-22" },
|
||||
{ "cDwCode", "01004" },
|
||||
{ "cSSCode", "1" },
|
||||
{"cDeptCode", "0401"},
|
||||
{"cSSName", "现金"},
|
||||
{"iPeriod", 7},
|
||||
{"cPerson", "00043"},
|
||||
{"cPersonName", "顾潇"},
|
||||
{"cexch_name", "人民币"},
|
||||
{"iExchRate", 1},
|
||||
{"iAmount_f", 100.00},
|
||||
{"iAmount", 100.00},
|
||||
{"iRAmount_f", 100.00},
|
||||
{"iRAmount", 100.00},
|
||||
{"cTypeName", "付款单"},
|
||||
{"cFlag", "AP"},
|
||||
{"iPayForOther", 0},
|
||||
{"bFromBank", 0},
|
||||
{"bToBank", 0},
|
||||
{"bSure", 0},
|
||||
{"cCode", "1001"},
|
||||
{ "bStartFlag", 0},
|
||||
{"body",dd}
|
||||
};
|
||||
|
||||
var res= bo.CloseBillSave(baseLogin, dict, "AP");
|
||||
|
||||
Trace.WriteLine("aaaaa");
|
||||
//Trace.WriteLine(res.ToJson());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UFIDA.U8.Framework.Api.Cont
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VoucherPlugTest", "VoucherPlugTest\VoucherPlugTest.csproj", "{20CD37D3-70D0-410B-8765-02E10766EBB2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebUpdate", "WebUpdate\WebUpdate.csproj", "{7861F8D1-F5A9-4AE5-9E60-1772D2B4A074}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -39,6 +41,10 @@ Global
|
||||
{20CD37D3-70D0-410B-8765-02E10766EBB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{20CD37D3-70D0-410B-8765-02E10766EBB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{20CD37D3-70D0-410B-8765-02E10766EBB2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7861F8D1-F5A9-4AE5-9E60-1772D2B4A074}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7861F8D1-F5A9-4AE5-9E60-1772D2B4A074}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7861F8D1-F5A9-4AE5-9E60-1772D2B4A074}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7861F8D1-F5A9-4AE5-9E60-1772D2B4A074}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Binary file not shown.
@@ -570,7 +570,7 @@
|
||||
</member>
|
||||
<member name="T:UFIDA.U8.Framework.Api.Controllers.U8.APController">
|
||||
<summary>
|
||||
应收应付
|
||||
应收应付管理
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:UFIDA.U8.Framework.Api.Controllers.U8.APController.logInfo">
|
||||
@@ -578,13 +578,16 @@
|
||||
日志组件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.APController.Save(System.String,System.String,System.Collections.Generic.Dictionary{System.String,System.Object})">
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.APController.Save(System.String,System.String,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.String,System.Boolean)">
|
||||
<summary>
|
||||
应收应付单据保存接口
|
||||
</summary>
|
||||
<param name="cAccId"></param>
|
||||
<param name="cCardNum"></param>
|
||||
<param name="input"></param>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="cSubId">模块号</param>
|
||||
<param name="input">报文</param>
|
||||
<param name="busDate">业务日期</param>
|
||||
<param name="bNeedBillClosed"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.APController.CloseBillSave(System.String,System.String,System.Collections.Generic.Dictionary{System.String,System.Object})">
|
||||
@@ -612,29 +615,15 @@
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.APController.ApNoteSave(System.String,System.String,System.Collections.Generic.Dictionary{System.String,System.Object})">
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.APController.ApNote_Save(System.String,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.String,System.Boolean)">
|
||||
<summary>
|
||||
票据保存
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="cSubId">模块号</param>
|
||||
<param name="busDate">业务日期</param>
|
||||
<param name="input">报文数据</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.APController.AP03Save(System.String,System.Collections.Generic.Dictionary{System.String,System.Object})">
|
||||
<summary>
|
||||
票据保存
|
||||
</summary>
|
||||
<param name="cAccId"></param>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.APController.AR03Save(System.String,System.Collections.Generic.Dictionary{System.String,System.Object})">
|
||||
<summary>
|
||||
票据保存
|
||||
</summary>
|
||||
<param name="cAccId"></param>
|
||||
<param name="input"></param>
|
||||
<param name="bNeedBillClosed"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:UFIDA.U8.Framework.Api.Controllers.U8.DPController">
|
||||
@@ -708,6 +697,74 @@
|
||||
生产订单
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:UFIDA.U8.Framework.Api.Controllers.U8.PUController">
|
||||
<summary>
|
||||
采购管理
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:UFIDA.U8.Framework.Api.Controllers.U8.PUController.logInfo">
|
||||
<summary>
|
||||
日志组件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.PUController.VoucherSave(System.String,System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Boolean,System.String,System.String,System.Int32,UFIDA.U8.Framework.Api.ControlObject.PU.UseMode,System.String)">
|
||||
<summary>
|
||||
保存单据
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="input">报文</param>
|
||||
<param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
<param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
<param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
<param name="VoucherState">单据状态:2新增,1修改,0非编辑</param>
|
||||
<param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
<param name="sOverDetailsXml">为空</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.PUController.Confirm(System.String,System.String,System.String,System.Boolean,System.String,System.String,UFIDA.U8.Framework.Api.ControlObject.PU.UseMode,System.String)">
|
||||
<summary>
|
||||
审核单据(单号)
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="cCode">单号</param>
|
||||
<param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
<param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
<param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
<param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
<param name="sOverDetailsXml">为空</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.PUController.Confirm(System.String,System.String,System.Int64,System.Boolean,System.String,System.String,UFIDA.U8.Framework.Api.ControlObject.PU.UseMode,System.String)">
|
||||
<summary>
|
||||
审核单据(ID)
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="voucherId">单据ID</param>
|
||||
<param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
<param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
<param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
<param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
<param name="sOverDetailsXml">为空</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.PUController.Confirm(System.String,System.String,UFIDA.U8.Framework.Api.Models.STInput,System.Boolean,System.String,System.String,UFIDA.U8.Framework.Api.ControlObject.PU.UseMode,System.String)">
|
||||
<summary>
|
||||
审核单据(批量)
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="input">报文</param>
|
||||
<param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
<param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
<param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
<param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
<param name="sOverDetailsXml">为空</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:UFIDA.U8.Framework.Api.Controllers.U8.SFCController">
|
||||
<summary>
|
||||
车间管理
|
||||
@@ -874,6 +931,130 @@
|
||||
<param name="bReMote">是否远程</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.STController.Verify(System.String,System.String,System.String,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
审核单据(单号)
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="cCode">单据编号</param>
|
||||
<param name="bCheck">是否控制可用量</param>
|
||||
<param name="bBeforCheckStock">是否检查可用量</param>
|
||||
<param name="bList">是否列表</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.STController.Verify(System.String,System.String,System.Int64,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
审核单据(ID)
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="voucherId">单据ID</param>
|
||||
<param name="bCheck">是否控制可用量</param>
|
||||
<param name="bBeforCheckStock">是否检查可用量</param>
|
||||
<param name="bList">是否列表</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.STController.Verify(System.String,System.String,UFIDA.U8.Framework.Api.Models.STInput,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
审核单据(批量)
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="input">报文</param>
|
||||
<param name="bCheck">是否控制可用量</param>
|
||||
<param name="bBeforCheckStock">是否检查可用量</param>
|
||||
<param name="bList">是否列表</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.STController.UnVerify(System.String,System.String,System.String,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
弃审单据(单号)
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="cCode">单据编号</param>
|
||||
<param name="bCheck">是否控制可用量</param>
|
||||
<param name="bBeforCheckStock">是否检查可用量</param>
|
||||
<param name="bList">是否列表</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.STController.UnVerify(System.String,System.String,System.Int64,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
弃审单据(ID)
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="voucherId">单据ID</param>
|
||||
<param name="bCheck">是否控制可用量</param>
|
||||
<param name="bBeforCheckStock">是否检查可用量</param>
|
||||
<param name="bList">是否列表</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.STController.UnVerify(System.String,System.String,UFIDA.U8.Framework.Api.Models.STInput,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
弃审单据(批量)
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="input">报文</param>
|
||||
<param name="bCheck">是否控制可用量</param>
|
||||
<param name="bBeforCheckStock">是否检查可用量</param>
|
||||
<param name="bList">是否列表</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.STController.Delete(System.String,System.String,System.String,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
删除单据(单号)
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="cCode">单据编号</param>
|
||||
<param name="bCheck">是否控制可用量</param>
|
||||
<param name="bBeforCheckStock">是否检查可用量</param>
|
||||
<param name="bList">是否列表</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.STController.Delete(System.String,System.String,System.Int64,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
删除单据(ID)
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="voucherId">单据ID</param>
|
||||
<param name="bCheck">是否控制可用量</param>
|
||||
<param name="bBeforCheckStock">是否检查可用量</param>
|
||||
<param name="bList">是否列表</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.STController.Delete(System.String,System.String,UFIDA.U8.Framework.Api.Models.STInput,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
删除单据(批量)
|
||||
</summary>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="input">报文</param>
|
||||
<param name="bCheck">是否控制可用量</param>
|
||||
<param name="bBeforCheckStock">是否检查可用量</param>
|
||||
<param name="bList">是否列表</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:UFIDA.U8.Framework.Api.Controllers.U8.WorkflowController">
|
||||
<summary>
|
||||
审批流
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:UFIDA.U8.Framework.Api.Controllers.U8.WorkflowController.logInfo">
|
||||
<summary>
|
||||
日志组件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.WebApiApplication.CurrentDomain_AssemblyResolve(System.Object,System.ResolveEventArgs)">
|
||||
<summary>
|
||||
缺少程序集全局处理事件
|
||||
@@ -887,6 +1068,11 @@
|
||||
报工单删除参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:UFIDA.U8.Framework.Api.Models.STInput">
|
||||
<summary>
|
||||
批量审核弃审参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:UFIDA.U8.Framework.Api.Models.U8AccountConfigInput">
|
||||
<summary>
|
||||
查询参数
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"cVouchType": "50",
|
||||
"cPayBillBank": "招商银行双榆树支行",
|
||||
"cVouchTypeName": "银行承兑汇票",
|
||||
"CVouchId": "12312345",
|
||||
"cDwCode": "00000001",
|
||||
"cDeptCode": "0301",
|
||||
"cPerson": "00024",
|
||||
"cDigest": "",
|
||||
"iAmount": 340000.00,
|
||||
"iRate": 0.00,
|
||||
"iRAmount": 340000.00,
|
||||
"dSignDate": "2014-10-21",
|
||||
"dExpireDate": "2015-04-21",
|
||||
"dReceiptDate": "2015-01-31",
|
||||
"cFlag": "AR",
|
||||
"cReceiver": "星空电子公司",
|
||||
"cReceiveBank": "",
|
||||
"cReceiveAccount": "",
|
||||
"iAmount_Local": 340000.00,
|
||||
"iRAmount_Local": 340000.00,
|
||||
"cSettleCode": "401",
|
||||
"cBill": "demo",
|
||||
"cSuperBank": "",
|
||||
"cexch_name": "人民币",
|
||||
"cDWName": "世纪天华集团公司",
|
||||
"cPayBillAccount": "6225000099998888",
|
||||
"cPayBillBankID": "",
|
||||
"cPayBillBankAdress": "",
|
||||
"cReceiverCode": "",
|
||||
"cReceiveBankID": "",
|
||||
"cRemark": "",
|
||||
"nfrat": 1,
|
||||
"iReceiveAmount": 340000.00,
|
||||
"iReceiveAmount_Local": 340000.00
|
||||
}
|
||||
@@ -2,18 +2,20 @@
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.SymbolStore;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.AP;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||
using UFIDA.U8.Framework.Api.Models;
|
||||
using UFIDA.U8.Framework.Api.Unit;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
{
|
||||
/// <summary>
|
||||
/// 应收应付
|
||||
/// 应收应付管理
|
||||
/// </summary>
|
||||
public class APController : ApiController
|
||||
{
|
||||
@@ -27,14 +29,16 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
/// <summary>
|
||||
/// 应收应付单据保存接口
|
||||
/// </summary>
|
||||
/// <param name="cAccId"></param>
|
||||
/// <param name="cCardNum"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="cSubId">模块号</param>
|
||||
/// <param name="input">报文</param>
|
||||
/// <param name="busDate">业务日期</param>
|
||||
/// <param name="bNeedBillClosed"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/AP/{cCardNum}/Save")]
|
||||
[Route("api/U8/AR/{cCardNum}/Save")]
|
||||
public async Task<BaseResult<dynamic>> Save(string cAccId, string cCardNum, [FromBody] Dictionary<string, object> input)
|
||||
[Route("api/U8/{cSubId}/{cCardNum}/Save")]
|
||||
public async Task<BaseResult<string>> Save(string cAccId, string cCardNum, string cSubId, [FromBody] Dictionary<string, object> input, string busDate="", bool bNeedBillClosed = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -42,7 +46,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
{
|
||||
case "AP03":
|
||||
case "AR03":
|
||||
return await ApNoteSave(cAccId, cCardNum, input);
|
||||
return await ApNote_Save(cAccId, cSubId, input,busDate, bNeedBillClosed);
|
||||
case "AP48":
|
||||
case "AP49":
|
||||
case "AR48":
|
||||
@@ -57,7 +61,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<dynamic> { bSuccess = false, message = ex.Message, result = ex.StackTrace };
|
||||
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,7 +76,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
[HttpPost]
|
||||
[Route("api/U8/AP/{cCardNum}/CloseBillSave")]
|
||||
[Route("api/U8/AR/{cCardNum}/CloseBillSave")]
|
||||
public async Task<BaseResult<dynamic>> CloseBillSave(string cAccId, string cCardNum, [FromBody] Dictionary<string, object> input)
|
||||
public async Task<BaseResult<string>> CloseBillSave(string cAccId, string cCardNum, [FromBody] Dictionary<string, object> input)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -121,7 +125,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<dynamic> { bSuccess = false, message = ex.Message, result = ex.StackTrace };
|
||||
return new BaseResult<string> { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -135,7 +139,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
[HttpPost]
|
||||
[Route("api/U8/AR/AP48/Save")]
|
||||
[Route("api/U8/AR/AP49/Save")]
|
||||
public async Task<BaseResult<dynamic>> AP48Save(string cAccId, [FromBody] Dictionary<string, object> input)
|
||||
public async Task<BaseResult<string>> AP48Save(string cAccId, [FromBody] Dictionary<string, object> input)
|
||||
{
|
||||
return await CloseBillSave(cAccId, "AP48", input);
|
||||
}
|
||||
@@ -149,7 +153,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
[HttpPost]
|
||||
[Route("api/U8/AP/AP49/Save")]
|
||||
[Route("api/U8/AP/AP49/Save")]
|
||||
public async Task<BaseResult<dynamic>> AP49Save(string cAccId, [FromBody] Dictionary<string, object> input)
|
||||
public async Task<BaseResult<string>> AP49Save(string cAccId, [FromBody] Dictionary<string, object> input)
|
||||
{
|
||||
return await CloseBillSave(cAccId, "AP49", input);
|
||||
}
|
||||
@@ -158,30 +162,19 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
/// 票据保存
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="cSubId">模块号</param>
|
||||
/// <param name="busDate">业务日期</param>
|
||||
/// <param name="input">报文数据</param>
|
||||
/// <param name="bNeedBillClosed"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/AP/{cCardNum}/ApNoteSave")]
|
||||
[Route("api/U8/AR/{cCardNum}/ApNoteSave")]
|
||||
public async Task<BaseResult<dynamic>> ApNoteSave(string cAccId, string cCardNum, [FromBody] Dictionary<string, object> input)
|
||||
[Route("api/U8/{cSubId}/RP03/NoteSave")]
|
||||
public async Task<BaseResult<string>> ApNote_Save(string cAccId, string cSubId, [FromBody] Dictionary<string, object> input, string busDate="",bool bNeedBillClosed=false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var subId = "";
|
||||
|
||||
if (cCardNum == "AR03")
|
||||
{
|
||||
subId = "AR";
|
||||
}
|
||||
|
||||
if (cCardNum == "AP03")
|
||||
{
|
||||
subId = "AP";
|
||||
}
|
||||
|
||||
|
||||
if (!_cache.TryGetValue($"U8AP_{cAccId}_{subId}", out BaseLogin baseLogin))
|
||||
if (!_cache.TryGetValue($"U8AP_{cAccId}", out BaseLogin baseLogin))
|
||||
{
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
@@ -192,60 +185,44 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
param.pSubId = subId;
|
||||
var curDate = Convert.ToDateTime(string.IsNullOrWhiteSpace(busDate) ? $"{DateTime.Today:yyyy-MM-dd}" : busDate);
|
||||
|
||||
param.pDate = $"{curDate:yyyy-MM-dd}";
|
||||
param.pYearId = $"{curDate.Year}";
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Set($"U8AP_{cAccId}_{subId}", baseLogin);
|
||||
_cache.Set($"U8AP_{cAccId}", baseLogin);
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrWhiteSpace(subId))
|
||||
throw new Exception("单据标识不正确");
|
||||
//if (string.IsNullOrWhiteSpace(cSubId))
|
||||
// throw new Exception("单据标识不正确");
|
||||
|
||||
var bo = new UFAPBO();
|
||||
if (cSubId == "AP")
|
||||
{
|
||||
var bo = new NoteManageAP();
|
||||
|
||||
var res = bo.ApNoteSave(baseLogin, input, subId);
|
||||
var res =await bo.NoteSave(baseLogin, input, bNeedBillClosed);
|
||||
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
var bo = new NoteManageAR();
|
||||
|
||||
var res = await bo.NoteSave(baseLogin, input, bNeedBillClosed);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<dynamic> { bSuccess = false, message = ex.Message, result = ex.StackTrace };
|
||||
return new BaseResult<string> { bSuccess = false, message ="保存失败", result = ex.Message };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 票据保存
|
||||
/// </summary>
|
||||
/// <param name="cAccId"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/AP/AP03/Save")]
|
||||
public async Task<BaseResult<dynamic>> AP03Save(string cAccId, [FromBody] Dictionary<string, object> input)
|
||||
{
|
||||
return await ApNoteSave(cAccId, "AP03", input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 票据保存
|
||||
/// </summary>
|
||||
/// <param name="cAccId"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/AR/AR03/Save")]
|
||||
public async Task<BaseResult<dynamic>> AR03Save(string cAccId, [FromBody] Dictionary<string, object> input)
|
||||
{
|
||||
return await ApNoteSave(cAccId, "AR03", input);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,842 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using log4net;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using SqlSugar;
|
||||
using UFIDA.U8.Framework.Api.Common.Entity;
|
||||
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.PU;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.ST;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||
using UFIDA.U8.Framework.Api.Models;
|
||||
using UFIDA.U8.Framework.Api.Unit;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
{
|
||||
/// <summary>
|
||||
/// 采购管理
|
||||
/// </summary>
|
||||
public class PUController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
/// 日志组件
|
||||
/// </summary>
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
private static readonly MemoryCache _cache = new MemoryCache(new MemoryCacheOptions { ExpirationScanFrequency = TimeSpan.FromMinutes(10) });
|
||||
|
||||
/// <summary>
|
||||
/// 保存单据
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="input">报文</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="VoucherState">单据状态:2新增,1修改,0非编辑</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
[HttpPost]
|
||||
[Route("api/U8/PU/{cCardNum}/VoucherSave")]
|
||||
public async Task<BaseResult<string>> VoucherSave(string cAccId, string cCardNum, [FromBody] Dictionary<string, object> input, bool bPositive = true, string sBillType = null, string sBusType = "", int VoucherState = 2, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:新增,对接账套:{cAccId},数据:{input.ToJson()}");
|
||||
|
||||
//LoginParamter param;
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// param = await CommUnit.GetLoginParamter(cAccId);
|
||||
//}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var defs = await db.Queryable<SysU8FieldDefine>().Where(s => s.CardNumber == cCardNum && s.cPosition == "H" && s.bEnable == true).ToListAsync(); //查询表头字段配置,供后续设置字段值
|
||||
|
||||
|
||||
var newNumber = "";
|
||||
var bGetCode = false;
|
||||
var codeKey = "";
|
||||
|
||||
if (defs.Any(a => a.bDefault == true && a.cPosition == "H" && a.DefaultValue == "单号" && a.bEnable == true))
|
||||
{
|
||||
bGetCode = true;
|
||||
codeKey = defs.Where(a => a.bDefault == true && a.cPosition == "H" && a.DefaultValue == "单号" && a.bEnable == true).Select(a => a.FieldName).First();
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----配置获取单号");
|
||||
}
|
||||
else
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----没有单号需要自动指定");
|
||||
}
|
||||
|
||||
#region 调整日期,去掉时间部分
|
||||
|
||||
if (input.ContainsKey("ddate"))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----调整日期,去掉时间部分");
|
||||
input["ddate"] = $"{Convert.ToDateTime(input["ddate"]):yyyy-MM-dd}";
|
||||
}
|
||||
|
||||
if (input.ContainsKey("dtvdate"))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----调整日期,去掉时间部分");
|
||||
input["dtvdate"] = $"{Convert.ToDateTime(input["dtvdate"]):yyyy-MM-dd}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
logInfo.Debug($"作业Id:{workId}-----设置表头数据");
|
||||
input.SetDictionaryData(defs, baseLogin.Connection, newNumber);
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----读取表体数据");
|
||||
var bodyData = input[voucherInfo.BodyName].ToJson().ToList<Dictionary<string, object>>(); //读取表体的数据
|
||||
|
||||
if (bodyData == null || bodyData.Count <= 0)
|
||||
throw new Exception("无表体数据!");
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----获取表体字段配置");
|
||||
var defsBody = await db.Queryable<SysU8FieldDefine>().Where(s => s.CardNumber == cCardNum && s.cPosition == "B" && s.bEnable == true).ToListAsync(); //获取表体的字段配置
|
||||
|
||||
var rowNo = 1;
|
||||
|
||||
foreach (var body in bodyData)
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----设置第{rowNo}行单据数据");
|
||||
body.SetDictionaryData(defsBody, baseLogin.Connection, newNumber, rowNo);
|
||||
|
||||
rowNo++;
|
||||
}
|
||||
|
||||
input[voucherInfo.BodyName] = bodyData;
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
var res = await co.VoucherSave(baseLogin, input, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), bPositive, sBillType, sBusType, VoucherState, UserMode, sOverDetailsXml, bGetCode, codeKey, voucherInfo.bVerify, voucherInfo.bPrintDom);
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = ex.Message, result = ex.StackTrace };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核单据(单号)
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="cCode">单号</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("api/U8/PU/{cCardNum}/Confirm/Code")]
|
||||
public async Task<BaseResult<string>> Confirm(string cAccId, string cCardNum, string cCode, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:审核,对接账套:{cAccId},单号:{cCode}");
|
||||
|
||||
//LoginParamter param;
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin) || baseLogin == null)
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// param = await CommUnit.GetLoginParamter(cAccId);
|
||||
//}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
return await co.Confirm(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), cCode, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "审核失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核单据(ID)
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="voucherId">单据ID</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("api/U8/PU/{cCardNum}/Confirm/ID")]
|
||||
public async Task<BaseResult<string>> Confirm(string cAccId, string cCardNum, long voucherId, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:审核,对接账套:{cAccId},ID:{voucherId}");
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
return await co.Confirm(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), voucherId, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "审核失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核单据(批量)
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="input">报文</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/PU/{cCardNum}/Confirm")]
|
||||
public async Task<BaseResult<List<BaseResult<string>>>> Confirm(string cAccId, string cCardNum, [FromBody] STInput input, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
if (input == null)
|
||||
{
|
||||
throw new Exception("参数不能为空");
|
||||
}
|
||||
|
||||
var cCodes = input.cCode;
|
||||
|
||||
var voucherIds = input.voucherId;
|
||||
|
||||
if ((cCodes == null || cCodes.Count <= 0) && (voucherIds == null || voucherIds.Count <= 0))
|
||||
{
|
||||
throw new Exception("没有数据需要审核");
|
||||
}
|
||||
|
||||
var strCode = "";
|
||||
var strId = "";
|
||||
|
||||
var apiType = cCodes == null || cCodes.Count <= 0 ? 1 : 0;
|
||||
|
||||
if (cCodes != null && cCodes.Count > 0)
|
||||
{
|
||||
strCode = string.Join(",", cCodes);
|
||||
}
|
||||
|
||||
if (voucherIds != null && voucherIds.Count > 0)
|
||||
{
|
||||
strId = string.Join(",", voucherIds);
|
||||
}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:审核,对接账套:{cAccId},单号:{strCode},ID:{strId}");
|
||||
|
||||
//LoginParamter param;
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// param = await CommUnit.GetLoginParamter(cAccId);
|
||||
//}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
var result = apiType == 0
|
||||
? await co.Confirm(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), cCodes, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml)
|
||||
: await co.Confirm(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), voucherIds, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var res = new BaseResult<List<BaseResult<string>>>()
|
||||
{
|
||||
bSuccess = true,
|
||||
message = "审核完成",
|
||||
result = result
|
||||
};
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<List<BaseResult<string>>> { bSuccess = false, message = ex.Message, result = null };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 弃审单据(单号)
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="cCode">单号</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("api/U8/PU/{cCardNum}/CancelConfirm/Code")]
|
||||
public async Task<BaseResult<string>> CancelConfirm(string cAccId, string cCardNum, string cCode, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:弃审,对接账套:{cAccId},单号:{cCode}");
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin) || baseLogin == null)
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
return await co.CancelConfirm(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), cCode, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "弃审失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 弃审单据(ID)
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="voucherId">单据ID</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("api/U8/PU/{cCardNum}/CancelConfirm/ID")]
|
||||
public async Task<BaseResult<string>> CancelConfirm(string cAccId, string cCardNum, long voucherId, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:弃审,对接账套:{cAccId},ID:{voucherId}");
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
return await co.CancelConfirm(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), voucherId, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "弃审失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 弃审单据(批量)
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="input">报文</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/PU/{cCardNum}/CancelConfirm")]
|
||||
public async Task<BaseResult<List<BaseResult<string>>>> CancelConfirm(string cAccId, string cCardNum, [FromBody] STInput input, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
if (input == null)
|
||||
{
|
||||
throw new Exception("参数不能为空");
|
||||
}
|
||||
|
||||
var cCodes = input.cCode;
|
||||
|
||||
var voucherIds = input.voucherId;
|
||||
|
||||
if ((cCodes == null || cCodes.Count <= 0) && (voucherIds == null || voucherIds.Count <= 0))
|
||||
{
|
||||
throw new Exception("没有数据需要弃审");
|
||||
}
|
||||
|
||||
var strCode = "";
|
||||
var strId = "";
|
||||
|
||||
var apiType = cCodes == null || cCodes.Count <= 0 ? 1 : 0;
|
||||
|
||||
if (cCodes != null && cCodes.Count > 0)
|
||||
{
|
||||
strCode = string.Join(",", cCodes);
|
||||
}
|
||||
|
||||
if (voucherIds != null && voucherIds.Count > 0)
|
||||
{
|
||||
strId = string.Join(",", voucherIds);
|
||||
}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:弃审,对接账套:{cAccId},单号:{strCode},ID:{strId}");
|
||||
|
||||
//LoginParamter param;
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// param = await CommUnit.GetLoginParamter(cAccId);
|
||||
//}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
var result = apiType == 0
|
||||
? await co.CancelConfirm(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), cCodes, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml)
|
||||
: await co.CancelConfirm(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), voucherIds, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var res = new BaseResult<List<BaseResult<string>>>()
|
||||
{
|
||||
bSuccess = true,
|
||||
message = "弃审完成",
|
||||
result = result
|
||||
};
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<List<BaseResult<string>>> { bSuccess = false, message = ex.Message, result = null };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除单据(单号)
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="cCode">单号</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("api/U8/PU/{cCardNum}/Delete/Code")]
|
||||
public async Task<BaseResult<string>> Delete(string cAccId, string cCardNum, string cCode, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:删除,对接账套:{cAccId},单号:{cCode}");
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin) || baseLogin == null)
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
return await co.Delete(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), cCode, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "删除失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除单据(ID)
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="voucherId">单据ID</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("api/U8/PU/{cCardNum}/Delete/ID")]
|
||||
public async Task<BaseResult<string>> Delete(string cAccId, string cCardNum, long voucherId, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:删除,对接账套:{cAccId},ID:{voucherId}");
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
return await co.Delete(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), voucherId, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "删除失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除单据(批量)
|
||||
/// </summary>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="input">报文</param>
|
||||
/// <param name="bPositive">红蓝标识:True,蓝字</param>
|
||||
/// <param name="sBillType">发票类型(普通发票 ppurbill,专用发票 purbill,运费发票 ypurbill);到货单类型(到货单 0,退货单 1,拒收单 2)</param>
|
||||
/// <param name="sBusType">业务类型:普通采购,直运采购,受托代销</param>
|
||||
/// <param name="UserMode">CS 0,BS 1;一般CS</param>
|
||||
/// <param name="sOverDetailsXml">为空</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/PU/{cCardNum}/Delete")]
|
||||
public async Task<BaseResult<List<BaseResult<string>>>> Delete(string cAccId, string cCardNum, [FromBody] STInput input, bool bPositive = true, string sBillType = null, string sBusType = null, UseMode UserMode = UseMode.CS, string sOverDetailsXml = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
if (input == null)
|
||||
{
|
||||
throw new Exception("参数不能为空");
|
||||
}
|
||||
|
||||
var cCodes = input.cCode;
|
||||
|
||||
var voucherIds = input.voucherId;
|
||||
|
||||
if ((cCodes == null || cCodes.Count <= 0) && (voucherIds == null || voucherIds.Count <= 0))
|
||||
{
|
||||
throw new Exception("没有数据需要弃审");
|
||||
}
|
||||
|
||||
var strCode = "";
|
||||
var strId = "";
|
||||
|
||||
var apiType = cCodes == null || cCodes.Count <= 0 ? 1 : 0;
|
||||
|
||||
if (cCodes != null && cCodes.Count > 0)
|
||||
{
|
||||
strCode = string.Join(",", cCodes);
|
||||
}
|
||||
|
||||
if (voucherIds != null && voucherIds.Count > 0)
|
||||
{
|
||||
strId = string.Join(",", voucherIds);
|
||||
}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:删除,对接账套:{cAccId},单号:{strCode},ID:{strId}");
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
throw new Exception("未能加载指定系统号的登录信息");
|
||||
}
|
||||
|
||||
baseLogin.Init(param, false);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{cAccId}", baseLogin);
|
||||
}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var co = new clsVoucherCO_PU();
|
||||
|
||||
var result = apiType == 0
|
||||
? await co.Delete(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), cCodes, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml)
|
||||
: await co.Delete(baseLogin, cCardNum, (vouchertype)Convert.ToInt32(voucherInfo.VoucherType), voucherIds, bPositive, sBillType, sBusType, UserMode, sOverDetailsXml);
|
||||
|
||||
var res = new BaseResult<List<BaseResult<string>>>()
|
||||
{
|
||||
bSuccess = true,
|
||||
message = "删除完成",
|
||||
result = result
|
||||
};
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<List<BaseResult<string>>> { bSuccess = false, message = ex.Message, result = null };
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -253,6 +253,228 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 修改单据
|
||||
///// </summary>
|
||||
///// <param name="cAccId">系统号</param>
|
||||
///// <param name="cCardNum">单据类型编码</param>
|
||||
///// <param name="input">报文</param>
|
||||
///// <param name="bCheck">是否控制可用量</param>
|
||||
///// <param name="bBeforCheckStock">是否检查可用量</param>
|
||||
///// <param name="bIsRedVouch">是否红字单据</param>
|
||||
///// <param name="sAddedState">传空字符串</param>
|
||||
///// <param name="bReMote">是否远程</param>
|
||||
///// <returns></returns>
|
||||
//[HttpPost]
|
||||
//[Route("api/U8/ST/{cCardNum}/Update")]
|
||||
//public async Task<BaseResult<string>> Update(string cAccId, string cCardNum, [FromBody] Dictionary<string, object> input, bool bCheck = true, bool bBeforCheckStock = true, bool bIsRedVouch = false, string sAddedState = "", bool bReMote = false)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// var db = CommUnit.GetDbClient();
|
||||
|
||||
// var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
// logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:修改,对接账套:{cAccId},数据:{input.ToJson()}");
|
||||
|
||||
// //LoginParamter param;
|
||||
|
||||
// if (!_cache.TryGetValue($"U8_{cAccId}", out BaseLogin baseLogin))
|
||||
// {
|
||||
// logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
// baseLogin = new BaseLogin();
|
||||
|
||||
// var param = await CommUnit.GetLoginParamter(cAccId);
|
||||
|
||||
// if (param == null)
|
||||
// {
|
||||
// throw new Exception("未能加载指定系统号的登录信息");
|
||||
// }
|
||||
|
||||
// baseLogin.Init(param, false);
|
||||
|
||||
// _cache.Clear();
|
||||
|
||||
// _cache.Set($"U8_{cAccId}", baseLogin);
|
||||
// }
|
||||
// //else
|
||||
// //{
|
||||
// // param = await CommUnit.GetLoginParamter(cAccId);
|
||||
// //}
|
||||
|
||||
// logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
// var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
// var defs = await db.Queryable<SysU8FieldDefine>().Where(s => s.CardNumber == cCardNum && s.cPosition == "H" && s.bEnable == true).ToListAsync(); //查询表头字段配置,供后续设置字段值
|
||||
|
||||
// var dateKey = "";
|
||||
// var exchKey = "";
|
||||
// if (defs.Any(a => a.bDate == true && a.cPosition == "H"))
|
||||
// dateKey = defs.Where(a => a.bDate == true && a.cPosition == "H").Select(a => a.FieldName).First();
|
||||
|
||||
// if (defs.Any(a => a.bPrice == true && a.cPosition == "H"))
|
||||
// exchKey = defs.Where(a => a.bPrice == true && a.cPosition == "H").Select(a => a.FieldName).First();
|
||||
|
||||
// var dDate = DateTime.Today;
|
||||
// if (!string.IsNullOrWhiteSpace(dateKey))
|
||||
// {
|
||||
// if (!DateTime.TryParse($"{input[dateKey]}", out dDate))
|
||||
// {
|
||||
// dDate = DateTime.Today;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Exch exch;
|
||||
|
||||
// if (!string.IsNullOrWhiteSpace(exchKey) && input.TryGetValue(exchKey, out var value))
|
||||
// {
|
||||
// exch = CommonHelper.GetExch(dDate, cAccId, $"{value}", baseLogin.Connection);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// exch = null;
|
||||
// }
|
||||
|
||||
|
||||
// var newNumber = "";
|
||||
// var bGetCode = false;
|
||||
// var codeKey = "";
|
||||
|
||||
// if (defs.Any(a => a.bDefault == true && a.cPosition == "H" && a.DefaultValue == "单号" && a.bEnable == true))
|
||||
// {
|
||||
// bGetCode = true;
|
||||
// codeKey = defs
|
||||
// .Where(a => a.bDefault == true && a.cPosition == "H" && a.DefaultValue == "单号" &&
|
||||
// a.bEnable == true).Select(a => a.FieldName).First();
|
||||
|
||||
// logInfo.Debug($"作业Id:{workId}-----配置获取单号");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// logInfo.Debug($"作业Id:{workId}-----没有单号需要自动指定");
|
||||
// }
|
||||
|
||||
// #region 调整日期,去掉时间部分
|
||||
|
||||
// if (input.ContainsKey("ddate"))
|
||||
// {
|
||||
// logInfo.Debug($"作业Id:{workId}-----调整日期,去掉时间部分");
|
||||
// input["ddate"] = $"{Convert.ToDateTime(input["ddate"]):yyyy-MM-dd}";
|
||||
// }
|
||||
|
||||
// if (input.ContainsKey("dtvdate"))
|
||||
// {
|
||||
// logInfo.Debug($"作业Id:{workId}-----调整日期,去掉时间部分");
|
||||
// input["dtvdate"] = $"{Convert.ToDateTime(input["dtvdate"]):yyyy-MM-dd}";
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
// logInfo.Debug($"作业Id:{workId}-----设置表头数据");
|
||||
// input.SetDictionaryData(defs, baseLogin.Connection, newNumber, 1, exch);
|
||||
|
||||
// logInfo.Debug($"作业Id:{workId}-----读取表体数据");
|
||||
// var bodyData = input[voucherInfo.BodyName].ToJson().ToList<Dictionary<string, object>>(); //读取表体的数据
|
||||
|
||||
// if (bodyData == null || bodyData.Count <= 0)
|
||||
// throw new Exception("无表体数据!");
|
||||
|
||||
// logInfo.Debug($"作业Id:{workId}-----获取表体字段配置");
|
||||
// var defsBody = await db.Queryable<SysU8FieldDefine>().Where(s => s.CardNumber == cCardNum && s.cPosition == "B" && s.bEnable == true).ToListAsync(); //获取表体的字段配置
|
||||
|
||||
// var rowNo = 1;
|
||||
|
||||
// foreach (var body in bodyData)
|
||||
// {
|
||||
// logInfo.Debug($"作业Id:{workId}-----设置第{rowNo}行单据数据");
|
||||
// body.SetDictionaryData(defsBody, baseLogin.Connection, newNumber, rowNo, exch);
|
||||
|
||||
// rowNo++;
|
||||
|
||||
// // 根据存货档案是否批次管理调整批次号
|
||||
// if (body.ContainsKey("binvbatch") && body.ContainsKey("cbatch"))
|
||||
// {
|
||||
// logInfo.Debug($"作业Id:{workId}-----第{rowNo}行根据存货档案是否批次管理调整批次号");
|
||||
// if (body["binvbatch"] == null || body["binvbatch"] == DBNull.Value || !body["binvbatch"].ToBoolean())
|
||||
// {
|
||||
// body["cbatch"] = "";
|
||||
// }
|
||||
// }
|
||||
|
||||
// // 根据存货档案是否批次管理调整批次号(调拨单)
|
||||
// if (body.ContainsKey("binvbatch") && body.ContainsKey("ctvbatch"))
|
||||
// {
|
||||
// logInfo.Debug($"作业Id:{workId}-----第{rowNo}行根据存货档案是否批次管理调整批次号(调拨单)");
|
||||
// if (body["binvbatch"] == null || body["binvbatch"] == DBNull.Value || !body["binvbatch"].ToBoolean())
|
||||
// {
|
||||
// body["ctvbatch"] = "";
|
||||
// }
|
||||
// }
|
||||
|
||||
// // 根据存货档案是否保质期管理调整生产日期和失效日期
|
||||
// if (body.ContainsKey("binvquality") && body.ContainsKey("dmadedate"))
|
||||
// {
|
||||
// logInfo.Debug($"作业Id:{workId}-----第{rowNo}行根据存货档案是否保质期管理调整生产日期和失效日期");
|
||||
|
||||
// if (body["binvquality"] == null || body["binvquality"] == DBNull.Value || !body["binvquality"].ToBoolean())
|
||||
// {
|
||||
// if (cCardNum == "0304")
|
||||
// {
|
||||
// body["dmadedate"] = "";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// body["dmadedate"] = "";
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (body.ContainsKey("cmassunit") && body.ContainsKey("imassdate"))
|
||||
// {
|
||||
// switch ($"{body["cmassunit"]}")
|
||||
// {
|
||||
// case "1" when cCardNum != "0304":
|
||||
// body["dvdate"] = $"{Convert.ToDateTime(body["dmadedate"]).AddYears(Convert.ToInt32(body["imassdate"])):yyyy-MM-dd HH:MM:ss}";
|
||||
// break;
|
||||
// case "1" when cCardNum == "0304":
|
||||
// body["ddisdate"] = $"{Convert.ToDateTime(body["dmadedate"]).AddYears(Convert.ToInt32(body["imassdate"])):yyyy-MM-dd HH:MM:ss}";
|
||||
// break;
|
||||
// case "2" when cCardNum != "0304":
|
||||
// body["dvdate"] = $"{Convert.ToDateTime(body["dmadedate"]).AddMonths(Convert.ToInt32(body["imassdate"])):yyyy-MM-dd HH:MM:ss}";
|
||||
// break;
|
||||
// case "2" when cCardNum == "0304":
|
||||
// body["ddisdate"] = $"{Convert.ToDateTime(body["dmadedate"]).AddMonths(Convert.ToInt32(body["imassdate"])):yyyy-MM-dd HH:MM:ss}";
|
||||
// break;
|
||||
// case "3" when cCardNum != "0304":
|
||||
// body["dvdate"] = $"{Convert.ToDateTime(body["dmadedate"]).AddDays(Convert.ToInt32(body["imassdate"])):yyyy-MM-dd HH:MM:ss}";
|
||||
// break;
|
||||
// case "3" when cCardNum == "0304":
|
||||
// body["ddisdate"] = $"{Convert.ToDateTime(body["dmadedate"]).AddDays(Convert.ToInt32(body["imassdate"])):yyyy-MM-dd HH:MM:ss}";
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// input[voucherInfo.BodyName] = bodyData;
|
||||
|
||||
// var co = new USERPCO();
|
||||
|
||||
// var res = await co.Update(baseLogin, input, cCardNum, voucherInfo.VoucherType, bCheck, bBeforCheckStock, bIsRedVouch, sAddedState, bReMote, voucherInfo.bVerify, voucherInfo.bPrintDom);
|
||||
|
||||
// return res;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// logInfo.Error(ex.Message, ex);
|
||||
|
||||
// return new BaseResult<string> { bSuccess = false, message = ex.Message, result = ex.StackTrace };
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 审核单据(单号)
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using log4net;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
{
|
||||
/// <summary>
|
||||
/// 审批流
|
||||
/// </summary>
|
||||
public class WorkflowController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
/// 日志组件
|
||||
/// </summary>
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
private static readonly MemoryCache _cache = new MemoryCache(new MemoryCacheOptions { ExpirationScanFrequency = TimeSpan.FromMinutes(10) });
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -415,8 +415,10 @@
|
||||
<Compile Include="Controllers\U8\APController.cs" />
|
||||
<Compile Include="Controllers\U8\DPController.cs" />
|
||||
<Compile Include="Controllers\U8\MOController.cs" />
|
||||
<Compile Include="Controllers\U8\PUController.cs" />
|
||||
<Compile Include="Controllers\U8\SFCController.cs" />
|
||||
<Compile Include="Controllers\U8\STController.cs" />
|
||||
<Compile Include="Controllers\U8\WorkflowController.cs" />
|
||||
<Compile Include="Global.asax.cs">
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
@@ -482,6 +484,7 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="App_Data\采购入库单模板.json" />
|
||||
<Content Include="App_Data\票据录入模板.json" />
|
||||
<None Include="Oracle.DataAccess.Common.Configuration.Section.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<add key="RequireExpirationTime" value="true" />
|
||||
<add key="ConnectionString" value="041e16f920938aada7a1017c9ade8790c34f8e781477c7397b5364847c977e506986760c37fbceb708864e688103e19850cef5ded5cbcb5477d8ed6ee7e8be249f3084e9a9be1fbc9a1e3df9de13040f3c93206ade3235f467eec9f2187e13916bf1f3d1311f82fd1cf226f61ab7df9863a710ea916a" />
|
||||
<add key="DbType" value="Sqlite" />
|
||||
<add key="ServerAddress" value="update.qmjtz.com" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.8" />
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebUpdate.Entity
|
||||
{
|
||||
public class UpdateInfo
|
||||
{
|
||||
public DateTime LastUpdateTime { get; set; }
|
||||
public List<FilesInfo> Files { get; set; }
|
||||
}
|
||||
|
||||
public class FilesInfo
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
|
||||
public string Version { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
||||
namespace WebUpdate
|
||||
{
|
||||
public static class JsonHelper
|
||||
{
|
||||
public static object ToJson(this string Json)
|
||||
{
|
||||
return Json == null ? null : JsonConvert.DeserializeObject(Json);
|
||||
}
|
||||
public static string ToJson(this object obj)
|
||||
{
|
||||
var timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
|
||||
return JsonConvert.SerializeObject(obj, timeConverter);
|
||||
}
|
||||
|
||||
public static string ToJson(this object obj, string datetimeformats)
|
||||
{
|
||||
var timeConverter = new IsoDateTimeConverter { DateTimeFormat = datetimeformats };
|
||||
return JsonConvert.SerializeObject(obj, timeConverter);
|
||||
}
|
||||
public static T ToObject<T>(this string Json)
|
||||
{
|
||||
return Json == null ? default : JsonConvert.DeserializeObject<T>(Json);
|
||||
}
|
||||
public static List<T> ToList<T>(this string Json)
|
||||
{
|
||||
return Json == null ? null : JsonConvert.DeserializeObject<List<T>>(Json);
|
||||
}
|
||||
public static DataTable ToTable(this string Json)
|
||||
{
|
||||
return Json == null ? null : JsonConvert.DeserializeObject<DataTable>(Json);
|
||||
}
|
||||
public static JObject ToJObject(this string Json)
|
||||
{
|
||||
return JObject.Parse(Json.Replace(" ", ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WebUpdate.Entity;
|
||||
|
||||
namespace WebUpdate
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var fielInfoPath= Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "update.json");
|
||||
var updateInfo = new UpdateInfo();
|
||||
|
||||
|
||||
if (File.Exists(fielInfoPath))
|
||||
{
|
||||
var files= File.ReadAllText(fielInfoPath);
|
||||
updateInfo = files.ToObject<UpdateInfo>();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("WebUpdate")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("WebUpdate")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2025")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("7861f8d1-f5a9-4ae5-9e60-1772d2b4a074")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7861F8D1-F5A9-4AE5-9E60-1772D2B4A074}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>WebUpdate</RootNamespace>
|
||||
<AssemblyName>WebUpdate</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Entity\UpdateInfo.cs" />
|
||||
<Compile Include="JsonHelper.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user