Browse Source

细节完善

章政 6 years ago
parent
commit
24b0092588

+ 15 - 0
UAS-出货标签管理(吉利通)/CustomerRule.Designer.cs

@@ -55,6 +55,7 @@
             this.groupBox1 = new System.Windows.Forms.GroupBox();
             this.cu_print_middc = new System.Windows.Forms.CheckBox();
             this.cu_print_outdc = new System.Windows.Forms.CheckBox();
+            this.cu_print_checkdatecode = new System.Windows.Forms.CheckBox();
             ((System.ComponentModel.ISupportInitialize)(this.cu_print_papercount)).BeginInit();
             this.groupBox1.SuspendLayout();
             this.SuspendLayout();
@@ -344,11 +345,24 @@
             this.cu_print_outdc.Text = "合并DC";
             this.cu_print_outdc.UseVisualStyleBackColor = true;
             // 
+            // cu_print_checkdatecode
+            // 
+            this.cu_print_checkdatecode.AutoSize = true;
+            this.cu_print_checkdatecode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.cu_print_checkdatecode.Location = new System.Drawing.Point(596, 220);
+            this.cu_print_checkdatecode.Name = "cu_print_checkdatecode";
+            this.cu_print_checkdatecode.Size = new System.Drawing.Size(137, 25);
+            this.cu_print_checkdatecode.TabIndex = 65;
+            this.cu_print_checkdatecode.Tag = "QTY";
+            this.cu_print_checkdatecode.Text = "校验DateCode";
+            this.cu_print_checkdatecode.UseVisualStyleBackColor = true;
+            // 
             // CustomerRule
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1082, 634);
+            this.Controls.Add(this.cu_print_checkdatecode);
             this.Controls.Add(this.cu_print_outdc);
             this.Controls.Add(this.cu_print_middc);
             this.Controls.Add(this.groupBox1);
@@ -412,5 +426,6 @@
         private System.Windows.Forms.GroupBox groupBox1;
         private System.Windows.Forms.CheckBox cu_print_middc;
         private System.Windows.Forms.CheckBox cu_print_outdc;
+        private System.Windows.Forms.CheckBox cu_print_checkdatecode;
     }
 }

+ 2 - 1
UAS-出货标签管理(吉利通)/CustomerRule.cs

