Browse Source

Merge branch 'master' of ssh://10.10.101.21/source/mes-client

Hcsy 8 years ago
parent
commit
28e7fd3718

+ 35 - 32
UAS-MES/DbFind.cs

@@ -108,7 +108,7 @@ namespace UAS_MES
                     for (int i = 0; i < DbFindGridView.Columns.Count; i++)
                     {
                         DbFindGridView.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
-                    } 
+                    }
                     //获取查询的字段的拼接语句
                     pagination1.BindDataToNavigator(DbFindGridView, tablename, SelectField, "ID", caller, Condition == null ? "" : Condition);
                     IsAbleDbFind = true;
@@ -184,45 +184,48 @@ namespace UAS_MES
         //给打开窗体的对应字段赋值
         private void DbFindGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
         {
-            FormCollection fmCollection = Application.OpenForms;
-            ControlCollection controls = (ControlCollection)fmCollection[FormName].Controls;
-            try
+            if (e.RowIndex >= 0)
             {
-                //先判断DataTable里面是否有这个字段,然后从打开的窗口里面去获取到这个Form,从Form中的指定Panel获取到指定字段的控件
-                for (int i = 0; i < dt.Columns.Count; i++)
+                FormCollection fmCollection = Application.OpenForms;
+                ControlCollection controls = (ControlCollection)fmCollection[FormName].Controls;
+                try
                 {
-                    fillControl(e, i, fmCollection[FormName]);
-                }
-                //发起DBFind的控件
-                SuccessReturnData = true;
-                if (MainControl is MaCodeSearchTextBox)
-                {
-                    MaCodeSearchTextBox ctl = (MainControl as MaCodeSearchTextBox);
-                    ctl.GetData(true);
+                    //先判断DataTable里面是否有这个字段,然后从打开的窗口里面去获取到这个Form,从Form中的指定Panel获取到指定字段的控件
+                    for (int i = 0; i < dt.Columns.Count; i++)
+                    {
+                        fillControl(e, i, fmCollection[FormName]);
+                    }
+                    //发起DBFind的控件
+                    SuccessReturnData = true;
+                    if (MainControl is MaCodeSearchTextBox)
+                    {
+                        MaCodeSearchTextBox ctl = (MainControl as MaCodeSearchTextBox);
+                        ctl.GetData(true);
+                    }
+                    if (MainControl is SearchTextBox)
+                    {
+                        SearchTextBox ctl = (MainControl as SearchTextBox);
+                        ctl.GetData();
+                    }
+                    MainControl.Focus();
                 }
-                if (MainControl is SearchTextBox)
+                catch (Exception ea)
                 {
-                    SearchTextBox ctl = (MainControl as SearchTextBox);
-                    ctl.GetData();
+                    LogManager.DoLog(ea.Message);
+                    SuccessReturnData = false;
                 }
-                MainControl.Focus();
-            }
-            catch (Exception ea)
-            {
-                LogManager.DoLog(ea.Message);
-                SuccessReturnData = false;
-            }
-            dt = (DataTable)DbFindGridView.DataSource;
-            for (int i = 0; i < dt.Columns.Count; i++)
-            {
-                if (MainControl.Name == dt.Columns[i].Caption)
+                dt = (DataTable)DbFindGridView.DataSource;
+                for (int i = 0; i < dt.Columns.Count; i++)
                 {
-                    TextBoxValue = dt.Rows[e.RowIndex][i].ToString();
-                    break;
+                    if (MainControl.Name == dt.Columns[i].Caption)
+                    {
+                        TextBoxValue = dt.Rows[e.RowIndex][i].ToString();
+                        break;
+                    }
                 }
+                Dispose();
+                Close();
             }
-            Dispose();
-            Close();
         }
 
 

+ 2 - 1
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -396,7 +396,8 @@ namespace UAS_MES.Make
             sn_code.Clear();
             CollectData.Clear();
             CollectDataSonCode.Clear();
-            BaseUtil.CleanDataTableData(dt1);
+            if (dt1 != null)
+                BaseUtil.CleanDataTableData(dt1);
             RemainIndex = 0;
             OperateResult.AppendText(">>请采集序列号\n", Color.Black);
         }

+ 28 - 28
UAS-MES/FunctionCode/Make/Make_GetReMakeSN.Designer.cs

@@ -47,6 +47,8 @@
             this.pr_detail_label = new System.Windows.Forms.Label();
             this.ma_qty_label = new System.Windows.Forms.Label();
             this.groupBoxWithBorder2 = new UAS_MES.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
