章政 8 سال پیش
والد
کامیت
d6e1de2308

+ 72 - 35
UAS-MES/FunctionCode/Make/Make_NewMatainInf.Designer.cs

@@ -28,6 +28,34 @@
         /// </summary>
         private void InitializeComponent()
         {
+            System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("主板");
+            System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("液晶屏");
+            System.Windows.Forms.ListViewItem listViewItem3 = new System.Windows.Forms.ListViewItem("电路板");
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Make_NewMatainInf));
+            this.mbc_component_lsv = new System.Windows.Forms.ListView();
+            this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.nrg_name_lsv = new System.Windows.Forms.ListView();
+            this.nrg_code = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.nrg_name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.nr_name_lsv = new System.Windows.Forms.ListView();
+            this.nr_code = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.nr_name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.nr_groupcode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.mbr_dutycode_lsv = new System.Windows.Forms.ListView();
+            this.nd_code = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.nd_name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.mbr_solutioncode_lsv = new System.Windows.Forms.ListView();
+            this.so_code = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.so_name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.Cancel = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.Save = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.groupBoxWithBorder1 = new UAS_MES.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
+            this.bc_name = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.bc_name_label = new System.Windows.Forms.Label();
+            this.bg_name = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.bg_name_label = new System.Windows.Forms.Label();
+            this.headBar1 = new UAS_MES.CustomControl.HeadBar();
+            this.groupBoxWithBorder1.SuspendLayout();
             this.SuspendLayout();
             // 
             // mbc_component_lsv
@@ -40,9 +68,10 @@
             listViewItem1,
             listViewItem2,
             listViewItem3});
-            this.mbc_component_lsv.Location = new System.Drawing.Point(12, 159);
+            this.mbc_component_lsv.Location = new System.Drawing.Point(9, 127);
+            this.mbc_component_lsv.Margin = new System.Windows.Forms.Padding(2);
             this.mbc_component_lsv.Name = "mbc_component_lsv";
-            this.mbc_component_lsv.Size = new System.Drawing.Size(291, 190);
+            this.mbc_component_lsv.Size = new System.Drawing.Size(219, 153);
             this.mbc_component_lsv.TabIndex = 1;
             this.mbc_component_lsv.UseCompatibleStateImageBehavior = false;
             this.mbc_component_lsv.View = System.Windows.Forms.View.Details;
@@ -61,9 +90,10 @@
             this.nrg_name_lsv.Cursor = System.Windows.Forms.Cursors.Default;
             this.nrg_name_lsv.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.nrg_name_lsv.FullRowSelect = true;
-            this.nrg_name_lsv.Location = new System.Drawing.Point(309, 159);
+            this.nrg_name_lsv.Location = new System.Drawing.Point(232, 127);
+            this.nrg_name_lsv.Margin = new System.Windows.Forms.Padding(2);
             this.nrg_name_lsv.Name = "nrg_name_lsv";
-            this.nrg_name_lsv.Size = new System.Drawing.Size(264, 190);
+            this.nrg_name_lsv.Size = new System.Drawing.Size(199, 153);
             this.nrg_name_lsv.TabIndex = 2;
             this.nrg_name_lsv.UseCompatibleStateImageBehavior = false;
             this.nrg_name_lsv.View = System.Windows.Forms.View.Details;
@@ -71,7 +101,7 @@
             // 
             // nrg_code
             // 
-            this.nrg_code.Text = "";
+            this.nrg_code.Text = "不良原因组代码";
             this.nrg_code.Width = 0;
             // 
             // nrg_name
@@ -87,9 +117,10 @@
             this.nr_groupcode});
             this.nr_name_lsv.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.nr_name_lsv.FullRowSelect = true;
-            this.nr_name_lsv.Location = new System.Drawing.Point(581, 159);
+            this.nr_name_lsv.Location = new System.Drawing.Point(436, 127);
+            this.nr_name_lsv.Margin = new System.Windows.Forms.Padding(2);
             this.nr_name_lsv.Name = "nr_name_lsv";
-            this.nr_name_lsv.Size = new System.Drawing.Size(241, 381);
+            this.nr_name_lsv.Size = new System.Drawing.Size(182, 306);
             this.nr_name_lsv.TabIndex = 3;
             this.nr_name_lsv.UseCompatibleStateImageBehavior = false;
             this.nr_name_lsv.View = System.Windows.Forms.View.Details;
@@ -97,6 +128,7 @@
             // 
             // nr_code
             // 
+            this.nr_code.Text = "不良原因代码";
             this.nr_code.Width = 0;
             // 
             // nr_name
@@ -115,9 +147,10 @@
             this.nd_name});
             this.mbr_dutycode_lsv.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.mbr_dutycode_lsv.FullRowSelect = true;
