コード例 #1
0
        public void GetWeldReportNo(int ProjId, string weldReportNo)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <DuqmDailyWeldingControlSheetModel> weldSummary = new List <DuqmDailyWeldingControlSheetModel>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = "SELECT  DISTINCT WELD_REP_NO FROM REP_DAILY_WELDING_CTRL_SHT" +
                             $" WHERE PROJECT_ID={1} AND WELD_REP_NO LIKE '%{weldReportNo}%'";

                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            DuqmDailyWeldingControlSheetModel summary = new DuqmDailyWeldingControlSheetModel();
                            summary.weld_rep_no = dr["WELD_REP_NO"].ToString();
                            weldSummary.Add(summary);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(weldSummary);

            Context.Response.Write(data);
        }
コード例 #2
0
        public void GetAllSubContractorDetails(int ProjId)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <SubContractorsModel> subConList = new List <SubContractorsModel>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = "SELECT SUB_CON_ID, SUB_CON_NAME FROM SUB_CONTRACTOR" +
                             $" WHERE PROJ_ID={1} ORDER BY SUB_CON_NAME";

                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            SubContractorsModel subCon = new SubContractorsModel();
                            subCon.SUB_CON_ID   = dr["SUB_CON_ID"].ToString();
                            subCon.SUB_CON_NAME = dr["SUB_CON_NAME"].ToString();
                            subConList.Add(subCon);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(subConList);

            Context.Response.Write(data);
        }
