来料检验入库单接口,单据已入,待验证单据数据完整

This commit is contained in:
杰 朱
2021-10-18 15:59:15 +08:00
parent 358db35b2a
commit d14a36fb07
8 changed files with 209 additions and 5 deletions

View File

@@ -125,6 +125,87 @@ namespace NX.ERP.U8.Store
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
}
}
else if (puStoreIn.Source == "来料检验单")
{
var Arrival = new Purchase.ArrivalDAL().GetModelNeedCheck(puStoreIn.SourceCode);
var Qmcheckvoucher = new Qmcheck.QmcheckDAL().GetModel(puStoreIn.Ccheckcode);
if (Arrival == null)
{
throw new Exception("未知采购到货单,或到货单已经入库完成");
}
if (Qmcheckvoucher == null)
{
throw new Exception("未知质检单,或到货单已经入库完成");
}
headXml.setAttribute("cbustype", Arrival.BusType);
headXml.setAttribute("iexchrate", Arrival.ExchRate);
headXml.setAttribute("cexch_name", Arrival.ExchName);
headXml.setAttribute("cvencode", Arrival.VenCode);
headXml.setAttribute("carvcode", Arrival.ArrivalNo);
headXml.setAttribute("ipurarriveid", Arrival.ArrivalId);
headXml.setAttribute("darvdate", Arrival.ArrivalDate);
headXml.setAttribute("itaxrate", Arrival.TaxRate);
headXml.setAttribute("cptcode", Arrival.PTCode);
headXml.setAttribute("cpersoncode", Arrival.CPersonCode);
headXml.setAttribute("cpersonname", Arrival.cpersonname);
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);
bodyXml = domBody.createElement("z:row");
if (arrivalDetail.cunitid != 0) //需要做辅助计量单位
{
var _inum = detail.Quantity / arrivalDetail.inspecexchrate;
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("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("dbarvdate", Arrival.ArrivalDate.ToString("yyyy-MM-dd"));
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("ccheckcode", Qmcheckvoucher.ccheckcode);
bodyXml.setAttribute("icheckidbaks", Qmcheckvoucher.id);
bodyXml.setAttribute("dcheckdate", Qmcheckvoucher.ddate.ToString("G"));
bodyXml.setAttribute("ccheckpersoncode", Qmcheckvoucher.ccheckpersoncode);
bodyXml.setAttribute("ccheckpersonname", Qmcheckvoucher.ccheckpersonname);
bodyXml.setAttribute("itaxrate", Arrival.TaxRate);
var info = new Account.Accinformation();
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("facost", arrivalDetail.cost);
bodyXml.setAttribute("iaprice", iprice2);//
bodyXml.setAttribute("itaxprice", itaxprice2);
bodyXml.setAttribute("isum", isum2);
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("ioritaxprice", ioritaxprice2);
bodyXml.setAttribute("iorisum", iorisum2);
bodyXml.setAttribute("irowno", domBody.selectSingleNode("//rs:data").childNodes.length + 1);
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
}
}
domHead.selectSingleNode("//rs:data").appendChild(headXml);
return AddRdVoucher(voucherParameter);