-            this.mbr_dutycode_lsv.Location = new System.Drawing.Point(12, 355);
+            this.mbr_dutycode_lsv.Location = new System.Drawing.Point(9, 284);
+            this.mbr_dutycode_lsv.Margin = new System.Windows.Forms.Padding(2);
             this.mbr_dutycode_lsv.Name = "mbr_dutycode_lsv";
-            this.mbr_dutycode_lsv.Size = new System.Drawing.Size(291, 185);
+            this.mbr_dutycode_lsv.Size = new System.Drawing.Size(219, 149);
             this.mbr_dutycode_lsv.TabIndex = 5;
             this.mbr_dutycode_lsv.UseCompatibleStateImageBehavior = false;
             this.mbr_dutycode_lsv.View = System.Windows.Forms.View.Details;
@@ -140,9 +173,10 @@
             this.so_name});
             this.mbr_solutioncode_lsv.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.mbr_solutioncode_lsv.FullRowSelect = true;
-            this.mbr_solutioncode_lsv.Location = new System.Drawing.Point(309, 355);
+            this.mbr_solutioncode_lsv.Location = new System.Drawing.Point(232, 284);
+            this.mbr_solutioncode_lsv.Margin = new System.Windows.Forms.Padding(2);
             this.mbr_solutioncode_lsv.Name = "mbr_solutioncode_lsv";
-            this.mbr_solutioncode_lsv.Size = new System.Drawing.Size(264, 185);
+            this.mbr_solutioncode_lsv.Size = new System.Drawing.Size(199, 149);
             this.mbr_solutioncode_lsv.TabIndex = 6;
             this.mbr_solutioncode_lsv.UseCompatibleStateImageBehavior = false;
             this.mbr_solutioncode_lsv.View = System.Windows.Forms.View.Details;
@@ -165,12 +199,13 @@
             this.Cancel.DownImage = ((System.Drawing.Image)(resources.GetObject("Cancel.DownImage")));
             this.Cancel.Image = null;
             this.Cancel.IsShowBorder = true;
-            this.Cancel.Location = new System.Drawing.Point(435, 563);
+            this.Cancel.Location = new System.Drawing.Point(326, 450);
+            this.Cancel.Margin = new System.Windows.Forms.Padding(2);
             this.Cancel.MoveImage = ((System.Drawing.Image)(resources.GetObject("Cancel.MoveImage")));
             this.Cancel.Name = "Cancel";
             this.Cancel.NormalImage = ((System.Drawing.Image)(resources.GetObject("Cancel.NormalImage")));
             this.Cancel.Power = null;
-            this.Cancel.Size = new System.Drawing.Size(80, 35);
+            this.Cancel.Size = new System.Drawing.Size(60, 28);
             this.Cancel.TabIndex = 58;
             this.Cancel.Text = "取消";
             this.Cancel.UseVisualStyleBackColor = false;
@@ -183,12 +218,13 @@
             this.Save.DownImage = ((System.Drawing.Image)(resources.GetObject("Save.DownImage")));
             this.Save.Image = null;
             this.Save.IsShowBorder = true;
-            this.Save.Location = new System.Drawing.Point(317, 563);
+            this.Save.Location = new System.Drawing.Point(238, 450);
+            this.Save.Margin = new System.Windows.Forms.Padding(2);
             this.Save.MoveImage = ((System.Drawing.Image)(resources.GetObject("Save.MoveImage")));
             this.Save.Name = "Save";
             this.Save.NormalImage = ((System.Drawing.Image)(resources.GetObject("Save.NormalImage")));
             this.Save.Power = null;
-            this.Save.Size = new System.Drawing.Size(80, 35);
+            this.Save.Size = new System.Drawing.Size(60, 28);
             this.Save.TabIndex = 57;
             this.Save.Text = "保存";
             this.Save.UseVisualStyleBackColor = false;
@@ -203,9 +239,11 @@
             this.groupBoxWithBorder1.Controls.Add(this.bg_name_label);
             this.groupBoxWithBorder1.Dock = System.Windows.Forms.DockStyle.Top;
             this.groupBoxWithBorder1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.groupBoxWithBorder1.Location = new System.Drawing.Point(0, 40);
+            this.groupBoxWithBorder1.Location = new System.Drawing.Point(0, 32);
+            this.groupBoxWithBorder1.Margin = new System.Windows.Forms.Padding(2);
             this.groupBoxWithBorder1.Name = "groupBoxWithBorder1";
