Browse Source

Merge branch 'master' of ssh://10.10.101.21/source/mes-client

Hcsy 8 years ago
parent
commit
b4ba732626

+ 19 - 39
UAS-MES/FunctionCode/Make/Make_BigBoxCollection.Designer.cs

@@ -46,7 +46,7 @@
             this.Clean = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
             this.outboxcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.bigoutboxcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.pa_outboxcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.Printlab = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.ReleasePallet = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.NewPallet = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
@@ -59,7 +59,6 @@
             this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pa_makecode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_standardqty = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
-            this.pa_outboxcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_currentqty = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_packageqty_label = new System.Windows.Forms.Label();
             this.Packing = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
@@ -275,22 +274,22 @@
             this.outboxcode.Tag = "NoAuto";
             this.outboxcode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.outboxcode_KeyDown);
             // 
-            // bigoutboxcode
-            // 
-            this.bigoutboxcode.AllPower = "ifall";
-            this.bigoutboxcode.BackColor = System.Drawing.Color.White;
-            this.bigoutboxcode.ID = null;
-            this.bigoutboxcode.Location = new System.Drawing.Point(111, 36);
-            this.bigoutboxcode.Margin = new System.Windows.Forms.Padding(4);
-            this.bigoutboxcode.Name = "bigoutboxcode";
-            this.bigoutboxcode.Power = "ifwrite";
-            this.bigoutboxcode.Size = new System.Drawing.Size(140, 25);
-            this.bigoutboxcode.Str = null;
-            this.bigoutboxcode.Str1 = null;
-            this.bigoutboxcode.Str2 = null;
-            this.bigoutboxcode.TabIndex = 163;
-            this.bigoutboxcode.Tag = "NoAuto";
-            this.bigoutboxcode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.palletcode_KeyDown);
+            // pa_outboxcode
+            // 
+            this.pa_outboxcode.AllPower = "ifall";
+            this.pa_outboxcode.BackColor = System.Drawing.Color.White;
+            this.pa_outboxcode.ID = null;
+            this.pa_outboxcode.Location = new System.Drawing.Point(111, 36);
+            this.pa_outboxcode.Margin = new System.Windows.Forms.Padding(4);
+            this.pa_outboxcode.Name = "pa_outboxcode";
+            this.pa_outboxcode.Power = "ifwrite";
+            this.pa_outboxcode.Size = new System.Drawing.Size(140, 25);
+            this.pa_outboxcode.Str = null;
+            this.pa_outboxcode.Str1 = null;
+            this.pa_outboxcode.Str2 = null;
+            this.pa_outboxcode.TabIndex = 163;
+            this.pa_outboxcode.Tag = "NoAuto";
+            this.pa_outboxcode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.palletcode_KeyDown);
             // 
             // Printlab
             // 
@@ -443,20 +442,6 @@
             this.pa_standardqty.TabIndex = 105;
             this.pa_standardqty.Tag = "1";
             // 
-            // pa_outboxcode
-            // 
-            this.pa_outboxcode.AutoSize = true;
-            this.pa_outboxcode.CutLength = null;
-            this.pa_outboxcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_outboxcode.Location = new System.Drawing.Point(1185, 220);
-            this.pa_outboxcode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.pa_outboxcode.MaximumSize = new System.Drawing.Size(200, 0);
-            this.pa_outboxcode.Name = "pa_outboxcode";
-            this.pa_outboxcode.Size = new System.Drawing.Size(0, 27);
-            this.pa_outboxcode.TabIndex = 103;
-            this.pa_outboxcode.Tag = "1";
-            this.pa_outboxcode.Visible = false;
-            // 
             // pa_currentqty
             // 
             this.pa_currentqty.AutoSize = true;
@@ -503,8 +488,6 @@
             // AutoOutBoxCode
             // 
             this.AutoOutBoxCode.AutoSize = true;
-            this.AutoOutBoxCode.Checked = true;
-            this.AutoOutBoxCode.CheckState = System.Windows.Forms.CheckState.Checked;
             this.AutoOutBoxCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.AutoOutBoxCode.Location = new System.Drawing.Point(258, 33);
             this.AutoOutBoxCode.Margin = new System.Windows.Forms.Padding(4);
@@ -546,7 +529,7 @@
             this.Controls.Add(this.OperateResult);
             this.Controls.Add(this.outboxcode_label);
             this.Controls.Add(this.outboxcode);
-            this.Controls.Add(this.bigoutboxcode);
+            this.Controls.Add(this.pa_outboxcode);
             this.Controls.Add(this.Printlab);
             this.Controls.Add(this.ReleasePallet);
             this.Controls.Add(this.NewPallet);
@@ -559,7 +542,6 @@
             this.Controls.Add(this.pa_makecode_label);
             this.Controls.Add(this.pa_standardqty);
             this.Controls.Add(this.pa_totalqty_label);
-            this.Controls.Add(this.pa_outboxcode);
             this.Controls.Add(this.pa_outboxcode_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
             this.Margin = new System.Windows.Forms.Padding(4);
@@ -577,8 +559,6 @@
         }
 
         #endregion
-
-        private CustomControl.ValueLabel.ValueLabel pa_outboxcode;
         private System.Windows.Forms.Label pa_outboxcode_label;
         private CustomControl.ValueLabel.ValueLabel pa_standardqty;
         private System.Windows.Forms.Label pa_totalqty_label;
@@ -592,7 +572,7 @@
         private CustomControl.ButtonUtil.NormalButton NewPallet;
         private CustomControl.ButtonUtil.NormalButton ReleasePallet;
         private CustomControl.ButtonUtil.NormalButton Printlab;
-        private CustomControl.TextBoxWithIcon.EnterTextBox bigoutboxcode;
+        private CustomControl.TextBoxWithIcon.EnterTextBox pa_outboxcode;
         private CustomControl.TextBoxWithIcon.EnterTextBox outboxcode;
         private System.Windows.Forms.Label outboxcode_label;
         private CustomControl.RichText.RichTextAutoBottom OperateResult;

+ 55 - 50
UAS-MES/FunctionCode/Make/Make_BigBoxCollection.cs

@@ -87,13 +87,13 @@ namespace UAS_MES.Make
             {
                 sql.Clear();
                 sql.Append("select pa_makecode,pa_standardqty,pa_packageqty,pa_prodcode,pa_outboxcode,pa_totalqty,pa_currentqty,pa_custcode,pa_salecode ");
-                sql.Append("from package where pa_outboxcode='" + bigoutboxcode.Text + "'  and pa_type =2");
-                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                BaseUtil.SetFormValue(Controls, dt);
+                sql.Append("from package where pa_outboxcode='" + pa_outboxcode.Text + "'  and pa_type =2");
+                DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 if (dt.Rows.Count > 0)
                 {
+                    BaseUtil.SetFormValue(Controls, dt);
                     LoadGridData();
-                    dt = dh.getFieldsDataByCondition("Package", new string[] { "pa_id", "pa_standardqty" }, "pa_outboxcode='" + bigoutboxcode.Text + "'");
+                    dt = dh.getFieldsDataByCondition("Package", new string[] { "pa_id", "pa_standardqty" }, "pa_outboxcode='" + pa_outboxcode.Text + "'");
                     pa_stanqty = int.Parse(dt.Rows[0]["pa_standardqty"].ToString());
                     pa_id = dt.Rows[0]["pa_id"].ToString();
                     FillPrintLabel();
@@ -116,13 +116,19 @@ namespace UAS_MES.Make
                         return;
                     }
                     sql.Clear();
-                    sql.Append("select pd_makecode pa_makecode,pa_id,pd_prodcode pa_prodcode,pa_status,pa_nextstep,nvl(pr_bigboxinnerqty,0) pa_standardqty from packagedetail ");
+                    sql.Append("select pd_makecode pa_makecode,pa_id,pd_prodcode pa_prodcode,pa_status,pa_mothercode,pa_nextstep,nvl(pr_bigboxinnerqty,0) pa_standardqty from packagedetail ");
                     sql.Append("left join package on pd_paid=pa_id left join product on pd_prodcode=pr_code where pd_outboxcode='" + outboxcode.Text + "'");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     //判断采集的卡通箱是否有明细
                     if (dt.Rows.Count > 0)
                     {
                         BaseUtil.SetFormValue(this.Controls, dt);
+                        //之前装过箱加载明细
+                        if (dt.Rows[0]["pa_mothercode"].ToString() != "")
+                        {
+                            pa_outboxcode.Text = dt.Rows[0]["pa_mothercode"].ToString();
+                            palletcode_KeyDown(sender, e);
+                        }
                         pa_nextstep = dt.Rows[0]["pa_nextstep"].ToString();
                         pa_stanqty = int.Parse(dt.Rows[0]["pa_standardqty"].ToString());
                         if (pa_stanqty == 0)
@@ -132,7 +138,7 @@ namespace UAS_MES.Make
                         }
                         if (pa_nextstep != User.CurrentStepCode && pa_nextstep != "")
                         {
-                            OperateResult.AppendText(">>箱号" + outboxcode.Text + "的下一工序不是当前岗位资源对应工序\n", Color.Red, outboxcode);
+                            OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "的下一工序不是当前岗位资源对应工序\n", Color.Red, outboxcode);
                             return;
                         }
                         //未空表示线外
@@ -159,43 +165,42 @@ namespace UAS_MES.Make
                     }
                     else
                     {
-                        OperateResult.AppendText(">>箱号" + outboxcode.Text + "未采集内容或不存在,不允许装大箱\n", Color.Red, outboxcode);
+                        OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "未采集内容或不存在,不允许装大箱\n", Color.Red, outboxcode);
                         return;
                     }
-                    pa_status.Text = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + bigoutboxcode.Text + "'").ToString();
+                    pa_status.Text = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
                     if (pa_standardqty.Text == pa_currentqty.Text && pa_status.Text == "0")
                     {
-                        dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + bigoutboxcode.Text + "'", "update");
+                        dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
                         pa_status.Text = "1";
                     }
                     //如果箱号为空的时候并且勾选了自动生成
-                    if (bigoutboxcode.Text == "" && AutoOutBoxCode.Checked || pa_status.Text == "1")
+                    if (pa_outboxcode.Text == "" && AutoOutBoxCode.Checked || pa_status.Text == "1")
                     {
                         //箱已采集满并且未勾选自动生成
                         if (pa_standardqty.Text == pa_currentqty.Text && !AutoOutBoxCode.Checked)
                         {
-                            OperateResult.AppendText(">>大箱" + pa_outboxcode.Text + "已采集满\n", Color.Red);
+                            OperateResult.AppendText(">>大箱" + pa_outboxcode.Text + "已采集满\n", Color.Red, outboxcode);
                             return;
                         }
                         else
                         {
-                            bigoutboxcode.Text = LogicHandler.GetOutBoxCode("BIGBOX", "", pa_prodcode.Text, User.UserCode);
+                            pa_outboxcode.Text = LogicHandler.GetOutBoxCode("BIGBOX", "", pa_prodcode.Text, User.UserCode);
                         }
                     }
-                    else if (bigoutboxcode.Text == "")
+                    else if (pa_outboxcode.Text == "")
                     {
                         OperateResult.AppendText(">>大箱号不能为空\n", Color.Red);
                         return;
                     }
-                    pa_outboxcode.Text = bigoutboxcode.Text;
                     //箱号不存在进行插入
-                    dt = (DataTable)dh.ExecuteSql("select pa_id from  package where pa_outboxcode='" + bigoutboxcode.Text + "'", "select");
+                    dt = (DataTable)dh.ExecuteSql("select pa_id from  package where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
                     if (dt.Rows.Count == 0)
                     {
                         pa_id = dh.GetSEQ("package_seq");
                         sql.Clear();
                         sql.Append("insert into package (pa_id,pa_outboxcode,pa_makecode,pa_indate,pa_packageqty,pa_type,pa_prodcode,pa_level,PA_STATUS,pa_standardqty,pa_sccode,pa_currentstep)values");
-                        sql.Append("(" + pa_id + ",'" + bigoutboxcode.Text + "','" + pa_makecode.Text + "',sysdate,'0',2,'" + pa_prodcode.Text + "',0,'','" + pa_standardqty.Text + "','" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
+                        sql.Append("(" + pa_id + ",'" + pa_outboxcode.Text + "','" + pa_makecode.Text + "',sysdate,'0',2,'" + pa_prodcode.Text + "',0,'','" + pa_standardqty.Text + "','" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
                         dh.ExecuteSql(sql.GetString(), "insert");
                     }
                     else
@@ -205,7 +210,7 @@ namespace UAS_MES.Make
                     //如果未装满的话
                     CollectBox();
                 }
-                else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, outboxcode);
             }
         }
 
@@ -214,8 +219,8 @@ namespace UAS_MES.Make
             sql.Clear();
             sql.Append("select pa_prodcode,nvl(pd_barcode,PD_INNERBOXCODE) code ,pd_innerqty,pa_salecode");
             sql.Append(",pa_makecode,pa_custcode,pa_packageqty from packagedetail left join package on pd_paid=pa_id left ");