@@ -50,7 +50,7 @@ namespace UAS_LabelMachine
             {
                 CUCODE = e.Node.Tag.ToString();
                 sql.Clear();
-                sql.Append("select cu_print_midlotno,cu_print_midspec,cu_print_recheck,cu_print_midpo,cu_print_midprod,nvl(cu_print_custprodmatchmodel,'Equal')cu_print_custprodmatchmodel,cu_print_outlotno,cu_print_outspec,cu_print_outpo");
+                sql.Append("select cu_print_midlotno,cu_print_midspec,cu_print_checkdatecode,cu_print_recheck,cu_print_midpo,cu_print_midprod,nvl(cu_print_custprodmatchmodel,'Equal')cu_print_custprodmatchmodel,cu_print_outlotno,cu_print_outspec,cu_print_outpo");
                 sql.Append(",cu_print_outprod,cu_print_checkonly,nvl(cu_print_papercount,0)cu_print_papercount,cu_print_regexpression from customer where cu_code='" + e.Node.Tag + "'");
                 dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 if (dt.Rows.Count > 0)
@@ -99,6 +99,7 @@ namespace UAS_LabelMachine
             sql.Append("cu_print_papercount='" + cu_print_papercount.Value + "',");
             sql.Append("cu_print_custprodmatchmodel='" + (Equal.Checked ? "Equal" : "Expression") + "',");
             sql.Append("cu_print_recheck='" + (CustProdAndSpec.Checked ? "CP" : "BR") + "',");
+            sql.Append("cu_print_checkdatecode='" + (cu_print_checkdatecode.Checked ? -1 : 0) + "',");
             sql.Append("cu_print_regexpression=:cu_print_regexpression where cu_code='" + CUCODE + "'");
             dh.ExecuteSql(sql.ToString(), "update", cu_print_regexpression.Text);
             MessageBox.Show("保存成功!", "提示");

+ 15 - 2
UAS-出货标签管理(吉利通)/PublicMethod/AccessDBHelper.cs

@@ -946,11 +946,24 @@ namespace UAS_LabelMachine
         public void AddColumFromDataTable(DataTable dt, string tablename)
         {
             DataTable dt2 = (DataTable)ExecuteSql("select top 1 * from " + tablename + "", "select");
-            foreach (var item in dt.Columns)
+            foreach (DataColumn item in dt.Columns)
             {
                 if (!dt2.Columns.Contains(item.ToString()))
                 {
-                    ExecuteSql("alter table " + tablename + " add [" + item.ToString() + "] varchar(200) NULL", "update");
+                    switch (item.DataType.ToString())
+                    {
+                        case "System.String":
+                            ExecuteSql("alter table " + tablename + " add [" + item.ToString() + "] varchar(200) NULL", "update");
+                            break;
+                        case "System.Decimal":
+                            ExecuteSql("alter table " + tablename + " add [" + item.ToString() + "] number NULL", "update");
+                            break;
+                        case "System.DateTime":
+                            ExecuteSql("alter table " + tablename + " add [" + item.ToString() + "] date NULL", "update");
+                            break;
+                        default:
+                            break;
+                    }
                 }
             }
         }

+ 0 - 1
UAS-出货标签管理(吉利通)/PublicMethod/GlobalEventsHandler.cs

@@ -44,7 +44,6 @@ namespace UAS_Labeling.PublicMethod
             dh = new DataHelper();
             if (User.UserAccountType != "admin")
             {
-                if (dh.getRowCount("labelprintpower") > 0)
                 {
                     string sql = " select * from labelprintpower where lpp_emcode = '" + User.UserCode + "' and lpp_manual=1";
                     DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");

+ 88 - 25
UAS-出货标签管理(吉利通)/UAS_出货标签管理.Designer.cs

@@ -94,6 +94,9 @@
             this.UploadData = new System.Windows.Forms.Button();
             this.PageSizeNum = new System.Windows.Forms.NumericUpDown();
             this.label28 = new System.Windows.Forms.Label();
+            this.button1 = new System.Windows.Forms.Button();
+            this.cu_print_checkonly = new System.Windows.Forms.CheckBox();
+            this.cu_print_checkdatecode = new System.Windows.Forms.CheckBox();
             this.front_sg_separator = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.FrontCollect = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.CollectionProcess = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
@@ -153,6 +156,9 @@
             this.pr_unit = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_lotno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_datecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_year = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_month = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_day = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_ifpick = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.pib_ifprint = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.pib_ifrecheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
@@ -237,7 +243,6 @@
             this.BackendCheck = new UAS_LabelMachine.CustomControl.SerialPortWithTag();
             this.FrontendCheck = new UAS_LabelMachine.CustomControl.SerialPortWithTag();
             this.PLC1 = new UAS_LabelMachine.CustomControl.SerialPortWithTag();
-            this.button1 = new System.Windows.Forms.Button();
             this.LogMenu.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.PageSizeNum)).BeginInit();
             this.CollectionProcess.SuspendLayout();
@@ -851,6 +856,44 @@
             this.label28.Text = "每页数量";
             this.label28.Visible = false;
             // 
+            // button1
+            // 
+            this.button1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.button1.Location = new System.Drawing.Point(234, 179);
+            this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(68, 26);
+            this.button1.TabIndex = 106;
+            this.button1.Text = "测试按钮";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // cu_print_checkonly
+            // 
+            this.cu_print_checkonly.AutoSize = true;
+            this.cu_print_checkonly.Enabled = false;
+            this.cu_print_checkonly.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.cu_print_checkonly.Location = new System.Drawing.Point(93, 218);
+            this.cu_print_checkonly.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.cu_print_checkonly.Name = "cu_print_checkonly";
+            this.cu_print_checkonly.Size = new System.Drawing.Size(63, 21);
+            this.cu_print_checkonly.TabIndex = 98;
+            this.cu_print_checkonly.Text = "仅复核";
+            this.cu_print_checkonly.UseVisualStyleBackColor = true;
+            // 
+            // cu_print_checkdatecode
+            // 
+            this.cu_print_checkdatecode.AutoSize = true;
+            this.cu_print_checkdatecode.Enabled = false;
+            this.cu_print_checkdatecode.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.cu_print_checkdatecode.Location = new System.Drawing.Point(93, 250);
+            this.cu_print_checkdatecode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.cu_print_checkdatecode.Name = "cu_print_checkdatecode";
+            this.cu_print_checkdatecode.Size = new System.Drawing.Size(109, 21);
+            this.cu_print_checkdatecode.TabIndex = 107;
+            this.cu_print_checkdatecode.Text = "校验DateCode";
+            this.cu_print_checkdatecode.UseVisualStyleBackColor = true;
+            // 
             // front_sg_separator
             // 
             this.front_sg_separator.Enabled = false;
@@ -912,9 +955,9 @@
             this.CollectionProcess.Controls.Add(this.Process);
             this.CollectionProcess.Font = new System.Drawing.Font("微软雅黑", 12F);
             this.CollectionProcess.Location = new System.Drawing.Point(334, 6);
-            this.CollectionProcess.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.CollectionProcess.Margin = new System.Windows.Forms.Padding(2);
             this.CollectionProcess.Name = "CollectionProcess";
-            this.CollectionProcess.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.CollectionProcess.Padding = new System.Windows.Forms.Padding(2);
             this.CollectionProcess.Size = new System.Drawing.Size(299, 268);
             this.CollectionProcess.TabIndex = 80;
             this.CollectionProcess.TabStop = false;
@@ -1388,6 +1431,9 @@
             this.pr_unit,
             this.pib_lotno,
             this.pib_datecode,
+            this.pib_year,
+            this.pib_month,
+            this.pib_day,
             this.pib_ifpick,
             this.pib_ifprint,
             this.pib_ifrecheck,
@@ -1409,6 +1455,7 @@
             this.LabelInf.RowTemplate.Height = 23;
             this.LabelInf.Size = new System.Drawing.Size(1385, 326);
             this.LabelInf.TabIndex = 27;
+            this.LabelInf.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.LabelInf_CellEndEdit);
             this.LabelInf.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.LabelInf_CellPainting);
             this.LabelInf.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.LabelInf_DataError);
             // 
