/// <summary> /// 取得設備明細檔 RP_Flowchart_Detail_ME_Equipment 清單 /// </summary> /// <param name="search">搜尋條件集合</param> /// <param name="page">分頁參數</param> /// <returns></returns> public PagedListModel <RP_ME_D_Equipment> GetME_D_Equipments(ME_EquipmentSearchVM search, Page page) { var totalCount = 0; var ME_D_Equipments = rP_Flowchart_MasterRepository.GetME_D_Equipments(search, page, out totalCount); return(new PagedListModel <RP_ME_D_Equipment>(totalCount, ME_D_Equipments)); }
public ActionResult GetME_D_Equipments(ME_EquipmentSearchVM search, Page page) { var apiUrl = string.Format("ProductionResourcePlan/GetME_D_EquipmentsAPI"); HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, page, apiUrl); var result = responMessage.Content.ReadAsStringAsync().Result; return(Content(result, "application/json")); }
/// <summary> /// 取得設備明細檔 RP_Flowchart_Detail_ME_Equipment /// </summary> /// <param name="search">搜尋條件集合</param> /// <param name="page">分頁參數</param> /// <returns></returns> public List <RP_ME_D_Equipment> GetME_D_Equipments(ME_EquipmentSearchVM search, Page page, out int count) { List <RP_ME_D_Equipment> query = new List <RP_ME_D_Equipment>(); var RP_Flowchart_Master_UID = new SqlParameter("@RP_Flowchart_Master_UID", search.RP_Flowchart_Master_UID); var Equipment_Type = new SqlParameter("@Equipment_Type", search.Equipment_Type); object[] parameter = new object[] { RP_Flowchart_Master_UID, Equipment_Type }; using (var context = new SPPContext()) { var sql_str = string.Empty; sql_str += @" --DECLARE @RP_Flowchart_Master_UID int = 33, -- @Equipment_Type nvarchar(50) = N'' --; SELECT b.RP_Flowchart_Detail_ME_Equipment_UID, a.[Process_Seq], a.[Process_Station], c.Organization_Name as FunPlant_Organization_Name, a.[Process], b.[Equipment_Name], b.Equipment_Spec, b.Equipment_Qty, b.Ratio, b.Request_Qty, b.EQP_Variable_Qty, b.NPI_Current_Qty, b.MP_Current_Qty, a.[Capacity_ByDay], a.[Capacity_ByHour], a.ME_Estimate_Yield, b.Plan_CT FROM [dbo].[RP_Flowchart_Detail_ME] a INNER JOIN [dbo].[RP_Flowchart_Detail_ME_Equipment] b ON a.[RP_Flowchart_Detail_ME_UID] = b.[RP_Flowchart_Detail_ME_UID] INNER JOIN [dbo].[System_Organization] c ON a.[FunPlant_Organization_UID] = c.Organization_UID WHERE a.[RP_Flowchart_Master_UID] = @RP_Flowchart_Master_UID AND ([Equipment_Type] = @Equipment_Type OR ISNULL(@Equipment_Type,'') = '') "; query = context.Database.SqlQuery <RP_ME_D_Equipment>(sql_str, parameter).ToList(); } count = query.Count(); return(query.Skip(page.Skip).Take(page.PageSize).ToList()); }