-            sql.Append("join product on pr_code=pa_prodcode where pa_outboxcode ='" + bigoutboxcode.Text + "' and pa_type=2");
-            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            sql.Append("join product on pr_code=pa_prodcode where pa_outboxcode ='" + pa_outboxcode.Text + "' and pa_type=2");
+            DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             BaseUtil.FillDgvWithDataTable(PackageInf, dt);
         }
 
@@ -223,7 +228,7 @@ namespace UAS_MES.Make
         {
             sql.Clear();
             sql.Append("select count(0) cn from packagedetail left join package on pa_id=pd_paid where ");
-            sql.Append("pa_outboxcode='" + bigoutboxcode.Text + "'");
+            sql.Append("pa_outboxcode='" + pa_outboxcode.Text + "'");
             int packageqty = int.Parse((dh.ExecuteSql(sql.GetString(), "select") as DataTable).Rows[0][0].ToString());
             DataTable dt = (DataTable)dh.ExecuteSql("select nvl(pa_status,1) pa_status,pa_mothercode from package where pa_outboxcode='" + outboxcode.Text + "' and pa_type=1", "select");
             //采集的卡通箱号存在
@@ -237,24 +242,24 @@ namespace UAS_MES.Make
                         //插入大箱明细
                         sql.Clear();
                         sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_innerboxcode, pd_innerqty,pd_makecode,pd_prodcode,pd_builddate)");
-                        sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + bigoutboxcode.Text + "','" + outboxcode.Text + "'");
+                        sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + pa_outboxcode.Text + "','" + outboxcode.Text + "'");
                         sql.Append(",pa_packageqty,'" + pa_makecode.Text + "','" + pa_prodcode.Text + "',sysdate from package where pa_outboxcode='" + outboxcode.Text + "'");
                         dh.ExecuteSql(sql.GetString(), "insert");
                         //箱内计数+1
-                        dh.UpdateByCondition("package", "PA_CURRENTQTY=PA_CURRENTQTY+1,PA_PACKAGEQTY=PA_PACKAGEQTY+1,PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + bigoutboxcode.Text + "')", "pa_outboxcode='" + bigoutboxcode.Text + "' and pa_type=2");
+                        dh.UpdateByCondition("package", "PA_CURRENTQTY=PA_CURRENTQTY+1,PA_PACKAGEQTY=PA_PACKAGEQTY+1,PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + pa_outboxcode.Text + "')", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_type=2");
                         //更新采集的子箱记录母箱号
-                        dh.UpdateByCondition("package", "pa_mothercode='" + bigoutboxcode.Text + "'", "pa_outboxcode='" + outboxcode.Text + "'");
-                        if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + bigoutboxcode.Text + "'").ToString() == "")
+                        dh.UpdateByCondition("package", "pa_mothercode='" + pa_outboxcode.Text + "'", "pa_outboxcode='" + outboxcode.Text + "'");
+                        if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() == "")
                         {
                             string carton_macode = dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
                             pa_makecode.Text = carton_macode;
-                            dh.ExecuteSql("update package set pa_makecode='" + carton_macode + "' where pa_outboxcode='" + bigoutboxcode.Text + "'", "update");
+                            dh.ExecuteSql("update package set pa_makecode='" + carton_macode + "' where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
                         }
                         LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "卡通箱" + outboxcode.Text + "采集成功", outboxcode.Text, "");
                         //记录卡通箱所有序列号操作日志
                         if (pa_nextstep != "")
                         {
-                            LogicHandler.OutBoxStepPass(outboxcode.Text, pa_makecode.Text, User.UserSourceCode, User.UserCode, "大箱采集成功,大箱号:" + bigoutboxcode.Text, "大箱采集");
+                            LogicHandler.OutBoxStepPass(outboxcode.Text, pa_makecode.Text, User.UserSourceCode, User.UserCode, "大箱采集成功,大箱号:" + pa_outboxcode.Text, "大箱采集");
                         }
                         LoadGridData();
                         LoadCollectNum();
@@ -262,12 +267,12 @@ namespace UAS_MES.Make
                         if (pa_currentqty.Text == "1")
                         {
                             string nextstepcode = dh.getFieldDataByCondition("mes_package_view left join makeserial on ms_sncode=v_barcode", "ms_nextstepcode", "v_outboxcode='" + outboxcode.Text + "'").ToString();
-                            dh.UpdateByCondition("package", "pa_nextstep='" + nextstepcode + "'", "pa_outboxcode='" + bigoutboxcode.Text + "'");
+                            dh.UpdateByCondition("package", "pa_nextstep='" + nextstepcode + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                         }
                         OperateResult.AppendText(">>卡通箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
                         if (packageqty + 1 == pa_stanqty)
                         {
-                            dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + bigoutboxcode.Text + "'", "update");
+                            dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
                             if (AutoPrint.Checked)
                             {
                                 OperateResult.AppendText(">>箱已装满,自动打印!\n", Color.Green);
@@ -296,7 +301,7 @@ namespace UAS_MES.Make
 
         private void LoadCollectNum()
         {
-            pa_currentqty.Text = dh.getFieldDataByCondition("package", "PA_CURRENTQTY", "pa_outboxcode='" + bigoutboxcode.Text + "' and pa_type=2").ToString();
+            pa_currentqty.Text = dh.getFieldDataByCondition("package", "PA_CURRENTQTY", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_type=2").ToString();
         }
 
         private void 栈板称重_SizeChanged(object sender, EventArgs e)
@@ -314,7 +319,7 @@ namespace UAS_MES.Make
 
         private void Make_BigBoxCollection_Click(object sender, EventArgs e)
         {
-            bigoutboxcode.Text = NewBigBox.OutBoxCode;
+            pa_outboxcode.Text = NewBigBox.OutBoxCode;
             palletcode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
         }
 
@@ -322,9 +327,9 @@ namespace UAS_MES.Make
         {
             if (PrintLabel.Items.Count != 0)
             {
-                if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + bigoutboxcode.Text + "'").ToString() == "1")
+                if (dh.getFieldDataByCondition("package", "pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() == "1")
                 {
-                    OperateResult.AppendText(">>打印箱号" + bigoutboxcode.Text + "\n", Color.Black);
+                    OperateResult.AppendText(">>打印箱号" + pa_outboxcode.Text + "\n", Color.Black);
                     doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
                     Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text));
                 }
@@ -335,32 +340,32 @@ namespace UAS_MES.Make
 
         private void ReleasePallet_Click(object sender, EventArgs e)
         {
-            if (dh.getRowCount("packagedetail", "pd_outboxcode='" + bigoutboxcode.Text + "'") > 0)
+            if (dh.getRowCount("packagedetail", "pd_outboxcode='" + pa_outboxcode.Text + "'") > 0)
             {
-                if (dh.getFieldDataByCondition("package", "pa_mothercode", "pa_outboxcode='" + bigoutboxcode.Text + "'").ToString() == "")
+                if (dh.getFieldDataByCondition("package", "pa_mothercode", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() == "")
                 {
                     string Delete = MessageBox.Show(this.ParentForm, "是否确认拆箱?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
                     if (Delete == "Yes")
                     {
-                        if (dh.getFieldDataByCondition("package", "pa_nextstep", "pa_mothercode='" + bigoutboxcode.Text + "'").ToString() != "")
-                            LogicHandler.OutBoxDrawStepPass(bigoutboxcode.Text, pa_makecode.Text, User.UserSourceCode);
+                        if (dh.getFieldDataByCondition("package", "pa_nextstep", "pa_mothercode='" + pa_outboxcode.Text + "'").ToString() != "")
+                            LogicHandler.OutBoxDrawStepPass(pa_outboxcode.Text, pa_makecode.Text, User.UserSourceCode);
                         else
                         {
                             List<string> SQLS = new List<string>();
-                            SQLS.Add("delete from packagedetail where pd_outboxcode='" + bigoutboxcode.Text + "'");
-                            SQLS.Add("update package set pa_packageqty=0,pa_totalqty=0,pa_currentqty=0,pa_status=0 where pa_outboxcode='" + bigoutboxcode.Text + "'");
-                            SQLS.Add("update package set pa_mothercode='' where pa_mothercode='" + bigoutboxcode.Text + "'");
+                            SQLS.Add("delete from packagedetail where pd_outboxcode='" + pa_outboxcode.Text + "'");
+                            SQLS.Add("update package set pa_packageqty=0,pa_totalqty=0,pa_currentqty=0,pa_status=0 where pa_outboxcode='" + pa_outboxcode.Text + "'");
+                            SQLS.Add("update package set pa_mothercode='' where pa_mothercode='" + pa_outboxcode.Text + "'");
                             dh.ExecuteSQLTran(SQLS.ToArray());
                         }
                         //将子箱的母箱编号置成空
-                        OperateResult.AppendText(">>箱号" + bigoutboxcode.Text + "解除成功\n", Color.Green);
-                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "解除大箱" + bigoutboxcode.Text + "成功", bigoutboxcode.Text, "");
+                        OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "解除成功\n", Color.Green);
+                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "解除大箱" + pa_outboxcode.Text + "成功", pa_outboxcode.Text, "");
                         palletcode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
                     }
                 }
-                else OperateResult.AppendText(">>箱号" + bigoutboxcode.Text + "已装箱,不能取消解除装箱\n", Color.Red);
+                else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "已装箱,不能取消解除装箱\n", Color.Red);
             }
-            else OperateResult.AppendText(">>箱号" + bigoutboxcode.Text + "未采集箱\n", Color.Red);
+            else OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "未采集箱\n", Color.Red);
         }
 
         private void Make_BigBoxCollection_FormClosed(object sender, FormClosedEventArgs e)
@@ -370,11 +375,11 @@ namespace UAS_MES.Make
 
         private void Packing_Click(object sender, EventArgs e)
         {
-            if (bigoutboxcode.Text != "")
+            if (pa_outboxcode.Text != "")
             {
                 sql.Clear();
                 sql.Append("select nvl(pa_status,0) pa_status from packagedetail left join package ");
-                sql.Append("on pa_id=pd_paid where pd_outboxcode='" + bigoutboxcode.Text + "'");
+                sql.Append("on pa_id=pd_paid where pd_outboxcode='" + pa_outboxcode.Text + "'");
                 DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 if (dt.Rows.Count > 0)
                 {
@@ -383,15 +388,15 @@ namespace UAS_MES.Make
                         string Seal = MessageBox.Show(this.ParentForm, "是否确认封箱?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
                         if (Seal == "Yes")
                         {
-                            OperateResult.AppendText(">>大箱号" + bigoutboxcode.Text + "装大箱成功\n", Color.Green);
-                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "装箱" + bigoutboxcode.Text + "成功", outboxcode.Text, "");
-                            dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + bigoutboxcode.Text + "'", "update");
+                            OperateResult.AppendText(">>大箱号" + pa_outboxcode.Text + "封大箱成功\n", Color.Green);
+                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱采集", "卡通箱装箱" + pa_outboxcode.Text + "成功", outboxcode.Text, "");
+                            dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
                             pa_status.Text = "1";
                         }
                     }
-                    else OperateResult.AppendText(">>大箱号" + bigoutboxcode.Text + "已封大箱\n", Color.Red);
+                    else OperateResult.AppendText(">>大箱号" + pa_outboxcode.Text + "已封大箱\n", Color.Red);
                 }
-                else OperateResult.AppendText(">>大箱号" + bigoutboxcode.Text + "未采集内容\n", Color.Red);
+                else OperateResult.AppendText(">>大箱号" + pa_outboxcode.Text + "未采集内容\n", Color.Red);
             }
             else OperateResult.AppendText(">>大箱号不能为空\n", Color.Red);
         }

+ 0 - 15
UAS-MES/FunctionCode/Make/Make_BigBoxCollection.resx

@@ -285,21 +285,6 @@
   <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pd_outboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_innerqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
   <data name="Packing.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m

+ 21 - 23
UAS-MES/FunctionCode/Make/Make_PackageCollection.Designer.cs

@@ -61,6 +61,7 @@
             this.pr_detail = new System.Windows.Forms.Label();
             this.pa_currentqty = new System.Windows.Forms.Label();
             this.groupBoxWithBorder1 = new UAS_MES.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
+            this.DeleteAll = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.pr_outboxinnerqty = new System.Windows.Forms.NumericUpDown();
             this.AutoGenBoxCode = new System.Windows.Forms.CheckBox();
             this.groupBoxWithBorder2 = new UAS_MES.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
@@ -78,7 +79,6 @@
             this.pa_downstatus = new System.Windows.Forms.Label();
             this.ms_makecode = new System.Windows.Forms.Label();
             this.pa_standardqty = new System.Windows.Forms.Label();
-            this.DeleteAll = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.PackageDetail)).BeginInit();
             this.groupBoxWithBorder1.SuspendLayout();
@@ -478,6 +478,26 @@
             this.groupBoxWithBorder1.Text = "装箱信息";
             this.groupBoxWithBorder1.TextColor = System.Drawing.Color.Black;
             // 
