Browse Source

1维修信息智能录入
2装箱界面限制产品故障品完工装箱状态限制

caosy 5 years ago
parent
commit
0bc7b217b9

+ 6 - 6
UAS-MES/CustomControl/TextBoxWithIcon/BlurSearch.cs

@@ -131,12 +131,12 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
         {
             if (TableName1 != null && EnterTextBox.Focused)
             {
-                string con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=10 ";
+                string con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=12 ";
                 if (condition != "" && condition != null)
                 {
-                    con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=10 and " + condition;
+                    con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=12 and " + condition;
                 }
-                dt = dh.getFieldsDatasByCondition(TableName1, new string[] { Field1, valueField, "rownum" }, con.ToUpper());
+                dt = dh.getFieldsDatasByCondition(TableName1, new string[] { Field1, valueField, "rownum" }, con);
                 if (dt.Rows.Count > 0)
                 {
                     ListBox.Items.Clear();
@@ -209,12 +209,12 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
 
         private void EnterTextBox_Enter(object sender, EventArgs e)
         {
-            string con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=10 ";
+            string con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=12 ";
             if (condition != "" && condition != null)
             {
-                con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=10 and " + condition;
+                con = Field1 + " like '%" + EnterTextBox.Text + "%' and rownum<=12 and " + condition;
             }
-            dt = dh.getFieldsDatasByCondition(TableName1, new string[] { Field1, valueField, "rownum" }, con.ToUpper());
+            dt = dh.getFieldsDatasByCondition(TableName1, new string[] { Field1, valueField, "rownum" }, con);
             if (dt.Rows.Count > 0)
             {
                 ListBox.Items.Clear();

+ 7 - 1
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -193,7 +193,7 @@ namespace UAS_MES.Make
             {
                 if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
-                    dt = (DataTable)dh.ExecuteSql("select ms_status,ms_id,ms_makecode,ms_nextstepcode,ms_craftcode,ms_prodcode from makeserial where ms_sncode ='" + sn_code.Text + "' order by ms_id desc", "select");
+                    dt = (DataTable)dh.ExecuteSql("select ms_status,ms_id,ms_makecode,ms_nextstepcode,ms_craftcode,ms_prodcode,nvl(ms_checkpack,0) ms_checkpack from makeserial where ms_sncode ='" + sn_code.Text + "' order by ms_id desc", "select");
                     if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage) || (dt.Rows.Count > 0 && dt.Rows[0]["ms_status"].ToString() == "2"))
                     {
                         if (oMsID == "" || oMsID == "null" || oMsID == "0")
@@ -214,6 +214,11 @@ namespace UAS_MES.Make
                                 return;
                             }
                         }
+                        if (dt.Rows[0]["ms_checkpack"].ToString() != "0")
+                        {
+                            OperateResult.AppendText(sn_code.Text+ "处于故障品完工装箱限制状态,不允许采集装箱\n", Color.Red);
+                            return;
+                        }
                         string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
                         if (nextstepcode != "" && nextstepcode != User.CurrentStepCode)
                         {
@@ -224,6 +229,7 @@ namespace UAS_MES.Make
                             }
                             return;
                         }
+                        
                         PR_CHECKCARTONW = dh.getFieldDataByCondition("craftdetail left join craft on cr_id=cd_crid left join makeserial on ms_craftcode =cr_code and cr_prodcode = ms_prodcode", "nvl(cd_ifweigh,'0') cd_ifweigh", "ms_sncode='" + sn_code.Text + "' and ms_makecode='" + oMakeCode + "' and cd_stepcode = '" + User.CurrentStepCode + "'").ToString();
                         //获取序列号信息
                         sql.Clear();

+ 6 - 1
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -264,7 +264,7 @@ namespace UAS_MES.Make
             {
                 if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
-                    dt = (DataTable)dh.ExecuteSql("select ms_status,ms_id,ms_makecode,ms_craftcode,ms_prodcode from makeserial where ms_sncode ='" + sn_code.Text + "'  order by ms_id desc", "select");
+                    dt = (DataTable)dh.ExecuteSql("select ms_status,ms_id,ms_makecode,ms_craftcode,ms_prodcode,nvl(ms_checkpack,0) ms_checkpack from makeserial where ms_sncode ='" + sn_code.Text + "'  order by ms_id desc", "select");
                     if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sn_code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage) || (dt.Rows.Count > 0 && dt.Rows[0]["ms_status"].ToString() == "2"))
                     {
                         if (oMsID == "" || oMsID == "null" || oMsID == "0")
@@ -284,6 +284,11 @@ namespace UAS_MES.Make
                                 return;
                             }
                         }
