修改采购入库单

This commit is contained in:
admin
2021-01-09 16:36:17 +08:00
parent fd3fc7af4c
commit cbd3c4555a
11 changed files with 262 additions and 130 deletions

View File

@@ -14,13 +14,13 @@ namespace NX.ERP.Model
private decimal height; private decimal height;
private int volume; private int volume;
private int weight; private int weight;
private int unitPrice; private double unitPrice;
private string unitCode; private string unitCode;
private string specsModel; private string specsModel;
private int maxStock; private int maxStock;
private int minStock; private int minStock;
private int aql; private int aql;
private int invccode;
public string MaterielCode { get => materielCode; set => materielCode = value; } public string MaterielCode { get => materielCode; set => materielCode = value; }
public string MaterielName { get => materielName; set => materielName = value; } public string MaterielName { get => materielName; set => materielName = value; }
public decimal Length { get => length; set => length = value; } public decimal Length { get => length; set => length = value; }
@@ -28,11 +28,12 @@ namespace NX.ERP.Model
public decimal Height { get => height; set => height = value; } public decimal Height { get => height; set => height = value; }
public int Volume { get => volume; set => volume = value; } public int Volume { get => volume; set => volume = value; }
public int Weight { get => weight; set => weight = value; } public int Weight { get => weight; set => weight = value; }
public int UnitPrice { get => unitPrice; set => unitPrice = value; } public double UnitPrice { get => unitPrice; set => unitPrice = value; }
public string UnitCode { get => unitCode; set => unitCode = value; } public string UnitCode { get => unitCode; set => unitCode = value; }
public string SpecsModel { get => specsModel; set => specsModel = value; } public string SpecsModel { get => specsModel; set => specsModel = value; }
public int MaxStock { get => maxStock; set => maxStock = value; } public int MaxStock { get => maxStock; set => maxStock = value; }
public int MinStock { get => minStock; set => minStock = value; } public int MinStock { get => minStock; set => minStock = value; }
public int Aql { get => aql; set => aql = value; } public int Aql { get => aql; set => aql = value; }
public int Invccode { get => invccode; set => invccode = value; }
} }
} }

View File

@@ -21,17 +21,12 @@ namespace NX.ERP.Model.Purchase
public DateTime Date { get => _date; set => _date = value; } public DateTime Date { get => _date; set => _date = value; }
public ICollection<ArrivalDetail> ArrivalDetails { get => arrivalDetails; set => arrivalDetails = value; } public ICollection<ArrivalDetail> ArrivalDetails { get => arrivalDetails; set => arrivalDetails = value; }
public string SupplierCode { get => supplierCode; set => supplierCode = value; } public string SupplierCode { get => supplierCode; set => supplierCode = value; }
public double ExchRate { get; set; }
public decimal ExchRate { get; set; }
public string ExchName { get; set; } public string ExchName { get; set; }
public string VenCode { get; set; } public string VenCode { get; set; }
public double TaxRate { get; set; } public double TaxRate { get; set; }
public string PTCode { get; set; } public string PTCode { get; set; }
public string BusType { get; set; }
} }
} }

View File

@@ -17,7 +17,7 @@ namespace NX.ERP.Model.Purchase
public string MaterielCode { get => materielCode; set => materielCode = value; } public string MaterielCode { get => materielCode; set => materielCode = value; }
public string BatchNo { get => batchNo; set => batchNo = value; } public string BatchNo { get => batchNo; set => batchNo = value; }
public string UnitCode { get => unitCode; set => unitCode = value; } public string UnitCode { get => unitCode; set => unitCode = value; }
public decimal Quantity { get => quantity; set => quantity = value; } public double Quantity { get => quantity; set => quantity = value; }
/// <summary> /// <summary>
/// 审批状态2 说明已经审核过了 /// 审批状态2 说明已经审核过了
/// </summary> /// </summary>
@@ -25,7 +25,7 @@ namespace NX.ERP.Model.Purchase
private int arrivalID; private int arrivalID;
private string batchNo; private string batchNo;
private string unitCode; private string unitCode;
private decimal quantity; private double quantity;
private int iverifystateex; private int iverifystateex;
public int posId { get; set; } public int posId { get; set; }
@@ -33,11 +33,14 @@ namespace NX.ERP.Model.Purchase
public string OrderCode { get; set; } public string OrderCode { get; set; }
public int PoId { get; set; } public int PoId { get; set; }
public double oricost { get; set; } public double oricost { get; set; }
public decimal oritaxcost { get; set; } public double oritaxcost { get; set; }
public decimal orimoney { get; set; } public double orimoney { get; set; }
public decimal oritaxprice { get; set; } public double oritaxprice { get; set; }
public decimal orisum { get; set; } public double orisum { get; set; }
public double cost { get; set; }
// b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.iorimoney as orimoney,b.oritaxprice as oritaxprice,b.iorisum as orisum, // b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.iorimoney as orimoney,b.oritaxprice as oritaxprice,b.iorisum as orisum,
} }

