소스 검색

一条线别只能有一个在线的钢网

章政 6 년 전
부모
커밋
634143079c

+ 68 - 8
UAS-MES/FunctionCode/Make/Make_SMTStencil.Designer.cs

@@ -42,6 +42,8 @@
             this.ma_qty = new System.Windows.Forms.Label();
             this.su_singlepringqty1_label = new System.Windows.Forms.Label();
             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.st_table = new UAS_MES.CustomControl.ComBoxWithFocus.ComBoxWithFocus();
             this.Receive = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
@@ -62,6 +64,8 @@
             this.li_code = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.ma_prodcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.ma_code = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.em_code1 = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.em_code1_label = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.ToolsBom)).BeginInit();
             this.SuspendLayout();
             // 
@@ -112,7 +116,7 @@
             // 
             this.RadioReturn.AutoSize = true;
             this.RadioReturn.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.RadioReturn.Location = new System.Drawing.Point(6, 521);
+            this.RadioReturn.Location = new System.Drawing.Point(6, 549);
             this.RadioReturn.Name = "RadioReturn";
             this.RadioReturn.Size = new System.Drawing.Size(55, 24);
             this.RadioReturn.TabIndex = 78;
@@ -145,7 +149,7 @@
             // 
             this.SU_DEVCODE1_label.AutoSize = true;
             this.SU_DEVCODE1_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SU_DEVCODE1_label.Location = new System.Drawing.Point(59, 524);
+            this.SU_DEVCODE1_label.Location = new System.Drawing.Point(59, 552);
             this.SU_DEVCODE1_label.Name = "SU_DEVCODE1_label";
             this.SU_DEVCODE1_label.Size = new System.Drawing.Size(74, 21);
             this.SU_DEVCODE1_label.TabIndex = 87;
@@ -155,7 +159,7 @@
             // 
             this.st_combinenumber_label.AutoSize = true;
             this.st_combinenumber_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.st_combinenumber_label.Location = new System.Drawing.Point(266, 524);
+            this.st_combinenumber_label.Location = new System.Drawing.Point(266, 552);
             this.st_combinenumber_label.Name = "st_combinenumber_label";
             this.st_combinenumber_label.Size = new System.Drawing.Size(90, 21);
             this.st_combinenumber_label.TabIndex = 89;
@@ -194,13 +198,37 @@
             // 
             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(492, 523);
+            this.SU_RETURNIFCLEAN.Location = new System.Drawing.Point(692, 550);
             this.SU_RETURNIFCLEAN.Name = "SU_RETURNIFCLEAN";
             this.SU_RETURNIFCLEAN.Size = new System.Drawing.Size(84, 24);
             this.SU_RETURNIFCLEAN.TabIndex = 110;
             this.SU_RETURNIFCLEAN.Text = "是否清洗";
             this.SU_RETURNIFCLEAN.UseVisualStyleBackColor = true;
             // 
+            // em_code_label
+            // 
+            this.em_code_label.AutoSize = true;
+            this.em_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.em_code_label.Location = new System.Drawing.Point(59, 524);
+            this.em_code_label.Name = "em_code_label";
+            this.em_code_label.Size = new System.Drawing.Size(74, 21);
+            this.em_code_label.TabIndex = 111;
+            this.em_code_label.Text = "人员编号";
+            // 
+            // em_code
+            // 
+            this.em_code.AllPower = null;
+            this.em_code.BackColor = System.Drawing.Color.White;
+            this.em_code.ID = null;
+            this.em_code.Location = new System.Drawing.Point(139, 525);
+            this.em_code.Name = "em_code";
+            this.em_code.Power = null;
+            this.em_code.Size = new System.Drawing.Size(120, 21);
+            this.em_code.Str = null;
+            this.em_code.Str1 = null;
+            this.em_code.Str2 = null;
+            this.em_code.TabIndex = 112;
+            // 
             // su_singlepringqty1
             // 
             this.su_singlepringqty1.AllPower = null;
@@ -253,7 +281,7 @@
             this.Return.DownImage = ((System.Drawing.Image)(resources.GetObject("Return.DownImage")));
             this.Return.Image = null;
             this.Return.IsShowBorder = true;