@@ -1541,6 +1588,27 @@
             this.pib_datecode.Name = "pib_datecode";
             this.pib_datecode.Width = 78;
             // 
+            // pib_year
+            // 
+            this.pib_year.DataPropertyName = "pib_year";
+            this.pib_year.HeaderText = "年";
+            this.pib_year.Name = "pib_year";
+            this.pib_year.Width = 42;
+            // 
+            // pib_month
+            // 
+            this.pib_month.DataPropertyName = "pib_month";
+            this.pib_month.HeaderText = "月";
+            this.pib_month.Name = "pib_month";
+            this.pib_month.Width = 42;
+            // 
+            // pib_day
+            // 
+            this.pib_day.DataPropertyName = "pib_day";
+            this.pib_day.HeaderText = "日";
+            this.pib_day.Name = "pib_day";
+            this.pib_day.Width = 42;
+            // 
             // pib_ifpick
             // 
             this.pib_ifpick.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
@@ -1688,7 +1756,7 @@
             this.SingleLabel.Location = new System.Drawing.Point(638, 6);
             this.SingleLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SingleLabel.Name = "SingleLabel";
-            this.SingleLabel.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.SingleLabel.Padding = new System.Windows.Forms.Padding(2);
             this.SingleLabel.Size = new System.Drawing.Size(180, 269);
             this.SingleLabel.TabIndex = 77;
             this.SingleLabel.TabStop = false;
@@ -1829,7 +1897,7 @@
             // 
             this.SingleLabelPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.SingleLabelPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelPrint.Location = new System.Drawing.Point(186, 108);
