Browse Source

调整钢网BUG

章政 6 years ago
parent
commit
849d062bdf

+ 5 - 3
UAS-MES/FunctionCode/Make/Make_SMTStencil.Designer.cs

@@ -44,7 +44,7 @@
             this.SU_RETURNIFCLEAN = new System.Windows.Forms.CheckBox();
             this.em_code_label = new System.Windows.Forms.Label();
             this.em_code = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.su_singlepringqty1 = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.su_singlepringqty1 = new UAS_MES.CustomControl.TextBoxWithIcon.NumOnlyTextBox();
             this.st_table = new UAS_MES.CustomControl.ComBoxWithFocus.ComBoxWithFocus();
             this.Receive = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.Return = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
@@ -198,7 +198,7 @@
             // 
             this.SU_RETURNIFCLEAN.AutoSize = true;
             this.SU_RETURNIFCLEAN.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SU_RETURNIFCLEAN.Location = new System.Drawing.Point(692, 550);
+            this.SU_RETURNIFCLEAN.Location = new System.Drawing.Point(692, 552);
             this.SU_RETURNIFCLEAN.Name = "SU_RETURNIFCLEAN";
             this.SU_RETURNIFCLEAN.Size = new System.Drawing.Size(84, 24);
             this.SU_RETURNIFCLEAN.TabIndex = 110;
@@ -236,6 +236,7 @@
             this.su_singlepringqty1.ID = null;
             this.su_singlepringqty1.Location = new System.Drawing.Point(559, 496);
             this.su_singlepringqty1.Name = "su_singlepringqty1";
+            this.su_singlepringqty1.Negative = false;
             this.su_singlepringqty1.Power = null;
             this.su_singlepringqty1.Size = new System.Drawing.Size(39, 21);
             this.su_singlepringqty1.Str = null;
@@ -447,6 +448,7 @@
             // 
             this.ma_prodcode.AllPower = null;
             this.ma_prodcode.BackColor = System.Drawing.Color.White;
+            this.ma_prodcode.Enabled = false;
             this.ma_prodcode.ID = null;
             this.ma_prodcode.Location = new System.Drawing.Point(309, 9);
             this.ma_prodcode.Name = "ma_prodcode";
@@ -571,7 +573,7 @@
         private System.Windows.Forms.Label ma_qty_label;
         private System.Windows.Forms.Label ma_qty;
         private CustomControl.ComBoxWithFocus.ComBoxWithFocus st_table;
-        private CustomControl.TextBoxWithIcon.EnterTextBox su_singlepringqty1;
+        private CustomControl.TextBoxWithIcon.NumOnlyTextBox su_singlepringqty1;
         private System.Windows.Forms.Label su_singlepringqty1_label;
         private System.Windows.Forms.DataGridViewTextBoxColumn su_stcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn st_pcbcode;

+ 43 - 28
UAS-MES/FunctionCode/Make/Make_SMTStencil.cs

@@ -54,6 +54,7 @@ namespace UAS_MES.Make
             li_code.FormName = Name;
             li_code.SetValueField = new string[] { "li_code", "li_name" };
             li_code.DbChange += Li_code_DbChange;
+            ma_code.Focus();
         }
 
         private void Li_code_DbChange(object sender, EventArgs e)