View File

@@ -287,8 +287,7 @@ namespace U8AppMain
private void 登录ToolStripMenuItem_Click(object sender, EventArgs e) private void 登录ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var a = new NX.ERP.U8.Store.PuStoreInDAL();
a.Loadd();
//u8LoginContext = new NX.ERP.U8.U8LoginContext(); //u8LoginContext = new NX.ERP.U8.U8LoginContext();
@@ -301,32 +300,27 @@ namespace U8AppMain
a.AddPuStoreIn(new NX.ERP.Model.Store.PuStoreIn() a.AddPuStoreIn(new NX.ERP.Model.Store.PuStoreIn()
{ {
Code = "0001", Code = "0001",
PersonCode = "wx065", //PersonCode = "wx065",
PuCode = "0002", //PuCode = "0002",
Date = DateTime.Today, Date = DateTime.Today,
Id = 1000021, //Id = 1000021,
RdCode = "101",
Depcode = "24", Depcode = "24",
//SupplierName = "上海拓恩机电科技有限公司",
SupplierCode = "10001",
Source = "采购到货单", Source = "采购到货单",
Whcode = "1", Whcode = "1",
SourceCode = "CGDH210100185", SourceCode = "CGDH210100187",
// Maker = "222",
RdCode = "101",
PuStoreInDetails = new List<NX.ERP.Model.Store.PuStoreInDetail>() { PuStoreInDetails = new List<NX.ERP.Model.Store.PuStoreInDetail>() {
new NX.ERP.Model.Store.PuStoreInDetail(){ new NX.ERP.Model.Store.PuStoreInDetail(){
//Batch="001", //Batch="001",
Quantity=2, Quantity=1,
Id=1, //Id=1,
Invcode="501241", Invcode="201763",
PuStoreInId=1000021, //PuStoreInId=1002001,
SorceDetailId=1000023624,
SorceDetailId=1000023622,
} }
} }
}); ; }); ; ;
} }
} }
} }

View File