+            // DeleteAll
+            // 
+            this.DeleteAll.AllPower = null;
+            this.DeleteAll.BackColor = System.Drawing.Color.Transparent;
+            this.DeleteAll.DownImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.DownImage")));
+            this.DeleteAll.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.DeleteAll.Image = null;
+            this.DeleteAll.IsShowBorder = true;
+            this.DeleteAll.Location = new System.Drawing.Point(476, 44);
+            this.DeleteAll.Margin = new System.Windows.Forms.Padding(4);
+            this.DeleteAll.MoveImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.MoveImage")));
+            this.DeleteAll.Name = "DeleteAll";
+            this.DeleteAll.NormalImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.NormalImage")));
+            this.DeleteAll.Power = "ifspecial";
+            this.DeleteAll.Size = new System.Drawing.Size(65, 30);
+            this.DeleteAll.TabIndex = 181;
+            this.DeleteAll.Text = "拆箱";
+            this.DeleteAll.UseVisualStyleBackColor = true;
+            this.DeleteAll.Click += new System.EventHandler(this.DeleteAll_Click);
+            // 
             // pr_outboxinnerqty
             // 
             this.pr_outboxinnerqty.Enabled = false;
@@ -497,8 +517,6 @@
             // AutoGenBoxCode
             // 
             this.AutoGenBoxCode.AutoSize = true;
-            this.AutoGenBoxCode.Checked = true;
-            this.AutoGenBoxCode.CheckState = System.Windows.Forms.CheckState.Checked;
             this.AutoGenBoxCode.Location = new System.Drawing.Point(318, 45);
             this.AutoGenBoxCode.Name = "AutoGenBoxCode";
             this.AutoGenBoxCode.Size = new System.Drawing.Size(154, 31);
@@ -705,26 +723,6 @@
             this.pa_standardqty.TabIndex = 180;
             this.pa_standardqty.Visible = false;
             // 
-            // DeleteAll
-            // 
-            this.DeleteAll.AllPower = null;
-            this.DeleteAll.BackColor = System.Drawing.Color.Transparent;
-            this.DeleteAll.DownImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.DownImage")));
-            this.DeleteAll.Font = new System.Drawing.Font("微软雅黑", 9F);
-            this.DeleteAll.Image = null;
-            this.DeleteAll.IsShowBorder = true;
-            this.DeleteAll.Location = new System.Drawing.Point(476, 44);
-            this.DeleteAll.Margin = new System.Windows.Forms.Padding(4);
-            this.DeleteAll.MoveImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.MoveImage")));
-            this.DeleteAll.Name = "DeleteAll";
-            this.DeleteAll.NormalImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.NormalImage")));
-            this.DeleteAll.Power = "ifspecial";
-            this.DeleteAll.Size = new System.Drawing.Size(65, 30);
-            this.DeleteAll.TabIndex = 181;
-            this.DeleteAll.Text = "拆箱";
-            this.DeleteAll.UseVisualStyleBackColor = true;
-            this.DeleteAll.Click += new System.EventHandler(this.DeleteAll_Click);
-            // 
             // Make_PackageCollection
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);

+ 21 - 23
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.Designer.cs

@@ -54,6 +54,7 @@
             this.pd_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.AutoPrint = new UAS_MES.CustomControl.CustomCheckBox.AutoPrintCheckBox();
             this.groupBoxWithBorder1 = new UAS_MES.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
+            this.DeleteAll = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.pr_outboxinnerqty = new System.Windows.Forms.NumericUpDown();
             this.pa_currentqty_label = new System.Windows.Forms.Label();
             this.pr_detail_label = new System.Windows.Forms.Label();
@@ -87,7 +88,6 @@
             this.pa_sccode = new System.Windows.Forms.Label();
             this.ms_makecode = new System.Windows.Forms.Label();
             this.pa_standardqty = new System.Windows.Forms.Label();
-            this.DeleteAll = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.PackageDetail)).BeginInit();
             this.groupBoxWithBorder1.SuspendLayout();
@@ -412,6 +412,26 @@
             this.groupBoxWithBorder1.Text = "装箱信息";
             this.groupBoxWithBorder1.TextColor = System.Drawing.Color.Black;
             // 
+            // DeleteAll
+            // 
+            this.DeleteAll.AllPower = null;
+            this.DeleteAll.BackColor = System.Drawing.Color.Transparent;
+            this.DeleteAll.DownImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.DownImage")));
+            this.DeleteAll.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.DeleteAll.Image = null;
+            this.DeleteAll.IsShowBorder = true;
+            this.DeleteAll.Location = new System.Drawing.Point(472, 46);
+            this.DeleteAll.Margin = new System.Windows.Forms.Padding(4);
+            this.DeleteAll.MoveImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.MoveImage")));
+            this.DeleteAll.Name = "DeleteAll";
+            this.DeleteAll.NormalImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.NormalImage")));
+            this.DeleteAll.Power = "ifspecial";
+            this.DeleteAll.Size = new System.Drawing.Size(61, 30);
+            this.DeleteAll.TabIndex = 184;
+            this.DeleteAll.Text = "拆箱";
+            this.DeleteAll.UseVisualStyleBackColor = true;
+            this.DeleteAll.Click += new System.EventHandler(this.DeleteAll_Click);
+            // 
             // pr_outboxinnerqty
             // 
             this.pr_outboxinnerqty.Enabled = false;
@@ -507,8 +527,6 @@
             // AutoGenBoxCode
             // 
             this.AutoGenBoxCode.AutoSize = true;
-            this.AutoGenBoxCode.Checked = true;
-            this.AutoGenBoxCode.CheckState = System.Windows.Forms.CheckState.Checked;
             this.AutoGenBoxCode.Location = new System.Drawing.Point(321, 47);
             this.AutoGenBoxCode.Name = "AutoGenBoxCode";
             this.AutoGenBoxCode.Size = new System.Drawing.Size(154, 31);
@@ -820,26 +838,6 @@
             this.pa_standardqty.TabIndex = 183;
             this.pa_standardqty.Visible = false;
             // 
-            // DeleteAll
-            // 
-            this.DeleteAll.AllPower = null;
-            this.DeleteAll.BackColor = System.Drawing.Color.Transparent;
-            this.DeleteAll.DownImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.DownImage")));
-            this.DeleteAll.Font = new System.Drawing.Font("微软雅黑", 9F);
-            this.DeleteAll.Image = null;
-            this.DeleteAll.IsShowBorder = true;
-            this.DeleteAll.Location = new System.Drawing.Point(472, 46);
-            this.DeleteAll.Margin = new System.Windows.Forms.Padding(4);
-            this.DeleteAll.MoveImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.MoveImage")));
-            this.DeleteAll.Name = "DeleteAll";
-            this.DeleteAll.NormalImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.NormalImage")));
-            this.DeleteAll.Power = "ifspecial";
-            this.DeleteAll.Size = new System.Drawing.Size(61, 30);
-            this.DeleteAll.TabIndex = 184;
-            this.DeleteAll.Text = "拆箱";
-            this.DeleteAll.UseVisualStyleBackColor = true;
-            this.DeleteAll.Click += new System.EventHandler(this.DeleteAll_Click);
-            // 
             // Make_PackageCollectionWeigh
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);

+ 0 - 18
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.resx

@@ -212,24 +212,6 @@
   <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pd_barcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pa_outboxcode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pa_prodcode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_innerqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pa_indate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
   <data name="DeleteAll.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m

+ 19 - 39
UAS-MES/FunctionCode/Make/Make_PalletCollection.Designer.cs

@@ -48,7 +48,7 @@
             this.Clean = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
             this.outboxcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.palletcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.pa_outboxcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.Printlab = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.ReleasePallet = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.NewPalletCode = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
@@ -61,7 +61,6 @@
             this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pa_makecode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_currentqty = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
-            this.pa_outboxcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.AutoOutBoxCode = new System.Windows.Forms.CheckBox();
             this.pa_status = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
@@ -303,22 +302,22 @@
             this.outboxcode.Tag = "NoAuto";
             this.outboxcode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.outboxcode_KeyDown);
             // 
-            // palletcode
-            // 
-            this.palletcode.AllPower = "ifall";
-            this.palletcode.BackColor = System.Drawing.Color.White;
-            this.palletcode.ID = null;
-            this.palletcode.Location = new System.Drawing.Point(113, 36);
-            this.palletcode.Margin = new System.Windows.Forms.Padding(4);
-            this.palletcode.Name = "palletcode";
-            this.palletcode.Power = "ifwrite";
-            this.palletcode.Size = new System.Drawing.Size(141, 25);
-            this.palletcode.Str = null;
-            this.palletcode.Str1 = null;
-            this.palletcode.Str2 = null;
-            this.palletcode.TabIndex = 163;
-            this.palletcode.Tag = "NoAuto";
-            this.palletcode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.palletcode_KeyDown);
+            // pa_outboxcode
+            // 
+            this.pa_outboxcode.AllPower = "ifall";
+            this.pa_outboxcode.BackColor = System.Drawing.Color.White;
+            this.pa_outboxcode.ID = null;
+            this.pa_outboxcode.Location = new System.Drawing.Point(113, 36);
+            this.pa_outboxcode.Margin = new System.Windows.Forms.Padding(4);
+            this.pa_outboxcode.Name = "pa_outboxcode";
+            this.pa_outboxcode.Power = "ifwrite";
+            this.pa_outboxcode.Size = new System.Drawing.Size(141, 25);
+            this.pa_outboxcode.Str = null;
+            this.pa_outboxcode.Str1 = null;
+            this.pa_outboxcode.Str2 = null;
+            this.pa_outboxcode.TabIndex = 163;
+            this.pa_outboxcode.Tag = "NoAuto";
+            this.pa_outboxcode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.palletcode_KeyDown);
             // 
             // Printlab
             // 
@@ -471,25 +470,9 @@
             this.pa_currentqty.TabIndex = 105;
             this.pa_currentqty.Tag = "1";
             // 
-            // pa_outboxcode
-            // 
-            this.pa_outboxcode.AutoSize = true;
-            this.pa_outboxcode.CutLength = null;
-            this.pa_outboxcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_outboxcode.Location = new System.Drawing.Point(1226, 218);
-            this.pa_outboxcode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.pa_outboxcode.MaximumSize = new System.Drawing.Size(200, 0);
-            this.pa_outboxcode.Name = "pa_outboxcode";
-            this.pa_outboxcode.Size = new System.Drawing.Size(0, 27);
-            this.pa_outboxcode.TabIndex = 103;
-            this.pa_outboxcode.Tag = "1";
-            this.pa_outboxcode.Visible = false;
-            // 
             // AutoOutBoxCode
             // 
             this.AutoOutBoxCode.AutoSize = true;
-            this.AutoOutBoxCode.Checked = true;
-            this.AutoOutBoxCode.CheckState = System.Windows.Forms.CheckState.Checked;
             this.AutoOutBoxCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.AutoOutBoxCode.Location = new System.Drawing.Point(262, 34);
             this.AutoOutBoxCode.Margin = new System.Windows.Forms.Padding(4);
@@ -531,7 +514,7 @@
             this.Controls.Add(this.OperateResult);
             this.Controls.Add(this.outboxcode_label);
             this.Controls.Add(this.outboxcode);
-            this.Controls.Add(this.palletcode);
+            this.Controls.Add(this.pa_outboxcode);
             this.Controls.Add(this.Printlab);
             this.Controls.Add(this.ReleasePallet);
             this.Controls.Add(this.NewPalletCode);
@@ -543,7 +526,6 @@
             this.Controls.Add(this.pa_makecode_label);
             this.Controls.Add(this.pa_currentqty);
             this.Controls.Add(this.pa_totalqty_label);
-            this.Controls.Add(this.pa_outboxcode);
             this.Controls.Add(this.pa_outboxcode_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
             this.Margin = new System.Windows.Forms.Padding(4);
@@ -561,8 +543,6 @@
         }
 
         #endregion
-
-        private CustomControl.ValueLabel.ValueLabel pa_outboxcode;
         private System.Windows.Forms.Label pa_outboxcode_label;
         private CustomControl.ValueLabel.ValueLabel pa_currentqty;
         private System.Windows.Forms.Label pa_totalqty_label;
@@ -575,7 +555,7 @@
         private CustomControl.ButtonUtil.NormalButton NewPalletCode;
         private CustomControl.ButtonUtil.NormalButton ReleasePallet;
         private CustomControl.ButtonUtil.NormalButton Printlab;
-        private CustomControl.TextBoxWithIcon.EnterTextBox palletcode;
+        private CustomControl.TextBoxWithIcon.EnterTextBox pa_outboxcode;
         private CustomControl.TextBoxWithIcon.EnterTextBox outboxcode;
         private System.Windows.Forms.Label outboxcode_label;
         private CustomControl.RichText.RichTextAutoBottom OperateResult;

+ 48 - 44
UAS-MES/FunctionCode/Make/Make_PalletCollection.cs

