添加领料需求
This commit is contained in:
@@ -37,7 +37,7 @@ 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
|
||||
b.ID as MaterialAppId,b.cInvCode as MaterialCode,b.iQuantity as Qty, b.imoseq as Pesodid,b.cmocode as MoCode,b.iMpoIds as AllocateId from MaterialAppVouch a
|
||||
left join
|
||||
MaterialAppVouchs b on a.id=b.ID
|
||||
|
||||
@@ -76,10 +76,93 @@ left join
|
||||
public Model.Response.Store.MaterialApp GetModel(string Code)
|
||||
{
|
||||
return this.GetList(" a.cCode=@Code", new { Code }).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="MoCode"></param>
|
||||
/// <param name="MoDetailId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public IEnumerable<Model.Response.Store.MaterialApp> GetListByMoCode(string MoCode, int MoDetailId)
|
||||
{
|
||||
return this.GetList(@" b.cmocode=@MoCode and
|
||||
b.iMPoIds in (
|
||||
select AllocateId from mom_moallocate where MoDId = @MoDetailId) ", new { MoCode, MoDetailId });
|
||||
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<Model.Response.Store.MaterialAppDetail> GetDetailByMoCode(string MoCode, int MoDetailId)
|
||||
{
|
||||
var models = this.GetListByMoCode(MoCode, MoDetailId);
|
||||
|
||||
|
||||
|
||||
var reslut = new List<Model.Response.Store.MaterialAppDetail>();
|
||||
foreach (var items in models)
|
||||
{
|
||||
reslut.AddRange(items.MaterialAppVouchsLst);
|
||||
}
|
||||
return reslut;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void Provide(NX.ERP.Model.Request.MaterialAppProvide provide)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
using (var conn = U8LoginContext.Instance.Connection)
|
||||
{
|
||||
|
||||
var strSql = @"update MaterialAppVouchs set dDueDate=@DueDate,cDefine22='是',cDefine23=@SN,cDefine24=@WorkCenter";
|
||||
if (provide.Detail1.Count() != 0)
|
||||
{
|
||||
var mappDetails = this.GetDetailByMoCode(provide.OrderCode, provide.OrderDetailId).ToDictionary(m => m.AllocateId);
|
||||
foreach (var item in provide.Detail1)
|
||||
{
|
||||
if (mappDetails.TryGetValue(item.AllocateId, out var _mappDetails))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("未找到");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else //整单发出
|
||||
{
|
||||
strSql = @"update MaterialAppVouchs set dDueDate=@DueDate,cDefine22='是',cDefine23=@SN,cDefine24=@WorkCenter where cmocode = @MoCode and
|
||||
iMPoIds in (
|
||||
select AllocateId from mom_moallocate where MoDId = @OrderDetailId
|
||||
)";
|
||||
|
||||
|
||||
conn.Execute(strSql, new
|
||||
{
|
||||
DueDate = provide.IssueDate,
|
||||
SN = "",
|
||||
WorkCenter = provide.WorkCenter,
|
||||
MoCode = provide.OrderCode,
|
||||
OrderDetailId = provide.OrderDetailId
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user