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

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

@@ -19,4 +19,17 @@ namespace NX.ERP.Model.Request
public IEnumerable<string> BinCodes { get; set; } public IEnumerable<string> BinCodes { get; set; }
} }
public class RequestTimes
{
public string Starttime { get; set; } = "19991231";
public string Endtime { get; set; } = "29991231";
public string Invcode { get; set; } = null;
}
} }

View File

@@ -38,6 +38,8 @@ namespace NX.ERP.Model.MOM
public double Qty { get => qty; set => qty = value; } public double Qty { get => qty; set => qty = value; }
public double QualifiedInQty { get; set; }
public ICollection<string> SN { get; set; } = new HashSet<string>(); public ICollection<string> SN { get; set; } = new HashSet<string>();

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>
/// 查询生产订单不包括用料明细 /// 查询生产订单不包括用料明细
/// </summary> /// </summary>
@@ -196,7 +230,7 @@ namespace NX.ERP.U8.Mom
{ {
string strSQL = @"select string strSQL = @"select
a.MoId as ProductOrderId,a.moCode as ProductOrderNo,a.MakeDate as ProductDate,a.ModifyUser as PreparedBy, 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) ) 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 ( 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"; 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>
/// ///
/// </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) using (var conn = U8LoginContext.Instance.Connection)
{ {
string sql = " SP_CurrentStock_crpd20211011 @starttime,@endtime ,@invcode "; 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 });
} }
} }

View File

@@ -55,6 +55,14 @@ namespace NX.ERP.WebAPi.Controllers.MOM
return customerDAL.QueryOrders(momOrder); return customerDAL.QueryOrders(momOrder);
} }
[Route("api/ProductOrder/QueryOrderWithClose")]
[HttpPost]
public IEnumerable<Model.MOM.MomOrder> QueryOrderWithClose(Model.Request.MomOrder momOrder)
{
var customerDAL = new NX.ERP.U8.Mom.MomOrderDAL();
return customerDAL.QueryOrderWithClose(momOrder);
}
[Route("api/ProductOrder/QueryDetails")] [Route("api/ProductOrder/QueryDetails")]
[HttpPost] [HttpPost]
public IEnumerable<Model.MOM.MomDetail> OrderDetails(Model.Request.MomOrder momOrder) public IEnumerable<Model.MOM.MomDetail> OrderDetails(Model.Request.MomOrder momOrder)

View File

@@ -50,9 +50,9 @@ namespace NX.ERP.WebAPi.Controllers.Store
[HttpPost] [HttpPost]
[Route("api/Stock/GetStockinouttimes")] [Route("api/Stock/GetStockinouttimes")]
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)
{ {
return new U8.Store.StockDAL().GetStockinouttimes(starttime, endtime, invcode); return new U8.Store.StockDAL().GetStockinouttimes(RequestTimes);
} }