This commit is contained in:
gongxh
2021-03-15 13:13:36 +08:00
3 changed files with 67 additions and 28 deletions

View File

@@ -99,34 +99,9 @@ namespace NX.ERP.U8.Store
VoucherParameter voucherParameter = this.LoadVoucher($"cCode='{storeIn.Code}'"); VoucherParameter voucherParameter = this.LoadVoucher($"cCode='{storeIn.Code}'");
DOMDocument domHead = voucherParameter.DomHead;
DOMDocument domBody = voucherParameter.DomBody; DOMDocument domBody = voucherParameter.DomBody;
IXMLDOMElement headXml = domHead.createElement("z:row");
headXml.setAttribute("bpufirst", "0");
headXml.setAttribute("bisstqc", "0");
headXml.setAttribute("bomfirst", "0");
headXml.setAttribute("biafirst", "0");
headXml.setAttribute("brdflag", 1);
headXml.setAttribute("ccode", storeIn.Code);
headXml.setAttribute("ddate", storeIn.Date);
headXml.setAttribute("cmaker", storeIn.Maker);
headXml.setAttribute("cvouchtype", this.VoucherID);
headXml.setAttribute("vt_id", new VT().GetDefaltVTID("0302"));
headXml.setAttribute("editprop", "A");
headXml.setAttribute("cdepcode", "");
headXml.setAttribute("cpersoncode", "");
headXml.setAttribute("crdcode", "");
headXml.setAttribute("csource", "库存");
headXml.setAttribute("cwhcode", storeIn.WhCode);
headXml.setAttribute("cbustype", "其他出库");
headXml.setAttribute("cmemo", "");
IXMLDOMElement bodyXml; IXMLDOMElement bodyXml;
for (var n = 0; n < storeIn.details.Count(); n++) for (var n = 0; n < storeIn.details.Count(); n++)
{ {
@@ -159,7 +134,7 @@ namespace NX.ERP.U8.Store
domBody.selectSingleNode("//rs:data").appendChild(bodyXml); domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
} }
domHead.selectSingleNode("//rs:data").appendChild(headXml);
var str = voucherParameter.DomBody.xml; var str = voucherParameter.DomBody.xml;
Console.WriteLine(str); Console.WriteLine(str);
try try

View File

@@ -99,6 +99,60 @@ namespace NX.ERP.U8.Store
} }
public bool UpdateVoucher(SaleStoreOut storeOut)
{
VoucherParameter voucherParameter = this.LoadVoucher($"cCode='{storeOut.Code}'");
DOMDocument domBody = voucherParameter.DomBody;
IXMLDOMElement bodyXml;
if (storeOut.Source == "发货单")
{
var dispatch = new Sale.DispatchListDAL().GetModel(storeOut.SourceCode);
for (var n = 0; n < storeOut.Details.Count; n++)
{
bodyXml = domBody.createElement("z:row");
var detail = storeOut.Details[n];
bodyXml.setAttribute("cinvcode", detail.InvCode);
bodyXml.setAttribute("iquantity", detail.Quantity);
bodyXml.setAttribute("cposition", detail.Position);
bodyXml.setAttribute("editprop", "A");
bodyXml.setAttribute("irowno", domBody.selectSingleNode("//rs:data").childNodes.length + 1);
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
}
}
try
{
return UpdateRdVoucher(voucherParameter);
}
catch (Exception err)
{
throw err;
}
}
} }
} }

View File

@@ -17,5 +17,15 @@ namespace NX.ERP.WebAPi.Controllers.Store
var dal = new NX.ERP.U8.Store.SaleOutDAL(); var dal = new NX.ERP.U8.Store.SaleOutDAL();
return new { Id = dal.AddVoucher(storeIn) }; return new { Id = dal.AddVoucher(storeIn) };
} }
[Route("api/SaleStoreOut/Update")]
[HttpPost]
public bool UpdateVoucher([FromBody] Model.Request.SaleStoreOut storeIn)
{
var dal = new NX.ERP.U8.Store.SaleOutDAL();
// return new { Id = dal.UpdateVoucher(storeIn) };
return dal.UpdateVoucher(storeIn);
}
} }
} }