Ejemplo n.º 1
0
        /// <summary>
        /// 取得設備明細檔 RP_Flowchart_Detail_ME_Equipment
        /// </summary>
        /// <param name="rP_Flowchart_Detail_ME_Equipment_UID">設備明細檔流水號</param>
        /// <returns></returns>
        public RP_ME_D_Equipment GetME_D_Equipment(int rP_Flowchart_Detail_ME_Equipment_UID)
        {
            RP_ME_D_Equipment query = new RP_ME_D_Equipment();
            var RP_Flowchart_Detail_ME_Equipment_UID = new SqlParameter("@RP_Flowchart_Detail_ME_Equipment_UID", rP_Flowchart_Detail_ME_Equipment_UID);

            object[] parameter = new object[] { RP_Flowchart_Detail_ME_Equipment_UID };

            using (var context = new SPPContext())
            {
                var sql_str = string.Empty;
                sql_str += @"
SELECT b.[Process_Seq],
       b.[Process_Station],
	   c.Organization_Name as FunPlant_Organization_Name,
	   b.Process,
       b.[Capacity_ByHour],
	   b.[Capacity_ByDay],
	   a.*  
FROM [dbo].[RP_Flowchart_Detail_ME_Equipment] a
INNER JOIN [dbo].[RP_Flowchart_Detail_ME] b ON a.[RP_Flowchart_Detail_ME_UID] = b.[RP_Flowchart_Detail_ME_UID]
INNER JOIN [dbo].[System_Organization] c ON b.[FunPlant_Organization_UID] = c.Organization_UID
WHERE a.[RP_Flowchart_Detail_ME_Equipment_UID] = @RP_Flowchart_Detail_ME_Equipment_UID
";
                query    = context.Database.SqlQuery <RP_ME_D_Equipment>(sql_str, parameter).SingleOrDefault();
            }

            return(query);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 新增ME製程設備明细檔
        /// </summary>
        /// <param name="equipItem">ME製程設備明细檔資料集</param>
        /// <param name="detailMeUID">ME製程明细檔流水號</param>
        /// <returns></returns>
        private string InsertEquipSql(RP_ME_D_Equipment equipItem, decimal rP_Flowchart_Detail_ME_UID)
        {
            string insertSql = @"
INSERT INTO [dbo].[RP_Flowchart_Detail_ME_Equipment]
           ([RP_Flowchart_Detail_ME_UID]
           ,[Equipment_Name]
           ,[Equipment_Spec]
           ,[Equipment_Type]
           ,[Plan_CT]
           ,[Equipment_Qty]
           ,[Ratio]
           ,[Request_Qty]
           ,[EQP_Variable_Qty]
           ,[NPI_Current_Qty]
           ,[MP_Current_Qty]
           ,[Notes]
           ,[Created_Date]
           ,[Created_UID]
           ,[Modified_Date]
           ,[Modified_UID])
     VALUES
           ({0}
           ,N'{1}'
           ,N'{2}'
           ,N'{3}'
           ,{4}
           ,{5}
           ,{6}
           ,{7}
           ,{8}
           ,{9}
           ,{10}
           ,N'{11}'
           ,N'{12}'
           ,{13}
           ,N'{14}'
           ,{15})
";

            insertSql = string.Format(insertSql,
                                      rP_Flowchart_Detail_ME_UID,
                                      equipItem.Equipment_Name,
                                      equipItem.Equipment_Spec,
                                      equipItem.Equipment_Type,
                                      equipItem.Plan_CT,
                                      equipItem.Equipment_Qty,
                                      equipItem.Ratio,
                                      equipItem.Request_Qty,
                                      equipItem.EQP_Variable_Qty,
                                      equipItem.NPI_Current_Qty,
                                      equipItem.MP_Current_Qty,
                                      equipItem.Notes,
                                      equipItem.Created_Date,
                                      equipItem.Created_UID,
                                      equipItem.Modified_Date,
                                      equipItem.Modified_UID
                                      );
            return(insertSql);
        }