+            this.SingleLabelPrint.Location = new System.Drawing.Point(103, 112);
             this.SingleLabelPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SingleLabelPrint.Name = "SingleLabelPrint";
             this.SingleLabelPrint.Size = new System.Drawing.Size(68, 26);
@@ -1891,7 +1959,7 @@
             this.MidLabel.Location = new System.Drawing.Point(823, 6);
             this.MidLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.MidLabel.Name = "MidLabel";
-            this.MidLabel.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.MidLabel.Padding = new System.Windows.Forms.Padding(2);
             this.MidLabel.Size = new System.Drawing.Size(279, 269);
             this.MidLabel.TabIndex = 78;
             this.MidLabel.TabStop = false;
@@ -2004,9 +2072,9 @@
             this.groupBoxWithBorder2.Controls.Add(this.cu_print_midlotno);
             this.groupBoxWithBorder2.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.groupBoxWithBorder2.Location = new System.Drawing.Point(172, 126);
-            this.groupBoxWithBorder2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.groupBoxWithBorder2.Margin = new System.Windows.Forms.Padding(2);
             this.groupBoxWithBorder2.Name = "groupBoxWithBorder2";
-            this.groupBoxWithBorder2.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.groupBoxWithBorder2.Padding = new System.Windows.Forms.Padding(2);
             this.groupBoxWithBorder2.Size = new System.Drawing.Size(101, 138);
             this.groupBoxWithBorder2.TabIndex = 81;
             this.groupBoxWithBorder2.TabStop = false;
@@ -2236,9 +2304,9 @@
             this.OutBoxLabel.Controls.Add(this.OutBoxCombox);
             this.OutBoxLabel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.OutBoxLabel.Location = new System.Drawing.Point(1106, 6);
-            this.OutBoxLabel.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.OutBoxLabel.Margin = new System.Windows.Forms.Padding(2);
             this.OutBoxLabel.Name = "OutBoxLabel";
-            this.OutBoxLabel.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.OutBoxLabel.Padding = new System.Windows.Forms.Padding(2);
             this.OutBoxLabel.Size = new System.Drawing.Size(278, 269);
             this.OutBoxLabel.TabIndex = 79;
             this.OutBoxLabel.TabStop = false;
@@ -2293,9 +2361,9 @@
             this.groupBoxWithBorder3.Controls.Add(this.cu_print_outlotno);
             this.groupBoxWithBorder3.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.groupBoxWithBorder3.Location = new System.Drawing.Point(172, 126);
-            this.groupBoxWithBorder3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.groupBoxWithBorder3.Margin = new System.Windows.Forms.Padding(2);
             this.groupBoxWithBorder3.Name = "groupBoxWithBorder3";
-            this.groupBoxWithBorder3.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.groupBoxWithBorder3.Padding = new System.Windows.Forms.Padding(2);
             this.groupBoxWithBorder3.Size = new System.Drawing.Size(101, 138);
             this.groupBoxWithBorder3.TabIndex = 96;
             this.groupBoxWithBorder3.TabStop = false;
@@ -2481,24 +2549,14 @@
             this.PLC1.SleepTime = 0;
             this.PLC1.Tag = "PLC1";
             // 
-            // button1
-            // 
-            this.button1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button1.Location = new System.Drawing.Point(150, 216);
-            this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(68, 26);
-            this.button1.TabIndex = 106;
-            this.button1.Text = "测试按钮";
-            this.button1.UseVisualStyleBackColor = true;
-            this.button1.Click += new System.EventHandler(this.button1_Click);
-            // 
             // UAS_出货标签打印
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             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(1390, 733);
+            this.Controls.Add(this.cu_print_checkdatecode);
+            this.Controls.Add(this.cu_print_checkonly);
             this.Controls.Add(this.button1);
             this.Controls.Add(this.label28);
             this.Controls.Add(this.PageSizeNum);