-            this.groupBoxWithBorder1.Size = new System.Drawing.Size(832, 100);
+            this.groupBoxWithBorder1.Padding = new System.Windows.Forms.Padding(2);
+            this.groupBoxWithBorder1.Size = new System.Drawing.Size(624, 80);
             this.groupBoxWithBorder1.TabIndex = 4;
             this.groupBoxWithBorder1.TabStop = false;
             this.groupBoxWithBorder1.Text = "工单信息";
@@ -214,18 +252,17 @@
             // bc_name
             // 
             this.bc_name.AllPower = null;
-            this.bc_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            this.bc_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
             | System.Windows.Forms.AnchorStyles.Left)));
             this.bc_name.BackColor = System.Drawing.Color.White;
             this.bc_name.Enabled = false;
             this.bc_name.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.bc_name.ForeColor = System.Drawing.Color.Black;
             this.bc_name.ID = null;
-            this.bc_name.Location = new System.Drawing.Point(538, 42);
-            this.bc_name.Margin = new System.Windows.Forms.Padding(4);
+            this.bc_name.Location = new System.Drawing.Point(404, 34);
             this.bc_name.Name = "bc_name";
             this.bc_name.Power = null;
-            this.bc_name.Size = new System.Drawing.Size(187, 27);
+            this.bc_name.Size = new System.Drawing.Size(141, 23);
             this.bc_name.Str = null;
             this.bc_name.Str1 = null;
             this.bc_name.Str2 = null;
@@ -236,28 +273,26 @@
             // 
             this.bc_name_label.AutoSize = true;
             this.bc_name_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.bc_name_label.Location = new System.Drawing.Point(411, 42);
-            this.bc_name_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.bc_name_label.Location = new System.Drawing.Point(308, 34);
             this.bc_name_label.Name = "bc_name_label";
-            this.bc_name_label.Size = new System.Drawing.Size(92, 27);
+            this.bc_name_label.Size = new System.Drawing.Size(74, 21);
             this.bc_name_label.TabIndex = 101;
             this.bc_name_label.Text = "不良代码";
             // 
             // bg_name
             // 
             this.bg_name.AllPower = null;
-            this.bg_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            this.bg_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
             | System.Windows.Forms.AnchorStyles.Left)));
             this.bg_name.BackColor = System.Drawing.Color.White;
             this.bg_name.Enabled = false;
             this.bg_name.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.bg_name.ForeColor = System.Drawing.Color.Black;
             this.bg_name.ID = null;
-            this.bg_name.Location = new System.Drawing.Point(170, 42);
-            this.bg_name.Margin = new System.Windows.Forms.Padding(4);
+            this.bg_name.Location = new System.Drawing.Point(128, 34);
             this.bg_name.Name = "bg_name";
             this.bg_name.Power = null;
-            this.bg_name.Size = new System.Drawing.Size(187, 27);
+            this.bg_name.Size = new System.Drawing.Size(141, 23);
             this.bg_name.Str = null;
             this.bg_name.Str1 = null;
             this.bg_name.Str2 = null;
@@ -268,10 +303,9 @@
             // 
             this.bg_name_label.AutoSize = true;
             this.bg_name_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.bg_name_label.Location = new System.Drawing.Point(25, 42);
-            this.bg_name_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.bg_name_label.Location = new System.Drawing.Point(19, 34);
             this.bg_name_label.Name = "bg_name_label";
-            this.bg_name_label.Size = new System.Drawing.Size(112, 27);
+            this.bg_name_label.Size = new System.Drawing.Size(90, 21);
             this.bg_name_label.TabIndex = 99;
             this.bg_name_label.Text = "不良代码组";
             // 
@@ -280,9 +314,8 @@
             this.headBar1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
             this.headBar1.Dock = System.Windows.Forms.DockStyle.Top;
             this.headBar1.Location = new System.Drawing.Point(0, 0);
-            this.headBar1.Margin = new System.Windows.Forms.Padding(4);
             this.headBar1.Name = "headBar1";
-            this.headBar1.Size = new System.Drawing.Size(832, 40);
+            this.headBar1.Size = new System.Drawing.Size(624, 32);
             this.headBar1.TabIndex = 0;
             this.headBar1.Title = "新增维修信息";
             // 
@@ -290,7 +323,7 @@
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(832, 610);
+            this.ClientSize = new System.Drawing.Size(624, 488);
             this.Controls.Add(this.Cancel);
             this.Controls.Add(this.Save);
             this.Controls.Add(this.mbr_solutioncode_lsv);
@@ -301,9 +334,13 @@
             this.Controls.Add(this.mbc_component_lsv);
             this.Controls.Add(this.headBar1);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Margin = new System.Windows.Forms.Padding(2);
             this.Name = "Make_NewMatainInf";
             this.Tag = "ShowDialogWindow";
             this.Text = "Make_NewMatainInf";