コード例 #3
0
        public int RegisterRFITransmittalDetails(int ProjId, string RFI_Number, int SUB_CON_ID, string Inspector_Name, string Inspection_Date, string Item_Desc, string Inspection_Result)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            string conn_str   = DatabaseTools.AmgDbConnectionString(ProjId);
            int    statusCode = 0;

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = "INSERT INTO RFI_TRANS_MASTER (RFI_NUMBER, PROJECT_ID, SUB_CON_ID, RFI_DATE, INSPECTOR_NAME, INSPECTOR_ACTIVITY, INSPECTION_RESULT, CREATED_AT, CREATED_BY) " +
                             $" VALUES('{RFI_Number}', {1}, {SUB_CON_ID}, '{Inspection_Date}','{Inspector_Name}', '{Item_Desc}', '{Inspection_Result}', '{DateTime.Now.ToString("dd/MMM/yyyy")}', '{Inspector_Name}') ";
                try
                {
                    using (OracleCommand cmd = new OracleCommand(sql, conn))
                    {
                        statusCode = cmd.ExecuteNonQuery();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            return(statusCode);
        }
コード例 #4
0
        public void GetMagneticParticleTestingDetails(int ProjId, string NDE_Rep_No)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <MagneticParticleTestingModel> magneticParticleList = new List <MagneticParticleTestingModel>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = "SELECT * FROM VIEW_MT_REPORT_FORMAT_DT" +
                             $" WHERE PROJECT_ID={1} AND NDE_REP_NO = '{NDE_Rep_No}'";

                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            MagneticParticleTestingModel magneticParticle = new MagneticParticleTestingModel();
                            magneticParticle.project_id      = dr["PROJECT_ID"].ToString();
                            magneticParticle.job_code        = dr["JOB_CODE"].ToString();
                            magneticParticle.iso_title1      = dr["ISO_TITLE1"].ToString();
                            magneticParticle.spool           = dr["SPOOL"].ToString();
                            magneticParticle.joint_no        = dr["JOINT_NO"].ToString();
                            magneticParticle.joint_id        = dr["JOINT_ID"].ToString();
                            magneticParticle.root_hot_welder = dr["ROOT_HOT_WELDER"].ToString();
                            magneticParticle.fill_cap_welder = dr["FILL_CAP_WELDER"].ToString();
                            magneticParticle.joint_size_dec  = dr["JOINT_SIZE_DEC"].ToString();
                            magneticParticle.schedule        = dr["SCHEDULE"].ToString();
                            magneticParticle.joint_type      = dr["JOINT_TYPE"].ToString();
                            magneticParticle.weld_process    = dr["WELD_PROCESS"].ToString();
                            magneticParticle.material        = dr["MATERIAL"].ToString();
                            magneticParticle.wps_no          = dr["WPS_NO"].ToString();
                            magneticParticle.pwht            = dr["PWHT"].ToString();
                            magneticParticle.nde_rep_no      = dr["NDE_REP_NO"].ToString();
                            string nde_date = dr["NDE_DATE"].ToString();
                            if (!string.IsNullOrEmpty(nde_date))
                            {
                                magneticParticle.nde_date = DateTime.Parse(dr["NDE_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }
                            magneticParticle.pass_flg      = dr["PASS_FLG"].ToString();
                            magneticParticle.nde_type      = dr["NDE_TYPE"].ToString();
                            magneticParticle.total_films   = dr["TOTAL_FILMS"].ToString();
                            magneticParticle.repair_films  = dr["REPAIR_FILMS"].ToString();
                            magneticParticle.reshoot_films = dr["RESHOOT_FILMS"].ToString();
                            magneticParticle.repair_code   = dr["REPAIR_CODE"].ToString();
                            magneticParticle.cat_name      = dr["CAT_NAME"].ToString();
                            magneticParticleList.Add(magneticParticle);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(magneticParticleList);

            Context.Response.Write(data);
        }
        public void GetRadiographyInspectionDetails(int ProjId, string NDE_Rep_No)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <RadiographyInspectionModel> radiographyInspection = new List <RadiographyInspectionModel>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = "SELECT * FROM VIEW_RT_REPORT_FORMAT_DT" +
                             $" WHERE PROJECT_ID={1} AND NDE_REP_NO = '{NDE_Rep_No}'";

                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            RadiographyInspectionModel inspection = new RadiographyInspectionModel();
                            inspection.project_id      = dr["project_id"].ToString();
                            inspection.job_code        = dr["job_code"].ToString();
                            inspection.iso_title1      = dr["iso_title1"].ToString();
                            inspection.spool           = dr["spool"].ToString();
                            inspection.joint_no        = dr["joint_no"].ToString();
                            inspection.joint_id        = dr["joint_id"].ToString();
                            inspection.root_hot_welder = dr["root_hot_welder"].ToString();
                            inspection.fill_cap_welder = dr["fill_cap_welder"].ToString();
                            inspection.joint_size_dec  = dr["joint_size_dec"].ToString();
                            inspection.schedule        = dr["schedule"].ToString();
                            inspection.joint_type      = dr["joint_type"].ToString();
                            inspection.weld_process    = dr["weld_process"].ToString();
                            inspection.material        = dr["material"].ToString();
                            inspection.wps_no          = dr["wps_no"].ToString();
                            inspection.pwht            = dr["pwht"].ToString();
                            inspection.nde_rep_no      = dr["nde_rep_no"].ToString();
                            string nde_date = dr["nde_date"].ToString();
                            if (!string.IsNullOrEmpty(nde_date))
                            {
                                inspection.nde_date = DateTime.Parse(dr["nde_date"].ToString()).ToString("dd-MMM-yyyy");
                            }
                            inspection.pass_flg      = dr["pass_flg"].ToString();
                            inspection.nde_type      = dr["nde_type"].ToString();
                            inspection.total_films   = dr["total_films"].ToString();
                            inspection.repair_films  = dr["repair_films"].ToString();
                            inspection.reshoot_films = dr["reshoot_films"].ToString();
                            inspection.repair_code   = dr["repair_code"].ToString();
                            radiographyInspection.Add(inspection);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(radiographyInspection);

            Context.Response.Write(data);
        }
コード例 #6
0
        public void GetMaterialWise(int ProjId)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <ReportSpoolIdMatWiseModel> items = new List <ReportSpoolIdMatWiseModel>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = "SELECT * FROM REP_SPOOL_INCH_DIA_MAT WHERE PROJECT_ID=1";


                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            ReportSpoolIdMatWiseModel item = new ReportSpoolIdMatWiseModel();
                            item.project_id    = int.Parse(dr["PROJECT_ID"].ToString());
                            item.job_code      = dr["JOB_CODE"].ToString();
                            item.job_name      = dr["JOB_NAME"].ToString();
                            item.client_name   = dr["CLIENT_NAME"].ToString();
                            item.proj_rem      = dr["PROJ_REM"].ToString();
                            item.mat_type      = dr["MAT_TYPE"].ToString();
                            item.sg_shop       = MathUtility.stringToDouble(dr["SG_SHOP"].ToString());
                            item.sg_field      = MathUtility.stringToDouble(dr["SG_FIELD"].ToString());
                            item.sg_total      = MathUtility.stringToDouble(dr["SG_TOTAL_ID"].ToString());
                            item.mat_avl       = MathUtility.stringToDouble(dr["MAT_AVL"].ToString());
                            item.jc_issued     = MathUtility.stringToDouble(dr["JC_ISSUED"].ToString());
                            item.swn           = MathUtility.stringToDouble(dr["SWN"].ToString());
                            item.dim_check     = MathUtility.stringToDouble(dr["DIM_CHECK"].ToString());
                            item.qc_cleared    = MathUtility.stringToDouble(dr["QC_CLEARED"].ToString());
                            item.paint_req     = MathUtility.stringToDouble(dr["PAINT_REQ"].ToString());
                            item.shipping_jc   = MathUtility.stringToDouble(dr["SHIPPING_JC"].ToString());
                            item.painted       = MathUtility.stringToDouble(dr["PAINTED"].ToString());
                            item.shipping      = MathUtility.stringToDouble(dr["SHIPPING"].ToString());
                            item.shop_fitup    = MathUtility.stringToDouble(dr["SHOP_FITUP"].ToString());
                            item.shop_welding  = MathUtility.stringToDouble(dr["SHOP_WELDING"].ToString());
                            item.field_fitup   = MathUtility.stringToDouble(dr["FIELD_FITUP"].ToString());
                            item.field_welding = MathUtility.stringToDouble(dr["FIELD_WELDING"].ToString());

                            items.Add(item);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(items);

            Context.Response.Write(data);
        } // method
        public void GetSpoolGenStatusDetails(int ProjId)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <SpoolGenProgress_LotWise_Model> spoolGenProgressList = new List <SpoolGenProgress_LotWise_Model>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = "SELECT * FROM VIEW_ISOME_REP_C" +
                             $" WHERE PROJECT_ID={1} ORDER BY LOT_NO";

                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            SpoolGenProgress_LotWise_Model spoolGen = new SpoolGenProgress_LotWise_Model();
                            spoolGen.PROJECT_ID  = dr["PROJECT_ID"].ToString();
                            spoolGen.JOB_CODE    = dr["JOB_CODE"].ToString();
                            spoolGen.CLIENT_NAME = dr["CLIENT_NAME"].ToString();
                            spoolGen.PROJ_REM    = dr["PROJ_REM"].ToString();
                            spoolGen.JOB_NAME    = dr["JOB_NAME"].ToString();
                            string LOT_RECV = dr["LOT_RECV"].ToString();
                            if (!string.IsNullOrEmpty(LOT_RECV))
                            {
                                spoolGen.LOT_RECV = DateTime.Parse(dr["LOT_RECV"].ToString()).ToString("dd-MMM-yyyy");
                            }
                            spoolGen.LOT_NO      = dr["LOT_NO"].ToString();
                            spoolGen.HCOPY_RECV  = Convert.ToInt32(dr["HCOPY_RECV"].ToString());
                            spoolGen.IDF_RECV    = Convert.ToInt32(dr["IDF_RECV"].ToString());
                            spoolGen.MARK_DATE   = Convert.ToInt32(dr["MARK_DATE"].ToString());
                            spoolGen.SG_DATE     = Convert.ToInt32(dr["SG_DATE"].ToString());
                            spoolGen.SG_BAL      = Convert.ToInt32(dr["SG_BAL"].ToString());
                            spoolGen.BACK_CHK    = Convert.ToInt32(dr["BACK_CHK"].ToString());
                            spoolGen.BCK_CHK_BAL = Convert.ToInt32(dr["BCK_CHK_BAL"].ToString());
                            spoolGen.MAT_CHK     = Convert.ToInt32(dr["MAT_CHK"].ToString());
                            spoolGen.MAT_CHK_BAL = Convert.ToInt32(dr["MAT_CHK_BAL"].ToString());
                            spoolGen.TRANS_QTY   = Convert.ToInt32(dr["TRANS_QTY"].ToString());
                            spoolGen.HOLD_QTY    = Convert.ToInt32(dr["HOLD_QTY"].ToString());
                            spoolGen.TRANS_BAL   = Convert.ToInt32(dr["TRANS_BAL"].ToString());
                            spoolGenProgressList.Add(spoolGen);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(spoolGenProgressList);

            Context.Response.Write(data);
        }
        public void GetSgSummaryAreaWise(int ProjId)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <IsomeSumaryAreaWiseModel> items = new List <IsomeSumaryAreaWiseModel>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = "SELECT * FROM REP_SG_SUMMARY_AREA WHERE PROJECT_ID = 1 ORDER BY AREA_L2, AREA_L1";
                //PROJECT_ID, JOB_CODE, JOB_NAME, CLIENT_NAME, PROJ_REM,
                //APP_LOGO1, APP_LOGO2, APP_LOGO3, AREA_L1, AREA_L2, RECVD, IDF_RECVD,
                //HOLD_QTY, SG_DONE, BCHK_DONE, TRANSMITTED

                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            IsomeSumaryAreaWiseModel item = new IsomeSumaryAreaWiseModel();
                            item.ProjectId     = int.Parse(dr["PROJECT_ID"].ToString());
                            item.AreaL1        = dr["AREA_L1"].ToString();
                            item.AreaL2        = dr["AREA_L2"].ToString();
                            item.IsoReceived   = MathUtility.stringToInt(dr["RECVD"].ToString());
                            item.IdfReceived   = MathUtility.stringToInt(dr["IDF_RECVD"].ToString());
                            item.OnHold        = MathUtility.stringToInt(dr["HOLD_QTY"].ToString());
                            item.SgDone        = MathUtility.stringToInt(dr["SG_DONE"].ToString());
                            item.BackCheckDone = MathUtility.stringToInt(dr["BCHK_DONE"].ToString());
                            item.Transmitted   = MathUtility.stringToInt(dr["TRANSMITTED"].ToString());

                            items.Add(item);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(items);

            Context.Response.Write(data);
        } // method