+                        if (dt.Rows[0]["ms_checkpack"].ToString() != "0")
+                        {
+                            OperateResult.AppendText(sn_code.Text + "处于故障品完工装箱限制状态,不允许采集装箱\n", Color.Red);
+                            return;
+                        }
                         string nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsID + "'").ToString();
                         if (nextstepcode != "" && nextstepcode != User.CurrentStepCode)
                         {

+ 17 - 7
UAS-MES/FunctionCode/Make/Make_Repair.cs

@@ -80,21 +80,24 @@ namespace UAS_MES.Make
             bd_soncode.DbChange += Prodcode_DbChange;
 
             //nrg_name.BringToFront();
-            nrg_name.TableName = "QUA_NGREASONGROUP";
+            nrg_name.TableName = "QUA_NGREASONGROUP left join DATAINPUTRECORD ON NRG_NAME = DIR_COMMENT AND DIR_GROUP = '不良原因组' and DIR_SOURCECODE = '" + User.UserSourceCode+"'";
             nrg_name.Field = "nrg_name";
             nrg_name.ValueField = "nrg_code";
+            nrg_name.Condition = " 1=1 ORDER BY NVL(DIR_NUMBER,0) DESC,ROWNUM asc";
 
-            nr_name.TableName = "QUA_NGREASONGROUPDET left join QUA_NGREASONGROUP on nrgd_nrgid=nrg_id left join QUA_NGReason on nrgd_nrcode=nr_code ";
+            nr_name.TableName = "QUA_NGREASONGROUPDET left join QUA_NGREASONGROUP on nrgd_nrgid=nrg_id left join QUA_NGReason on nrgd_nrcode=nr_code left join DATAINPUTRECORD ON nr_name = DIR_COMMENT AND DIR_GROUP = '不良原因' and  DIR_SOURCECODE = '" + User.UserSourceCode + "' ";
             nr_name.Field = "nr_name";
             nr_name.ValueField = "nr_code";
 
-            mbr_dutyname.TableName = "ngduty";
+            mbr_dutyname.TableName = "ngduty left join DATAINPUTRECORD ON nd_name = DIR_COMMENT  AND DIR_GROUP = '责任别' and DIR_SOURCECODE = '" + User.UserSourceCode + "'";
             mbr_dutyname.Field = "nd_name";
             mbr_dutyname.ValueField = "nd_code";
+            mbr_dutyname.Condition = " 1=1 ORDER BY NVL(DIR_NUMBER,0) DESC,ROWNUM asc";
 
-            so_name.TableName = "solution";
+            so_name.TableName = "solution left join DATAINPUTRECORD ON so_name = DIR_COMMENT AND DIR_GROUP = '解决方案' and DIR_SOURCECODE = '" + User.UserSourceCode + "'";
             so_name.Field = "so_name";
             so_name.ValueField = "so_code";
+            so_name.Condition = " 1=1 ORDER BY NVL(DIR_NUMBER,0) DESC,ROWNUM asc";
 
             asc.controllInitializeSize(this);
             mbc_component.SendToBack();
@@ -565,9 +568,9 @@ namespace UAS_MES.Make
                         else
                             SQLS.Add("update makeserial set ms_checkno='',ms_paststep = ms_paststep || case when instr(','||ms_paststep||',','" + User.CurrentStepCode + "')=0 then ','||'" + User.CurrentStepCode + "' end , ms_nextstepcode ='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_reworkstatus=1 where ms_id='" + msid + "'");
                     }
-                    SQLS.Add("update makebad set mb_status=-1 where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ms_makecode.Text + "'");
+                    SQLS.Add("update makebad set mb_status=-1,ms_checkpack = -1 where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ms_makecode.Text + "'");
                     //取消最近拆解部件
-                    SQLS.Add("update craftmaterial set cm_lastdeco=0 where cm_sncode='" + ms_sncode.Text + "' and cm_makecode='" + ms_makecode.Text + "' and nvl(cm_lastdeco,0)<>0");
+                    SQLS.Add("update craftmaterial set cm_lastdeco=0 where cm_sncode='" + ms_sncode.Text + "' and cm_makecode='" + ms_makecode.Text + "' and nvl(cm_lastdeco,0)<>0");           
                     dh.ExecuteSQLTran(SQLS.ToArray());
                     LogicHandler.InsertMakeProcess(ms_sncode.Text, ms_makecode.Text, User.UserSourceCode, "回流工序", "完成维修回流", User.UserCode);
                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, macode, User.UserLineCode, User.UserSourceCode, "回流工序", "完成维修回流", ms_sncode.Text, ms_checkno.Text);
@@ -703,6 +706,13 @@ namespace UAS_MES.Make
                 OperatResult.AppendText(">>解决方案不存在\n", Color.Red);
                 return;
             }
