电梯调度的设计与实现过程(李帅 张硕)

实现整个调度算法花了好多时间,不过总算完成了,虽然代码不是很规范,因为没有进行类的封装,将所有的代码写在了一个文件之中。原来以为实现这个调度并不算困难,写不了多少行代码,结果越写越多,又不想从头封装类再写,只能不断在原来基础上添加,代码比较繁长,冗余。不过我想整个思路还是有可取之处吧。

 

整个电梯调度可以说分为三大部分,第一部分是电梯的选择,可以算是外部调度,当有楼层发出请求后,选择最快到达的电梯到达发出请求的楼层。如图所示这里除了

底层和顶层外分别设定了两个按键发出上楼或者下楼的请求。这四十个按键几乎是相同的操作。

private void button25_Click(object sender, EventArgs e)
{
    obj = 0;
    flag[obj] = 1;
    button_Click();
}

obj代表发出请求的楼层数;

flag[obj]表示发出的请求是上楼还是下楼(1代表上楼,-1代表下楼);

button_Click();表示调度函数开始进程ele,用来实例化线程ele的start函数是进行电梯的选择的;

public void button_Click()
{
            
    ele = new Thread(new ThreadStart(start));
    ele.Start();

}

 

现在说说整个start函数

  1 public void start()
  2         {
  3             
  4             int min = 22, d;
  5             int select = -1;
  6            
  7             if (floor_num[0, obj] == -1 && floor_num[1, obj] == -1 && floor_num[2, obj] == -1 && floor_num[3, obj] == -1)          //发出请求的楼层未在等待中
  8             {
  9                  for (int i = 0; i < 4; i++)
 10                  {
 11                      ele_flag1[i] = ele_flag[i];
 12                     if (ele_flag[i] == 0)   //电梯停靠
 13                     {
 14 
 15                         d = Math.Abs(obj - num[i]);               //电梯与发出请求的楼层的距离
 16                         //找出最短距离的电梯,将距离最近的电梯号赋给select
 17                         if (min > d)
 18                         {
 19                             min = d;
 20                             select = i;
 21                             if (obj < num[i])
 22                             {
 23                                 ele_flag[i] = -1;
 24                             }
 25                             if (obj > num[i])
 26                             {
 27 
 28                                 ele_flag[i] = 1;
 29                             }
 30                             if (obj == num[i])
 31                             {
 32 
 33                                 ele_flag[i] = 0;
 34                             }
 35                         }
 36 
 37                     }
 38                     if (ele_flag[i] == 1 && flag[obj] == 1)   //电梯向上运行与请求同向
 39                     {
 40                         flag[obj] = 0;
 41                         if (obj >= num[i])
 42                         {
 43                             d = Math.Abs(obj - num[i]);               //电梯与发出请求的楼层的距离
 44                             //找出最短距离的电梯,将距离最近的电梯号赋给select
 45                             if (min > d)
 46                             {
 47 
 48                                 min = d;
 49                                 select = i;
 50                                 ele_flag[i] = 1;
 51                             }
 52                         }
 53                         if (obj < num[i] && min == 22&&i==3)
 54                         {
 55                             Thread.Sleep(1);
 56                             button_Click();
 57                         }
 58 
 59                     }
 60                     if (ele_flag[i] == -1 && flag[obj] == -1)      //电梯下降
 61                     {
 62                         flag[obj] = 0;
 63                         if (obj <= num[i])
 64                         {
 65                             d = Math.Abs(obj - num[i]);               //电梯与发出请求的楼层的距离
 66 
 67                             //找出最短距离的电梯,将距离最近的电梯号赋给select
 68                             if (min > d)
 69                             {
 70                                 min = d;
 71                                 select = i;
 72                                 ele_flag[i] = -1;
 73 
 74                             }
 75                         }
 76                         if (obj > num[i] && min == 22 && i == 3)
 77                         {
 78                             Thread.Sleep(1);
 79                             button_Click();
 80                         }
 81                     }
 82                     if (ele_flag[3] == -flag[3]&&min == 22)
 83                     {
 84                         Thread.Sleep(1);
 85                         button_Click();
 86                     }
 87 
 88                 }
 89                  for (int i = 0; i < 4; i++)
 90                  {
 91                      if (i != select)
 92                      {
 93                          ele_flag[i] = ele_flag1[i];
 94                      }
 95                  } 
 96             }
 97             
 98             if (select == 0)
 99             {
100                 select = -1;
101                 obj_num[0]++;
102                 floor_num[0, obj] = obj;
103                 peopleflag[0, obj] = 1;
104                 if (obj > floortop[0])
105                 {
106                     floortop[0] = obj;
107                 }
108                 if (obj < floorbase[0])
109                 {
110                     floortop[0] = obj;
111                 }
112                     
113                 if (obj_num[0] == 1)
114                 {
115                     elet[0] = new Thread(new ThreadStart(run1));
116                     elet[0].Start();
117                 }
118             }
119             if (select == 1)
120             {
121                 select = -1;
122                 obj_num[1]++;
123                 floor_num[1,obj] = obj;
124                 peopleflag[1, obj] = 1;
125 
126                 if (obj > floortop[1])
127                 {
128                     floortop[1] = obj;
129                 }
130                 if (obj < floorbase[0])
131                 {
132                     floortop[1] = obj;
133                 }
134                 if (obj_num[1] == 1)
135                 {
136                     elet[1] = new Thread(new ThreadStart(run2));
137                     elet[1].Start();
138                 }
139             }
140             if (select == 2)
141             {
142                 select = -1;
143                 obj_num[2]++;
144                 floor_num[2, obj] = obj;
145                 peopleflag[2, obj] = 1;
146                 if (obj > floortop[2])
147                 {
148                     floortop[2] = obj;
149                 }
150                 if (obj < floorbase[2])
151                 {
152                     floortop[2] = obj;
153                 }
154                 if (obj_num[2] == 1)
155                 {
156                     elet[2] = new Thread(new ThreadStart(run3));
157                     elet[2].Start();
158                 }
159             }
160             if (select == 3)
161             {
162                 select = -1;
163                 obj_num[3]++;
164                 floor_num[3, obj] = obj;
165                 peopleflag[3, obj] = 1;
166                 if (obj > floortop[3])
167                 {
168                     floortop[3] = obj;
169                 }
170                 if (obj < floorbase[3])
171                 {
172                     floortop[3] = obj;
173                 }
174                 if (obj_num[3] == 1)
175                 {
176                     elet[3] = new Thread(new ThreadStart(run4));
177                     elet[3].Start();
178                 }
179             }
180 
181           
182         }
start

这是利用循环进行比较,每一次循环大体比较三次,第一次比较停靠电梯,第二三次比较方向相同的,如果循环完成都没有则沉睡1毫秒再次循环寻找。找到合适的电梯后进行调用。首先解决的的问题是如何比较,低一些的算法少比较了好多情况,经过讨论确定这种算法情况比较全面。但依然出了问题其中会出现电梯位置与请求位置的比较,造成电梯运行方向的不同。解决了这些问题才有了现在的算法。

 

