安睿特接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
5.8 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using XS_BLL;
using XS_DAL;
using XS_Model;
namespace XS_HttpServer_LR
{
public partial class FrmInterfaceFeedback : Form
{
public FrmInterfaceFeedback()
{
InitializeComponent();
dropDownBox();
}
public void init()
{
//this.Controls.Clear();
//this.InitializeComponent();
//this.time_begin.Text = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd HH:mm");
this.time_begin.Text = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00";//.ToString("yyyy-MM-dd HH:mm")
this.time_end.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
}
public void dropDownBox()
{
//DataTable dt = DBOperator.GetTableSql("select DISTINCT INTERFACE_NAME,INTERFACE_MENO from IO_INTERFACE_LOG ORDER BY INTERFACE_MENO");
DataTable dt = DBOperator.GetTableSql("select DISTINCT INTERFACE_MENO from IO_INTERFACE_LOG ORDER BY INTERFACE_MENO");
List<drop> loglist = new List<drop>();
loglist.Add(new drop("", "请选择记录"));
for (int i = 0; i < dt.Rows.Count; i++)
{
//loglist.Add(new drop(dt.Rows[i]["INTERFACE_NAME"].ToString(), dt.Rows[i]["INTERFACE_MENO"].ToString()));
loglist.Add(new drop(dt.Rows[i]["INTERFACE_MENO"].ToString(), dt.Rows[i]["INTERFACE_MENO"].ToString()));
}
comboBox2.DataSource = null;
this.comboBox2.DisplayMember = "c_name";
this.comboBox2.ValueMember = "c_id";
this.comboBox2.DataSource = loglist;
}
private void FrmInterfaceFeedback_Load(object sender, EventArgs e)
{
this.time_begin.Text = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00";//.ToString("yyyy-MM-dd HH:mm")
this.time_end.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
}
private void Btn_query_Click(object sender, EventArgs e)
{
query();
}
/// <summary>
/// 查询
/// </summary>
private void query()
{
DataTable dt = new DataTable();
int[] arrWidth = new int[] { };
dt = InterfaceLogQuery(out arrWidth);
if (dt == null || dt.Rows.Count <= 0)
{
MessageBox.Show("无有效数据。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
dataGridView1.DataSource = dt;
if (dt != null && dt.Rows.Count > 0)
{
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
for (int i = 0; i < arrWidth.Length; i++)
{
dataGridView1.Columns[i].Width = arrWidth[i];
}
}
}
/// <summary>
/// 接口日志查询
/// </summary>
/// <returns></returns>
private DataTable InterfaceLogQuery(out int[] arrWidth)
{
try
{
string stWhere = " 1=1 and INTERFACE_DATETIME BETWEEN '" + this.time_begin.Text + ":00' and '" + this.time_end.Text + ":59'";
string IName = this.comboBox2.SelectedValue.ToString();
switch (IName)
{
case "":
break;
//default: stWhere += $" and INTERFACE_NAME = '{IName}' "; break;
default: stWhere += $" and INTERFACE_MENO = '{IName}' "; break;
}
StringBuilder sb = new StringBuilder();
sb.AppendLine(" select top 3000 ");
sb.AppendLine(" INTERFACE_ID as 顺序编号 ");
sb.AppendLine(" ,INTERFACE_DATETIME as 时间 ,INTERFACE_MENO as 备注信息 ");
sb.AppendLine(" ,INTERFACE_NAME as 接口名称 ,INTERFACE_FLOW as 接口方向 ,INTERFACE_REQUEST as 请求数据 ,INTERFACE_FEEDBACK as 返回数据 ");
sb.AppendLine(" from IO_INTERFACE_LOG ");
sb.AppendLine(" where");
sb.AppendLine(stWhere);
sb.AppendLine(" order by INTERFACE_ID desc ");
DataTable dt = DBOperator.GetTableSql(sb.ToString());
int num = dt.Rows.Count;
arrWidth = new int[] { 80, 160, 200, 200, 100, 400, 400 };
return dt;
}
catch (Exception ex)
{
LogHelper.ErrorLog(ex);
arrWidth = new int[] { };
return new DataTable();
}
}
/// <summary>
/// 双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0)
{
string dec_id = dataGridView1.Rows[e.RowIndex].Cells["顺序编号"].Value.ToString();
InterfaceLog frm = new InterfaceLog(dec_id);
this.Visible = true;
frm.Show();
//frm.ShowDialog();
//this.Visible = true;
}
}
private void Button1_Click(object sender, EventArgs e)
{
init();
}
private void ComboBox1_SelectionChangeCommitted(object sender, EventArgs e)
{
init();
}
}
public class drop
{
public string c_id { get; set; }
public string c_name { get; set; }
public drop(string i, string n)
{
c_name = n;
c_id = i;
}
}
}