@@ -130,20 +131,27 @@ namespace UAS_MES.Make
                 dt = (DataTable)dh.ExecuteSql("select em_name from employee where em_code='" + em_code.Text + "'", "select");
                 if (dt.Rows.Count > 0)
                 {
-                    string em_name = dt.Rows[0]["em_name"].ToString();
-                    sql.Clear();
-                    sql.Append("insert into StencilUse(su_id,SU_USEPRODCODE,su_stid,su_linecode,su_stcode,su_usedate,su_useman,SU_USEMANCODE,SU_TABLE,su_usemacode,su_singlepringqty,su_stverison,SU_STATUS)");
-                    sql.Append("select StencilUse_seq.nextval,'" + ma_prodcode.Text + "',st_id,'" + li_code.Text + "','" + SU_DEVCODE.Text + "',sysdate,'" + em_name + "','" + em_code.Text + "','" + st_table.Text + "','" + ma_code.Text + "'");
-                    sql.Append(",'" + su_singlepringqty1.Text + "',st_version,'在线' from ");
-                    sql.Append("Stencil where st_code='" + SU_DEVCODE.Text + "'");
-                    dh.ExecuteSql(sql.ToString(), "insert");
-                    dh.ExecuteSql("update Stencil set ST_USESTATUS='在线' where st_code='" + SU_DEVCODE.Text + "'", "update");
-                    MessageBox.Show("领用成功");
-                    st_table.SelectedItem = null;
-                    SU_DEVCODE.Text = "";
-                    em_code.Text = "";
-                    Receive.Enabled = false;
-                    LoadGridData();
+                    if (int.Parse(su_singlepringqty1.Text) > 0)
+                    {
+                        string em_name = dt.Rows[0]["em_name"].ToString();
+                        sql.Clear();
+                        sql.Append("insert into StencilUse(su_id,SU_USEPRODCODE,su_stid,su_linecode,su_stcode,su_usedate,su_useman,SU_USEMANCODE,SU_TABLE,su_usemacode,su_singlepringqty,su_stverison,SU_STATUS)");
+                        sql.Append("select StencilUse_seq.nextval,'" + ma_prodcode.Text + "',st_id,'" + li_code.Text + "','" + SU_DEVCODE.Text + "',sysdate,'" + em_name + "','" + em_code.Text + "','" + st_table.Text + "','" + ma_code.Text + "'");
+                        sql.Append(",'" + su_singlepringqty1.Text + "',st_version,'在线' from ");
+                        sql.Append("Stencil where st_code='" + SU_DEVCODE.Text + "'");
+                        dh.ExecuteSql(sql.ToString(), "insert");
+                        dh.ExecuteSql("update Stencil set ST_USESTATUS='在线' where st_code='" + SU_DEVCODE.Text + "'", "update");
+                        MessageBox.Show("领用成功");
+                        st_table.SelectedItem = null;
+                        SU_DEVCODE.Text = "";
+                        em_code.Text = "";
+                        Receive.Enabled = false;
+                        LoadGridData();
+                    }
+                    else
+                    {
+                        MessageBox.Show("单片印刷次数必须大于0");
+                    }
                 }
                 else
                 {
@@ -179,20 +187,27 @@ namespace UAS_MES.Make
                 dt = (DataTable)dh.ExecuteSql("select em_name from employee where em_code='" + em_code1.Text + "'", "select");
                 if (dt.Rows.Count > 0)
                 {
-                    sql.Clear();
-                    sql.Append("update StencilUse set SU_BACKDATE=sysdate,su_returnmancode='" + em_code1.Text + "',");
-                    sql.Append("SU_THISUSETIMES='" + st_combinenumber.Text + "',SU_STATUS='借出',su_usecount=" + (St_USECOUNT == "" ? "0" : St_USECOUNT) + "+" + st_combinenumber.Text);
-                    sql.Append(",SU_RETURNIFCLEAN='" + (SU_RETURNIFCLEAN.Checked ? "-1" : "0") + "' where su_id=(select max(su_id) from stenciluse where su_stcode='" + SU_DEVCODE1.Text + "' and su_status='在线')");
-                    dh.ExecuteSql(sql.ToString(), "update");
-                    sql.Clear();
-                    sql.Append("update Stencil set St_USECOUNT=nvl(St_USECOUNT,0)+" + st_combinenumber.Text + ",ST_USESTATUS='借出' where st_code='" + SU_DEVCODE1.Text + "'");
-                    dh.ExecuteSql(sql.ToString(), "update");
-                    MessageBox.Show("钢网" + SU_DEVCODE1.Text + "退回成功!");
-                    SU_DEVCODE1.Text = "";
-                    st_combinenumber.Text = "";
-                    em_code1.Text = "";
-                    SU_RETURNIFCLEAN.Checked = false;
-                    Confirm.PerformClick();
+                    if (int.Parse(st_combinenumber.Text) >= 0)
+                    {
+                        sql.Clear();
+                        sql.Append("update StencilUse set SU_BACKDATE=sysdate,su_returnman='"+dt.Rows[0]["em_name"].ToString() +"',su_returnmancode='" + em_code1.Text + "',");
+                        sql.Append("SU_THISUSETIMES='" + (st_combinenumber.Text == "" ? "0" : st_combinenumber.Text) + "',SU_STATUS='借出',su_usecount=" + (St_USECOUNT == "" ? "0" : St_USECOUNT) + "+" + st_combinenumber.Text);
+                        sql.Append(",SU_RETURNIFCLEAN='" + (SU_RETURNIFCLEAN.Checked ? "-1" : "0") + "' where su_id=(select max(su_id) from stenciluse where su_stcode='" + SU_DEVCODE1.Text + "' and su_status='在线')");
+                        dh.ExecuteSql(sql.ToString(), "update");
+                        sql.Clear();
+                        sql.Append("update Stencil set St_USECOUNT=nvl(St_USECOUNT,0)+" + (st_combinenumber.Text == "" ? "0" : st_combinenumber.Text) + ",ST_USESTATUS='借出' where st_code='" + SU_DEVCODE1.Text + "'");
+                        dh.ExecuteSql(sql.ToString(), "update");
+                        MessageBox.Show("钢网" + SU_DEVCODE1.Text + "退回成功!");
+                        SU_DEVCODE1.Text = "";
+                        st_combinenumber.Text = "";
+                        em_code1.Text = "";
+                        SU_RETURNIFCLEAN.Checked = false;
+                        Confirm.PerformClick();
+                    }
+                    else
+                    {
+                        MessageBox.Show("加工小板数必须大于等于0");
+                    }
                 }
                 else
                 {

+ 0 - 24
UAS-MES/FunctionCode/Make/Make_SMTStencil.resx

@@ -218,30 +218,6 @@
   <metadata name="su_usemacode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="su_stcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="st_pcbcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="su_status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="SU_LINECODE.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="su_stverison.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="su_singlepringqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="su_table.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="su_usemacode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
   <data name="Confirm.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m

+ 40 - 10
UAS-MES/FunctionCode/Make/Make_SMTStockStencil.Designer.cs

@@ -47,11 +47,11 @@
             this.Receive = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.Return = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.Scrap = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
-            this.ST_ENSIONA = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.ST_ENSIONB = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.ST_ENSIONC = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.ST_ENSIOND = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.ST_ENSIONE = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.ST_ENSIONA = new UAS_MES.CustomControl.TextBoxWithIcon.NumOnlyTextBox();
+            this.ST_ENSIONB = new UAS_MES.CustomControl.TextBoxWithIcon.NumOnlyTextBox();
+            this.ST_ENSIONC = new UAS_MES.CustomControl.TextBoxWithIcon.NumOnlyTextBox();
+            this.ST_ENSIOND = new UAS_MES.CustomControl.TextBoxWithIcon.NumOnlyTextBox();
+            this.ST_ENSIONE = new UAS_MES.CustomControl.TextBoxWithIcon.NumOnlyTextBox();
             this.SU_DEVCODE1 = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.SU_DEVCODE = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ToolsBom = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithSerialNum();
@@ -66,6 +66,8 @@
             this.Confirm = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.ma_prodcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ma_code = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.st_usecount = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.ToolsBom)).BeginInit();
             this.SuspendLayout();
             // 