然后就是电梯的运行移动了代码如下:

 1  public void run1()
 2         {
 3 
 4 
 5             int x = 0;
 6             int y = ele_flag[0] * 2550;
 7             int i = num[0];
 8            
 9             while (obj_num[0] > 0 && ele_flag[0] != 0&&i<21)
10             {
11                
12 
13                 i = i + ele_flag[0];
14                 num[0] = i;
15                 lab[0].BackColor = Color.Green;
16                 Thread.Sleep(1000);
17 
18                 lab[0].Text = fnum[i];
19                 lab[0].Location = new Point(lab[0].Location.X + x / 100, lab[0].Location.Y - y / 100);
20 
21                 label1.Refresh();
22                 
23                 if (floor_num[0,i] == i&&(peopleflag[0, i]+peopleflag1[0]) != 2)
24                 {
25                     num[0] = i;
26                     lab[0].BackColor = Color.Red;
27                     floor_num[0,i] = -1;
28                     obj_num[0]--;
29 
30 
31                     if (obj_num[0] != 0)
32                     {
33                         Thread.Sleep(5000);
34                     }
35                   
36 
37                 }
38                 if ((i == floortop[0] || i == floorbase[0]||i==20||i==0) && obj_num[0] != 0)
39                 {
40                     ele_flag[0] = -ele_flag[0];
41                     y = ele_flag[0] * 2550;
42 
43                 }
44                 if (obj_num[0] == 0)
45                 {
46                     ele_flag[0] = 0;
47                     elet[0].Abort();
48                 }
49             }
50 
51 
52         }
run1

这里面遇到的问题是最多的,首先就是电梯会有上下移动,方向不同,一开始用两个循环分别进行上和下的运行,这样太过繁琐,然后行到了可以利用取反来使用一个循环。解决这个问题之后又出现了新的问题

,因为刚开始写的是一个run函数大家共同调用它,结果发现无动态,利用百度添加委托事件之后,虽然试验能移动,但移动的却只有一部电梯,并且是将两部的动态显示在一部之上,查看函数发现在移动时是用编号对变量赋值,这样在上一个运行的线程中变量值同样被改变,不得已对四部电梯分别写了四个相同的函数,然后在start中选择调用。问题接踵而来,在运行时会有数组超过界限问题,经过调试发现是没有运行终点的原因,所以添加了floorbase[]和floortop[]两个变量,赋予电梯所要到达的最低和最高楼层。电梯调度才顺利实行。这花去了很多的时间,但这是最主要的调度,只要完成距离完全实现也就不远了

 

 

然后两人分别写了电梯的内部调度和重量人数的主要算法

内部调度 同样是一个button事件来进行调度,完成两点就行,一是将发出请求的楼层标记,二是与要到达的最低最高楼层比较

 1 public void inside_start()
 2         {
 3             if (floor_num[floor, floory] < floorbase[floor] && floor_num[floor, floory] >= 0)
 4             {
 5                 floorbase[floor] = floor_num[floor, floory];
 6             }
 7             if (floortop[floor] < floor_num[floor, floory])
 8             {
 9                 floortop[floor] = floor_num[floor, floory];
10             }
11             if (floor_num[floor, floory] > num[floor] && ele_flag[floor] == 0)
12             {
13                 ele_flag[floor] = 1;
14             }
15             if (floor_num[floor, floory] < num[floor]&&ele_flag[floor] == 0)
16             {
17                 ele_flag[floor] = -1;
18             }
19             if (floor_num[floor, floory] == num[floor]&&ele_flag[floor] == 0)
20             {
21                 ele_flag[floor] = 0;
22             }
23             if (floor == 0 && obj_num[0] == 1)
24             {
25                 elet[0] = new Thread(new ThreadStart(run1));
26                 elet[0].Start();
27             }
28             if (floor == 1 && obj_num[1] == 1)
29             {
30                 elet[1] = new Thread(new ThreadStart(run2));
31                 elet[1].Start();
32             }
33             if (floor == 2&&obj_num[2]==1)
34             {
35                 elet[2] = new Thread(new ThreadStart(run3));
36                 elet[2].Start();
37             }
38             if (floor == 3 && obj_num[3]==1)
39             {
40                 elet[3] = new Thread(new ThreadStart(run4));
41                 elet[3].Start();
42             }
43            
44         }
inside_start

关于重量和人数的限制也不是很困难,完成加减法,未解决的问题就是如何在输入一次后清空输入,能实现的是初始化为0,利用backspace会出现输入错误

 1 private void button68_Click(object sender, EventArgs e)
 2         {
 3             peoplenow[3] = double.Parse(textBox20.Text) + peoplein[3] - peopleout[3];
 4             textBox20.Text = peoplenow[3] + "";
 5             weightnow[3] = double.Parse(textBox14.Text) + weightadd[3]-weightdel[3];
 6             textBox14.Text = weightnow[3] + "";
 7             if (peoplenow[3] >= 20 || weightnow[3] >= 1600)
 8             {
 9                 peopleflag1[3] = 1;
10                 textBox14.Text = 1600 + "";
11                 textBox20.Text = 20 + "";
12             }
13             else
14             {
15                 peopleflag1[3] = 0;
16                
17 
18             }
19             textBox12.Text = 0+"";
20             textBox13.Text =0+ "";
21             textBox15.Text = 0+"";
22             textBox24.Text = 0 + "";
23         }
people

最后一点问题就是,如何使在人数重量超过限制之后不在外部的请求下停下,这是整合时要注意的,同样想到的是标志,利用内外标志,内部请求的标为0,外部的标为1,当超过限制时同样设一个标志为1,在同为1的情况下电梯不停下。当然遇到许多其它问题,就不多提了

下面附带代码和部分截图:

来5人400kg,在四楼按电梯

   1 using System;
   2 using System.Collections.Generic;
   3 using System.ComponentModel;
   4 using System.Data;
   5 using System.Drawing;
   6 using System.Linq;
   7 using System.Text;
   8 using System.Threading.Tasks;
   9 using System.Windows.Forms;
  10 using System.Threading;
  11 using System.Windows;
  12 namespace lift2
  13 {
  14     public partial class lift : Form
  15     {
  16         Label[] lab = new Label[4];
  17        
  18         int[] flag = new int[21]{0,0,0,0,0,                  //请求上下楼的标志  初始:0  上楼:1   下楼:-1  
  19                                0,0,0,0,0,
  20                                0,0,0,0,0,
  21                                0,0,0,0,0,0};
  22         int[] ele_flag = new int[4] { 0, 0, 0, 0 };          //电梯运行标志  初始:0  向上:1   向下:-1
  23         int[] ele_flag1 = new int[4] { 0, 0, 0, 0 }; 
  24         int floor=0,floory=0;                                     
  25         int[] num = new int[4] { 0, 0, 0, 0 };               //电梯所在楼层
  26         int[] floortop = new int[4] { -1,-1,-1,-1};  //要到达的最高楼层
  27         int[] floorbase = new int[4] { -1,-1,-1,-1};  //要到达的最低楼层
  28         int obj;                                        //中间变量发出请求的楼层
  29         int[] obj_num = new int[4] { 0, 0, 0, 0 };                       //发出请求的楼层个数
  30         int[ ,] floor_num = new int[4,21];                  //电梯所要到达的楼层
  31         int[ ,] peopleflag=new int[4,21];
  32         int[] peopleflag1 = new int[4]{0,0,0,0};
  33         Thread[] elet=new Thread[4];                     //四部电梯运行的线程实例
  34         Thread ele,eleinside;                                     //外部调度的现成实例
  35         string[] fnum = new string[21]{
  36                                 "第0层","第1层","第2层","第3层","第4层","第5层",
  37                                 "第6层","第7层","第8层","第9层","第10层","第11层",
  38                                 "第12层","第13层","第14层","第15层","第16层","第17层",
  39                                 "第18层","第19层","第20层"};
  40         double[]weightnow=new double[4]{0,0,0,0};
  41         double[] weightadd = new double[4] { 0, 0, 0, 0 };
  42         double[] peoplein = new double[4] { 0, 0, 0, 0 };
  43         double[] peopleout = new double[4] { 0, 0, 0, 0 };
  44         double[] peoplenow = new double[4] { 0, 0, 0, 0 };
  45         double[] weightdel = new double[4] { 0, 0, 0, 0 };
  46         public lift()
  47         {
  48             InitializeComponent();
  49             Control.CheckForIllegalCrossThreadCalls = false;
  50             lab[0] = label49;
  51             lab[1] = label50;
  52             lab[2] = label51;
  53             lab[3] = label52;
  54             button69.BackColor = Color.Blue;
  55             textBox1.Text = 0 + "";
  56             textBox2.Text = 0 + "";
  57             textBox3.Text = 0 + "";
  58             textBox4.Text = 0 + "";
  59             textBox5.Text = 0 + "";
  60             textBox6.Text = 0 + "";
  61             textBox7.Text = 0 + "";
  62             textBox8.Text = 0 + "";
  63             textBox9.Text = 0 + "";
  64             textBox10.Text = 0 + "";
  65             textBox11.Text = 0 + "";
  66             textBox12.Text = 0 + "";
  67             textBox13.Text = 0 + "";
  68             textBox14.Text = 0 + "";
  69             textBox15.Text = 0 + "";
  70             textBox16.Text = 0 + "";
  71             textBox17.Text = 0 + "";
  72             textBox18.Text = 0 + "";
  73             textBox19.Text = 0 + "";
  74             textBox20.Text = 0 + "";
  75             textBox21.Text = 0 + "";
  76             textBox22.Text = 0 + "";
  77             textBox23.Text = 0 + "";
  78             textBox24.Text = 0 + "";
  79             
  80      
  81             for (int i = 0; i < 4; i++)
  82             {
  83                 lab[i].Text = fnum[num[i]];      //初始化显示电梯所在的层数
  84 
  85                 lab[i].BackColor = Color.Red;
  86             }
  87             for (int i = 0; i < 4; i++)
  88                 for (int j=0; j < 21;j++ )//将要到达的所有楼层初始化为-1,代表没有要达到的楼层
  89                 {
  90                     floor_num[i,j] = -1;
  91                     peopleflag[i, j] = 0;
  92 
  93                 }
  94         }
  95         //  委托事件及各个线程
  96         private delegate void setText();
  97         private delegate void setText1();
  98         private delegate void setText2();
  99         private delegate void setText3();
 100         private delegate void setText4();
 101         private delegate void setText5();
 102         private delegate void setText6();
 103         private delegate void setText7();
 104         public void Threadp()
 105         {
 106             setText d = new setText(start);
 107             this.Invoke(d);
 108 
 109         }
 110         public void inside_start()
 111         {
 112             if (floor_num[floor, floory] < floorbase[floor] && floor_num[floor, floory] >= 0)
 113             {
 114                 floorbase[floor] = floor_num[floor, floory];
 115             }
 116             if (floortop[floor] < floor_num[floor, floory])
 117             {
 118                 floortop[floor] = floor_num[floor, floory];
 119             }
 120             if (floor_num[floor, floory] > num[floor] && ele_flag[floor] == 0)
 121             {
 122                 ele_flag[floor] = 1;
 123             }
 124             if (floor_num[floor, floory] < num[floor]&&ele_flag[floor] == 0)
 125             {
 126                 ele_flag[floor] = -1;
 127             }
 128             if (floor_num[floor, floory] == num[floor]&&ele_flag[floor] == 0)
 129             {
 130                 ele_flag[floor] = 0;
 131             }
 132             if (floor == 0 && obj_num[0] == 1)
 133             {
 134                 elet[0] = new Thread(new ThreadStart(run1));
 135                 elet[0].Start();
 136             }
 137             if (floor == 1 && obj_num[1] == 1)
 138             {
 139                 elet[1] = new Thread(new ThreadStart(run2));
 140                 elet[1].Start();
 141             }
 142             if (floor == 2&&obj_num[2]==1)
 143             {
 144                 elet[2] = new Thread(new ThreadStart(run3));
 145                 elet[2].Start();
 146             }
 147             if (floor == 3 && obj_num[3]==1)
 148             {
 149                 elet[3] = new Thread(new ThreadStart(run4));
 150                 elet[3].Start();
 151             }
 152            
 153         }
 154         public void start()
 155         {
 156             
 157             int min = 22, d;
 158             int select = -1;
 159            
 160             if (floor_num[0, obj] == -1 && floor_num[1, obj] == -1 && floor_num[2, obj] == -1 && floor_num[3, obj] == -1)          //发出请求的楼层未在等待中
 161             {
 162                  for (int i = 0; i < 4; i++)
 163                  {
 164                      ele_flag1[i] = ele_flag[i];
 165                     if (ele_flag[i] == 0)   //电梯停靠
 166                     {
 167 
 168                         d = Math.Abs(obj - num[i]);               //电梯与发出请求的楼层的距离
 169                         //找出最短距离的电梯,将距离最近的电梯号赋给select
 170                         if (min > d)
 171                         {
 172                             min = d;
 173                             select = i;
 174                             if (obj < num[i])
 175                             {
 176                                 ele_flag[i] = -1;
 177                             }
 178                             if (obj > num[i])
 179                             {
 180 
 181                                 ele_flag[i] = 1;
 182                             }
 183                             if (obj == num[i])
 184                             {
 185 
 186                                 ele_flag[i] = 0;
 187                             }
 188                         }
 189 
 190                     }
 191                     if (ele_flag[i] == 1 && flag[obj] == 1)   //电梯向上运行与请求同向
 192                     {
 193                         flag[obj] = 0;
 194                         if (obj >= num[i])
 195                         {
 196                             d = Math.Abs(obj - num[i]);               //电梯与发出请求的楼层的距离
 197                             //找出最短距离的电梯,将距离最近的电梯号赋给select
 198                             if (min > d)
 199                             {
 200 
 201                                 min = d;
 202                                 select = i;
 203                                 ele_flag[i] = 1;
 204                             }
 205                         }
 206                         if (obj < num[i] && min == 22&&i==3)
 207                         {
 208                             Thread.Sleep(1);
 209                             button_Click();
 210                         }
 211 
 212                     }
 213                     if (ele_flag[i] == -1 && flag[obj] == -1)      //电梯下降
 214                     {
 215                         flag[obj] = 0;
 216                         if (obj <= num[i])
 217                         {
 218                             d = Math.Abs(obj - num[i]);               //电梯与发出请求的楼层的距离
 219 
 220                             //找出最短距离的电梯,将距离最近的电梯号赋给select
 221                             if (min > d)
 222                             {
 223                                 min = d;
 224                                 select = i;
 225                                 ele_flag[i] = -1;
 226 
 227                             }
 228                         }
 229                         if (obj > num[i] && min == 22 && i == 3)
 230                         {
 231                             Thread.Sleep(1);
 232                             button_Click();
 233                         }
 234                     }
 235                     if (ele_flag[3] == -flag[3]&&min == 22)
 236                     {
 237                         Thread.Sleep(1);
 238                         button_Click();
 239                     }
 240 
 241                 }
 242                  for (int i = 0; i < 4; i++)
 243                  {
 244                      if (i != select)
 245                      {
 246                          ele_flag[i] = ele_flag1[i];
 247                      }
 248                  } 
 249             }
 250             
 251             if (select == 0)
 252             {
 253                 select = -1;
 254                 obj_num[0]++;
 255                 floor_num[0, obj] = obj;
 256                 peopleflag[0, obj] = 1;
 257                 if (obj > floortop[0])
 258                 {
 259                     floortop[0] = obj;
 260                 }
 261                 if (obj < floorbase[0])
 262                 {
 263                     floortop[0] = obj;
 264                 }
 265                     
 266                 if (obj_num[0] == 1)
 267                 {
 268                     elet[0] = new Thread(new ThreadStart(run1));
 269                     elet[0].Start();
 270                 }
 271             }
 272             if (select == 1)
 273             {
 274                 select = -1;
 275                 obj_num[1]++;
 276                 floor_num[1,obj] = obj;
 277                 peopleflag[1, obj] = 1;
 278 
 279                 if (obj > floortop[1])
 280                 {
 281                     floortop[1] = obj;
 282                 }
 283                 if (obj < floorbase[1])
 284                 {
 285                     floortop[1] = obj;
 286                 }
 287                 if (obj_num[1] == 1)
 288                 {
 289                     elet[1] = new Thread(new ThreadStart(run2));
 290                     elet[1].Start();
 291                 }
 292             }
 293             if (select == 2)
 294             {
 295                 select = -1;
 296                 obj_num[2]++;
 297                 floor_num[2, obj] = obj;
 298                 peopleflag[2, obj] = 1;
 299                 if (obj > floortop[2])
 300                 {
 301                     floortop[2] = obj;
 302                 }
 303                 if (obj < floorbase[2])
 304                 {
 305                     floortop[2] = obj;
 306                 }
 307                 if (obj_num[2] == 1)
 308                 {
 309                     elet[2] = new Thread(new ThreadStart(run3));
 310                     elet[2].Start();
 311                 }
 312             }
 313             if (select == 3)
 314             {
 315                 select = -1;
 316                 obj_num[3]++;
 317                 floor_num[3, obj] = obj;
 318                 peopleflag[3, obj] = 1;
 319                 if (obj > floortop[3])
 320                 {
 321                     floortop[3] = obj;
 322                 }
 323                 if (obj < floorbase[3])
 324                 {
 325                     floortop[3] = obj;
 326                 }
 327                 if (obj_num[3] == 1)
 328                 {
 329                     elet[3] = new Thread(new ThreadStart(run4));
 330                     elet[3].Start();
 331                 }
 332             }
 333 
 334           
 335         }
 336         public void Threadp1()
 337         {
 338             setText1 d = new setText1(run1);
 339             this.Invoke(d);
 340 
 341         }
 342         public void run1()
 343         {
 344 
 345 
 346             int x = 0;
 347             int y = ele_flag[0] * 2550;
 348             int i = num[0];
 349            
 350             while (obj_num[0] > 0 && ele_flag[0] != 0&&i<21)
 351             {
 352                
 353 
 354                 i = i + ele_flag[0];
 355                 num[0] = i;
 356                 lab[0].BackColor = Color.Green;
 357                 Thread.Sleep(1000);
 358 
 359                 lab[0].Text = fnum[i];
 360                 lab[0].Location = new Point(lab[0].Location.X + x / 100, lab[0].Location.Y - y / 100);
 361 
 362                 label1.Refresh();
 363                 
 364                 if (floor_num[0,i] == i&&(peopleflag[0, i]+peopleflag1[0]) != 2)
 365                 {
 366                     num[0] = i;
 367                     lab[0].BackColor = Color.Red;
 368                     floor_num[0,i] = -1;
 369                     obj_num[0]--;
 370 
 371 
 372                     if (obj_num[0] != 0)
 373                     {
 374                         Thread.Sleep(5000);
 375                     }
 376                   
 377 
 378                 }
 379                 if ((i == floortop[0] || i == floorbase[0]||i==20||i==0) && obj_num[0] != 0)
 380                 {
 381                     ele_flag[0] = -ele_flag[0];
 382                     y = ele_flag[0] * 2550;
 383 
 384                 }
 385                 if (obj_num[0] == 0)
 386                 {
 387                     ele_flag[0] = 0;
 388                     elet[0].Abort();
 389                 }
 390             }
 391 
 392 
 393         }
 394         public void Threadp2()
 395         {
 396             setText2 d = new setText2(run2);
 397             this.Invoke(d);
 398 
 399         }
 400 
 401         public void run2()
 402         {
 403 
 404             int x = 0;
 405             int y = ele_flag[1] * 2550;
 406             int i = num[1];
 407           
 408             while (obj_num[1] > 0 && ele_flag[1] != 0)
 409             {
 410 
 411                 i = i + ele_flag[1];
 412                 num[1] = i;
 413                 lab[1].BackColor = Color.Green;
 414 
 415                 Thread.Sleep(1000);
 416                 lab[1].Text = fnum[i];
 417                 lab[1].Location = new Point(lab[1].Location.X + x / 100, lab[1].Location.Y - y / 100);
 418 
 419                 label2.Refresh();
 420 
 421                 if (floor_num[1, i] == i && (peopleflag[1, i] + peopleflag1[1]) != 2)
 422                 {
 423 
 424                     lab[1].BackColor = Color.Red;
 425                     floor_num[1,i] = -1;
 426                     obj_num[1]--;
 427                     if (obj_num[01] != 0)
 428                     {
 429                         Thread.Sleep(5000);
 430                     }
 431                     
 432                    
 433 
 434                 }
 435                 if ((i == floortop[1] || i == floorbase[1]) && obj_num[1] != 0)
 436                 {
 437                     ele_flag[1] = -ele_flag[1];
 438                     y = ele_flag[1] * 2550;
 439 
 440                 }
 441                 if (obj_num[1] == 0)
 442                 {
 443                     ele_flag[1] = 0;
 444                     elet[1].Abort();
 445                 }
 446 
 447             }
 448 
 449 
 450         }
 451         public void Threadp3()
 452         {
 453             setText3 f = new setText3(run3);
 454             this.Invoke(f);
 455 
 456         }
 457 
 458         public void run3()
 459         {
 460 
 461 
 462             int x = 0;
 463             int y = ele_flag[2] * 2550;
 464             int i = num[2];
 465             
 466             while (obj_num[2] > 0 && ele_flag[2] != 0)
 467             {
 468 
 469                 i = i + ele_flag[2];
 470                 num[2] = i;
 471                 lab[2].BackColor = Color.Green;
 472 
 473                 Thread.Sleep(1000);
 474                 lab[2].Text = fnum[i];
 475                 lab[2].Location = new Point(lab[2].Location.X + x / 100, lab[2].Location.Y - y / 100);
 476 
 477                 label3.Refresh();
 478 
 479                 if (floor_num[2, i] == i&&(peopleflag[2, i] + peopleflag1[2]) != 2)
 480                 {
 481 
 482                     lab[2].BackColor = Color.Red;
 483                     floor_num[2,i] = -1;
 484                     obj_num[2]--;
 485                     if (obj_num[2] != 0)
 486                     {
 487                         Thread.Sleep(5000);
 488                     }
 489                     
 490 
 491                 }
 492                 if ((i == floortop[2] || i == floorbase[2]) && obj_num[2] != 0)
 493                 {
 494                     ele_flag[2] = -ele_flag[2];
 495                     y = ele_flag[2] * 2550;
 496 
 497                 }
 498                 if (obj_num[2] == 0)
 499                 {
 500                     ele_flag[2] = 0;
 501                     elet[2].Abort();
 502                 }
 503 
 504             }
 505 
 506 
 507         }
 508         public void Threadp4()
 509         {
 510             setText4 d = new setText4(run4);
 511             this.Invoke(d);
 512 
 513         }
 514 
 515         public void run4()
 516         {
 517 
 518 
 519             int x = 0;
 520             int y = ele_flag[3] * 2550;
 521             int i = num[3];
 522             
 523             while (obj_num[3] > 0 && ele_flag[3] != 0)
 524             {
 525 
 526                 i = i + ele_flag[3];
 527                 num[3] = i;
 528                 lab[3].BackColor = Color.Green;
 529 
 530                 Thread.Sleep(1000);
 531                 lab[3].Text = fnum[i];
 532                 lab[3].Location = new Point(lab[3].Location.X + x / 100, lab[3].Location.Y - y / 100);
 533 
 534                 label4.Refresh();
 535 
 536                 if (floor_num[3, i] == i && (peopleflag[3,i] + peopleflag1[3]) != 2)
 537                 {
 538 
 539                     lab[3].BackColor = Color.Red;
 540                     floor_num[3,i] = -1;
 541                     obj_num[3]--;
 542                     if (obj_num[3] != 0)
 543                     {
 544                         Thread.Sleep(5000);
 545                     }
 546                    
 547                     
 548 
 549                 }
 550                 if ((i == floortop[3] || i == floorbase[3]) && obj_num[3] != 0)
 551                 {
 552                     ele_flag[3] = -ele_flag[3];
 553                     y = ele_flag[3] * 2550;
 554 
 555                 }
 556                 if (obj_num[3] == 0)
 557                 {
 558                     ele_flag[3] = 0;
 559                     elet[3].Abort();
 560 
 561                 }
 562 
 563             }
 564 
 565 
 566         }
 567         public void Threadp5()
 568         {
 569             setText d = new setText(button_Click);
 570             this.Invoke(d);
 571 
 572         }
 573         public void Threadp6()
 574         {
 575             setText d = new setText(button_inside);
 576             this.Invoke(d);
 577 
 578         }
 579         public void button_Click()
 580         {
 581             
 582             ele = new Thread(new ThreadStart(start));
 583             ele.Start();
 584 
 585         }
 586         public void Threadp7()
 587         {
 588             setText d = new setText(inside_start);
 589             this.Invoke(d);
 590 
 591         }
 592         public void button_inside()
 593         {
 594             eleinside = new Thread(new ThreadStart(inside_start));
 595             eleinside.Start();
 596         }
 597 
 598         private void button1_Click(object sender, EventArgs e)
 599         {
 600 
 601         }
 602 
 603         private void button2_Click(object sender, EventArgs e)
 604         {
 605 
 606         }
 607 
 608         private void button3_Click(object sender, EventArgs e)
 609         {
 610 
 611         }
 612 
 613         private void button4_Click(object sender, EventArgs e)
 614         {
 615             if (floor_num[floor, 0] == -1)
 616             {
 617                 floory = floor_num[floor, 0] = 0;
 618                 peopleflag[floor, 0] = 0;
 619                 obj_num[floor]++;
 620                 button_inside();
 621             }
 622             else
 623             {
 624                 peopleflag[floor, 0] = 0;
 625             }
 626         }
 627 
 628         private void button5_Click(object sender, EventArgs e)
 629         {
 630             if (floor_num[floor, 1] == -1)
 631             {
 632                 floory = floor_num[floor, 1] = 1;
 633                 peopleflag[floor, 1] = 0;
 634                 obj_num[floor]++;
 635                 button_inside();
 636             }
 637             else
 638             {
 639                 peopleflag[floor, 1] = 0;
 640             }
 641         }
 642 
 643         private void button6_Click(object sender, EventArgs e)
 644         {
 645             if (floor_num[floor, 2] == -1)
 646             {
 647                 floory = floor_num[floor, 2] = 2;
 648                 peopleflag[floor, 2] = 0;
 649                 obj_num[floor]++;
 650                 button_inside();
 651             }
 652             else
 653             {
 654                 peopleflag[floor, 2] = 0;
 655             }
 656         }
 657 
 658         private void button7_Click(object sender, EventArgs e)
 659         {
 660             if (floor_num[floor, 3] == -1)
 661             {
 662                 floory = floor_num[floor, 3] = 3;
 663                 peopleflag[floor, 3] = 0;
 664                 obj_num[floor]++;
 665                 button_inside();
 666             }
 667             else
 668             {
 669                 peopleflag[floor, 3] = 0;
 670             }
 671         }
 672 
 673         private void button8_Click(object sender, EventArgs e)
 674         {
 675             if (floor_num[floor, 4] == -1)
 676             {
 677                 floory = floor_num[floor, 4] = 4;
 678                 peopleflag[floor, 4] = 0;
 679                 obj_num[floor]++;
 680                 button_inside();
 681             }
 682             else
 683             {
 684                 peopleflag[floor, 4] = 0;
 685             }
 686         }
 687 
 688         private void button9_Click(object sender, EventArgs e)
 689         {
 690             if (floor_num[floor, 5] == -1)
 691             {
 692                 floory = floor_num[floor, 5] = 5;
 693                 peopleflag[floor, 5] = 0;
 694                 obj_num[floor]++;
 695                 button_inside();
 696             }
 697             else
 698             {
 699                 peopleflag[floor, 5] = 0;
 700             }
 701         }
 702 
 703         private void button10_Click(object sender, EventArgs e)
 704         {
 705             if (floor_num[floor, 6] == -1)
 706             {
 707                 floory = floor_num[floor, 6] = 6;
 708                 peopleflag[floor, 6] = 0;
 709                 obj_num[floor]++;
 710                 button_inside();
 711             }
 712             else
 713             {
 714                 peopleflag[floor, 6] = 0;
 715             }
 716         }
 717 
 718         private void button11_Click(object sender, EventArgs e)
 719         {
 720             if (floor_num[floor, 7] == -1)
 721             {
 722                 floory = floor_num[floor, 7] = 7;
 723                 peopleflag[floor, 7] = 0;
 724                 obj_num[floor]++;
 725                 button_inside();
 726             }
 727             else
 728             {
 729                 peopleflag[floor, 7] = 0;
 730             }
 731         }
 732 
 733         private void button12_Click(object sender, EventArgs e)
 734         {
 735             if (floor_num[floor, 8] == -1)
 736             {
 737                 floory = floor_num[floor, 8] = 8;
 738                 peopleflag[floor, 8] = 0;
 739                 obj_num[floor]++;
 740                 button_inside();
 741             }
 742             else
 743             {
 744                 peopleflag[floor, 8] = 0;
 745             }
 746         }
 747 
 748         private void button13_Click(object sender, EventArgs e)
 749         {
 750             if (floor_num[floor, 9] == -1)
 751             {
 752                 floory = floor_num[floor, 9] = 9;
 753                 peopleflag[floor, 9] = 0;
 754                 obj_num[floor]++;
 755                 button_inside();
 756             }
 757             else
 758             {
 759                 peopleflag[floor, 9] = 0;
 760             }
 761         }
 762 
 763         private void button14_Click(object sender, EventArgs e)
 764         {
 765             if (floor_num[floor, 10] == -1)
 766             {
 767                 floory = floor_num[floor, 10] = 10;
 768                 peopleflag[floor, 10] = 0;
 769                 obj_num[floor]++;
 770                 button_inside();
 771             }
 772             else
 773             {
 774                 peopleflag[floor, 10] = 0;
 775             }
 776         }
 777 
 778         private void button15_Click(object sender, EventArgs e)
 779         {
 780             if (floor_num[floor, 11] == -1)
 781             {
 782                 floory = floor_num[floor, 11] = 11;
 783                 peopleflag[floor, 11] = 0;
 784                 obj_num[floor]++;
 785                 button_inside();
 786             }
 787             else
 788             {
 789                 peopleflag[floor, 11] = 0;
 790             }
 791         }
 792 
 793         private void button16_Click(object sender, EventArgs e)
 794         {
 795             if (floor_num[floor, 12] == -1)
 796             {
 797                 floory = floor_num[floor, 12] = 12;
 798                 peopleflag[floor, 12] = 0;
 799                 obj_num[floor]++;
 800                 button_inside();
 801             }
 802             else
 803             {
 804                 peopleflag[floor, 12] = 0;
 805             }
 806         }
 807 
 808         private void button17_Click(object sender, EventArgs e)
 809         {
 810             if (floor_num[floor, 13] == -1)
 811             {
 812                 floory = floor_num[floor, 13] = 13;
 813                 peopleflag[floor, 13] = 0;
 814                 obj_num[floor]++;
 815                 button_inside();
 816             }
 817             else
 818             {
 819                 peopleflag[floor, 13] = 0;
 820             }
 821         }
 822 
 823         private void button18_Click(object sender, EventArgs e)
 824         {
 825             if (floor_num[floor, 14] == -1)
 826             {
 827                 floory = floor_num[floor, 14] = 14;
 828                 peopleflag[floor, 14] = 0;
 829                 obj_num[floor]++;
 830                 button_inside();
 831             }
 832             else
 833             {
 834                 peopleflag[floor, 14] = 0;
 835             }
 836         }
 837 
 838         private void button19_Click(object sender, EventArgs e)
 839         {
 840             if (floor_num[floor, 15] == -1)
 841             {
 842                 floory = floor_num[floor, 15] = 15;
 843                 peopleflag[floor, 15] = 0;
 844                 obj_num[floor]++;
 845                 button_inside();
 846             }
 847             else
 848             {
 849                 peopleflag[floor, 15] = 0;
 850             }
 851 
 852         }
 853         private void button20_Click(object sender, EventArgs e)
 854         {
 855             if (floor_num[floor, 16] == -1)
 856             {
 857                 floory = floor_num[floor, 16] = 16;
 858                 peopleflag[floor, 16] = 0;
 859                 obj_num[floor]++;
 860                 button_inside();
 861             }
 862             else
 863             {
 864                 peopleflag[floor, 16] = 0;
 865             }
 866         }
 867       
 868         private void button21_Click(object sender, EventArgs e)
 869         {
 870             if (floor_num[floor, 17] == -1)
 871             {
 872                 floory = floor_num[floor, 17] = 17;
 873                 peopleflag[floor, 17] = 0;
 874                 obj_num[floor]++;
 875                 button_inside();
 876             }
 877             else
 878             {
 879                 peopleflag[floor, 17] = 0;
 880             }
 881         }
 882 
 883         private void button22_Click(object sender, EventArgs e)
 884         {
 885             if (floor_num[floor, 18] == -1)
 886             {
 887                 floory = floor_num[floor, 18] = 18;
 888                 peopleflag[floor, 18] = 0;
 889                 obj_num[floor]++;
 890                 button_inside();
 891             }
 892             else
 893             {
 894                 peopleflag[floor, 18] = 0;
 895             }
 896         }
 897 
 898         private void button23_Click(object sender, EventArgs e)
 899         {
 900             if (floor_num[floor, 19] == -1)
 901             {
 902                 floory = floor_num[floor, 19] = 19;
 903                 peopleflag[floor, 19] = 0;
 904                 obj_num[floor]++;
 905                 button_inside();
 906             }
 907             else
 908             {
 909                 peopleflag[floor, 19] = 0;
 910             }
 911         }
 912 
 913         private void button24_Click(object sender, EventArgs e)
 914         {
 915             if (floor_num[floor, 20] == -1)
 916             {
 917                 floory = floor_num[floor, 20] = 20;
 918                 peopleflag[floor, 20] = 0;
 919                 obj_num[floor]++;
 920                 button_inside();
 921             }
 922             else
 923             {
 924                 peopleflag[floor, 20] = 0;
 925             }
 926         }
 927 
 928         private void button25_Click(object sender, EventArgs e)
 929         {
 930             obj = 0;
 931             flag[obj] = 1;
 932             button_Click();
 933         }
 934 
 935         private void button26_Click(object sender, EventArgs e)
 936         {
 937             obj = 1;
 938             flag[obj] = 1;
 939             button_Click();
 940         }
 941 
 942         private void button27_Click(object sender, EventArgs e)
 943         {
 944             obj = 2;
 945             flag[obj] = 1;
 946             button_Click();
 947         }
 948 
 949         private void button28_Click(object sender, EventArgs e)
 950         {
 951             obj = 3;
 952             flag[obj] = 1;
 953             button_Click();
 954         }
 955 
 956         private void button29_Click(object sender, EventArgs e)
 957         {
 958             obj = 4;
 959             flag[obj] = 1;
 960             button_Click();
 961         }
 962 
 963         private void button30_Click(object sender, EventArgs e)
 964         {
 965             obj = 5;
 966             flag[obj] = 1;
 967             button_Click();
 968         }
 969 
 970         private void button31_Click(object sender, EventArgs e)
 971         {
 972             obj = 6;
 973             flag[obj] = 1;
 974             button_Click();
 975         }
 976 
 977         private void button32_Click(object sender, EventArgs e)
 978         {
 979             obj = 7;
 980             flag[obj] = 1;
 981             button_Click();
 982         }
 983 
 984         private void button33_Click(object sender, EventArgs e)
 985         {
 986             obj = 8;
 987             flag[obj] = 1;
 988             button_Click();
 989         }
 990 
 991         private void button34_Click(object sender, EventArgs e)
 992         {
 993             obj = 9;
 994             flag[obj] = 1;
 995             button_Click();
 996         }
 997 
 998         private void button35_Click(object sender, EventArgs e)
 999         {
1000             obj = 10;
1001             flag[obj] = 1;
1002             button_Click();
1003         }
1004 
1005         private void button36_Click(object sender, EventArgs e)
1006         {
1007             obj = 11;
1008             flag[obj] = 1;
1009             button_Click();
1010 
1011         }
1012 
1013         private void button37_Click(object sender, EventArgs e)
1014         {
1015             obj = 12;
1016             flag[obj] = 1;
1017             button_Click();
1018         }
1019 
1020         private void button38_Click(object sender, EventArgs e)
1021         {
1022             obj = 13;
1023             flag[obj] = 1;
1024             button_Click();
1025         }
1026 
1027         private void button39_Click(object sender, EventArgs e)
1028         {
1029             obj = 14;
1030             flag[obj] = 1;
1031             button_Click();
1032         }
1033 
1034         private void button40_Click(object sender, EventArgs e)
1035         {
1036             obj = 15;
1037             flag[obj] = 1;
1038             button_Click();
1039         }
1040 
1041         private void button41_Click(object sender, EventArgs e)
1042         {
1043             obj = 16;
1044             flag[obj] = 1;
1045             button_Click();
1046         }
1047 
1048         private void button42_Click(object sender, EventArgs e)
1049         {
1050             obj = 17;
1051             flag[obj] = 1;
1052             button_Click();
1053         }
1054 
1055         private void button43_Click(object sender, EventArgs e)
1056         {
1057             obj = 18;
1058             flag[obj] = 1;
1059             button_Click();
1060         }
1061 
1062         private void button44_Click(object sender, EventArgs e)
1063         {
1064             obj = 19;
1065             flag[obj] = 1;
1066             button_Click();
1067         }
1068 
1069         private void button45_Click(object sender, EventArgs e)
1070         {
1071             obj = 20;
1072             flag[obj] = -1;
1073             button_Click();
1074         }
1075 
1076         private void button46_Click(object sender, EventArgs e)
1077         {
1078             obj = 19;
1079             flag[obj] = -1;
1080             button_Click();
1081         }
1082 
1083         private void button47_Click(object sender, EventArgs e)
1084         {
1085             obj = 18;
1086             flag[obj] = -1;
1087             button_Click();
1088         }
1089 
1090         private void button48_Click(object sender, EventArgs e)
1091         {
1092             obj = 17;
1093             flag[obj] = -1;
1094             button_Click();
1095         }
1096 
1097         private void button49_Click(object sender, EventArgs e)
1098         {
1099             obj = 16;
1100             flag[obj] = -1;
1101             button_Click();
1102         }
1103 
1104         private void button50_Click(object sender, EventArgs e)
1105         {
1106             obj = 15;
1107             flag[obj] = -1;
1108             button_Click();
1109         }
1110 
1111         private void button51_Click(object sender, EventArgs e)
1112         {
1113             obj = 14;
1114             flag[obj] = -1;
1115             button_Click();
1116         }
1117 
1118         private void button52_Click(object sender, EventArgs e)
1119         {
1120             obj = 13;
1121             flag[obj] = -1;
1122             button_Click();
1123         }
1124 
1125         private void button53_Click(object sender, EventArgs e)
1126         {
1127             obj = 12;
1128             flag[obj] = -1;
1129             button_Click();
1130         }
1131 
1132         private void button54_Click(object sender, EventArgs e)
1133         {
1134             obj = 11;
1135             flag[obj] = -1;
1136             button_Click();
1137 
1138         }
1139 
1140         private void button55_Click(object sender, EventArgs e)
1141         {
1142             obj = 10;
1143             flag[obj] = -1;
1144             button_Click();
1145 
1146         }
1147 
1148         private void button56_Click(object sender, EventArgs e)
1149         {
1150             obj = 9;
1151             flag[obj] = -1;
1152             button_Click();
1153 
1154         }
1155 
1156         private void button57_Click(object sender, EventArgs e)
1157         {
1158             obj = 8;
1159             flag[obj] = -1;
1160             button_Click();
1161 
1162         }
1163 
1164         private void button58_Click(object sender, EventArgs e)
1165         {
1166             obj = 7;
1167             flag[obj] = -1;
1168             button_Click();
1169 
1170         }
1171 
1172         private void button59_Click(object sender, EventArgs e)
1173         {
1174             obj = 6;
1175             flag[obj] = -1;
1176             button_Click();
1177 
1178         }
1179 
1180         private void button60_Click(object sender, EventArgs e)
1181         {
1182             obj = 5;
1183             flag[obj] = -1;
1184             button_Click();
1185 
1186         }
1187 
1188         private void button61_Click(object sender, EventArgs e)
1189         {
1190             obj = 4;
1191             flag[obj] = -1;
1192             button_Click();
1193 
1194         }
1195 
1196         private void button62_Click(object sender, EventArgs e)
1197         {
1198             obj = 3;
1199             flag[obj] = -1;
1200             button_Click();
1201 
1202         }
1203 
1204         private void button63_Click(object sender, EventArgs e)
1205         {
1206             obj = 2;
1207             flag[obj] = -1;
1208             button_Click();
1209 
1210         }
1211 
1212         private void button64_Click(object sender, EventArgs e)
1213         {
1214             obj = 1;
1215             flag[obj] = -1;
1216             button_Click();
1217 
1218         }
1219 
1220         private void label2_Click(object sender, EventArgs e)
1221         {
1222 
1223         }
1224 
1225        
1226 
1227         private void button69_Click(object sender, EventArgs e)
1228         {
1229             button69.BackColor = Color.Blue;
1230             button70.BackColor = Color.Pink;
1231             button71.BackColor = Color.Pink;
1232             button72.BackColor = Color.Pink;
1233             floor = 0;
1234             
1235         }
1236         private void button70_Click(object sender, EventArgs e)
1237         {
1238 
1239             button69.BackColor = Color.Pink;
1240             button70.BackColor = Color.Blue;
1241             button71.BackColor = Color.Pink;
1242             button72.BackColor = Color.Pink;
1243             floor = 1;
1244             
1245 
1246         }
1247        
1248 
1249         private void button71_Click(object sender, EventArgs e)
1250         {
1251             button69.BackColor = Color.Pink;
1252             button70.BackColor = Color.Pink;
1253             button71.BackColor = Color.Blue;
1254             button72.BackColor = Color.Pink;
1255             floor = 2;
1256             
1257         }
1258 
1259         private void button72_Click(object sender, EventArgs e)
1260         {
1261             button69.BackColor = Color.Pink;
1262             button70.BackColor = Color.Pink;
1263             button71.BackColor = Color.Pink;
1264             button72.BackColor = Color.Blue;
1265             floor = 3;
1266             
1267         }
1268 
1269         private void textBox1_TextChanged(object sender, EventArgs e)
1270         {
1271             peoplein[0] = double.Parse(textBox1.Text.ToString());
1272 
1273         }
1274 
1275         private void textBox2_TextChanged(object sender, EventArgs e)
1276         {
1277             peopleout[0] = double.Parse(textBox2.Text);
1278         }
1279 
1280         private void textBox5_TextChanged(object sender, EventArgs e)
1281         {
1282             peoplein[1] = double.Parse(textBox5.Text);
1283         }
1284 
1285         private void textBox9_TextChanged(object sender, EventArgs e)
1286         {
1287             peoplein[2] = double.Parse(textBox9.Text);
1288         }
1289 
1290         private void textBox16_TextChanged(object sender, EventArgs e)
1291         {
1292             peoplein[3] = double.Parse(textBox16.Text);
1293         }
1294 
1295         private void textBox6_TextChanged(object sender, EventArgs e)
1296         {
1297             peopleout[1] = double.Parse(textBox6.Text);
1298         }
1299 
1300         private void textBox10_TextChanged(object sender, EventArgs e)
1301         {
1302             peopleout[2] = double.Parse(textBox10.Text);
1303         }
1304 
1305         private void textBox15_TextChanged(object sender, EventArgs e)
1306         {
1307             peopleout[3] = double.Parse(textBox15.Text);
1308         }
1309 
1310         private void textBox4_TextChanged(object sender, EventArgs e)
1311         {
1312             weightdel[0] = double.Parse(textBox4.Text);
1313         }
1314 
1315         private void textBox8_TextChanged(object sender, EventArgs e)
1316         {
1317             weightdel[1] = double.Parse(textBox8.Text);
1318         }
1319 
1320         private void textBox12_TextChanged(object sender, EventArgs e)
1321         {
1322             weightdel[2] = double.Parse(textBox12.Text);
1323         }
1324 
1325         private void textBox13_TextChanged(object sender, EventArgs e)
1326         {
1327             weightdel[3] = double.Parse(textBox13.Text);
1328         }
1329 
1330         private void button65_Click(object sender, EventArgs e)
1331         {
1332             peoplenow[0] = double.Parse(textBox17.Text)+peoplein[0]-peopleout[0];
1333             textBox17.Text = peoplenow[0] + "";
1334             weightnow[0] = double.Parse(textBox3.Text) + weightadd[0]-weightdel[0];
1335             textBox3.Text = weightnow[0] + "";
1336             if (peoplenow[0] >= 10 || weightnow[0] >= 800)
1337             {
1338                 peopleflag1[0] = 1;
1339                 textBox3.Text = 800 + "";
1340                 textBox17.Text = 10 + "";
1341             }
1342             else
1343             {
1344                 peopleflag1[0] = 0;
1345                 
1346 
1347             }
1348 
1349             textBox1.Text = 0 + "";
1350             textBox2.Text = 0+"";
1351             textBox4.Text = 0+"";
1352             textBox21.Text = 0 + "";
1353 
1354 
1355 
1356                
1357            
1358         }
1359 
1360         private void button66_Click(object sender, EventArgs e)
1361         {
1362             peoplenow[1] = double.Parse(textBox18.Text) + peoplein[1] - peopleout[1];
1363             textBox18.Text = peoplenow[1] + "";
1364             weightnow[1] = double.Parse(textBox7.Text) + weightadd[1]-weightdel[1];
1365             textBox7.Text = weightnow[1] + "";
1366             if (peoplenow[1] >= 10 || weightnow[1] >= 800)
1367             {
1368                 peopleflag1[1] = 1;
1369                 textBox7.Text = 800 + "";
1370                 textBox18.Text = 10 + "";
1371             }
1372             else
1373             {
1374                 peopleflag1[1] = 0;
1375                 
1376 
1377             }
1378             textBox5.Text = 0+"";
1379             textBox6.Text = 0+"";
1380             textBox8.Text = 0+"";
1381             textBox22.Text = 0 + "";
1382         }
1383 
1384         private void button67_Click(object sender, EventArgs e)
1385         {
1386             peoplenow[2] = double.Parse(textBox19.Text) + peoplein[2] - peopleout[2];
1387             textBox19.Text = peoplenow[2] + "";
1388             weightnow[2] = double.Parse(textBox11.Text) + weightadd[2]-weightdel[2];
1389             textBox11.Text = weightnow[2] + "";
1390             if (peoplenow[2] >= 20 || weightnow[2] >= 1600)
1391             {
1392                 peopleflag1[2] = 1;
1393                 textBox11.Text = 1600 + "";
1394                 textBox19.Text = 20 + "";
1395             }
1396             else
1397             {
1398                 peopleflag1[2] = 0;
1399                 
1400                     
1401             }
1402             textBox9.Text = 0+"";
1403             textBox10.Text =0+ "";
1404             textBox11.Text = 0+"";
1405             textBox23.Text = 0 + "";
1406             
1407         }
1408 
1409         private void button68_Click(object sender, EventArgs e)
1410         {
1411             peoplenow[3] = double.Parse(textBox20.Text) + peoplein[3] - peopleout[3];
1412             textBox20.Text = peoplenow[3] + "";
1413             weightnow[3] = double.Parse(textBox14.Text) + weightadd[3]-weightdel[3];
1414             textBox14.Text = weightnow[3] + "";
1415             if (peoplenow[3] >= 20 || weightnow[3] >= 1600)
1416             {
1417                 peopleflag1[3] = 1;
1418                 textBox14.Text = 1600 + "";
1419                 textBox20.Text = 20 + "";
1420             }
1421             else
1422             {
1423                 peopleflag1[3] = 0;
1424                
1425 
1426             }
1427             textBox12.Text = 0+"";
1428             textBox13.Text =0+ "";
1429             textBox15.Text = 0+"";
1430             textBox24.Text = 0 + "";
1431         }
1432 
1433         private void textBox3_TextChanged(object sender, EventArgs e)
1434         {
1435 
1436         }
1437 
1438        
1439 
1440         private void textBox21_TextChanged(object sender, EventArgs e)
1441         {
1442             weightadd[0] = double.Parse(textBox21.Text);
1443         }
1444 
1445         private void textBox22_TextChanged(object sender, EventArgs e)
1446         {
1447             weightadd[0] = double.Parse(textBox22.Text);
1448         }
1449 
1450         private void textBox23_TextChanged(object sender, EventArgs e)
1451         {
1452             weightadd[0] = double.Parse(textBox23.Text);
1453         }
1454 
1455         private void textBox24_TextChanged(object sender, EventArgs e)
1456         {
1457             weightadd[0] = double.Parse(textBox24.Text);
1458         }
1459 
1460         
1461 
1462         
1463 
1464 
1465 
1466  
1467 
1468         
1469 
1470         
1471         
1472 
1473       
1474 
1475       
1476 
1477 
1478     }
1479 }
lift

 

选择上11楼运行中界面

 

1 2 同时运行

时间安排(工作日志

posted @ 2014-03-21 09:29  季节的风  阅读(329)  评论(21编辑  收藏  举报