+            this.label2 = new System.Windows.Forms.Label();
+            this.PrintNum = new System.Windows.Forms.NumericUpDown();
             this.PrintLabel = new System.Windows.Forms.ComboBox();
             this.PrintLabel_label = new System.Windows.Forms.Label();
             this.AutoPrint = new UAS_MES.CustomControl.CustomCheckBox.AutoPrintCheckBox();
@@ -58,12 +60,10 @@
             this.ReWorkAsCurrentSN = new System.Windows.Forms.RadioButton();
             this.label1 = new System.Windows.Forms.Label();
             this.sn_code = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.PrintNum = new System.Windows.Forms.NumericUpDown();
-            this.label2 = new System.Windows.Forms.Label();
             this.groupBoxWithBorder1.SuspendLayout();
             this.groupBoxWithBorder2.SuspendLayout();
-            this.groupBoxWithBorder3.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
+            this.groupBoxWithBorder3.SuspendLayout();
             this.SuspendLayout();
             // 
             // groupBoxWithBorder1
@@ -156,9 +156,9 @@
             this.ma_code_label.AutoSize = true;
             this.ma_code_label.Location = new System.Drawing.Point(38, 42);
             this.ma_code_label.Name = "ma_code_label";
-            this.ma_code_label.Size = new System.Drawing.Size(72, 27);
+            this.ma_code_label.Size = new System.Drawing.Size(92, 27);
             this.ma_code_label.TabIndex = 11;
-            this.ma_code_label.Text = "工单号";
+            this.ma_code_label.Text = "工单号";
             // 
             // ma_code
             // 
@@ -295,6 +295,28 @@
             this.groupBoxWithBorder2.Text = "打印设置";
             this.groupBoxWithBorder2.TextColor = System.Drawing.Color.Black;
             // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(301, 139);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(92, 27);
+            this.label2.TabIndex = 18;
+            this.label2.Text = "打印份数";
+            // 
+            // PrintNum
+            // 
+            this.PrintNum.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.PrintNum.Location = new System.Drawing.Point(403, 139);
+            this.PrintNum.Name = "PrintNum";
+            this.PrintNum.Size = new System.Drawing.Size(120, 27);
+            this.PrintNum.TabIndex = 17;
+            this.PrintNum.Value = new decimal(new int[] {
+            1,
+            0,
+            0,
+            0});
+            // 
             // PrintLabel
             // 
             this.PrintLabel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -413,28 +435,6 @@
             this.sn_code.TabIndex = 0;
             this.sn_code.KeyDown += new System.Windows.Forms.KeyEventHandler(this.sn_code_KeyDown);
             // 
-            // PrintNum
-            // 
-            this.PrintNum.Font = new System.Drawing.Font("微软雅黑", 9F);
-            this.PrintNum.Location = new System.Drawing.Point(403, 139);
-            this.PrintNum.Name = "PrintNum";
-            this.PrintNum.Size = new System.Drawing.Size(120, 27);
-            this.PrintNum.TabIndex = 17;
-            this.PrintNum.Value = new decimal(new int[] {
-            1,
-            0,
-            0,
-            0});
-            // 
-            // label2
-            // 
-            this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(301, 139);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(92, 27);
-            this.label2.TabIndex = 18;
-            this.label2.Text = "打印份数";
-            // 
             // Make_GetReMakeSN
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
@@ -454,9 +454,9 @@
             this.groupBoxWithBorder1.PerformLayout();
             this.groupBoxWithBorder2.ResumeLayout(true);
             this.groupBoxWithBorder2.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).EndInit();
             this.groupBoxWithBorder3.ResumeLayout(true);
             this.groupBoxWithBorder3.PerformLayout();
-            ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).EndInit();
             this.ResumeLayout(true);
 
         }

+ 7 - 7
UAS-MES/FunctionCode/Make/Make_RePrintLabel.Designer.cs

@@ -61,7 +61,7 @@
             this.giftBox.AutoSize = true;
             this.giftBox.Checked = true;
             this.giftBox.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.giftBox.Location = new System.Drawing.Point(83, 50);
+            this.giftBox.Location = new System.Drawing.Point(83, 51);
             this.giftBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.giftBox.Name = "giftBox";
             this.giftBox.Size = new System.Drawing.Size(135, 35);
@@ -69,33 +69,33 @@
             this.giftBox.TabStop = true;
             this.giftBox.Text = "彩标打印";
             this.giftBox.UseVisualStyleBackColor = true;