@@ -287,6 +289,7 @@
             this.ST_ENSIONA.ID = null;
             this.ST_ENSIONA.Location = new System.Drawing.Point(160, 493);
             this.ST_ENSIONA.Name = "ST_ENSIONA";
+            this.ST_ENSIONA.Negative = false;
             this.ST_ENSIONA.Power = null;
             this.ST_ENSIONA.Size = new System.Drawing.Size(120, 21);
             this.ST_ENSIONA.Str = null;
@@ -302,6 +305,7 @@
             this.ST_ENSIONB.ID = null;
             this.ST_ENSIONB.Location = new System.Drawing.Point(325, 493);
             this.ST_ENSIONB.Name = "ST_ENSIONB";
+            this.ST_ENSIONB.Negative = false;
             this.ST_ENSIONB.Power = null;
             this.ST_ENSIONB.Size = new System.Drawing.Size(120, 21);
             this.ST_ENSIONB.Str = null;
@@ -317,6 +321,7 @@
             this.ST_ENSIONC.ID = null;
             this.ST_ENSIONC.Location = new System.Drawing.Point(489, 493);
             this.ST_ENSIONC.Name = "ST_ENSIONC";
+            this.ST_ENSIONC.Negative = false;
             this.ST_ENSIONC.Power = null;
             this.ST_ENSIONC.Size = new System.Drawing.Size(120, 21);
             this.ST_ENSIONC.Str = null;
