Просмотр исходного кода

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

Hcsy 8 лет назад
Родитель
Сommit
1b59f2a5a3

+ 15 - 33
UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.cs

@@ -174,6 +174,12 @@ namespace UAS_MES.Make
                                 {
                                     return;
                                 }
+                                //判断转换后序列号的范围是否合法
+                                if (!checkStartAndEnd()) {
+                                    OperateResult.AppendText(">>序列号" + code.Text + "校验错误,不在工单防呆规则指定范围内!\n", Color.Red);
+                                    code.Text = "";
+                                    return;
+                                }
                                 //SN校验成功,合法,记录下SN
                                 SN = code.Text;
                                 code.Text = "";
@@ -494,12 +500,10 @@ 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();
+                        //记录起止序列号
+                        startNo = dr["msr_startno"].ToString().Substring(prefix.Length);
+                        endNo = dr["msr_endno"].ToString().Substring(prefix.Length);
                         if (length != "" && length != null)
                         {
                             //赋值
@@ -539,41 +543,19 @@ namespace UAS_MES.Make
             if (system == "decimal")
             {
                 //十进制
-                if (SNPre.Text.Trim() == "")
+                if (int.Parse(code.Text.Substring(SNPre.Text.Length)) >= int.Parse(startNo) && int.Parse(code.Text.Substring(SNPre.Text.Length)) <= int.Parse(endNo))
                 {
-                    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;
-                    }
+                    //满足
+                    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)) >= int.Parse(startNo, System.Globalization.NumberStyles.HexNumber) && int.Parse(code.Text.Substring(SNPre.Text.Length)) <= int.Parse(endNo, System.Globalization.NumberStyles.HexNumber))
                 {
-                    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 true;
                 }
             }
             return false;

+ 11 - 34
UAS-MES/FunctionCode/Make/Make_SeqTransform.cs

@@ -340,12 +340,10 @@ 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();
+                        //记录起止序列号
+                        startNo = dr["msr_startno"].ToString().Substring(afterTransSNPre.Text.Length);
+                        endNo = dr["msr_endno"].ToString().Substring(afterTransSNPre.Text.Length);
                         if (length != "" && length != null)
                         {
                             //赋值
@@ -428,40 +426,19 @@ namespace UAS_MES.Make
             if (system == "decimal")
             {
                 //十进制
-                if (afterTransSNPre.Text.Trim() == "")
+                if (int.Parse(sncode.Text.Substring(afterTransSNPre.Text.Length)) >= int.Parse(startNo) && int.Parse(sncode.Text.Substring(afterTransSNPre.Text.Length)) <= int.Parse(endNo))
                 {
-                    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;
-                    }
+                    //满足
+                    return true;
                 }
             }
-            else {
+            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)) >= int.Parse(startNo, System.Globalization.NumberStyles.HexNumber) && int.Parse(sncode.Text.Substring(afterTransSNPre.Text.Length)) <= int.Parse(endNo, System.Globalization.NumberStyles.HexNumber))
                 {
-                    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 true;
                 }
             }
             return false;

+ 6 - 9
UAS-MES/Login.cs

@@ -23,8 +23,6 @@ namespace UAS_MES
 
         Thread LoadMasterInf;
 
-
-
         public Login()
         {
             InitializeComponent();
@@ -48,8 +46,8 @@ namespace UAS_MES
             LoadMasterInf = new Thread(LoadMaster);
             LoadMasterInf.Start();
             //显示上次用户登录的用户名,将输入框定位到密码
-            UserName.Text = Properties.Settings.Default.LastLoginUser;
-            Source.Text = Properties.Settings.Default.LastLoginResource;
+            UserName.Text = BaseUtil.GetCacheData("LastLoginUser").ToString();
+            Source.Text = BaseUtil.GetCacheData("LastLoginResource").ToString();
             if (UserName.Text != "")
                 PassWord.Select();
             else
@@ -67,7 +65,7 @@ namespace UAS_MES
                 DB.DataSource = DbComboxData;
                 DB.DisplayMember = "ma_user";
                 DB.ValueMember = "ma_user";
-                DB.Text = Properties.Settings.Default.LastLoginSob;
+                DB.Text = BaseUtil.GetCacheData("LastLoginSob").ToString();
                 LoginButton.Enabled = true;
             }
             catch (Exception ex)
@@ -164,10 +162,9 @@ namespace UAS_MES
             UserInf = (DataTable)dh.ExecuteSql("select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') as systime from dual", "select");
             SystemInf.LoginTime = UserInf.Rows[0]["systime"].ToString();
             //记录在本地用户成功登录的用户名
-            Properties.Settings.Default.LastLoginUser = UserName.Text;
-            Properties.Settings.Default.LastLoginSob = DB.Text;
-            Properties.Settings.Default.LastLoginResource = Source.Text;
-            Properties.Settings.Default.Save();
+            BaseUtil.SetCacheData("LastLoginUser", UserName.Text);
+            BaseUtil.SetCacheData("LastLoginSob", DB.Text);
+            BaseUtil.SetCacheData("LastLoginResource", Source.Text);
         }
 
         private void ForGetPwd_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

+ 6 - 9
UAS-MES/PublicMethod/BaseUtil.cs

@@ -125,7 +125,7 @@ namespace UAS_MES.PublicMethod
                     string controlName = collection[i].Name;
                     string controlsTag = collection[i].Tag == null ? "" : collection[i].Tag.ToString();
                     //默认给TextBox和Label赋值
-                    if (collection[i] is TextBox || collection[i] is Label || collection[i] is SearchTextBox || collection[i] is MaCodeSearchTextBox||collection[i] is EnterTextBox ||collection[i] is TextBoxGeneratePaCode)
+                    if (collection[i] is TextBox || collection[i] is Label || collection[i] is SearchTextBox || collection[i] is MaCodeSearchTextBox || collection[i] is EnterTextBox || collection[i] is TextBoxGeneratePaCode)
                     {
                         for (int j = 0; j < dt.Columns.Count; j++)
                         {
@@ -986,7 +986,8 @@ namespace UAS_MES.PublicMethod
             fs.Close();
         }
 
-        public static Object GetCacheData(string ParamName) {
+        public static Object GetCacheData(string ParamName)
+        {
             Object o = null;
             //根据地址读取xml文件
             XmlDocument doc = new XmlDocument();
@@ -1002,7 +1003,7 @@ namespace UAS_MES.PublicMethod
             foreach (XmlNode node in nodeList)
             {
                 //找到了这个节点名字
-                if (node.Name==ParamName)
+                if (node.Name == ParamName)
                 {
                     //返回节点的内容
                     switch (((XmlElement)node).GetAttribute("Type"))
@@ -1019,23 +1020,19 @@ namespace UAS_MES.PublicMethod
                         default:
                             break;
                     }
-                    //o = ;
                     break;
                 }
             }
             //关闭reader
             reader.Close();
             if (o == null)
-            {
                 return "";
-            }
             else
-            {
                 return o;
-            }
         }
 
-        public static void SetCacheData(string ParamName,object Value) {
+        public static void SetCacheData(string ParamName, object Value)
+        {
             //根据地址读取xml文件
             XmlDocument doc = new XmlDocument();
             XmlReaderSettings settings = new XmlReaderSettings();