实现生产订单的功能
This commit is contained in:
@@ -35,8 +35,16 @@ namespace NX.ERP.Model.MOM
|
||||
public double Qty { get => qty; set => qty = value; }
|
||||
|
||||
|
||||
public ICollection<string> SN { get; set; } = new HashSet<string>();
|
||||
|
||||
public string SoCode { get; set; }
|
||||
|
||||
|
||||
public string SortSeq { get; set; }
|
||||
|
||||
public DateTime DueDate { get; set; }
|
||||
|
||||
public int MoTypeId { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,11 +19,17 @@ namespace NX.ERP.U8.Mom
|
||||
{
|
||||
string strSQL = @"select
|
||||
a.MoId as ProductOrderId,a.moCode as ProductOrderNo,a.CreateDate as ProductDate,a.CreateUser as PreparedBy,
|
||||
b.MoId as id ,b.MoDId as ProductOrderDtlId,b.MoId as ProductOrderId,ISNULL( b.MDeptCode,'53') as MDeptCode,a.MoCode as ProductOrderNo,a.CreateDate as ProductOrderDate,b.InvCode as ProductCode,b.Qty as Qty,
|
||||
c.AllocateId as id ,c.AllocateId as AllocateId,c.MoDId as ProductOrderDtlId,c.InvCode as MaterialCode,b.MoId as ProductOrderId, c.IssQty as IssQty,c.Qty
|
||||
b.MoId as id ,b.MoDId as ProductOrderDtlId,b.MoId as ProductOrderId,b.MoTypeId,d.DueDate,ISNULL( b.MDeptCode,'53') as MDeptCode,a.MoCode as ProductOrderNo,
|
||||
a.CreateDate as ProductOrderDate,b.InvCode as ProductCode,b.Qty as Qty,b.SortSeq,b.SoCode,
|
||||
c.AllocateId as id ,c.AllocateId as AllocateId,c.MoDId as ProductOrderDtlId,c.InvCode as MaterialCode,b.MoId as ProductOrderId, c.IssQty as IssQty,c.Qty,
|
||||
e.cInvSN as ID
|
||||
from mom_order as a
|
||||
left join mom_orderdetail as b on a.MoId=b.MoId
|
||||
left join mom_moallocate as c on b.MoDId=c.MoDId ";
|
||||
left join mom_morder as d on b.MoDId=d.MoDId
|
||||
left join mom_SNDetail as e on b.MoDId=e.iVouchsID
|
||||
|
||||
left join mom_moallocate as c on b.MoDId=c.MoDId
|
||||
";
|
||||
if (!string.IsNullOrEmpty(strWhere))
|
||||
{
|
||||
strSQL += $" where {strWhere} ";
|
||||
@@ -31,7 +37,7 @@ namespace NX.ERP.U8.Mom
|
||||
var lookupDetail = new Dictionary<int, Model.MOM.MomDetail>();
|
||||
var lookupOrder = new Dictionary<int, Model.MOM.MomOrder>();
|
||||
// return conn.Query<Model.Purchase.Arrival>(strSQL,null);
|
||||
var list = conn.Query<Model.MOM.MomOrder, Model.MOM.MomDetail, Model.MOM.MoAllocate, Model.MOM.MomOrder>(strSQL, (Order, OrderDetail, MoAllocate) =>
|
||||
var list = conn.Query<Model.MOM.MomOrder, Model.MOM.MomDetail, Model.MOM.MoAllocate,string, Model.MOM.MomOrder>(strSQL, (Order, OrderDetail, MoAllocate,SN) =>
|
||||
{
|
||||
if (!lookupOrder.TryGetValue(Order.ProductOrderId, out var _order))
|
||||
{
|
||||
@@ -52,6 +58,10 @@ namespace NX.ERP.U8.Mom
|
||||
{
|
||||
OrderDetail = momDetail;
|
||||
}
|
||||
OrderDetail.SN.Add(SN);
|
||||
|
||||
|
||||
|
||||
Order.Allocates.Add(MoAllocate);
|
||||
OrderDetail.ProductAllocateOrderLst.Add(MoAllocate);
|
||||
MoAllocate.momDetail = OrderDetail;
|
||||
@@ -62,6 +72,38 @@ namespace NX.ERP.U8.Mom
|
||||
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<Model.MOM.MomOrder> GetList(NX.ERP.Model.Request.MomOrder Params)
|
||||
{
|
||||
if (Params == null)
|
||||
{
|
||||
return this.GetOrders();
|
||||
}
|
||||
List<string> where = new List<string>();
|
||||
|
||||
if (!string.IsNullOrEmpty(Params.ProductCode))
|
||||
{
|
||||
where.Add(" a.InvCode like @ProductCode");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(Params.ProductOrderNo))
|
||||
{
|
||||
where.Add(" a.moCode like @ProductOrderNo ");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(Params.ProductOrderendID))
|
||||
{
|
||||
where.Add(" a.MoId >= @ProductOrderendID ");
|
||||
}
|
||||
return this.GetList(string.Join(" and ", where.ToArray()), new
|
||||
{
|
||||
ProductCode = $"%{Params.ProductCode}%",
|
||||
ProductOrderNo = $"{Params.ProductOrderNo}",
|
||||
ProductOrderendID = $"{Params.ProductOrderendID}"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -96,7 +138,7 @@ namespace NX.ERP.U8.Mom
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// 查询生产订单不包括用料明细
|
||||
/// </summary>
|
||||
/// <param name="strWhere"></param>
|
||||
/// <param name="Param"></param>
|
||||
|
||||
@@ -17,6 +17,18 @@ namespace NX.ERP.WebAPi.Controllers.MOM
|
||||
return customerDAL.GetList();
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Route("api/MomOrder/List")]
|
||||
[HttpPost]
|
||||
public IEnumerable<Model.MOM.MomOrder> List(NX.ERP.Model.Request.MomOrder momOrder)
|
||||
{
|
||||
var customerDAL = new NX.ERP.U8.Mom.MomOrderDAL();
|
||||
return customerDAL.GetList(momOrder);
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Obsolete]
|
||||
[Route("api/MomOrder/list/{id}")]
|
||||
[HttpGet]
|
||||
|
||||
Reference in New Issue
Block a user