@@ -332,6 +337,7 @@
             this.ST_ENSIOND.ID = null;
             this.ST_ENSIOND.Location = new System.Drawing.Point(160, 520);
             this.ST_ENSIOND.Name = "ST_ENSIOND";
+            this.ST_ENSIOND.Negative = false;
             this.ST_ENSIOND.Power = null;
             this.ST_ENSIOND.Size = new System.Drawing.Size(120, 21);
             this.ST_ENSIOND.Str = null;
@@ -347,6 +353,7 @@
             this.ST_ENSIONE.ID = null;
             this.ST_ENSIONE.Location = new System.Drawing.Point(325, 520);
             this.ST_ENSIONE.Name = "ST_ENSIONE";
+            this.ST_ENSIONE.Negative = false;
             this.ST_ENSIONE.Power = null;
             this.ST_ENSIONE.Size = new System.Drawing.Size(120, 21);
             this.ST_ENSIONE.Str = null;
@@ -507,11 +514,32 @@
             this.ma_code.TextBoxEnable = true;
             this.ma_code.TextKeyDown += new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox.OnTextKeyDown(this.ma_code_TextKeyDown);
             // 
+            // st_usecount
+            // 
+            this.st_usecount.AutoSize = true;
+            this.st_usecount.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.st_usecount.Location = new System.Drawing.Point(476, 461);
+            this.st_usecount.Name = "st_usecount";
+            this.st_usecount.Size = new System.Drawing.Size(0, 21);
+            this.st_usecount.TabIndex = 112;
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label2.Location = new System.Drawing.Point(357, 460);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(106, 21);
+            this.label2.TabIndex = 111;
+            this.label2.Text = "累计使用次数";
+            // 
             // Make_SMTStockStencil
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(908, 551);
+            this.Controls.Add(this.st_usecount);
+            this.Controls.Add(this.label2);
             this.Controls.Add(this.SU_RETURNIFCLEAN);
             this.Controls.Add(this.ma_qty);
             this.Controls.Add(this.ma_qty_label);
@@ -563,15 +591,15 @@
         private CustomControl.TextBoxWithIcon.EnterTextBox SU_DEVCODE1;
         private System.Windows.Forms.Label SU_DEVCODE1_label;
         private System.Windows.Forms.Label label7;
-        private CustomControl.TextBoxWithIcon.EnterTextBox ST_ENSIONE;
+        private CustomControl.TextBoxWithIcon.NumOnlyTextBox ST_ENSIONE;
         private System.Windows.Forms.Label ST_ENSIONE_label;
-        private CustomControl.TextBoxWithIcon.EnterTextBox ST_ENSIOND;
+        private CustomControl.TextBoxWithIcon.NumOnlyTextBox ST_ENSIOND;
         private System.Windows.Forms.Label label9;
-        private CustomControl.TextBoxWithIcon.EnterTextBox ST_ENSIONC;
+        private CustomControl.TextBoxWithIcon.NumOnlyTextBox ST_ENSIONC;
         private System.Windows.Forms.Label ST_ENSIONC_label;
-        private CustomControl.TextBoxWithIcon.EnterTextBox ST_ENSIONB;
+        private CustomControl.TextBoxWithIcon.NumOnlyTextBox ST_ENSIONB;
         private System.Windows.Forms.Label ST_ENSIONB_label;
-        private CustomControl.TextBoxWithIcon.EnterTextBox ST_ENSIONA;
+        private CustomControl.TextBoxWithIcon.NumOnlyTextBox ST_ENSIONA;
         private System.Windows.Forms.Label ST_ENSIONA_label;
         private CustomControl.ButtonUtil.NormalButton Scrap;
         private CustomControl.ButtonUtil.NormalButton Return;
@@ -591,5 +619,7 @@
         private CustomControl.TextBoxWithIcon.EnterTextBox ma_prodcode;
         private System.Windows.Forms.Label ma_qty_label;
         private System.Windows.Forms.Label ms_makecode_label;
+        private System.Windows.Forms.Label st_usecount;
+        private System.Windows.Forms.Label label2;
     }
 }

+ 38 - 11
UAS-MES/FunctionCode/Make/Make_SMTStockStencil.cs

@@ -24,6 +24,8 @@ namespace UAS_MES.Make
 
         StringBuilder sql = new StringBuilder();
 
