Quellcode durchsuchen

完工入库数据采集表格完善

Hcsy vor 8 Jahren
Ursprung
Commit
653d312f80

+ 5 - 0
UAS-MES/FunctionCode/Warehouse/Warehouse_FinishedProductOut.Designer.cs

@@ -28,6 +28,7 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Warehouse_FinishedProductOut));
             this.pi_inoutno_label = new System.Windows.Forms.Label();
             this.pi_titile_label = new System.Windows.Forms.Label();
@@ -61,8 +62,10 @@
             this.NewProdInOut = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.ProdDetail = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.pi_inoutno = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.bindingSource = new System.Windows.Forms.BindingSource(this.components);
             this.panel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.InOutDetailDGV)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit();
             this.SuspendLayout();
             // 
             // pi_inoutno_label
@@ -489,6 +492,7 @@
             this.panel1.ResumeLayout(true);
             this.panel1.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.InOutDetailDGV)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit();
             this.ResumeLayout(true);
             this.PerformLayout();
 
@@ -528,5 +532,6 @@
         private CustomControl.ValueLabel.ValueLabel ungetqty;
         private CustomControl.ValueLabel.ValueLabel getqty;
         private CustomControl.ValueLabel.ValueLabel boxqty;
+        private System.Windows.Forms.BindingSource bindingSource;
     }
 }

+ 3 - 0
UAS-MES/FunctionCode/Warehouse/Warehouse_FinishedProductOut.resx

@@ -300,4 +300,7 @@
         ROJSU3qXjMKwG/vjzEz/skOI3Zqgv7AAAAAASUVORK5CYII=
 </value>
   </data>
+  <metadata name="bindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
 </root>

+ 62 - 47
UAS-MES/FunctionCode/Warehouse/Warehouse_ProductMakeIn.Designer.cs

@@ -28,12 +28,8 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             this.InOutDetailDGV = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
-            this.pim_outboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pim_mac = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pim_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_detail = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_spec = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.getqty = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.label8 = new System.Windows.Forms.Label();
             this.cancel = new UAS_MES.CustomControl.CustomCheckBox.CustomCheckBox();
@@ -43,7 +39,15 @@
             this.palletBtn = new System.Windows.Forms.RadioButton();
             this.label1 = new System.Windows.Forms.Label();
             this.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
