瀏覽代碼

修改岗位备料,DBFind

章政 8 年之前
父節點
當前提交
3881fd1d87

+ 14 - 4
UAS-MES/DbFind.cs

@@ -14,7 +14,7 @@ namespace UAS_MES
         bool IsAbleDbFind;
 
         //双击选择的工单号
-        string TextBoxValue;
+        string TextBoxValue = "";
 
         DataHelper dh = new DataHelper();
 
@@ -110,9 +110,11 @@ namespace UAS_MES
                     IsAbleDbFind = true;
                 }
             }
-            catch (Exception  EB) {
+            catch (Exception EB)
+            {
                 LogManager.DoLog(EB.Message);
-                IsAbleDbFind = false; }
+                IsAbleDbFind = false;
+            }
         }
 
         protected override void WndProc(ref Message m)
@@ -206,7 +208,15 @@ namespace UAS_MES
                 LogManager.DoLog(ea.Message);
                 SuccessReturnData = false;
             }
-            TextBoxValue = DbFindGridView.Rows[e.RowIndex].Cells[0].Value.ToString();
+            dt = (DataTable)DbFindGridView.DataSource;
+            for (int i = 0; i < dt.Columns.Count; i++)
+            {
+                if (MainControl.Name == dt.Columns[i].Caption)
+                {
+                    TextBoxValue = dt.Rows[e.RowIndex][i].ToString();
+                    break;
+                }
+            }
             Dispose();
             Close();
         }

+ 61 - 61
UAS-MES/FunctionCode/Make/Make_PositionStock.Designer.cs

@@ -46,10 +46,6 @@
             this.Confirm = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.pr_batchnum = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.BatchProductDGV = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
-            this.sc_stepcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
-            this.pr_detail = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
-            this.ma_prodcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
-            this.Screen = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.sp_soncode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.mss_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.mss_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -62,6 +58,10 @@
             this.pr_detail1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pr_spec = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.DeleteRow = new System.Windows.Forms.DataGridViewImageColumn();
+            this.sc_stepcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
+            this.pr_detail = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
+            this.ma_prodcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
+            this.Screen = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.panel2.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.BatchProductDGV)).BeginInit();
             this.SuspendLayout();
@@ -125,9 +125,9 @@
             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(10, 510);
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(74, 21);
+            this.label3.Size = new System.Drawing.Size(58, 21);
             this.label3.TabIndex = 175;
-            this.label3.Text = "物料批号";
+            this.label3.Text = "条码号";
             // 
             // label2
             // 
@@ -290,61 +290,6 @@
             this.BatchProductDGV.TabIndex = 174;
             this.BatchProductDGV.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.BatchProduct_CellContentClick);
             // 