+        bool ifUsed = false;
+
         public Make_SMTStockStencil()
         {
             InitializeComponent();
@@ -51,6 +53,8 @@ namespace UAS_MES.Make
             ma_code.Condition = "ma_statuscode in('STARTED','AUDITED')";
             ma_code.DbChange += Ma_code_DbChange;
 
+            SU_DEVCODE.Focus();
+
         }
 
         private void Ma_code_DbChange(object sender, EventArgs e)
@@ -115,23 +119,23 @@ namespace UAS_MES.Make
             {
                 if (SU_RETURNIFCLEAN.Checked)
                 {
-                    DataTable dt = (DataTable)dh.ExecuteSql("select ST_USESTATUS,St_USECOUNT from Stencil where st_code='" + SU_DEVCODE1.Text + "' and st_statuscode='AUDITED'", "select");
+                    DataTable dt = (DataTable)dh.ExecuteSql("select ST_USESTATUS,nvl(St_USECOUNT,0)St_USECOUNT from Stencil where st_code='" + SU_DEVCODE1.Text + "' and st_statuscode='AUDITED'", "select");
                     if (dt.Rows.Count > 0)
                     {
                         string status = dt.Rows[0]["ST_USESTATUS"].ToString();
                         if (status == "在线")
                         {
-                            MessageBox.Show("当前钢网" + SU_DEVCODE.Text + "处于在线状态,无法退回");
+                            MessageBox.Show("当前钢网" + SU_DEVCODE1.Text + "处于在线状态,无法退回");
                             return;
                         }
                         if (status == "在仓")
                         {
-                            MessageBox.Show("当前钢网" + SU_DEVCODE.Text + "未借出,无需归还");
+                            MessageBox.Show("当前钢网" + SU_DEVCODE1.Text + "未借出,无需归还");
                             return;
                         }
                         if (status == "报废")
                         {
-                            MessageBox.Show("当前钢网" + SU_DEVCODE.Text + "处于" + status + "状态,无法退回");
+                            MessageBox.Show("当前钢网" + SU_DEVCODE1.Text + "处于" + status + "状态,无法退回");
                             return;
                         }
                     }
@@ -140,8 +144,17 @@ namespace UAS_MES.Make
                         MessageBox.Show("钢网编号" + SU_DEVCODE1.Text + "不存在或者未审核");
                     }
                     string St_USECOUNT = dt.Rows[0]["St_USECOUNT"].ToString();
+                    //如果有使用过的话
+                    if (int.Parse(St_USECOUNT) > 0)
+                    {
+                        ifUsed = true;
+                    }
+                    else
+                    {
+                        ifUsed = false;
+                    }
                     sql.Clear();
-                    sql.Append("update StencilUse set SU_BACKDATE=sysdate,SU_ENSIONA='" + ST_ENSIONA.Text + "',SU_ENSIONB='" + ST_ENSIONB.Text + "',SU_ENSIONC='" + ST_ENSIONC.Text + "',SU_ENSIOND='" + ST_ENSIOND.Text + "',");
+                    sql.Append("update StencilUse set su_returnman='" + User.UserName + "',SU_BACKDATE=sysdate,SU_ENSIONA='" + ST_ENSIONA.Text + "',SU_ENSIONB='" + ST_ENSIONB.Text + "',SU_ENSIONC='" + ST_ENSIONC.Text + "',SU_ENSIOND='" + ST_ENSIOND.Text + "',");
                     sql.Append("SU_ENSIONE='" + ST_ENSIONE.Text + "',SU_STATUS='在仓'");
                     sql.Append(",SU_RETURNIFCLEAN='" + (SU_RETURNIFCLEAN.Checked ? "-1" : "0") + "' where su_id=(select max(su_id) from stenciluse where su_stcode='" + SU_DEVCODE1.Text + "' and su_status='借出')");
                     dh.ExecuteSql(sql.ToString(), "update");
@@ -209,14 +222,12 @@ namespace UAS_MES.Make
                 MessageBox.Show("报废原因不能为空");
                 return;
             }