+            this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
+            this.pim_outboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pim_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pim_mac = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pim_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_detail = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_spec = new System.Windows.Forms.DataGridViewTextBoxColumn();
             ((System.ComponentModel.ISupportInitialize)(this.InOutDetailDGV)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit();
             this.SuspendLayout();
             // 
             // InOutDetailDGV
@@ -52,6 +56,7 @@
             this.InOutDetailDGV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.InOutDetailDGV.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.pim_outboxcode,
+            this.pim_id,
             this.pim_mac,
             this.pim_prodcode,
             this.pr_detail,
@@ -64,43 +69,6 @@
             this.InOutDetailDGV.Size = new System.Drawing.Size(665, 329);
             this.InOutDetailDGV.TabIndex = 219;
             // 
-            // pim_outboxcode
-            // 
-            this.pim_outboxcode.DataPropertyName = "pim_outboxcode";
-            this.pim_outboxcode.HeaderText = "栈板/箱号";
-            this.pim_outboxcode.MinimumWidth = 120;
-            this.pim_outboxcode.Name = "pim_outboxcode";
-            this.pim_outboxcode.ReadOnly = true;
-            this.pim_outboxcode.Width = 120;
-            // 
-            // pim_mac
-            // 
-            this.pim_mac.DataPropertyName = "pim_mac";
-            this.pim_mac.HeaderText = "SN号";
-            this.pim_mac.Name = "pim_mac";
-            this.pim_mac.ReadOnly = true;
-            // 
-            // pim_prodcode
-            // 
-            this.pim_prodcode.DataPropertyName = "pim_prodcode";
-            this.pim_prodcode.HeaderText = "产品代码";
-            this.pim_prodcode.Name = "pim_prodcode";
-            this.pim_prodcode.ReadOnly = true;
-            // 
-            // pr_detail
-            // 
-            this.pr_detail.DataPropertyName = "pr_detail";
-            this.pr_detail.HeaderText = "名称";
-            this.pr_detail.Name = "pr_detail";
-            this.pr_detail.ReadOnly = true;
-            // 
-            // pr_spec
-            // 
-            this.pr_spec.DataPropertyName = "pr_spec";
-            this.pr_spec.HeaderText = "规格";
-            this.pr_spec.Name = "pr_spec";
-            this.pr_spec.ReadOnly = true;
-            // 
             // getqty
             // 
             this.getqty.AutoSize = true;
@@ -205,6 +173,50 @@
             this.OperateResult.TabIndex = 235;
             this.OperateResult.Text = "";
             // 
+            // pim_outboxcode
+            // 
+            this.pim_outboxcode.DataPropertyName = "pim_outboxcode";
+            this.pim_outboxcode.HeaderText = "栈板/箱号";
+            this.pim_outboxcode.MinimumWidth = 120;
+            this.pim_outboxcode.Name = "pim_outboxcode";
+            this.pim_outboxcode.ReadOnly = true;
+            this.pim_outboxcode.Width = 120;
+            // 
+            // pim_id
+            // 
+            this.pim_id.DataPropertyName = "pim_id";
+            this.pim_id.HeaderText = "pim_id";
+            this.pim_id.Name = "pim_id";
+            this.pim_id.Visible = false;
+            // 
+            // pim_mac
+            // 
+            this.pim_mac.DataPropertyName = "pim_mac";
+            this.pim_mac.HeaderText = "SN号";
+            this.pim_mac.Name = "pim_mac";
+            this.pim_mac.ReadOnly = true;
+            // 
+            // pim_prodcode
+            // 
+            this.pim_prodcode.DataPropertyName = "pim_prodcode";
+            this.pim_prodcode.HeaderText = "产品代码";
+            this.pim_prodcode.Name = "pim_prodcode";
+            this.pim_prodcode.ReadOnly = true;
+            // 
+            // pr_detail
+            // 
+            this.pr_detail.DataPropertyName = "pr_detail";
+            this.pr_detail.HeaderText = "名称";
+            this.pr_detail.Name = "pr_detail";
+            this.pr_detail.ReadOnly = true;
+            // 
+            // pr_spec
+            // 
+            this.pr_spec.DataPropertyName = "pr_spec";
+            this.pr_spec.HeaderText = "规格";
+            this.pr_spec.Name = "pr_spec";
+            this.pr_spec.ReadOnly = true;
+            // 
             // Warehouse_ProductMakeIn
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -227,6 +239,7 @@
             this.Load += new System.EventHandler(this.Warehouse_ProductMakeIn_Load);
             this.SizeChanged += new System.EventHandler(this.Warehouse_ProductMakeIn_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.InOutDetailDGV)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit();
             this.ResumeLayout(true);
             this.PerformLayout();
 
@@ -235,11 +248,6 @@
         #endregion
 
         private CustomControl.DataGrid_View.DataGridViewWithSerialNum InOutDetailDGV;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pim_outboxcode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pim_mac;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pim_prodcode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec;
         private CustomControl.ValueLabel.ValueLabel getqty;
         private System.Windows.Forms.Label label8;
         private CustomControl.CustomCheckBox.CustomCheckBox cancel;
@@ -249,5 +257,12 @@
         private System.Windows.Forms.RadioButton palletBtn;
         private System.Windows.Forms.Label label1;
         private CustomControl.RichText.RichTextAutoBottom OperateResult;
+        private System.Windows.Forms.BindingSource bindingSource1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pim_outboxcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pim_id;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pim_mac;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pim_prodcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec;
     }
 }

+ 41 - 6
UAS-MES/FunctionCode/Warehouse/Warehouse_ProductMakeIn.cs

@@ -171,6 +171,7 @@ namespace UAS_MES.Warehouse
                         OperateResult.AppendText("未选择录入数据类型\n", Color.Red, input);
                         return;
                     }
+                    LoadGridData();
                 }
                 else
                 {
@@ -198,6 +199,7 @@ namespace UAS_MES.Warehouse
                                 OperateResult.AppendText("栈板号" + input.Text + "已被出货单单号:" + pa_outno + "锁定\n", Color.Red, input);
                                 return;
                             }
+                            DeleteData();
                             deleteprodiomac(pa_id, pa_makecode, "PALLET");
                             OperateResult.AppendText("栈板" + input.Text + "取消完工入库成功\n", Color.Green);
                         }
@@ -237,6 +239,7 @@ namespace UAS_MES.Warehouse
                                 OperateResult.AppendText("箱号" + input.Text + "已被出货单单号:" + pa_outno + "锁定\n", Color.Red, input);
                                 return;
                             }
+                            DeleteData();
                             deleteprodiomac(pa_id, pa_makecode, "BOX");
                             OperateResult.AppendText("箱号" + input.Text + "取消完工入库成功\n", Color.Green);
                         }
@@ -281,6 +284,7 @@ namespace UAS_MES.Warehouse
                                 OperateResult.AppendText("序列号" + input.Text + "不是在库状态,无需取消完工入库\n", Color.Red, input);
                                 return;
                             }
+                            DeleteData();
                             sql.Clear();
                             sql.Append("delete from prodiomac where pim_id =(select max(pim_id) from prodiomac where ");
                             sql.Append(" pim_mac='" + input.Text + "' and pim_inorout='IN' AND pim_class='完工入库' )");
@@ -295,9 +299,10 @@ namespace UAS_MES.Warehouse
                         OperateResult.AppendText("未选择录入数据类型\n", Color.Red, input);
                         return;
                     }
+
                 }
-                getqty.Text = (++getcount).ToString();
-                LoadGridData();
+                getqty.Text = ((DataTable)bindingSource1.DataSource).Rows.Count.ToString();
+             
             }
         }
 
