Browse Source

序列号生成修改

callm 2 years ago
parent
commit
c8fd497932

+ 6 - 1
UAS_MES_ODLF/FunctionCode/Packing/Packing_PackageCollection1.cs

@@ -207,12 +207,17 @@ namespace UAS_MES_NEW.Packing
             //当用户输入回车键的时候
             if (e.KeyCode == Keys.Enter)
             {
+                dt = (DataTable)dh.ExecuteSql("select mil_imei1 from Makeimeilist where mil_psn='"+sn_code.Text+ "' and mil_makecode='T1030B-1025' order by mil_id desc", "select");
+                if (dt.Rows.Count > 0)
+                {
+                    sn_code.Text = dt.Rows[0]["mil_imei1"].ToString();
+                }
                 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");
                     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")
+                        if (oMsID == "" || oMsID == "null" || oMsID == "0") 
                         {
                             oMsID = dt.Rows[0]["ms_id"].ToString();
                             oMsStatus = dt.Rows[0]["ms_status"].ToString();

+ 21 - 86
UAS_MES_ODLF/FunctionCode/Query/Query_SN.Designer.cs

@@ -31,14 +31,12 @@
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Query_SN));
             this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
             this.label1 = new System.Windows.Forms.Label();
-            this.label2 = new System.Windows.Forms.Label();
             this.label5 = new System.Windows.Forms.Label();
             this.label3 = new System.Windows.Forms.Label();
             this.label4 = new System.Windows.Forms.Label();
             this.date = new System.Windows.Forms.DateTimePicker();
             this.label6 = new System.Windows.Forms.Label();
             this.label7 = new System.Windows.Forms.Label();
-            this.label8 = new System.Windows.Forms.Label();
             this.label9 = new System.Windows.Forms.Label();
             this.label10 = new System.Windows.Forms.Label();
             this.label11 = new System.Windows.Forms.Label();
@@ -46,12 +44,10 @@
             this.Printer = new UAS_MES_NEW.CustomControl.ComBoxWithFocus.PrinterCombox();
             this.Print = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.ma_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.BeginMac = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.num = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.status = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.seriallength = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.pr_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.color = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.factory = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.Export = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             ((System.ComponentModel.ISupportInitialize)(this.currentSerial)).BeginInit();
@@ -61,40 +57,29 @@
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(106, 313);
+            this.label1.Location = new System.Drawing.Point(106, 326);
             this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(146, 41);
+            this.label1.Size = new System.Drawing.Size(82, 41);
             this.label1.TabIndex = 1;
-            this.label1.Text = "工厂代码";
-            // 
-            // label2
-            // 
-            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(106, 181);
-            this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(146, 41);
-            this.label2.TabIndex = 2;
-            this.label2.Text = "颜色代码";
+            this.label1.Text = "线别";
             // 
             // label5
             // 
             this.label5.AutoSize = true;
             this.label5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label5.Location = new System.Drawing.Point(106, 112);
+            this.label5.Location = new System.Drawing.Point(106, 189);
             this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label5.Name = "label5";
-            this.label5.Size = new System.Drawing.Size(146, 41);
+            this.label5.Size = new System.Drawing.Size(82, 41);
             this.label5.TabIndex = 11;
-            this.label5.Text = "产品代码";
+            this.label5.Text = "机型";
             // 
             // label3
             // 
             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(106, 456);
+            this.label3.Location = new System.Drawing.Point(106, 469);
             this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(146, 41);
@@ -105,7 +90,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(106, 383);
+            this.label4.Location = new System.Drawing.Point(106, 396);
             this.label4.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(146, 41);
@@ -114,7 +99,7 @@
             // 
             // date
             // 
-            this.date.Location = new System.Drawing.Point(305, 249);
+            this.date.Location = new System.Drawing.Point(305, 262);
             this.date.Name = "date";
             this.date.Size = new System.Drawing.Size(388, 35);
             this.date.TabIndex = 17;
@@ -124,7 +109,7 @@
             // 
             this.label6.AutoSize = true;
             this.label6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label6.Location = new System.Drawing.Point(106, 247);
+            this.label6.Location = new System.Drawing.Point(106, 260);
             this.label6.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(82, 41);
@@ -135,29 +120,18 @@
             // 
             this.label7.AutoSize = true;
             this.label7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label7.Location = new System.Drawing.Point(106, 526);
+            this.label7.Location = new System.Drawing.Point(106, 539);
             this.label7.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label7.Name = "label7";
             this.label7.Size = new System.Drawing.Size(126, 41);
             this.label7.TabIndex = 19;
             this.label7.Text = "SN数量";
             // 
