添加领料申请
This commit is contained in:
@@ -3,7 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Dapper;
|
||||
namespace NX.ERP.U8.Store
|
||||
{
|
||||
public class MaterialAppVoucher : VoucherBase
|
||||
@@ -30,5 +30,56 @@ namespace NX.ERP.U8.Store
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public IEnumerable<Model.Response.Store.MaterialApp> GetList(string strWhere = "", object Params = null)
|
||||
{
|
||||
var strSQL = @"select a.ID ,a.cCode as Code,a.dDate as Date,a.cMaker as PreparedBy,b.AutoID as id,b.AutoID as MaterialAppDtlId,
|
||||
b.ID as MaterialAppDtlId,b.cInvCode as MaterialCode,b.fOutQuantity as Qty, b.imoseq as Pesodid from MaterialAppVouch a
|
||||
left join
|
||||
MaterialAppVouchs b on a.id=b.ID
|
||||
|
||||
";
|
||||
if (!string.IsNullOrEmpty(strWhere))
|
||||
{
|
||||
strSQL += $" where {strWhere} ";
|
||||
}
|
||||
using (var conn = U8LoginContext.Instance.Connection)
|
||||
{
|
||||
var lookup = new Dictionary<int, Model.Response.Store.MaterialApp>();
|
||||
conn.Query<Model.Response.Store.MaterialApp, Model.Response.Store.MaterialAppDetail, Model.Response.Store.MaterialApp>(strSQL, (head, body) =>
|
||||
{
|
||||
if (!lookup.TryGetValue(head.Id, out var _head))
|
||||
{
|
||||
lookup.Add(head.Id, head);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
head = _head;
|
||||
}
|
||||
head.MaterialAppVouchsLst.Add(body);
|
||||
return head;
|
||||
}, Params, null, true, "id", 10, System.Data.CommandType.Text); ;
|
||||
return lookup.Values;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="Code"></param>
|
||||
/// <returns></returns>
|
||||
public Model.Response.Store.MaterialApp GetModel(string Code)
|
||||
{
|
||||
return this.GetList(" a.cCode=@Code", new { Code }).FirstOrDefault();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user