增加材料出库单查询接口
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using MSXML2;
|
||||
using Dapper;
|
||||
using MSXML2;
|
||||
using NX.ERP.Model.Store;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -39,7 +40,7 @@ namespace NX.ERP.U8.Store
|
||||
}
|
||||
headXml.setAttribute("cbustype", "领料");
|
||||
headXml.setAttribute("cbuscode", metailApp.Code);
|
||||
|
||||
|
||||
string lastProductNo = null;
|
||||
decimal moqty = 0;
|
||||
string DeptName = "";
|
||||
@@ -49,7 +50,7 @@ namespace NX.ERP.U8.Store
|
||||
for (var n = 0; n < storeOut.Details.Count(); n++)
|
||||
{
|
||||
var detail = storeOut.Details[n];
|
||||
var materialAppDetail = metailApp.MaterialAppVouchsLst.FirstOrDefault(m => m.MaterialAppDtlId== detail.SorceDetailId);
|
||||
var materialAppDetail = metailApp.MaterialAppVouchsLst.FirstOrDefault(m => m.MaterialAppDtlId == detail.SorceDetailId);
|
||||
if (materialAppDetail == null)
|
||||
{
|
||||
throw new Exception("未知明细");
|
||||
@@ -83,7 +84,7 @@ namespace NX.ERP.U8.Store
|
||||
bodyXml.setAttribute("editprop", "A");
|
||||
bodyXml.setAttribute("innum", 10);
|
||||
bodyXml.setAttribute("imoseq", materialAppDetail.Moseq);
|
||||
bodyXml.setAttribute("inquantity", materialAppDetail.Quantit- materialAppDetail.OutQuantity);
|
||||
bodyXml.setAttribute("inquantity", materialAppDetail.Quantit - materialAppDetail.OutQuantity);
|
||||
bodyXml.setAttribute("crejectcode", materialAppDetail.RejectCode);
|
||||
bodyXml.setAttribute("iOMoMID", materialAppDetail.OmomId);
|
||||
bodyXml.setAttribute("iopseq", materialAppDetail.OpSeq);
|
||||
@@ -110,7 +111,7 @@ namespace NX.ERP.U8.Store
|
||||
bodyXml.setAttribute("ipesodid", materialAppDetail.PesodId);
|
||||
bodyXml.setAttribute("ipesoseq", materialAppDetail.PesoSeq);
|
||||
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
|
||||
|
||||
|
||||
}
|
||||
headXml.setAttribute("cpspcode", lastProductNo);
|
||||
headXml.setAttribute("imquantity", moqty);
|
||||
@@ -225,7 +226,7 @@ namespace NX.ERP.U8.Store
|
||||
voucherParameter.DomHead.loadXML(HeadTemplate);
|
||||
voucherParameter.DomBody.loadXML(BodyTemplate);
|
||||
IXMLDOMElement headXml = domHead.createElement("z:row");
|
||||
headXml.setAttribute("ccode","AAA"/* storeOut.Code*/); //DomHead[0]["ccode"] = ""; //入库单号,string类型
|
||||
headXml.setAttribute("ccode", "AAA"/* storeOut.Code*/); //DomHead[0]["ccode"] = ""; //入库单号,string类型
|
||||
headXml.setAttribute("ddate", storeOut.Date.ToShortDateString()); //DomHead[0]["ddate"] = ""; //入库日期,DateTime类型
|
||||
headXml.setAttribute("bpufirst", "0");
|
||||
headXml.setAttribute("bisstqc", "0");
|
||||
@@ -293,6 +294,53 @@ namespace NX.ERP.U8.Store
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public MaterialStoreOut GetModel(string Code)
|
||||
{
|
||||
return GetList(" a.cCode=@Code", new { Code }).FirstOrDefault();
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<MaterialStoreOut> GetList(string strWhere = "", object param = null)
|
||||
{
|
||||
string strSQL = @" select a.id,a.cCode as Code,a.iproorderid as iproorderid,a.dDate as date,a.cSource as Source,a.cBusCode as SourceCode,
|
||||
b.id,b.iQuantity as quantity, b.cPosition as binCode,b.impoids as SorceDetailId,b.cInvCode as InvCode,
|
||||
c.cInvName as InvName,c.cInvStd as InvStd
|
||||
from rdrecord11 a
|
||||
left join rdrecords11 as b on a.ID=b.ID
|
||||
left join Inventory as c on b.cInvCode=c.cInvCode ";
|
||||
if (!string.IsNullOrEmpty(strWhere))
|
||||
{
|
||||
strSQL += $" where {strWhere} ";
|
||||
}
|
||||
var lookup = new System.Collections.Generic.Dictionary<int, MaterialStoreOut>();
|
||||
using (var conn = U8LoginContext.Instance.Connection)
|
||||
{
|
||||
var list = conn.Query<MaterialStoreOut, MaterialStoreOutDetail, MaterialStoreOut>(strSQL, (a, b) =>
|
||||
{
|
||||
if (!lookup.TryGetValue(a.Id, out var _order))
|
||||
{
|
||||
lookup.Add(a.Id, a);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
a = _order;
|
||||
}
|
||||
|
||||
a.Details.Add(b);
|
||||
return a;
|
||||
}, param, null, true, "id", 10, System.Data.CommandType.Text);
|
||||
}
|
||||
|
||||
return lookup.Values;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -378,7 +426,8 @@ namespace NX.ERP.U8.Store
|
||||
}
|
||||
|
||||
|
||||
} else if (storeOut.Source=="领料申请单")
|
||||
}
|
||||
else if (storeOut.Source == "领料申请单")
|
||||
{
|
||||
|
||||
var metailApp = new U8.Store.MaterialAppDAL().GetModel(storeOut.SourceCode);
|
||||
@@ -386,7 +435,7 @@ namespace NX.ERP.U8.Store
|
||||
{
|
||||
throw new Exception("未知的领料申请单");
|
||||
}
|
||||
|
||||
|
||||
string lastProductNo = null;
|
||||
decimal moqty = 0;
|
||||
string DeptName = "";
|
||||
@@ -456,11 +505,11 @@ namespace NX.ERP.U8.Store
|
||||
bodyXml.setAttribute("cpesocode", materialAppDetail.PesoCode);
|
||||
bodyXml.setAttribute("ipesodid", materialAppDetail.PesodId);
|
||||
bodyXml.setAttribute("ipesoseq", materialAppDetail.PesoSeq);
|
||||
|
||||
|
||||
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user