-            // label8
-            // 
-            this.label8.AutoSize = true;
-            this.label8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label8.Location = new System.Drawing.Point(106, 599);
-            this.label8.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.label8.Name = "label8";
-            this.label8.Size = new System.Drawing.Size(157, 41);
-            this.label8.TabIndex = 21;
-            this.label8.Text = "起始MAC";
-            // 
             // label9
             // 
             this.label9.AutoSize = true;
             this.label9.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label9.Location = new System.Drawing.Point(106, 44);
+            this.label9.Location = new System.Drawing.Point(106, 121);
             this.label9.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label9.Name = "label9";
             this.label9.Size = new System.Drawing.Size(114, 41);
@@ -168,7 +142,7 @@
             // 
             this.label10.AutoSize = true;
             this.label10.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label10.Location = new System.Drawing.Point(106, 669);
+            this.label10.Location = new System.Drawing.Point(106, 619);
             this.label10.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(146, 41);
@@ -188,7 +162,7 @@
             // 
             // currentSerial
             // 
-            this.currentSerial.Location = new System.Drawing.Point(305, 675);
+            this.currentSerial.Location = new System.Drawing.Point(305, 625);
             this.currentSerial.Name = "currentSerial";
             this.currentSerial.Size = new System.Drawing.Size(388, 35);
             this.currentSerial.TabIndex = 30;
@@ -225,7 +199,7 @@
             this.ma_code.AllPower = null;
             this.ma_code.BackColor = System.Drawing.Color.White;
             this.ma_code.ID = null;
-            this.ma_code.Location = new System.Drawing.Point(305, 47);
+            this.ma_code.Location = new System.Drawing.Point(305, 124);
             this.ma_code.Margin = new System.Windows.Forms.Padding(6);
             this.ma_code.Name = "ma_code";
             this.ma_code.Power = null;
@@ -235,27 +209,12 @@
             this.ma_code.Str2 = null;
             this.ma_code.TabIndex = 24;
             // 
-            // BeginMac
-            // 
-            this.BeginMac.AllPower = null;
-            this.BeginMac.BackColor = System.Drawing.Color.White;
-            this.BeginMac.ID = null;
-            this.BeginMac.Location = new System.Drawing.Point(305, 601);
-            this.BeginMac.Margin = new System.Windows.Forms.Padding(6);
-            this.BeginMac.Name = "BeginMac";
-            this.BeginMac.Power = null;
-            this.BeginMac.Size = new System.Drawing.Size(388, 35);
-            this.BeginMac.Str = null;
-            this.BeginMac.Str1 = null;
-            this.BeginMac.Str2 = null;
-            this.BeginMac.TabIndex = 22;
-            // 
             // num
             // 
             this.num.AllPower = null;
             this.num.BackColor = System.Drawing.Color.White;
             this.num.ID = null;
-            this.num.Location = new System.Drawing.Point(305, 527);
+            this.num.Location = new System.Drawing.Point(305, 540);
             this.num.Margin = new System.Windows.Forms.Padding(6);
             this.num.Name = "num";
             this.num.Power = null;
@@ -270,7 +229,7 @@
             this.status.AllPower = null;
             this.status.BackColor = System.Drawing.Color.White;
             this.status.ID = null;
-            this.status.Location = new System.Drawing.Point(305, 386);
+            this.status.Location = new System.Drawing.Point(305, 399);
             this.status.Margin = new System.Windows.Forms.Padding(6);
             this.status.Name = "status";
             this.status.Power = null;
@@ -285,7 +244,7 @@
             this.seriallength.AllPower = null;
             this.seriallength.BackColor = System.Drawing.Color.White;
             this.seriallength.ID = null;
-            this.seriallength.Location = new System.Drawing.Point(305, 457);
+            this.seriallength.Location = new System.Drawing.Point(305, 470);
             this.seriallength.Margin = new System.Windows.Forms.Padding(6);
             this.seriallength.Name = "seriallength";
             this.seriallength.Power = null;
@@ -294,14 +253,14 @@
             this.seriallength.Str1 = null;
             this.seriallength.Str2 = null;
             this.seriallength.TabIndex = 14;
-            this.seriallength.Text = "7";
+            this.seriallength.Text = "5";
             // 
             // pr_code
             // 
             this.pr_code.AllPower = null;
             this.pr_code.BackColor = System.Drawing.Color.White;
             this.pr_code.ID = null;
-            this.pr_code.Location = new System.Drawing.Point(305, 118);
+            this.pr_code.Location = new System.Drawing.Point(305, 195);
             this.pr_code.Margin = new System.Windows.Forms.Padding(6);
             this.pr_code.Name = "pr_code";
             this.pr_code.Power = null;
@@ -312,28 +271,12 @@
             this.pr_code.TabIndex = 12;
             this.pr_code.Text = "95023";
             // 
