添加修改功能

This commit is contained in:
gongxh
2021-03-15 09:50:23 +08:00
parent 073bd82663
commit bd8fb8ca93
12 changed files with 277 additions and 41 deletions

View File

@@ -22,7 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -45,6 +45,7 @@
<Compile Include="Mom\MomOrderDAL.cs" />
<Compile Include="Purchase\ArrivalDAL.cs" />
<Compile Include="Sale\DispatchListDAL.cs" />
<Compile Include="Store\BaseBill.cs" />
<Compile Include="Store\MaterielStoreOutDAL.cs" />
<Compile Include="Store\OtherStoreInDAL.cs" />
<Compile Include="Store\OtherStoreOutDAL.cs" />
@@ -71,7 +72,7 @@
<HintPath>..\packages\Dapper.1.42\lib\net35\Dapper.dll</HintPath>
</Reference>
<Reference Include="Interop.MSXML2">
<HintPath>D:\U8SOFT\Interop\Interop.MSXML2.dll</HintPath>
<HintPath>E:\U8SOFT\Interop\Interop.MSXML2.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Interop.U8Login, Version=1.14.0.0, Culture=neutral, PublicKeyToken=79a4e7ad54eeabca, processorArchitecture=MSIL">
@@ -83,16 +84,17 @@
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="UFIDA.U8.MomServiceCommon">
<HintPath>D:\U8SOFT\UFMOM\U8APIFramework\UFIDA.U8.MomServiceCommon.dll</HintPath>
<HintPath>E:\U8SOFT\UFMOM\U8APIFramework\UFIDA.U8.MomServiceCommon.dll</HintPath>
</Reference>
<Reference Include="UFIDA.U8.U8APIFramework">
<HintPath>D:\U8SOFT\UFMOM\U8APIFramework\UFIDA.U8.U8APIFramework.dll</HintPath>
<HintPath>E:\U8SOFT\UFMOM\U8APIFramework\UFIDA.U8.U8APIFramework.dll</HintPath>
</Reference>
<Reference Include="UFIDA.U8.U8MOMAPIFramework">
<HintPath>D:\U8SOFT\UFMOM\U8APIFramework\UFIDA.U8.U8MOMAPIFramework.dll</HintPath>
<HintPath>E:\U8SOFT\UFMOM\U8APIFramework\UFIDA.U8.U8MOMAPIFramework.dll</HintPath>
</Reference>
<Reference Include="UFSoft.U8.Framework.Login.UI">
<HintPath>D:\U8SOFT\Framework\UFSoft.U8.Framework.Login.UI.dll</HintPath>
<Reference Include="UFSoft.U8.Framework.Login.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=19a34671517e8c56, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>E:\U8SOFT\Framework\UFSoft.U8.Framework.Login.UI.dll</HintPath>
</Reference>
<Reference Include="UFSoft.U8.Framework.LoginContext, Version=1.0.0.0, Culture=neutral, PublicKeyToken=90e57cffdf9d854d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.U8.Store
{
public class BaseBill
{
}
}

View File

@@ -93,7 +93,7 @@ namespace NX.ERP.U8.Store
#region 明细
bodyXml = domBody.createElement("z:row");
bodyXml.setAttribute("autoid", n);
//bodyXml.setAttribute("autoid", n);
bodyXml.setAttribute("cinvcode", detail.InvCode);
bodyXml.setAttribute("iquantity", detail.Quantity);
bodyXml.setAttribute("irowno", n + 1);

View File