@@ -85,13 +85,13 @@ namespace UAS_MES.Make
             {
                 sql.Clear();
                 sql.Append("select pa_makecode,pa_status,pa_packageqty,pa_currentqty,pa_prodcode,pa_outboxcode,pa_totalqty,pa_custcode,pa_salecode ");
-                sql.Append("from package where pa_outboxcode='" + palletcode.Text + "' and pa_type =3");
-                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                BaseUtil.SetFormValue(Controls, dt);
+                sql.Append("from package where pa_outboxcode='" + pa_outboxcode.Text + "' and pa_type =3");
+                DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 if (dt.Rows.Count > 0)
                 {
+                    BaseUtil.SetFormValue(Controls, dt);
                     LoadGridData();
-                    dt = dh.getFieldsDataByCondition("Package", new string[] { "pa_totalqty", "pa_id" }, "pa_outboxcode='" + palletcode.Text + "'");
+                    dt = dh.getFieldsDataByCondition("Package", new string[] { "pa_totalqty", "pa_id" }, "pa_outboxcode='" + pa_outboxcode.Text + "'");
                     pa_totqty = int.Parse(dt.Rows[0]["pa_totalqty"].ToString());
                     pa_id = dt.Rows[0]["pa_id"].ToString();
                     FillPrintLabel();
@@ -114,12 +114,17 @@ namespace UAS_MES.Make
                         return;
                     }
                     sql.Clear();
-                    sql.Append("select pd_makecode pa_makecode,pa_id,pd_prodcode pa_prodcode,pa_status,pa_nextstep  from packagedetail ");
+                    sql.Append("select pd_makecode pa_makecode,pa_id,pd_prodcode pa_prodcode,pa_mothercode,pa_status,pa_nextstep  from packagedetail ");
                     sql.Append("left join package on pd_paid=pa_id where pd_outboxcode='" + outboxcode.Text + "'");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     if (dt.Rows.Count > 0)
                     {
                         BaseUtil.SetFormValue(this.Controls, dt);
+                        if (dt.Rows[0]["pa_mothercode"].ToString() != "")
+                        {
+                            pa_outboxcode.Text = dt.Rows[0]["pa_mothercode"].ToString();
+                            palletcode_KeyDown(sender, e);
+                        }
                         pa_nextstep = dt.Rows[0]["pa_nextstep"].ToString();
                         if (pa_nextstep != User.CurrentStepCode && pa_nextstep != "")
                         {
@@ -153,12 +158,12 @@ namespace UAS_MES.Make
                         OperateResult.AppendText(">>箱号" + outboxcode.Text + "未采集内容或不存在,不允许装栈板\n", Color.Red, outboxcode);
                         return;
                     }
-                    pa_status.Text = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + palletcode.Text + "'").ToString();
+                    pa_status.Text = dh.getFieldDataByCondition("package", "nvl(pa_status,0)pa_status", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
                     if (pa_status.Text == "1")
                     {
                         if (AutoOutBoxCode.Checked)
                         {
-                            palletcode.Text = LogicHandler.GetOutBoxCode("PALLET", "", pa_prodcode.Text, User.UserCode);
+                            pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PALLET", "", pa_prodcode.Text, User.UserCode);
                             pa_status.Text = "1";
                         }
                         else
@@ -167,23 +172,23 @@ namespace UAS_MES.Make
                             return;
                         }
                     }
-                    else if (palletcode.Text == "" && AutoOutBoxCode.Checked)
+                    else if (pa_outboxcode.Text == "" && AutoOutBoxCode.Checked)
                     {
-                        palletcode.Text = LogicHandler.GetOutBoxCode("PALLET", "", pa_prodcode.Text, User.UserCode);
+                        pa_outboxcode.Text = LogicHandler.GetOutBoxCode("PALLET", "", pa_prodcode.Text, User.UserCode);
                     }
-                    else if (palletcode.Text == "" && !AutoOutBoxCode.Checked)
+                    else if (pa_outboxcode.Text == "" && !AutoOutBoxCode.Checked)
                     {
                         OperateResult.AppendText(">>栈板号不能为空\n", Color.Red, outboxcode);
                         return;
                     }
-                    pa_outboxcode.Text = palletcode.Text;
-                    dt = (DataTable)dh.ExecuteSql("select pa_id from  package where pa_outboxcode='" + palletcode.Text + "'", "select");
+                    pa_outboxcode.Text = pa_outboxcode.Text;
+                    dt = (DataTable)dh.ExecuteSql("select pa_id from  package where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
                     if (dt.Rows.Count == 0)
                     {
                         pa_id = dh.GetSEQ("package_seq");
                         sql.Clear();
                         sql.Append("insert into package (pa_id,pa_outboxcode,pa_makecode,pa_indate,pa_packageqty,pa_type,pa_prodcode,pa_level,PA_STATUS,pa_sccode,pa_currentstep)values");
-                        sql.Append("(" + pa_id + ",'" + palletcode.Text + "','" + pa_makecode.Text + "',sysdate,'0',3,'" + pa_prodcode.Text + "',0,0,'" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
+                        sql.Append("(" + pa_id + ",'" + pa_outboxcode.Text + "','" + pa_makecode.Text + "',sysdate,'0',3,'" + pa_prodcode.Text + "',0,0,'" + User.UserSourceCode + "','" + User.CurrentStepCode + "')");
                         dh.ExecuteSql(sql.GetString(), "insert");
                     }
                     else
@@ -201,30 +206,30 @@ namespace UAS_MES.Make
                                 List<string> SQLS = new List<string>();
                                 sql.Clear();
                                 sql.Append("insert into packagedetail(pd_id, pd_paid, pd_outboxcode,pd_makecode,pd_prodcode,pd_innerboxcode, pd_innerqty,pd_builddate)");
-                                sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + palletcode.Text + "','" + pa_makecode.Text + "','" + pa_prodcode.Text + "','" + outboxcode.Text + "' ");
+                                sql.Append("select packagedetail_seq.nextval,'" + pa_id + "','" + pa_outboxcode.Text + "','" + pa_makecode.Text + "','" + pa_prodcode.Text + "','" + outboxcode.Text + "' ");
                                 sql.Append(",(select nvl(sum(pd_innerqty),0) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode=");
                                 sql.Append("'" + outboxcode.Text + "'),sysdate from package where pa_outboxcode='" + outboxcode.Text + "'");
                                 SQLS.Add(sql.GetString());
-                                SQLS.Add("update package set PA_CURRENTQTY=nvl(PA_CURRENTQTY,0)+1,PA_PACKAGEQTY=nvl(PA_PACKAGEQTY,0)+1,PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + palletcode.Text + "') where pa_outboxcode='" + palletcode.Text + "' and pa_type=3");
-                                SQLS.Add("update package set pa_mothercode='" + palletcode.Text + "' where pa_outboxcode='" + outboxcode.Text + "'");
+                                SQLS.Add("update package set PA_CURRENTQTY=nvl(PA_CURRENTQTY,0)+1,PA_PACKAGEQTY=nvl(PA_PACKAGEQTY,0)+1,PA_TOTALQTY=(select sum(pd_innerqty) from packagedetail left join package on pa_id=pd_paid where pa_outboxcode='" + pa_outboxcode.Text + "') where pa_outboxcode='" + pa_outboxcode.Text + "' and pa_type=3");
+                                SQLS.Add("update package set pa_mothercode='" + pa_outboxcode.Text + "' where pa_outboxcode='" + outboxcode.Text + "'");
                                 dh.ExecuteSQLTran(SQLS.ToArray());
                                 //更新大箱的栈板号
-                                if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + palletcode.Text + "'").ToString() == "")
+                                if (dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString() == "")
                                 {
                                     string carton_macode = dh.getFieldDataByCondition("package", "pa_makecode", "pa_outboxcode='" + outboxcode.Text + "'").ToString();
                                     pa_makecode.Text = carton_macode;
-                                    dh.ExecuteSql("update package set pa_makecode='" + carton_macode + "' where pa_outboxcode='" + palletcode.Text + "'", "update");
+                                    dh.ExecuteSql("update package set pa_makecode='" + carton_macode + "' where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
                                 }
                                 //已箱号过站
-                                LogicHandler.OutBoxStepPass(outboxcode.Text, pa_makecode.Text, User.UserSourceCode, User.UserCode, "栈板采集成功,栈板号:" + palletcode.Text, "栈板采集");
+                                LogicHandler.OutBoxStepPass(outboxcode.Text, pa_makecode.Text, User.UserSourceCode, User.UserCode, "栈板采集成功,栈板号:" + pa_outboxcode.Text, "栈板采集");
                                 LoadCollectNum();
                                 LoadGridData();
                                 if (pa_currentqty.Text == "1")
                                 {
                                     string nextstepcode = dh.getFieldDataByCondition("mes_package_view left join makeserial on ms_sncode=v_barcode", "ms_nextstepcode", "v_outboxcode='" + outboxcode.Text + "'").ToString();
-                                    dh.UpdateByCondition("package", "pa_nextstep='" + nextstepcode + "'", "pa_outboxcode='" + palletcode.Text + "'");
+                                    dh.UpdateByCondition("package", "pa_nextstep='" + nextstepcode + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                                 }
-                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "栈板采集", "栈板采集成功", palletcode.Text, "");
+                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "栈板采集", "栈板采集成功", pa_outboxcode.Text, "");
                                 OperateResult.AppendText(">>箱号" + outboxcode.Text + "采集成功!\n", Color.Green, outboxcode);
                                 LoadGridData();
                             }
@@ -242,8 +247,8 @@ namespace UAS_MES.Make
             sql.Clear();
             sql.Append("select pa_prodcode,nvl(pd_barcode,PD_INNERBOXCODE) code ,pd_innerqty,pa_salecode");
             sql.Append(",pa_makecode,pa_custcode,pa_packageqty from packagedetail left join package on pd_paid=pa_id left ");
-            sql.Append("join product on pr_code=pa_prodcode where pa_outboxcode ='" + palletcode.Text + "' and pa_type=3");
-            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            sql.Append("join product on pr_code=pa_prodcode where pa_outboxcode ='" + pa_outboxcode.Text + "' and pa_type=3");
+            DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             BaseUtil.FillDgvWithDataTable(PackageInf, dt);
         }
 
@@ -262,7 +267,7 @@ namespace UAS_MES.Make
 
         private void LoadCollectNum()
         {
-            pa_currentqty.Text = dh.getFieldDataByCondition("package", "pa_currentqty", "pa_outboxcode='" + palletcode.Text + "' and pa_type=3").ToString();
+            pa_currentqty.Text = dh.getFieldDataByCondition("package", "pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "' and pa_type=3").ToString();
         }
 
         private void 栈板称重_SizeChanged(object sender, EventArgs e)
@@ -280,7 +285,7 @@ namespace UAS_MES.Make
 
         private void Make_PalletCollection_Click(object sender, EventArgs e)
         {
-            palletcode.Text = NewPallet.OutBoxCode;
+            pa_outboxcode.Text = NewPallet.OutBoxCode;
             palletcode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
             NewPallet.Close();
         }
@@ -289,38 +294,37 @@ namespace UAS_MES.Make
         {
             if (PrintLabel.Items.Count != 0)
             {
-                OperateResult.AppendText(">>打印箱号" + palletcode.Text + "\n", Color.Black);
+                OperateResult.AppendText(">>打印箱号" + pa_outboxcode.Text + "\n", Color.Black);
                 doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
                 Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text));
             }
-            else
-                OperateResult.AppendText(">>产品" + pa_prodcode.Text + "未维护打印标签\n", Color.Red);
+            else OperateResult.AppendText(">>产品" + pa_prodcode.Text + "未维护打印标签\n", Color.Red);
         }
 
         private void ReleasePallet_Click(object sender, EventArgs e)
         {
-            if (dh.getRowCount("packagedetail", "pd_outboxcode='" + palletcode.Text + "'") > 0)
+            if (dh.getRowCount("packagedetail", "pd_outboxcode='" + pa_outboxcode.Text + "'") > 0)
             {
                 string Delete = MessageBox.Show(this.ParentForm, "是否确认拆栈板?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
                 if (Delete == "Yes")
                 {
                     //如果含有下一执行步骤的撤销过站,否则直接删除
-                    if (dh.getFieldDataByCondition("package", "pa_nextstep", "pa_mothercode='" + palletcode.Text + "'").ToString() != "")
-                        LogicHandler.OutBoxDrawStepPass(palletcode.Text, pa_makecode.Text, User.UserSourceCode);
+                    if (dh.getFieldDataByCondition("package", "pa_nextstep", "pa_mothercode='" + pa_outboxcode.Text + "'").ToString() != "")
+                        LogicHandler.OutBoxDrawStepPass(pa_outboxcode.Text, pa_makecode.Text, User.UserSourceCode);
                     else
                     {
                         List<string> SQLS = new List<string>();
-                        SQLS.Add("delete from packagedetail where pd_outboxcode='" + palletcode.Text + "'");
-                        SQLS.Add("update package set pa_packageqty=0,pa_totalqty=0,pa_currentqty=0,pa_status=0 where pa_outboxcode='" + palletcode.Text + "'");
-                        SQLS.Add("update package set pa_mothercode='' where pa_mothercode='" + palletcode.Text + "'");
+                        SQLS.Add("delete from packagedetail where pd_outboxcode='" + pa_outboxcode.Text + "'");
+                        SQLS.Add("update package set pa_packageqty=0,pa_totalqty=0,pa_currentqty=0,pa_status=0 where pa_outboxcode='" + pa_outboxcode.Text + "'");
+                        SQLS.Add("update package set pa_mothercode='' where pa_mothercode='" + pa_outboxcode.Text + "'");
                         dh.ExecuteSQLTran(SQLS.ToArray());
                     }
-                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "栈板采集", "解除栈板" + palletcode.Text + "成功", palletcode.Text, "");
-                    OperateResult.AppendText(">>栈板号" + palletcode.Text + "解除成功\n", Color.Green);
+                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "栈板采集", "解除栈板" + pa_outboxcode.Text + "成功", pa_outboxcode.Text, "");
+                    OperateResult.AppendText(">>栈板号" + pa_outboxcode.Text + "解除成功\n", Color.Green);
                     palletcode_KeyDown(new object(), new KeyEventArgs(Keys.Enter));
                 }
             }
