Procházet zdrojové kódy

修改记录错误日志,调整BUG

章政 před 7 roky
rodič
revize
3c0da29558

+ 27 - 26
UAS-出货标签管理/UAS_出货标签管理.Designer.cs

@@ -57,7 +57,6 @@
             this.pi_cardcode = new System.Windows.Forms.Label();
             this.pi_cardcode_label = new System.Windows.Forms.Label();
             this.Fresh = new System.Windows.Forms.LinkLabel();
-            this.label3 = new System.Windows.Forms.Label();
             this.CleanInputAfterCollect = new System.Windows.Forms.CheckBox();
             this.AllCollected = new System.Windows.Forms.Button();
             this.PowerSetting = new System.Windows.Forms.Button();
@@ -94,6 +93,8 @@
             this.ExportFileDialog = new System.Windows.Forms.FolderBrowserDialog();
             this.AttachInfo = new System.Windows.Forms.Button();
             this.pi_date = new System.Windows.Forms.Label();
+            this.label3 = new System.Windows.Forms.Label();
+            this.PrCodePanel = new System.Windows.Forms.Panel();
             this.groupBoxWithBorder1 = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.ExportData = new System.Windows.Forms.Button();
             this.label18 = new System.Windows.Forms.Label();
@@ -121,7 +122,6 @@
             this.Input = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.griddetno = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.sg_code = new UAS_LabelMachine.CustomControl.SearchTextBox();
-            this.MessageLog = new UAS_LabelMachine.CustomControl.RichText.RichTextAutoBottom();
             this.LabelInf = new UAS_LabelMachine.CustomControl.DataGridViewWithSerialNum();
             this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.pib_ifpick = new System.Windows.Forms.DataGridViewCheckBoxColumn();
@@ -184,6 +184,7 @@
             this.OutBoxCombox = new System.Windows.Forms.ComboBox();
             ((System.ComponentModel.ISupportInitialize)(this.Si_ItemDGV)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
+            this.PrCodePanel.SuspendLayout();
             this.groupBoxWithBorder1.SuspendLayout();
             this.CollectionProcess.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.LabelInf)).BeginInit();
@@ -484,16 +485,6 @@
             this.Fresh.Text = "刷新";
             this.Fresh.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.Refresh_LinkClicked);
             // 
-            // label3
-            // 
-            this.label3.AutoSize = true;
-            this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(2, 582);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(74, 21);
-            this.label3.TabIndex = 29;
-            this.label3.Text = "输出日志";
-            // 
             // CleanInputAfterCollect
             // 
             this.CleanInputAfterCollect.AutoSize = true;
@@ -786,6 +777,25 @@
             this.pi_date.TabIndex = 86;
             this.pi_date.Visible = false;
             // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label3.Location = new System.Drawing.Point(4, 4);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(65, 20);
+            this.label3.TabIndex = 87;
+            this.label3.Text = "物料编号";
+            // 
+            // PrCodePanel
+            // 
+            this.PrCodePanel.AutoScroll = true;
+            this.PrCodePanel.Controls.Add(this.label3);
+            this.PrCodePanel.Location = new System.Drawing.Point(7, 587);
+            this.PrCodePanel.Name = "PrCodePanel";
+            this.PrCodePanel.Size = new System.Drawing.Size(1246, 95);
+            this.PrCodePanel.TabIndex = 88;
+            // 
             // groupBoxWithBorder1
             // 
             this.groupBoxWithBorder1.Controls.Add(this.ExportData);
@@ -1119,16 +1129,6 @@
             this.sg_code.TextBoxEnable = false;
             this.sg_code.UserControlTextChanged += new UAS_LabelMachine.CustomControl.SearchTextBox.OnTextChange(this.sg_code_UserControlTextChanged);
             // 
-            // MessageLog
-            // 
-            this.MessageLog.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MessageLog.Location = new System.Drawing.Point(0, 610);
-            this.MessageLog.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.MessageLog.Name = "MessageLog";
-            this.MessageLog.Size = new System.Drawing.Size(1253, 74);
-            this.MessageLog.TabIndex = 28;
-            this.MessageLog.Text = "";
-            // 
             // LabelInf
             // 
             this.LabelInf.AllowUserToAddRows = false;
@@ -1791,6 +1791,7 @@
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(233)))), ((int)(((byte)(206)))));
             this.ClientSize = new System.Drawing.Size(1257, 686);
+            this.Controls.Add(this.PrCodePanel);
             this.Controls.Add(this.pi_date);
             this.Controls.Add(this.AttachInfo);
             this.Controls.Add(this.groupBoxWithBorder1);
@@ -1824,8 +1825,6 @@
             this.Controls.Add(this.label2);
             this.Controls.Add(this.sg_code);
             this.Controls.Add(this.label1);