@@ -12,9 +12,6 @@ namespace U8AppMain.Voucher
public class IdEnity public class IdEnity
{ {
public string cAcc_Id { get; set; } public string cAcc_Id { get; set; }
public string cVouchType { get; set; } public string cVouchType { get; set; }

View File

@@ -139,6 +139,20 @@ namespace NX.ERP.U8.Account
} }
public virtual double FormatUPrice(double uPrice)
{
try
{
return Math.Round(uPrice, PriceDecDgt);
}
catch (Exception)
{
throw;
}
}
public double FormatMoney(double currMoney) public double FormatMoney(double currMoney)
{ {
try try

View File

@@ -36,7 +36,7 @@ namespace NX.ERP.U8
iMassDate AS 保质期数, iMassDate AS 保质期数,
cMassUnit AS 保质期单位, cMassUnit AS 保质期单位,
iWarnDays AS 保质期预警天数, iWarnDays AS 保质期预警天数,
cInvCCode AS 存货大类编码, cInvCCode AS InvCCode,
cReplaceItem AS 替换件, cReplaceItem AS 替换件,
cPosition AS 货位编码, cPosition AS 货位编码,
bSale AS 是否销售, bSale AS 是否销售,

View File

@@ -12,11 +12,11 @@ namespace NX.ERP.U8.Purchase
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
{ {
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, string strSQL = @"select a.id,a.cCode as ArrivalCode,A.cbustype AS busType,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.Autoid as id,b.ID as ArrivalID,
b.cInvCode AS MaterielCode, b.cInvCode AS MaterielCode,
b.cBatch AS BatchNo, b.cBatch AS BatchNo,
b.cUnitID AS UnitCode,b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.iorimoney as orimoney,b.ioritaxprice as oritaxprice,b.iorisum as orisum, b.cUnitID AS UnitCode,b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.icost as cost,b.iorimoney as orimoney,b.ioritaxprice as oritaxprice,b.iorisum as orisum,
B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid from B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid from
pu_ArrHead as a pu_ArrHead as a
left join pu_arrbody as b on a.id=b.id left join pu_arrbody as b on a.id=b.id

View File

@@ -46,6 +46,73 @@ namespace NX.ERP.U8.Store
} }
public virtual void GetUnitPriceByTaxCost(double iQuan, double itaxcost, double itaxrate, double iExchRate, out double iprice, out double itaxprice, out double isum)
{
try
{
var info = new NX.ERP.U8.Account.Accinformation();
iprice = info.FormatMoney(itaxcost / (1.0 + itaxrate / 100.0) * iExchRate * iQuan);
itaxprice = info.FormatMoney(itaxcost / (1.0 + itaxrate / 100.0) * iExchRate * iQuan * (itaxrate / 100.0));
isum = info.FormatMoney(itaxcost * iExchRate * iQuan);
}
catch (Exception)
{
throw;
}
}
public virtual void GetOriPriceByTaxCost(double iQuan, double itaxcost, double itaxrate, out double iorimoney, out double ioritaxprice, out double iorisum, out double iunitcost)
{
try
{
var info = new Account.Accinformation();
iorimoney = info.FormatMoney(itaxcost / (1.0 + itaxrate / 100.0) * iQuan);
ioritaxprice = info.FormatMoney(itaxcost / (1.0 + itaxrate / 100.0) * iQuan * (itaxrate / 100.0));
iorisum = info.FormatMoney(itaxcost * iQuan);
iunitcost = info.FormatUPrice(itaxcost / (1.0 + itaxrate / 100.0));
}
catch (Exception)
{
throw;
}
}
public virtual void GetOriPriceByCost(double iQuan, double iunitcost, double itaxrate, out double iorimoney, out double ioritaxprice, out double iorisum, out double itaxcost)
{
try
{
var info = new Account.Accinformation();
iorimoney = info.FormatMoney(iunitcost * iQuan);
ioritaxprice = info.FormatMoney(iunitcost * iQuan * (itaxrate / 100.0));
iorisum = info.FormatMoney(iunitcost * (1.0 + itaxrate / 100.0) * iQuan);
itaxcost = info.FormatUPrice(iunitcost * (1.0 + itaxrate / 100.0));
}
catch (Exception)
{
throw;
}
}
public virtual void GetUnitPriceByCost(double iQuan, double iunitcost, double itaxrate, double iExchRate, out double iprice, out double itaxprice, out double isum)
{
try
{
var info = new NX.ERP.U8.Account.Accinformation();
iprice = info.FormatMoney(iunitcost * iExchRate * iQuan);
itaxprice = info.FormatMoney(iunitcost * iExchRate * iQuan * (itaxrate / 100.0));
isum = info.FormatMoney(iunitcost * iExchRate * (1.0 + itaxrate / 100.0) * iQuan);
}
catch (Exception)
{
throw;
}
}
/// <summary> /// <summary>
/// 保存一个采购到货单 /// 保存一个采购到货单
@@ -53,49 +120,35 @@ namespace NX.ERP.U8.Store
/// <param name="puStoreIn"></param> /// <param name="puStoreIn"></param>
public void AddPuStoreIn(Model.Store.PuStoreIn puStoreIn) public void AddPuStoreIn(Model.Store.PuStoreIn puStoreIn)
{ {
VoucherParameter voucherParameter = new VoucherParameter(); VoucherParameter voucherParameter = new VoucherParameter();
voucherParameter.VoucherType = "01"; voucherParameter.VoucherType = "01";
voucherParameter.DomHead = new DOMDocumentClass(); voucherParameter.DomHead = new DOMDocumentClass();
voucherParameter.DomBody = new DOMDocumentClass(); voucherParameter.DomBody = new DOMDocumentClass();
DOMDocument domHead = voucherParameter.DomHead; DOMDocument domHead = voucherParameter.DomHead;
DOMDocument domBody = voucherParameter.DomBody; DOMDocument domBody = voucherParameter.DomBody;
voucherParameter.DomHead.loadXML(ReadFile(AppDomain.CurrentDomain.BaseDirectory + "\\XMLDOM\\XMLDomHead01.xml")); voucherParameter.DomHead.loadXML(ReadFile(AppDomain.CurrentDomain.BaseDirectory + "\\XMLDOM\\XMLDomHead01.xml"));
voucherParameter.DomBody.loadXML(ReadFile(AppDomain.CurrentDomain.BaseDirectory + "\\XMLDOM\\XMLDomBody01.xml")); voucherParameter.DomBody.loadXML(ReadFile(AppDomain.CurrentDomain.BaseDirectory + "\\XMLDOM\\XMLDomBody01.xml"));
IXMLDOMElement headXml = domHead.createElement("z:row");
headXml.setAttribute("cvouchtype", "01");//DomHead[0]["cvouchtype"] = ""; //单据类型,string类型
headXml.setAttribute("id", puStoreIn.Id); //DomHead[0]["id"] = ""; //主关键字段,int类型
headXml.setAttribute("bomfirst", "0"); //DomHead[0]["bomfirst"] = ""; //委外期初标志,string类型
headXml.setAttribute("ccode", puStoreIn.Code); //DomHead[0]["ccode"] = ""; //入库单号,string类型
headXml.setAttribute("ddate", puStoreIn.Date.ToShortDateString()); //DomHead[0]["ddate"] = ""; //入库日期,DateTime类型
IXMLDOMElement iXMLDOMElement = domHead.createElement("z:row"); headXml.setAttribute("iverifystate", 0); //DomHead[0]["iverifystate"] = ""; //iverifystate,int类型
iXMLDOMElement.setAttribute("id", "11"); //DomHead[0]["id"] = ""; //主关键字段,int类型 headXml.setAttribute("iswfcontrolled", 0); //DomHead[0]["iswfcontrolled"] = ""; //iswfcontrolled,int类型
iXMLDOMElement.setAttribute("bomfirst", "0"); //DomHead[0]["bomfirst"] = ""; //委外期初标志,string类型 headXml.setAttribute("bpufirst", "0"); //DomHead[0]["bpufirst"] = ""; //采购期初标志,string类型
iXMLDOMElement.setAttribute("ccode", "211"); //DomHead[0]["ccode"] = ""; //入库单号,string类型 headXml.setAttribute("brdflag", 1); //DomHead[0]["brdflag"] = ""; //收发标志,int类型
iXMLDOMElement.setAttribute("ddate", puStoreIn.Date.ToShortDateString()); //DomHead[0]["ddate"] = ""; //入库日期,DateTime类型 headXml.setAttribute("csource", puStoreIn.Source); //DomHead[0]["csource"] = ""; //单据来源,int类型
iXMLDOMElement.setAttribute("iverifystate", 1); //DomHead[0]["iverifystate"] = ""; //iverifystate,int类型 headXml.setAttribute("cmaker", U8LoginContext.Instance.LoginUserName);//DomHead[0]["cmaker"] = ""; //制单人,string类型
iXMLDOMElement.setAttribute("iswfcontrolled", 1); //DomHead[0]["iswfcontrolled"] = ""; //iswfcontrolled,int类型 headXml.setAttribute("vt_id", "27");
//iXMLDOMElement.setAttribute("cbustype", "0"); //DomHead[0]["cbustype"] = ""; //业务类型,int类型 headXml.setAttribute("editprop", "A");
//iXMLDOMElement.setAttribute("iexchrate", 1); //DomHead[0]["iexchrate"] = ""; //汇率,double类型 headXml.setAttribute("cdepcode", puStoreIn.Depcode);
//iXMLDOMElement.setAttribute("cexch_name", "人民币"); //DomHead[0]["cexch_name"] = ""; //币种,string类型 headXml.setAttribute("cpersoncode", puStoreIn.PersonCode);
//iXMLDOMElement.setAttribute("ufts", "asdasd"); //DomHead[0]["ufts"] = ""; //时间戳,string类型 headXml.setAttribute("crdcode", puStoreIn.RdCode);
iXMLDOMElement.setAttribute("bpufirst", "0"); //DomHead[0]["bpufirst"] = ""; //采购期初标志,string类型 headXml.setAttribute("cwhcode", "1");
headXml.setAttribute("bisstqc", "0");
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", U8LoginContext.Instance.LoginUserName);//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 == "采购到货单") if (puStoreIn.Source == "采购到货单")
{ {
var Arrival = new Purchase.ArrivalDAL().GetModel(puStoreIn.SourceCode); var Arrival = new Purchase.ArrivalDAL().GetModel(puStoreIn.SourceCode);
@@ -103,73 +156,122 @@ namespace NX.ERP.U8.Store
//iXMLDOMElement.setAttribute("cvencode", puStoreIn.SupplierCode); //DomHead[0]["cvencode"] = ""; //供货单位编码,string类型 //iXMLDOMElement.setAttribute("cvencode", puStoreIn.SupplierCode); //DomHead[0]["cvencode"] = ""; //供货单位编码,string类型
//iXMLDOMElement.setAttribute("cvenabbname", puStoreIn.SupplierName);//DomHead[0]["cvenabbname"] = ""; //供货单位,string类型 //iXMLDOMElement.setAttribute("cvenabbname", puStoreIn.SupplierName);//DomHead[0]["cvenabbname"] = ""; //供货单位,string类型
iXMLDOMElement.setAttribute("cbustype", Arrival.SupplierCode); headXml.setAttribute("cbustype", Arrival.BusType);
iXMLDOMElement.setAttribute("iexchrate", Arrival.ExchRate); headXml.setAttribute("iexchrate", Arrival.ExchRate);
iXMLDOMElement.setAttribute("cexch_name", Arrival.ExchName); headXml.setAttribute("cexch_name", Arrival.ExchName);
iXMLDOMElement.setAttribute("cvencode", Arrival.VenCode); headXml.setAttribute("cvencode", Arrival.VenCode);
headXml.setAttribute("carvcode", Arrival.ArrivalCode);
headXml.setAttribute("ipurarriveid", Arrival.Id);
headXml.setAttribute("darvdate", Arrival.Date);
headXml.setAttribute("itaxrate", Arrival.TaxRate);
iXMLDOMElement.setAttribute("carvcode", Arrival.ArrivalCode); headXml.setAttribute("cptcode", Arrival.PTCode);
iXMLDOMElement.setAttribute("ipurarriveid", Arrival.Id);
iXMLDOMElement.setAttribute("darvdate", Arrival.Date);
iXMLDOMElement.setAttribute("itaxrate", Arrival.TaxRate);
iXMLDOMElement.setAttribute("cptcode", Arrival.PTCode); domHead.selectSingleNode("//rs:data").appendChild(headXml);
IXMLDOMElement bodyXml;
domHead.selectSingleNode("//rs:data").appendChild(iXMLDOMElement);
for (var n = 0; n < puStoreIn.PuStoreInDetails.Count; n++) for (var n = 0; n < puStoreIn.PuStoreInDetails.Count; n++)
{ {
var detail = puStoreIn.PuStoreInDetails[n]; var detail = puStoreIn.PuStoreInDetails[n];
var arrivalDetail = Arrival.ArrivalDetails.First(m => { return m.Id == detail.SorceDetailId; }); var arrivalDetail = Arrival.ArrivalDetails.First(m => { return m.Id == detail.SorceDetailId; });
headXml.setAttribute("cordercode", arrivalDetail.OrderCode);
(domHead.selectSingleNode("//z:row") as IXMLDOMElement).setAttribute("cordercode", arrivalDetail.OrderCode); // headXml.setAttribute("ipurorderid", arrivalDetail.PoId);
(domHead.selectSingleNode("//z:row") as IXMLDOMElement).setAttribute("ipurorderid", arrivalDetail.PoId); bodyXml = domBody.createElement("z:row");
bodyXml.setAttribute("cinvcode", detail.Invcode);
iXMLDOMElement = domBody.createElement("z:row"); bodyXml.setAttribute("iquantity", detail.Quantity);
iXMLDOMElement.setAttribute("cinvcode", detail.Invcode); bodyXml.setAttribute("irowno", n);
iXMLDOMElement.setAttribute("iquantity", detail.Quantity); bodyXml.setAttribute("cbvencode", "10001");
iXMLDOMElement.setAttribute("irowno", n); bodyXml.setAttribute("inquantity", detail.Quantity); //应收数量,double类型
iXMLDOMElement.setAttribute("cbvencode", "10001"); bodyXml.setAttribute("cbatch", detail.Batch);
bodyXml.setAttribute("innum", 0);
iXMLDOMElement.setAttribute("cbatch", detail.Batch); //iXMLDOMElement.setAttribute("carvcode", Arrival.ArrivalCode);
iXMLDOMElement.setAttribute("carvcode", Arrival.ArrivalCode); bodyXml.setAttribute("cbarvcode", Arrival.ArrivalCode);
iXMLDOMElement.setAttribute("cbarvcode", Arrival.ArrivalCode); bodyXml.setAttribute("ipurarriveid", Arrival.Id);
iXMLDOMElement.setAttribute("ipurarriveid", Arrival.Id); bodyXml.setAttribute("iarrsid", detail.SorceDetailId);
iXMLDOMElement.setAttribute("iarrsid", detail.SorceDetailId); bodyXml.setAttribute("darvdate", DateTime.Today.ToShortDateString());
iXMLDOMElement.setAttribute("darvdate", DateTime.Today.ToShortDateString()); bodyXml.setAttribute("editprop", "A");
iXMLDOMElement.setAttribute("editprop", "A"); bodyXml.setAttribute("cpoid", arrivalDetail.OrderCode);
iXMLDOMElement.setAttribute("cpoid", arrivalDetail.OrderCode); bodyXml.setAttribute("iposid", arrivalDetail.posId);
iXMLDOMElement.setAttribute("iposid", arrivalDetail.posId); bodyXml.setAttribute("itaxrate", Arrival.TaxRate);
var info = new NX.ERP.U8.Account.Accinformation(); var info = new Account.Accinformation();
//iorimoney = FormatMoney(iunitcost * iQuan);
//ioritaxprice = FormatMoney(iunitcost * iQuan * (itaxrate / 100.0));
//iorisum = FormatMoney(iunitcost * (1.0 + itaxrate / 100.0) * iQuan);
//itaxcost = FormatUPrice(iunitcost * (1.0 + itaxrate / 100.0));
var iorisum = info.FormatMoney(arrivalDetail.oricost * (1.00 + (Arrival.TaxRate / 100.0)) * detail.Quantity);
var ioritaxprice = info.FormatMoney(arrivalDetail.oricost * (Arrival.TaxRate / 100.0) * detail.Quantity); double iprice2;
var iorimoney = info.FormatMoney(arrivalDetail.oricost * detail.Quantity); double itaxprice2;
var oritaxcost = info.FormatMoney(arrivalDetail.oricost * (1.00 + (Arrival.TaxRate / 100.0))); double isum2;
iXMLDOMElement.setAttribute("ioricost", arrivalDetail.oricost);
iXMLDOMElement.setAttribute("ioritaxcost", oritaxcost); GetUnitPriceByCost(detail.Quantity, arrivalDetail.oricost, Arrival.TaxRate, Arrival.ExchRate, out iprice2, out itaxprice2, out isum2);
iXMLDOMElement.setAttribute("iorimoney", iorimoney); bodyXml.setAttribute("iunitcost", arrivalDetail.cost);
iXMLDOMElement.setAttribute("ioritaxprice", ioritaxprice); bodyXml.setAttribute("iprice", iprice2);
iXMLDOMElement.setAttribute("iorisum", iorisum); bodyXml.setAttribute("facost", arrivalDetail.cost);
domBody.selectSingleNode("//rs:data").appendChild(iXMLDOMElement); bodyXml.setAttribute("iaprice", iprice2);
bodyXml.setAttribute("itaxprice", itaxprice2);
bodyXml.setAttribute("isum", isum2);
//double price;
//double taxprice;
//double sum;
//GetUnitPriceByCost(detail.Quantity, arrivalDetail.cost, Arrival.TaxRate, Arrival.ExchRate, out price, out taxprice, out sum);
//bodyXml.setAttribute("iunitcost", arrivalDetail.cost); //本币单价,double类型
//bodyXml.setAttribute("iprice", price); //本币金额,double类型
//bodyXml.setAttribute("facost", arrivalDetail.cost); //暂估单价,double类型
//bodyXml.setAttribute("itaxprice", taxprice);//本币税额,double类型
//bodyXml.setAttribute("isum", sum);//本币价税合计,double类型
double iorimoney2;
double ioritaxprice2;
double iorisum2;
double iunitcost2;
GetOriPriceByCost(detail.Quantity, arrivalDetail.oricost, Arrival.TaxRate, out iorimoney2, out ioritaxprice2, out iorisum2, out iunitcost2);
bodyXml.setAttribute("ioricost", arrivalDetail.oricost);
bodyXml.setAttribute("ioritaxcost", arrivalDetail.oritaxcost);
bodyXml.setAttribute("iorimoney", iorimoney2);
bodyXml.setAttribute("ioritaxprice", ioritaxprice2);
bodyXml.setAttribute("iorisum", iorisum2);
//var iorisum = info.FormatMoney(arrivalDetail.oricost * (1.00 + (Arrival.TaxRate / 100.0)) * detail.Quantity);
//var ioritaxprice = info.FormatMoney(arrivalDetail.oricost * (Arrival.TaxRate / 100.0) * detail.Quantity);
//var iorimoney = info.FormatMoney(arrivalDetail.oricost * detail.Quantity);
//var oritaxcost = info.FormatMoney(arrivalDetail.oricost * (1.00 + (Arrival.TaxRate / 100.0)));
//double money;
//double taxcost;
//GetOriPriceByCost(detail.Quantity, arrivalDetail.oricost, Arrival.TaxRate, out money, out taxprice, out sum, out taxcost);
//bodyXml.setAttribute("ioricost", arrivalDetail.oricost);
//bodyXml.setAttribute("ioritaxcost", arrivalDetail.oritaxcost);
//bodyXml.setAttribute("iorimoney", money);
//bodyXml.setAttribute("ioritaxprice", taxprice);
//bodyXml.setAttribute("iorisum", sum);
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
} }
} }
var str = voucherParameter.DomBody.xml; var str = voucherParameter.DomBody.xml;
Console.WriteLine(str); Console.WriteLine(str);
try
{
U8LoginContext.Instance.AddRdVoucher("U8API/PuStoreIn/Add", voucherParameter); U8LoginContext.Instance.AddRdVoucher("U8API/PuStoreIn/Add", voucherParameter);
}
catch (Exception err)
{
throw err;
}
} }
public void Loadd() public void LoadTemplate()
{ {
VoucherParameter rdVoucherParameter = null; VoucherParameter rdVoucherParameter = null;

View File

@@ -1,4 +1,6 @@
using System; using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
@@ -28,16 +30,31 @@ namespace NX.ERP.WebAPi
public static void Register(HttpConfiguration config) public static void Register(HttpConfiguration config)
{ {
// Web API 配置和服务 // Web API 配置和服务
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings
{
//忽略循环引用,如果设置为Error,则遇到循环引用的时候报错
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
Formatting = Newtonsoft.Json.Formatting.Indented,
//小驼峰命名法
ContractResolver = new DefaultContractResolver() {
NamingStrategy = new SnakeCaseNamingStrategy()
}
//格式化日期时间
//空值处理
//NullValueHandling = NullValueHandling.Ignore
};
// Web API 路由 // Web API 路由
config.MapHttpAttributeRoutes(); config.MapHttpAttributeRoutes();
var jsonFormatter = new JsonMediaTypeFormatter();
config.Services.Replace(typeof(IContentNegotiator), new JsonContentNegotiator(jsonFormatter));
config.Routes.MapHttpRoute( config.Routes.MapHttpRoute(
name: "DefaultApi", name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}", routeTemplate: "api/{controller}/{action}/{code}",
defaults: new { id = RouteParameter.Optional } defaults: new { code = RouteParameter.Optional }
); );
} }
} }

View File

@@ -9,6 +9,7 @@ namespace NX.ERP.WebAPi.Controllers
{ {
public class ArrivalController : ApiController public class ArrivalController : ApiController
{ {
// GET api/values // GET api/values
[HttpGet] [HttpGet]
public IEnumerable<Model.Purchase.Arrival> List() public IEnumerable<Model.Purchase.Arrival> List()
@@ -18,5 +19,13 @@ namespace NX.ERP.WebAPi.Controllers
} }
[HttpGet]
public Model.Purchase.Arrival Model(string Code)
{
var customerDAL = new ArrivalDAL();
return customerDAL.GetModel(Code);
}
} }
} }