增加关闭生产订单的查询,加生产订单的入库数量

This commit is contained in:
杰 朱
2021-11-04 10:47:29 +08:00
parent 8c92f0544f
commit bcb736a6b9
6 changed files with 102 additions and 5 deletions

View File

@@ -184,6 +184,40 @@ namespace NX.ERP.U8.Mom
});
}
/// <summary>
///
/// </summary>
/// <param name="Params"></param>
/// <returns></returns>
public IEnumerable<Model.MOM.MomOrder> QueryOrderWithClose(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 (Params.ProductOrderNo != null)
{
where.Add(" a.moCode in @ProductOrderNo ");
}
if (!string.IsNullOrEmpty(Params.ProductOrderendID))
{
where.Add(" a.MoId >= @ProductOrderendID ");
}
return this.GetOrdersWithClose(string.Join(" and ", where.ToArray()), new
{
ProductCode = $"%{Params.ProductCode}%",
ProductOrderNo = Params.ProductOrderNo,
ProductOrderendID = $"{Params.ProductOrderendID}"
});
}
/// <summary>
/// 查询生产订单不包括用料明细
/// </summary>
@@ -196,7 +230,7 @@ namespace NX.ERP.U8.Mom
{
string strSQL = @"select
a.MoId as ProductOrderId,a.moCode as ProductOrderNo,a.MakeDate as ProductDate,a.ModifyUser as PreparedBy,
a.MoId as id ,a.MoDId as ProductOrderDtlId,a.MoId as ProductOrderId,a.MoCode as ProductOrderNo,a.MakeDate as ProductOrderDate,a.InvCode as ProductCode,a.Qty as Qty
a.MoId as id ,a.MoDId as ProductOrderDtlId,a.MoId as ProductOrderId,a.MoCode as ProductOrderNo,a.MakeDate as ProductOrderDate,a.InvCode as ProductCode,a.Qty as Qty,a.QualifiedInQty
FROM v_st_mom_orderdetail a with (nolock) Where ( (1>0) AND (1>0) )
AND ( 1>0 ) and (case when ISNULL(SfcFlag,0)=1 then iquantity+QualifiedInQty else 1 end)<>0
and ISNULL(QCFLAG,0)=0 and ISNULL(Status,0) = 3 and (ISNULL(iQuantity,0))>0 and isnull(MrpQty,0)<>0 and 1=1";
@@ -225,6 +259,46 @@ namespace NX.ERP.U8.Mom
}
}
/// <summary>
/// 查询生产订单不包括用料明细(包含关闭)
/// </summary>
/// <param name="strWhere"></param>
/// <param name="Param"></param>
/// <returns></returns>
public IEnumerable<Model.MOM.MomOrder> GetOrdersWithClose(string strWhere = "", object Param = null)
{
using (var conn = U8LoginContext.Instance.Connection)
{
string strSQL = @"select
a.MoId as ProductOrderId,a.moCode as ProductOrderNo,a.MakeDate as ProductDate,a.ModifyUser as PreparedBy,
a.MoId as id ,a.MoDId as ProductOrderDtlId,a.MoId as ProductOrderId,a.MoCode as ProductOrderNo,a.MakeDate as ProductOrderDate,a.InvCode as ProductCode,a.Qty as Qty,a.QualifiedInQty
FROM v_st_mom_orderdetail a with (nolock) Where 1=1";
if (!string.IsNullOrEmpty(strWhere))
{
strSQL += $" and {strWhere} ";
}
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.MomOrder>(strSQL, (Order, OrderDetail) =>
{
if (!lookupOrder.TryGetValue(Order.ProductOrderId, out var _order))
{
lookupOrder.Add(Order.ProductOrderId, Order);
}
else
{
Order = _order;
}
Order.ProductDtlLst.Add(OrderDetail);
return Order;
}, Param, null, true, "id", 10, System.Data.CommandType.Text);
return lookupOrder.Values;
}
}
/// <summary>
///
/// </summary>

View File

@@ -144,13 +144,13 @@ left join
public IEnumerable<Model.Response.Store.Stockinouttimes> GetStockinouttimes(string starttime = "19991231" , string endtime="20991231", string invcode = null )
public IEnumerable<Model.Response.Store.Stockinouttimes> GetStockinouttimes(NX.ERP.Model.Request.RequestTimes RequestTimes)
{
using (var conn = U8LoginContext.Instance.Connection)
{
string sql = " SP_CurrentStock_crpd20211011 @starttime,@endtime ,@invcode ";
return conn.Query<Model.Response.Store.Stockinouttimes>(sql,new { starttime, endtime, invcode });
return conn.Query<Model.Response.Store.Stockinouttimes>(sql,new { starttime= RequestTimes.Starttime, endtime = RequestTimes.Endtime, invcode = RequestTimes.Invcode });
}
}