This commit is contained in:
gongxh
2021-03-23 15:06:34 +08:00
parent 7e48441739
commit 27fccb1674
18 changed files with 267 additions and 50 deletions

View File

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

View File

@@ -0,0 +1,52 @@
using MSXML2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.U8.Store
{
public class BinChangeDAL : VoucherBase
{
public BinChangeDAL() : base("19", "U8API/BinChange")
{
}
public string AddVocher(Model.Request.BinChange binChange)
{
VoucherParameter voucherParameter = new VoucherParameter
{
VoucherType = this.VoucherID,
DomHead = new DOMDocumentClass(),
DomBody = new DOMDocumentClass()
};
DOMDocument domHead = voucherParameter.DomHead;
DOMDocument domBody = voucherParameter.DomBody;
voucherParameter.DomHead.loadXML(HeadTemplate);
voucherParameter.DomBody.loadXML(BodyTemplate);
IXMLDOMElement headXml = domHead.createElement("z:row");
headXml.setAttribute("id", 0);
headXml.setAttribute("ddate", DateTime.Now.ToShortDateString());
headXml.setAttribute("ddate", DateTime.Now.ToShortDateString());
headXml.setAttribute("cwhcode", binChange.whCode);
headXml.setAttribute("vt_id", new VT().GetDefaltVTID("0313"));
headXml.setAttribute("cvouchcode", "00000009998");
foreach (var item in binChange.binChangeDetails)
{
var bodyXml = domBody.createElement("z:row");
bodyXml.setAttribute("cinvcode", item.InvCode);
bodyXml.setAttribute("cbposcode", item.SoucePositon);
bodyXml.setAttribute("caposcode", item.DestPostion);
bodyXml.setAttribute("iquantity", item.Qty);
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
}
domHead.selectSingleNode("//rs:data").appendChild(headXml);
return this.AddRdVoucher(voucherParameter);
}
}
}

View File

@@ -106,17 +106,18 @@ namespace NX.ERP.U8.Store
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);
var _oricost = (arrivalDetail.orisum / (1 + (Arrival.TaxRate / 100f)) / arrivalDetail.Qty);
FormatHelp.GetUnitPriceByCost(detail.Quantity, _oricost /*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("iprice", iprice2);//
bodyXml.setAttribute("facost", arrivalDetail.cost);
bodyXml.setAttribute("iaprice", iprice2);
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);
FormatHelp.GetOriPriceByCost(detail.Quantity, _oricost /*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("iorimoney", iorimoney2);//
bodyXml.setAttribute("ioritaxprice", ioritaxprice2);
bodyXml.setAttribute("iorisum", iorisum2);
bodyXml.setAttribute("irowno", domBody.selectSingleNode("//rs:data").childNodes.length + 1);

View File

@@ -0,0 +1,31 @@
using Dapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.U8.Store
{
public class StockDAL
{
public IEnumerable<Model.Response.Store.Stock> GetList(string strwhere = "", object Params = null)
{
using (var conn = U8LoginContext.Instance.Connection)
{
var sql = @"select a.cInvCode as MaterialCode ,c.cPosName as BinName,(isnull(a.iQuantity,0)-isnull(b.iQuantity,0)) as Qty from (
select cInvCode,cPosCode , sum(iQuantity)as iQuantity from InvPosition where bRdFlag=1 group by cInvCode,cPosCode
)a full join (
select cInvCode,cPosCode , sum(iQuantity)as iQuantity from InvPosition where bRdFlag=0 group by cInvCode,cPosCode)
b on isnull(a.cInvCode,'')=isnull(b.cInvCode,'') and a.cPosCode=b.cPosCode
left join Position c on a.cPosCode=c.cPosCode
where a.cPosCode like '021%'";
if (!string.IsNullOrEmpty(strwhere))
{
sql += $" where {strwhere}";
}
return conn.Query<Model.Response.Store.Stock>(sql, Params);
}
}
}
}