-            // sc_stepcode
-            // 
-            this.sc_stepcode.AutoSize = true;
-            this.sc_stepcode.CutLength = null;
-            this.sc_stepcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sc_stepcode.Location = new System.Drawing.Point(688, 42);
-            this.sc_stepcode.MaximumSize = new System.Drawing.Size(150, 0);
-            this.sc_stepcode.Name = "sc_stepcode";
-            this.sc_stepcode.Size = new System.Drawing.Size(0, 21);
-            this.sc_stepcode.TabIndex = 171;
-            // 
-            // pr_detail
-            // 
-            this.pr_detail.AutoSize = true;
-            this.pr_detail.CutLength = null;
-            this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail.Location = new System.Drawing.Point(415, 82);
-            this.pr_detail.MaximumSize = new System.Drawing.Size(150, 0);
-            this.pr_detail.Name = "pr_detail";
-            this.pr_detail.Size = new System.Drawing.Size(0, 21);
-            this.pr_detail.TabIndex = 170;
-            this.pr_detail.Tag = "pr_detail";
-            // 
-            // ma_prodcode
-            // 
-            this.ma_prodcode.AutoSize = true;
-            this.ma_prodcode.CutLength = null;
-            this.ma_prodcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ma_prodcode.Location = new System.Drawing.Point(102, 82);
-            this.ma_prodcode.MaximumSize = new System.Drawing.Size(150, 0);
-            this.ma_prodcode.Name = "ma_prodcode";
-            this.ma_prodcode.Size = new System.Drawing.Size(0, 21);
-            this.ma_prodcode.TabIndex = 167;
-            this.ma_prodcode.Tag = "ma_prodcode";
-            this.ma_prodcode.TextChanged += new System.EventHandler(this.ma_prodcode_TextChanged);
-            // 
-            // Screen
-            // 
-            this.Screen.AllPower = null;
-            this.Screen.BackColor = System.Drawing.Color.Transparent;
-            this.Screen.DownImage = ((System.Drawing.Image)(resources.GetObject("Screen.DownImage")));
-            this.Screen.Image = ((System.Drawing.Image)(resources.GetObject("Screen.Image")));
-            this.Screen.IsShowBorder = true;
-            this.Screen.Location = new System.Drawing.Point(621, 83);
-            this.Screen.MoveImage = ((System.Drawing.Image)(resources.GetObject("Screen.MoveImage")));
-            this.Screen.Name = "Screen";
-            this.Screen.NormalImage = ((System.Drawing.Image)(resources.GetObject("Screen.NormalImage")));
-            this.Screen.Power = null;
-            this.Screen.Size = new System.Drawing.Size(60, 24);
-            this.Screen.TabIndex = 154;
-            this.Screen.Tag = "IfRead";
-            this.Screen.Text = "刷新";
-            this.Screen.UseVisualStyleBackColor = true;
-            this.Screen.Click += new System.EventHandler(this.Screen_Click);
-            // 
             // sp_soncode
             // 
             this.sp_soncode.DataPropertyName = "sp_soncode";
@@ -430,6 +375,61 @@
             this.DeleteRow.Image = global::UAS_MES.Properties.Resources.bindingNavigatorDeleteItem_Image;
             this.DeleteRow.Name = "DeleteRow";
             // 
+            // sc_stepcode
+            // 
+            this.sc_stepcode.AutoSize = true;
+            this.sc_stepcode.CutLength = null;
+            this.sc_stepcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.sc_stepcode.Location = new System.Drawing.Point(688, 42);
+            this.sc_stepcode.MaximumSize = new System.Drawing.Size(150, 0);
+            this.sc_stepcode.Name = "sc_stepcode";
+            this.sc_stepcode.Size = new System.Drawing.Size(0, 21);
+            this.sc_stepcode.TabIndex = 171;
+            // 
+            // pr_detail
+            // 
+            this.pr_detail.AutoSize = true;
+            this.pr_detail.CutLength = null;
+            this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pr_detail.Location = new System.Drawing.Point(415, 82);
+            this.pr_detail.MaximumSize = new System.Drawing.Size(150, 0);
+            this.pr_detail.Name = "pr_detail";
+            this.pr_detail.Size = new System.Drawing.Size(0, 21);
+            this.pr_detail.TabIndex = 170;
+            this.pr_detail.Tag = "pr_detail";
+            // 
+            // ma_prodcode
+            // 
+            this.ma_prodcode.AutoSize = true;
+            this.ma_prodcode.CutLength = null;
+            this.ma_prodcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_prodcode.Location = new System.Drawing.Point(102, 82);
+            this.ma_prodcode.MaximumSize = new System.Drawing.Size(150, 0);
+            this.ma_prodcode.Name = "ma_prodcode";
+            this.ma_prodcode.Size = new System.Drawing.Size(0, 21);
+            this.ma_prodcode.TabIndex = 167;
+            this.ma_prodcode.Tag = "ma_prodcode";
+            this.ma_prodcode.TextChanged += new System.EventHandler(this.ma_prodcode_TextChanged);
+            // 
+            // Screen
+            // 
+            this.Screen.AllPower = null;
+            this.Screen.BackColor = System.Drawing.Color.Transparent;
+            this.Screen.DownImage = ((System.Drawing.Image)(resources.GetObject("Screen.DownImage")));
+            this.Screen.Image = ((System.Drawing.Image)(resources.GetObject("Screen.Image")));
+            this.Screen.IsShowBorder = true;
+            this.Screen.Location = new System.Drawing.Point(621, 83);
+            this.Screen.MoveImage = ((System.Drawing.Image)(resources.GetObject("Screen.MoveImage")));
+            this.Screen.Name = "Screen";
+            this.Screen.NormalImage = ((System.Drawing.Image)(resources.GetObject("Screen.NormalImage")));
+            this.Screen.Power = null;
+            this.Screen.Size = new System.Drawing.Size(60, 24);
+            this.Screen.TabIndex = 154;
+            this.Screen.Tag = "IfRead";
+            this.Screen.Text = "刷新";
+            this.Screen.UseVisualStyleBackColor = true;
+            this.Screen.Click += new System.EventHandler(this.Screen_Click);
+            // 
             // Make_PositionStock
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