@@ -15,13 +15,9 @@ namespace NX.ERP.U8.Store
public PuStoreInDAL() : base("01", "U8API/PuStoreIn")
{
}
/// <summary>
/// 保存一个采购到货单
/// </summary>
/// <param name="puStoreIn"></param>
public string AddVocher(Model.Request.PuStoreIn puStoreIn)
{
private VoucherParameter BuildVocher(Model.Request.PuStoreIn puStoreIn, string EditType)
{
VoucherParameter voucherParameter = new VoucherParameter
{
VoucherType = this.VoucherID,
@@ -36,7 +32,7 @@ namespace NX.ERP.U8.Store
headXml.setAttribute("cvouchtype", this.VoucherID);//DomHead[0]["cvouchtype"] = ""; //单据类型,string类型
headXml.setAttribute("id", puStoreIn.Id); //DomHead[0]["id"] = ""; //主关键字段,int类型
headXml.setAttribute("bomfirst", "0"); //DomHead[0]["bomfirst"] = ""; //委外期初标志,string类型
headXml.setAttribute("ccode", "190700000050"); //DomHead[0]["ccode"] = ""; //入库单号,string类型
headXml.setAttribute("ccode", puStoreIn.Code); //DomHead[0]["ccode"] = ""; //入库单号,string类型
headXml.setAttribute("ddate", System.DateTime.Now.ToString("G")); //DomHead[0]["ddate"] = ""; //入库日期,DateTime类型
headXml.setAttribute("iverifystate", 0); //DomHead[0]["iverifystate"] = ""; //iverifystate,int类型
headXml.setAttribute("iswfcontrolled", 0); //DomHead[0]["iswfcontrolled"] = ""; //iswfcontrolled,int类型
@@ -45,7 +41,7 @@ namespace NX.ERP.U8.Store
headXml.setAttribute("csource", puStoreIn.Source); //DomHead[0]["csource"] = ""; //单据来源,int类型
headXml.setAttribute("cmaker", puStoreIn.Maker);//DomHead[0]["cmaker"] = ""; //制单人,string类型
headXml.setAttribute("vt_id", new VT().GetDefaltVTID("24"));
headXml.setAttribute("editprop", "A");
headXml.setAttribute("editprop", EditType);
headXml.setAttribute("cdepcode", puStoreIn.Deptcode);
headXml.setAttribute("cpersoncode", puStoreIn.PersonCode);
headXml.setAttribute("crdcode", "101" /*puStoreIn.RdCode*/);
@@ -56,7 +52,7 @@ namespace NX.ERP.U8.Store
var Arrival = new Purchase.ArrivalDAL().GetModel(puStoreIn.SourceCode);
if (Arrival == null)
{
throw new Exception("未知采购到货单,或到货单已经入库完成");
throw new Exception("未知采购到货单,或到货单已经入库完成");
}
headXml.setAttribute("cbustype", Arrival.BusType);
headXml.setAttribute("iexchrate", Arrival.ExchRate);
@@ -67,20 +63,14 @@ namespace NX.ERP.U8.Store
headXml.setAttribute("darvdate", Arrival.ArrivalDate);
headXml.setAttribute("itaxrate", Arrival.TaxRate);
headXml.setAttribute("cptcode", Arrival.PTCode);
IXMLDOMElement bodyXml;
for (var n = 0; n < puStoreIn.Details.Count; n++)
{
var detail = puStoreIn.Details[n];
var arrivalDetail = Arrival.ArrivalDtlLst.First(m => { return m.ArrivalDtlId == detail.SorceDetailId; });
headXml.setAttribute("cordercode", arrivalDetail.OrderCode);
// headXml.setAttribute("ipurorderid", arrivalDetail.PoId);
bodyXml = domBody.createElement("z:row");
if (arrivalDetail.cunitid != 0) //需要做辅助计量单位
{
var _inum = detail.Quantity / arrivalDetail.inspecexchrate;
@@ -93,9 +83,6 @@ namespace NX.ERP.U8.Store
{
bodyXml.setAttribute("innum", 0);
}
bodyXml.setAttribute("cinvcode", detail.Invcode);
bodyXml.setAttribute("iquantity", detail.Quantity);
bodyXml.setAttribute("irowno", n + 1);
@@ -104,8 +91,6 @@ namespace NX.ERP.U8.Store
bodyXml.setAttribute("cbatch", detail.Batch);
bodyXml.setAttribute("cposition", detail.Position);
// bodyXml.setAttribute("cposname", "B1Y1H001"); //货位,string类型
//iXMLDOMElement.setAttribute("carvcode", Arrival.ArrivalCode);
bodyXml.setAttribute("cbarvcode", Arrival.ArrivalNo);
bodyXml.setAttribute("ipurarriveid", Arrival.ArrivalId);
bodyXml.setAttribute("iarrsid", detail.SorceDetailId);
@@ -132,10 +117,17 @@ namespace NX.ERP.U8.Store
}
}
domHead.selectSingleNode("//rs:data").appendChild(headXml);
return voucherParameter;
}
/// <summary>
/// 保存一个采购到货单
/// </summary>
/// <param name="puStoreIn"></param>
public string AddVocher(Model.Request.PuStoreIn puStoreIn)
{
try
{
var voucherParameter = BuildVocher(puStoreIn, "A");
return AddRdVoucher(voucherParameter);
}
catch (Exception err)
@@ -143,11 +135,89 @@ namespace NX.ERP.U8.Store
throw err;
}
}
public string UpdateVocher(Model.Request.PuStoreIn puStoreIn)
{
try
{
// var voucherParameter = BuildVocher(puStoreIn, "M");
var voucherParameter = this.LoadVoucher($"cCode='{puStoreIn.Code}'");
//添加一條
DOMDocument domBody = voucherParameter.DomBody;
if (puStoreIn.Source == "采购到货单")
{
var Arrival = new Purchase.ArrivalDAL().GetModel(puStoreIn.SourceCode);
if (Arrival == null)
{
throw new Exception("未知采购到货单,或到货单已经入库完成");
}
IXMLDOMElement bodyXml;
for (var n = 0; n < puStoreIn.Details.Count; n++)
{
var detail = puStoreIn.Details[n];
var arrivalDetail = Arrival.ArrivalDtlLst.First(m => { return m.ArrivalDtlId == detail.SorceDetailId; });
// headXml.setAttribute("ipurorderid", arrivalDetail.PoId);
bodyXml = domBody.createElement("z:row");
if (arrivalDetail.cunitid != 0) //需要做辅助计量单位
{
var _inum = detail.Quantity / arrivalDetail.inspecexchrate;
//bodyXml.setAttribute("innum", arrivalDetail.inum);
bodyXml.setAttribute("inum", _inum);
bodyXml.setAttribute("cinva_unit", arrivalDetail.cinva_unit);
bodyXml.setAttribute("cassunit", arrivalDetail.cunitid);
}
else
{
bodyXml.setAttribute("innum", 0);
}
bodyXml.setAttribute("cinvcode", detail.Invcode);
bodyXml.setAttribute("iquantity", detail.Quantity);
bodyXml.setAttribute("irowno", domBody.childNodes.length + n + 1);
bodyXml.setAttribute("cbvencode", "10001");
bodyXml.setAttribute("inquantity", detail.Quantity); //应收数量,double类型
bodyXml.setAttribute("cbatch", detail.Batch);
bodyXml.setAttribute("cposition", detail.Position);
bodyXml.setAttribute("cbarvcode", Arrival.ArrivalNo);
bodyXml.setAttribute("ipurarriveid", Arrival.ArrivalId);
bodyXml.setAttribute("iarrsid", detail.SorceDetailId);
bodyXml.setAttribute("darvdate", DateTime.Today.ToShortDateString());
bodyXml.setAttribute("editprop", "A");
bodyXml.setAttribute("cpoid", arrivalDetail.OrderCode);
bodyXml.setAttribute("iposid", arrivalDetail.posId);
bodyXml.setAttribute("itaxrate", Arrival.TaxRate);
var info = new Account.Accinformation();
FormatHelp.GetUnitPriceByCost(detail.Quantity, arrivalDetail.oricost, Arrival.TaxRate, Arrival.ExchRate, out double iprice2, out double itaxprice2, out double isum2);
bodyXml.setAttribute("iunitcost", arrivalDetail.cost);
bodyXml.setAttribute("iprice", iprice2);
bodyXml.setAttribute("facost", arrivalDetail.cost);
bodyXml.setAttribute("iaprice", iprice2);
bodyXml.setAttribute("itaxprice", itaxprice2);
bodyXml.setAttribute("isum", isum2);
FormatHelp.GetOriPriceByCost(detail.Quantity, arrivalDetail.oricost, Arrival.TaxRate, out double iorimoney2, out double ioritaxprice2, out double iorisum2, out double iunitcost2);
bodyXml.setAttribute("ioricost", arrivalDetail.oricost);
bodyXml.setAttribute("ioritaxcost", arrivalDetail.oritaxcost);
bodyXml.setAttribute("iorimoney", iorimoney2);
bodyXml.setAttribute("ioritaxprice", ioritaxprice2);
bodyXml.setAttribute("iorisum", iorisum2);
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
}
}
return UpdateRdVoucher(voucherParameter);
}
catch (Exception err)
{
throw err;
}
}
}
}