-            // color
-            // 
-            this.color.AllPower = null;
-            this.color.BackColor = System.Drawing.Color.White;
-            this.color.ID = null;
-            this.color.Location = new System.Drawing.Point(305, 186);
-            this.color.Margin = new System.Windows.Forms.Padding(6);
-            this.color.Name = "color";
-            this.color.Power = null;
-            this.color.Size = new System.Drawing.Size(388, 35);
-            this.color.Str = null;
-            this.color.Str1 = null;
-            this.color.Str2 = null;
-            this.color.TabIndex = 6;
-            this.color.Text = "5";
-            // 
             // factory
             // 
             this.factory.AllPower = null;
             this.factory.BackColor = System.Drawing.Color.White;
             this.factory.ID = null;
-            this.factory.Location = new System.Drawing.Point(305, 315);
+            this.factory.Location = new System.Drawing.Point(305, 328);
             this.factory.Margin = new System.Windows.Forms.Padding(6);
             this.factory.Name = "factory";
             this.factory.Power = null;
@@ -375,8 +318,6 @@
             this.Controls.Add(this.label10);
             this.Controls.Add(this.ma_code);
             this.Controls.Add(this.label9);
-            this.Controls.Add(this.BeginMac);
-            this.Controls.Add(this.label8);
             this.Controls.Add(this.num);
             this.Controls.Add(this.label7);
             this.Controls.Add(this.label6);
@@ -387,9 +328,7 @@
             this.Controls.Add(this.label3);
             this.Controls.Add(this.pr_code);
             this.Controls.Add(this.label5);
-            this.Controls.Add(this.color);
             this.Controls.Add(this.factory);
-            this.Controls.Add(this.label2);
             this.Controls.Add(this.label1);
             this.Controls.Add(this.Export);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
@@ -409,9 +348,7 @@
         private CustomControl.ButtonUtil.NormalButton Export;
         private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
         private System.Windows.Forms.Label label1;
-        private System.Windows.Forms.Label label2;
         private CustomControl.TextBoxWithIcon.EnterTextBox factory;
-        private CustomControl.TextBoxWithIcon.EnterTextBox color;
         private CustomControl.TextBoxWithIcon.EnterTextBox pr_code;
         private System.Windows.Forms.Label label5;
         private CustomControl.TextBoxWithIcon.EnterTextBox seriallength;
@@ -422,8 +359,6 @@
         private System.Windows.Forms.Label label6;
         private CustomControl.TextBoxWithIcon.EnterTextBox num;
         private System.Windows.Forms.Label label7;
-        private CustomControl.TextBoxWithIcon.EnterTextBox BeginMac;
-        private System.Windows.Forms.Label label8;
         private CustomControl.TextBoxWithIcon.EnterTextBox ma_code;
         private System.Windows.Forms.Label label9;
         private System.Windows.Forms.Label label10;

+ 4 - 21
UAS_MES_ODLF/FunctionCode/Query/Query_SN.cs

@@ -54,27 +54,19 @@ namespace UAS_MES_NEW.Query
                 dt.Columns.Add("拓展栏位2");
                 dt.Columns.Add("拓展栏位3");
                 dt.Columns.Add("备注");
-                string prefix = BeginMac.Text.Substring(0, 8);
-                string suffix = BeginMac.Text.Substring(8, 4);
-                int Number = Int32.Parse(suffix, System.Globalization.NumberStyles.HexNumber);
                 for (decimal i = currentSerial.Value; i < currentSerial.Value + int.Parse(num.Text); i++)
                 {
                     DataRow dr = dt.NewRow();
 
                     dr["工单号"] = ma_code.Text;
-                    dr["MAC"] = prefix + Number.ToString("X");
-                    Number = Number + 1;
-                    dr["BT"] = prefix + Number.ToString("X");
-                    Number = Number + 1;
 
                     string serial = pr_code.Text
-                        + color.Text
                         + GetDate(date.Value.ToString("yyyy"), date.Value.ToString("MM"), date.Value.ToString("dd"))
                         + factory.Text
                         + status.Text
                         + lpad(int.Parse(seriallength.Text), (i + 1).ToString());
-                    string encode = MD5Encoding(serial + ")G$d");
-                    dr["序列号"] = serial + encode.Substring(encode.Length - 2);
+                    //string encode = MD5Encoding(serial + ")G$d");
+                    dr["序列号"] = serial;
                     dt.Rows.Add(dr);
                 }
                 eh.ExportExcel(dt, FolderPath);
@@ -335,33 +327,24 @@ namespace UAS_MES_NEW.Query
             dt.Columns.Add("拓展栏位2");
             dt.Columns.Add("拓展栏位3");
             dt.Columns.Add("备注");