@@ -371,18 +376,44 @@ namespace UAS_MES.Warehouse
             if (palletBtn.Checked || bigboxBtn.Checked)
             {
                 sql.Clear();
-                sql.Append("select pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
+                sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
                 sql.Append("left join product on pr_code=pim_prodcode where pim_outboxcode='" + input.Text + "'");
                 DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                BaseUtil.FillDgvWithDataTable(InOutDetailDGV, dt);
+                (bindingSource1.DataSource as DataTable).Merge(dt.Copy());
+                BaseUtil.FillDgvWithDataTable(InOutDetailDGV, (DataTable)bindingSource1.DataSource);
             }
             else
             {
                 sql.Clear();
-                sql.Append("select pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
+                sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
                 sql.Append("left join product on pr_code=pim_prodcode where pim_mac='" + input.Text + "'");
                 DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                BaseUtil.FillDgvWithDataTable(InOutDetailDGV, dt);
+                (bindingSource1.DataSource as DataTable).Merge(dt.Copy());
+                BaseUtil.FillDgvWithDataTable(InOutDetailDGV, (DataTable)bindingSource1.DataSource);
+            }
+        }
+
+
+        /// <summary>
+        /// 去除重复Grid数据
+        /// </summary>
+        private void DeleteData()
+        {
+            if (palletBtn.Checked || bigboxBtn.Checked)
+            {
+                sql.Clear();
+                sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
+                sql.Append("left join product on pr_code=pim_prodcode where pim_outboxcode='" + input.Text + "'");
+                DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select"); 
+                BaseUtil.FillDgvWithDataTable(InOutDetailDGV,BaseUtil.DataTableMerge((DataTable)bindingSource1.DataSource,dt, "pim_id"));
+            }
+            else
+            {
+                sql.Clear();
+                sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
+                sql.Append("left join product on pr_code=pim_prodcode where pim_mac='" + input.Text + "'");
+                DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                BaseUtil.FillDgvWithDataTable(InOutDetailDGV, BaseUtil.DataTableMerge((DataTable)bindingSource1.DataSource, dt, "pim_id"));
             }
         }
 
@@ -405,6 +436,10 @@ namespace UAS_MES.Warehouse
             asc.controllInitializeSize(this);
             getcount = 0;
             getqty.Text = getcount.ToString();
+            sql.Clear();
+            sql.Append("select pim_id,pim_outboxcode,pim_mac,pim_prodcode,pr_detail,pr_spec from prodiomac ");
+            sql.Append("left join product on pr_code=pim_prodcode where pr_detail is null");
+            bindingSource1.DataSource = dh.ExecuteSql(sql.GetString(), "select"); 
         }
 
         private void Warehouse_ProductMakeIn_SizeChanged(object sender, EventArgs e)

+ 4 - 13
UAS-MES/FunctionCode/Warehouse/Warehouse_ProductMakeIn.resx

@@ -120,19 +120,7 @@
   <metadata name="pim_outboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pim_mac.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pim_prodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_detail.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_spec.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pim_outboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="pim_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
   <metadata name="pim_mac.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -147,4 +135,7 @@
   <metadata name="pr_spec.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="bindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
 </root>

+ 38 - 0
UAS-MES/PublicMethod/BaseUtil.cs

@@ -1225,6 +1225,44 @@ namespace UAS_MES.PublicMethod
 
         }
 
+
+
+        /// <summary>
+        /// 取两个DataTable的交集,删除重复数据
+        /// </summary>
+        /// <param name="sourceDataTable"></param>
+        /// <param name="targetDataTable"></param>
+        /// <param name="primaryKey"></param>
+        /// <returns></returns>
+        public static DataTable DataTableMerge(DataTable sourceDataTable, DataTable targetDataTable, string primaryKey)
+        {
+            if (sourceDataTable != null || targetDataTable != null || !sourceDataTable.Equals(targetDataTable))
+            {
+                sourceDataTable.PrimaryKey = new DataColumn[] { sourceDataTable.Columns[primaryKey] };
+                DataTable dt = targetDataTable.Copy();
+                foreach (DataRow tRow in dt.Rows)
+                {
+                    try
+                    {
+                        //拒绝自上次调用 System.Data.DataRow.AcceptChanges() 以来对该行进行的所有更改。
+                        //因为行状态为DataRowState.Deleted时无法访问ItemArray的值
+                        tRow.RejectChanges();
+                        //在加载数据时关闭通知、索引维护和约束。
+                        sourceDataTable.BeginLoadData();
+                        //查找和更新特定行。如果找不到任何匹配行,则使用给定值创建新行。
+                        DataRow temp = sourceDataTable.LoadDataRow(tRow.ItemArray, false);
+                        sourceDataTable.EndLoadData();
+                        sourceDataTable.Rows.Remove(temp);
+                    }
+                    catch
+                    {
+                    }
+                }
+            }
+            sourceDataTable.AcceptChanges();
+            return sourceDataTable;
+        }
+
         /// <summary>
         /// 
         /// </summary>