Browse Source

数据上传BUG

章政 6 years ago
parent
commit
167fc1de73

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

@@ -95,5 +95,21 @@ namespace UAS_LabelMachine.PublicMethod
             }
             return false;
         }
+
+        /// <summary>
+        /// 检测数据库未上传的数据,根据设置的上传条数上传数据   
+        /// </summary>
+        /// <param name="iInoutno"></param>
+        public static bool CheckUploadData(string iInoutno)
+        {
+            DataTable dt = (DataTable)adh.ExecuteSql("select pib_id,pib_outboxcode1,pib_outboxcode2,pib_custmidboxcode,pib_custoutboxcode,pib_lotno,pib_datecode,pib_ifmodify,-1 as pib_ifupload,pib_ifpick,pib_ifprint,pib_ifrecheck from prodiobarcode where pib_inoutno='" + iInoutno + "' and pib_ifupload=0 and pib_ifrecheck=-1  ", "select");
+            dh.CallProcedure("sp_uploadbarcode", dt);
+            //更新本地数据为已上传
+            if (adh.UpdateByCondition("prodiobarcode", "pib_ifupload=-1", "pib_inoutno='" + iInoutno + "' and pib_ifrecheck=-1 and pib_ifupload<>-1") > 0)
+            {
+                return true;
+            }
+            return false;
+        }
     }
 }

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

@@ -228,6 +228,7 @@
             this.BackendCheck = new UAS_LabelMachine.CustomControl.SerialPortWithTag();
             this.FrontendCheck = new UAS_LabelMachine.CustomControl.SerialPortWithTag();
             this.PLC1 = new UAS_LabelMachine.CustomControl.SerialPortWithTag();
+            this.UploadData = new System.Windows.Forms.Button();
             this.LogMenu.SuspendLayout();
             this.CollectionProcess.SuspendLayout();
             this.groupBox2.SuspendLayout();
@@ -2359,12 +2360,25 @@
             // 
             this.PLC1.Tag = "PLC1";
             // 
+            // UploadData
+            // 
+            this.UploadData.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.UploadData.Location = new System.Drawing.Point(234, 214);
+            this.UploadData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.UploadData.Name = "UploadData";
+            this.UploadData.Size = new System.Drawing.Size(68, 26);
+            this.UploadData.TabIndex = 103;
+            this.UploadData.Text = "上传数据";
+            this.UploadData.UseVisualStyleBackColor = true;
+            this.UploadData.Click += new System.EventHandler(this.UploadData_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(1389, 729);
+            this.Controls.Add(this.UploadData);
             this.Controls.Add(this.PageNum);
             this.Controls.Add(this.LastPage);
             this.Controls.Add(this.FirstPage);
@@ -2641,5 +2655,6 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode2;
         private System.Windows.Forms.ContextMenuStrip LogMenu;
         private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
+        private System.Windows.Forms.Button UploadData;
     }
 }

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

@@ -244,7 +244,7 @@ namespace UAS_LabelMachine
                     case "FrontendCheck":
                         //比对当前箱数量和容量
                         FrontCollect.Text = msg;
-                        if (!FrontCheckFunction( msg, out ErrorMsg))
+                        if (!FrontCheckFunction(msg, out ErrorMsg))
                         {
                             LogicHandler.SendDataToPLC(PLC1, PLCInstruct.FrontDataDelete);
                             MessageLog.AppendText(">>" + ErrorMsg + "\n", Color.Red);
@@ -354,7 +354,7 @@ namespace UAS_LabelMachine
                                 //自动匹配客户PN
                                 DataTable pndt = (DataTable)adh.ExecuteSql("select min(rownum) as rn from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pr_orispeccode='" + PN + "' and pib_ifpick=0", "select");
                                 int rownum = 0;
-                                if (pndt.Rows.Count > 0)
+                                if (pndt.Rows[0][0].ToString() != "")
                                 {
                                     rownum = int.Parse(pndt.Rows[0]["rn"].ToString());
                                     //如果需要翻页的话
@@ -1417,7 +1417,7 @@ namespace UAS_LabelMachine
             LoadGridData(new object(), new EventArgs());
         }
         int CurrentPage = 1;
-        int PageSize = 4;
+        int PageSize = 500;
         int DataSize = 0;
         int MaxPageSize = 0;
         /// <summary>
@@ -1895,7 +1895,7 @@ namespace UAS_LabelMachine
             string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
             int pib_pdno = int.Parse(LabelInf.Rows[CurrentRowIndex].Cells["pib_pdno"].Value.ToString());
             string ErrorMsg = "";
-            FrontCheckFunction( "", out ErrorMsg);
+            FrontCheckFunction("", out ErrorMsg);
         }
 
         private void ButtonRecheckPass_Click(object sender, EventArgs e)
@@ -2003,5 +2003,20 @@ namespace UAS_LabelMachine
                 LogMenu.Show(new Point(MessageLog.Location.X + 100, MessageLog.Location.Y + 20));
             }
         }
+
+        private void UploadData_Click(object sender, EventArgs e)
+        {
+            if (LogicHandler.CheckUploadData(pi_inoutno.Text))
+            {
+                DataTable dtt = LabelInf.DataSource as DataTable;
+                for (int i = 0; i < dtt.Rows.Count; i++)
+                {
+                    if (dtt.Rows[i]["pib_ifrecheck"].ToString() != "0" && dtt.Rows[i]["pib_ifupload"].ToString() == "0")
+                    {
+                        dtt.Rows[i]["pib_ifupload"] = -1;
+                    }
+                }
+            }
+        }
     }
 }