@@ -2758,6 +2816,7 @@
         private System.Windows.Forms.LinkLabel OutDocRefresh;
         private System.Windows.Forms.NumericUpDown PageSizeNum;
         private System.Windows.Forms.Label label28;
+        private System.Windows.Forms.Button button1;
         private System.Windows.Forms.DataGridViewCheckBoxColumn Choose;
         private System.Windows.Forms.DataGridViewTextBoxColumn pd_id;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_id1;
@@ -2774,6 +2833,9 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_unit;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_lotno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_datecode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pib_year;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pib_month;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pib_day;
         private System.Windows.Forms.DataGridViewCheckBoxColumn pib_ifpick;
         private System.Windows.Forms.DataGridViewCheckBoxColumn pib_ifprint;
         private System.Windows.Forms.DataGridViewCheckBoxColumn pib_ifrecheck;
@@ -2789,6 +2851,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.Button button1;
+        private System.Windows.Forms.CheckBox cu_print_checkonly;
+        private System.Windows.Forms.CheckBox cu_print_checkdatecode;
     }
 }

+ 100 - 49
UAS-出货标签管理(吉利通)/UAS_出货标签管理.cs

@@ -23,7 +23,7 @@ namespace UAS_LabelMachine
         AutoSizeFormClass asc = new AutoSizeFormClass();
 
         DataHelper dh;
-         
+
         AccessDBHelper adh;
 
         AccessDBHelper front_adh;
@@ -200,7 +200,7 @@ namespace UAS_LabelMachine
                 {
                     BackendCheck.SleepTime = sleeptime;
                 }
-                BackendCheck.BaudRate = int.Parse(dr[0] ["BaudRate"].ToString());
+                BackendCheck.BaudRate = int.Parse(dr[0]["BaudRate"].ToString());
                 BackendCheck.DataReceived += Serial_DataReceived;
                 BackendCheck.Open();
             }
@@ -280,6 +280,16 @@ namespace UAS_LabelMachine
                         }
                         else
                         {
+                            if (cu_print_checkdatecode.Checked)
+                            {
+                                string datecode = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
+                                string lotno = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
+                                if (datecode == "" || lotno == "")
+                                {
+                                    MessageLog.AppendText(">>设定必须采集DateCode内容,请先采集再打印\n", Color.Red);
+                                    return;
+                                }
+                            }
                             //勾选了单盘自动打印
                             if (SingleLabelAutoPrint.Checked)
                             {
@@ -298,7 +308,7 @@ namespace UAS_LabelMachine
                             //勾选了中盒自动打印
                             if (MidLabelAutoPrint.Checked)
                                 AutoPrintMidLabel();
-                            LogicHandler.SendDataToPLC(PLC1, PLCInstruct.FrontDataPass,adh);
+                            LogicHandler.SendDataToPLC(PLC1, PLCInstruct.FrontDataPass, adh);
                             LabelInf.Invalidate();
                         }
                         break;
@@ -386,24 +396,21 @@ namespace UAS_LabelMachine
                                         DataTable pndt = (DataTable)adh.ExecuteSql(sql, "select");
                                         if (pndt.Rows[0][0].ToString() != "")
                                         {
-                                            if (CheckType == "FrontCheck")
+                                            rownum = int.Parse(pndt.Rows[0]["rn"].ToString());
+                                            //如果需要翻页的话
+                                            if (!(rownum >= (PageSize * (CurrentPage - 1) + 1) && rownum <= PageSize * CurrentPage))
+                                            {
+                                                CurrentPage = rownum / PageSize + 1;
+                                                LoadGridData();
+                                                CurrentRowIndex = rownum % PageSize == 0 ? PageSize - 1 : rownum % PageSize - 1;
+                                                if (CurrentRowIndex - 10 > 0)
+                                                    LabelInf.FirstDisplayedScrollingRowIndex = CurrentRowIndex - 5;
+                                            }
+                                            else
                                             {
-                                                rownum = int.Parse(pndt.Rows[0]["rn"].ToString());
-                                                //如果需要翻页的话
-                                                if (!(rownum >= (PageSize * (CurrentPage - 1) + 1) && rownum <= PageSize * CurrentPage))
-                                                {
-                                                    CurrentPage = rownum / PageSize + 1;
-                                                    LoadGridData();
-                                                    CurrentRowIndex = rownum % PageSize == 0 ? PageSize - 1 : rownum % PageSize - 1;
-                                                    if (CurrentRowIndex - 10 > 0)
-                                                        LabelInf.FirstDisplayedScrollingRowIndex = CurrentRowIndex - 5;
-                                                }
-                                                else
-                                                {
-                                                    CurrentRowIndex = rownum % PageSize == 0 ? PageSize - 1 : rownum % PageSize - 1;
-                                                    if (CurrentRowIndex - 10 > 0)
-                                                        LabelInf.FirstDisplayedScrollingRowIndex = CurrentRowIndex - 5;
-                                                }
+                                                CurrentRowIndex = rownum % PageSize == 0 ? PageSize - 1 : rownum % PageSize - 1;
+                                                if (CurrentRowIndex - 10 > 0)
+                                                    LabelInf.FirstDisplayedScrollingRowIndex = CurrentRowIndex - 5;
                                             }
                                         }
                                         else
@@ -534,7 +541,7 @@ namespace UAS_LabelMachine
                         if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString() && !GetBarcode)
                         {
                             LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
-                            LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray,front_adh);
+                            LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, front_adh);
                             LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
                             outboxcode1 = outboxcode1 + 1;
                         }
