/* private string QUERY = @"SELECT {0} AS message_id, * '454666' AS accession_number, * '20200101120000' AS study_date, * 'ASDASD' AS study_description, * '12345455' AS patient_id, * 'TESTE 'AS last_name, * '19800101' AS birth_date, * 'M' AS sex, * '666' AS requested_procedure_id, * 'GFGFGF' AS requested_procedure_name, * 'TESTERRR' AS last_name_request_doctor, * '89898' AS code_request_doctor, * 'YUYUY' AS first_name_read_doctor, * 'VBVBVB' AS last_name_read_doctor, * '4546666' AS code_read_doctor, * '20200318120000' AS report_sign_datetime, * TO_CLOB('TOMOGRAFIA COMPUTADORIZADA DO TÓRAX * * * Método: * Aquisição volumétrica, sem contraste.Exame realizado em caráter de urgência. * * Indicação: Suspeita de pneumonia viral. * * * Análise: * * * Achados mais relevantes no contexto de urgência: * * * Opacidades pulmonares em vidro fosco, esparsas, em distribuição multifocal, bilateral, predominantemente periférica e posterior. O aspecto é inespecifico, mas pode estar relacionado a processo infeccioso / inflamatório, sobretudo por agentes infecciosos virais. * * Demais achados: * * * Ausência de derrame pleural. * Restante do parênquima pulmonar com atenuação preservada. * Traqueia e brônquios principais pérvios e com calibres conservados.Não há linfonodomegalias mediastinais. * Grandes vasos do mediastino de trajeto e calibre conservados. * Arcabouço ósseo torácico sem particularidades.') AS report * * from dual * ";*/ public void ReportSalvalus() { //string s = System.IO.File.ReadAllText("C:\\temp\\31_492721.rtf"); //RichTextBox rtb = new RichTextBox(); //TODO: Execute business logic from this method. //CacheManagerBusiness.Execute(); var conn = ConfigurationManager.ConnectionStrings["InfinittOracle"].ConnectionString; var outxml = ConfigurationManager.AppSettings["OutReport"]; var aetitle = String.Join(",", ConfigurationManager.AppSettings["AeTitles"].Split(',')); var reports = new List <ReportModel>(); using (OracleConnection connection = new OracleConnection(conn)) { using (OracleCommand command = new OracleCommand(string.Format(QUERY, aetitle), connection)) { connection.Open(); var transaction = connection.BeginTransaction(); command.Transaction = transaction; command.CommandTimeout = 320; using (OracleDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { reports = reader.Cast <IDataRecord>().Select(r => ReportModel.Create(r)).ToList(); } } } foreach (var report in reports) { var doc = Common.GenerateXMLString(report); doc.Save(outxml + $"\\{report.accession_number}.xml"); Common.Save_RTF_file(outxml + $"\\{report.accession_number}.rtf", Common.BuildStringReport(report)); using (OracleCommand command = new OracleCommand()) { command.CommandTimeout = 320; command.Connection = connection; command.CommandText = $"UPDATE MOVEREPORT SET STATUS = 1 WHERE STUDY_KEY = {report.message_id}"; command.ExecuteNonQuery(); command.Transaction.Commit(); } } connection.Close(); } }
protected void Page_Load(object sender, EventArgs e) { try { string v_joborder = ""; if ((Request.Params["joborder"] != null)) { v_joborder = Request.Params["joborder"].ToString(); Sql_str = " SELECT J.ITEM_NO, J.WIR_KIND,replace(to_char(J.DRAW_DIA,'99.99'),'.00','') DRAW_DIA,NVL(J.LUO_NO,'x') LUO_NO,J.ASSM_NO||'-'||J.ASSM_NAME ASSM, "; Sql_str += " J.REQU_QTY,J.ISSU_QTY,J.FNSH_QTY ,J.END_CODE "; Sql_str += "FROM v_apc_job_orde J "; Sql_str += "WHERE JOB_NO = :joborder "; Sql_str += "ORDER BY 1 "; //建立連線 //使用web.config conn string OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["jheip"].ConnectionString); conn.Open(); OracleCommand cmd = new OracleCommand(Sql_str, conn); cmd.Parameters.Add(new OracleParameter("joborder", OracleType.VarChar, 100)); cmd.Parameters["joborder"].Value = v_joborder; OracleDataReader dr = cmd.ExecuteReader(); try { //while (dr.Read()) //{ //組成JSON字串 if (dr.HasRows) { var dataQuery = from d in dr.Cast <DbDataRecord>() select new { ITEM_NO = (Decimal)dr["ITEM_NO"], WIR_KIND = (String)dr["WIR_KIND"], DRAW_DIA = (String)dr["DRAW_DIA"], LUO_NO = (String)dr["LUO_NO"], ASSM = (String)dr["ASSM"], REQU_QTY = (Decimal)dr["REQU_QTY"], ISSU_QTY = (Decimal)dr["ISSU_QTY"], FNSH_QTY = (Decimal)dr["FNSH_QTY"], }; string v_json = (JsonConvert.SerializeObject(dataQuery)); tsconn.save_log("guest", "QueryJoborder_01", "192.168.0.19", v_json); Response.Write(v_json); //} } } catch (Exception ex) { //tsconn.save_log("guest", "QueryWires_01", "192.168.0.19", ex.ToString()); Response.Write(ex.ToString()); } finally { cmd.Dispose(); dr.Close(); dr.Dispose(); conn.Close(); conn.Dispose(); } //tsconn.trans_oracle815(Sql_str, "insert"); //Response.Write("Insert success!"); } } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { try { string v_process = "", v_pdate = ""; if ((Request.Params["process"] != null) & (Request.Params["pdate"] != null)) { v_process = Request.Params["process"].ToString(); v_pdate = Request.Params["pdate"].ToString(); Sql_str = " SELECT W.RAWMTRL_ID, W.HEAT_NO, W.DIAMETER,nvl(decode(W.NEXT,'A','A洗球','D','D洗抽','N','N螺帽',W.NEXT),'null') NEXT,to_char(W.PDATE,'yyyy/mm/dd') PDATE, COUNT(*) CNT "; Sql_str += " FROM EAGLE.WIRES_PICKLING W "; Sql_str += " WHERE PROCESS = :process "; Sql_str += " AND TO_CHAR(PDATE,'YYYY/MM/DD') = :pdate "; Sql_str += " GROUP BY W.RAWMTRL_ID, W.HEAT_NO, W.DIAMETER,nvl(decode(W.NEXT,'A','A洗球','D','D洗抽','N','N螺帽',W.NEXT),'null'),to_char(W.PDATE,'yyyy/mm/dd') "; Sql_str += " ORDER BY 4,1,2,3,5 "; //建立連線 //使用web.config conn string OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["jh815"].ConnectionString); conn.Open(); OracleCommand cmd = new OracleCommand(Sql_str, conn); cmd.Parameters.Add(new OracleParameter("process", OracleType.VarChar, 100)); cmd.Parameters["process"].Value = v_process; cmd.Parameters.Add(new OracleParameter("pdate", OracleType.VarChar, 100)); cmd.Parameters["pdate"].Value = v_pdate; OracleDataReader dr = cmd.ExecuteReader(); try { //while (dr.Read()) //{ //組成JSON字串 if (dr.HasRows) { var dataQuery = from d in dr.Cast <DbDataRecord>() select new { RAWMTRL_ID = (String)dr["RAWMTRL_ID"], HEAT_NO = (String)dr["HEAT_NO"], PDATE = (String)dr["PDATE"], NEXT = (String)dr["NEXT"], DIAMETER = (Decimal)dr["DIAMETER"], CNT = (Decimal)dr["CNT"] }; string v_json = (JsonConvert.SerializeObject(dataQuery)); tsconn.save_log("guest", "QueryWires_01", "192.168.0.19", v_json); Response.Write(v_json); //} } } catch (Exception ex) { //tsconn.save_log("guest", "QueryWires_01", "192.168.0.19", ex.ToString()); Response.Write(ex.ToString()); } finally { cmd.Dispose(); dr.Close(); dr.Dispose(); conn.Close(); conn.Dispose(); } //tsconn.trans_oracle815(Sql_str, "insert"); //Response.Write("Insert success!"); } } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (ts_Fun.chk_verify()) { //Server.Transfer("error.htm"); Response.Redirect("error2.aspx", false); } try { //string v_process = "", v_pdate = ""; if (Request.Params["location"] != null & Request.Params["pdate"] != null) { v_loc = Request.Params["location"].ToString(); v_pdate = Request.Params["pdate"].ToString(); Sql_str = " SELECT JOB_CARD, "; Sql_str += " CAT||'-'||DIA||'-'||LEN||'-'||TH||'-'||PL PRODUCTS, "; Sql_str += " WEIGHT,RAWMTRL_ID RAWMTRL, PDTSIZE,LOCATION, CREATE_DATE "; Sql_str += "FROM WIP_PLT_TRANS "; Sql_str += "WHERE 1=1 "; Sql_str += "AND LOCATION = NVL(:location,LOCATION) "; Sql_str += "AND TO_CHAR(CREATE_DATE,'YYYY/MM/DD') = :pdate "; Sql_str += "ORDER BY 1 "; //Sql_str = "SELECT LOT_NO||'-'||CTRLOT_NO||'-'||KEG_NO JOB_CARD, "; //Sql_str += " CAT||'-'||DIA||'-'||LEN||'-'||TH||'-'||PL PRODUCTS , "; //Sql_str += " P_SIZE,RAWMTRL_ID,LOCATION "; //Sql_str += " FROM wip_plt_scheduled S "; //Sql_str += " WHERE STATUS = 'N' AND LOCATION = :location "; //建立連線 //使用web.config conn string OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["jh815"].ConnectionString); conn.Open(); OracleCommand cmd = new OracleCommand(Sql_str, conn); cmd.Parameters.Add(new OracleParameter("location", OracleType.VarChar, 100)); cmd.Parameters["location"].Value = v_loc; cmd.Parameters.Add(new OracleParameter("pdate", OracleType.VarChar, 100)); cmd.Parameters["pdate"].Value = v_pdate; OracleDataReader dr = cmd.ExecuteReader(); try { //while (dr.Read()) //{ //組成JSON字串 if (dr.HasRows) { var dataQuery = from d in dr.Cast <DbDataRecord>() select new { JOB_CARD = (String)dr["JOB_CARD"], PRODUCTS = (String)dr["PRODUCTS"], RAWMTRL = (String)dr["RAWMTRL"], PDTSIZE = (String)dr["PDTSIZE"], LOCATION = (String)dr["LOCATION"], WEIGHT = (Decimal)dr["WEIGHT"] }; string v_json = (JsonConvert.SerializeObject(dataQuery)); tsconn.save_log("guest", "QueryPLT_01", "192.168.0.19", "電鍍預排查詢:庫位機台 " + v_loc + ",日期 " + v_pdate); Response.Write(v_json); //} } } catch (Exception ex) { //tsconn.save_log("guest", "QueryWires_01", "192.168.0.19", ex.ToString()); Response.Write(ex.ToString()); } finally { cmd.Dispose(); dr.Close(); dr.Dispose(); conn.Close(); conn.Dispose(); } //tsconn.trans_oracle815(Sql_str, "insert"); //Response.Write("Insert success!"); } } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (ts_Fun.chk_verify()) { //Server.Transfer("error.htm"); Response.Redirect("error2.aspx", false); } try { string v_barcode1 = ""; if ((Request.Params["barcode1"] != null)) { v_barcode1 = Request.Params["barcode1"].ToString().Replace("%QP6", "").Replace("\n", "").Replace("\r", "").Substring(0, 6); Sql_str = " SELECT B.BARCODE_1, B.BARCODE_2, B.BBI_SO,B.EMP_NO, TO_CHAR(B.CREATE_DATE,'YY/MM/DD HH24:MI') CREATE_DATE, B.STATUS "; Sql_str += "FROM BBI_SHIP_QUEUE B "; Sql_str += "WHERE SUBSTR(BARCODE_1,0,6) like :v_BARCODE_1 "; Sql_str += "ORDER BY 1 "; //建立連線 //使用web.config conn string OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["jh815"].ConnectionString); conn.Open(); OracleCommand cmd = new OracleCommand(Sql_str, conn); cmd.Parameters.Add(new OracleParameter("v_BARCODE_1", OracleType.VarChar, 100)); cmd.Parameters["v_BARCODE_1"].Value = v_barcode1; OracleDataReader dr = cmd.ExecuteReader(); try { //while (dr.Read()) //{ //組成JSON字串 if (dr.HasRows) { var dataQuery = from d in dr.Cast <DbDataRecord>() select new { BARCODE_1 = (String)dr["BARCODE_1"], BARCODE_2 = (String)dr["BARCODE_2"], PAC_NO = (String)dr["BBI_SO"], EMP_NO = (String)dr["EMP_NO"], CREATE_DATE = (String)dr["CREATE_DATE"] }; string v_json = (JsonConvert.SerializeObject(dataQuery)); tsconn.save_log("guest", "QueryBBIqueue", "192.168.0.19", "查詢BBI條碼:" + v_barcode1); Response.Write(v_json); //} } } catch (Exception ex) { //tsconn.save_log("guest", "QueryWires_01", "192.168.0.19", ex.ToString()); Response.Write(ex.ToString()); } finally { cmd.Dispose(); dr.Close(); dr.Dispose(); conn.Close(); conn.Dispose(); } //tsconn.trans_oracle815(Sql_str, "insert"); //Response.Write("Insert success!"); } } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { try { string v_barcode1 = ""; if ((Request.Params["id"] != null) & (Request.Params["pw"] != null)) { v_id = Request.Params["id"].ToString(); v_pw = Request.Params["pw"].ToString(); Sql_str = " SELECT S.USER_ID, S.USERNAME, S.PASSWORD, "; Sql_str += " S.LOGIN_NAME, S.EMP_NO, S.EMP_NAME, "; Sql_str += " S.DEPT_NO, S.DEPT_NAME "; Sql_str += " FROM EAGLE.SYS_USERS S "; Sql_str += " WHERE USERNAME = :v_ID "; Sql_str += " AND PASSWORD = :v_PW "; //建立連線 //使用web.config conn string OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["jh815"].ConnectionString); conn.Open(); OracleCommand cmd = new OracleCommand(Sql_str, conn); cmd.Parameters.Add(new OracleParameter("v_ID", OracleType.VarChar, 100)); cmd.Parameters["v_ID"].Value = v_id; cmd.Parameters.Add(new OracleParameter("v_PW", OracleType.VarChar, 100)); cmd.Parameters["v_PW"].Value = v_pw; OracleDataReader dr = cmd.ExecuteReader(); try { //while (dr.Read()) //{ //組成JSON字串 if (dr.HasRows) { var dataQuery = from d in dr.Cast <DbDataRecord>() select new { STATUS = "PASS", USERNAME = (String)dr["USERNAME"], EMP_NAME = (String)dr["EMP_NAME"] }; string v_json = (JsonConvert.SerializeObject(dataQuery)); tsconn.save_log("guest", "APP Login", "192.168.0.19", v_json); Response.Write(v_json); //} } else { var dataQuery = new { STATUS = "REJECT", USERNAME = v_id }; string v_json = (JsonConvert.SerializeObject(dataQuery)); tsconn.save_log("guest", "APP Login", "192.168.0.19", v_json); Response.Write(v_json); } } catch (Exception ex) { var dataQuery = new { STATUS = "REJECT", USERNAME = v_id }; string v_json = (JsonConvert.SerializeObject(dataQuery)); tsconn.save_log("guest", "APP Login", "192.168.0.19", v_json); Response.Write(v_json); } finally { cmd.Dispose(); dr.Close(); dr.Dispose(); conn.Close(); conn.Dispose(); } //tsconn.trans_oracle815(Sql_str, "insert"); //Response.Write("Insert success!"); } //else //{ // Response.Write("No data insert!"); //} } catch (Exception ex) { var dataQuery = new { STATUS = "REJECT", USERNAME = v_id }; string v_json = (JsonConvert.SerializeObject(dataQuery)); tsconn.save_log("guest", "APP Login", "192.168.0.19", v_json); Response.Write(v_json); } }
protected void Page_Load(object sender, EventArgs e) { try { string v_ver = ""; if ((Request.Params["version"] != null)) { v_ver = Request.Params["version"].ToString(); //Y = 啟動 , N = 停用 Sql_str = " SELECT TITTLE, CONTENT,VERSION FROM PDA_NOTIFICATION WHERE STATUS = 'Y' AND VERSION > '" + v_ver + "' "; //建立連線 //使用web.config conn string OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["jheip"].ConnectionString); conn.Open(); OracleCommand cmd = new OracleCommand(Sql_str, conn); OracleDataReader dr = cmd.ExecuteReader(); try { //while (dr.Read()) //{ //組成JSON字串 if (dr.HasRows) { var dataQuery = from d in dr.Cast <DbDataRecord>() select new { STATUS = "PASS", TITTLE = (String)dr["TITTLE"], CONTENT = (String)dr["CONTENT"], VERSION = (String)dr["VERSION"] }; string v_json = (JsonConvert.SerializeObject(dataQuery)); //tsconn.save_log("guest", "NOTFICATION PASS", "192.168.0.19", v_json); Response.Write(v_json); //} } } catch (Exception ex) { Response.Write(ex.ToString()); } finally { cmd.Dispose(); dr.Close(); dr.Dispose(); conn.Close(); conn.Dispose(); } } } catch (Exception ex) { var dataQuery = new { STATUS = "REJECT" }; string v_json = (JsonConvert.SerializeObject(dataQuery)); //tsconn.save_log("guest", "NOTFICATION REJECT", "192.168.0.19", v_json); Response.Write(v_json); } }