-            this.Return.Location = new System.Drawing.Point(582, 522);
+            this.Return.Location = new System.Drawing.Point(782, 548);
             this.Return.MoveImage = ((System.Drawing.Image)(resources.GetObject("Return.MoveImage")));
             this.Return.Name = "Return";
             this.Return.NormalImage = ((System.Drawing.Image)(resources.GetObject("Return.NormalImage")));
@@ -269,7 +297,7 @@
             this.st_combinenumber.AllPower = null;
             this.st_combinenumber.BackColor = System.Drawing.Color.White;
             this.st_combinenumber.ID = null;
-            this.st_combinenumber.Location = new System.Drawing.Point(360, 525);
+            this.st_combinenumber.Location = new System.Drawing.Point(360, 553);
             this.st_combinenumber.Name = "st_combinenumber";
             this.st_combinenumber.Power = null;
             this.st_combinenumber.Size = new System.Drawing.Size(120, 21);
@@ -283,7 +311,7 @@
             this.SU_DEVCODE1.AllPower = null;
             this.SU_DEVCODE1.BackColor = System.Drawing.Color.White;
             this.SU_DEVCODE1.ID = null;
-            this.SU_DEVCODE1.Location = new System.Drawing.Point(139, 525);
+            this.SU_DEVCODE1.Location = new System.Drawing.Point(139, 553);
             this.SU_DEVCODE1.Name = "SU_DEVCODE1";
             this.SU_DEVCODE1.Power = null;
             this.SU_DEVCODE1.Size = new System.Drawing.Size(120, 21);
@@ -449,11 +477,39 @@
             this.ma_code.TextBoxEnable = true;
             this.ma_code.TextKeyDown += new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox.OnTextKeyDown(this.ma_code_TextKeyDown);
             // 
+            // em_code1
+            // 
+            this.em_code1.AllPower = null;
+            this.em_code1.BackColor = System.Drawing.Color.White;
+            this.em_code1.ID = null;
+            this.em_code1.Location = new System.Drawing.Point(566, 553);
+            this.em_code1.Name = "em_code1";
+            this.em_code1.Power = null;
+            this.em_code1.Size = new System.Drawing.Size(120, 21);
+            this.em_code1.Str = null;
+            this.em_code1.Str1 = null;
+            this.em_code1.Str2 = null;
+            this.em_code1.TabIndex = 114;
+            // 
+            // em_code1_label
+            // 
+            this.em_code1_label.AutoSize = true;
+            this.em_code1_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.em_code1_label.Location = new System.Drawing.Point(486, 552);
+            this.em_code1_label.Name = "em_code1_label";
+            this.em_code1_label.Size = new System.Drawing.Size(74, 21);
+            this.em_code1_label.TabIndex = 113;
+            this.em_code1_label.Text = "人员编号";
+            // 
             // Make_SMTStencil
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(908, 551);
+            this.ClientSize = new System.Drawing.Size(908, 580);
+            this.Controls.Add(this.em_code1);
+            this.Controls.Add(this.em_code1_label);
+            this.Controls.Add(this.em_code);
+            this.Controls.Add(this.em_code_label);
             this.Controls.Add(this.SU_RETURNIFCLEAN);
             this.Controls.Add(this.su_singlepringqty1);
             this.Controls.Add(this.su_singlepringqty1_label);
@@ -526,5 +582,9 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn su_table;
         private System.Windows.Forms.DataGridViewTextBoxColumn su_usemacode;
         private System.Windows.Forms.CheckBox SU_RETURNIFCLEAN;
+        private CustomControl.TextBoxWithIcon.EnterTextBox em_code;
+        private System.Windows.Forms.Label em_code_label;
+        private CustomControl.TextBoxWithIcon.EnterTextBox em_code1;
+        private System.Windows.Forms.Label em_code1_label;
     }
 }

+ 56 - 26
UAS-MES/FunctionCode/Make/Make_SMTStencil.cs