@@ -659,7 +666,6 @@ namespace UAS_LabelMachine
             MessageLog.AppendText(msg + "\n");
             string[] msgArr = msg.Split(back_sg_separator.Text.ToCharArray());
             //需要校验2项数据,完成校验后此项的值需要为2则表示校验成功
-            int checkItemCount = 0;
             List<string> CheckItem = new List<string>();
             string pibid = "";
             string pibid1 = "";
@@ -680,7 +686,6 @@ namespace UAS_LabelMachine
                         {
                             pibid1 = pibid;
                             CheckItem.Remove("客户料号");
-                            checkItemCount = checkItemCount + 1;
                         }
                     }
                     //验证正则匹配过之后相等
@@ -690,13 +695,11 @@ namespace UAS_LabelMachine
                         if (re.Match(msgArr[i]).Value == LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString())
                         {
                             CheckItem.Remove("客户料号");
-                            checkItemCount = checkItemCount + 1;
                         }
                     }
                     if (RegexMatch("BackCheck", msgArr[i], out ErrorMsg))
                     {
                         CheckItem.Remove("原厂型号");
-                        checkItemCount = checkItemCount + 1;
                     }
                 }
                 else if (RecheckBarcode.Checked)
@@ -706,21 +709,19 @@ namespace UAS_LabelMachine
                         CheckItem.Add("唯一条码");
                         CheckItem.Add("原厂型号");
                     }
+                    if (RegexMatch("BackCheck", msgArr[i], out ErrorMsg))
+                    {
+                        CheckItem.Remove("原厂型号");
+                    }
                     pibid = back_adh.getFieldDataByCondition("prodiobarcode", "min(pib_id)", "pib_inoutno='" + pi_inoutno.Text + "' and pib_custbarcode='" + msgArr[i] + "' and pib_ifrecheck=0").ToString();
                     if (pibid != "")
                     {
                         pibid1 = pibid;
                         CheckItem.Remove("唯一条码");
-                        checkItemCount = checkItemCount + 1;
-                    }
-                    if (RegexMatch("BackCheck", msgArr[i], out ErrorMsg))
-                    {
-                        CheckItem.Remove("原厂型号");
-                        checkItemCount = checkItemCount + 1;
                     }
                 }
             }