+            this.Load += new System.EventHandler(this.Make_NewMatainInf_Load);
+            this.groupBoxWithBorder1.ResumeLayout(false);
+            this.groupBoxWithBorder1.PerformLayout();
             this.ResumeLayout(false);
 
         }
@@ -327,11 +364,11 @@
         private System.Windows.Forms.ColumnHeader nd_code;
         private System.Windows.Forms.ColumnHeader so_code;
         private System.Windows.Forms.ColumnHeader nr_name;
-        private System.Windows.Forms.ColumnHeader nrg_code;
         private System.Windows.Forms.ColumnHeader nr_code;
         private System.Windows.Forms.ColumnHeader nr_groupcode;
         private System.Windows.Forms.ColumnHeader nd_name;
         private System.Windows.Forms.ColumnHeader so_name;
         private System.Windows.Forms.ColumnHeader columnHeader1;
+        private System.Windows.Forms.ColumnHeader nrg_code;
     }
 }

+ 3 - 3
UAS-MES/FunctionCode/Make/Make_NewMatainInf.cs

@@ -40,7 +40,7 @@ namespace UAS_MES.Make
 
         LogStringBuilder sql = new LogStringBuilder();
 
-        public Make_NewMatainInf(string iBgName, string iBgCode, string iBcName, string iBccode, string iSnCode, string iMsID, string iMbID )
+        public Make_NewMatainInf(string iBgName, string iBgCode, string iBcName, string iBccode, string iSnCode, string iMsID, string iMbID)
         {
             InitializeComponent();
             bg_name.Text = iBgName;
@@ -109,7 +109,7 @@ namespace UAS_MES.Make
             {
                 ListViewItem lvi = new ListViewItem(dt.Rows[i][0].ToString());
                 //第一列是勾选列,设置列头文本为空
-                for (int j = 1; j < dt.Columns.Count; j++) 
+                for (int j = 1; j < dt.Columns.Count; j++)
                     lvi.SubItems.Add(dt.Rows[i][j].ToString());
                 lsv.Items.Add(lvi);
             }
@@ -183,7 +183,7 @@ namespace UAS_MES.Make
                         sql.Append("insert into makebadreason (mbr_mbid,mbr_id,mbr_brcode,mbr_solutioncode,");
                         sql.Append("mbr_dutycode,mbr_brgcode,mbr_badcode,mbr_sncode,mbr_makecode,mbr_indate,");
                         sql.Append("mbr_inman) select '" + mbid + "','" + mbr_id + "','" + nrgcode + "',");
-                        sql.Append("'" + mbrsolutioncode + "','" + mbrdutycode + "','" + nrcode + "','" + bccode+ "',");
+                        sql.Append("'" + mbrsolutioncode + "','" + mbrdutycode + "','" + nrcode + "','" + bccode + "',");
                         sql.Append("'" + sncode + "','" + macode + "',sysdate,'" + User.UserCode + "' from dual");
                         dh.ExecuteSql(sql.GetString(), "insert");
                     }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 246 - 245
UAS-MES/FunctionCode/Make/Make_Repair.Designer.cs


+ 223 - 25
UAS-MES/FunctionCode/Make/Make_Repair.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
@@ -29,6 +30,10 @@ namespace UAS_MES.Make
         string insert_makeprocess = "insert into makeprocess(mp_id,mp_makecode,mp_maid, mp_mscode,mp_sncode,mp_stepcode,mp_stepname,mp_craftcode,mp_craftname,mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode) select MakeProcess_seq.nextval, ma_code,ma_id,ms_code,ms_sncode,mcd_stepcode,mcd_stepname,ma_craftcode,'','维修作业','#',sysdate,'" + User.UserName + "',ma_wccode,ma_linecode,'' from make left join makecraftdetail on mcd_macode=ma_code left join makeserial on ms_makecode=ma_code where ms_sncode=:ms_sncode and ma_code=:ma_code";
         //是否获取过下拉框数据
         bool GetSelectData = false;
+
+        string mb_id = "";
+
+        string mbr_id = "";
         /// <summary>
         /// 存放父节点信息
         /// </summary>
@@ -50,25 +55,39 @@ namespace UAS_MES.Make
 
         string macode;
 
