From d34fb7b00662abd284ed25c81447ff9fb5c79735 Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 6 Jan 2021 12:43:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=9F=E4=B8=80=E7=AE=97?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.Model/Store/PuStoreIn.cs | 16 +- NX.ERP.U8/NX.ERP.U8.csproj | 2 + NX.ERP.U8/Store/PuStoreInDAL.cs | 44 +++++ NX.ERP.U8/U8LoginContext.cs | 102 +++++++++++- NX.ERP.U8/VoucherParameter.cs | 278 ++++++++++++++++++++++++++++++++ 5 files changed, 439 insertions(+), 3 deletions(-) create mode 100644 NX.ERP.U8/Store/PuStoreInDAL.cs create mode 100644 NX.ERP.U8/VoucherParameter.cs diff --git a/NX.ERP.Model/Store/PuStoreIn.cs b/NX.ERP.Model/Store/PuStoreIn.cs index 81fd4b9..c5c5c4f 100644 --- a/NX.ERP.Model/Store/PuStoreIn.cs +++ b/NX.ERP.Model/Store/PuStoreIn.cs @@ -5,6 +5,9 @@ using System.Text; namespace NX.ERP.Model.Store { + /// + /// 采购入库单 + /// public class PuStoreIn { @@ -14,7 +17,18 @@ namespace NX.ERP.Model.Store private string depcode; private string whcode; private ICollection puStoreInDetails = new List(); - + private string _puCode; + private string maker; + private string personCode; public ICollection PuStoreInDetails { get => puStoreInDetails; set => puStoreInDetails = value; } + public int Id { get => id; set => id = value; } + public string Code { get => code; set => code = value; } + public DateTime Date { get => date; set => date = value; } + public string Depcode { get => depcode; set => depcode = value; } + public string Whcode { get => whcode; set => whcode = value; } + public string PuCode { get => _puCode; set => _puCode = value; } + public string Maker { get => maker; set => maker = value; } + public string PersonCode { get => personCode; set => personCode = value; } + public string RdCode { get; set; } } } diff --git a/NX.ERP.U8/NX.ERP.U8.csproj b/NX.ERP.U8/NX.ERP.U8.csproj index a336244..20e8c8f 100644 --- a/NX.ERP.U8/NX.ERP.U8.csproj +++ b/NX.ERP.U8/NX.ERP.U8.csproj @@ -42,12 +42,14 @@ + + diff --git a/NX.ERP.U8/Store/PuStoreInDAL.cs b/NX.ERP.U8/Store/PuStoreInDAL.cs new file mode 100644 index 0000000..fd87110 --- /dev/null +++ b/NX.ERP.U8/Store/PuStoreInDAL.cs @@ -0,0 +1,44 @@ +using MSXML2; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UFIDA.U8.U8APIFramework; +using UFIDA.U8.U8APIFramework.Parameter; +using UFIDA.U8.U8MOMAPIFramework; + +namespace NX.ERP.U8.Store +{ + public class PuStoreInDAL + { + /// + /// 保存一个采购到货单 + /// + /// + public void AddPuStoreIn(Model.Store.PuStoreIn puStoreIn) + { + VoucherParameter voucherParameter = new VoucherParameter(); + voucherParameter.VoucherType = "01"; + voucherParameter.DomHead = new DOMDocumentClass(); + voucherParameter.DomBody = new DOMDocumentClass(); + + IXMLDOMElement iXMLDOMElement = voucherParameter.DomHead.createElement("z:row"); + iXMLDOMElement.setAttribute("biafirst", "0"); + iXMLDOMElement.setAttribute("bpufirst", "0"); + iXMLDOMElement.setAttribute("bisstqc", "0"); + iXMLDOMElement.setAttribute("bomfirst", "0"); + iXMLDOMElement.setAttribute("brdflag", 1); + iXMLDOMElement.setAttribute("ccode", puStoreIn.Code); + iXMLDOMElement.setAttribute("ddate", puStoreIn.Date.ToShortDateString()); + iXMLDOMElement.setAttribute("cmaker", puStoreIn.Maker); + iXMLDOMElement.setAttribute("cvouchtype", "01"); + ///iXMLDOMElement.setAttribute("vt_id", ((U8ApiInterfaceBase)u8STApiInterface).get_Util().GetDefaltVTID("24", "", "")); + iXMLDOMElement.setAttribute("editprop", "A"); + iXMLDOMElement.setAttribute("cdepcode", puStoreIn.Depcode); + iXMLDOMElement.setAttribute("cpersoncode", puStoreIn.PersonCode); + iXMLDOMElement.setAttribute("crdcode", puStoreIn.RdCode); + + + } + } +} diff --git a/NX.ERP.U8/U8LoginContext.cs b/NX.ERP.U8/U8LoginContext.cs index 0cff17c..001e0ea 100644 --- a/NX.ERP.U8/U8LoginContext.cs +++ b/NX.ERP.U8/U8LoginContext.cs @@ -1,8 +1,10 @@ -using System; +using MSXML2; +using System; using System.Collections.Generic; using System.Text; using U8Login; - +using UFIDA.U8.U8APIFramework; +using UFIDA.U8.U8MOMAPIFramework; namespace NX.ERP.U8 { @@ -131,5 +133,101 @@ namespace NX.ERP.U8 } + + + public void AddRdVoucher(VoucherParameter para) + { + try + { + U8EnvContext u8EnvContext = new U8EnvContext(); + u8EnvContext.U8Login =this.ClsLogin; + + U8ApiAddress apiAddress = new U8ApiAddress(""); + U8ApiBroker u8ApiBroker = new U8ApiBroker(apiAddress, u8EnvContext); + u8ApiBroker.AssignNormalValue("sVouchType", para.VoucherType); + u8ApiBroker.AssignNormalValue("DomHead", para.DomHead); + u8ApiBroker.AssignNormalValue("domBody", para.DomBody); + if (para.DomPosition != null && para.DomPosition.selectNodes("//z:row").length != 0) + { + u8ApiBroker.AssignNormalValue("domPosition", para.DomPosition); + } + u8ApiBroker.AssignNormalValue("cnnFrom", para.Connection); + if (para.DOMMsg != null) + { + u8ApiBroker.AssignNormalValue("domMsg", para.DOMMsg); + } + else + { + u8ApiBroker.AssignNormalValue("domMsg", new DOMDocumentClass()); + } + u8ApiBroker.AssignNormalValue("bCheck", para.IsCheck); + u8ApiBroker.AssignNormalValue("bBeforCheckStock", para.IsBeforCheckStock); + u8ApiBroker.AssignNormalValue("bIsRedVouch", para.IsRedVouch); + u8ApiBroker.AssignNormalValue("sAddedState", para.AddedState); + u8ApiBroker.AssignNormalValue("bReMote", para.IsReMote); + if (!u8ApiBroker.Invoke()) + { + Exception exception = u8ApiBroker.GetException(); + if (exception != null) + { + if (exception is MomSysException) + { + MomSysException ex = exception as MomSysException; + + } + else if (exception is MomBizException) + { + MomBizException ex2 = exception as MomBizException; + + } + string exceptionString = u8ApiBroker.GetExceptionString(); + if (exceptionString.Length != 0) + { + + } + } + para.ReturnValue = false; + + u8ApiBroker.Release(); + return; + } + para.ReturnValue = Convert.ToBoolean(u8ApiBroker.GetReturnValue()); + para.DOMMsg = u8ApiBroker.GetResult("domMsg") as DOMDocument; + para.ErrMsg = u8ApiBroker.GetResult("errMsg") as string; + if (para.ReturnValue) + { + para.VoucherId = u8ApiBroker.GetResult("VouchId") as string; + if (para.VoucherType.Equals("12")) + { + //para.VoucherCode = base.Util.GetTransVoucherCode(para.VoucherId); + } + else if (para.VoucherType.Equals("18")) + { + //para.VoucherCode = base.Util.GetCheckVoucherCode(para.VoucherId); + } + else if (para.VoucherType.Equals("19")) + { + // para.VoucherCode = base.Util.GetAdjustVoucherCode(para.VoucherId); + //if (base.Util.dbHelper.U8ExcuteNoneQuery("Update AdjustPVouchs Set cVouchCode = '" + para.VoucherCode + "' Where id = " + para.VoucherId) == 0) + //{ + // para.ErrMsg = "更新货位调整单子表单号失败!"; + // para.ReturnValue = false; + //} + } + else + { + //para.VoucherCode = base.Util.GetSTVoucherCode(para.VoucherId, para.VoucherType); + } + } + u8ApiBroker.Release(); + } + catch (Exception ex3) + { + // Log.WriteLog(ex3); + throw new Exception("增加供应链库存单据失败!"); + } + } + + } } diff --git a/NX.ERP.U8/VoucherParameter.cs b/NX.ERP.U8/VoucherParameter.cs new file mode 100644 index 0000000..6ee17f7 --- /dev/null +++ b/NX.ERP.U8/VoucherParameter.cs @@ -0,0 +1,278 @@ +using ADODB; +using MSXML2; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.U8 +{ + public class VoucherParameter + { + private string voucherType; + + private DOMDocument domHead; + + private DOMDocument domBody; + + private DOMDocument domPosition; + + private string errMsg; + + private string voucherId; + + private DOMDocument domMsg; + + private bool isCheck; + + private bool isBeforCheckStock; + + private bool isRedVouch; + + private bool isReMote; + + private string addedState; + + private object timeStamp; + + private string voucherCode; + + private ADODB.Connection connection; + + + private bool returnValue; + + private string strWhere; + + private bool isGetBlank; + + private string sBodyWhere_Order; + + public string SBodyWhere_Order + { + get + { + return sBodyWhere_Order; + } + set + { + sBodyWhere_Order = value; + } + } + + public bool IsGetBlank + { + get + { + return isGetBlank; + } + set + { + isGetBlank = value; + } + } + + public string StrWhere + { + get + { + return strWhere; + } + set + { + strWhere = value; + } + } + + public bool ReturnValue + { + get + { + return returnValue; + } + set + { + returnValue = value; + } + } + + + + public string VoucherCode + { + get + { + return voucherCode; + } + set + { + voucherCode = value; + } + } + + public string VoucherType + { + get + { + return voucherType; + } + set + { + voucherType = value; + } + } + + public DOMDocument DomHead + { + get + { + return domHead; + } + set + { + domHead = value; + } + } + + public DOMDocument DomBody + { + get + { + return domBody; + } + set + { + domBody = value; + } + } + + public DOMDocument DomPosition + { + get + { + return domPosition; + } + set + { + domPosition = value; + } + } + + public string ErrMsg + { + get + { + return errMsg; + } + set + { + errMsg = value; + } + } + + public string VoucherId + { + get + { + return voucherId; + } + set + { + voucherId = value; + } + } + + public DOMDocument DOMMsg + { + get + { + return domMsg; + } + set + { + domMsg = value; + } + } + + public bool IsCheck + { + get + { + return isCheck; + } + set + { + isCheck = value; + } + } + + public bool IsBeforCheckStock + { + get + { + return isBeforCheckStock; + } + set + { + isBeforCheckStock = value; + } + } + + public bool IsRedVouch + { + get + { + return isRedVouch; + } + set + { + isRedVouch = value; + } + } + + public bool IsReMote + { + get + { + return isReMote; + } + set + { + isReMote = value; + } + } + + public string AddedState + { + get + { + return addedState; + } + set + { + addedState = value; + } + } + + public object TimeStamp + { + get + { + return timeStamp; + } + set + { + timeStamp = value; + } + } + + public Connection Connection { get => connection; set => connection = value; } + + public VoucherParameter() + { + + isCheck = true; + isBeforCheckStock = true; + } + } +}