-            if (checkItemCount != 2)
+            if (CheckItem.Count != 0)
             {
                 string Item = "";
                 for (int i = 0; i < CheckItem.Count; i++)
@@ -732,12 +733,19 @@ namespace UAS_LabelMachine
             }
             else
             {
-                DataRow[] dr = LabelInfDataTable.Select("pib_id=" + pibid1);
+                DataRow[] dr = LabelInfDataTable.Select("pib_id=" + pibid1 + " and pr_orispeccode='" + PN + "'");
                 if (dr.Length > 0)
                 {
                     dr[0]["pib_ifrecheck"] = -1;
+                    dr[0]["pib_lotno"] = LotNo;
+                    dr[0]["pib_datecode"] = DateCode;
                 }
-                back_adh.ExecuteSql("update prodiobarcode set pib_ifrecheck=-1 where pib_id=" + pibid1, "update");
+                else
+                {
+                    ErrorMsg = "未匹配到合适的原厂型号";
+                    return false;
+                }
+                back_adh.ExecuteSql("update prodiobarcode set pib_ifrecheck=-1,pib_datecode='" + DateCode + "',pib_lotno='" + LotNo + "' where pib_id=" + pibid1 + " and pr_orispeccode='" + PN + "'", "update");
             }
             LabelInf.Invalidate();
             RefreshProcessData();
@@ -958,7 +966,7 @@ namespace UAS_LabelMachine
                     //}
                     //获取客户自定义设置
                     sql.Clear();
-                    sql.Append("select cu_print_middc,cu_print_outdc,cu_print_midlotno,nvl(cu_print_custprodmatchmodel,'Equal')cu_print_custprodmatchmodel,cu_print_midspec,cu_print_midpo,cu_print_midprod,cu_print_outlotno,cu_print_outspec,cu_print_outpo");
+                    sql.Append("select cu_print_middc,cu_print_outdc,cu_print_checkdatecode,cu_print_midlotno,nvl(cu_print_custprodmatchmodel,'Equal')cu_print_custprodmatchmodel,cu_print_midspec,cu_print_midpo,cu_print_midprod,cu_print_outlotno,cu_print_outspec,cu_print_outpo");
                     sql.Append(",cu_print_outprod,cu_print_checkonly,nvl(cu_print_papercount,0)cu_print_papercount,cu_print_regexpression,cu_print_recheck from customer where cu_code='" + pi_cardcode.Text + "'");
                     dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                     if (dt.Rows.Count > 0)