コード例 #9
0
        public void GetRTSummaryMaterialWise(int ProjId, int CatId)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <RTSummaryMaterialWiseModel> items = new List <RTSummaryMaterialWiseModel>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = $"SELECT * FROM REP_RT_SUMMARY_MAT WHERE PROJECT_ID=1 AND CAT_ID={CatId} ORDER BY MAT_TYPE, RT";

                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            RTSummaryMaterialWiseModel item = new RTSummaryMaterialWiseModel();
                            item.project_id    = int.Parse(dr["PROJECT_ID"].ToString());
                            item.mat_type      = dr["MAT_TYPE"].ToString();
                            item.cat_id        = MathUtility.stringToInt(dr["CAT_ID"].ToString());
                            item.rt_percentage = MathUtility.stringToInt(dr["RT"].ToString());
                            item.jnt_welded    = MathUtility.stringToInt(dr["JNT_WELDED"].ToString());
                            item.jnt_nde_done  = MathUtility.stringToInt(dr["JNT_NDE_DONE"].ToString());
                            item.jnt_repair    = MathUtility.stringToInt(dr["JNT_REPAIR"].ToString());
                            item.jnt_repaired  = MathUtility.stringToInt(dr["JNT_REPAIRED"].ToString());
                            item.total_films   = MathUtility.stringToInt(dr["TOTAL_FILMS"].ToString());
                            item.acc_films     = MathUtility.stringToInt(dr["ACC_FILMS"].ToString());
                            item.rej_films     = MathUtility.stringToInt(dr["REJ_FILMS"].ToString());

                            items.Add(item);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(items);

            Context.Response.Write(data);
        } // method
コード例 #10
0
        public void GetRFITransmittalDetails(int ProjId, string RFI_Number)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <RFI_Transmittal_Model> rfiTransmittalList = new List <RFI_Transmittal_Model>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = "SELECT * FROM VW_RFI_TRANS_MASTER" +
                             $" WHERE PROJECT_ID={1} AND RFI_NUMBER = '{RFI_Number}'";

                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            RFI_Transmittal_Model rfiTransmittal = new RFI_Transmittal_Model();
                            rfiTransmittal.project_id         = dr["project_id"].ToString();
                            rfiTransmittal.rfi_number         = dr["rfi_number"].ToString();
                            rfiTransmittal.sub_con_name       = dr["sub_con_name"].ToString();
                            rfiTransmittal.rfi_date           = dr["rfi_date"].ToString();
                            rfiTransmittal.inspector_name     = dr["inspector_name"].ToString();
                            rfiTransmittal.inspector_activity = dr["inspector_activity"].ToString();
                            rfiTransmittal.inspection_result  = dr["inspection_result"].ToString();
                            rfiTransmittal.created_at         = dr["created_at"].ToString();
                            rfiTransmittal.created_by         = dr["created_by"].ToString();
                            rfiTransmittalList.Add(rfiTransmittal);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(rfiTransmittalList);

            Context.Response.Write(data);
        }
コード例 #11
0
        public void GetAreaWise(int ProjId)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <ReportSpoolIdAreaWiseModel> areas = new List <ReportSpoolIdAreaWiseModel>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = "SELECT * FROM REP_SPOOL_INCH_DIA_AREA"
                             + $" WHERE LENGTH(NVL(AREA_L1,''))>0 AND PROJECT_ID=1";


                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            //PROJECT_ID, JOB_CODE, JOB_NAME, CLIENT_NAME, PROJ_REM,
                            //APP_LOGO1, APP_LOGO2, AREA_L2, AREA_L1, SG_SHOP, SG_FIELD,
                            //MAT_AVL, JC_ISSUED, SWN, NDE_CMPLT, DIM_CHECK, QC_CLEARED,
                            //PAINT_REQ, SHIPPING_JC, PAINTED, SHIPPING, SHOP_FITUP,
                            //SHOP_WELDING, FIELD_FITUP, FIELD_WELDING

                            ReportSpoolIdAreaWiseModel area = new ReportSpoolIdAreaWiseModel();
                            area.project_id    = int.Parse(dr["PROJECT_ID"].ToString());
                            area.job_code      = dr["JOB_CODE"].ToString();
                            area.job_name      = dr["JOB_NAME"].ToString();
                            area.client_name   = dr["CLIENT_NAME"].ToString();
                            area.proj_rem      = dr["PROJ_REM"].ToString();
                            area.app_logo1     = dr["APP_LOGO1"].ToString();
                            area.area_l1       = dr["AREA_L1"].ToString();
                            area.area_l2       = dr["AREA_L2"].ToString();
                            area.sg_shop       = MathUtility.stringToDouble(dr["SG_SHOP"].ToString());
                            area.sg_field      = MathUtility.stringToDouble(dr["SG_FIELD"].ToString());
                            area.mat_avl       = MathUtility.stringToDouble(dr["MAT_AVL"].ToString());
                            area.jc_issued     = MathUtility.stringToDouble(dr["JC_ISSUED"].ToString());
                            area.swn           = MathUtility.stringToDouble(dr["SWN"].ToString());
                            area.dim_check     = MathUtility.stringToDouble(dr["DIM_CHECK"].ToString());
                            area.qc_cleared    = MathUtility.stringToDouble(dr["QC_CLEARED"].ToString());
                            area.paint_req     = MathUtility.stringToDouble(dr["PAINT_REQ"].ToString());
                            area.shipping_jc   = MathUtility.stringToDouble(dr["SHIPPING_JC"].ToString());
                            area.painted       = MathUtility.stringToDouble(dr["PAINTED"].ToString());
                            area.shipping      = MathUtility.stringToDouble(dr["SHIPPING"].ToString());
                            area.shop_fitup    = MathUtility.stringToDouble(dr["SHOP_FITUP"].ToString());
                            area.shop_welding  = MathUtility.stringToDouble(dr["SHOP_WELDING"].ToString());
                            area.field_fitup   = MathUtility.stringToDouble(dr["FIELD_FITUP"].ToString());
                            area.field_welding = MathUtility.stringToDouble(dr["FIELD_WELDING"].ToString());

                            areas.Add(area);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(areas);

            Context.Response.Write(data);
        } // method
        public void GetNDEPMIStatusDetails(int ProjId, string SUB_CON_ID, string CAT_ID, string Inclde_Prod)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <Duqm_NDE_PMI_Status_Model> ndePMIStatusList = new List <Duqm_NDE_PMI_Status_Model>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = string.Empty;
                if (Inclde_Prod.ToUpper() == "Y")
                {
                    string prod = "SELECT * FROM VIEW_LINE_CLASS_WISE_PMI" +
                                  $" WHERE PROJ_ID={1} AND SUB_CON_ID = '{SUB_CON_ID}' AND CAT_ID= '{CAT_ID}'";
                    sql = prod;
                }
                else
                {
                    string nonProd = "SELECT * FROM VIEW_LINE_CLS_PMI_NON_PROD" +
                                     $" WHERE PROJ_ID={1} AND SUB_CON_ID = '{SUB_CON_ID}' AND CAT_ID= '{CAT_ID}'";
                    sql = nonProd;
                }

                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            Duqm_NDE_PMI_Status_Model ndePMIStatus = new Duqm_NDE_PMI_Status_Model();
                            ndePMIStatus.PROJ_ID      = dr["PROJ_ID"].ToString();
                            ndePMIStatus.JOB_CODE     = dr["JOB_CODE"].ToString();
                            ndePMIStatus.CLIENT_NAME  = dr["CLIENT_NAME"].ToString();
                            ndePMIStatus.JV_OF        = dr["JV_OF"].ToString();
                            ndePMIStatus.JOB_NAME     = dr["JOB_NAME"].ToString();
                            ndePMIStatus.SHORT_CODE   = dr["SHORT_CODE"].ToString();
                            ndePMIStatus.REP_TITLE1   = dr["REP_TITLE1"].ToString();
                            ndePMIStatus.REP_TITLE2   = dr["REP_TITLE2"].ToString();
                            ndePMIStatus.SUB_CON_ID   = Convert.ToInt32(dr["SUB_CON_ID"].ToString());
                            ndePMIStatus.SUB_CON_NAME = dr["SUB_CON_NAME"].ToString();
                            ndePMIStatus.CAT_ID       = Convert.ToInt32(dr["CAT_ID"].ToString());

                            bool catName = DatabaseTools.ColumnExists(dr, "CAT_NAME");
                            if (catName)
                            {
                                ndePMIStatus.CAT_NAME = dr["CAT_NAME"].ToString();
                            }

                            //ndePWHTStatus.CAT_NAME = dr["CAT_NAME"].ToString();
                            ndePMIStatus.LINE_CLASS    = dr["LINE_CLASS"].ToString();
                            ndePMIStatus.PMI           = dr["PMI"].ToString();
                            ndePMIStatus.TOTAL_JOINTS  = Convert.ToInt32(dr["TOTAL_JOINTS"].ToString());
                            ndePMIStatus.PMI_WELDED    = Convert.ToInt32(dr["PMI_WELDED"].ToString());
                            ndePMIStatus.PMI_REQUIRED  = Convert.ToInt32(dr["PMI_REQUIRED"].ToString());
                            ndePMIStatus.PMI_REQUESTED = Convert.ToInt32(dr["PMI_REQUESTED"].ToString());
                            ndePMIStatus.PMI_DONE      = Convert.ToInt32(dr["PMI_DONE"].ToString());
                            ndePMIStatus.PMI_COVERAGE  = Convert.ToDouble(dr["PMI_COVERAGE"].ToString());
                            ndePMIStatus.PMI_BALANCE   = Convert.ToInt32(dr["PMI_BALANCE"].ToString());
                            ndePMIStatusList.Add(ndePMIStatus);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(ndePMIStatusList);

            Context.Response.Write(data);
        }
