Browse Source

打印初始化异常处理,修改岗位备料

章政 8 years ago
parent
commit
ed9c8b46e9

+ 8 - 1
UAS-MES/FunctionCode/Make/Make_ColorBoxLabelPrint.cs

@@ -97,7 +97,14 @@ namespace UAS_MES.Make
 
         private void InPrint()
         {
-            lbl = new ApplicationClass();
+            try
+            {
+                lbl = new ApplicationClass();
+            }
+            catch (Exception)
+            {
+                MessageBox.Show("未正确安装CodeSoft软件");
+            }
         }
 
         private void sn_code_KeyDown(object sender, KeyEventArgs e)

+ 8 - 1
UAS-MES/FunctionCode/Make/Make_ColorBoxLoadPrint.cs

@@ -54,7 +54,14 @@ namespace UAS_MES.Make
 
         private void InPrint()
         {
-            lbl = new ApplicationClass();
+            try
+            {
+                lbl = new ApplicationClass();
+            }
+            catch (Exception)
+            {
+                MessageBox.Show("未正确安装CodeSoft软件");
+            }
         }
 
         private void sn_code_KeyDown(object sender, KeyEventArgs e)

+ 59 - 59
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();
@@ -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);

+ 13 - 31
UAS-MES/FunctionCode/Make/Make_PositionStock.cs

@@ -50,6 +50,7 @@ namespace UAS_MES.Make
         {
             Dbfind = ma_code.ReturnData;
             BaseUtil.SetFormValue(this.Controls, Dbfind);
+            FillDataGridView();
         }
 
         private void 岗位备料_SizeChanged(object sender, EventArgs e)
@@ -90,21 +91,17 @@ namespace UAS_MES.Make
                                 {
                                     string mm_oneuseqty = dt.Rows[0]["mm_oneuseqty"].ToString();
                                     string mm_prodcode = dt.Rows[0]["mm_prodcode"].ToString();
-                                    if (dh.getRowCount("makesourcestock", "mss_makecode='" + ma_code.Text + "' and mss_prodcode='" + mm_prodcode + "' and mss_barcode='" + pr_batchnum.Text + "'") == 0)
-                                    {
-                                        sql.Clear();
-                                        sql.Append("insert into makesourcestock (mss_id,mss_makecode,mss_linecode ,mss_craftcode,");
-                                        sql.Append("mss_stepcode,mss_barcode,mss_fprodcode,mss_indate,mss_inman,mss_qty,");
-                                        sql.Append("mss_remain ,mss_baseqty ,mss_prodcode,mss_maid) values(makesourcestock_seq.nextval,'" + ma_code.Text + "','" + User.UserLineCode + "',");
-                                        sql.Append("'','" + sc_stepcode.Text + "','" + pr_batchnum.Text + "','" + mm_prodcode + "',");
-                                        sql.Append("sysdate,'" + User.UserCode + "','" + bar_remain + "','" + bar_remain + "','" + mm_oneuseqty + "','" + bar_prodcode + "','" + ma_id + "')");
-                                        dh.ExecuteSql(sql.GetString(), "insert");
-                                        dh.UpdateByCondition("barcode", "bar_place='" + ma_code.Text + "'", "bar_code='" + pr_batchnum.Text + "'");
-                                        //数据插入成功后加载Grid的数据
-                                        FillDataGridView();
-                                        OperateResult.AppendText(">>批次号" + pr_batchnum.Text + "备料成功\n", Color.Green, pr_batchnum);
-                                    }
-                                    else OperateResult.AppendText(">>批次号" + pr_batchnum.Text + "的物料已分配\n", Color.Red, pr_batchnum);
+                                    sql.Clear();
+                                    sql.Append("insert into makesourcestock (mss_id,mss_makecode,mss_linecode ,mss_craftcode,");
+                                    sql.Append("mss_stepcode,mss_barcode,mss_fprodcode,mss_indate,mss_inman,mss_qty,");
+                                    sql.Append("mss_remain ,mss_baseqty ,mss_prodcode,mss_maid) values(makesourcestock_seq.nextval,'" + ma_code.Text + "','" + User.UserLineCode + "',");
+                                    sql.Append("'" + ma_craftcode.Text + "','" + sc_stepcode.Text + "','" + pr_batchnum.Text + "','" + mm_prodcode + "',");
+                                    sql.Append("sysdate,'" + User.UserCode + "','" + bar_remain + "','" + bar_remain + "','" + mm_oneuseqty + "','" + bar_prodcode + "','" + ma_id + "')");
+                                    dh.ExecuteSql(sql.GetString(), "insert");
+                                    dh.UpdateByCondition("barcode", "bar_place='" + ma_code.Text + "'", "bar_code='" + pr_batchnum.Text + "'");
+                                    //数据插入成功后加载Grid的数据
+                                    FillDataGridView();
+                                    OperateResult.AppendText(">>批次号" + pr_batchnum.Text + "备料成功\n", Color.Green, pr_batchnum);
                                 }
                                 else OperateResult.AppendText(">>批次" + pr_batchnum.Text + "对应的物料不是当前工单当前工序需要备的物料\n", Color.Red, pr_batchnum);
                             }
@@ -152,22 +149,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);
             }
@@ -182,6 +163,7 @@ namespace UAS_MES.Make
                 if (id != "0")
                 {
                     dh.ExecuteSql("delete from makesourcestock where mss_id='" + id + "'", "delete");
+                    BatchProductDGV.Rows.RemoveAt(e.RowIndex);
                 }
             }
         }