diff --git a/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs b/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs index dd8df3d..29a8ae6 100644 --- a/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs +++ b/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs @@ -50,15 +50,46 @@ namespace NX.ERP.Model.Purchase [Newtonsoft.Json.JsonIgnore] 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, - /// - /// 辅助计量单位的数量 - /// - public double isum { get; set; } + // b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.iorimoney as orimoney,b.oritaxprice as oritaxprice,b.iorisum as orisum, + /// + /// 主计量单位编码 + /// + [Newtonsoft.Json.JsonIgnore] + public int ccomunitcode { get; set; } + /// + /// 主计量单位名称 + /// + [Newtonsoft.Json.JsonIgnore] + public string cinvm_unit { get; set; } + /// + /// 辅助计量单位的数量 + /// + [Newtonsoft.Json.JsonIgnore] + public double inum { get; set; } + /// + /// 辅助计量单位编码 + /// + [Newtonsoft.Json.JsonIgnore] + public int cunitid { get; set; } + /// + /// 辅助计量单位名称 + /// + [Newtonsoft.Json.JsonIgnore] + public string cinva_unit { get; set; } + /// + /// 主副计量单位换算率 + /// + [Newtonsoft.Json.JsonIgnore] + public double inspecexchrate { get; set; } + ///// + ///// + ///// + //[Newtonsoft.Json.JsonIgnore] + //public double cwhcode { get; set; } } } diff --git a/NX.ERP.U8/Purchase/ArrivalDAL.cs b/NX.ERP.U8/Purchase/ArrivalDAL.cs index 1680d29..106542e 100644 --- a/NX.ERP.U8/Purchase/ArrivalDAL.cs +++ b/NX.ERP.U8/Purchase/ArrivalDAL.cs @@ -17,7 +17,7 @@ namespace NX.ERP.U8.Purchase b.cBatch AS BatchNo, b.fvalidinquan as RealQuantity, b.ccomunitcode 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 + B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid,b.iNum,b.ccomunitcode,b.cunitid,b.cinva_unit,b.cinvm_unit,b.inspecexchrate FROM pu_ArrBody b inner join pu_ArrHead a on a.id=b.id inner join (select cinvcode as cinvcode1,iId from inventory) inventory on b.cinvcode=inventory.cinvcode1 Left Join PO_Podetails C WITH (NOLOCK) ON B.iPOsID = C.ID diff --git a/NX.ERP.U8/Store/PuStoreInDAL.cs b/NX.ERP.U8/Store/PuStoreInDAL.cs index 900c188..6289f32 100644 --- a/NX.ERP.U8/Store/PuStoreInDAL.cs +++ b/NX.ERP.U8/Store/PuStoreInDAL.cs @@ -54,6 +54,10 @@ namespace NX.ERP.U8.Store if (puStoreIn.Source == "采购到货单") { var Arrival = new Purchase.ArrivalDAL().GetModel(puStoreIn.SourceCode); + if (Arrival == null) + { + throw new Exception("未知采购到货单,或到货单已经入库完成"); + } headXml.setAttribute("cbustype", Arrival.BusType); headXml.setAttribute("iexchrate", Arrival.ExchRate); headXml.setAttribute("cexch_name", Arrival.ExchName); @@ -69,16 +73,36 @@ namespace NX.ERP.U8.Store { 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; + 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", n + 1); bodyXml.setAttribute("cbvencode", "10001"); bodyXml.setAttribute("inquantity", detail.Quantity); //应收数量,double类型 bodyXml.setAttribute("cbatch", detail.Batch); - bodyXml.setAttribute("innum", 0); + bodyXml.setAttribute("cposition", detail.Position); // bodyXml.setAttribute("cposname", "B1Y1H001"); //货位,string类型 //iXMLDOMElement.setAttribute("carvcode", Arrival.ArrivalCode); diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config index c9dba9e..0b2c04a 100644 --- a/NX.ERP.WebAPi/Web.config +++ b/NX.ERP.WebAPi/Web.config @@ -7,8 +7,8 @@ - - + +