增加材料出库单查询接口

This commit is contained in:
gongxh
2021-12-06 16:24:25 +08:00
parent a8a3a0e6e1
commit 417ad1e8b1
5 changed files with 83 additions and 13 deletions

View File

@@ -14,7 +14,7 @@ namespace NX.ERP.Model.Store
private DateTime date;
private string sourceCode;
private string source;
private IList<MaterialStoreOutDetail> details;
private IList<MaterialStoreOutDetail> details = new List<MaterialStoreOutDetail>();
public int Id { get => id; set => id = value; }
public string Code { get => code; set => code = value; }

View File

@@ -13,9 +13,14 @@ namespace NX.ERP.Model.Store
private string cinvcode;
public int SorceDetailId { get; set; }
private string cInvName;
private string vcInvStd;
public double Quantity { get => quantity; set => quantity = value; }
public string Position { get => binCode; set => binCode = value; }
public string InvCode { get => cinvcode; set => cinvcode = value; }
public string InvName { get => cInvName; set => cInvName = value; }
public string InvStd { get => vcInvStd; set => vcInvStd = value; }
}
}

View File

@@ -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);
}

View File

@@ -1,4 +1,5 @@
using System;
using NX.ERP.Model.Store;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
@@ -31,5 +32,14 @@ namespace NX.ERP.WebAPi.Controllers.Store
var dal = new NX.ERP.U8.Store.MaterialStoreOutDAL();
return dal.UpdateVocher(storeIn);
}
[Route("api/MaterialOut")]
[HttpGet]
public MaterialStoreOut GetModel([FromUri] string Code)
{
var dal = new NX.ERP.U8.Store.MaterialStoreOutDAL();
return dal.GetModel(Code);
}
}
}

View File

@@ -1,4 +1,5 @@
using System;
using NX.ERP.Model.Store;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
@@ -26,5 +27,10 @@ namespace NX.ERP.WebAPi.Controllers.Store
var dal = new NX.ERP.U8.Store.OtherStoreOutDAL();
return dal.UpdateVocher(storeIn);
}
}
}