-            else OperateResult.AppendText(">>栈板号" + palletcode.Text + "未采集箱\n", Color.Red);
+            else OperateResult.AppendText(">>栈板号" + pa_outboxcode.Text + "未采集箱\n", Color.Red);
         }
 
         private void Make_PalletCollection_FormClosing(object sender, FormClosingEventArgs e)
@@ -330,11 +334,11 @@ namespace UAS_MES.Make
 
         private void Packing_Click(object sender, EventArgs e)
         {
-            if (palletcode.Text != "")
+            if (pa_outboxcode.Text != "")
             {
                 sql.Clear();
                 sql.Append("select nvl(pa_status,0) pa_status from packagedetail left join package ");
-                sql.Append("on pa_id=pd_paid where pd_outboxcode='" + palletcode.Text + "'");
+                sql.Append("on pa_id=pd_paid where pd_outboxcode='" + pa_outboxcode.Text + "'");
                 DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 if (dt.Rows.Count > 0)
                 {
@@ -343,15 +347,15 @@ namespace UAS_MES.Make
                         string Seal = MessageBox.Show(this.ParentForm, "是否确认封栈板?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
                         if (Seal == "Yes")
                         {
-                            OperateResult.AppendText(">>栈板号" + palletcode.Text + "装栈板成功\n", Color.Green);
-                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "栈板采集", "装栈板" + palletcode.Text + "成功", outboxcode.Text, "");
-                            dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + palletcode.Text + "'", "update");
+                            OperateResult.AppendText(">>栈板号" + pa_outboxcode.Text + "装栈板成功\n", Color.Green);
+                            LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "栈板采集", "装栈板" + pa_outboxcode.Text + "成功", outboxcode.Text, "");
+                            dh.ExecuteSql("update package set pa_status=1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
                             pa_status.Text = "1";
                         }
                     }
-                    else OperateResult.AppendText(">>栈板号" + palletcode.Text + "已封栈板\n", Color.Red);
+                    else OperateResult.AppendText(">>栈板号" + pa_outboxcode.Text + "已封栈板\n", Color.Red);
                 }
-                else OperateResult.AppendText(">>栈板号" + palletcode.Text + "未采集内容\n", Color.Red);
+                else OperateResult.AppendText(">>栈板号" + pa_outboxcode.Text + "未采集内容\n", Color.Red);
             }
             else OperateResult.AppendText(">>栈板号不能为空\n", Color.Red);
         }

+ 0 - 15
UAS-MES/FunctionCode/Make/Make_PalletCollection.resx

@@ -788,19 +788,4 @@
   <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pd_outboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_innerqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
 </root>

+ 41 - 2
UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.cs

@@ -56,6 +56,12 @@ namespace UAS_MES.Make
         string oMakecode = "";
         string oMsid = "";
         bool onlyPass = false;
+
+        StringBuilder insertSninfoFields;//存插入sninfo的字段
+
+        StringBuilder insertSninfoValues;//存插入sninfo的值
+
+        StringBuilder toSi;//存更新sninfo的值
         public Make_SeqProgramTransform()
         {
             InitializeComponent();
@@ -244,7 +250,7 @@ namespace UAS_MES.Make
                                 return;
                             }
                             //开始录入SN
-                            if ((ChangeResult.Checked && dh.CheckExist("makeserial", "ms_sncode='" + code.Text + "' and ms_id='"+oMsid+"'"))||!dh.CheckExist("makeserial", "ms_sncode='" + code.Text + "'"))
+                            if ((ChangeResult.Checked && dh.CheckExist("makeserial", "ms_sncode='" + code.Text + "' and ms_id='"+oMsid+"'"))||!dh.CheckExist("makeserial", "ms_sncode='" + code.Text + "' and ms_id <> '"+oMsid+"' and ms_nextmacode is null"))
                             {
                                 //SN校验成功,合法,记录下SN
                                 SN = code.Text;
@@ -259,6 +265,9 @@ namespace UAS_MES.Make
                                 }
                                 //step+1
                                 step = 2;
+                                insertSninfoFields = new StringBuilder();
+                                insertSninfoValues = new StringBuilder();
+                                toSi = new StringBuilder();
                             }
                             else
                             {
@@ -397,6 +406,9 @@ namespace UAS_MES.Make
                     //通过校验,将包含IMEI的值拼接
                     imei.Append("'" + code.Text + "',");
                     s1.Append("MS_" + type + " = '" + code.Text + "',");
+                    insertSninfoFields.Append("si_" + type + ",");
+                    insertSninfoValues.Append("'"+code.Text+"',");
+                    toSi.Append("si_" + type + " = '" + code.Text + "',");
                     break;
                 case "BT":
                 case "MAC":
@@ -409,6 +421,9 @@ namespace UAS_MES.Make
                     }
                     //通过校验,将包含IMEI的值拼接
                     s1.Append("MS_" + type + " = '" + code.Text + "',");
+                    insertSninfoFields.Append("si_" + type + ",");
+                    insertSninfoValues.Append("'" + code.Text + "',");
+                    toSi.Append("si_" + type + " = '" + code.Text + "',");
                     break;
             }
             //满足规则,则采集
@@ -470,7 +485,8 @@ namespace UAS_MES.Make
                         LogicHandler.DoCommandLog(Tag.ToString(),User.UserCode,oMakecode,User.UserLineCode,User.UserSourceCode,"序列烧录转换","转换成功",TSN,"");
                         //完成该道工序 setFinish
                         LogicHandler.SetStepResult( ms_macode.Text, User.UserSourceCode, SN, "序列烧录转换", "序列烧录转换成功", User.UserCode, out errorMessage);
-
+                        //写入sninfo表
+                        insert2Sninfo(TSN);
                         //输出提示用户“>>序列号转换成功”,“>>关联采集成功”
                         //获取剩余数,刷新页面
                         sql.Clear();
@@ -728,5 +744,28 @@ namespace UAS_MES.Make
                 OperateResult.AppendText("<<请输入TSN号\n", Color.Black);
             }
         }
+        private void insert2Sninfo(string sn)
+        {
+            //查询是否有记录
+            string siid = dh.getFieldDataByCondition("sninfo", "max(si_id) si_id", "si_sn='" + sn + "' or si_sn in(select sn from makesnrelation where sn='" + sn + "' or beforesn = '" + sn + "' )").ToString();
+            //是否为空
+            if (siid == "")
+            {
+                //插入新的数据
+                sql.Clear();
+                sql.Append("insert into sninfo(si_id,si_sn," + insertSninfoFields.ToString().Substring(0, insertSninfoFields.ToString().Length - 1) + ") values ");
+                sql.Append("(sninfo_seq.nextval,'"+sn+"'," + insertSninfoValues.ToString().Substring(0, insertSninfoValues.ToString().Length - 1) + ")");
+                dh.ExecuteSql(sql.GetString(), "insert");
+            }
+            else
+            {
+                //更新sninfo
+                sql.Clear();
+                sql.Append("update sninfo set ");
+                sql.Append(toSi.ToString().Substring(0, toSi.ToString().Length - 1));
+                sql.Append(" where si_id='" + siid + "'");
+                dh.ExecuteSql(sql.GetString(), "update");
+            }
+        }
     }
 }

+ 8 - 8
UAS-MES/FunctionCode/Make/Make_SeqTransform.cs

@@ -218,9 +218,9 @@ namespace UAS_MES.Make
                                 return;
                             }
                             //如果两次输入的序列号相同进行提示,不相同则进行下一步
-                            if (bsncode != sncode.Text)
-                            {
-                                if ((ChangeResult.Checked && dh.CheckExist("makeserial", "ms_sncode='" + sncode.Text + "' and ms_id='" + oMsId + "'")) || !dh.CheckExist("makeserial", "ms_sncode='" + sncode.Text + "'"))
+                            //if (bsncode != sncode.Text)
+                            //{
+                                if ((ChangeResult.Checked && dh.CheckExist("makeserial", "ms_sncode='" + sncode.Text + "' and ms_id='" + oMsId + "'")) || !dh.CheckExist("makeserial", "ms_sncode='" + sncode.Text + "'  and ms_id <> '" + oMsId + "' and ms_nextmacode is null"))
                                 {
                                     string firstsn = "";
                                     string updateSql = "";
@@ -268,11 +268,11 @@ namespace UAS_MES.Make
                                 }
                                 else
                                     OperateResult.AppendText(">>序列号" + sncode.Text + "已存在,请输入其他序列号\n", Color.Red);
-                            }
-                            else
-                            {
-                                OperateResult.AppendText(">>相同序列号不能进行转换\n", Color.Red);
-                            }
+                            //}
+                            //else
+                            //{
+                            //    OperateResult.AppendText(">>相同序列号不能进行转换\n", Color.Red);
+                            //}
                             sncode.Text = "";
                         }
                     }

+ 43 - 45
UAS-MES/FunctionCode/Make/Make_SpecialCartonPack.Designer.cs

@@ -54,6 +54,7 @@
             this.pd_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.AutoPrint = new UAS_MES.CustomControl.CustomCheckBox.AutoPrintCheckBox();
             this.groupBoxWithBorder1 = new UAS_MES.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
+            this.DeleteAll = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.pr_outboxinnerqty = new System.Windows.Forms.NumericUpDown();
             this.pa_currentqty_label = new System.Windows.Forms.Label();
             this.pr_detail_label = new System.Windows.Forms.Label();
@@ -85,7 +86,6 @@
             this.pa_downstatus = new System.Windows.Forms.Label();
             this.pa_checkno = new System.Windows.Forms.Label();
             this.pa_sccode = new System.Windows.Forms.Label();
-            this.DeleteAll = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.PackageDetail)).BeginInit();
             this.groupBoxWithBorder1.SuspendLayout();
@@ -121,7 +121,7 @@
             // 
             this.pa_code_label.AutoSize = true;
             this.pa_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_code_label.Location = new System.Drawing.Point(12, 44);
+            this.pa_code_label.Location = new System.Drawing.Point(12, 43);
             this.pa_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_code_label.Name = "pa_code_label";
             this.pa_code_label.Size = new System.Drawing.Size(52, 27);
@@ -132,7 +132,7 @@
             // 
             this.PrintList_label.AutoSize = true;
             this.PrintList_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintList_label.Location = new System.Drawing.Point(13, 44);
+            this.PrintList_label.Location = new System.Drawing.Point(13, 43);
             this.PrintList_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.PrintList_label.Name = "PrintList_label";
             this.PrintList_label.Size = new System.Drawing.Size(112, 27);
@@ -143,7 +143,7 @@
             // 
             this.PrintNum_label.AutoSize = true;
             this.PrintNum_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintNum_label.Location = new System.Drawing.Point(249, 145);
+            this.PrintNum_label.Location = new System.Drawing.Point(249, 144);
             this.PrintNum_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.PrintNum_label.Name = "PrintNum_label";
             this.PrintNum_label.Size = new System.Drawing.Size(52, 27);
@@ -189,7 +189,7 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(13, 93);
+            this.label3.Location = new System.Drawing.Point(13, 92);
             this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(92, 27);
@@ -412,6 +412,26 @@
             this.groupBoxWithBorder1.Text = "装箱信息";
             this.groupBoxWithBorder1.TextColor = System.Drawing.Color.Black;
             // 
