雅琪诺MES智能条码管理系统
jhz
2022-06-30 0d3b2bd4edaa7385e4ff96370c877be237af054b
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
 
namespace SCM
{
    public partial class Gy_BadReasonList : Form
    {
        public Gy_BadReasonList()
        {
            BlDic = new Dictionary<string, int>();
            InitializeComponent();
            textBox2.Text = "ÎïÁÏ´úÂë";
            textBox3.Text = "ÎïÁÏÃû³Æ";
            textBox4.Text = "¹æ¸ñÐͺÅ";
            textBox5.Text = "¼ÆÁ¿µ¥Î»";
            oWeb.Url = SCM.ClsPub1.WEBSURL;
            AddButton();
        }
 
        public SCM.WMSWeb.WebService1 oWeb = new SCM.WMSWeb.WebService1();
        private static Dictionary<string, int> BlDic;
        public int ISOK = 0;
        public string sSourceTypeName = "";
 
        private void Gy_BadReasonList_Load(object sender, EventArgs e)
        {
            oWeb.Url = SCM.ClsPub1.WEBSURL;
        }
 
 
        public string blStr = string.Empty;//²»Á¼Ô­Òò
        public string blId = string.Empty;//²»Á¼Ô­Òòid
 
        private void cmdHOK_Click(object sender, EventArgs e)
        {
            int a = 0;
            blStr = string.Empty;
            blId = string.Empty;
            foreach (var item in BlDic)
            {
                blStr += a == 0 ? item.Key : ";" + item.Key;
                blId += a == 0 ? item.Value.ToString() : ";" + item.Value;
                a++;
            }
            if (string.IsNullOrEmpty(blStr))
            {
                MessageBox.Show("ÇëÑ¡Ôñ²»Á¼Ô­ÒòºóÌá½»", "´íÎó", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //if (sSourceTypeName == "Éú²ú¶©µ¥")
            //{
            if (DBUtility.ClsPub.isDoule(txtHBadQty.Text) <= 0)
            {
                MessageBox.Show("ÇëÊäÈë²»Á¼Ã×Êý£¡", "´íÎó", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtHBadQty.Focus();
                return;
            }
            //}
            ISOK = 1;
            this.Visible = false;
        }
 
        private void cmdCancel_Click(object sender, EventArgs e)
        {
            txtHBadReason.Text = "";
            ISOK = 0;
            this.Visible = false;
        }
 
        private void cmdHClear_Click(object sender, EventArgs e)
        {
            txtHBadReason.Text = string.Empty;
            BlDic = new Dictionary<string, int>();
        }
 
        /// <summary>
        /// ¶¯Ì¬¼ÓÔØ²»Á¼Ô­Òò
        /// </summary>
        public void AddButton()
        {
            
            DataSet ds = oWeb.getDataSetBySQL("select top 100 HIteMID,HName from Gy_BadReason order by hnumber ", "Gy_BadReason", ref DBUtility.ClsPub.sExeReturnInfo);
            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
                return;
            }
            DataTable dataTable = ds.Tables[0];
            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                Button button = new Button();
                button.Location = new System.Drawing.Point(25, 40);
                button.Name = "btn";
                button.Size = new System.Drawing.Size(120, 80);
                button.TabIndex = 0;
                button.Tag = dataTable.Rows[i]["HIteMID"].ToString();
                button.TextAlign = ContentAlignment.MiddleCenter;
                button.Text = dataTable.Rows[i]["HName"].ToString();
                button.BackColor = Color.Gray; 
                button.FlatStyle = FlatStyle.Flat;
                button.FlatAppearance.BorderSize = 0;
                button.BackColor = Color.Gainsboro;
                button.Click += new EventHandler(Btn_Click);//ʹÓÃʼþº¯Êý¾ä±úÖ¸ÏòÒ»¸ö¾ßÌåµÄº¯Êý
                flowLayoutPanel1.Controls.Add(button);
            }
            label6.Text = label6.Text + sSourceTypeName;
        }
 
 
        /// <summary>
        /// ²»Á¼ÎïÁϵã»÷ʼþ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;//»ñÈ¡±»µã»÷µÄ¿Ø¼þ,°´Å¥
            if (BlDic.ContainsKey(btn.Text))
            {
                BlDic.Remove(btn.Text);
            }
            else
            {
                BlDic.Add(btn.Text, int.Parse(btn.Tag.ToString()));
            }
            SetBlText();
        }
 
        /// <summary>
        /// Îı¾¿ò¸³Öµ
        /// </summary>
        private void SetBlText()
        {
            int a = 0;
            txtHBadReason.Text = string.Empty;
            foreach (var item in BlDic)
            {
                txtHBadReason.Text += a == 0 ? item.Key : ";" + item.Key;
                a++;
            }
        }
 
        private void cmdHProcID_Click(object sender, EventArgs e)
        {
            SCM.ClsIF_Process_View oProc = new SCM.ClsIF_Process_View();
            string sWhere = "";
            if (oProc.RefreshView(sWhere))
            {
                this.txtHProcName.Text = oProc.oModel.HName;
                this.txtHProcName.Tag = oProc.oModel.HItemID.ToString();
            }
            else
            {
                this.txtHProcName.Text = "";
            }
        }
    }
}