+            //保存选择记录至后台,根据岗位资源代码记录
+            List<string> SQLS = new List<string>();
+            SQLS.Add("merge into DATAINPUTRECORD using (select NRG_NAME  from QUA_NGREASONGROUP where NRG_NAME = '" + nrg_name.Text + "') ON (NRG_NAME = DIR_COMMENT AND DIR_GROUP = '不良原因组' and DIR_SOURCECODE = '" + User.UserSourceCode + "') when matched then update set DIR_NUMBER = DIR_NUMBER +1 when not matched then insert (DIR_COMMENT,DIR_NUMBER,DIR_SOURCECODE,DIR_GROUP) VALUES (NRG_NAME,1,'" + User.UserSourceCode + "','不良原因组')");
+            SQLS.Add("merge into DATAINPUTRECORD using (select nr_name  from QUA_NGReason left join QUA_NGREASONGROUPDET on nrgd_nrcode=nr_code left join QUA_NGREASONGROUP on nrgd_nrgid=nrg_id where nr_name = '" + nr_name.Text + "' and NRG_NAME = '" + nrg_name.Text + "') ON (nr_name = DIR_COMMENT AND DIR_GROUP = '不良原因' and DIR_SOURCECODE = '" + User.UserSourceCode + "') when matched then update set DIR_NUMBER = DIR_NUMBER +1 when not matched then insert (DIR_COMMENT,DIR_NUMBER,DIR_SOURCECODE,DIR_GROUP) VALUES (nr_name,1,'" + User.UserSourceCode + "','不良原因')");
+            SQLS.Add("merge into DATAINPUTRECORD using (select nd_name  from ngduty where nd_name = '" + mbr_dutyname.Text + "') ON (nd_name = DIR_COMMENT AND DIR_GROUP = '责任别' and DIR_SOURCECODE = '" + User.UserSourceCode + "') when matched then update set DIR_NUMBER = DIR_NUMBER +1 when not matched then insert (DIR_COMMENT,DIR_NUMBER,DIR_SOURCECODE,DIR_GROUP) VALUES (nd_name,1,'" + User.UserSourceCode + "','责任别')");
+            SQLS.Add("merge into DATAINPUTRECORD using (select so_name  from solution where so_name = '" + so_name.Text + "') ON (so_name = DIR_COMMENT AND DIR_GROUP = '解决方案' and DIR_SOURCECODE = '" + User.UserSourceCode + "') when matched then update set DIR_NUMBER = DIR_NUMBER +1 when not matched then insert (DIR_COMMENT,DIR_NUMBER,DIR_SOURCECODE,DIR_GROUP) VALUES (so_name,1,'" + User.UserSourceCode + "','解决方案')");
+            dh.ExecuteSQLTran(SQLS.ToArray());
             //保存不良原因
             sql.Clear();
             sql.Append("insert into makebadreason (mbr_mbid,mbr_id,mbr_brcode,mbr_solutioncode,");
@@ -915,7 +925,7 @@ namespace UAS_MES.Make
         {
             if (nrg_code.Text == "" || (nrg_code.Text != "" && nrg_code.Text != nrg_name.Value))
                 nrg_code.Text = nrg_name.Value;
-            nr_name.Condition = "nrg_code in('" + (nrg_code.Text == "" ? "''" : nrg_code.Text) + "')";
+            nr_name.Condition = "nrg_code in('" + (nrg_code.Text == "" ? "''" : nrg_code.Text) + "') ORDER BY NVL(DIR_NUMBER,0) DESC,ROWNUM asc";
         }
 
         private void mbr_dutyname_UserControlTextChanged(object sender, EventArgs e)

+ 55 - 28
UAS-MES/PublicMethod/Encryption.cs

@@ -4,50 +4,77 @@ using System.IO;
 using System.Linq;
 using System.Security.Cryptography;
 using System.Text;
