#
mrzhssss
2022-09-22 110f3977b399dd117ce1af49ca792d602e2ba9a9
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
 
namespace WCS
{
    public partial class plcset : Office2007Form
    {
        public int stano = 0;
        public plcset(int stn)
        {
            InitializeComponent();
            this.Text = "站点:"+stn.ToString()+"--->快速维护";
            stano = stn;
        }
 
        private void set_Click(object sender, EventArgs e)
        {
            int idno = 0, destno = 0,seqno=0;
            int plcno = 0;
            try
            {
                seqno=Common.GetStnSeq(stano);
                plcno = Common.g_ari_staion_plc_no[seqno] - 1;
                if (id.Checked == true)
                {
                    idno = Int32.Parse(this.idval.Text);
                    Common.AddPlcQuereCmd(plcno, "02" + idno.ToString("0000") + stano.ToString("0000") + "0000");
                    //Common.PlcAQueue.Enqueue("02" + idno.ToString("0000") + stano.ToString("0000") + "0000");
                }
                else if (dest.Checked == true)
                {
                    destno = Int32.Parse(this.destval.Text);
                    Common.AddPlcQuereCmd(plcno, "030000" + stano.ToString("0000") + destno.ToString("0000"));
                    //Common.PlcAQueue.Enqueue("030000" + stano.ToString("0000") + destno.ToString("0000"));
                }
                else
                {
                    idno = Int32.Parse(this.idval.Text);
                    destno = Int32.Parse(this.destval.Text);
                    Common.AddPlcQuereCmd(plcno, "04" + idno.ToString("0000") + stano.ToString("0000") + destno.ToString("0000"));
                    //Common.PlcAQueue.Enqueue("04" + idno.ToString("0000") + stano.ToString("0000") + destno.ToString("0000"));
                }
            }
            catch (Exception r)
            {
 
            }
            this.Close();
        }
 
        private void idval_TextChanged(object sender, EventArgs e)
        {
            try
            {
                int i = Int32.Parse(idval.Text);
                if (i < 0)
                {
                    iderr.Text = "错误";
                    this.idval.Text = "0";
                    return;
                }
                iderr.Text = "";
            }
            catch (Exception t)
            {
                iderr.Text = "错误";
                this.idval.Text = "0";
                return;
            }
        }
 
        private void destval_TextChanged(object sender, EventArgs e)
        {
            try
            {
                int i = Int32.Parse(destval.Text);
                if (i < 0)
                {
                    desterr.Text = "错误";
                    this.destval.Text = "0";
                    return;
                }
                desterr.Text = "";
            }
            catch (Exception t)
            {
                desterr.Text = "错误";
                this.destval.Text = "0";
                return;
            }
        }
 
        private void plcset_Load(object sender, EventArgs e)
        {
            this.idval.Enabled = true;
            this.destval.Enabled = false;
        }
 
        private void id_Click(object sender, EventArgs e)
        {
            this.idval.Enabled = true;
            this.destval.Enabled = false;
        }
 
        private void dest_Click(object sender, EventArgs e)
        {
            this.idval.Enabled = false;
            this.destval.Enabled = true;
        }
 
        private void iddest_Click(object sender, EventArgs e)
        {
            this.idval.Enabled = true;
            this.destval.Enabled = true;
        }
 
 
    }
}