Browse Source

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

Hcsy 8 years ago
parent
commit
08b0169328

+ 5 - 5
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -217,7 +217,7 @@ namespace UAS_MES.Make
                         string length = dt1.Rows[RemainIndex]["sp_length"].ToString();
                         string sp_id = dt1.Rows[RemainIndex]["sp_id"].ToString();
                         string sp_ifforsn = dt1.Rows[RemainIndex]["sp_ifforsn"].ToString();
-                        string pr_tracekind = dt1.Rows[RemainIndex]["pr_tracekind"].ToString();
+                        string sp_tracekind = dt1.Rows[RemainIndex]["sp_tracekind"].ToString();
                         int sp_length = int.Parse(length != "" ? length : "0");
                         if (dt1.Rows[RemainIndex]["sp_type"].ToString() == "物料")
                         {
@@ -235,7 +235,7 @@ namespace UAS_MES.Make
                                 else OperateResult.AppendText(">>序列号不存在\n", Color.Red);
                             }
                             //单件管控物料
-                            else if (pr_tracekind == "1")
+                            else if (sp_tracekind == "1")
                             {
                                 dt = (DataTable)dh.ExecuteSql("select bar_prodcode,bar_code from barcode where bar_code='" + code.Text + "'", "select");
                                 if (dt.Rows.Count > 0)
@@ -254,7 +254,7 @@ namespace UAS_MES.Make
                                 else OperateResult.AppendText(">>条码不存在\n", Color.Red, code);
                             }
                             //不管控