+        string msid = "";
+
+        string dbtable1 = "(select distinct nvl(dsl_prodcode,msl_prodcode)prodcode from ReduceStepRecord left join devsmtlocation on dsl_linecode=rsd_linecode and dsl_makecode=rsd_macode left join makesmtlocation on msl_linecode=rsd_linecode and msl_makecode=rsd_macode where rsd_macode=':macode'  and rsd_sncode=':sncode') left join product on pr_code=prodcode";
+
+        string dbtable2 = "(select distinct nvl(dsl_prodcode,msl_prodcode)prodcode from ReduceStepRecord left join devsmtlocation on dsl_linecode=rsd_linecode and dsl_makecode=rsd_macode left join makesmtlocation on msl_linecode=rsd_linecode and msl_makecode=rsd_macode where rsd_macode=':macode'  and rsd_sncode=':sncode' and ((dsl_location=':msl_location' and dsl_validtime<sysdate and sysdate<dsl_invalidtime) ) or (msl_location=':msl_location' and msl_validtime<sysdate and sysdate<msl_invalidtime)) left join product on pr_code=prodcode";
+
         public Make_Repair()
         {
             InitializeComponent();
+        }
+
+        private void 维修作业_Load(object sender, EventArgs e)
+        {
+            dh = new DataHelper();
             //为DBFind配置Call和Form的名称
             cr_code.FormName = Name;
             cr_code.TableName = "craft";
             cr_code.SelectField = "cr_name # 工艺名称 ,cr_code # 工艺编号,cr_prodcode # 物料编号";
             cr_code.SetValueField = new string[] { "cr_code" };
+            cr_code.DBTitle = "回流工艺";
 
             cd_stepcode.FormName = Name;
             cd_stepcode.TableName = "craftdetail left join step on st_code=cd_stepcode left join craft on cd_crid=cr_id";
             cd_stepcode.SetValueField = new string[] { "cd_stepcode" };
             cd_stepcode.SelectField = "cd_stepname # 工序名称 ,cd_stepcode # 工序编号,cd_stepno # 执行顺序";
-            cd_stepcode.Condition = "ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "'";
-        }
+            cd_stepcode.DBTitle = "回流工序";
+
+            prodcode.FormName = Name;
+            prodcode.TableName = dbtable1.Replace(":macode", macode).Replace(":sncode", GetSNCode.Text);
+            prodcode.SetValueField = new string[] { "prodcode" };
+            prodcode.SelectField = "prodcode # 不良零件编号,pr_detail # 零件名称";
+            prodcode.DBTitle = "不良零件";
 
-        private void 维修作业_Load(object sender, EventArgs e)
-        {
-            dh = new DataHelper();
             asc.controllInitializeSize(this);
             GetSNCode.Focus();
         }
@@ -91,14 +110,19 @@ namespace UAS_MES.Make
                     {
                         //验证makeserial或者ms_firstsn表序列号是否存在
                         sql.Clear();
-                        sql.Append("select max(ms_id) from makeserial where ms_makecode ='" + macode + "' and(ms_sncode");
-                        sql.Append("='" + GetSNCode.Text + "' or ms_firstsn in (select firstsn from makesnrelation ");
-                        sql.Append("where sn='" + GetSNCode.Text + "'))");
+                        sql.Append("select max(ms_id) ms_id,ms_makecode,ms_prodcode,ms_sncode,pr_detail,ms_stepcode,ms_craftcode ");
+                        sql.Append("from makeserial left join product on pr_code=ms_prodcode where ms_makecode ='" + macode + "' and(ms_sncode");
+                        sql.Append("='" + GetSNCode.Text + "' or ms_firstsn in (select firstsn from makesnrelation where ");
+                        sql.Append("sn='" + GetSNCode.Text + "')) group by ms_makecode,ms_prodcode,ms_sncode,pr_detail,ms_stepcode,ms_craftcode");
                         dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                         if (dt.Rows.Count > 0)
+                        {
+                            msid = dt.Rows[0]["ms_id"].ToString();
+                            BaseUtil.SetFormValue(this.Controls, dt);
                             LoadBadInfTree(sender, e);
+                        }
                         else
-                            OperatResult.AppendText(">>序列号" + GetSNCode.Text + "不存在\n", Color.Red);
+                            OperatResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                     }
                     else
                         OperatResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