-            string prefix = BeginMac.Text.Substring(0, 8);
-            string suffix = BeginMac.Text.Substring(8, 4);
-            int Number = Int32.Parse(suffix, System.Globalization.NumberStyles.HexNumber);
             for (decimal i = currentSerial.Value; i < currentSerial.Value + int.Parse(num.Text); i++)
             {
                 DataRow dr = dt.NewRow();
 
                 dr["工单号"] = ma_code.Text;
-                dr["MAC"] = prefix + Number.ToString("X");
-                Number = Number + 1;
-                dr["BT"] = prefix + Number.ToString("X");
-                Number = Number + 1;
 
                 string serial = pr_code.Text
-                    + color.Text
                     + GetDate(date.Value.ToString("yyyy"), date.Value.ToString("MM"), date.Value.ToString("dd"))
                     + factory.Text
                     + status.Text
                     + lpad(int.Parse(seriallength.Text), (i + 1).ToString());
-                string encode = MD5Encoding(serial + ")G$d");
-                dr["序列号"] = serial + encode.Substring(encode.Length - 2);
+                dr["序列号"] = serial;
                 dt.Rows.Add(dr);
                 for (int j = 0; j < doc.Variables.FormVariables.Count; j++)
                 {
                     if (doc.Variables.FormVariables.Item(j + 1).Name.ToUpper() == "SN")
                     {
-                        doc.Variables.FormVariables.Item(j + 1).Value = (serial + encode.Substring(encode.Length - 2));
+                        doc.Variables.FormVariables.Item(j + 1).Value = (serial);
                     }
                 }
                 doc.Printer.SwitchTo(Printer.Text);

+ 7 - 7
UAS_MES_ODLF/FunctionCode/Query/Query_SpecialReport_SN.cs

@@ -15,8 +15,6 @@ namespace UAS_MES_NEW.Query
     public partial class Query_SpecialReport_SN : Form
     {
 
-        DataHelper dh = SystemInf.dh;
-
         public Query_SpecialReport_SN()
         {
             InitializeComponent();
@@ -82,7 +80,8 @@ namespace UAS_MES_NEW.Query
                 string prefix = BeginMac.Text.Substring(0, 6);
                 string suffix = BeginMac.Text.Substring(6, 6);
                 string imei1prefix = BeginIMEI1.Text.Substring(0, 10);
-                string imei1suffix = BeginIMEI1.Text.Substring(10, BeginIMEI1.Text.Length-10);
+                string imei1suffix = BeginIMEI1.Text.Substring(10, BeginIMEI1.Text.Length - 10);
+
                 string imei2prefix = BeginIMEI2.Text.Substring(0, 10);
                 string imei2suffix = BeginIMEI2.Text.Substring(10, BeginIMEI2.Text.Length - 10);
                 int num = Int32.Parse(suffix, System.Globalization.NumberStyles.HexNumber);
@@ -95,7 +94,7 @@ namespace UAS_MES_NEW.Query
                     DataRow dr = dt.NewRow();
                     dr["工单号"] = ma_code.Text;
                     dr["SN"] = SNPrefix.Text + lpad(int.Parse(RMLength.Text), num3.ToString(""));
-                    if (dr["SN"].ToString().Length <=0)
+                    if (dr["SN"].ToString().Length <= 0)
                     {
                         MessageBox.Show("生成SN地址错误");
                         return;
@@ -112,13 +111,14 @@ namespace UAS_MES_NEW.Query
                         MessageBox.Show("生成BT地址错误");
                         return;
                     }
-                    dr["IMEI1"] = imei1prefix + num1.ToString("");
+                    Console.WriteLine(imei1prefix+"  " + lpad(BeginIMEI1.Text.Length - 10, num1.ToString("")));
+                    dr["IMEI1"] = imei1prefix + lpad(BeginIMEI1.Text.Length - 10, num1.ToString(""));
                     if (dr["IMEI1"].ToString().Length < 15)
                     {
                         MessageBox.Show("生成IMEI1地址错误");
                         return;
                     }
-                    dr["IMEI2"] = imei2prefix + num1.ToString("");
+                    dr["IMEI2"] = imei2prefix + lpad(BeginIMEI2.Text.Length - 10, num2.ToString(""));
                     if (dr["IMEI2"].ToString().Length < 15)
                     {
                         MessageBox.Show("生成IMEI2地址错误");
@@ -127,7 +127,7 @@ namespace UAS_MES_NEW.Query
                     num = num + 1;
                     num0 = num0 + 1;
                     num1 = num1 + 1;
-                    num2= num2 + 1;
+                    num2 = num2 + 1;
                     num3 = num3 + 1;
                     dt.Rows.Add(dr);
                 }