+            // DeleteAll
+            // 
+            this.DeleteAll.AllPower = null;
+            this.DeleteAll.BackColor = System.Drawing.Color.Transparent;
+            this.DeleteAll.DownImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.DownImage")));
+            this.DeleteAll.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.DeleteAll.Image = null;
+            this.DeleteAll.IsShowBorder = true;
+            this.DeleteAll.Location = new System.Drawing.Point(475, 45);
+            this.DeleteAll.Margin = new System.Windows.Forms.Padding(4);
+            this.DeleteAll.MoveImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.MoveImage")));
+            this.DeleteAll.Name = "DeleteAll";
+            this.DeleteAll.NormalImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.NormalImage")));
+            this.DeleteAll.Power = "ifspecial";
+            this.DeleteAll.Size = new System.Drawing.Size(58, 30);
+            this.DeleteAll.TabIndex = 185;
+            this.DeleteAll.Text = "拆箱";
+            this.DeleteAll.UseVisualStyleBackColor = true;
+            this.DeleteAll.Click += new System.EventHandler(this.DeleteAll_Click);
+            // 
             // pr_outboxinnerqty
             // 
             this.pr_outboxinnerqty.Font = new System.Drawing.Font("微软雅黑", 9F);
@@ -432,7 +452,7 @@
             // 
             this.pa_currentqty_label.AutoSize = true;
             this.pa_currentqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_currentqty_label.Location = new System.Drawing.Point(277, 91);
+            this.pa_currentqty_label.Location = new System.Drawing.Point(277, 90);
             this.pa_currentqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_currentqty_label.Name = "pa_currentqty_label";
             this.pa_currentqty_label.Size = new System.Drawing.Size(92, 27);
@@ -443,7 +463,7 @@
             // 
             this.pr_detail_label.AutoSize = true;
             this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail_label.Location = new System.Drawing.Point(277, 145);
+            this.pr_detail_label.Location = new System.Drawing.Point(277, 144);
             this.pr_detail_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail_label.Name = "pr_detail_label";
             this.pr_detail_label.Size = new System.Drawing.Size(92, 27);
@@ -454,7 +474,7 @@
             // 
             this.pa_currentqty.AutoSize = true;
             this.pa_currentqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_currentqty.Location = new System.Drawing.Point(388, 91);
+            this.pa_currentqty.Location = new System.Drawing.Point(388, 90);
             this.pa_currentqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_currentqty.Name = "pa_currentqty";
             this.pa_currentqty.Size = new System.Drawing.Size(0, 27);
@@ -464,7 +484,7 @@
             // 
             this.pr_code_label.AutoSize = true;
             this.pr_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code_label.Location = new System.Drawing.Point(12, 145);
+            this.pr_code_label.Location = new System.Drawing.Point(12, 144);
             this.pr_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_code_label.Name = "pr_code_label";
             this.pr_code_label.Size = new System.Drawing.Size(92, 27);
@@ -475,7 +495,7 @@
             // 
             this.pr_detail.AutoSize = true;
             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(388, 145);
+            this.pr_detail.Location = new System.Drawing.Point(388, 144);
             this.pr_detail.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail.Name = "pr_detail";
             this.pr_detail.Size = new System.Drawing.Size(0, 27);
@@ -485,7 +505,7 @@
             // 
             this.pr_outboxinnerqty_label.AutoSize = true;
             this.pr_outboxinnerqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_outboxinnerqty_label.Location = new System.Drawing.Point(12, 91);
+            this.pr_outboxinnerqty_label.Location = new System.Drawing.Point(12, 90);
             this.pr_outboxinnerqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_outboxinnerqty_label.Name = "pr_outboxinnerqty_label";
             this.pr_outboxinnerqty_label.Size = new System.Drawing.Size(92, 27);
@@ -496,7 +516,7 @@
             // 
             this.pr_code.AutoSize = true;
             this.pr_code.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code.Location = new System.Drawing.Point(129, 145);
+            this.pr_code.Location = new System.Drawing.Point(129, 144);
             this.pr_code.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_code.MaximumSize = new System.Drawing.Size(200, 0);
             this.pr_code.Name = "pr_code";
@@ -506,9 +526,7 @@
             // AutoGenBoxCode
             // 
             this.AutoGenBoxCode.AutoSize = true;
-            this.AutoGenBoxCode.Checked = true;
-            this.AutoGenBoxCode.CheckState = System.Windows.Forms.CheckState.Checked;
-            this.AutoGenBoxCode.Location = new System.Drawing.Point(322, 46);
+            this.AutoGenBoxCode.Location = new System.Drawing.Point(322, 45);
             this.AutoGenBoxCode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.AutoGenBoxCode.Name = "AutoGenBoxCode";
             this.AutoGenBoxCode.Size = new System.Drawing.Size(154, 31);
@@ -548,7 +566,7 @@
             // 
             this.ob_nowcheckqty.AutoSize = true;
             this.ob_nowcheckqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_nowcheckqty.Location = new System.Drawing.Point(475, 90);
+            this.ob_nowcheckqty.Location = new System.Drawing.Point(475, 89);
             this.ob_nowcheckqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_nowcheckqty.Name = "ob_nowcheckqty";
             this.ob_nowcheckqty.Size = new System.Drawing.Size(0, 27);
@@ -558,7 +576,7 @@
             // 
             this.ob_batchqty.AutoSize = true;
             this.ob_batchqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_batchqty.Location = new System.Drawing.Point(475, 43);
+            this.ob_batchqty.Location = new System.Drawing.Point(475, 42);
             this.ob_batchqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_batchqty.Name = "ob_batchqty";
             this.ob_batchqty.Size = new System.Drawing.Size(0, 27);
@@ -568,7 +586,7 @@
             // 
             this.ob_nowcheckqty_label.AutoSize = true;
             this.ob_nowcheckqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(367, 90);
+            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(367, 89);
             this.ob_nowcheckqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_nowcheckqty_label.Name = "ob_nowcheckqty_label";
             this.ob_nowcheckqty_label.Size = new System.Drawing.Size(92, 27);
@@ -579,7 +597,7 @@
             // 
             this.ob_batchqty_label.AutoSize = true;
             this.ob_batchqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_batchqty_label.Location = new System.Drawing.Point(367, 43);
+            this.ob_batchqty_label.Location = new System.Drawing.Point(367, 42);
             this.ob_batchqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_batchqty_label.Name = "ob_batchqty_label";
             this.ob_batchqty_label.Size = new System.Drawing.Size(92, 27);
@@ -685,7 +703,7 @@
             // 
             this.pr_cartonunit1.AutoSize = true;
             this.pr_cartonunit1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_cartonunit1.Location = new System.Drawing.Point(125, 170);
+            this.pr_cartonunit1.Location = new System.Drawing.Point(125, 169);
             this.pr_cartonunit1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartonunit1.Name = "pr_cartonunit1";
             this.pr_cartonunit1.Size = new System.Drawing.Size(25, 27);
@@ -697,7 +715,7 @@
             // 
             this.pr_cartonunit.AutoSize = true;
             this.pr_cartonunit.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_cartonunit.Location = new System.Drawing.Point(84, 43);
+            this.pr_cartonunit.Location = new System.Drawing.Point(84, 42);
             this.pr_cartonunit.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartonunit.Name = "pr_cartonunit";
             this.pr_cartonunit.Size = new System.Drawing.Size(25, 27);
@@ -708,7 +726,7 @@
             // 
             this.pr_cartonboxgw.AutoSize = true;
             this.pr_cartonboxgw.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_cartonboxgw.Location = new System.Drawing.Point(81, 230);
+            this.pr_cartonboxgw.Location = new System.Drawing.Point(81, 229);
             this.pr_cartonboxgw.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartonboxgw.Name = "pr_cartonboxgw";
             this.pr_cartonboxgw.Size = new System.Drawing.Size(0, 27);
@@ -718,7 +736,7 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(28, 170);
+            this.label4.Location = new System.Drawing.Point(28, 169);
             this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(92, 27);
@@ -730,7 +748,7 @@
             this.weight.AutoSize = true;
             this.weight.Font = new System.Drawing.Font("微软雅黑", 20F);
             this.weight.ForeColor = System.Drawing.Color.Lime;
-            this.weight.Location = new System.Drawing.Point(77, 90);
+            this.weight.Location = new System.Drawing.Point(77, 89);
             this.weight.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.weight.Name = "weight";
             this.weight.Size = new System.Drawing.Size(0, 45);
@@ -740,7 +758,7 @@
             // 
             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(28, 43);
+            this.label2.Location = new System.Drawing.Point(28, 42);
             this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(52, 27);
@@ -802,26 +820,6 @@
             this.pa_sccode.TabIndex = 181;
             this.pa_sccode.Visible = false;
             // 
-            // DeleteAll
-            // 
-            this.DeleteAll.AllPower = null;
-            this.DeleteAll.BackColor = System.Drawing.Color.Transparent;
-            this.DeleteAll.DownImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.DownImage")));
-            this.DeleteAll.Font = new System.Drawing.Font("微软雅黑", 9F);
-            this.DeleteAll.Image = null;
-            this.DeleteAll.IsShowBorder = true;
-            this.DeleteAll.Location = new System.Drawing.Point(475, 45);
-            this.DeleteAll.Margin = new System.Windows.Forms.Padding(4);
-            this.DeleteAll.MoveImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.MoveImage")));
-            this.DeleteAll.Name = "DeleteAll";
-            this.DeleteAll.NormalImage = ((System.Drawing.Image)(resources.GetObject("DeleteAll.NormalImage")));
-            this.DeleteAll.Power = "ifspecial";
-            this.DeleteAll.Size = new System.Drawing.Size(58, 30);
-            this.DeleteAll.TabIndex = 185;
-            this.DeleteAll.Text = "拆箱";
-            this.DeleteAll.UseVisualStyleBackColor = true;
-            this.DeleteAll.Click += new System.EventHandler(this.DeleteAll_Click);
-            // 
             // Make_SpecialCartonPack
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);

+ 0 - 18
UAS-MES/FunctionCode/Make/Make_SpecialCartonPack.resx

@@ -212,24 +212,6 @@
   <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pd_barcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pa_outboxcode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pa_prodcode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_innerqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pa_indate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
   <data name="DeleteAll.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m

+ 42 - 2
UAS-MES/FunctionCode/Make/Make_UpdateCollectCode.cs

@@ -31,7 +31,13 @@ namespace UAS_MES.Make
 
         string ms_id = "";
 
-        StringBuilder sb;
+        StringBuilder sb;//存更新makeserial表的数据
+
+        StringBuilder toSi;//存储更新sninfo的数据
+
+        StringBuilder insertSninfoFields;
+
+        StringBuilder insertSninfoValues;
 
         string sncode = "";
         StringBuilder oldData;
@@ -129,8 +135,11 @@ namespace UAS_MES.Make
                     step = 1;
                     OperateResult.AppendText("<<请输入" + ((CheckBox)list[0]).Text + "\n", Color.Green, inputValue);
                     sb = new StringBuilder();
+                    toSi = new StringBuilder();//初始化以备更新sninfo表
                     oldData = new StringBuilder();
                     newData = new StringBuilder();
+                    insertSninfoFields = new StringBuilder();
+                    insertSninfoValues = new StringBuilder();
                 }
                 else
                 //采集的关联采集信息
@@ -173,6 +182,9 @@ namespace UAS_MES.Make
                                 }
                                 //通过校验
                                 sb.Append("ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + " = '" + inputValue.Text + "',");
+                                toSi.Append("si_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + " = '" + inputValue.Text + "',");
+                                insertSninfoFields.Append("si_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ",");
+                                insertSninfoValues.Append("'"+inputValue.Text+"',");
                                 oldData.Append("ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":" + dt.Rows[0]["ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0]].ToString() + ",");
                                 newData.Append("ms_" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":" + inputValue.Text + ",");
                             }
@@ -194,6 +206,9 @@ namespace UAS_MES.Make
                             }
                             //通过校验
                             sb.Append("ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + " = '" + inputValue.Text + "',");
+                            toSi.Append("si_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + " = '" + inputValue.Text + "',");
+                            insertSninfoFields.Append("si_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + ",");
+                            insertSninfoValues.Append("'"+inputValue.Text+"',");
                             oldData.Append("ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + ":" + dt.Rows[0]["ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text)].ToString() + ",");
                             newData.Append("ms_" + (((CheckBox)list[step - 1]).Text == "网标" ? "NETCODE" : ((CheckBox)list[step - 1]).Text) + ":" + inputValue.Text + ",");
                             break;
@@ -209,8 +224,10 @@ namespace UAS_MES.Make
                         dh.ExecuteSql(sql.GetString(), "update");
                         //提示烧录成功
                         OperateResult.AppendText(">>烧录成功\n", Color.Green);
+                        //更新sninfo表
+                        insert2Sninfo(sncode);
                         //记录日志
-                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, dt.Rows[0]["ms_makecode"].ToString(), User.UserLineCode, User.UserSourceCode, "更新烧录", "原数据:" + oldData.ToString() + "新数据:" + newData.ToString(), sncode, "");
+                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, dt.Rows[0]["ms_makecode"].ToString(), User.UserLineCode, User.UserSourceCode, "更新烧录","新数据:" + newData.ToString(), sncode, "");
                         step = 0;
                         //清除规则
                         BaseUtil.CleanDataTableData(info);
@@ -284,5 +301,28 @@ namespace UAS_MES.Make
                 OperateResult.AppendText(">>请采集SN\n", Color.Black);
             }
         }