@@ -117,24 +141,26 @@ namespace UAS_MES.Make
         {
             if (e.Node.Level == 0)
             {
-                string mb_id = e.Node.Tag.ToString();
+                mb_id = e.Node.Tag.ToString();
+                BaseUtil.CleanControlsText(bc_name, bc_code, bg_name, bg_code, mb_badremark, nrg_name, nr_name, nr_code, mbr_solutioncode, mbr_dutycode, mbc_component);
                 bc_name.Text = BadInf_1[mb_id]["bc_name"];
+                bc_code.Text = BadInf_1[mb_id]["mb_badcode"];
                 bg_name.Text = BadInf_1[mb_id]["bg_name"];
+                bg_code.Text = BadInf_1[mb_id]["mb_bgcode"];
                 mb_badremark.Text = BadInf_1[mb_id]["mb_badremark"];
             }
             if (e.Node.Level == 1)
             {
-                string mbr_id = e.Node.Tag.ToString();
+                mbr_id = e.Node.Tag.ToString();
                 nrg_name.Text = BadInf_2[mbr_id]["nrg_name"];
                 nr_name.Text = BadInf_2[mbr_id]["nr_name"];
-                mbr_solutioncode.Text = BadInf_2[mbr_id]["mbr_solutioncode"];
+                nr_code.Text = BadInf_2[mbr_id]["nr_code"];
+                mbr_solutioncode.Text = BadInf_2[mbr_id]["so_name"];
                 mbr_dutycode.Text = BadInf_2[mbr_id]["mbr_dutycode"];
                 mbc_component.Text = dh.getFieldDataByCondition("makebadrscom", "mbc_component", "mbc_mbrid=" + mbr_id).ToString();
                 //加载两个Grid的数据源
-                ComponentSource.DataSource = (DataTable)dh.ExecuteSql("select mbp_part from makebadrspart where mbp_mbrid=" + mbr_id, "select");
-                LocationSource.DataSource = (DataTable)dh.ExecuteSql("select mbl_loc from makebadrsloc where mbl_mbrid=" + mbr_id, "select");
-                mbl_locdgv.DataSource = LocationSource;
-                mbp_partdgv.DataSource = ComponentSource;
+                mbp_partdgv.DataSource = (DataTable)dh.ExecuteSql("select mbp_id,mbp_part from makebadrspart where mbp_mbrid=" + mbr_id, "select");
+                mbl_locdgv.DataSource = (DataTable)dh.ExecuteSql("select mbl_id,mbl_loc from makebadrsloc where mbl_mbrid=" + mbr_id, "select");
             }
         }
 
@@ -150,7 +176,8 @@ namespace UAS_MES.Make
             {
                 //添加根节点
                 TreeNode tnode_0 = new TreeNode();
-                tnode_0.Text = dt.Rows[i]["mb_bgcode"].ToString();
+                tnode_0.Text = dt.Rows[i]["bg_name"].ToString() + ":" + dt.Rows[i]["bc_name"].ToString();
+                tnode_0.Name = dt.Rows[i]["mb_bgcode"].ToString();
                 //作为Dictionary的主标识
                 string mb_id = dt.Rows[i]["mb_id"].ToString();
                 tnode_0.Tag = mb_id;
@@ -167,10 +194,10 @@ namespace UAS_MES.Make
                 BadCodeTree.Nodes.Add(tnode_0);
                 //添加子节点
                 sql.Clear();
-                sql.Append("select mbr_id,mbr_brcode,mbr_brgcode,mbr_solutioncode,so_name,mbr_dutycode,nd_name,");
-                sql.Append("nrg_name,nr_name from makebadreason left join QUA_NGReason left join QUA_NGREASONGROUP on ");
-                sql.Append("nrg_code=nr_group on nr_code=mbr_brcode left join solution ");
-                sql.Append("on so_code=mbr_solutioncode left join ngduty on nd_code=mbr_dutycode where mbr_mbid=" + mb_id);
+                sql.Append("select mbr_id,mbr_brcode,mbr_brgcode,mbr_solutioncode,so_name,mbr_dutycode,nd_name,nrg_name");
+                sql.Append(",nr_name,nr_code from makebadreason left join QUA_NGReason left join QUA_NGREASONGROUP on ");
+                sql.Append("nrg_code=nr_group on nr_code=mbr_brcode left join solution on so_code=mbr_solutioncode ");
+                sql.Append("left join ngduty on nd_code=mbr_dutycode where mbr_mbid=" + mb_id);
                 DataTable dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 for (int j = 0; j < dt1.Rows.Count; j++)
                 {
@@ -188,12 +215,15 @@ namespace UAS_MES.Make
                     dic1.Add("so_name", dt1.Rows[j]["so_name"].ToString());
                     dic1.Add("nrg_name", dt1.Rows[j]["nrg_name"].ToString());
                     dic1.Add("nr_name", dt1.Rows[j]["nr_name"].ToString());
+                    dic1.Add("nr_code", dt1.Rows[j]["nr_code"].ToString());
                     tnode_1.Text = dt1.Rows[j]["mbr_brgcode"].ToString();
                     if (!BadInf_2.ContainsKey(mbr_id))
                         BadInf_2.Add(mbr_id, dic1);
                     tnode_0.Nodes.Add(tnode_1);
                 }
             }
+            if (bg_code.Text != "")
+                BadCodeTree.Nodes[bg_code.Text].Expand();
         }
 
         private void RefreshTreeView_Click(object sender, EventArgs e)