-            this.Controls.Add(this.label3);
-            this.Controls.Add(this.MessageLog);
             this.Controls.Add(this.LabelInf);
             this.Controls.Add(this.pi_inoutno_label);
             this.Controls.Add(this.pi_inoutno);
@@ -1843,6 +1842,8 @@
             this.SizeChanged += new System.EventHandler(this.贴标机条码打印_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.Si_ItemDGV)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).EndInit();
+            this.PrCodePanel.ResumeLayout(false);
+            this.PrCodePanel.PerformLayout();
             this.groupBoxWithBorder1.ResumeLayout(false);
             this.groupBoxWithBorder1.PerformLayout();
             this.CollectionProcess.ResumeLayout(false);
@@ -1912,7 +1913,6 @@
         private CustomControl.EnterTextBox pi_inoutno;
         private System.Windows.Forms.Label pi_inoutno_label;
         private CustomControl.DataGridViewWithSerialNum LabelInf;
-        private CustomControl.RichText.RichTextAutoBottom MessageLog;
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.Label label2;
         private System.Windows.Forms.Label label22;
@@ -1949,7 +1949,6 @@
         private System.Windows.Forms.Label pi_cardcode;
         private System.Windows.Forms.Label pi_cardcode_label;
         private System.Windows.Forms.LinkLabel Fresh;
-        private System.Windows.Forms.Label label3;
         private System.Windows.Forms.CheckBox CleanInputAfterCollect;
         private System.Windows.Forms.Button AllCollected;
         private System.Windows.Forms.Button PowerSetting;
@@ -2015,5 +2014,7 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode2;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.Panel PrCodePanel;
     }
 }

+ 69 - 19
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -221,6 +221,7 @@ namespace UAS_LabelMachine
             {
                 MessageBox.Show("未安装CodeSoft软件或者版本不正确");
             }
+
             RefreshDBConnect.Interval = 60000;
             RefreshDBConnect.Start();
         }
@@ -231,9 +232,15 @@ namespace UAS_LabelMachine
             BaseUtil.SetFormValue(this.Controls, dt);
         }
 
+        bool AutoSzied = false;
+
         private void 贴标机条码打印_SizeChanged(object sender, EventArgs e)
         {
-            asc.controlAutoSize(this);
+            if (!AutoSzied)
+            {
+                asc.controlAutoSize(this);
+                AutoSzied = true;
+            }
         }
 
         private void GenerateBarCode_Click(object sender, EventArgs e)
@@ -609,7 +616,6 @@ namespace UAS_LabelMachine
             //提醒用户需要采集的数据
             RemindUser();
             RefreshProcessData();
-            MessageLog.AppendText(">>扫描到数据" + Input.Text + "\n", Color.Blue);
             //如果所采集的行的物料不一样的话,重新计算箱内容量
             if (CurrentRowIndex - 1 > 0)
             {
@@ -723,7 +729,6 @@ namespace UAS_LabelMachine
                 {
                     Inf += arr[i] + "  ";
                 }
-                MessageLog.AppendText(">>当前采集行" + (CurrentRowIndex + 1) + ",请采集" + Inf + "\n", Color.Green);
             }
         }
 
@@ -772,7 +777,6 @@ namespace UAS_LabelMachine
                                     PaintCell.Remove(cell);
                                 PaintCell.Add(cell, false);
                                 LabelInf.Refresh();
-                                MessageLog.AppendText(">>供应商物料编号不匹配\n", Color.Red);
                             }
                             else
                             {
@@ -797,7 +801,6 @@ namespace UAS_LabelMachine
                                     PaintCell.Remove(cell);
                                 PaintCell.Add(cell, false);
                                 LabelInf.Refresh();
-                                MessageLog.AppendText(">>数量不匹配\n", Color.Red);
                             }
                             else
                             {
@@ -822,7 +825,6 @@ namespace UAS_LabelMachine
                                     PaintCell.Remove(cell);
                                 PaintCell.Add(cell, false);
                                 LabelInf.Refresh();
-                                MessageLog.AppendText(">>品牌不匹配\n", Color.Red);
                             }
                             else
                             {
@@ -1159,6 +1161,7 @@ namespace UAS_LabelMachine
                     stw.ShowDialog();
                     //重置采集项次
                     CurrentItemIndex = 0;
+                    PaintRadioCheckBox();
                     LogManager.DoLog("输入单号【" + pi_inoutno.Text + "】");
                 }
                 else
@@ -1294,7 +1297,14 @@ namespace UAS_LabelMachine
                                 }
                                 if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
                                 {
-                                    SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
+                                    try
+                                    {
+                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
+                                    }
+                                    catch (Exception ex)
+                                    {
+                                        LogManager.DoLog(ex.StackTrace);
+                                    }
                                 }
                                 ParamLog.AppendLine("pib_id:" + LabelInf.Rows[i].Cells["pib_id1"].Value.ToString() + ",SingleDoc打印参数【" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(j + 1).Value);
                             }