@@ -46,7 +46,6 @@ namespace UAS_MES.Make
             ma_code.SelectField = "ma_code # 工单号,ma_prodcode # 产品编号,ma_qty # 工单数量,pr_detail # 产品名称,ma_softversion # 软件版本,ma_salecode # 销售单号,pr_sendchecktype # 产品送检方式";
             ma_code.FormName = Name;
             ma_code.SetValueField = new string[] { "ma_code", "ma_prodcode", "ma_qty", "pr_detail", "ma_softversion", "ma_salecode", "nvl(pr_sendchecktype,'LineCode')pr_sendchecktype" };
-            ma_code.Condition = "ma_statuscode in('STARTED','AUDITED')";
             ma_code.DbChange += Ma_code_DbChange;
 
             li_code.TableName = "Line";
@@ -112,24 +111,45 @@ namespace UAS_MES.Make
             {
                 MessageBox.Show("钢网编号" + SU_DEVCODE.Text + "不存在或者未审核");
             }
+            //限制钢网使用的产品
             dt = (DataTable)dh.ExecuteSql("select 1 from STENILCANUSEPRO where sp_stcode='" + SU_DEVCODE.Text + "' and sp_prodcode='" + ma_prodcode.Text + "'", "select");
             if (dt.Rows.Count == 0)
             {
                 MessageBox.Show("钢网编号" + SU_DEVCODE.Text + "不能在产品" + ma_prodcode.Text + "中使用");
                 return;
             }
-            sql.Clear();
-            sql.Append("update StencilUse set su_usedate=sysdate,SU_USEPRODCODE='" + ma_prodcode.Text + "',su_usemacode='" + ma_code.Text + "', ");
-            sql.Append("su_useman='" + User.UserName + "',SU_TABLE='" + st_table.Text + "',su_singlepringqty='" + su_singlepringqty1.Text + "',");
-            sql.Append("su_stverison='" + version + "',SU_STATUS='在线',su_linecode='" + li_code.Text + "' ");
-            sql.Append("where su_id=(select max(su_id) from stenciluse where su_stcode='" + SU_DEVCODE.Text + "')");
-            dh.ExecuteSql(sql.ToString(), "update");
-            dh.ExecuteSql("update Stencil set ST_USESTATUS='在线' where st_code='" + SU_DEVCODE.Text + "'", "update");
-            MessageBox.Show("领用成功");
-            st_table.SelectedItem = null;
-            SU_DEVCODE.Text = "";
-            Receive.Enabled = false;
-            LoadGridData();
+            //一条线只能在线一个钢网
+            dt = (DataTable)dh.ExecuteSql("select su_stcode from stenciluse where su_linecode='" + li_code.Text + "' and su_status='在线'", "select");
+            if (dt.Rows.Count > 0)
+            {
+                MessageBox.Show("线别" + li_code.Text + "已有领用的钢网" + dt.Rows[0]["su_stcode"].ToString() + ",请先退回");
+                return;
+            }
+            else
+            {
+                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();
+                }
+                else
+                {
+                    MessageBox.Show("人员编号" + em_code.Text + "不存在");
+                }
+            }
         }
 
         private void Return_Click(object sender, EventArgs e)
@@ -156,19 +176,29 @@ namespace UAS_MES.Make
                     MessageBox.Show("钢网编号" + SU_DEVCODE1.Text + "不存在或者未审核");
                 }
                 string St_USECOUNT = dt.Rows[0]["St_USECOUNT"].ToString();
-                sql.Clear();
-                sql.Append("update StencilUse set SU_BACKDATE=sysdate,");
-                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 + "')");
-                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 = "";
-                SU_RETURNIFCLEAN.Checked = false;
-                Confirm.PerformClick();
+                dt = (DataTable)dh.ExecuteSql("select em_name from employee where em_code='" + em_code.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();
+                }
+                else
+                {
+                    MessageBox.Show("人员编号" + em_code.Text + "不存在");
+                }
+
             }
             else
             {

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_SMTStockStencil.cs

@@ -143,7 +143,7 @@ namespace UAS_MES.Make
                     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("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 + "')");
+                    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_USESTATUS='在仓',ST_ENSIONA='" + ST_ENSIONA.Text + "',ST_ENSIONB='" + ST_ENSIONB.Text + "',");