-                            else if (pr_tracekind == "0")
+                            else if (sp_tracekind == "0")
                             {
                                 //进行前缀匹配
                                 if (code.Text.Substring(0, sp_prefix.Length) == sp_prefix || sp_prefix == "")
@@ -370,11 +370,11 @@ namespace UAS_MES.Make
                         //单独用一个DataTable存储一个
                         dt1 = new DataTable();
                         sql.Clear();
-                        sql.Append("select sp_id,sp_prefix,sp_ifuseregex,sp_ifforsn,sp_length,sp_description,sp_soncode,pr_tracekind,pr_detail,pr_spec,sp_repcode,pr_id,");
+                        sql.Append("select sp_id,sp_tracekind,sp_prefix,sp_ifuseregex,sp_ifforsn,sp_length,sp_description,sp_soncode,pr_detail,pr_spec,sp_repcode,pr_id,");
                         sql.Append("sp_type,case when (sp_type='物料' and sp_soncode=pr_code) then '已采集' else '未采集' end sp_ifpick ,sp_prefix,");
                         sql.Append("sp_length,sp_regex,sp_ifforsn from stepproduct left join product on pr_code=sp_soncode where sp_bomversion='" + ma_bomversion + "' and ");
                         sql.Append("sp_craftcode='" + ms_craftcode + "' and sp_stepcode='" + User.CurrentStepCode + "' And sp_mothercode ='" + make_prodcode + "' ");
-                        sql.Append("and((sp_type = '物料' and( pr_tracekind <> 2 or pr_tracekind is null))or sp_type <> '物料') order by SP_DETNO asc");
+                        sql.Append("and((sp_type = '物料' and( sp_tracekind <> 2 or sp_tracekind is null))or sp_type <> '物料') order by SP_DETNO asc");
                         dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                         sn_code.Text = code.Text;
                         code.Clear();

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

@@ -45,6 +45,11 @@ namespace UAS_MES.Make
         string makecode;
         //存放所有关联信息的类型和录入的值
         Hashtable hs;
+        string startNo = "";//起始序列
+
+        string endNo = "";//终止序列
+
+        string system = "";//进制
         public Make_SeqProgramTransform()
         {
             InitializeComponent();
@@ -435,7 +440,7 @@ namespace UAS_MES.Make
             SNLength_checkBox.Enabled = true;
 
             //查询表工单序列号防呆规则表
-            dt = (DataTable)dh.ExecuteSql("select msr_type, msr_prefix ,msr_length from makesnrule where msr_makecode='" + ms_macode.Text + "'", "select");
+            dt = (DataTable)dh.ExecuteSql("select msr_startno,msr_endno,msr_system,msr_type, msr_prefix ,msr_length from makesnrule where msr_makecode='" + ms_macode.Text + "'", "select");
             if (dt.Rows.Count > 0)
             {
                 foreach (DataRow dr in dt.Rows)
@@ -477,6 +482,8 @@ namespace UAS_MES.Make
                         //临时变量记录
                         string length = dr["msr_length"].ToString();
                         string prefix = dr["msr_prefix"].ToString();
+                        //记录进制
+                        system = dr["msr_system"].ToString();
                         //不为空
                         if (prefix != "" && prefix != null)
                         {
@@ -487,7 +494,12 @@ namespace UAS_MES.Make
                             //勾选
                             SNPre_checkBox.Checked = true;
                             SNPre_checkBox.Enabled = false;
+                            //记录起止序列号
+                            startNo = dr["msr_startno"].ToString().Substring(prefix.Length - 1);
+                            endNo = dr["msr_endno"].ToString().Substring(prefix.Length - 1);
                         }
+                        startNo = dr["msr_startno"].ToString();
+                        endNo = dr["msr_endno"].ToString();
                         if (length != "" && length != null)
                         {
                             //赋值
@@ -518,7 +530,54 @@ namespace UAS_MES.Make
                 //}
             }
         }
-
+        /// <summary>
+        /// 检测转换后的序列号是否满足起止序列号范围
+        /// </summary>
+        /// <returns></returns>
+        private bool checkStartAndEnd()
+        {
+            if (system == "decimal")
+            {
+                //十进制
+                if (SNPre.Text.Trim() == "")
+                {
+                    if (int.Parse(code.Text) >= int.Parse(startNo) && int.Parse(code.Text) <= int.Parse(endNo))
+                    {
+                        //满足范围条件
+                        return true;
+                    }
+                }
+                else
+                {
+                    if (int.Parse(code.Text.Substring(SNPre.Text.Length - 1)) >= int.Parse(startNo) && int.Parse(code.Text.Substring(SNPre.Text.Length - 1)) <= int.Parse(endNo))
+                    {
+                        //满足
+                        return true;
+                    }
+                }
+            }
+            else
+            {
+                //十六进制
+                if (SNPre.Text.Trim() == "")
+                {
+                    if (int.Parse(code.Text) >= int.Parse(startNo, System.Globalization.NumberStyles.HexNumber) && int.Parse(code.Text) <= int.Parse(endNo, System.Globalization.NumberStyles.HexNumber))
+                    {
+                        //满足范围条件
+                        return true;
+                    }
+                }
+                else
+                {
+                    if (int.Parse(code.Text.Substring(SNPre.Text.Length - 1)) >= int.Parse(startNo, System.Globalization.NumberStyles.HexNumber) && int.Parse(code.Text.Substring(SNPre.Text.Length - 1)) <= int.Parse(endNo, System.Globalization.NumberStyles.HexNumber))
+                    {
+                        //满足
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
         private bool checkExist(string fields)
         {
             //不存在

+ 68 - 1
UAS-MES/FunctionCode/Make/Make_SeqTransform.cs

@@ -23,6 +23,12 @@ namespace UAS_MES.Make
 
         string errorMessage = "";
 
+        string startNo = "";//起始序列
+
+        string endNo = "";//终止序列
+
+        string system = "";//进制
+
         public Make_SeqTransform()
         {
             InitializeComponent();
@@ -150,6 +156,13 @@ namespace UAS_MES.Make
                         //bsncode不为空,说明输入的是转换后的序列号
                         else
                         {
+                            //判断输入的转换后序列号是否符合起始终止
+                            if (!checkStartAndEnd())
+                            {
+                                OperateResult.AppendText(">>序列号" + sncode.Text + "校验错误,不在工单防呆规则指定范围内!\n", Color.Red);
+                                sncode.Text = "";
+                                return;
+                            }
                             //判断用户是否锁定输入转换后序列号长度,
                             if (!checkLengthOrPre(afterTransSNLength_checkBox, afterTransSNLength, "长度"))
                                 return;
@@ -273,7 +286,7 @@ namespace UAS_MES.Make
             afterTransSNPre_checkBox.Enabled = true;
             afterTransSNLength_checkBox.Enabled = true;
             //查询表工单序列号防呆规则表
-            dt = (DataTable)dh.ExecuteSql("select msr_type, msr_prefix ,msr_length from makesnrule where msr_makecode='" + ma_code.Text + "'", "select");
+            dt = (DataTable)dh.ExecuteSql("select msr_startno,msr_endno,msr_system,msr_type, msr_prefix ,msr_length from makesnrule where msr_makecode='" + ma_code.Text + "'", "select");
             if (dt.Rows.Count > 0)
             {
                 foreach (DataRow dr in dt.Rows)
@@ -315,6 +328,8 @@ namespace UAS_MES.Make
                         //临时变量记录
                         string length = dr["msr_length"].ToString();
                         string prefix = dr["msr_prefix"].ToString();
+                        //记录进制
+                        system = dr["msr_system"].ToString();
                         //不为空
                         if (prefix != "" && prefix != null)
                         {
@@ -325,7 +340,12 @@ namespace UAS_MES.Make
                             //勾选
                             afterTransSNPre_checkBox.Checked = true;
                             afterTransSNPre_checkBox.Enabled = false;
+                            //记录起止序列号
+                            startNo = dr["msr_startno"].ToString().Substring(prefix.Length - 1);
+                            endNo = dr["msr_endno"].ToString().Substring(prefix.Length - 1);
                         }
+                        startNo = dr["msr_startno"].ToString();
+                        endNo = dr["msr_endno"].ToString();
                         if (length != "" && length != null)
                         {
                             //赋值
@@ -399,5 +419,52 @@ namespace UAS_MES.Make
             }
             return true;
         }
+        /// <summary>
+        /// 检测转换后的序列号是否满足起止序列号范围
+        /// </summary>
+        /// <returns></returns>
+        private bool checkStartAndEnd()
+        {
+            if (system == "decimal")
+            {
+                //十进制
+                if (afterTransSNPre.Text.Trim() == "")
+                {
+                    if (int.Parse(sncode.Text) >= int.Parse(startNo) && int.Parse(sncode.Text) <= int.Parse(endNo))
+                    {
+                        //满足范围条件
+                        return true;
+                    }
+                }
+                else
+                {
+                    if (int.Parse(sncode.Text.Substring(afterTransSNPre.Text.Length-1))>= int.Parse(startNo)&& int.Parse(sncode.Text.Substring(afterTransSNPre.Text.Length - 1)) <= int.Parse(endNo))
+                    {
+                        //满足
+                        return true;
+                    }
+                }
+            }
+            else {
+                //十六进制
+                if (afterTransSNPre.Text.Trim() == "")
+                {
+                    if (int.Parse(sncode.Text) >= int.Parse(startNo,System.Globalization.NumberStyles.HexNumber) && int.Parse(sncode.Text) <= int.Parse(endNo, System.Globalization.NumberStyles.HexNumber))
+                    {
+                        //满足范围条件
+                        return true;
+                    }
+                }
+                else
+                {
+                    if (int.Parse(sncode.Text.Substring(afterTransSNPre.Text.Length - 1)) >= int.Parse(startNo, System.Globalization.NumberStyles.HexNumber) && int.Parse(sncode.Text.Substring(afterTransSNPre.Text.Length - 1)) <= int.Parse(endNo, System.Globalization.NumberStyles.HexNumber))
+                    {
+                        //满足
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
     }
 }

+ 7 - 7
UAS-MES/Main.Designer.cs

@@ -73,11 +73,11 @@
             | System.Windows.Forms.AnchorStyles.Right)));
             this.MainTabControl.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.MainTabControl.ItemSize = new System.Drawing.Size(96, 25);
-            this.MainTabControl.Location = new System.Drawing.Point(156, 40);
+            this.MainTabControl.Location = new System.Drawing.Point(186, 40);
             this.MainTabControl.Margin = new System.Windows.Forms.Padding(4);
             this.MainTabControl.Name = "MainTabControl";
             this.MainTabControl.SelectedIndex = 0;
-            this.MainTabControl.Size = new System.Drawing.Size(1121, 700);
+            this.MainTabControl.Size = new System.Drawing.Size(1118, 700);
             this.MainTabControl.TabIndex = 7;
             this.MainTabControl.ControlRemoved += new System.Windows.Forms.ControlEventHandler(this.MainTabControl_ControlRemoved);
             // 
@@ -109,7 +109,7 @@
             this.BasicInf.Location = new System.Drawing.Point(0, 741);
             this.BasicInf.Margin = new System.Windows.Forms.Padding(4);
             this.BasicInf.Name = "BasicInf";
-            this.BasicInf.Size = new System.Drawing.Size(1277, 39);
+            this.BasicInf.Size = new System.Drawing.Size(1304, 39);
             this.BasicInf.TabIndex = 6;
             // 
             // inf_currentstep
@@ -224,7 +224,7 @@
             this.panel1.Location = new System.Drawing.Point(0, 40);
             this.panel1.Margin = new System.Windows.Forms.Padding(4);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(155, 702);
+            this.panel1.Size = new System.Drawing.Size(185, 702);
             this.panel1.TabIndex = 1;
             // 
             // Menu
@@ -233,7 +233,7 @@
             this.Menu.Location = new System.Drawing.Point(0, 0);
             this.Menu.Margin = new System.Windows.Forms.Padding(5);
             this.Menu.Name = "Menu";
-            this.Menu.Size = new System.Drawing.Size(153, 700);
+            this.Menu.Size = new System.Drawing.Size(183, 700);
             this.Menu.TabIndex = 3;
             // 
             // notifyIcon1
@@ -259,7 +259,7 @@
             this.headBar1.Location = new System.Drawing.Point(0, 0);
             this.headBar1.Margin = new System.Windows.Forms.Padding(5);
             this.headBar1.Name = "headBar1";
-            this.headBar1.Size = new System.Drawing.Size(1277, 40);
+            this.headBar1.Size = new System.Drawing.Size(1304, 40);
             this.headBar1.TabIndex = 0;
             this.headBar1.Title = null;
             // 
@@ -267,7 +267,7 @@
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1277, 780);
+            this.ClientSize = new System.Drawing.Size(1304, 780);
             this.Controls.Add(this.BasicInf);
             this.Controls.Add(this.MainTabControl);
             this.Controls.Add(this.pictureBox1);