@@ -1320,7 +1330,7 @@ namespace UAS_LabelMachine
                             //勾选为已打印
                             LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
                         }
-                        catch (Exception ex) { LogManager.DoLog(ex.Message); }
+                        catch (Exception ex) { LogManager.DoLog(ex.StackTrace); }
                     }
                 }
                 dh.BatchInsert("update prodiobarcode set pib_printdate=sysdate where pib_id=:pib_id", new string[] { "pib_id" }, SingleID.ToArray());
@@ -1662,7 +1672,7 @@ namespace UAS_LabelMachine
                             }
                         }
                     }
-                    catch { }
+                    catch (Exception ex) { LogManager.DoLog(ex.StackTrace); }
                 }
                 else
                 {
@@ -1692,7 +1702,7 @@ namespace UAS_LabelMachine
                     else
                         MessageBox.Show("该出入库单未找到该外箱号!");
                 }
-                catch (Exception) { }
+                catch (Exception ex) { LogManager.DoLog(ex.StackTrace); }
             }
             Outboxcode.Clear();
         }
@@ -1927,7 +1937,7 @@ namespace UAS_LabelMachine
                 OutBoxDoc.PrintDocument();
                 LogManager.DoLog("执行打印外箱,pib_id:" + LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString());
             }
-            catch (Exception ex) { MessageBox.Show(ex.Message); }
+            catch (Exception ex) { LogManager.DoLog(ex.StackTrace); }
         }
 
         private void CleanDetail_Click(object sender, EventArgs e)
@@ -2259,7 +2269,7 @@ namespace UAS_LabelMachine
                     else
                         LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + weekOfYear;
                 }
-                catch (Exception) { }
+                catch (Exception ex) { LogManager.DoLog(ex.StackTrace); }
             }
         }
 
@@ -2298,7 +2308,7 @@ namespace UAS_LabelMachine
                 if (dt.Rows.Count > 0)
                 {
                     try { OutboxCapacity.Value = (decimal)dt.Rows[0]["pr_qtyperplace"] / (decimal)dt.Rows[0]["pr_zxbzs"]; }
-                    catch (Exception) { }
+                    catch (Exception ex) { LogManager.DoLog(ex.StackTrace); }
                 }
                 try
                 {
@@ -2315,9 +2325,7 @@ namespace UAS_LabelMachine
                     }
                     GetPackingCode = true;
                 }
-                catch (Exception)
-                {
-                }
+                catch (Exception ex) { LogManager.DoLog(ex.StackTrace); }
             }
             else
             {
@@ -2372,7 +2380,7 @@ namespace UAS_LabelMachine
                     }
                 }
             }
-            catch (Exception) { }
+            catch (Exception ex) { LogManager.DoLog(ex.StackTrace); }
         }
 
         /// <summary>
@@ -2395,7 +2403,7 @@ namespace UAS_LabelMachine
                     }
                 }
             }
-            catch (Exception) { }
+            catch (Exception ex) { LogManager.DoLog(ex.StackTrace); }
         }
 
         /// <summary>
@@ -2418,7 +2426,7 @@ namespace UAS_LabelMachine
                     }
                 }
             }
-            catch (Exception) { }
+            catch (Exception ex) { LogManager.DoLog(ex.StackTrace); }
         }
 
         /// <summary>
@@ -2613,5 +2621,47 @@ namespace UAS_LabelMachine
         {
             dh.ExecuteSql("select count(1) from employee", "select");
         }
+
+        private void PaintRadioCheckBox()
+        {
+            DataTable dt = (DataTable)dh.ExecuteSql("select distinct pib_prodcode from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by  pib_prodcode", "select");
+            int RowRadioCount = Width / 100;
+            int RowIndex = 0;
+            Console.WriteLine(RowRadioCount);
+            int Y = 0;
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                RadioButton rb = new RadioButton();
+                //满了一格就换行
+                if (i % RowRadioCount == 0)
+                {
+                    Y = Y + 40;
+                    RowIndex = -1;
+                }
+                RowIndex = RowIndex + 1;
+                rb.Location = new Point(10 + 100 * RowIndex, Y);
+                rb.AutoSize = true;
+                rb.Name = "radioButton1";
+                rb.Size = new Size(100, 16);
+                rb.Text = dt.Rows[i]["pib_prodcode"].ToString();
+                rb.UseVisualStyleBackColor = true;
+                rb.CheckedChanged += Rb_CheckedChanged;
+                PrCodePanel.Controls.Add(rb);
+            }
+        }
+
+        private void Rb_CheckedChanged(object sender, EventArgs e)
+        {
+            RadioButton rb = (RadioButton)sender;
+            CurrentItemIndex = 0;
+            for (int i = 0; i < LabelInf.RowCount; i++)
+            {
+                if (rb.Text == LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
+                {
+                    CurrentRowIndex = i;
+                    break;
+                }
+            }
+        }
     }
 }