添加领料需求

This commit is contained in:
gongxh
2021-05-18 15:16:31 +08:00
parent 1c32ca4a40
commit 42ba368234
7 changed files with 180 additions and 4 deletions

View File

@@ -65,6 +65,7 @@
<Compile Include="Request\BinChange.cs" />
<Compile Include="Request\Inventorybu.cs" />
<Compile Include="Request\Inventoryall.cs" />
<Compile Include="Request\MaterialAppProvide.cs" />
<Compile Include="Request\SnOrderRequest.cs" />
<Compile Include="Request\SaleOrderRequest.cs" />
<Compile Include="Response\MOM\Bom.cs" />

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.Model.Request
{
public class MaterialAppProvideDetail
{
private int allocateId;
private string materialCode;
private decimal qty;
private IEnumerable<string> sn;
public int AllocateId { get => allocateId; set => allocateId = value; }
public string MaterialCode { get => materialCode; set => materialCode = value; }
public decimal Qty { get => qty; set => qty = value; }
public IEnumerable<string> Sn { get => sn; set => sn = value; }
}
public class MaterialAppProvide
{
private string orderCode;
private int orderDetailId;
private string workCenter;
private DateTime issueDate;
private IEnumerable<MaterialAppProvideDetail> Detail = new List<MaterialAppProvideDetail>();
public string OrderCode { get => orderCode; set => orderCode = value; }
public int OrderDetailId { get => orderDetailId; set => orderDetailId = value; }
public IEnumerable<MaterialAppProvideDetail> Detail1 { get => Detail; set => Detail = value; }
public string WorkCenter { get => workCenter; set => workCenter = value; }
public DateTime IssueDate { get => issueDate; set => issueDate = value; }
}
}

View File

@@ -37,6 +37,13 @@ namespace NX.ERP.Model.Response.Store
public string MaterialCode { get => materialCode; set => materialCode = value; }
public decimal Qty { get => qty; set => qty = value; }
public int Pesodid { get => pesodid; set => pesodid = value; }
public string MoCode { get; set; }
public int AllocateId { get; set; }
}

View File

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

View File

@@ -30,8 +30,6 @@ namespace NX.ERP.U8.Store
}
headXml.setAttribute("cbustype", "领料");
string lastProductNo = null;
headXml.setAttribute("crdname", "材料出库");
IXMLDOMElement bodyXml;

View File

@@ -16,5 +16,51 @@ namespace NX.ERP.WebAPi.Controllers.Store
var dal = new NX.ERP.U8.Store.MaterialAppVoucher();
return dal.GetList();
}
[Route("api/MaterialAppVoucher/Model")]
[HttpGet]
public Model.Response.Store.MaterialApp GetModel(string Code)
{
var dal = new NX.ERP.U8.Store.MaterialAppVoucher();
return dal.GetModel(Code);
}
[Route("api/MaterialAppVoucher/ListByMoCode")]
[HttpGet]
public IEnumerable<Model.Response.Store.MaterialApp> GetList(string MoCode, int MoDetailId)
{
var dal = new NX.ERP.U8.Store.MaterialAppVoucher();
return dal.GetListByMoCode(MoCode, MoDetailId);
}
[Route("api/MaterialAppVoucher/DetailByMoCode")]
[HttpGet]
public IEnumerable<Model.Response.Store.MaterialAppDetail> GetDetail(string MoCode, int MoDetailId)
{
var dal = new NX.ERP.U8.Store.MaterialAppVoucher();
return dal.GetDetailByMoCode(MoCode, MoDetailId);
}
[Route("api/MaterialAppVoucher/Provide")]
[HttpPost]
public bool Provide([FromBody]NX.ERP.Model.Request.MaterialAppProvide provide)
{
var dal = new NX.ERP.U8.Store.MaterialAppVoucher();
dal.Provide(provide);
return true;
}
}
}

View File

@@ -5,7 +5,7 @@
-->
<configuration>
<appSettings>
<add key="server" value="172.30.6.150" />
<add key="server" value="192.168.1.14" />
<add key="AccId" value="002" />
<add key="UserId" value="0001" />
<add key="Password" value="123456" />