@@ -1097,6 +1105,16 @@ namespace UAS_LabelMachine
                     //勾选了并且未打印
                     if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString() != "True")
                     {
+                        if (cu_print_checkdatecode.Checked)
+                        {
+                            string datecode = LabelInf.Rows[i].Cells["pib_datecode"].Value.ToString();
+                            string lotno = LabelInf.Rows[i].Cells["pib_lotno"].Value.ToString();
+                            if (datecode == "" || lotno == "")
+                            {
+                                MessageLog.AppendText(">>设定必须采集DateCode内容,请先采集再打印\n", Color.Red);
+                                return;
+                            }
+                        }
                         CheckedRowCount = CheckedRowCount + 1;
                         CurrentRowIndex = i;
                         //以标签模板的参数为基准,循环取数
@@ -1374,6 +1392,16 @@ namespace UAS_LabelMachine
 
         private void MidBoxCodePrint(int rowindex)
         {
+            if (cu_print_checkdatecode.Checked)
+            {
+                string datecode = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
+                string lotno = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
+                if (datecode == "" || lotno == "")
+                {
+                    MessageLog.AppendText(">>设定必须采集DateCode内容,请先采集再打印\n", Color.Red);
+                    return;
+                }
+            }
             //获取对应行的pib_id
             string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
             string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
@@ -1440,6 +1468,16 @@ namespace UAS_LabelMachine
         /// </summary>
         private void OutBoxCodePrint(int rowindex)
         {
+            if (cu_print_checkdatecode.Checked)
+            {
+                string datecode = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
+                string lotno = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
+                if (datecode == "" || lotno == "")
+                {
+                    MessageLog.AppendText(">>设定必须采集DateCode内容,请先采集再打印\n", Color.Red);
+                    return;
+                }
+            }
             LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, adh);
             //获取对应行的pib_id
             string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
@@ -1567,7 +1605,7 @@ namespace UAS_LabelMachine
             {
                 //嵌套查询重置RowNum
                 sql.Clear();
-                sql.Append("select t.*,rownum from (select pd_ordercode,pr_detail,pib_custoutboxcode,pib_custmidboxcode,pr_orispeccode,pd_id,pd_custprodcode,pib_indate,pi_date,pib_inoutno,pd_custprodspec,");
+                sql.Append("select t.*,rownum from (select pd_ordercode,pib_year,pib_month,pib_day,pr_detail,pib_custoutboxcode,pib_custmidboxcode,pr_orispeccode,pd_id,pd_custprodcode,pib_indate,pi_date,pib_inoutno,pd_custprodspec,");
                 sql.Append("nvl(pib_ifrecheck,0)pib_ifrecheck,nvl(pib_ifupload,0)pib_ifupload,nvl(pib_ifmodify,0)pib_ifmodify,pd_pocode,pib_madein,pib_custbarcode,pib_id,pib_pdid,pib_piid,");
                 sql.Append("pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,pib_lotno,pib_datecode,pib_qty,pr_spec,pi_title,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,");
                 sql.Append("pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint from prodiobarcode left join prodinout on pib_piid=pi_id left join prodiodetail on pib_piid=pd_piid and  ");
@@ -1614,19 +1652,6 @@ namespace UAS_LabelMachine
             }
             //获取所有的匹配脚本
             ScanGroup = (DataTable)dh.ExecuteSql("select distinct sg_brand,sg_id,sg_name,sg_script from prodiobarcode left join scangroup on pib_brand=sg_brand where pib_inoutno='" + pi_inoutno.Text + "' and sg_id is not null and nvl(sg_autolabel,0)=0", "select");
-            //绑定数据之后往下找到未采集的数据显示在当前采集的栏目
-            for (int i = 0; i < LabelInf.RowCount; i++)
-            {
-                if (LabelInf.Rows[i].Cells["pib_ifrecheck"].FormattedValue.ToString() != "True")
-                {
-                    CurrentRowIndex = LabelInf.Rows[i].Cells["pib_prodcode"].RowIndex;
-                    break;
-                }
-                else
-                {
-                    CurrentRowIndex = LabelInf.RowCount - 1;
-                }
-            }
         }
 
 
@@ -2206,5 +2231,31 @@ namespace UAS_LabelMachine
         {
             adh.ExecuteSql("delete from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "'", "delete");
         }
+
+        private void LabelInf_CellEndEdit(object sender, DataGridViewCellEventArgs e)
+        {
+            string columnname = LabelInf.Columns[e.ColumnIndex].Name;
+            if (columnname == "pib_lotno" || columnname == "pib_datecode")
+            {
+                string data = LabelInf.Rows[e.RowIndex].Cells[columnname].Value.ToString();
+                if (data != "")
+                {
+                    string close = MessageBox.Show(this.ParentForm, "确认修改该出货明细行" + columnname.Replace("pib_", ""), "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                    if (close.ToString() == "Yes")
+                    {
+                        string pib_pdno = LabelInf.Rows[e.RowIndex].Cells["pib_pdno"].Value.ToString();
+                        DataRow[] dr = (LabelInf.DataSource as DataTable).Select("pib_pdno=" + pib_pdno);
+                        for (int i = 0; i < dr.Length; i++)
+                        {
+                            dr[i][columnname] = data;
+                            dr[i]["pib_ifmodify"] = -1;
+                            dr[i]["pib_ifpick"] = -1;
+                        }
+                        adh.UpdateByCondition("prodiobarcode", columnname + "='" + data + "',pib_ifmodify=-1,pib_ifpick=-1", "pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pib_pdno + "");
+                        LabelInf.Invalidate();
+                    }
+                }
+            }
+        }
     }
 }

+ 9 - 0
UAS-出货标签管理(吉利通)/UAS_出货标签管理.resx

@@ -150,6 +150,15 @@
   <metadata name="pr_unit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="pib_year.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pib_month.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pib_day.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="pib_ifrecheck.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>