+ 1 - 17
UAS-MES/FunctionCode/Make/Make_PositionStock.cs

@@ -84,7 +84,7 @@ namespace UAS_MES.Make
                                 string bar_prodcode = dt.Rows[0]["bar_prodcode"].ToString();
                                 sql.Clear();
                                 sql.Append("select * from stepproduct inner join product on pr_code=sp_soncode left join makematerial on mm_prodcode=sp_soncode where ");
-                                sql.Append("sp_craftcode='" + ma_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' and sp_mothercode='" + bar_prodcode + "' and pr_tracekind=2 ");
+                                sql.Append("sp_craftcode='" + ma_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' and sp_soncode='" + bar_prodcode + "' and pr_tracekind=2 ");
                                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                                 if (dt.Rows.Count > 0)
                                 {
@@ -152,22 +152,6 @@ namespace UAS_MES.Make
                     ma_id = dt.Rows[0]["ma_id"].ToString();
                     string craftcode = dt.Rows[0]["ma_craftcode"].ToString();
                     BaseUtil.SetFormValue(this.Controls, dt);
-                    //if (dt.Rows[0]["ma_statuscode"].ToString() == "STARTED")
-                    //{
-                    //    //判断当前用户的执行工序和岗位资源是否对应
-                    //    sql.Clear();
-                    //    sql.Append("select mss_id,sp_soncode,mm_oneuseqty,mss_prodcode,mss_barcode,nvl(mss_qty,0)mss_qty,mss_remain,mm_qty,pr_detail,pr_spec ");
-                    //    sql.Append("from stepproduct inner join makematerial on sp_soncode=mm_Prodcode left join product on pr_code=mm_prodcode left join ");
-                    //    sql.Append("makesourcestock on mss_maid=mm_maid and mss_stepcode=mm_stepcode and mm_prodcode=mss_fprodcode where ");
-                    //    sql.Append("mm_maid='" + ma_id + "' and sp_mothercode='" + ma_prodcode.Text + "' and sp_craftcode='" + craftcode + "' and sp_stepcode='" + User.CurrentStepCode + "' and pr_tracekind=2");
-                    //    dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                    //    //查询到有记录的话表示对应
-                    //    if (dt.Rows.Count > 0)
-                    //        FillDataGridView();
-                    //    //查询到没有结果表示不对应
-                    //    else OperateResult.AppendText(">>当前工单[" + ma_code.Text + "]途程[" + ma_craftcode.Text + "]工序[" + User.CurrentStepCode + "]无需要岗位备料数据\n", Color.Red);
-                    //}
-                    //else OperateResult.AppendText(">>必须状态为已下放的工单才允许进行岗位备料\n", Color.Red);
                 }
                 else OperateResult.AppendText(">>工单号不存在\n", Color.Red);
             }

+ 8 - 1
UAS-MES/Login.cs

@@ -212,7 +212,14 @@ namespace UAS_MES
 
         private void Login_FormClosing(object sender, FormClosingEventArgs e)
         {
-            dh.Dispose();
+            try
+            {
+                dh.Dispose();
+            }
+            catch (Exception)
+            {
+
+            }
         }
     }
 }