コード例 #13
0
        public void GetDailyFitupJointDetails(int PROJECT_ID, string SUB_CON_ID, string CAT_ID, string MAT_TYPE, string DATE_FROM, string DATE_TO)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <DailyFitupWelding_Joint_Model> dailyFitupJointShopList = new List <DailyFitupWelding_Joint_Model>();
            string conn_str = DatabaseTools.AmgDbConnectionString(PROJECT_ID);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = string.Empty;

                if (string.IsNullOrEmpty(DATE_FROM) && string.IsNullOrEmpty(DATE_TO))
                {
                    DATE_FROM = DateTime.Now.ToString("dd-MMM-yyyy");
                    DATE_TO   = DateTime.Now.ToString("dd-MMM-yyyy");
                }


                if (CAT_ID == "1")
                {
                    string categoryType = "SELECT * FROM VIEW_WELDING_REPORT" +
                                          $" WHERE PROJECT_ID={1} AND (SUB_CON_ID = '{SUB_CON_ID}' OR '{SUB_CON_ID}' ='99') AND (CAT_ID= '{1}' OR CAT_ID='{3}') AND (FITUP_DATE >= '{DATE_FROM}') AND (FITUP_DATE <= '{DATE_TO}') AND (MAT_TYPE = '{MAT_TYPE}' OR '{MAT_TYPE}' = 'XXX') ORDER BY ISO_TITLE1, SPOOL, JOINT_NO";
                    sql = categoryType;
                }
                else
                {
                    string categoryType = "SELECT * FROM VIEW_WELDING_REPORT" +
                                          $" WHERE PROJECT_ID={1} AND (SUB_CON_ID = '{SUB_CON_ID}' OR '{SUB_CON_ID}' ='99') AND (CAT_ID= '{2}' OR CAT_ID='{4}') AND (FITUP_DATE >= '{DATE_FROM}') AND (FITUP_DATE <= '{DATE_TO}') AND (MAT_TYPE = '{MAT_TYPE}' OR '{MAT_TYPE}' = 'XXX') ORDER BY ISO_TITLE1, SPOOL, JOINT_NO";
                    sql = categoryType;
                }


                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            DailyFitupWelding_Joint_Model dailyFitupJointShop = new DailyFitupWelding_Joint_Model();
                            dailyFitupJointShop.project_id  = dr["PROJECT_ID"].ToString();
                            dailyFitupJointShop.job_code    = dr["job_code"].ToString();
                            dailyFitupJointShop.client_name = dr["client_name"].ToString();
                            dailyFitupJointShop.rep_title1  = dr["rep_title1"].ToString();
                            dailyFitupJointShop.rep_title2  = dr["rep_title2"].ToString();
                            dailyFitupJointShop.job_name    = dr["job_name"].ToString();
                            dailyFitupJointShop.proj_rem    = dr["proj_rem"].ToString();
                            // dailyFitupJointShop.app_logo1 = dr["app_logo1"].ToString();
                            // dailyFitupJointShop.app_logo2 = dr["app_logo2"].ToString();
                            //dailyFitupJointShop.wo_id = dr["wo_id"].ToString();
                            //dailyFitupJointShop.wo_name = dr["wo_name"].ToString();
                            dailyFitupJointShop.sub_con_id   = dr["sub_con_id"].ToString();
                            dailyFitupJointShop.sub_con_name = dr["sub_con_name"].ToString();
                            //dailyFitupJointShop.iso_id = dr["iso_id"].ToString();
                            dailyFitupJointShop.line_no    = dr["line_no"].ToString();
                            dailyFitupJointShop.iso_title1 = dr["iso_title1"].ToString();
                            //dailyFitupJointShop.sheet = dr["sheet"].ToString();
                            dailyFitupJointShop.spool  = dr["spool"].ToString();
                            dailyFitupJointShop.rev_no = dr["rev_no"].ToString();
                            dailyFitupJointShop.fcr    = dr["fcr"].ToString();
                            dailyFitupJointShop.scr    = dr["scr"].ToString();
                            //dailyFitupJointShop.area_l1 = dr["area_l1"].ToString();
                            //dailyFitupJointShop.train = dr["train"].ToString();
                            //dailyFitupJointShop.srv_code = dr["srv_code"].ToString();
                            dailyFitupJointShop.spl_id         = dr["spl_id"].ToString();
                            dailyFitupJointShop.main_mat       = dr["main_mat"].ToString();
                            dailyFitupJointShop.field_sc_id    = dr["field_sc_id"].ToString();
                            dailyFitupJointShop.field_sc_name  = dr["field_sc_name"].ToString();
                            dailyFitupJointShop.mat_type       = dr["mat_type"].ToString();
                            dailyFitupJointShop.mat_class      = dr["mat_class"].ToString();
                            dailyFitupJointShop.joint_id       = dr["joint_id"].ToString();
                            dailyFitupJointShop.joint_no       = dr["joint_no"].ToString();
                            dailyFitupJointShop.rev_code       = dr["rev_code"].ToString();
                            dailyFitupJointShop.crw_code       = dr["crw_code"].ToString();
                            dailyFitupJointShop.joint_type     = dr["joint_type"].ToString();
                            dailyFitupJointShop.joint_size     = dr["joint_size"].ToString();
                            dailyFitupJointShop.joint_size_dec = dr["joint_size_dec"].ToString();
                            dailyFitupJointShop.joint_thk      = dr["joint_thk"].ToString();
                            dailyFitupJointShop.schedule       = dr["schedule"].ToString();
                            dailyFitupJointShop.cat_id         = dr["cat_id"].ToString();
                            dailyFitupJointShop.cat_name       = dr["cat_name"].ToString();
                            dailyFitupJointShop.item_1         = dr["item_1"].ToString();
                            dailyFitupJointShop.item_2         = dr["item_2"].ToString();
                            //dailyFitupJointShop.mat_id1 = dr["mat_id1"].ToString();
                            //dailyFitupJointShop.mat_id2 = dr["mat_id2"].ToString();
                            //dailyFitupJointShop.mat_code1 = dr["mat_code1"].ToString();
                            //dailyFitupJointShop.short_descr1 = dr["short_descr1"].ToString();
                            //dailyFitupJointShop.mat_code2 = dr["mat_code2"].ToString();
                            //dailyFitupJointShop.short_descr2 = dr["short_descr2"].ToString();
                            dailyFitupJointShop.heat_no1     = dr["heat_no1"].ToString();
                            dailyFitupJointShop.heat_no2     = dr["heat_no2"].ToString();
                            dailyFitupJointShop.fitup_rep_no = dr["fitup_rep_no"].ToString();
                            dailyFitupJointShop.weld_rep_no  = dr["weld_rep_no"].ToString();
                            dailyFitupJointShop.weld_insp    = dr["weld_insp"].ToString();
                            //dailyFitupJointShop.amg_insp_rep = dr["amg_insp_rep"].ToString();
                            string fitupDate = dr["fitup_date"].ToString();
                            if (!string.IsNullOrEmpty(fitupDate))
                            {
                                dailyFitupJointShop.fitup_date = DateTime.Parse(dr["fitup_date"].ToString()).ToString("dd-MMM-yyyy");
                            }
                            string weld_insp_date = dr["weld_insp_date"].ToString();
                            if (!string.IsNullOrEmpty(weld_insp_date))
                            {
                                dailyFitupJointShop.weld_insp_date = DateTime.Parse(dr["weld_insp_date"].ToString()).ToString("dd-MMM-yyyy");
                            }
                            string weld_date = dr["weld_date"].ToString();
                            if (!string.IsNullOrEmpty(weld_date))
                            {
                                dailyFitupJointShop.weld_date = DateTime.Parse(dr["weld_date"].ToString()).ToString("dd-MMM-yyyy");
                            }
                            string weld_entry_date = dr["weld_entry_date"].ToString();
                            if (!string.IsNullOrEmpty(weld_entry_date))
                            {
                                dailyFitupJointShop.weld_entry_date = DateTime.Parse(dr["weld_entry_date"].ToString()).ToString("dd-MMM-yyyy");
                            }
                            dailyFitupJointShop.fitup_insp      = dr["fitup_insp"].ToString();
                            dailyFitupJointShop.amg_weld_rep    = dr["amg_weld_rep"].ToString();
                            dailyFitupJointShop.root_hot_welder = dr["root_hot_welder"].ToString();
                            dailyFitupJointShop.fill_cap_welder = dr["fill_cap_welder"].ToString();
                            dailyFitupJointShop.rt   = dr["rt"].ToString();
                            dailyFitupJointShop.pt   = dr["pt"].ToString();
                            dailyFitupJointShop.mt   = dr["mt"].ToString();
                            dailyFitupJointShop.pwht = dr["pwht"].ToString();
                            dailyFitupJointShop.pmi  = dr["pmi"].ToString();
                            dailyFitupJointShop.ht   = dr["ht"].ToString();
                            //dailyFitupJointShop.wps_no = dr["wps_no"].ToString();
                            //dailyFitupJointShop.prog_factor = dr["prog_factor"].ToString();
                            //dailyFitupJointShop.cns_batch = dr["cns_batch"].ToString();
                            dailyFitupJointShop.weld_process = dr["weld_process"].ToString();

                            dailyFitupJointShopList.Add(dailyFitupJointShop);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(dailyFitupJointShopList);

            Context.Response.Write(data);
        }
        public void GetSpoolClearanceAndReleaseServiceDetails(int ProjId, string SpoolId)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <DuqmSpoolClearanceAndReleaseModel> spoolClearance = new List <DuqmSpoolClearanceAndReleaseModel>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = "SELECT * FROM VIEW_SPL_CLR_HS" +
                             $" WHERE PROJECT_ID=1 AND spl_id={SpoolId}";

                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            DuqmSpoolClearanceAndReleaseModel clearance = new DuqmSpoolClearanceAndReleaseModel();
                            clearance.LINE_NO      = dr["LINE_NO"].ToString();
                            clearance.ISO_TITLE1   = dr["ISO_TITLE1"].ToString();
                            clearance.SPOOL        = dr["SPOOL"].ToString();
                            clearance.SC_NAME      = dr["SC_NAME"].ToString();
                            clearance.SPL_REV      = dr["SPL_REV"].ToString();
                            clearance.SPL_SCR      = dr["SPL_SCR"].ToString();
                            clearance.SPL_FCR      = dr["SPL_FCR"].ToString();
                            clearance.MAT_CLASS    = dr["MAT_CLASS"].ToString();
                            clearance.MAT_TYPE     = dr["MAT_TYPE"].ToString();
                            clearance.SPL_PS       = dr["SPL_PS"].ToString();
                            clearance.SHOP_ID      = dr["SHOP_ID"].ToString();
                            clearance.DIM_CHECK    = dr["DIM_CHECK"].ToString();
                            clearance.HYDRO_REP_NO = dr["HYDRO_REP_NO"].ToString();
                            string hydro_rep_date = dr["HYDRO_REP_DATE"].ToString();
                            if (!string.IsNullOrEmpty(hydro_rep_date))
                            {
                                clearance.HYDRO_REP_DATE = DateTime.Parse(dr["HYDRO_REP_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }
                            clearance.PNT_REP_NO = dr["PNT_REP_NO"].ToString();
                            string pick_rep_no_date = dr["PICK_REP_NO_DATE"].ToString();
                            if ((!string.IsNullOrEmpty(pick_rep_no_date)) && (pick_rep_no_date != "/"))
                            {
                                clearance.PICK_REP_NO_DATE = DateTime.Parse(dr["PICK_REP_NO_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }

                            clearance.PNT_REQ_NO        = dr["PNT_REQ_NO"].ToString();
                            clearance.JOINT_NO          = dr["JOINT_NO"].ToString();
                            clearance.JOINT_TYPE        = dr["JOINT_TYPE"].ToString();
                            clearance.WPS_NO            = dr["WPS_NO"].ToString();
                            clearance.TW_FLG            = dr["TW_FLG"].ToString();
                            clearance.MRV_NOS1          = dr["MRV_NOS1"].ToString();
                            clearance.MAT_CODE1         = dr["MAT_CODE1"].ToString();
                            clearance.HEAT_NO1          = dr["HEAT_NO1"].ToString();
                            clearance.FITUP_REP_NO      = dr["FITUP_REP_NO"].ToString();
                            clearance.ROOT_HOT_WELDER   = dr["ROOT_HOT_WELDER"].ToString();
                            clearance.WELD_REP_NO       = dr["WELD_REP_NO"].ToString();
                            clearance.PT_REP_NO         = dr["PT_REP_NO"].ToString();
                            clearance.MT_PT_ROOT_REP_NO = dr["MT_PT_ROOT_REP_NO"].ToString();
                            clearance.PMI1_REP_NO       = dr["PMI1_REP_NO"].ToString();
                            clearance.RT1_REP_NO        = dr["RT1_REP_NO"].ToString();
                            clearance.RT2_REP_NO        = dr["RT2_REP_NO"].ToString();

                            clearance.PWHT_REP_NO  = dr["PWHT_REP_NO"].ToString();
                            clearance.UT_REP_NO    = dr["UT_REP_NO"].ToString();
                            clearance.HT_REP_NO    = dr["HT_REP_NO"].ToString();
                            clearance.FT_REP_NO    = dr["FT_REP_NO"].ToString();
                            clearance.RT1_PASS_FLG = dr["RT1_PASS_FLG"].ToString();
                            clearance.RT2_PASS_FLG = dr["RT2_PASS_FLG"].ToString();
                            clearance.TRACER       = dr["TRACER"].ToString();
                            clearance.SYMBOL       = dr["SYMBOL"].ToString();
                            clearance.JOINT_SIZE   = dr["JOINT_SIZE"].ToString();
                            clearance.JOINT_THK    = dr["JOINT_THK"].ToString();
                            clearance.CAT_NAME     = dr["CAT_NAME"].ToString();
                            clearance.MRV_NOS2     = dr["MRV_NOS2"].ToString();
                            clearance.MAT_CODE2    = dr["MAT_CODE2"].ToString();
                            clearance.HEAT_NO2     = dr["HEAT_NO2"].ToString();
                            string fitup_date = dr["FITUP_DATE"].ToString();
                            if (!string.IsNullOrEmpty(fitup_date))
                            {
                                clearance.FITUP_DATE = DateTime.Parse(dr["FITUP_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }
                            clearance.FILL_CAP_WELDER = dr["FILL_CAP_WELDER"].ToString();

                            string weld_date = dr["WELD_DATE"].ToString();
                            if (!string.IsNullOrEmpty(weld_date))
                            {
                                clearance.WELD_DATE = DateTime.Parse(dr["WELD_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }

                            string pt_date = dr["PT_DATE"].ToString();
                            if (!string.IsNullOrEmpty(pt_date))
                            {
                                clearance.PT_DATE = DateTime.Parse(dr["PT_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }

                            string mt_pt_rootRep_date = dr["MT_PT_ROOT_REP_DATE"].ToString();
                            if (!string.IsNullOrEmpty(mt_pt_rootRep_date))
                            {
                                clearance.MT_PT_ROOT_REP_DATE = DateTime.Parse(dr["MT_PT_ROOT_REP_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }

                            string mt_date = dr["MT_DATE"].ToString();
                            if (!string.IsNullOrEmpty(mt_date))
                            {
                                clearance.MT_DATE = DateTime.Parse(dr["MT_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }

                            string pmi1_date = dr["PMI1_DATE"].ToString();
                            if (!string.IsNullOrEmpty(pmi1_date))
                            {
                                clearance.PMI1_DATE = DateTime.Parse(dr["PMI1_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }

                            string rt1_date = dr["RT1_DATE"].ToString();
                            if (!string.IsNullOrEmpty(rt1_date))
                            {
                                clearance.RT1_DATE = DateTime.Parse(dr["RT1_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }

                            string rt2_date = dr["RT2_DATE"].ToString();
                            if (!string.IsNullOrEmpty(rt2_date))
                            {
                                clearance.RT2_DATE = DateTime.Parse(dr["RT2_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }

                            string pwht_date = dr["PWHT_DATE"].ToString();
                            if (!string.IsNullOrEmpty(pwht_date))
                            {
                                clearance.PWHT_DATE = DateTime.Parse(dr["PWHT_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }

                            string ut_date = dr["UT_DATE"].ToString();
                            if (!string.IsNullOrEmpty(ut_date))
                            {
                                clearance.UT_DATE = DateTime.Parse(dr["UT_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }

                            string ht_date = dr["HT_DATE"].ToString();
                            if (!string.IsNullOrEmpty(ht_date))
                            {
                                clearance.HT_DATE = DateTime.Parse(dr["HT_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }

                            string ft_date = dr["FT_DATE"].ToString();
                            if (!string.IsNullOrEmpty(ft_date))
                            {
                                clearance.FT_DATE = DateTime.Parse(dr["FT_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }
                            clearance.UT_PASS_FLG = dr["UT_PASS_FLG"].ToString();
                            clearance.DIM_CHECK   = dr["DIM_CHECK"].ToString();
                            clearance.NDE_CMPLT   = dr["NDE_CMPLT"].ToString();
                            clearance.PAINT_CLR   = dr["PAINT_CLR"].ToString();
                            spoolClearance.Add(clearance);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(spoolClearance);

            Context.Response.Write(data);
        }
        public void GetWelderPerformanceMonthlyDetails(int ProjId, int SUB_CON_ID, string DATE_FROM, string DATE_TO)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <Welder_Performance_Model> welderPerformanceList = new List <Welder_Performance_Model>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();

                if (string.IsNullOrEmpty(DATE_FROM) && string.IsNullOrEmpty(DATE_TO))
                {
                    DATE_FROM = DateTime.Now.ToString("dd-MMM-yyyy");
                    DATE_TO   = DateTime.Now.ToString("dd-MMM-yyyy");
                }


                string sql = "SELECT PROJECT_ID, JOB_CODE, CLIENT_NAME, JOB_NAME, PROJ_DESC, " +
                             $"SC_ID, SUB_CON_NAME, WELDER_ID, WELDER_NO, " +
                             $"SUM(FNC_IIF_DATE(CREATE_DATE, '{DATE_TO}', WELD_JNTS, WELD_JNTS, 0)) AS JNTS_WELDED_C," +
                             $"SUM(FNC_IIF_DATE(CREATE_DATE, '{DATE_TO}', RT_JNTS, RT_JNTS, 0)) AS JNTS_RT_DONE_C," +
                             $"SUM(FNC_IIF_DATE(CREATE_DATE, '{DATE_TO}', REP_JNTS, REP_JNTS, 0)) AS JNTS_REPAR_C," +
                             $"SUM(FNC_BETWEEN_DATE('{DATE_FROM}', '{DATE_TO}', CREATE_DATE, WELD_JNTS)) AS JNTS_WELDED_THIS," +
                             $"SUM(FNC_BETWEEN_DATE('{DATE_FROM}', '{DATE_TO}', CREATE_DATE, RT_JNTS)) AS JNTS_RT_DONE_THIS," +
                             $"SUM(FNC_BETWEEN_DATE('{DATE_FROM}', '{DATE_TO}', CREATE_DATE, REP_JNTS)) AS JNTS_REPAR_THIS," +
                             $"SUM(FNC_BETWEEN_DATE(TO_DATE('{DATE_FROM}') -7, TO_DATE('{DATE_FROM}') - 1, CREATE_DATE, WELD_JNTS)) AS JNTS_WELDED_LAST_WEEK," +
                             $"SUM(FNC_BETWEEN_DATE(TO_DATE('{DATE_FROM}') -7, TO_DATE('{DATE_FROM}') - 1, CREATE_DATE, RT_JNTS)) AS JNTS_RT_DONE_LAST_WEEK," +
                             $"SUM(FNC_BETWEEN_DATE(TO_DATE('{DATE_FROM}') -7, TO_DATE('{DATE_FROM}') - 1, CREATE_DATE, REP_JNTS)) AS JNTS_REPAR_LAST_WEEK," +
                             $"SUM(FNC_IIF_DATE(CREATE_DATE, TO_DATE('{DATE_FROM}' )-7, 0, WELD_JNTS, 0)) AS JNTS_WELDED_PREV," +
                             $"SUM(FNC_IIF_DATE(CREATE_DATE, TO_DATE('{DATE_FROM}') -7, 0, RT_JNTS, 0)) AS JNTS_RT_DONE_PREV," +
                             $"SUM(FNC_IIF_DATE(CREATE_DATE, TO_DATE('{DATE_FROM}') -7, 0, REP_JNTS, 0)) AS JNTS_REPAR_PREV FROM VIEW_WELDER_PERF_F " +
                             $"WHERE PROJECT_ID={1}  AND SC_ID = {SUB_CON_ID} " +
                             $"GROUP BY WELDER_ID, WELDER_NO, SC_ID, SUB_CON_NAME, PROJECT_ID, JOB_CODE, CLIENT_NAME, JOB_NAME, PROJ_DESC " +
                             $"ORDER BY SUB_CON_NAME, WELDER_NO";


                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            Welder_Performance_Model welderPerformance = new Welder_Performance_Model();
                            welderPerformance.PROJECT_ID   = dr["PROJECT_ID"].ToString();
                            welderPerformance.JOB_CODE     = dr["JOB_CODE"].ToString();
                            welderPerformance.CLIENT_NAME  = dr["CLIENT_NAME"].ToString();
                            welderPerformance.PROJ_DESC    = dr["PROJ_DESC"].ToString();
                            welderPerformance.JOB_NAME     = dr["JOB_NAME"].ToString();
                            welderPerformance.SUB_CON_NAME = dr["SUB_CON_NAME"].ToString();
                            welderPerformance.SC_ID        = Convert.ToInt32(dr["SC_ID"].ToString());
                            string welderID = dr["WELDER_ID"].ToString();
                            if (!string.IsNullOrEmpty(welderID))
                            {
                                welderPerformance.WELDER_ID = Convert.ToInt32(dr["WELDER_ID"].ToString());
                            }
                            welderPerformance.WELDER_NO              = dr["WELDER_NO"].ToString();
                            welderPerformance.JNTS_WELDED_C          = Convert.ToDouble(dr["JNTS_WELDED_C"].ToString());
                            welderPerformance.JNTS_RT_DONE_C         = Convert.ToDouble(dr["JNTS_RT_DONE_C"].ToString());
                            welderPerformance.JNTS_REPAR_C           = Convert.ToDouble(dr["JNTS_REPAR_C"].ToString());
                            welderPerformance.JNTS_WELDED_THIS       = Convert.ToDouble(dr["JNTS_WELDED_THIS"].ToString());
                            welderPerformance.JNTS_RT_DONE_THIS      = Convert.ToDouble(dr["JNTS_RT_DONE_THIS"].ToString());
                            welderPerformance.JNTS_REPAR_THIS        = Convert.ToDouble(dr["JNTS_REPAR_THIS"].ToString());
                            welderPerformance.JNTS_WELDED_LAST_WEEK  = Convert.ToDouble(dr["JNTS_WELDED_LAST_WEEK"].ToString());
                            welderPerformance.JNTS_RT_DONE_LAST_WEEK = Convert.ToDouble(dr["JNTS_RT_DONE_LAST_WEEK"].ToString());
                            welderPerformance.JNTS_REPAR_LAST_WEEK   = Convert.ToDouble(dr["JNTS_REPAR_LAST_WEEK"].ToString());
                            welderPerformance.JNTS_WELDED_PREV       = Convert.ToDouble(dr["JNTS_WELDED_PREV"].ToString());
                            welderPerformance.JNTS_RT_DONE_PREV      = Convert.ToDouble(dr["JNTS_RT_DONE_PREV"].ToString());
                            welderPerformance.JNTS_REPAR_PREV        = Convert.ToDouble(dr["JNTS_REPAR_PREV"].ToString());
                            welderPerformanceList.Add(welderPerformance);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(welderPerformanceList);

            Context.Response.Write(data);
        }
        public void GetFitupWeldingProgress_MatWiseDetails(int ProjId, string CAT_ID, int SUB_CON_ID, string DATE_FROM, string DATE_TO, string IsShop)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <FitupWeldingProgress_MatWise_Model> fitupWeldingProgressList = new List <FitupWeldingProgress_MatWise_Model>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = string.Empty;

                if (string.IsNullOrEmpty(DATE_FROM) && string.IsNullOrEmpty(DATE_TO))
                {
                    DATE_FROM = DateTime.Now.ToString("dd-MMM-yyyy");
                    DATE_TO   = DateTime.Now.ToString("dd-MMM-yyyy");
                }

                if (IsShop.ToUpper() == "Y")
                {
                    string query = "SELECT JOB_CODE, JOB_NAME, PROJ_REM, SUB_CON_ID, " +
                                   $"SUB_CON_NAME, MAIN_MAT, " +
                                   $"SUM(S_ID_SCOPE) AS S_ID_SCOPE," +
                                   $"SUM(FNC_BETWEEN_DATE('{DATE_FROM}', '{DATE_TO}', FITUP_DATE, S_FITUP_DONE)) AS S_FITUP_DONE," +
                                   $"SUM(FNC_BETWEEN_DATE('{DATE_FROM}', '{DATE_TO}', WELD_DATE, S_WELDING_DONE)) AS S_WELDING_DONE," +
                                   $"SUM(F_ID_SCOPE) AS F_ID_SCOPE," +
                                   $"SUM(FNC_BETWEEN_DATE('{DATE_FROM}', '{DATE_TO}', FITUP_DATE, F_FITUP_DONE)) AS F_FITUP_DONE," +
                                   $"SUM(FNC_BETWEEN_DATE('{DATE_FROM}', '{DATE_TO}', WELD_DATE, F_WELDING_DONE)) AS F_WELDING_DONE," +
                                   $"SUM(FNC_BETWEEN_DATE('{DATE_FROM}', '{DATE_TO}', SWN_DATE, SWN_BAL_ID)) AS S_SWN_BALANCE FROM VIEW_WELDING_REPORT_SF " +
                                   $"WHERE PROJECT_ID={1}  AND (SUB_CON_ID = {SUB_CON_ID}  OR {SUB_CON_ID} = 99) " +
                                   $"GROUP BY JOB_CODE, JOB_NAME, PROJ_REM, SUB_CON_ID, SUB_CON_NAME, MAIN_MAT ";
                    sql = query;
                }
                else
                {
                    string query = "SELECT JOB_CODE, JOB_NAME, PROJ_REM, FIELD_SC_ID, " +
                                   $"SUB_CON_NAME, MAIN_MAT, " +
                                   $"SUM(F_ID_SCOPE) AS F_ID_SCOPE," +
                                   $"SUM(FNC_BETWEEN_DATE('{DATE_FROM}', '{DATE_TO}', FITUP_DATE, F_FITUP_DONE)) AS F_FITUP_DONE," +
                                   $"SUM(FNC_BETWEEN_DATE('{DATE_FROM}', '{DATE_TO}', WELD_DATE, F_WELDING_DONE)) AS F_WELDING_DONE FROM VIEW_WELDING_REPORT_FIELD_A " +
                                   $"WHERE PROJECT_ID={1}  AND (FIELD_SC_ID = {SUB_CON_ID}  OR {SUB_CON_ID} = 99) " +
                                   $"GROUP BY JOB_CODE, JOB_NAME, PROJ_REM, FIELD_SC_ID, SUB_CON_NAME, MAIN_MAT ";
                    sql = query;
                }

                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            FitupWeldingProgress_MatWise_Model fitupWeldingProgress = new FitupWeldingProgress_MatWise_Model();
                            fitupWeldingProgress.JOB_CODE     = dr["JOB_CODE"].ToString();
                            fitupWeldingProgress.JOB_NAME     = dr["JOB_NAME"].ToString();
                            fitupWeldingProgress.PROJ_REM     = dr["PROJ_REM"].ToString();
                            fitupWeldingProgress.SUB_CON_NAME = dr["SUB_CON_NAME"].ToString();
                            if (IsShop.ToUpper() == "Y")
                            {
                                fitupWeldingProgress.SUB_CON_ID     = Convert.ToInt32(dr["SUB_CON_ID"].ToString());
                                fitupWeldingProgress.S_ID_SCOPE     = MathUtility.stringToDouble(dr["S_ID_SCOPE"].ToString());
                                fitupWeldingProgress.S_FITUP_DONE   = MathUtility.stringToDouble(dr["S_FITUP_DONE"].ToString());
                                fitupWeldingProgress.S_WELDING_DONE = MathUtility.stringToDouble(dr["S_WELDING_DONE"].ToString());
                                fitupWeldingProgress.S_SWN_BALANCE  = MathUtility.stringToDouble(dr["S_SWN_BALANCE"].ToString());
                            }
                            if (IsShop.ToUpper() == "N")
                            {
                                fitupWeldingProgress.FIELD_SC_ID = Convert.ToInt32(dr["FIELD_SC_ID"].ToString());
                            }
                            fitupWeldingProgress.MAIN_MAT       = dr["MAIN_MAT"].ToString();
                            fitupWeldingProgress.F_ID_SCOPE     = MathUtility.stringToDouble(dr["F_ID_SCOPE"].ToString());
                            fitupWeldingProgress.F_FITUP_DONE   = MathUtility.stringToDouble(dr["F_FITUP_DONE"].ToString());
                            fitupWeldingProgress.F_WELDING_DONE = MathUtility.stringToDouble(dr["F_WELDING_DONE"].ToString());
                            fitupWeldingProgressList.Add(fitupWeldingProgress);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(fitupWeldingProgressList);

            Context.Response.Write(data);
        }
        public void GetDailyWeldingControlSheet(int ProjId, string weldReportNo)
        {
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            List <DuqmDailyWeldingControlSheetModel> weldSummary = new List <DuqmDailyWeldingControlSheetModel>();
            string conn_str = DatabaseTools.AmgDbConnectionString(ProjId);

            using (OracleConnection conn = new OracleConnection(conn_str))
            {
                conn.Open();
                string sql = "SELECT * FROM REP_DAILY_WELDING_CTRL_SHT" +
                             $" WHERE PROJECT_ID={1} AND WELD_REP_NO = '{weldReportNo}'";

                using (OracleCommand cmd = new OracleCommand(sql, conn))
                    using (OracleDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            DuqmDailyWeldingControlSheetModel summary = new DuqmDailyWeldingControlSheetModel();
                            summary.duqm_no        = dr["DUQM_NO"].ToString();
                            summary.iso_title1     = dr["ISO_TITLE1"].ToString();
                            summary.spool          = dr["SPOOL"].ToString();
                            summary.joint_no       = dr["JOINT_NO"].ToString();
                            summary.heat_no1       = dr["HEAT_NO1"].ToString();
                            summary.heat_no2       = dr["HEAT_NO2"].ToString();
                            summary.cat_name       = dr["CAT_NAME"].ToString();
                            summary.mat_class      = dr["MAT_CLASS"].ToString();
                            summary.ps             = dr["PS"].ToString();
                            summary.joint_size_dec = double.Parse(dr["JOINT_SIZE_DEC"].ToString());
                            summary.schedule       = dr["SCHEDULE"].ToString();
                            summary.joint_thk      = double.Parse(dr["JOINT_THK"].ToString());
                            summary.joint_type     = dr["JOINT_TYPE"].ToString();
                            summary.wps_no         = dr["WPS_NO"].ToString();
                            //summary.welding_consumables = dr["WELDING_CONSUMABLES"].ToString();
                            summary.electrode_size = dr["ELECTRODE_SIZE"].ToString();
                            summary.batch_no       = dr["BATCH_NO"].ToString();

                            string weld_date = dr["WELD_DATE"].ToString();
                            if (!string.IsNullOrEmpty(weld_date))
                            {
                                summary.weld_date = DateTime.Parse(dr["WELD_DATE"].ToString()).ToString("dd-MMM-yyyy");
                            }

                            summary.fitup_date = DateTime.Parse(dr["FITUP_DATE"].ToString()).ToString("dd-MMM-yyyy");

                            summary.visual_affect   = dr["VISUAL_AFFECT"].ToString();
                            summary.root_hot_welder = dr["ROOT_HOT_WELDER"].ToString();
                            summary.fill_cap_welder = dr["FILL_CAP_WELDER"].ToString();
                            summary.weld_rep_no     = dr["WELD_REP_NO"].ToString();
                            summary.rt   = double.Parse(string.IsNullOrEmpty(dr["RT"].ToString()) ? "0" : dr["RT"].ToString());
                            summary.pwht = dr["PWHT"].ToString();
                            summary.mt   = dr["MT"].ToString();
                            summary.pt   = dr["PT"].ToString();
                            summary.ut   = dr["UT"].ToString();
                            summary.pmi  = dr["PMI"].ToString();
                            summary.ht   = dr["HT"].ToString();
                            weldSummary.Add(summary);
                        }
                    }
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            js.MaxJsonLength = int.MaxValue;
            string data = js.Serialize(weldSummary);

            Context.Response.Write(data);
        }