using System;
using XXXXXXXXXXXXXXXXXXXXXneric;
using XXXXXXXXXXponentModel;
using System.Data;
using System.Drawing;
using XXXXXXXXXnq;
using System.Text;
using XXXXXXXXXXXXXXXXXrms;
namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//测试电池数据
double jy = 10;
double nz = 20;
double rl = 10;
double dy = 30;
double yc = 30;
bool jyng = false;
bool nzng = false;
bool rlng = false;
bool dyng = false;
bool ycng = false;
//7行5列设置最小值和设置最大值数据初始化
//给数组赋datatable中的值
//档位8行
//设置最大参数5列,设置最小参数5列,1.jy XXXX 3.rl 4.dy 5.yc
//绝缘 内阻 容量 电压 压差
//1行 00 01 02 03 04
//2行 10 11 12 13 14
//3行 20 21 22 23 24
//4行 30 31 32 33 34
//5行 40 41 42 43 44
//6行 50 51 52 53 54
//7行 60 61 62 63 64
//8行 70 71 72 73 74
int[,] numbermax = new int[8, 5] { { 11, 12, 13, 14, 15 },
{ 21, 22, 23, 24, 25 },
{ 31, 32, 33, 34, 35 },
{ 41, 42, 43, 44, 45 },
{ 51, 52, 53, 54, 55 },
{ 61, 62, 63, 64, 65 },
{ 71, 72, 73, 74, 75 },
{ 81, 82, 83, 84, 85 } };
int[,] numbermin = new int[8, 5] { { 1, 2, 3, 4, 5 } ,
{ 11, 12, 13, 14, 15 },
{ 21, 22, 23, 24, 25 },
{ 31, 32, 33, 34, 35 },
{ 41, 42, 43, 44, 45 },
{ 51, 52, 53, 54, 55 },
{ 61, 62, 63, 64, 65 },
{ 71, 72, 73, 74, 75 } };
for(int a=0;a<8;a++)
if (jy < numbermax[a,0] && jy > numbermin[a,0])//第一列
{
if (nz < numbermax[a,1] && nz > numbermin[a,1])//第二列
{
if (rl < numbermax[a,2] && rl > numbermin[a,2 ])//第三列
{
if (dy < numbermax[a,3] && dy > numbermin[a,3])//第四列
{
if (yc < numbermax[a,4] && yc > numbermin[a,4])//第五列
{
//如果第一行五个都满足那么就将此电池置为OK
textBox1.Text = "电池第"+(a+1).ToString()+"档ok";
break;
}
else
{
if (a == 7)
{
textBox1.Text = "电池第8档ng";
}
else
{
ycng = true;
}
}
}
else
{
dyng = true;
}
}
else
{
rlng = true;
}
}
else
{
nzng = true;
}
}
else
{
jyng = true;
}
if (jyng == true) { textBox1.Text = "绝缘ng"; }
if (nzng == true) { textBox1.Text = "内阻ng"; }
if (rlng == true) { textBox1.Text = "容量ng"; }
if (dyng == true) { textBox1.Text = "电压ng"; }
if (ycng == true) { textBox1.Text = "压差ng"; }
}
}
}