提交
This commit is contained in:
@@ -3,7 +3,9 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using ADODB;
|
||||
using MSXML2;
|
||||
using NoteManageAR;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Common;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Json;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Models;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||
|
||||
@@ -17,6 +19,16 @@ namespace UFIDA.U8.Framework.Api.ControlObject.AP
|
||||
{
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
/// <summary>
|
||||
/// 收付款单保存
|
||||
/// </summary>
|
||||
/// <param name="baseLogin">登录对象</param>
|
||||
/// <param name="dictionary">单据数据</param>
|
||||
/// <param name="cSubId">子系统Id</param>
|
||||
/// <param name="isAdd">是否新增</param>
|
||||
/// <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")
|
||||
{
|
||||
try
|
||||
@@ -65,5 +77,212 @@ namespace UFIDA.U8.Framework.Api.ControlObject.AP
|
||||
return new BaseResult<dynamic> { bSuccess = false, message = "保存失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 收付款单审核
|
||||
/// </summary>
|
||||
/// <param name="baseLogin">登录对象</param>
|
||||
/// <param name="cLink">单号</param>
|
||||
/// <param name="cVouchType">单据类型</param>
|
||||
/// <param name="cVouchID">单据Id</param>
|
||||
/// <param name="cSubId">子系统Id</param>
|
||||
/// <param name="bFirst">是否期初</param>
|
||||
/// <returns></returns>
|
||||
public BaseResult<dynamic> CloseBillSign(BaseLogin baseLogin,string cLink,string cVouchType,string cVouchID, string cSubId, bool bFirst = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
IXMLDOMDocument2 oDom = new DOMDocument();
|
||||
|
||||
oDom.loadXML("<condition/>");
|
||||
|
||||
var oElm = oDom.documentElement;
|
||||
|
||||
oElm.setAttribute("type", 0);
|
||||
oElm.setAttribute("cLink", cLink);
|
||||
oElm.setAttribute("cVouchType", cVouchType);
|
||||
oElm.setAttribute("cVouchID", cVouchID);
|
||||
oElm.setAttribute("bFirst", bFirst);
|
||||
|
||||
var bo = "UFAPBO.clsCloseBill".GetComObject();
|
||||
|
||||
var m_Login = baseLogin._vbLogin;
|
||||
|
||||
var m_conn = new Connection();
|
||||
|
||||
m_conn.Open(m_Login.UfDbName);
|
||||
|
||||
bo.Init(m_Login, m_conn, null, cSubId);
|
||||
|
||||
var errorMessage = "";
|
||||
|
||||
var signFlag = bo.Sign(oElm.xml, ref errorMessage);
|
||||
|
||||
if (!signFlag)
|
||||
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 };
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 票据录入
|
||||
/// </summary>
|
||||
/// <param name="baseLogin">登录对象</param>
|
||||
/// <param name="dictionary">单据数据</param>
|
||||
/// <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)
|
||||
{
|
||||
try
|
||||
{
|
||||
var m_Login = baseLogin._vbLogin;
|
||||
|
||||
var domHead = dictionary.ToDocument2();
|
||||
|
||||
|
||||
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 = "保存成功" };
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//var ap= "UFAPBO.clsAccount_AP".GetComObject();
|
||||
|
||||
//var bo = "UFAPBO.clsApNote".GetComObject();
|
||||
|
||||
//var a=ap.Init(m_Login, cSubId);
|
||||
//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 m_conn = new Connection();
|
||||
|
||||
//m_conn.Open(m_Login.UfDbName);
|
||||
|
||||
//var d=bo.Init(m_Login);
|
||||
|
||||
//logInfo.Debug($"bo.Init:{d}");
|
||||
|
||||
//var errorMessage = "";
|
||||
|
||||
//var saveFlag = bo.SaveVouch(domHead, ref errorMessage);
|
||||
|
||||
//logInfo.Debug($"bo.SaveVouch:{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 };
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NoteManageAR;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.Common
|
||||
{
|
||||
public class APARHelper
|
||||
{
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
private readonly VoucherData _vd;
|
||||
private readonly PropertyInfo[] _props;
|
||||
|
||||
public APARHelper(VoucherDataClass vd)
|
||||
{
|
||||
_vd = vd;
|
||||
var tp = vd.GetType();
|
||||
_props = tp.GetProperties();
|
||||
}
|
||||
|
||||
public void SetValue(Dictionary<string, object> dictionary)
|
||||
{
|
||||
foreach (var key in dictionary.Keys)
|
||||
{
|
||||
if (key != "body")
|
||||
logInfo.Debug($"正在设置字段:{key}--{dictionary[key]}");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace($"{dictionary[key]}") && _props.Any(a => string.Equals(a.Name, key, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
var prop = _props.First(a => string.Equals(a.Name, key, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
prop.SetPropValue(_vd, dictionary[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SetPartId()
|
||||
{
|
||||
_be.SetPartId(_invCode, new[] { _free1, _free2, _free3, _free4, _free5, _free6, _free7, _free8, _free9, _free10 });
|
||||
|
||||
@@ -3,6 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using GetComObj;
|
||||
using MSXML2;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NoteManageAR;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Json;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.Common
|
||||
@@ -15,32 +17,172 @@ namespace UFIDA.U8.Framework.Api.ControlObject.Common
|
||||
if (prop.PropertyType == typeof(string))
|
||||
{
|
||||
prop.SetValue(obj, value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(DateTime))
|
||||
{
|
||||
prop.SetValue(obj, DateTime.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(byte))
|
||||
{
|
||||
prop.SetValue(obj, byte.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(int))
|
||||
{
|
||||
prop.SetValue(obj, int.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(long))
|
||||
{
|
||||
prop.SetValue(obj, long.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(decimal))
|
||||
{
|
||||
prop.SetValue(obj, decimal.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(double))
|
||||
{
|
||||
prop.SetValue(obj, double.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(float))
|
||||
{
|
||||
prop.SetValue(obj, float.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(short))
|
||||
{
|
||||
prop.SetValue(obj, short.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetPropValue(this PropertyInfo prop, VoucherData obj, object value)
|
||||
{
|
||||
if (prop.PropertyType == typeof(string))
|
||||
{
|
||||
prop.SetValue(obj, value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(DateTime))
|
||||
{
|
||||
prop.SetValue(obj, DateTime.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(byte))
|
||||
{
|
||||
prop.SetValue(obj, byte.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(int))
|
||||
{
|
||||
prop.SetValue(obj, int.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(long))
|
||||
{
|
||||
prop.SetValue(obj, long.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(decimal))
|
||||
{
|
||||
prop.SetValue(obj, decimal.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(double))
|
||||
{
|
||||
prop.SetValue(obj, double.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(float))
|
||||
{
|
||||
prop.SetValue(obj, float.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop.PropertyType == typeof(short))
|
||||
{
|
||||
prop.SetValue(obj, short.Parse($"{value}"));
|
||||
return;
|
||||
}
|
||||
|
||||
//if (prop.PropertyType == typeof(object))
|
||||
//{
|
||||
// switch (prop.Name)
|
||||
// {
|
||||
// case "cDefine1":
|
||||
// obj.set_cDefine1($"{value}");
|
||||
// break;
|
||||
// case "cDefine2":
|
||||
// obj.set_cDefine2($"{value}");
|
||||
// break;
|
||||
// case "cDefine3":
|
||||
// obj.set_cDefine3($"{value}");
|
||||
// break;
|
||||
// case "cDefine4":
|
||||
// obj.set_cDefine4(DateTime.Parse($"{value}"));
|
||||
// break;
|
||||
// case "cDefine5":
|
||||
// obj.set_cDefine5(int.Parse($"{value}"));
|
||||
// break;
|
||||
// case "cDefine6":
|
||||
// obj.set_cDefine6(DateTime.Parse($"{value}"));
|
||||
// break;
|
||||
// case "cDefine7":
|
||||
// obj.set_cDefine7(float.Parse($"{value}"));
|
||||
// break;
|
||||
// case "cDefine8":
|
||||
// obj.set_cDefine8($"{value}");
|
||||
// break;
|
||||
// case "cDefine9":
|
||||
// obj.set_cDefine9($"{value}");
|
||||
// break;
|
||||
// case "cDefine10":
|
||||
// obj.set_cDefine10($"{value}");
|
||||
// break;
|
||||
// case "cDefine11":
|
||||
// obj.set_cDefine11($"{value}");
|
||||
// break;
|
||||
// case "cDefine12":
|
||||
// obj.set_cDefine12($"{value}");
|
||||
// break;
|
||||
// case "cDefine13":
|
||||
// obj.set_cDefine13($"{value}");
|
||||
// break;
|
||||
// case "cDefine14":
|
||||
// obj.set_cDefine14($"{value}");
|
||||
// break;
|
||||
// case "cDefine15":
|
||||
// obj.set_cDefine15(int.Parse($"{value}"));
|
||||
// break;
|
||||
// case "cDefine16":
|
||||
// obj.set_cDefine16(float.Parse($"{value}"));
|
||||
// break;
|
||||
// default:
|
||||
// prop.SetValue(obj, $"{value}");
|
||||
// break;
|
||||
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
public static IXMLDOMDocument2 ToDocument2(this Dictionary<string,object> dictionary,IXMLDOMDocument2 domDocument2=null)
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
using log4net;
|
||||
using MSXML2;
|
||||
using NoteManageAR;
|
||||
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.Json;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Models;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||
using UFSoft.U8.SF.BE;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.ST
|
||||
{
|
||||
/// <summary>
|
||||
/// 库存管理
|
||||
/// </summary>
|
||||
public class USERPCO
|
||||
{
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
|
||||
public async Task<BaseResult<string>> Insert(BaseLogin baseLogin, Dictionary<string, object> dictionary,string sVouchType,bool bCheck=true,bool bBeforCheckStock=true,bool bIsRedVouch=false,string sAddedState="", bool bReMote=false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var co = "USERPCO.USERPCO".GetComObject();
|
||||
|
||||
var errorMsg = "";
|
||||
|
||||
if (!co.IniLogin(baseLogin._vbLogin, ref errorMsg))
|
||||
{
|
||||
await Task.Delay(1);
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
var domHead = dictionary.ToDocument2();
|
||||
|
||||
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("无法获取表体数据");
|
||||
}
|
||||
|
||||
|
||||
var domBody = dictionarys.ToDocument2();
|
||||
IXMLDOMDocument2 domPosition = new DOMDocument();
|
||||
IXMLDOMDocument2 domMsg = new DOMDocument();
|
||||
errorMsg = "";
|
||||
baseLogin.Connection.BeginTrans();
|
||||
var vouchId = "";
|
||||
|
||||
var res = new BaseResult<string>();
|
||||
try
|
||||
{
|
||||
res.bSuccess = co.Update(sVouchType, domHead, domBody, domPosition, ref errorMsg, baseLogin.Connection, ref vouchId, ref domMsg, bCheck, bBeforCheckStock, bIsRedVouch, sAddedState, bReMote);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
throw ex;
|
||||
}
|
||||
|
||||
if (!res.bSuccess)
|
||||
{
|
||||
res.message = "新增失败";
|
||||
res.result = errorMsg;
|
||||
}
|
||||
else
|
||||
{
|
||||
res.message = "新增成功";
|
||||
res.result = vouchId;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
//var bodys = dictionary.TryGetValue() dictionary["body"];
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "新增失败", result = ex.Message };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
var co = "USERPCO.VoucherCO".GetComObject();
|
||||
|
||||
var errorMsg = "";
|
||||
|
||||
if (!co.IniLogin(baseLogin._vbLogin, ref errorMsg))
|
||||
{
|
||||
await Task.Delay(1);
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
IXMLDOMDocument2 domHead = new DOMDocument();
|
||||
IXMLDOMDocument2 domBody = new DOMDocument();
|
||||
IXMLDOMDocument2 domPosition = new DOMDocument();
|
||||
errorMsg = "";
|
||||
if (!co.GetDefaultVoucherDom(sVouchType, sCardNum, ref domHead, ref domBody, ref domPosition, ref errorMsg))
|
||||
{
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
domHead = dictionary.ToDocument2(domHead);
|
||||
|
||||
var bodys = dictionary["body"] as List<Dictionary<string, object>> ?? $"{dictionary["body"]}".ToObject<List<Dictionary<string, object>>>();
|
||||
|
||||
if (bodys==null || bodys.Count<=0)
|
||||
{
|
||||
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("无法获取表体数据");
|
||||
//}
|
||||
|
||||
|
||||
domBody = bodys.ToDocument2(domBody);
|
||||
|
||||
IXMLDOMDocument2 domMsg = new DOMDocument();
|
||||
|
||||
errorMsg = "";
|
||||
baseLogin.Connection.BeginTrans();
|
||||
var vouchId = "";
|
||||
|
||||
var res = new BaseResult<string>();
|
||||
try
|
||||
{
|
||||
res.bSuccess = co.Update(sVouchType, domHead, domBody, domPosition);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
throw ex;
|
||||
}
|
||||
|
||||
if (!res.bSuccess)
|
||||
{
|
||||
baseLogin.Connection.RollbackTrans();
|
||||
res.message = "新增失败";
|
||||
res.result = errorMsg;
|
||||
}
|
||||
else
|
||||
{
|
||||
baseLogin.Connection.CommitTrans();
|
||||
res.message = "新增成功";
|
||||
res.result = vouchId;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
//var bodys = dictionary.TryGetValue() dictionary["body"];
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "新增失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,26 +10,32 @@ using ThreadContext = UFSoft.U8.Framework.ContextSrv.ThreadContext;
|
||||
using VBLogin = U8Login.clsLogin;
|
||||
// ReSharper disable IdentifierTypo
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable CommentTypo
|
||||
// ReSharper disable FieldCanBeMadeReadOnly.Local
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
{
|
||||
|
||||
public class BaseLogin
|
||||
{
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
|
||||
private NetLogin _netLogin { get; set; }
|
||||
public VBLogin _vbLogin { get; set; }
|
||||
static ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
public ProductContext _productContext { get; set; }
|
||||
|
||||
public Connection Connection { get; set; }
|
||||
public NetLogin _netLogin;
|
||||
|
||||
public VBLogin _vbLogin;
|
||||
|
||||
public ProductContext _productContext;
|
||||
|
||||
public Connection Connection;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化生产制造上下文
|
||||
/// </summary>
|
||||
/// <param name="paramter">登录参数</param>
|
||||
/// <param name="bMon"></param>
|
||||
/// <param name="traceTimes"></param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public void Init(LoginParamter paramter,bool bMon=true, int traceTimes=0)
|
||||
|
||||
@@ -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.Models;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
{
|
||||
public interface IBaseBF
|
||||
{
|
||||
BaseResult<string> Save(string cCardNum, Dictionary<string, object> input);
|
||||
|
||||
BaseResult<string> Save(string cCardNum, List<Dictionary<string, object>> inputs);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,9 @@ using UFSoft.U8.U8M.DOSchema.MO;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产订单
|
||||
/// </summary>
|
||||
public class MOrder
|
||||
{
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Reflection;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Common;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Json;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Models;
|
||||
using UFSoft.U8.Framework.BizBase;
|
||||
using UFSoft.U8.Framework.ContextSrv;
|
||||
using UFSoft.U8.U8M.BFDispatcher;
|
||||
using UFSoft.U8.U8M.Common;
|
||||
@@ -22,15 +23,19 @@ using UFSoft.U8.U8M.Exceptions;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
{
|
||||
|
||||
public class MoRoutingBill
|
||||
/// <summary>
|
||||
/// 报工单
|
||||
/// </summary>
|
||||
public class MoRoutingBill: IBaseBF
|
||||
{
|
||||
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
private IContextContainer callar { get; set; }
|
||||
|
||||
private MoRoutingBillDs GetEmptyDs(string cCardNum)
|
||||
{
|
||||
var ds = SFExecutor.BFMoRoutingBill_LoadData("LoadFirst", 0, "", cCardNum, new DefaultContextContainer());
|
||||
var ds = SFExecutor.BFMoRoutingBill_LoadData("LoadFirst", 0, "", cCardNum, callar);
|
||||
|
||||
#region 清除数据集里的数据
|
||||
|
||||
@@ -63,7 +68,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
|
||||
ds.MoRoutingBill.AddMoRoutingBillRow(head);
|
||||
|
||||
var docNo = U8MCommonExecutor.BFVoucher_GetVoucherID(cCardNum, docNoParam.Paramaters, false, new DefaultContextContainer());
|
||||
var docNo = U8MCommonExecutor.BFVoucher_GetVoucherID(cCardNum, docNoParam.Paramaters, false, callar);
|
||||
|
||||
var be = new UFSoft.U8.SF.BE.MoRoutingBill(ds);
|
||||
|
||||
@@ -98,14 +103,17 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
}
|
||||
|
||||
|
||||
|
||||
public BaseResult<string> Save(string cCardNum, Dictionary<string, object> input)
|
||||
{
|
||||
try
|
||||
{
|
||||
callar = new DefaultContextContainer();
|
||||
|
||||
var docNoParam = new AutoDocNoGenerateParam(EnumAutoDocNoType.HandAuto, cCardNum)
|
||||
{
|
||||
IsCurrentDocNoByHand = false
|
||||
};
|
||||
{
|
||||
IsCurrentDocNoByHand = false
|
||||
};
|
||||
|
||||
var ds = GetVoucherDs(cCardNum, docNoParam, input);
|
||||
|
||||
@@ -119,7 +127,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
|
||||
logInfo.Debug($"单据编码:{cCardNum},开始保存");
|
||||
|
||||
var id = SFExecutor.BFMoRoutingBill_MoRoutingBillSave(ds, docNoParam, new DefaultContextContainer());
|
||||
var id = SFExecutor.BFMoRoutingBill_MoRoutingBillSave(ds, docNoParam, callar);
|
||||
|
||||
|
||||
logInfo.Debug($"单据编码:{cCardNum},保存完成,id:{id}");
|
||||
@@ -139,8 +147,7 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
{
|
||||
logInfo.Error(ex.InnerException.Message, ex.InnerException);
|
||||
|
||||
return new BaseResult<string>
|
||||
{ bSuccess = false, message = "新增失败", result = ex.InnerException.Message };
|
||||
return new BaseResult<string> { bSuccess = false, message = "新增失败", result = ex.InnerException.Message };
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Common;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Json;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Models;
|
||||
using UFSoft.U8.Framework.BizBase;
|
||||
using UFSoft.U8.Framework.ContextSrv;
|
||||
using UFSoft.U8.U8M.BFDispatcher;
|
||||
using UFSoft.U8.U8M.Common;
|
||||
using UFSoft.U8.U8M.DOSchema.BO;
|
||||
using UFSoft.U8.U8M.DOSchema.SF;
|
||||
using UFSoft.U8.U8M.Exceptions;
|
||||
using UFSoft.U8.U8MCommon.GSetup;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
{
|
||||
/// <summary>
|
||||
/// 标准BOM
|
||||
/// </summary>
|
||||
public class StandardBom
|
||||
{
|
||||
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
|
||||
|
||||
private IContextContainer callar { get; set; }
|
||||
|
||||
public StandardBom()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private StandardBomDs GetEmptyDs()
|
||||
{
|
||||
var standardBomDs = new StandardBomDs();
|
||||
var standardBomRow = standardBomDs.StandardBom.NewStandardBomRow();
|
||||
standardBomRow.BomType = 1;
|
||||
standardBomRow.VersionEffDate = MParameters.Instance.DefaultVersionDate;
|
||||
standardBomRow.Status = (byte)MParameters.Instance.Options.BomDefaultStatus;
|
||||
standardBomDs.StandardBom.AddStandardBomRow(standardBomRow);
|
||||
var bomParentRow = standardBomDs.BomParent.NewBomParentRow();
|
||||
bomParentRow.BomId = standardBomRow.BomId;
|
||||
bomParentRow.AutoId = $"{Guid.NewGuid()}";
|
||||
standardBomDs.BomParent.AddBomParentRow(bomParentRow);
|
||||
return standardBomDs;
|
||||
}
|
||||
|
||||
private StandardBomDs GetVoucherDs(Dictionary<string, object> input)
|
||||
{
|
||||
var ds = GetEmptyDs();
|
||||
|
||||
var be = new UFSoft.U8.BO.BE.BomEntity(ds);
|
||||
|
||||
be.BomType = EnumBOMCatalogType.StandardBom;
|
||||
|
||||
var beHead = new BEHelper(be.Bom);
|
||||
|
||||
beHead.SetValue(input);
|
||||
|
||||
beHead.SetPartId();
|
||||
|
||||
var bodys = input["body"] as List<Dictionary<string, object>> ?? $"{input["body"]}".ToObject<List<Dictionary<string, object>>>();
|
||||
|
||||
for (var i = 0; i < bodys.Count; i++)
|
||||
{
|
||||
var body = bodys[i];
|
||||
var detail = be.Bom.Components[i];
|
||||
|
||||
var beBody = new BEHelper(detail);
|
||||
|
||||
beBody.SetValue(body);
|
||||
|
||||
beBody.SetPartId();
|
||||
}
|
||||
|
||||
return (StandardBomDs)be.InstanceBom.DataObject;
|
||||
}
|
||||
|
||||
public BaseResult<string> Save(Dictionary<string, object> input)
|
||||
{
|
||||
try
|
||||
{
|
||||
callar = new DefaultContextContainer();
|
||||
|
||||
var ds = GetVoucherDs(input);
|
||||
|
||||
if (ds == null)
|
||||
{
|
||||
throw new Exception("未能构建数据集");
|
||||
}
|
||||
|
||||
//var context = new DefaultContextContainer();
|
||||
//context.context["taskid"] = taskId;
|
||||
|
||||
logInfo.Debug("单据编码:BO11,开始保存");
|
||||
|
||||
var id = BOMExecutor.BFStandardBom_Save(ds, callar);
|
||||
|
||||
|
||||
logInfo.Debug($"单据编码:BO11,保存完成,id:{id}");
|
||||
|
||||
return new BaseResult<string> { bSuccess = true, message = "新增成功", result = $"{id}" };
|
||||
|
||||
}
|
||||
catch (U8MReferenceBENotExistException ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "新增失败", result = ex.Message };
|
||||
}
|
||||
catch (TargetInvocationException ex)
|
||||
{
|
||||
if (ex.InnerException is U8MReferenceBENotExistException)
|
||||
{
|
||||
logInfo.Error(ex.InnerException.Message, ex.InnerException);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "新增失败", result = ex.InnerException.Message };
|
||||
}
|
||||
else
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "新增失败", result = ex.Message };
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "新增失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,14 @@
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>D:\U8SOFT\Interop\ADODB.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Interop.ADOX">
|
||||
<HintPath>D:\U8SOFT\COBat\Interop.ADOX.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.DAO">
|
||||
<HintPath>D:\U8SOFT\COBat\Interop.DAO.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.GetComObj">
|
||||
<HintPath>D:\U8SOFT\Interop\Interop.GetComObj.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
@@ -45,11 +53,43 @@
|
||||
<HintPath>D:\U8SOFT\Interop\Interop.MSXML2.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.NoteManageAR">
|
||||
<HintPath>D:\U8SOFT\COBat\Interop.NoteManageAR.dll</HintPath>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.U8ColumnSet">
|
||||
<HintPath>D:\U8SOFT\Interop\Interop.U8ColumnSet.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.U8Login, Version=1.14.0.0, Culture=neutral, PublicKeyToken=79a4e7ad54eeabca, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>D:\U8SOFT\Interop\Interop.U8Login.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Interop.UFGeneralFilter">
|
||||
<HintPath>D:\U8SOFT\Interop\Interop.UFGeneralFilter.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.UFGeneralFilterOCX">
|
||||
<HintPath>D:\U8SOFT\Interop\Interop.UFGeneralFilterOCX.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.UFGeneralFilterPub">
|
||||
<HintPath>D:\U8SOFT\Interop\Interop.UFGeneralFilterPub.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.UfHeronReport">
|
||||
<HintPath>D:\U8SOFT\COBat\Interop.UfHeronReport.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.UFRPPub">
|
||||
<HintPath>D:\U8SOFT\COBat\Interop.UFRPPub.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.USDbKit">
|
||||
<HintPath>D:\U8SOFT\COBat\Interop.USDbKit.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=2.0.17.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.17\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -78,6 +118,9 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UFSoft.U8.BO.BE">
|
||||
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.BO.BE.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UFSoft.U8.Framework.BE">
|
||||
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.Framework.BE.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
@@ -152,9 +195,14 @@
|
||||
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.U8M.Exceptions.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="UFSoft.U8.U8MCommon.GSetup">
|
||||
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.U8MCommon.GSetup.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AP\UFAPBO.cs" />
|
||||
<Compile Include="Common\APARHelper.cs" />
|
||||
<Compile Include="Common\BEHelper.cs" />
|
||||
<Compile Include="Common\CommonHelper.cs" />
|
||||
<Compile Include="Json\JsonHelper.cs" />
|
||||
@@ -163,17 +211,30 @@
|
||||
<Compile Include="Models\StatusEnum.cs" />
|
||||
<Compile Include="Models\SysU8AccountConfig.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ST\USERPCO.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" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="AA\" />
|
||||
<Folder Include="ST\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="stdole">
|
||||
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
|
||||
<VersionMajor>2</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user