cdk
2 天以前 3c6cad1224e7cb985f03d15cc98a4a2074a5af49
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
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using System;
using System.Data;
using System.IO;
using System.Windows;
 
namespace Gs.DevApp.DevFrm.Work
{
    public partial class Frm_WorkStart : DevExpress.XtraEditors.XtraForm
    {
        /// <summary>
        /// pc只需要过站
        /// </summary>
        private string isPc = "投入,电检,水检,终检";
        /// <summary>
        /// 电检取值路径,目前都是存硬盘
        /// </summary>
        string dianJianPath = "";
        public Frm_WorkStart()
        {
            InitializeComponent();
            _getListJyxm();
            btnLogin.Click += BtnLogin_Click;
            txt_gx.EditValueChanged += (s, e) =>
            {
                string fGx = txt_gx.Text.Trim();
                if (fGx == "G003:水检")
                {
                    chkWater.Visible = true;
                }
                else
                    chkWater.Visible = false;
 
 
                if (fGx == "G001:投入")
                {
                    btnFg.Visible = true;
                }
                else
                    btnFg.Visible = false;
 
            };
 
            btnFg.Click += BtnFg_Click;
        }
 
        /// <summary>
        /// 返工类型进入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void BtnFg_Click(object sender, EventArgs e)
        {
            if (txt_bc.SelectedIndex <= 0)
            {
                txt_bc.Focus();
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择班次!");
                return;
            }
            if (txt_gx.SelectedIndex <= 0)
            {
                txt_gx.Focus();
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择工序!");
                return;
            }
            string fGx = txt_gx.Text.Trim();
            string fBc = txt_bc.Text.Trim();
            if (fGx == "G001:投入")
            {
                Frm_Work01Fg frm = new Frm_Work01Fg(fGx, fBc);
                frm.ShowDialog();
                return;
            }
            Gs.DevApp.ToolBox.MsgHelper.ShowError("选择错误,请重试!");
            return;
        }
 
        /// <summary>
        /// 正常进入 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            if (txt_bc.SelectedIndex <= 0)
            {
                txt_bc.Focus();
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择班次!");
                return;
            }
            if (txt_gx.SelectedIndex <= 0)
            {
                txt_gx.Focus();
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择工序!");
                return;
            }
            string fGx = txt_gx.Text.Trim();
            string fBc = txt_bc.Text.Trim();
            //如果是电检
            if (fGx == "G002:电检")
            {
                if (!getConfigDianJian())
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("读取【G002:电检】置文件失败,请联系管理员!");
                    return;
                }
            }
            Frm_Work01 frm = new Frm_Work01(fGx, fBc, dianJianPath, (chkWater.Checked ? 1 : 0));
            frm.ShowDialog();
        }
 
        /// <summary>
        /// 先读取电检的存储路径
        /// </summary>
        /// <returns></returns>
        private bool getConfigDianJian()
        {
            string _where = " and 1=1 and  defect_code='1008'";
            var pgq = new PageQueryModel(1, 999999, "a.defect_code", "asc", "", _where);
            var json = JsonConvert.SerializeObject(pgq);
            try
            {
                var strReturn = UtilityHelper.HttpPost("", "MesDefectCodeManager/GetListPage", json);
                var dd = UtilityHelper.ReturnToTablePage(strReturn);
                var dt = dd.rtnData.list;
                if (dt != null && dt.Rows.Count > 0)
                {
                    dianJianPath = dt.Rows[0]["defectName"].ToString();
                    if (File.Exists(dianJianPath))
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                return false;
            }
            catch (Exception ex)
            {
                MsgHelper.ShowError("提示:" + ex.Message);
                return false;
            }
        }
 
        /// <summary>
        /// 读取工序下拉,同时配对isPc
        /// </summary>
        private void _getListJyxm()
        {
            var pgq = new PageQueryModel(1, 999999, "a.processNo", "asc", "", "");
            var json = JsonConvert.SerializeObject(pgq);
            try
            {
                var strReturn = UtilityHelper.HttpPost("", "WorkPro/GetListPage", json);
                var dd = UtilityHelper.ReturnToTablePage(strReturn);
                DataTable dt = dd.rtnData.list;
                txt_gx.Properties.Items.Add("-请选择-");
                foreach (DataRow dr in dt.Rows)
                {
                    if (isPc.Contains(dr["processName"].ToString()))
                        txt_gx.Properties.Items.Add(dr["processNo"].ToString() + ":" + dr["processName"].ToString());
                }
                txt_gx.Focus();
                txt_gx.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
    }
}