ibms-MCUT/z01_WinAPP/fmKeke.cs

86 lines
2.9 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;
using tpDomeWinAPP.Service;
using tpDomeWinAPP.Models;
using System.Linq;
using System.Collections;
using NPOI.SS.Formula.Functions;
namespace z01_WinAPP
{
public partial class fmKeke : Form
{
List<device_value2> ds;
public fmKeke()
{
InitializeComponent();
}
private void fmKeke_Load(object sender, EventArgs e)
{
}
private void splitContainer1_Panel2_Paint(object sender, PaintEventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
loadData_fic();
}
private void loadData_fic()
{
lbMsg.Text = "Loading ...";
// https://green.fic.com.tw:8443/obix/config/
// ObixUser
// Admin123456
webRequestSvc svc = new webRequestSvc();
//local:|foxs:|history:/S02102000101/Inv|view:history:HistoryTable
string url_slot = "history:/S02102000101/Inv|";
string bql = url_slot + "bql:select *";
string obix_url = "https://green.fic.com.tw:8443/obix/histories/S03203000101/Inv/~historyQuery/";
string post_xml = "<obj is=\"obix:HistoryFilter\"><abstime name=\"start\" val=\"2023-06-02T00:00:00.000+08:00\"/><abstime name=\"end\" val=\"2023-06-06T23:59:59.000+08:00\"/><reltime name=\"interval\" val=\"PT15M\" /></obj>";
ds = svc.obixQuery_keke(obix_url, post_xml);
//ds = svc.obixQuery("http://60.251.164.125:8080/obix/config/Arena/Program/ObixQuery/query/", bql);
//ds = svc.obixQuery("http://60.251.164.125:8080/obix/config/Program/ObixQuery/query/", bql);//三菱
//ds = svc.obixQuery("http://192.168.0.136:8081/obix/config/Program/ObixQuery/query/", bql);//wsp
//ds = svc.obixQuery("http://localhost:8080/obix/config/Program/ObixQuery/query/", bql);
//dataGridView1.DataSource = ds;
dataGridView1.Columns[0].Visible = false;
dataGridView1.Columns[1].Width = 400;
dataGridView1.Columns[2].Width = 200;
//lbMsg.Text = "共 " + ds.Count.ToString() + " 筆資料 " + Environment.NewLine + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button1_Click_1(object sender, EventArgs e)
{
string targetTable = "archive_electric_meter_day_202308";
string yyyymm = targetTable.Split('_')[targetTable.Split('_').Length - 1]; //取出 archive_electric_meter_day_202308 的最後一段 202308
string yyyy = yyyymm.Substring(0, 4);
string mm = yyyymm.Remove(0, 4);
}
}
}