-            DataTable dt = (DataTable)dh.ExecuteSql("select St_USECOUNT from stencil where st_code='" + SU_DEVCODE1.Text + "'", "select");
-            string St_USECOUNT = dt.Rows[0]["St_USECOUNT"].ToString();
             sql.Clear();
             sql.Append("update StencilUse set SU_IFSCRAPOLD=-1,SU_STATUS='报废',SU_ENSIONA='" + ST_ENSIONA.Text + "',SU_ENSIONB='" + ST_ENSIONB.Text + "',SU_ENSIONC='" + ST_ENSIONC.Text + "',SU_ENSIOND='" + ST_ENSIOND.Text + "',SU_ENSIONE='" + ST_ENSIONE.Text + "'");
             sql.Append(",SU_RETURNIFCLEAN='" + (SU_RETURNIFCLEAN.Checked ? "-1" : "0") + "' where su_id=(select max(su_id) from stenciluse where su_stcode='" + SU_DEVCODE1.Text + "')");
             dh.ExecuteSql(sql.ToString(), "update");
             sql.Clear();
-            sql.Append("update Stencil set ST_SCRAPREASON='" + scrapreason + "',ST_USESTATUS='报废',ST_ENSIONA='" + ST_ENSIONA.Text + "',ST_ENSIONB='" + ST_ENSIONB.Text + "',");
+            sql.Append("update Stencil set ST_SCRAPREASON='" + scrapreason + "',st_scrapman='" + User.UserName + "',st_scrapdate=sysdate,ST_USESTATUS='报废',ST_ENSIONA='" + ST_ENSIONA.Text + "',ST_ENSIONB='" + ST_ENSIONB.Text + "',");
             sql.Append("ST_ENSIONC='" + ST_ENSIONC.Text + "',ST_ENSIOND='" + ST_ENSIOND.Text + "',ST_ENSIONE='" + ST_ENSIONE.Text + "' ");
             sql.Append("where st_code='" + SU_DEVCODE1.Text + "'");
             dh.ExecuteSql(sql.ToString(), "insert");
@@ -236,6 +247,7 @@ namespace UAS_MES.Make
             ST_ENSIONE.Text = "";
             SU_RETURNIFCLEAN.Checked = false;
             Scrap.Enabled = false;
+            MessageBox.Show("报废成功!");
         }
 
         private void Radio_CheckedChanged(object sender, EventArgs e)
@@ -296,9 +308,20 @@ namespace UAS_MES.Make
                     FillCount = FillCount + 1;
                     if (double.TryParse(item, out Range))
                     {
-                        if (Range >= 39 && Range <= 55)
+                        //如果使用过张力范围39-55,使用过30-55
+                        if (ifUsed)
+                        {
+                            if (Range >= 30 && Range <= 55)
+                            {
+                                CheckCount = CheckCount + 1;
+                            }
+                        }
+                        else
                         {
-                            CheckCount = CheckCount + 1;
+                            if (Range >= 39 && Range <= 55)
+                            {
+                                CheckCount = CheckCount + 1;
+                            }
                         }
                     }
                 }
@@ -342,11 +365,15 @@ namespace UAS_MES.Make
         {
             if (e.KeyCode == Keys.Enter)
             {
-                DataTable dt = (DataTable)dh.ExecuteSql("select case when nvl(ST_COMBINENUMBER,1)=0 then 1 else nvl(ST_COMBINENUMBER,1) end from STENCIL where st_code='" + SU_DEVCODE1.Text + "' and st_statuscode='AUDITED'", "select");
+                DataTable dt = (DataTable)dh.ExecuteSql("select st_usecount,case when nvl(ST_COMBINENUMBER,1)=0 then 1 else nvl(ST_COMBINENUMBER,1) end from STENCIL where st_code='" + SU_DEVCODE1.Text + "' and st_statuscode='AUDITED'", "select");
                 if (dt.Rows.Count == 0)
                 {
                     MessageBox.Show("钢网编号" + SU_DEVCODE1.Text + "不存在或者未审核");
                 }
+                else
+                {
+                    st_usecount.Text = dt.Rows[0]["st_usecount"].ToString();
+                }
             }
         }
 

+ 24 - 0
UAS-MES/FunctionCode/Make/Make_SMTStockStencil.resx

@@ -256,6 +256,30 @@
   <metadata name="su_usemacode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="su_stcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="st_pcbcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="su_status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="SU_LINECODE.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="su_stverison.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="su_singlepringqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="su_table.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="su_usemacode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <data name="Confirm.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m