From bcb736a6b9ceb037bacedb3739d8dc8355bacc34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=B0=20=E6=9C=B1?= <501697962@qq.com> Date: Thu, 4 Nov 2021 10:47:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=B3=E9=97=AD=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E8=AE=A2=E5=8D=95=E7=9A=84=E6=9F=A5=E8=AF=A2=EF=BC=8C?= =?UTF-8?q?=E5=8A=A0=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=E7=9A=84=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.Model/Request/Stock.cs | 13 ++++ NX.ERP.Model/Response/MOM/MomDetail.cs | 2 + NX.ERP.U8/Mom/MomOrderDAL.cs | 76 ++++++++++++++++++- NX.ERP.U8/Store/StockDAL.cs | 4 +- .../Controllers/MOM/MomOrderController.cs | 8 ++ .../Controllers/Store/StockController.cs | 4 +- 6 files changed, 102 insertions(+), 5 deletions(-) diff --git a/NX.ERP.Model/Request/Stock.cs b/NX.ERP.Model/Request/Stock.cs index 3c1771d..e974438 100644 --- a/NX.ERP.Model/Request/Stock.cs +++ b/NX.ERP.Model/Request/Stock.cs @@ -19,4 +19,17 @@ namespace NX.ERP.Model.Request public IEnumerable BinCodes { get; set; } } + + + public class RequestTimes + { + public string Starttime { get; set; } = "19991231"; + + public string Endtime { get; set; } = "29991231"; + + + public string Invcode { get; set; } = null; + + + } } diff --git a/NX.ERP.Model/Response/MOM/MomDetail.cs b/NX.ERP.Model/Response/MOM/MomDetail.cs index 10a9adb..6b6b34a 100644 --- a/NX.ERP.Model/Response/MOM/MomDetail.cs +++ b/NX.ERP.Model/Response/MOM/MomDetail.cs @@ -38,6 +38,8 @@ namespace NX.ERP.Model.MOM public double Qty { get => qty; set => qty = value; } + public double QualifiedInQty { get; set; } + public ICollection SN { get; set; } = new HashSet(); diff --git a/NX.ERP.U8/Mom/MomOrderDAL.cs b/NX.ERP.U8/Mom/MomOrderDAL.cs index d3c0d8d..ce1dc5a 100644 --- a/NX.ERP.U8/Mom/MomOrderDAL.cs +++ b/NX.ERP.U8/Mom/MomOrderDAL.cs @@ -184,6 +184,40 @@ namespace NX.ERP.U8.Mom }); } + + /// + /// + /// + /// + /// + public IEnumerable QueryOrderWithClose(NX.ERP.Model.Request.MomOrder Params) + { + if (Params == null) + { + return this.GetOrders(); + } + List where = new List(); + + 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}" + }); + } + /// /// 查询生产订单不包括用料明细 /// @@ -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 } } + + /// + /// 查询生产订单不包括用料明细(包含关闭) + /// + /// + /// + /// + public IEnumerable 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(); + var lookupOrder = new Dictionary(); + // return conn.Query(strSQL,null); + var list = conn.Query(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; + } + } + /// /// /// diff --git a/NX.ERP.U8/Store/StockDAL.cs b/NX.ERP.U8/Store/StockDAL.cs index fd9cfb3..236ec1d 100644 --- a/NX.ERP.U8/Store/StockDAL.cs +++ b/NX.ERP.U8/Store/StockDAL.cs @@ -144,13 +144,13 @@ left join - public IEnumerable GetStockinouttimes(string starttime = "19991231" , string endtime="20991231", string invcode = null ) + public IEnumerable GetStockinouttimes(NX.ERP.Model.Request.RequestTimes RequestTimes) { using (var conn = U8LoginContext.Instance.Connection) { string sql = " SP_CurrentStock_crpd20211011 @starttime,@endtime ,@invcode "; - return conn.Query(sql,new { starttime, endtime, invcode }); + return conn.Query(sql,new { starttime= RequestTimes.Starttime, endtime = RequestTimes.Endtime, invcode = RequestTimes.Invcode }); } } diff --git a/NX.ERP.WebAPi/Controllers/MOM/MomOrderController.cs b/NX.ERP.WebAPi/Controllers/MOM/MomOrderController.cs index fff79b4..78ddabe 100644 --- a/NX.ERP.WebAPi/Controllers/MOM/MomOrderController.cs +++ b/NX.ERP.WebAPi/Controllers/MOM/MomOrderController.cs @@ -55,6 +55,14 @@ namespace NX.ERP.WebAPi.Controllers.MOM return customerDAL.QueryOrders(momOrder); } + [Route("api/ProductOrder/QueryOrderWithClose")] + [HttpPost] + public IEnumerable QueryOrderWithClose(Model.Request.MomOrder momOrder) + { + var customerDAL = new NX.ERP.U8.Mom.MomOrderDAL(); + return customerDAL.QueryOrderWithClose(momOrder); + } + [Route("api/ProductOrder/QueryDetails")] [HttpPost] public IEnumerable OrderDetails(Model.Request.MomOrder momOrder) diff --git a/NX.ERP.WebAPi/Controllers/Store/StockController.cs b/NX.ERP.WebAPi/Controllers/Store/StockController.cs index 98b5d92..6c0aa91 100644 --- a/NX.ERP.WebAPi/Controllers/Store/StockController.cs +++ b/NX.ERP.WebAPi/Controllers/Store/StockController.cs @@ -50,9 +50,9 @@ namespace NX.ERP.WebAPi.Controllers.Store [HttpPost] [Route("api/Stock/GetStockinouttimes")] - public IEnumerable GetStockinouttimes(string starttime = "19991231", string endtime = "20991231", string invcode = null) + public IEnumerable GetStockinouttimes(NX.ERP.Model.Request.RequestTimes RequestTimes) { - return new U8.Store.StockDAL().GetStockinouttimes(starttime, endtime, invcode); + return new U8.Store.StockDAL().GetStockinouttimes(RequestTimes); }