View File

@@ -66,6 +66,17 @@ namespace NX.ERP.U8.Store
}
}
protected string UpdateUrl
{
get
{
return $"{BaseUrl}/Update";
}
}
protected string VoucherID
{
get
@@ -189,9 +200,111 @@ namespace NX.ERP.U8.Store
}
protected string UpdateRdVoucher(VoucherParameter para)
{
string VoucherId;
try
{
U8EnvContext u8EnvContext = new U8EnvContext();
u8EnvContext.U8Login = U8LoginContext.Instance.ClsLogin;
U8ApiAddress apiAddress = new U8ApiAddress(this.UpdateUrl);
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", null);
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("bUpdateNeedEas", true);
// 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();
}
para.ReturnValue = Convert.ToBoolean(u8ApiBroker.GetReturnValue());
para.DOMMsg = u8ApiBroker.GetResult("domMsg") as DOMDocument;
para.ErrMsg = u8ApiBroker.GetResult("errMsg") as string;
if (para.ReturnValue)
{
}
else
{
throw new Exception(para.ErrMsg);
}
u8ApiBroker.Release();
return "";
}
catch (Exception ex3)
{
throw ex3;
}
finally
{
}
}
protected string AddRdVoucher(VoucherParameter para)
{
string VoucherId;
try
{
U8EnvContext u8EnvContext = new U8EnvContext();
@@ -219,7 +332,8 @@ namespace NX.ERP.U8.Store
u8ApiBroker.AssignNormalValue("bBeforCheckStock", para.IsBeforCheckStock);
u8ApiBroker.AssignNormalValue("bIsRedVouch", para.IsRedVouch);
u8ApiBroker.AssignNormalValue("sAddedState", para.AddedState);
u8ApiBroker.AssignNormalValue("bReMote", para.IsReMote);
// u8ApiBroker.AssignNormalValue("bReMote", para.IsReMote);
if (!u8ApiBroker.Invoke())
{
Exception exception = u8ApiBroker.GetException();
@@ -276,6 +390,25 @@ namespace NX.ERP.U8.Store
protected VoucherParameter LoadVoucher(string where)
{
var rdVoucherParameter = new VoucherParameter
{
VoucherType = this.VoucherID,
IsGetBlank = false,
StrWhere = where
};
this.LoadRdVoucher(rdVoucherParameter);
return rdVoucherParameter;
}
private void LoadTemplate()
{
VoucherParameter rdVoucherParameter = null;