+        private void insert2Sninfo(string sn)
+        {
+            //查询是否有记录
+            string siid = dh.getFieldDataByCondition("sninfo", "max(si_id) si_id", "si_sn='"+sn+"' or si_sn in(select sn from makesnrelation where sn='"+sn+"' or beforesn = '"+sn+"' )").ToString();
+            //是否为空
+            if (siid == "")
+            {
+                //插入新的数据
+                sql.Clear();
+                sql.Append("insert into sninfo(si_id,si_sn,"+ insertSninfoFields.ToString().Substring(0, insertSninfoFields.ToString().Length - 1) + ") values ");
+                sql.Append("(sninfo_seq.nextval,'"+sn+"',"+ insertSninfoValues.ToString().Substring(0, insertSninfoValues.ToString().Length - 1) + ")");
+                dh.ExecuteSql(sql.GetString(),"insert");
+            }
+            else
+            {
+                //更新sninfo
+                sql.Clear();
+                sql.Append("update sninfo set ");
+                sql.Append(toSi.ToString().Substring(0, toSi.ToString().Length - 1));
+                sql.Append(" where si_id='" + siid + "'");
+                dh.ExecuteSql(sql.GetString(), "update");
+            }
+        }
     }
 }

+ 20 - 17
UAS-MES/FunctionCode/Packing/Packing_ProdWeightSet.Designer.cs

@@ -43,6 +43,8 @@
             this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.panel4 = new System.Windows.Forms.Panel();
+            this.errorValue = new System.Windows.Forms.TextBox();
+            this.standardWeight = new System.Windows.Forms.TextBox();
             this.label7 = new System.Windows.Forms.Label();
             this.label4 = new System.Windows.Forms.Label();
             this.label6 = new System.Windows.Forms.Label();
@@ -58,8 +60,6 @@
             this.stopWeigh = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.startWeigh = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.ma_code = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
-            this.standardWeight = new System.Windows.Forms.TextBox();
-            this.errorValue = new System.Windows.Forms.TextBox();
             this.panel4.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -196,6 +196,24 @@
             this.panel4.Size = new System.Drawing.Size(515, 156);
             this.panel4.TabIndex = 221;
             // 
+            // errorValue
+            // 
+            this.errorValue.Location = new System.Drawing.Point(245, 19);
+            this.errorValue.Name = "errorValue";
+            this.errorValue.Size = new System.Drawing.Size(100, 28);
+            this.errorValue.TabIndex = 52;
+            this.errorValue.Enter += new System.EventHandler(this.standardWeight_Enter);
+            this.errorValue.Leave += new System.EventHandler(this.standardWeight_Leave);
+            // 
+            // standardWeight
+            // 
+            this.standardWeight.Location = new System.Drawing.Point(83, 19);
+            this.standardWeight.Name = "standardWeight";
+            this.standardWeight.Size = new System.Drawing.Size(100, 28);
+            this.standardWeight.TabIndex = 51;
+            this.standardWeight.Enter += new System.EventHandler(this.standardWeight_Enter);
+            this.standardWeight.Leave += new System.EventHandler(this.standardWeight_Leave);
+            // 
             // label7
             // 
             this.label7.AutoSize = true;
@@ -410,21 +428,6 @@
             this.ma_code.TextBoxEnable = false;
             this.ma_code.UserControlTextChanged += new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox.OnTextChange(this.ma_code_UserControlTextChanged);
             // 
-            // standardWeight
-            // 
-            this.standardWeight.Location = new System.Drawing.Point(83, 19);
-            this.standardWeight.Name = "standardWeight";
-            this.standardWeight.Size = new System.Drawing.Size(100, 28);
-            this.standardWeight.TabIndex = 51;
-            this.standardWeight.TextChanged += new System.EventHandler(this.standardWeight_TextChanged);
-            // 
-            // errorValue
-            // 
-            this.errorValue.Location = new System.Drawing.Point(245, 19);
-            this.errorValue.Name = "errorValue";
-            this.errorValue.Size = new System.Drawing.Size(100, 28);
-            this.errorValue.TabIndex = 52;
-            // 
             // Packing_ProdWeightSet
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);

+ 38 - 0
UAS-MES/FunctionCode/Packing/Packing_ProdWeightSet.cs

@@ -44,6 +44,9 @@ namespace UAS_MES.Packing
         List<string> sncodes = new List<string>();//存序列号
         List<string> indates = new List<string>();//存时间
         List<string> weights = new List<string>();//存重量
+
+        string recordSW = ""; //存标准重量
+        string recordEV = "";//存误差值
         public Packing_ProdWeightSet()
         {
             InitializeComponent();
@@ -304,8 +307,43 @@ namespace UAS_MES.Packing
         }
 
         private void standardWeight_TextChanged(object sender, EventArgs e)
+        {
+        }
+
+        private void standardWeight_Leave(object sender, EventArgs e)
         {
             //在采样的时候不能更改
+            if (showResult.Items.Count > 0)
+            {
+                if ((sender as TextBox).Name == "standardWeight"&& standardWeight.Text == recordSW)
+                {
+                    return;
+                }
+                else if((sender as TextBox).Name == "errorValue" && errorValue.Text == recordEV)
+                {
+                    return;
+                }
+                if (MessageBox.Show("是否修改标准重量或误差值重新采样", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
+                {
+                    //选择取消,数据回退
+                    standardWeight.Text = recordSW;
+                    errorValue.Text = recordEV;
+                }
+                else
+                {
+                    //选择确认,重新采样
+                    showResult.Items.Clear();
+                    indates.Clear();
+                    sncodes.Clear();
+                    weights.Clear();
+                }
+            }
+        }
+
+        private void standardWeight_Enter(object sender, EventArgs e)
+        {
+            recordSW = standardWeight.Text;
+            recordEV = errorValue.Text;
         }
     }
 }

+ 59 - 46
UAS_AutoPass/AutoAnalysisXml.Designer.cs

@@ -45,6 +45,7 @@
             this.Master = new System.Windows.Forms.ComboBox();
             this.AutoStart = new System.Windows.Forms.CheckBox();
             this.ma_code = new System.Windows.Forms.TextBox();
+            this.BatchAnalysus = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).BeginInit();
             this.SuspendLayout();
             // 
@@ -57,10 +58,10 @@
             // StartWatch
             // 
             this.StartWatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.StartWatch.Location = new System.Drawing.Point(145, 256);
-            this.StartWatch.Margin = new System.Windows.Forms.Padding(2);
+            this.StartWatch.Location = new System.Drawing.Point(193, 320);
+            this.StartWatch.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.StartWatch.Name = "StartWatch";
-            this.StartWatch.Size = new System.Drawing.Size(64, 28);
+            this.StartWatch.Size = new System.Drawing.Size(85, 35);
             this.StartWatch.TabIndex = 0;
             this.StartWatch.Text = "开始监控";
             this.StartWatch.UseVisualStyleBackColor = true;
@@ -70,10 +71,10 @@
             // 
             this.StopWatch.Enabled = false;
             this.StopWatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.StopWatch.Location = new System.Drawing.Point(249, 256);
-            this.StopWatch.Margin = new System.Windows.Forms.Padding(2);
+            this.StopWatch.Location = new System.Drawing.Point(332, 320);
+            this.StopWatch.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.StopWatch.Name = "StopWatch";
-            this.StopWatch.Size = new System.Drawing.Size(64, 28);
+            this.StopWatch.Size = new System.Drawing.Size(85, 35);
             this.StopWatch.TabIndex = 1;
             this.StopWatch.Text = "停止监控";
             this.StopWatch.UseVisualStyleBackColor = true;
@@ -83,29 +84,28 @@
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(27, 139);
-            this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label1.Location = new System.Drawing.Point(36, 174);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(84, 20);
+            this.label1.Size = new System.Drawing.Size(107, 25);
             this.label1.TabIndex = 2;
             this.label1.Text = "监控文件夹";
             // 
             // FolderPath
             // 
             this.FolderPath.Enabled = false;
-            this.FolderPath.Location = new System.Drawing.Point(112, 139);
-            this.FolderPath.Margin = new System.Windows.Forms.Padding(2);
+            this.FolderPath.Location = new System.Drawing.Point(149, 174);
+            this.FolderPath.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.FolderPath.Name = "FolderPath";
-            this.FolderPath.Size = new System.Drawing.Size(220, 21);
+            this.FolderPath.Size = new System.Drawing.Size(292, 25);
             this.FolderPath.TabIndex = 3;
             // 
             // ChooseFolder
             // 
             this.ChooseFolder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ChooseFolder.Location = new System.Drawing.Point(346, 139);
-            this.ChooseFolder.Margin = new System.Windows.Forms.Padding(2);
+            this.ChooseFolder.Location = new System.Drawing.Point(461, 174);
+            this.ChooseFolder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.ChooseFolder.Name = "ChooseFolder";
-            this.ChooseFolder.Size = new System.Drawing.Size(78, 24);
+            this.ChooseFolder.Size = new System.Drawing.Size(104, 30);
             this.ChooseFolder.TabIndex = 6;
             this.ChooseFolder.Text = "选择文件夹";
             this.ChooseFolder.UseVisualStyleBackColor = true;
@@ -113,20 +113,20 @@
             // 
             // OperateResult
             // 
-            this.OperateResult.Location = new System.Drawing.Point(446, 11);
-            this.OperateResult.Margin = new System.Windows.Forms.Padding(2);
+            this.OperateResult.Location = new System.Drawing.Point(595, 14);
+            this.OperateResult.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(211, 270);
+            this.OperateResult.Size = new System.Drawing.Size(280, 336);
             this.OperateResult.TabIndex = 7;
             this.OperateResult.Text = "";
             // 
             // Clean
             // 
             this.Clean.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Clean.Location = new System.Drawing.Point(524, 287);
-            this.Clean.Margin = new System.Windows.Forms.Padding(2);
+            this.Clean.Location = new System.Drawing.Point(699, 359);
+            this.Clean.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.Clean.Name = "Clean";
-            this.Clean.Size = new System.Drawing.Size(56, 24);
+            this.Clean.Size = new System.Drawing.Size(75, 30);
             this.Clean.TabIndex = 8;
             this.Clean.Text = "清除";
             this.Clean.UseVisualStyleBackColor = true;
@@ -135,10 +135,10 @@
             // ChooseBackUpFolder
             // 
             this.ChooseBackUpFolder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ChooseBackUpFolder.Location = new System.Drawing.Point(346, 201);
-            this.ChooseBackUpFolder.Margin = new System.Windows.Forms.Padding(2);
+            this.ChooseBackUpFolder.Location = new System.Drawing.Point(461, 251);
+            this.ChooseBackUpFolder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.ChooseBackUpFolder.Name = "ChooseBackUpFolder";
-            this.ChooseBackUpFolder.Size = new System.Drawing.Size(78, 24);
+            this.ChooseBackUpFolder.Size = new System.Drawing.Size(104, 30);
             this.ChooseBackUpFolder.TabIndex = 11;
             this.ChooseBackUpFolder.Text = "选择文件夹";
             this.ChooseBackUpFolder.UseVisualStyleBackColor = true;
@@ -147,20 +147,19 @@
             // BackUpFolderPath
             // 
             this.BackUpFolderPath.Enabled = false;
-            this.BackUpFolderPath.Location = new System.Drawing.Point(112, 201);
-            this.BackUpFolderPath.Margin = new System.Windows.Forms.Padding(2);
+            this.BackUpFolderPath.Location = new System.Drawing.Point(149, 251);
+            this.BackUpFolderPath.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.BackUpFolderPath.Name = "BackUpFolderPath";
-            this.BackUpFolderPath.Size = new System.Drawing.Size(220, 21);
+            this.BackUpFolderPath.Size = new System.Drawing.Size(292, 25);
             this.BackUpFolderPath.TabIndex = 10;
             // 
             // label2
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(27, 201);
-            this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label2.Location = new System.Drawing.Point(36, 251);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(84, 20);
+            this.label2.Size = new System.Drawing.Size(107, 25);
             this.label2.TabIndex = 9;
             this.label2.Text = "备份文件夹";
             // 
@@ -168,10 +167,9 @@
             // 
             this.MakeCode_lable.AutoSize = true;
             this.MakeCode_lable.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MakeCode_lable.Location = new System.Drawing.Point(27, 80);
-            this.MakeCode_lable.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.MakeCode_lable.Location = new System.Drawing.Point(36, 100);
             this.MakeCode_lable.Name = "MakeCode_lable";
-            this.MakeCode_lable.Size = new System.Drawing.Size(54, 20);
+            this.MakeCode_lable.Size = new System.Drawing.Size(69, 25);
             this.MakeCode_lable.TabIndex = 12;
             this.MakeCode_lable.Text = "工单号";
             // 
@@ -179,10 +177,9 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(27, 23);
-            this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label4.Location = new System.Drawing.Point(36, 29);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(69, 20);
+            this.label4.Size = new System.Drawing.Size(88, 25);
             this.label4.TabIndex = 14;
             this.label4.Text = "账套选择";
             // 
@@ -190,17 +187,19 @@
             // 
             this.Master.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.Master.FormattingEnabled = true;