+using System.Web;
 
 namespace UAS_MES.PublicMethod
 {
     class Encryption
     {
 
-        private static string encryptKey = "DBDB";
+        private static string encryptKey = "MUPSWORD";
 
-        public static string EncryptStr(string str)
+        public static string EncryptStr(string pToEncrypt)
         {
-            DESCryptoServiceProvider descsp = new DESCryptoServiceProvider();   //实例化加/解密类对象   
-
-            byte[] key = Encoding.Unicode.GetBytes(encryptKey); //定义字节数组,用来存储密钥    
-
-            byte[] data = Encoding.Unicode.GetBytes(str);//定义字节数组,用来存储要加密的字符串  
-
-            MemoryStream MStream = new MemoryStream(); //实例化内存流对象      
-
-            //使用内存流实例化加密流对象   
-            CryptoStream CStream = new CryptoStream(MStream, descsp.CreateEncryptor(key, key), CryptoStreamMode.Write);
-
-            CStream.Write(data, 0, data.Length);  //向加密流中写入数据      
-
-            CStream.FlushFinalBlock();              //释放加密流      
-            return Convert.ToBase64String(MStream.ToArray());//返回加密后的字符串  
+            using (DESCryptoServiceProvider des = new DESCryptoServiceProvider())
+            {
+
+                byte[] inputByteArray = Encoding.UTF8.GetBytes(pToEncrypt);
+                des.Key = ASCIIEncoding.ASCII.GetBytes(encryptKey);
+                des.IV = ASCIIEncoding.ASCII.GetBytes(encryptKey);
+                System.IO.MemoryStream ms = new System.IO.MemoryStream();
+                using (CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write))
+                {
+                    cs.Write(inputByteArray, 0, inputByteArray.Length);
+                    cs.FlushFinalBlock();
+                    cs.Close();
+                }
+                string str = Convert.ToBase64String(ms.ToArray());
+                ms.Close();
+                return str;
+            }
         }
 
-        public static string DecryptStr(string str)
+        public static string GETMD5(string password)
         {
-            DESCryptoServiceProvider descsp = new DESCryptoServiceProvider();   //实例化加/解密类对象    
-
-            byte[] key = Encoding.Unicode.GetBytes(encryptKey); //定义字节数组,用来存储密钥    
+            //初始化MD5对象
+            MD5 md5 = MD5.Create();
 
-            byte[] data = Convert.FromBase64String(str);//定义字节数组,用来存储要解密的字符串  
+            //将源字符串转化为byte数组
+            Byte[] soucebyte = Encoding.Default.GetBytes(password);
 
-            MemoryStream MStream = new MemoryStream(); //实例化内存流对象      
+            //soucebyte转化为mf5的byte数组
+            Byte[] md5bytes = md5.ComputeHash(soucebyte);
 
-            //使用内存流实例化解密流对象       
-            CryptoStream CStream = new CryptoStream(MStream, descsp.CreateDecryptor(key, key), CryptoStreamMode.Write);
-            CStream.Write(data, 0, data.Length);      //向解密流中写入数据     
+            //将md5的byte数组再转化为MD5数组
+            StringBuilder sb = new StringBuilder();
+            foreach (Byte b in md5bytes)
+            {
+                //x表示16进制,2表示2位
+                sb.Append(b.ToString("x2"));
 
-            CStream.FlushFinalBlock();               //释放解密流      
+            }
+            return sb.ToString();
+        }
 
-            return Encoding.Unicode.GetString(MStream.ToArray());       //返回解密后的字符串  
+        public static string DecryptStr(string pToDecrypt)
+        {
+            byte[] inputByteArray = Convert.FromBase64String(pToDecrypt);
+            using (DESCryptoServiceProvider des = new DESCryptoServiceProvider())
+            {
+
+                des.Key = ASCIIEncoding.ASCII.GetBytes(encryptKey);
+                des.IV = ASCIIEncoding.ASCII.GetBytes(encryptKey);
+                System.IO.MemoryStream ms = new System.IO.MemoryStream();
+                using (CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write))
+                {
+                    cs.Write(inputByteArray, 0, inputByteArray.Length);
+                    cs.FlushFinalBlock();
+                    cs.Close();
+                }
+                string str = Encoding.UTF8.GetString(ms.ToArray());
+                ms.Close();
+                return str;
+            }
         }
     }
 }