schangxiang@126.com
2025-09-01 4b51c3551c3957ddd5236a18dd480637835cf7d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
using Newtonsoft.Json;
using sunui.forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using System.Windows.Forms;
using System.Xml.Linq;
using WMS.EnumDefine;
using WMS.Model;
using WMS.UI.Basic;
using WMS.UI.SynthesizeQuery;
using WMS.Untils;
using Button = System.Windows.Forms.Button;
using CheckBox = System.Windows.Forms.CheckBox;
 
namespace WMS.UI.WORK
{
    public partial class preview : Form
    {
        /// <summary>
        /// 选择的输送线编号
        /// </summary>
        int check_convs_num = 0;
 
        //上线点库存数据
        List<WMS.yunneiWCS.position> UpStationInfo = new List<WMS.yunneiWCS.position>();
        Dictionary<string, string> conveyorName = new Dictionary<string, string>
        {
          {"2-39-1","Conveyor1"},
          {"1-39-1","Conveyor2"},
          {"1-0-1","Conveyor3"},
          {"2-0-1","Conveyor4"},
        };
        string apiBase = "http://192.168.0.3";
        // string apiBase = "http://localhost";
        //已打开的窗口名集合
        public static List<string> newform = new List<string>();
        public preview()
        {
            InitializeComponent();
            //dataGridView1.AutoGenerateColumns = false;
            Thread getStationTh = new Thread(getStation);
            getStationTh.Start();
        }
        /// <summary>解锁输送线状态和打开站点流水号
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GTU1_Click(object sender, EventArgs e)
        {
            Button button = (Button)sender;
            //解锁输送线锁定状态
            if (button.Name == "Conveyor1" || button.Name == "Conveyor2" || button.Name == "Conveyor3" || button.Name == "Conveyor4")
            {
                /*
                DialogResult dr = MessageBox.Show($"确认要解锁库位 {button.Text} 吗", "解锁库位确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dr == DialogResult.OK)
                {
                    var res = FLogin.wcsWcf.unlockPosition(button.Text);
 
                    WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(res.status == 200 ? 1 : 2, res.status == 200 ? "解锁成功" : "解锁失败");
                    ms.Show();
                }
                //*/
 
                //要求必须输入管理员密码才可以!!!
                FormManagerPassword fr = new FormManagerPassword();
                fr.StartPosition = FormStartPosition.CenterScreen;
                fr.ShowDialog();
                if (!fr.isValidateOk)
                {
                    return;
                }
                var ret = FLogin.wcsWcf.findSinglePosition(button.Text);
                if (ret.status == 200)
                {
                    var postion = ret.date.First();
                    var isLock = postion.isLock == true ? 1 : 0;
                    var str_LastModifyTime = postion.LastModifyTime == null ? "" : ((DateTime)postion.LastModifyTime).ToString("yyyy-MM-dd HH:mm:ss");
                    placeEditForLock listView = new placeEditForLock(postion.positionId.ToString(), postion.positionName, isLock, postion.remark, postion.lastModifier,
                       str_LastModifyTime
                        );
                    listView.ShowDialog();
                }
                else
                {
                    WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "没有找到库位数据");
                    ms.Show();
                }
            }
            else//打开上线点流水号
            {
                if (!newform.Contains(button.Text))
                {
                    FrmPVClist listView = new FrmPVClist(button.Text, 1);//dataGridView1
                    listView.Show();
                    newform.Add(button.Text);
                }
                else
                {
                    WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "此窗口已打开");
                    ms.Show();
                }
            }
        }
        /// <summary>获取输送线和上线点是状态
        /// 
        /// </summary>
        private void getStation()
        {
            while (true)
            {
                Thread.Sleep(2000);
                if (WMSFrmMain.isCurrentShowpreview == false)
                {
                    continue;
                }
                try
                {
                    List<WMS.yunneiWCS.position> stations = FLogin.wcsWcf.stationStatus().date.ToList();
                    if (stations.Count > 0)
                    {
                        #region 判断输送线是否锁定
 
                        foreach (var item in stations)
                        {
                            var conv = stations.FirstOrDefault(x => x.positionName == item.positionName);//ControlText
                            if (conv != null)
                            {
                                var name = conveyorName[item.positionName];
                                this.Controls.Find(name, true)[0].BackColor = conv.isLock == true ? Color.Red : Color.FromArgb(225, 225, 225);
                            }
                        }
 
                        #endregion
                    }
 
 
                    #region 上线点是否有货
                    var res = FLogin.wcsWcf.UpStationInfo();
                    if (res.status == 200)
                    {
                        UpStationInfo = res.date.ToList();
                        foreach (var item in UpStationInfo)
                        {
                            this.Controls.Find(item.positionName, true)[0].BackColor = item.isfree == true ? Color.FromArgb(124, 205, 124) : Color.FromArgb(225, 225, 225);
 
                        }
                    }
                    #endregion
 
                    #region 获取AGV发送消息
 
                    string[] dataList = FLogin.wcsWcf.findAgvInfo();
                    if (dataList != null)
                    {
                        if (dataList.Length > 0)
                        {
                            label_agvGT.Text = dataList[0];
                            label_agvGG.Text = dataList[1];
                        }
                    }
 
 
 
                    #endregion
 
                }
                catch (Exception)
                {
                }
            }
 
        }
        /// <summary>缸盖上线
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                HTTPService api = new HTTPService(apiBase + ":1025/pda/");
                // HTTPService api = new HTTPService("http://localhost:1025/pda/");
                string paprm = JsonConvert.SerializeObject("");
                Guid guid = System.Guid.NewGuid();
                string res = api.postContentForStringForAgv("GGoutStock/?materialCode=" + textBox3.Text.Trim() + "&station=" + comboBox8.SelectedItem.ToString(), paprm, guid);
                WMSCommon.SendToAGVResult(res);
                textBox2.Text = "缸盖上线叫料返回消息:" + DateTime.Now.ToLocalTime().ToShortTimeString() + res;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        /// <summary>缸体上线
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button12_Click(object sender, EventArgs e)
        {
            try
            {
                HTTPService api = new HTTPService(apiBase + ":1025/pda/");
                string paprm = JsonConvert.SerializeObject("");
                Guid guid = System.Guid.NewGuid();
                string res = api.postContentForStringForAgv("GToutStock/?materialCode=" + textBox3.Text.Trim() + "&station=" + comboBox8.SelectedItem.ToString(), paprm, guid);
                WMSCommon.SendToAGVResult(res);
                textBox2.Text = "缸体上线叫料返回消息:" + DateTime.Now.ToLocalTime().ToShortTimeString() + res;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        /// <summary>获取设备状态
        /// 
        /// </summary>
        private void getDeviceStatus_Srm()
        {
            while (true)
            {
                Thread.Sleep(1000);
                try
                {
                    var srm = FLogin.wcsWcf.getSrmStatus();
                    if (srm != null)
                    {
                        label34.Text = "心跳:" + srm.handShake;
                        label32.Text = "模式:" + srm.mode;
                        label26.Text = "任务ID:" + srm.TaskID.ToString();
                        label25.Text = "状态:" + srm.state;
                        label30.Text = "当前列:" + srm.posY;
                        label27.Text = "当前层:" + srm.posZ;
                        label28.Text = "报警信息:" + srm.Alarm_info;
                        label53.Text = "是否完成:" + srm.taskFinish;
                        label6.Text = "是否收到任务:" + srm.stb;
                        label13.Text = "是否有货:" + srm.haveGoods;
 
                        lbl_stateDetailName.Text = "详细状态:" + srm.stateDetailName;
                        lbl_srmTaskExcuteName.Text = "任务执行:" + srm.srmTaskExcuteName;
                    }
                }
                catch (Exception)
                {
 
                }
            }
 
        }
 
        private void getDeviceStatus_Convs()
        {
            while (true)
            {
                Thread.Sleep(1000);
                try
                {
                    var convs = FLogin.wcsWcf.getConvStatus();
                    #region 输送线赋值
                    if (convs != null)
                    {
                        if (convs.Length == 4)
                        {
                            //int num = Convert.ToInt32(comboBox1.SelectedItem);
                            int num = check_convs_num;
                            if (num < 5 && num > 0)
                            {
                                label49.Text = "输送线编号:L0" + num;
                                label50.Text = "心跳:" + convs[num - 1].handShake;
                                label48.Text = "模式:" + convs[num - 1].mode;
                                label43.Text = "任务id:" + convs[num - 1].taskId;
                                if (convs[num - 1].position == "0")
                                {
                                    label42.Text = "位置:无货";
                                }
                                else
                                {
                                    label42.Text = convs[num - 1].position == "1" ? "位置:外侧有货" : "位置:内测有货";
                                }
                                label47.Text = "外形检测:" + convs[num - 1].check;
                                label46.Text = "是否报警:" + convs[num - 1].isAlarm;
 
                                lbl_GJJY.Text = "输送线外侧工件记忆:" + convs[num - 1].W_GJJY;
                                lbl_LoadMaterialConfirm.Text = "放料完成信号:" + convs[num - 1].W_LoadMaterialConfirm;
                            }
                            else
                            {
                                label49.Text = "输送线编号:";
                                label50.Text = "心跳:";
                                label48.Text = "模式:";
                                label43.Text = "任务id:";
                                label42.Text = "位置:";
                                label47.Text = "外形检测:";
                                label46.Text = "是否报警:";
 
                                lbl_GJJY.Text = "输送线外侧工件记忆:";
                                lbl_LoadMaterialConfirm.Text = "放料完成信号:";
                            }
                        }
                    }
                    #endregion
                }
                catch (Exception)
                {
 
                }
            }
 
        }
        private void preview_Load(object sender, EventArgs e)
        {
            Control.CheckForIllegalCrossThreadCalls = false;
            Thread getinfo = new Thread(getDeviceStatus_Srm);
            getinfo.Start();
 
            Thread getinfo2 = new Thread(getDeviceStatus_Convs);
            getinfo2.Start();
        }
        /// <summary>发送缸盖侧AGV任务
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button17_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("本次任务将是AGV单机任务,仓储系统不会更改库存信息,请谨慎操作,确定要发送任务吗", "AGV任务", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (dr == DialogResult.OK)
            {
                try
                {//postContent
                    var newAgvTaskNo = "";
                    using (yunneiWCS.IyunneiWcfClient client = new yunneiWCS.IyunneiWcfClient())
                    {
                        newAgvTaskNo = client.CreateTaskIdForAgvTaskByHand();
                    }
                    tb_GG_AgvTaskNo.Text = newAgvTaskNo;
 
                    var apiAddress = "http://192.168.0.3:6546/api/v2/";
                    var url = "orders";
                    HTTPService api = new HTTPService(apiAddress);
                    //HTTPService api = new HTTPService(" http://localhost:1026/api/pp/");
 
                    var data = new
                    {
                        id = newAgvTaskNo,
                        systemId = "WMS",
                        type = "LoadingAndUnloading",
                        source = comboBox2.SelectedItem,
                        destination = comboBox3.SelectedItem
                    };
 
                    string paprm = JsonConvert.SerializeObject(data);
 
                    Guid guid = System.Guid.NewGuid();
                    string result = api.postContentForStringForAgv(url, paprm, guid);
                    WMSCommon.SendToAGVResult(result);
                    SuccessForHandToSendTaskToAgv(comboBox2.SelectedItem.ToString(), result);
 
                    textBox8.Text = DateTime.Now.ToLocalTime().ToShortTimeString() + result;
                    textBox8.Text = DateTimeHelper.ConvertToString(DateTime.Now) + "_____" + "返回结果:" + result + "。 请求参数:" + paprm + " 请求地址:" + apiAddress + url;
                }
                catch (Exception ex)
                {
                    textBox8.Text = DateTimeHelper.ConvertToString(DateTime.Now) + "_____" + "出现异常:" + JsonConvert.SerializeObject(ex);
                }
            }
        }
 
        /// <summary>
        /// 手动给agv发送任务成功之后
        /// </summary>
        /// <param name="station"></param>
        /// <param name="result"></param>
        private void SuccessForHandToSendTaskToAgv(string station, string agvRetResult)
        {
            if (!string.IsNullOrEmpty(agvRetResult))
            {
                return;
            }
            int convDBValue = 0;
            if (station == "2-39-1")
            {
                convDBValue = 1;
            }
            else if (station == "1-39-1")
            {
                convDBValue = 2;
            }
            else if (station == "1-0-1")
            {
                convDBValue = 3;
            }
            else if (station == "2-0-1")
            {
                convDBValue = 4;
            }
            else
            {
                return;
            }
            var result = FLogin.wcsWcf.ClearGJJY(convDBValue - 1);//为啥减去1,因为减去1是为了匹配list的索引值
            if (result.result)
            {
                //MessageBox.Show("给输送线" + num + "手动发送放料完成信号成功!");
            }
            else
            {
                MessageBox.Show("给输送线" + convDBValue + "手动清除工件记忆信号失败!" + result.resMsg);
            }
        }
 
        /// <summary>发送缸体侧AGV任务
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button18_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("本次任务将是AGV单机任务,仓储系统不会更改库存信息,请谨慎操作,确定要发送任务吗", "AGV任务", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (dr == DialogResult.OK)
            {
                try
                {//postContent
                    var newAgvTaskNo = "";
                    using (yunneiWCS.IyunneiWcfClient client = new yunneiWCS.IyunneiWcfClient())
                    {
                        newAgvTaskNo = client.CreateTaskIdForAgvTaskByHand();
                    }
                    tb_GT_AgvTaskNo.Text = newAgvTaskNo;
 
                    var apiAddress = "http://192.168.0.3:6546/api/v2/";
                    var url = "orders";
                    HTTPService api = new HTTPService(apiAddress);
                    //HTTPService api = new HTTPService(" http://localhost:1026/api/pp/");
 
                    var data = new
                    {
                        id = newAgvTaskNo,
                        systemId = "WMS",
                        type = "LoadingAndUnloading",
                        source = comboBox4.SelectedItem,
                        destination = comboBox5.SelectedItem
                    };
 
                    string paprm = JsonConvert.SerializeObject(data);
                    Guid guid = System.Guid.NewGuid();
                    string result = api.postContentForStringForAgv(url, paprm, guid);
                    WMSCommon.SendToAGVResult(result);
                    SuccessForHandToSendTaskToAgv(comboBox4.SelectedItem.ToString(), result);
                    textBox8.Text = DateTimeHelper.ConvertToString(DateTime.Now) + "_____" + "返回结果:" + result + "。 请求参数:" + paprm + " 请求地址:" + apiAddress + url;
                }
                catch (Exception ex)
                {
                    textBox8.Text = DateTimeHelper.ConvertToString(DateTime.Now) + "_____" + "出现异常:" + JsonConvert.SerializeObject(ex);
                }
            }
        }
        /// <summary>发送堆垛机任务
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button6_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dr = MessageBox.Show("本次任务将是堆垛机单机任务,仓储系统不会更改库存信息,请谨慎操作,确定要发送任务吗", "堆垛机任务", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dr == DialogResult.OK)
                {
                    string sourcePlace = tb_SourcePlace.Text.Trim();
                    string toPlace = tb_ToPlace.Text.Trim();
                    long taskID = Convert.ToInt64(textBox4.Text.Trim());
                    string res = FLogin.wcsWcf.srmTaskReSend(taskID, sourcePlace, toPlace, 2, true);
                    if (!string.IsNullOrEmpty(res))
                    {
                        MessageBox.Show(res);
                    }
                }
            }
            catch (Exception)
            {
 
            }
        }
        /// <summary>堆垛机任务确认
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button10_Click(object sender, EventArgs e)
        {
            try
            {
                FLogin.wcsWcf.srmConfirm();
            }
            catch (Exception)
            {
            }
 
        }
        /// <summary>堆垛机ACK确认
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button15_Click(object sender, EventArgs e)
        {
            try
            {
                FLogin.wcsWcf.sendSrmACK();
            }
            catch (Exception)
            {
            }
        }
        /// <summary>堆垛机解除报警
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button8_Click(object sender, EventArgs e)
        {
            try
            {
                FLogin.wcsWcf.srmAlarmReset();
            }
            catch (Exception)
            {
            }
        }
        /// <summary>模拟测试_空托盘回库测试
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                HTTPService api = new HTTPService(apiBase + ":1025/pda/");
 
                List<serialNumbers> LIU = new List<serialNumbers>();
 
                if (listBox1.Items.Count > 0)
                {
                    foreach (var item in listBox1.Items)
                    {
                        serialNumbers liu = new serialNumbers();
                        liu.serialNumber = item.ToString();
                        LIU.Add(liu);
                    }
 
                }
 
                var data = new
                {
                    station = comboBox8.SelectedItem.ToString(),
                    datalist = LIU
                };
                string paprm = JsonConvert.SerializeObject(data);
                Guid guid = System.Guid.NewGuid();
                string res = api.postContentForStringForAgv("EmptyBack", paprm, guid);
                WMSCommon.SendToAGVResult(res);
                textBox2.Text = "空托盘回库返回消息:" + DateTime.Now.ToLocalTime().ToShortTimeString() + res;
 
            }
            catch (Exception)
            {
 
            }
        }
        /// <summary>模拟测试-添加流水号
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button5_Click(object sender, EventArgs e)
        {
            listBox1.Items.Add(textBox1.Text.Trim());
        }
        /// <summary>模拟测试-清空流水号
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button9_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
 
        }
 
        private void button4_Click(object sender, EventArgs e)
        {
            //int num = Convert.ToInt32(comboBox1.SelectedItem);
            int num = check_convs_num;
            if (num < 5 && num > 0)
            {
            }
            else
            {
                MessageBox.Show("请选择输送线设备号");
                return;
            }
            DialogResult dr = MessageBox.Show("您确认要给输送线" + num + "手动发送放料完成信号吗", "输送线任务", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (dr == DialogResult.OK)
            {
                try
                {
                    var result = FLogin.wcsWcf.Trans_LoadMaterialConfirm(num - 1);//为啥减去1,因为减去1是为了匹配list的索引值
                    if (result.result)
                    {
                        //MessageBox.Show("给输送线" + num + "手动发送放料完成信号成功!");
                    }
                    else
                    {
                        MessageBox.Show("给输送线" + num + "手动发送放料完成信号失败!" + result.resMsg);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("给输送线" + num + "手动发送放料完成信号异常!" + ex.Message);
                }
            }
        }
 
        private void AGV_Click(object sender, EventArgs e)
        {
 
        }
 
        private void checkedChanged(object sender, EventArgs e)
        {
            if ((sender as CheckBox).Checked == true)
            {
                foreach (Control chk in (sender as CheckBox).Parent.Controls)
                {
                    if (chk is CheckBox)
                    {
                        var _chk = chk as CheckBox;
                        if (_chk != sender)
                        {
                            _chk.Checked = false;
                        }
                    }
                }
            }
        }
 
        private void ck_L01_CheckedChanged(object sender, EventArgs e)
        {
            checkedChanged(sender, e);
            check_convs_num = (sender as CheckBox).Checked == true ? 1 : 0;
        }
 
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            checkedChanged(sender, e);
            check_convs_num = (sender as CheckBox).Checked == true ? 2 : 0;
        }
 
        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            checkedChanged(sender, e);
            check_convs_num = (sender as CheckBox).Checked == true ? 3 : 0;
        }
 
        private void checkBox3_CheckedChanged(object sender, EventArgs e)
        {
            checkedChanged(sender, e);
            check_convs_num = (sender as CheckBox).Checked == true ? 4 : 0;
        }
 
        private void button7_Click(object sender, EventArgs e)
        {
 
        }
 
        /// <summary>
        /// 堆垛机起点和目标点切换
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button23_Click(object sender, EventArgs e)
        {
            var old_sourcePlace = this.tb_SourcePlace.Text;
            var old_toPlace = this.tb_ToPlace.Text;
            this.tb_SourcePlace.Text = old_toPlace;
            this.tb_ToPlace.Text = old_sourcePlace;
        }
 
        private void button24_Click(object sender, EventArgs e)
        {
            //int num = Convert.ToInt32(comboBox1.SelectedItem);
            int num = check_convs_num;
            if (num < 5 && num > 0)
            {
            }
            else
            {
                MessageBox.Show("请选择输送线设备号");
                return;
            }
            DialogResult dr = MessageBox.Show("您确认要给输送线" + num + "手动清除外侧工件记忆吗", "输送线任务", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (dr == DialogResult.OK)
            {
                try
                {
                    var result = FLogin.wcsWcf.ClearGJJY(num - 1);//为啥减去1,因为减去1是为了匹配list的索引值
                    if (result.result)
                    {
                        //MessageBox.Show("给输送线" + num + "手动发送放料完成信号成功!");
                    }
                    else
                    {
                        MessageBox.Show("给输送线" + num + "手动清除外侧工件记忆失败!" + result.resMsg);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("给输送线" + num + "手动清除外侧工件记忆吗异常!" + ex.Message);
                }
            }
        }
    }
    public class serialNumbers
    {
        public string serialNumber { get; set; }
    }
 
}