-            this.Master.Location = new System.Drawing.Point(112, 23);
+            this.Master.Location = new System.Drawing.Point(149, 29);
+            this.Master.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Master.Name = "Master";
-            this.Master.Size = new System.Drawing.Size(220, 20);
+            this.Master.Size = new System.Drawing.Size(292, 23);
             this.Master.TabIndex = 15;
             // 
             // AutoStart
             // 
             this.AutoStart.AutoSize = true;
-            this.AutoStart.Location = new System.Drawing.Point(343, 26);
+            this.AutoStart.Location = new System.Drawing.Point(457, 32);
+            this.AutoStart.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.AutoStart.Name = "AutoStart";
-            this.AutoStart.Size = new System.Drawing.Size(96, 16);
+            this.AutoStart.Size = new System.Drawing.Size(119, 19);
             this.AutoStart.TabIndex = 16;
             this.AutoStart.Text = "开机自动启动";
             this.AutoStart.UseVisualStyleBackColor = true;
@@ -208,17 +207,30 @@
             // 
             // ma_code
             // 
-            this.ma_code.Location = new System.Drawing.Point(112, 80);
-            this.ma_code.Margin = new System.Windows.Forms.Padding(2);
+            this.ma_code.Location = new System.Drawing.Point(149, 100);
+            this.ma_code.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.ma_code.Name = "ma_code";
-            this.ma_code.Size = new System.Drawing.Size(220, 21);
+            this.ma_code.Size = new System.Drawing.Size(292, 25);
             this.ma_code.TabIndex = 17;
             // 
+            // BatchAnalysus
+            // 
+            this.BatchAnalysus.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.BatchAnalysus.Location = new System.Drawing.Point(461, 98);
+            this.BatchAnalysus.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.BatchAnalysus.Name = "BatchAnalysus";
+            this.BatchAnalysus.Size = new System.Drawing.Size(104, 30);
+            this.BatchAnalysus.TabIndex = 18;
+            this.BatchAnalysus.Text = "批量解析";
+            this.BatchAnalysus.UseVisualStyleBackColor = true;
+            this.BatchAnalysus.Click += new System.EventHandler(this.BatchAnalysus_Click);
+            // 
             // AutoAnalysisXml
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(665, 316);
+            this.ClientSize = new System.Drawing.Size(887, 395);
+            this.Controls.Add(this.BatchAnalysus);
             this.Controls.Add(this.ma_code);
             this.Controls.Add(this.AutoStart);
             this.Controls.Add(this.Master);
@@ -234,7 +246,7 @@
             this.Controls.Add(this.label1);
             this.Controls.Add(this.StopWatch);
             this.Controls.Add(this.StartWatch);
-            this.Margin = new System.Windows.Forms.Padding(2);
+            this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.MaximizeBox = false;
             this.Name = "AutoAnalysisXml";
             this.Text = "UAS自动过站解析器";
@@ -265,6 +277,7 @@
         private System.Windows.Forms.Label label4;
         private System.Windows.Forms.CheckBox AutoStart;
         private System.Windows.Forms.TextBox ma_code;
+        private System.Windows.Forms.Button BatchAnalysus;
     }
 }
 

+ 214 - 2
UAS_AutoPass/AutoAnalysisXml.cs

@@ -264,7 +264,7 @@ namespace UAS_AutoPass
                 if (LogicHandler.CheckStepSNAndMacode(ma_code.Text == "" ? makecode : ma_code.Text, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
                 {
                     //插入日志
-                    LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, e.Name, test_result == "NG" ? "-1" : "0","-1");
+                    LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, e.Name, test_result == "NG" ? "-1" : "0", "-1");
                     //如果是不良品记录日志,用于测试采集判负
                     if (test_result == "NG")
                     {
@@ -286,6 +286,7 @@ namespace UAS_AutoPass
             {
                 string status = "";
                 string errmessage = "";
+                bool NoteAlready = false;
                 LogicHandler.GetMakeInfo(sncode, out makecode, out status, out errmessage);
                 if (ma_code.Text != makecode && makecode != "" && ma_code.Text != "" && status != "2")
                 {
@@ -295,9 +296,30 @@ namespace UAS_AutoPass
                     {
                         makecode = ma_code.Text;
                     }
+                    else
+                    {
+                        NoteAlready = true;
+                    }
                 }
                 if (LogicHandler.CheckStepSNAndMacode(makecode, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
                 {
+                    if (!NoteAlready)
+                    {
+                        if (makecode != ma_code.Text && ma_code.Text != "")
+                        {
+                            string ChangeMakeCode = MessageBox.Show(this.ParentForm, "序列号所属工单不同,是否切换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                            //如果选择不切换赋值当前界面工单
+                            if (ChangeMakeCode == "Yes")
+                            {
+                                ma_code.Text = makecode;
+                            }
+                            else
+                            {
+                                OperateResult.AppendText(">>请重新采集序列号\n");
+                                return;
+                            }
+                        }
+                    }
                     //获取序列号ID最大的工单
                     dt = (DataTable)dh.ExecuteSql("select ms_makecode,ms_id from makeserial where ms_sncode='" + sncode + "' order by ms_id desc", "select");
                     if (dt.Rows.Count > 0)
@@ -325,7 +347,7 @@ namespace UAS_AutoPass
                             default:
                                 break;
                         }
-                        LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, e.Name, test_result == "NG" ? "1" : "0","0");
+                        LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, e.Name, test_result == "NG" ? "1" : "0", "0");
                     }
                 }
                 else
@@ -461,5 +483,195 @@ namespace UAS_AutoPass
                 rk.Close();
             }
         }
+
+        private void BatchAnalysus_Click(object sender, EventArgs e)
+        {
+            var AllXmls = Directory.GetFiles(FolderPath.Text, "*.xml");
+            foreach (var Xml in AllXmls)
+            {
+                string fileName = Xml.Substring(Xml.LastIndexOf(@"\")+1, Xml.Length- Xml.LastIndexOf(@"\")-1);
+                string test_date = "";
+                string test_result = "";
+                string test_sn = "";
+                string imageurl = "";
+                string oMSID = "";
+                string oErrMessage = "";
+                XmlReader myReader = XmlReader.Create(FolderPath.Text + @"\" + fileName);
+                OperateResult.AppendText("读取文件" + fileName + "\n");
+                //获取采集的项目名称
+                List<string> badcode = new List<string>();
+                //获取采集项目的结果
+                List<string> badlocation = new List<string>();
+                int code_or_location = 0;
+                while (myReader.Read())
+                {
+                    if (myReader.NodeType == XmlNodeType.Element && myReader.Name == "test" && myReader.IsStartElement())
+                    {
+                        test_sn = myReader.GetAttribute("test_sn");
+                        test_result = myReader.GetAttribute("test_result");
+                        test_date = myReader.GetAttribute("test_date");
+                        imageurl = myReader.GetAttribute("imgurl");
+                    }
+                    if (myReader.NodeType == XmlNodeType.Text)
+                    {
+                        if (code_or_location % 2 == 0)
+                        {
+                            badcode.Add(myReader.Value);
+                            code_or_location++;
+                        }
+                        else
+                        {
+                            badlocation.Add(myReader.Value);
+                            code_or_location++;
+                        }
+                    }
+                }
+                myReader.Close();
+                //获取文件名的序列号,如SA123456.xml,如果开头为-表示无条码需要自动获取
+                string sncode = fileName.Substring(0, 1) == "-" ? "" : fileName.Split('.')[0];
+                string makecode = "";
+                //获取序列号ID最大的工单号,所有序列号都测试为良品
+                if (sncode == "")
+                {
+                    //获取资源,线别,工序相等,并且状态在线的序列号进行分配
+                    sql.Clear();
+                    sql.Append("select ms_sncode,ms_makecode from makeserial left join source on sc_code=ms_sccode where ");
+                    sql.Append("ms_linecode='" + ilinecode + "' and ms_nextstepcode='" + istepcode + "' and ms_status=1 order by ms_id");
+                    dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+                    if (dt.Rows.Count > 0)
+                    {
+                        makecode = dt.Rows[0]["ms_makecode"].ToString();
+                        sncode = dt.Rows[0]["ms_sncode"].ToString();
+                    }
+                    else
+                    {
+                        OperateResult.AppendText("当前线别在" + istepcode + "无可分配序列号");
+                        continue;
+                    }
+                    //-2-NG2017/10/2514:46:29.xml取第二位版号
+                    string combinecode = fileName.Substring(1, 1);
+                    if (LogicHandler.CheckStepSNAndMacode(ma_code.Text == "" ? makecode : ma_code.Text, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
+                    {
+                        //插入日志
+                        LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, fileName, test_result == "NG" ? "-1" : "0", "-1");
+                        //如果是不良品记录日志,用于测试采集判负
+                        if (test_result == "NG")
+                        {
+                            RecordBadInfo(sncode, makecode, fileName, combinecode, badcode.ToArray(), badlocation.ToArray());
+                        }
+                        if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", "OK", iusercode, out oErrMessage))
+                        {
+                            OperateResult.AppendText(oErrMessage + "\n");
+                            continue;
+                        }
+                    }
+                    else
+                    {
+                        OperateResult.AppendText(oErrMessage + "\n");
+                        continue;
+                    }
+                }
+                else
+                {
+                    string status = "";
+                    string errmessage = "";
+                    bool NoteAlready = false;
+                    LogicHandler.GetMakeInfo(sncode, out makecode, out status, out errmessage);
+                    if (ma_code.Text != makecode && makecode != "" && ma_code.Text != "" && status != "2")
+                    {
+                        string ChangeMakeCode = MessageBox.Show(this.ParentForm, "序列号" + sncode + "所属工单不同,是否切换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                        //如果选择不切换赋值当前界面工单
+                        if (ChangeMakeCode != "Yes")
+                        {
+                            makecode = ma_code.Text;
+                        }
+                        else
+                        {
+                            NoteAlready = true;
+                        }
+                    }
+                    if (LogicHandler.CheckStepSNAndMacode(makecode, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
+                    {
+                        if (!NoteAlready)
+                        {
+                            if (makecode != ma_code.Text && ma_code.Text != "")
+                            {
+                                string ChangeMakeCode = MessageBox.Show(this.ParentForm, "序列号所属工单不同,是否切换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                                //如果选择不切换赋值当前界面工单
+                                if (ChangeMakeCode == "Yes")
+                                {
+                                    ma_code.Text = makecode;
+                                }
+                                else
+                                {
+                                    OperateResult.AppendText(">>请重新采集序列号\n");
+                                    continue;
+                                }
+                            }
+                        }
+                        //获取序列号ID最大的工单
+                        dt = (DataTable)dh.ExecuteSql("select ms_makecode,ms_id from makeserial where ms_sncode='" + sncode + "' order by ms_id desc", "select");
+                        if (dt.Rows.Count > 0)
+                        {
+                            ma_code.Text = dt.Rows[0]["ms_makecode"].ToString();
+                            makecode = dt.Rows[0]["ms_makecode"].ToString();
+                            switch (test_result)
+                            {
+                                case "OK":
+                                    if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out oErrMessage))
+                                    {
+                                        OperateResult.AppendText(oErrMessage + "\n");
+                                        continue;
+                                    }
+                                    break;
+                                case "NG":
+                                    RecordBadInfo(sncode, makecode, fileName, "", badcode.ToArray(), badlocation.ToArray());
+                                    //所有的序列号均采集为良品
+                                    if (!LogicHandler.SetTestNGDetail(sncode, makecode, iusercode, isource, test_result, out oErrMessage))
+                                    {
+                                        OperateResult.AppendText(oErrMessage + "\n");
+                                        continue;
+                                    }
+                                    break;
+                                default:
+                                    break;
+                            }
+                            LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, fileName, test_result == "NG" ? "1" : "0", "0");
+                        }
+                    }
+                    else
+                    {
+                        OperateResult.AppendText(oErrMessage + "\n");
+                        continue;
+                    }
+                }
+                FileInfo file = new FileInfo(FolderPath.Text + @"\" + fileName);
+                if (file.Exists)
+                {
+                    try
+                    {
+                        for (int i = 1; i <= 20; i++)
+                        {
+                            if (!File.Exists(BackUpFolderPath.Text + @"\" + fileName))
+                            {
+                                file.MoveTo(BackUpFolderPath.Text + @"\" + fileName);
+                                OperateResult.AppendText("成功解析文件" + fileName + "\n");
+                                break;
+                            }
+                            else if (!File.Exists(BackUpFolderPath.Text + @"\" + fileName.Split('.')[0] + "(" + i + ")" + "." + fileName.Split('.')[1]))
+                            {
+                                file.MoveTo(BackUpFolderPath.Text + @"\" + fileName.Split('.')[0] + "(" + i + ")" + "." + fileName.Split('.')[1]);
+                                OperateResult.AppendText("成功解析文件" + fileName + "\n");
+                                break;
+                            }
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        OperateResult.AppendText(fileName + ex.Message + "\n");
+                    }
+                }
+            }
+        }
     }
 }