采购入库成功
This commit is contained in:
@@ -7,19 +7,25 @@ namespace NX.ERP.U8.Purchase
|
||||
{
|
||||
public class ArrivalDAL
|
||||
{
|
||||
public IEnumerable<Model.Purchase.Arrival> GetList()
|
||||
public IEnumerable<Model.Purchase.Arrival> GetList(string strWhere = "", object param = null)
|
||||
{
|
||||
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
|
||||
{
|
||||
|
||||
string strSQL = @"select a.id,a.cCode as ArrivalCode,a.dDate as date,A.cVenCode AS SupplierCode,
|
||||
B.Autoid as id,b.ID as ArrivalID,
|
||||
b.cInvCode AS MaterielCode,
|
||||
b.cBatch AS BatchNo,
|
||||
b.cUnitID AS UnitCode,
|
||||
B.iQuantity as Quantity
|
||||
from PU_ArrivalVouch as a
|
||||
left join PU_ArrivalVouchs as b on a.id=b.id";
|
||||
string strSQL = @"select a.id,a.cCode as ArrivalCode,a.cptcode as PTCode,a.iTaxRate as TaxRate,a.iexchrate as Exchrate,cexch_name as ExchName,cVenCode as VenCode,a.dDate as date,A.cVenCode AS SupplierCode,
|
||||
B.Autoid as id,b.ID as ArrivalID,
|
||||
b.cInvCode AS MaterielCode,
|
||||
b.cBatch AS BatchNo,
|
||||
b.cUnitID AS UnitCode,
|
||||
B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid from
|
||||
pu_ArrHead as a
|
||||
left join pu_arrbody as b on a.id=b.id
|
||||
Left Join PO_Podetails C WITH (NOLOCK) ON B.iPOsID = C.ID
|
||||
";
|
||||
if (!string.IsNullOrEmpty(strWhere))
|
||||
{
|
||||
strSQL += $" where {strWhere} ";
|
||||
}
|
||||
var lookup = new Dictionary<int, Model.Purchase.Arrival>();
|
||||
// return conn.Query<Model.Purchase.Arrival>(strSQL,null);
|
||||
var list = conn.Query<Model.Purchase.Arrival, Model.Purchase.ArrivalDetail, Model.Purchase.Arrival>(strSQL, (arrival, ArrivalDetail) =>
|
||||
@@ -27,16 +33,31 @@ namespace NX.ERP.U8.Purchase
|
||||
if (!lookup.TryGetValue(arrival.Id, out var _arrival))
|
||||
{
|
||||
lookup.Add(arrival.Id, arrival);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
arrival = _arrival;
|
||||
}
|
||||
|
||||
arrival.ArrivalDetails.Add(ArrivalDetail);
|
||||
return arrival;
|
||||
}, null, null, true, "id", 10, System.Data.CommandType.Text);
|
||||
}, param, null, true, "id", 10, System.Data.CommandType.Text);
|
||||
return lookup.Values;
|
||||
}
|
||||
}
|
||||
|
||||
public Model.Purchase.Arrival GetModel(int id)
|
||||
{
|
||||
return this.GetList(" a.id=@Id ", new { id }).FirstOrDefault();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Model.Purchase.Arrival GetModel(string Code)
|
||||
{
|
||||
return this.GetList(" a.cCode=@Code ", new { Code }).FirstOrDefault();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using MSXML2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UFIDA.U8.U8APIFramework;
|
||||
@@ -11,6 +12,41 @@ namespace NX.ERP.U8.Store
|
||||
{
|
||||
public class PuStoreInDAL
|
||||
{
|
||||
public static string ReadFile(string strFileName)
|
||||
{
|
||||
if (!File.Exists(strFileName))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
using (StreamReader streamReader = new StreamReader(strFileName, Encoding.Default))
|
||||
{
|
||||
return streamReader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static bool WriteFile(string strContentToFile, string strFilePathName, Encoding encoding)
|
||||
{
|
||||
using (StreamWriter streamWriter = new StreamWriter(strFilePathName, append: false, encoding))
|
||||
{
|
||||
streamWriter.Write(strContentToFile);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static bool WriteFile(string strContentToFile, string strFilePathName)
|
||||
{
|
||||
using (StreamWriter streamWriter = new StreamWriter(strFilePathName, append: false, Encoding.Default))
|
||||
{
|
||||
streamWriter.Write(strContentToFile);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存一个采购到货单
|
||||
/// </summary>
|
||||
@@ -22,21 +58,285 @@ namespace NX.ERP.U8.Store
|
||||
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", "", ""));
|
||||
DOMDocument domHead = voucherParameter.DomHead;
|
||||
DOMDocument domBody = voucherParameter.DomBody;
|
||||
|
||||
voucherParameter.DomHead.loadXML(ReadFile(AppDomain.CurrentDomain.BaseDirectory + "\\XMLDOM\\XMLDomHead01.xml"));
|
||||
voucherParameter.DomBody.loadXML(ReadFile(AppDomain.CurrentDomain.BaseDirectory + "\\XMLDOM\\XMLDomBody01.xml"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
IXMLDOMElement iXMLDOMElement = domHead.createElement("z:row");
|
||||
iXMLDOMElement.setAttribute("id", "11"); //DomHead[0]["id"] = ""; //主关键字段,int类型
|
||||
iXMLDOMElement.setAttribute("bomfirst", "0"); //DomHead[0]["bomfirst"] = ""; //委外期初标志,string类型
|
||||
iXMLDOMElement.setAttribute("ccode", "211"); //DomHead[0]["ccode"] = ""; //入库单号,string类型
|
||||
iXMLDOMElement.setAttribute("ddate", puStoreIn.Date.ToShortDateString()); //DomHead[0]["ddate"] = ""; //入库日期,DateTime类型
|
||||
iXMLDOMElement.setAttribute("iverifystate", 1); //DomHead[0]["iverifystate"] = ""; //iverifystate,int类型
|
||||
iXMLDOMElement.setAttribute("iswfcontrolled", 1); //DomHead[0]["iswfcontrolled"] = ""; //iswfcontrolled,int类型
|
||||
//iXMLDOMElement.setAttribute("cbustype", "0"); //DomHead[0]["cbustype"] = ""; //业务类型,int类型
|
||||
//iXMLDOMElement.setAttribute("iexchrate", 1); //DomHead[0]["iexchrate"] = ""; //汇率,double类型
|
||||
//iXMLDOMElement.setAttribute("cexch_name", "人民币"); //DomHead[0]["cexch_name"] = ""; //币种,string类型
|
||||
//iXMLDOMElement.setAttribute("ufts", "asdasd"); //DomHead[0]["ufts"] = ""; //时间戳,string类型
|
||||
iXMLDOMElement.setAttribute("bpufirst", "0"); //DomHead[0]["bpufirst"] = ""; //采购期初标志,string类型
|
||||
|
||||
iXMLDOMElement.setAttribute("cvouchtype", "01");//DomHead[0]["cvouchtype"] = ""; //单据类型,string类型
|
||||
iXMLDOMElement.setAttribute("brdflag", 1); //DomHead[0]["brdflag"] = ""; //收发标志,int类型
|
||||
iXMLDOMElement.setAttribute("csource", puStoreIn.Source); //DomHead[0]["csource"] = ""; //单据来源,int类型
|
||||
iXMLDOMElement.setAttribute("cmaker", puStoreIn.Maker);//DomHead[0]["cmaker"] = ""; //制单人,string类型
|
||||
iXMLDOMElement.setAttribute("vt_id", "27");
|
||||
iXMLDOMElement.setAttribute("editprop", "A");
|
||||
iXMLDOMElement.setAttribute("cdepcode", puStoreIn.Depcode);
|
||||
iXMLDOMElement.setAttribute("cpersoncode", puStoreIn.PersonCode);
|
||||
iXMLDOMElement.setAttribute("crdcode", puStoreIn.RdCode);
|
||||
iXMLDOMElement.setAttribute("cwhcode", "1");
|
||||
iXMLDOMElement.setAttribute("bisstqc", "0");
|
||||
iXMLDOMElement.setAttribute("bomfirst", "0");
|
||||
|
||||
|
||||
if (puStoreIn.Source == "采购到货单")
|
||||
{
|
||||
var Arrival = new Purchase.ArrivalDAL().GetModel(puStoreIn.SourceCode);
|
||||
|
||||
//iXMLDOMElement.setAttribute("cvencode", puStoreIn.SupplierCode); //DomHead[0]["cvencode"] = ""; //供货单位编码,string类型
|
||||
//iXMLDOMElement.setAttribute("cvenabbname", puStoreIn.SupplierName);//DomHead[0]["cvenabbname"] = ""; //供货单位,string类型
|
||||
|
||||
iXMLDOMElement.setAttribute("cbustype", Arrival.SupplierCode);
|
||||
iXMLDOMElement.setAttribute("iexchrate", Arrival.ExchRate);
|
||||
iXMLDOMElement.setAttribute("cexch_name", Arrival.ExchName);
|
||||
iXMLDOMElement.setAttribute("cvencode", Arrival.VenCode);
|
||||
|
||||
iXMLDOMElement.setAttribute("carvcode", Arrival.ArrivalCode);
|
||||
iXMLDOMElement.setAttribute("ipurarriveid", Arrival.Id);
|
||||
iXMLDOMElement.setAttribute("darvdate", Arrival.Date);
|
||||
iXMLDOMElement.setAttribute("itaxrate", Arrival.TaxRate);
|
||||
iXMLDOMElement.setAttribute("itaxrate", Arrival.TaxRate);
|
||||
iXMLDOMElement.setAttribute("cptcode", Arrival.PTCode);
|
||||
|
||||
domHead.selectSingleNode("//rs:data").appendChild(iXMLDOMElement);
|
||||
for (var n = 0; n < puStoreIn.PuStoreInDetails.Count; n++)
|
||||
{
|
||||
var detail = puStoreIn.PuStoreInDetails[n];
|
||||
var arrivalDetail = Arrival.ArrivalDetails.First(m => { return m.Id == detail.SorceDetailId; });
|
||||
|
||||
(domHead.selectSingleNode("//z:row") as IXMLDOMElement).setAttribute("cordercode", arrivalDetail.OrderCode);
|
||||
(domHead.selectSingleNode("//z:row") as IXMLDOMElement).setAttribute("ipurorderid", arrivalDetail.PoId);
|
||||
|
||||
iXMLDOMElement = domBody.createElement("z:row");
|
||||
iXMLDOMElement.setAttribute("cinvcode", detail.Invcode);
|
||||
iXMLDOMElement.setAttribute("iquantity", detail.Quantity);
|
||||
iXMLDOMElement.setAttribute("irowno", n);
|
||||
iXMLDOMElement.setAttribute("cbvencode", "10001");
|
||||
iXMLDOMElement.setAttribute("cbatch", detail.Batch);
|
||||
iXMLDOMElement.setAttribute("carvcode", "2");
|
||||
iXMLDOMElement.setAttribute("ipurarriveid", "222");
|
||||
iXMLDOMElement.setAttribute("darvdate", DateTime.Today.ToShortDateString());
|
||||
iXMLDOMElement.setAttribute("editprop", "A");
|
||||
iXMLDOMElement.setAttribute("cpoid", arrivalDetail.OrderCode);
|
||||
iXMLDOMElement.setAttribute("iposid", arrivalDetail.posId);
|
||||
domBody.selectSingleNode("//rs:data").appendChild(iXMLDOMElement);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
var str = voucherParameter.DomBody.xml;
|
||||
Console.WriteLine(str);
|
||||
U8LoginContext.Instance.AddRdVoucher("U8API/PuStoreIn/Add", voucherParameter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Loadd()
|
||||
{
|
||||
VoucherParameter rdVoucherParameter = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "XMLDOM"))
|
||||
{
|
||||
Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "XMLDOM");
|
||||
}
|
||||
|
||||
|
||||
rdVoucherParameter = new VoucherParameter();
|
||||
rdVoucherParameter.VoucherType = "01";
|
||||
rdVoucherParameter.IsGetBlank = true;
|
||||
U8LoginContext.Instance.LoadRdVoucher(rdVoucherParameter);
|
||||
if (!rdVoucherParameter.ReturnValue)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
WriteFile(rdVoucherParameter.DomHead.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomHead01.xml");
|
||||
WriteFile(rdVoucherParameter.DomBody.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomBody01.xml");
|
||||
|
||||
}
|
||||
//if (string.IsNullOrEmpty(U8ApiCommonValue.XMLDomHead08) || string.IsNullOrEmpty(U8ApiCommonValue.XMLDomBody08))
|
||||
//{
|
||||
// rdVoucherParameter = new RdVoucherParameter();
|
||||
// rdVoucherParameter.VoucherType = "08";
|
||||
// rdVoucherParameter.IsGetBlank = true;
|
||||
// u8STApiInterface.LoadRdVoucher(rdVoucherParameter);
|
||||
// if (!rdVoucherParameter.ReturnValue)
|
||||
// {
|
||||
// Log.WriteLog("加载其他入库单XML失败,原因:" + rdVoucherParameter.ErrMsg);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// U8ApiCommonValue.XMLDomHead08 = rdVoucherParameter.DomHead.xml;
|
||||
// U8ApiCommonValue.XMLDomBody08 = rdVoucherParameter.DomBody.xml;
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomHead.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomHead08.xml");
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomBody.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomBody08.xml");
|
||||
// Log.WriteLog("加载其他入库单XML完成");
|
||||
// }
|
||||
//}
|
||||
//if (string.IsNullOrEmpty(U8ApiCommonValue.XMLDomHead10) || string.IsNullOrEmpty(U8ApiCommonValue.XMLDomBody10))
|
||||
//{
|
||||
// rdVoucherParameter = new RdVoucherParameter();
|
||||
// rdVoucherParameter.VoucherType = "10";
|
||||
// rdVoucherParameter.IsGetBlank = true;
|
||||
// u8STApiInterface.LoadRdVoucher(rdVoucherParameter);
|
||||
// if (!rdVoucherParameter.ReturnValue)
|
||||
// {
|
||||
// Log.WriteLog("加载产成品入库单XML失败,原因:" + rdVoucherParameter.ErrMsg);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// U8ApiCommonValue.XMLDomHead10 = rdVoucherParameter.DomHead.xml;
|
||||
// U8ApiCommonValue.XMLDomBody10 = rdVoucherParameter.DomBody.xml;
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomHead.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomHead10.xml");
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomBody.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomBody10.xml");
|
||||
// Log.WriteLog("加载产成品入库单XML完成");
|
||||
// }
|
||||
//}
|
||||
//if (string.IsNullOrEmpty(U8ApiCommonValue.XMLDomHead11) || string.IsNullOrEmpty(U8ApiCommonValue.XMLDomBody11))
|
||||
//{
|
||||
// rdVoucherParameter = new RdVoucherParameter();
|
||||
// rdVoucherParameter.VoucherType = "11";
|
||||
// rdVoucherParameter.IsGetBlank = true;
|
||||
// u8STApiInterface.LoadRdVoucher(rdVoucherParameter);
|
||||
// if (!rdVoucherParameter.ReturnValue)
|
||||
// {
|
||||
// Log.WriteLog("加载材料出库单XML失败,原因:" + rdVoucherParameter.ErrMsg);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// U8ApiCommonValue.XMLDomHead11 = rdVoucherParameter.DomHead.xml;
|
||||
// U8ApiCommonValue.XMLDomBody11 = rdVoucherParameter.DomBody.xml;
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomHead.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomHead11.xml");
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomBody.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomBody11.xml");
|
||||
// Log.WriteLog("加载材料出库单XML完成");
|
||||
// }
|
||||
//}
|
||||
//if (string.IsNullOrEmpty(U8ApiCommonValue.XMLDomHead09) || string.IsNullOrEmpty(U8ApiCommonValue.XMLDomBody09))
|
||||
//{
|
||||
// rdVoucherParameter = new RdVoucherParameter();
|
||||
// rdVoucherParameter.VoucherType = "09";
|
||||
// rdVoucherParameter.IsGetBlank = true;
|
||||
// u8STApiInterface.LoadRdVoucher(rdVoucherParameter);
|
||||
// if (!rdVoucherParameter.ReturnValue)
|
||||
// {
|
||||
// Log.WriteLog("加载其他出库单XML失败,原因:" + rdVoucherParameter.ErrMsg);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// U8ApiCommonValue.XMLDomHead09 = rdVoucherParameter.DomHead.xml;
|
||||
// U8ApiCommonValue.XMLDomBody09 = rdVoucherParameter.DomBody.xml;
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomHead.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomHead09.xml");
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomBody.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomBody09.xml");
|
||||
// Log.WriteLog("加载其他出库单XML完成");
|
||||
// }
|
||||
//}
|
||||
//if (string.IsNullOrEmpty(U8ApiCommonValue.XMLDomHead32) || string.IsNullOrEmpty(U8ApiCommonValue.XMLDomBody32))
|
||||
//{
|
||||
// rdVoucherParameter = new RdVoucherParameter();
|
||||
// rdVoucherParameter.VoucherType = "32";
|
||||
// rdVoucherParameter.IsGetBlank = true;
|
||||
// u8STApiInterface.LoadRdVoucher(rdVoucherParameter);
|
||||
// if (!rdVoucherParameter.ReturnValue)
|
||||
// {
|
||||
// Log.WriteLog("加载销售出库单XML失败,原因:" + rdVoucherParameter.ErrMsg);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// U8ApiCommonValue.XMLDomHead32 = rdVoucherParameter.DomHead.xml;
|
||||
// U8ApiCommonValue.XMLDomBody32 = rdVoucherParameter.DomBody.xml;
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomHead.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomHead32.xml");
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomBody.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomBody32.xml");
|
||||
// Log.WriteLog("加载销售出库单XML完成");
|
||||
// }
|
||||
//}
|
||||
//if (string.IsNullOrEmpty(U8ApiCommonValue.XMLDomHead12) || string.IsNullOrEmpty(U8ApiCommonValue.XMLDomBody12))
|
||||
//{
|
||||
// rdVoucherParameter = new RdVoucherParameter();
|
||||
// rdVoucherParameter.VoucherType = "12";
|
||||
// rdVoucherParameter.IsGetBlank = true;
|
||||
// u8STApiInterface.LoadRdVoucher(rdVoucherParameter);
|
||||
// if (!rdVoucherParameter.ReturnValue)
|
||||
// {
|
||||
// Log.WriteLog("加载调拨单XML失败,原因:" + rdVoucherParameter.ErrMsg);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// U8ApiCommonValue.XMLDomHead12 = rdVoucherParameter.DomHead.xml;
|
||||
// U8ApiCommonValue.XMLDomBody12 = rdVoucherParameter.DomBody.xml;
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomHead.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomHead12.xml");
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomBody.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomBody12.xml");
|
||||
// Log.WriteLog("加载调拨单XML完成");
|
||||
// }
|
||||
//}
|
||||
//if (string.IsNullOrEmpty(U8ApiCommonValue.XMLDomHead18) || string.IsNullOrEmpty(U8ApiCommonValue.XMLDomBody18))
|
||||
//{
|
||||
// rdVoucherParameter = new RdVoucherParameter();
|
||||
// rdVoucherParameter.VoucherType = "18";
|
||||
// rdVoucherParameter.IsGetBlank = true;
|
||||
// u8STApiInterface.LoadRdVoucher(rdVoucherParameter);
|
||||
// if (!rdVoucherParameter.ReturnValue)
|
||||
// {
|
||||
// Log.WriteLog("加载盘点单XML失败,原因:" + rdVoucherParameter.ErrMsg);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// U8ApiCommonValue.XMLDomHead18 = rdVoucherParameter.DomHead.xml;
|
||||
// U8ApiCommonValue.XMLDomBody18 = rdVoucherParameter.DomBody.xml;
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomHead.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomHead18.xml");
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomBody.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomBody18.xml");
|
||||
// Log.WriteLog("加载盘点单XML完成");
|
||||
// }
|
||||
//}
|
||||
//if ((U8ApiFactoryBase.get_U8APIType() == U8APIType.API_VOUCHERCO_INTERFACE || U8ApiFactoryBase.get_U8APIType() == U8APIType.API_BUSINESS_INTERFACE) && (string.IsNullOrEmpty(U8ApiCommonValue.XMLDomHead19) || string.IsNullOrEmpty(U8ApiCommonValue.XMLDomBody19)))
|
||||
//{
|
||||
// rdVoucherParameter = new RdVoucherParameter();
|
||||
// rdVoucherParameter.VoucherType = "19";
|
||||
// rdVoucherParameter.IsGetBlank = true;
|
||||
// u8STApiInterface.LoadRdVoucher(rdVoucherParameter);
|
||||
// if (!rdVoucherParameter.ReturnValue)
|
||||
// {
|
||||
// Log.WriteLog("加载货位调整单XML失败,原因:" + rdVoucherParameter.ErrMsg);
|
||||
// return;
|
||||
// }
|
||||
// U8ApiCommonValue.XMLDomHead19 = rdVoucherParameter.DomHead.xml;
|
||||
// U8ApiCommonValue.XMLDomBody19 = rdVoucherParameter.DomBody.xml;
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomHead.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomHead19.xml");
|
||||
// FileUtil.WriteFile(rdVoucherParameter.DomBody.xml, AppDomain.CurrentDomain.BaseDirectory + "XMLDOM\\XMLDomBody19.xml");
|
||||
// Log.WriteLog("加载货位调整单XML完成");
|
||||
//}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -135,14 +135,14 @@ namespace NX.ERP.U8
|
||||
}
|
||||
|
||||
|
||||
public void AddRdVoucher(VoucherParameter para)
|
||||
public void AddRdVoucher(string URL,VoucherParameter para)
|
||||
{
|
||||
try
|
||||
{
|
||||
U8EnvContext u8EnvContext = new U8EnvContext();
|
||||
u8EnvContext.U8Login =this.ClsLogin;
|
||||
|
||||
U8ApiAddress apiAddress = new U8ApiAddress("");
|
||||
U8ApiAddress apiAddress = new U8ApiAddress(URL);
|
||||
U8ApiBroker u8ApiBroker = new U8ApiBroker(apiAddress, u8EnvContext);
|
||||
u8ApiBroker.AssignNormalValue("sVouchType", para.VoucherType);
|
||||
u8ApiBroker.AssignNormalValue("DomHead", para.DomHead);
|
||||
@@ -151,7 +151,8 @@ namespace NX.ERP.U8
|
||||
{
|
||||
u8ApiBroker.AssignNormalValue("domPosition", para.DomPosition);
|
||||
}
|
||||
u8ApiBroker.AssignNormalValue("cnnFrom", para.Connection);
|
||||
|
||||
u8ApiBroker.AssignNormalValue("cnnFrom", null);
|
||||
if (para.DOMMsg != null)
|
||||
{
|
||||
u8ApiBroker.AssignNormalValue("domMsg", para.DOMMsg);
|
||||
@@ -207,7 +208,7 @@ namespace NX.ERP.U8
|
||||
}
|
||||
else if (para.VoucherType.Equals("19"))
|
||||
{
|
||||
// para.VoucherCode = base.Util.GetAdjustVoucherCode(para.VoucherId);
|
||||
// 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 = "更新货位调整单子表单号失败!";
|
||||
@@ -219,15 +220,94 @@ namespace NX.ERP.U8
|
||||
//para.VoucherCode = base.Util.GetSTVoucherCode(para.VoucherId, para.VoucherType);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(para.ErrMsg);
|
||||
}
|
||||
u8ApiBroker.Release();
|
||||
}
|
||||
catch (Exception ex3)
|
||||
{
|
||||
// Log.WriteLog(ex3);
|
||||
throw new Exception("增加供应链库存单据失败!");
|
||||
|
||||
throw ex3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void LoadRdVoucher(VoucherParameter para)
|
||||
{
|
||||
try
|
||||
{
|
||||
U8EnvContext u8EnvContext = new U8EnvContext();
|
||||
u8EnvContext.U8Login = this.ClsLogin;
|
||||
U8ApiAddress apiAddress = new U8ApiAddress("U8API/PuStoreIn/Load");
|
||||
U8ApiBroker u8ApiBroker = new U8ApiBroker(apiAddress, u8EnvContext);
|
||||
u8ApiBroker.AssignNormalValue("sVouchType", para.VoucherType);
|
||||
u8ApiBroker.AssignNormalValue("sWhere", para.StrWhere);
|
||||
u8ApiBroker.AssignNormalValue("domPos", new DOMDocumentClass());
|
||||
u8ApiBroker.AssignNormalValue("bGetBlank", para.IsGetBlank);
|
||||
u8ApiBroker.AssignNormalValue("sBodyWhere_Order", para.SBodyWhere_Order);
|
||||
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;
|
||||
}
|
||||
DOMDocument dOMDocument = u8ApiBroker.GetResult("DomHead") as DOMDocument;
|
||||
if (dOMDocument != null)
|
||||
{
|
||||
para.DomHead = new DOMDocumentClass();
|
||||
para.DomHead.loadXML(dOMDocument.xml);
|
||||
}
|
||||
DOMDocument dOMDocument2 = u8ApiBroker.GetResult("domBody") as DOMDocument;
|
||||
if (dOMDocument2 != null)
|
||||
{
|
||||
para.DomBody = new DOMDocumentClass();
|
||||
para.DomBody.loadXML(dOMDocument2.xml);
|
||||
}
|
||||
DOMDocument dOMDocument3 = u8ApiBroker.GetResult("domPos") as DOMDocument;
|
||||
if (dOMDocument3 != null)
|
||||
{
|
||||
para.DomPosition = new DOMDocumentClass();
|
||||
para.DomPosition.loadXML(dOMDocument3.xml);
|
||||
}
|
||||
para.ReturnValue = Convert.ToBoolean(u8ApiBroker.GetReturnValue());
|
||||
para.ErrMsg = u8ApiBroker.GetResult("errMsg") as string;
|
||||
u8ApiBroker.Release();
|
||||
}
|
||||
catch (Exception ex3)
|
||||
{
|
||||
|
||||
throw new Exception("装载供应链库存单据失败!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using ADODB;
|
||||
using MSXML2;
|
||||
using MSXML2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,7 +8,7 @@ namespace NX.ERP.U8
|
||||
{
|
||||
public class VoucherParameter
|
||||
{
|
||||
private string voucherType;
|
||||
private string string_0;
|
||||
|
||||
private DOMDocument domHead;
|
||||
|
||||
@@ -19,7 +18,7 @@ namespace NX.ERP.U8
|
||||
|
||||
private string errMsg;
|
||||
|
||||
private string voucherId;
|
||||
private string string_2;
|
||||
|
||||
private DOMDocument domMsg;
|
||||
|
||||
@@ -37,7 +36,6 @@ namespace NX.ERP.U8
|
||||
|
||||
private string voucherCode;
|
||||
|
||||
private ADODB.Connection connection;
|
||||
|
||||
|
||||
private bool returnValue;
|
||||
@@ -114,11 +112,11 @@ namespace NX.ERP.U8
|
||||
{
|
||||
get
|
||||
{
|
||||
return voucherType;
|
||||
return string_0;
|
||||
}
|
||||
set
|
||||
{
|
||||
voucherType = value;
|
||||
string_0 = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,11 +172,11 @@ namespace NX.ERP.U8
|
||||
{
|
||||
get
|
||||
{
|
||||
return voucherId;
|
||||
return string_2;
|
||||
}
|
||||
set
|
||||
{
|
||||
voucherId = value;
|
||||
string_2 = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,13 +264,12 @@ namespace NX.ERP.U8
|
||||
}
|
||||
}
|
||||
|
||||
public Connection Connection { get => connection; set => connection = value; }
|
||||
|
||||
public VoucherParameter()
|
||||
public VoucherParameter()
|
||||
{
|
||||
|
||||
isCheck = true;
|
||||
isBeforCheckStock = true;
|
||||
isBeforCheckStock = true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user