-            this.giftBox.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
+            this.giftBox.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChange);
             // 
             // CartonBox
             // 
             this.CartonBox.AutoSize = true;
             this.CartonBox.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.CartonBox.Location = new System.Drawing.Point(431, 50);
+            this.CartonBox.Location = new System.Drawing.Point(431, 51);
             this.CartonBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.CartonBox.Name = "CartonBox";
             this.CartonBox.Size = new System.Drawing.Size(164, 35);
             this.CartonBox.TabIndex = 2;
             this.CartonBox.Text = "Carton打印";
             this.CartonBox.UseVisualStyleBackColor = true;
-            this.CartonBox.CheckedChanged += new System.EventHandler(this.CartonBox_CheckedChanged);
+            this.CartonBox.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChange);
             // 
             // fuselagel
             // 
             this.fuselagel.AutoSize = true;
             this.fuselagel.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.fuselagel.Location = new System.Drawing.Point(845, 50);
+            this.fuselagel.Location = new System.Drawing.Point(845, 51);
             this.fuselagel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.fuselagel.Name = "fuselagel";
             this.fuselagel.Size = new System.Drawing.Size(159, 35);
             this.fuselagel.TabIndex = 3;
             this.fuselagel.Text = "机身标打印";
             this.fuselagel.UseVisualStyleBackColor = true;
-            this.fuselagel.CheckedChanged += new System.EventHandler(this.fuselagel_CheckedChanged);
+            this.fuselagel.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChange);
             // 
             // label
             // 
@@ -279,7 +279,7 @@
             this.normalButton1.TabIndex = 194;
             this.normalButton1.Text = "打印";
             this.normalButton1.UseVisualStyleBackColor = false;
-            this.normalButton1.Click += new System.EventHandler(this.normalButton1_Click);
+            this.normalButton1.Click += new System.EventHandler(this.print_Click);
             // 
             // printNum
             // 

+ 24 - 34
UAS-MES/FunctionCode/Make/Make_RePrintLabel.cs

@@ -89,30 +89,17 @@ namespace UAS_MES.Make
         {
             //窗口关闭的时候
         }
-
-        private void radioButton1_CheckedChanged(object sender, EventArgs e)
+        private void radioButton_CheckedChange(object sender, EventArgs e)
         {
-            //切换打印类型,清除输入值、工单代码、产品编号,名称、打印模板、核对第一次输入的SN
-            if (giftBox.Checked)
+            RadioButton btn = sender as RadioButton;
+            if ((btn.Name == "giftBox" || btn.Name == "fuselagel") && btn.Checked)
             {
                 //如果是切换成彩盒或者机身标提示用户 输入SN
                 OperateResult.AppendText(">>请输入SN\n", Color.Black);
                 clearAll();
-            }
-        }
-        private void CartonBox_CheckedChanged(object sender, EventArgs e)
-        {
-            if (CartonBox.Checked) {
-                OperateResult.AppendText(">>请输入卡通箱号\n", Color.Black);
-                clearAll();
-            }
-        }
-
-        private void fuselagel_CheckedChanged(object sender, EventArgs e)
-        {
-            if (fuselagel.Checked)
+            } else if (btn.Name == "CartonBox" || btn.Checked)
             {
-                OperateResult.AppendText(">>请输入SN\n", Color.Black);
+                OperateResult.AppendText(">>请输入卡通箱号\n", Color.Black);
                 clearAll();
             }
         }
@@ -204,23 +191,24 @@ namespace UAS_MES.Make
                 indate[i] = Convert.ToDateTime(listA.Rows[i]["pl_indate"].ToString());
             }
         }