@@ -203,12 +233,52 @@ namespace UAS_MES.Make
 
         private void RepairComplete_Click(object sender, EventArgs e)
         {
-
+            int RejectNum = int.Parse(dh.getFieldDataByCondition("makebad", "count(0) cn", "mb_sncode='" + GetSNCode.Text + "' and mb_status not in (1,-1)").ToString());
+            if (RejectNum > 0)
+                OperatResult.AppendText(">>维修结果必须为已维修或无不良\n", Color.Red);
+            else
+            {
+                dt = (DataTable)dh.ExecuteSql("select cr_id from craft where cr_statuscode='AUDITED' and cr_code='" + cr_code.Text + "'", "select");
+                if (dt.Rows.Count == 0)
+                    OperatResult.AppendText(">>回流工序不存在\n", Color.Red);
+                else
+                {
+                    string cr_id = dt.Rows[0]["cr_id"].ToString();
+                    dt = (DataTable)dh.ExecuteSql("select cd_ifinput from craftdetail left join step on st_code=cd_stepcode where cd_crid='" + cr_id + "' and cd_stepcode='" + cd_stepcode.Text + "' and st_statuscode='AUDITED'", "select");
+                    if (dt.Rows.Count == 0)
+                        OperatResult.AppendText(">>回流工序不在回流工艺中\n", Color.Red);
+                    else
+                    {
+                        dh.UpdateByCondition("makeserial", "ms_nextstepcode='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_status=1", "ms_sncode='" + ms_sncode.Text + "'");
+                        dh.ExecuteSql(insert_makeprocess.Replace("#", "完成维修"), "insert", ms_sncode.Text, User.CurrentStepCode);
+                        OperatResult.AppendText(">>序列号" + ms_sncode.Text + "回流成功\n", Color.Green);
+                        GetSNCode.Clear();
+                    }
+                }
+            }
         }
 
         private void Scrap_Click(object sender, EventArgs e)
         {
-
+            //判断是否有无法维修的记录
+            int ScrapNum = int.Parse(dh.getFieldDataByCondition("makebad", "count(0) cn", "mb_sncode='" + ms_sncode.Text + "'").ToString());
+            if (ScrapNum == 0)
+            {
+                OperatResult.AppendText(">>存在无法维修的记录才允许报废\n", Color.Red);
+            }
+            else
+            {
+                string confirm = MessageBox.Show(this.ParentForm, "此操作不可撤销,是否确认报废", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk).ToString();
+                if (confirm == "Yes")
+                {
+                    dh.UpdateByCondition("makeserial", "ms_status=4,ms_nextstepcode='',ms_stepcode='" + User.CurrentStepCode + "'", "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
+                    dh.UpdateByCondition("make", "MA_NGMADEQTY=nvl(MA_NGMADEQTY,0)+1", "ma_code='" + macode + "'");
+                    OperatResult.AppendText(">>报废成功\n", Color.Green);
+                    GetSNCode.Clear();
+                    BaseUtil.CleanForm(this);
+                    BadCodeTree.Nodes.Clear();
+                }
+            }
         }
 
         private void NewBadCode_Click(object sender, EventArgs e)
@@ -221,19 +291,147 @@ namespace UAS_MES.Make
 
         private void NewRepairInf_Click(object sender, EventArgs e)
         {
-            Make_NewMatainInf mataininf = new Make_NewMatainInf();
+            Make_NewMatainInf mataininf = new Make_NewMatainInf(bg_name.Text, bg_code.Text, bc_name.Text, bc_code.Text, GetSNCode.Text, msid, mb_id);
+            mataininf.FormClosed += LoadBadInfTree;
             BaseUtil.SetFormCenter(mataininf);
             mataininf.ShowDialog();
         }
 
         private void SaveRepairInf_Click(object sender, EventArgs e)
         {
-
+            //保存不良零件
+            DataTable dt = (DataTable)mbp_partdgv.DataSource;
+            List<string> prodcode = new List<string>();
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                if (dt.Rows[i]["mbp_id"].ToString() == "")
+                    prodcode.Add(dt.Rows[i]["mbp_part"].ToString());
+            }
+            sql.Clear();
+            sql.Append("insert into makebadrspart(mbp_id,mbp_mbrid,mbp_part,mbp_badcode,");
+            sql.Append("mbp_brcode,mbp_sncode,mbp_makecode,mbp_indate,mbp_inman)");
+            sql.Append("select makebadrspart_seq.nextval," + mbr_id + ",:prodcode,");
+            sql.Append("'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + macode + "',");
+            sql.Append("sysdate,'" + User.UserCode + "' from dual");
+            dh.BatchInsert(sql.GetString(), new string[] { "prodcode" }, prodcode.ToArray());
+            //保存不良位置
+            dt = (DataTable)mbl_locdgv.DataSource;
+            List<string> location = new List<string>();
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                if (dt.Rows[i]["mbl_id"].ToString() == "")
+                    location.Add(dt.Rows[i]["mbl_loc"].ToString());
+            }
+            sql.Clear();
+            sql.Append("insert into makebadrsloc(mbl_id,mbl_mbrid,mbl_loc,mbl_badcode,mbl_brcode,");
+            sql.Append("mbl_sncode,mbl_makecode,mbl_indate ,mbl_inman) select makebadrsloc_seq.nextval," + mbr_id);
+            sql.Append(",:location,'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + macode + "',");
+            sql.Append("sysdate,'" + User.UserCode + "' from dual");
+            dh.BatchInsert(sql.GetString(), new string[] { "location" }, location.ToArray());
+            MessageBox.Show("保存成功");
         }
 
         private void DeleteRepairInf_Click(object sender, EventArgs e)
+        {
+            DataTable dt = (DataTable)dh.ExecuteSql("select ms_makecode from makeserial where ms_id='" + msid + "' and ms_sncode='" + GetSNCode.Text + "' and ms_status=3", "select");
+            if (dt.Rows.Count > 0)
+            {
+                if (mbr_id != "")
+                {
+                    string delete1 = "delete from makebadrsloc where mbl_mbrid=" + mbr_id;
+                    string delete2 = "delete from makebadrspart where mbp_mbrid=" + mbr_id;
+                    string delete3 = "delete from makebadrscom where mbc_mbrid=" + mbr_id;
+                    string delete4 = "delete from makebadreason where mbr_id=" + mbr_id;
+                    dh.ExecuteSQLTran(delete1, delete2, delete3, delete4);
+                    OperatResult.AppendText(">>删除成功\n", Color.Green);
+                    mbr_id = "";
+                    //删除后重新加载Tree的信息
+                    LoadBadInfTree(sender, e);
+                }
+                else OperatResult.AppendText(">>必须选择不良原因\n", Color.Red);
+            }
+            else
+                OperatResult.AppendText(">>序列号错误,不存在或者不处于维修状态\n", Color.Red);
+        }
+
+        private void SaveBadLocation_Click(object sender, EventArgs e)
+        {
+            DataTable dt = (DataTable)dh.ExecuteSql("select ms_makecode from makeserial where ms_id='" + msid + "' and ms_sncode='" + GetSNCode.Text + "' and ms_status=3", "select");
+            if (dt.Rows.Count > 0)
+            {
+                if (mbl_loc.Text != "")
+                {
+                    if (mbr_id != "")
+                    {
+                        dt = (DataTable)mbl_locdgv.DataSource;
+                        DataRow dr = dt.NewRow();
+                        dr["mbl_loc"] = mbl_loc.Text;
+                        dt.Rows.Add(dr);
+                    }
+                    else OperatResult.AppendText(">>请先选择不良原因\n", Color.Red);
+                }
+            }
+            else
+                OperatResult.AppendText(">>序列号错误,不存在或者不处于维修状态\n", Color.Red);
+        }
+
+        private void mbl_loc_TextChanged(object sender, EventArgs e)
+        {
+            if (mbl_loc.Text != "")
+                prodcode.TableName = dbtable2.Replace(":macode", macode).Replace(":sncode", GetSNCode.Text).Replace(":msl_location", mbl_loc.Text);
+        }
+
+        /// <summary>
+        /// 加载不良零件Grid
+        /// </summary>
+        private void LoadBadPart()
+        {
+        }
+
+        /// <summary>
+        /// 加载不良位置信息
+        /// </summary>
+        private void LoadBadLocation()
         {
 
         }
+
+        private void nr_name_TextChanged(object sender, EventArgs e)
+        {
+            if (nr_name.Text == "")
+                SaveBadLocation.Enabled = false;
+            else
+                SaveBadLocation.Enabled = true;
+        }
+
+
+        private void mbl_loc_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
+                SaveBadLocation_Click(sender, e);
+        }
+
+        private void prodcode_TextKeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
+            {
+                if (prodcode.Text != "")
+                {
+                    if (mbr_id != "")
+                    {
+                        DataTable dt = (DataTable)mbp_partdgv.DataSource;
+                        DataRow dr = dt.NewRow();
+                        dr["mbp_part"] = prodcode.Text;
+                        dt.Rows.Add(dr);
+                    }
+                    else MessageBox.Show("请先选择不良原因");
+                }
+            }
+        }
+
+        private void cr_code_UserControlTextChanged(object sender, EventArgs e)
+        {
+            cd_stepcode.Condition = "ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "'";
+        }
     }
 }

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است