This commit is contained in:
gongxh
2021-11-08 14:05:12 +08:00
8 changed files with 141 additions and 2 deletions

View File

@@ -19,4 +19,17 @@ namespace NX.ERP.Model.Request
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 QualifiedInQty { get; set; }
public ICollection<string> SN { get; set; } = new HashSet<string>();

View File

@@ -24,4 +24,24 @@ namespace NX.ERP.Model.Response.Store
public decimal ArrivalQty { get => arrivalQty; set => arrivalQty = value; }
public decimal PoQty { get => poQty; set => poQty = value; }
}
public class Stockinouttimes
{
public string cInvCode { get; set; }
public string cInvName { get; set; }
public string cInvStd { get; set; }
public string stockout { get; set; }
public string stockin { get; set; }
public decimal iQuantity { get; set; }
}
}

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

@@ -40,7 +40,7 @@ namespace NX.ERP.U8.Store
headXml.setAttribute("id", puStoreIn.Id); //DomHead[0]["id"] = ""; //主关键字段,int类型
headXml.setAttribute("bomfirst", "0"); //DomHead[0]["bomfirst"] = ""; //委外期初标志,string类型
headXml.setAttribute("ccode", puStoreIn.Code); //DomHead[0]["ccode"] = ""; //入库单号,string类型
headXml.setAttribute("ddate", System.DateTime.Now.ToString("G")); //DomHead[0]["ddate"] = ""; //入库日期,DateTime类型
headXml.setAttribute("ddate", puStoreIn.Date.ToShortDateString()); //DomHead[0]["ddate"] = ""; //入库日期,DateTime类型
headXml.setAttribute("iverifystate", 0); //DomHead[0]["iverifystate"] = ""; //iverifystate,int类型
headXml.setAttribute("iswfcontrolled", 0); //DomHead[0]["iswfcontrolled"] = ""; //iswfcontrolled,int类型
headXml.setAttribute("bpufirst", "0"); //DomHead[0]["bpufirst"] = ""; //采购期初标志,string类型

View File

@@ -142,5 +142,19 @@ left join
}
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= RequestTimes.Starttime, endtime = RequestTimes.Endtime, invcode = RequestTimes.Invcode });
}
}
}
}

View File

@@ -55,6 +55,14 @@ namespace NX.ERP.WebAPi.Controllers.MOM
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")]
[HttpPost]
public IEnumerable<Model.MOM.MomDetail> OrderDetails(Model.Request.MomOrder momOrder)

View File

@@ -48,5 +48,13 @@ namespace NX.ERP.WebAPi.Controllers.Store
}
[HttpPost]
[Route("api/Stock/GetStockinouttimes")]
public IEnumerable<Model.Response.Store.Stockinouttimes> GetStockinouttimes(NX.ERP.Model.Request.RequestTimes RequestTimes)
{
return new U8.Store.StockDAL().GetStockinouttimes(RequestTimes);
}
}
}