-
-        private void normalButton1_Click(object sender, EventArgs e)
+        private void print_Click(object sender, EventArgs e)
         {
             //输入值字段值不为空,打印不为空,有选中打印模板,才可以进行打印,打印前再次判断
-            if (inputValue.Text=="") {
+            if (inputValue.Text == "")
+            {
                 OperateResult.AppendText("<<无箱号或者序列号\n", Color.Red);
                 return;
             }
-            if (PrintLabel.Text=="") {
+            if (PrintLabel.Text == "")
+            {
                 OperateResult.AppendText("<<无打印模板\n", Color.Red);
                 return;
             }
             //打印类型 彩盒或者标签,再次判断是否已装箱,未转号
             if (giftBox.Checked || fuselagel.Checked)
             {
-                mapB = (DataTable)dh.ExecuteSql("select ms_outboxcode, nvl(ms_downstatus,0) ms_downstatus from makeserial where ms_id='"+ms_id+"' and ms_sncode='"+ inputValue.Text+"'", "select");
-                if (mapB.Rows.Count==0)
+                mapB = (DataTable)dh.ExecuteSql("select ms_outboxcode, nvl(ms_downstatus,0) ms_downstatus from makeserial where ms_id='" + ms_id + "' and ms_sncode='" + inputValue.Text + "'", "select");
+                if (mapB.Rows.Count == 0)
                 {
                     //无值提示用户序列号错误,不存在或者已经发生转号
                     OperateResult.AppendText("<<序列号错误,不存在或已经发生转号\n", Color.Red);
@@ -237,23 +225,24 @@ namespace UAS_MES.Make
                 OperateResult.AppendText("<<打印成功\n", Color.Green);
                 Print.CodeSoft(Tag.ToString(), lbl, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), Printer.Text, inputValue.Text, int.Parse(printNum.Text), indate[PrintLabel.SelectedIndex]);
                 //打印成功,记录日志commandlog , cl_operate彩盒或者机身标补打印,cl_result补打印成功
-                LogicHandler.DoCommandLog(Tag.ToString(),User.UserCode, "", User.UserLineCode, User.UserSourceCode, giftBox.Checked?"彩盒标补打印":"机身标补打印", "补打印成功", inputValue.Text, "");
+                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, giftBox.Checked ? "彩盒标补打印" : "机身标补打印", "补打印成功", inputValue.Text, "");
                 //如果ms_downstatus<>0,则更新ms_downstatus=-1 where ms_id=?id,同时插入记录至表 MAKEDOWN
-                if (mapB.Rows[0]["ms_downstatus"].ToString()=="0")
+                if (mapB.Rows[0]["ms_downstatus"].ToString() == "0")
                 {
-                    dh.ExecuteSql("update makeserial set ms_downstatus='-1' where ms_id='"+ms_id+"'","update");
+                    dh.ExecuteSql("update makeserial set ms_downstatus='-1' where ms_id='" + ms_id + "'", "update");
                     //插入数据
                     putInfo2MakeDown();
                 }
             }
             //打印类型为卡通箱标签
-            else if(CartonBox.Checked)
+            else if (CartonBox.Checked)
             {
                 //select pa_downstatus from package where pa_outboxcode=? 输入值code
-                mapB = (DataTable)dh.ExecuteSql("select pa_downstatus from package where pa_outboxcode='"+inputValue.Text+"'", "select");
+                mapB = (DataTable)dh.ExecuteSql("select pa_downstatus from package where pa_outboxcode='" + inputValue.Text + "'", "select");
                 //无值提示用户箱号错误,不存在。
-                if (mapB.Rows.Count==0) {
-                    OperateResult.AppendText("<<箱号:"+inputValue.Text+"错误,不存在\n", Color.Red);
+                if (mapB.Rows.Count == 0)
+                {
+                    OperateResult.AppendText("<<箱号:" + inputValue.Text + "错误,不存在\n", Color.Red);
                     return;
                 }
                 //判断通过,打印
@@ -265,10 +254,11 @@ namespace UAS_MES.Make
                 sql.Append("insert into commandlog(cl_id,cl_man,cl_date,cl_linecode,cl_sourcecode,cl_makecode,cl_operate,");
                 sql.Append("cl_result,cl_sncode,cl_code) values (commandlog_seq.nextval,:inman,sysdate,:linecode,:sourcecode,:makecode,");
                 sql.Append(":operate,:result,'','')");
-                dh.ExecuteSql(sql.GetString(), "insert",User.UserCode,User.UserLineCode,User.UserSourceCode,ms_makecode.Text,"卡通箱标签补打印,箱号:" + inputValue.Text, "补打印成功");
+                dh.ExecuteSql(sql.GetString(), "insert", User.UserCode, User.UserLineCode, User.UserSourceCode, ms_makecode.Text, "卡通箱标签补打印,箱号:" + inputValue.Text, "补打印成功");
                 //如果pa_downstatus<>0,则更新pa_downstatus=-1 where pa_outboxcode=?code,同时插入记录至表 MAKEDOWN
-                if (mapB.Rows[0]["pa_downstatus"].ToString()=="0") {
-                    dh.ExecuteSql("update package set pa_downstatus='-1' where pa_outboxcode='"+ inputValue.Text+"'", "update");
+                if (mapB.Rows[0]["pa_downstatus"].ToString() == "0")
+                {
+                    dh.ExecuteSql("update package set pa_downstatus='-1' where pa_outboxcode='" + inputValue.Text + "'", "update");
                     //插入MakeDown表
                     putInfo2MakeDown();
                 }