Browse Source

有效日期提醒设置

章政 6 năm trước cách đây
mục cha
commit
630a66e3fd

+ 32 - 2
UAS-出货标签管理(吉利通)/CustomerRule.Designer.cs

@@ -33,7 +33,7 @@
             this.cu_print_midprod = new System.Windows.Forms.CheckBox();
             this.cu_print_midspec = new System.Windows.Forms.CheckBox();
             this.cu_print_midpo = new System.Windows.Forms.CheckBox();
-            this.cu_print_regexpression = new UAS_LabelMachine.CustomControl.RichText.RichTextAutoBottom();
+            this.cu_print_regexpression = new System.Windows.Forms.RichTextBox();
             this.CustomerTreeView = new System.Windows.Forms.TreeView();
             this.ButtonSaveScanGroup = new UAS_LabelMachine.CustomControl.NormalButton();
             this.Customer = new System.Windows.Forms.TextBox();
@@ -61,9 +61,12 @@
             this.FormatExample = new System.Windows.Forms.Label();
             this.FormatExample1 = new System.Windows.Forms.Label();
             this.cu_print_dateformat = new System.Windows.Forms.TextBox();
+            this.label7 = new System.Windows.Forms.Label();
+            this.cu_print_limiteddate = new System.Windows.Forms.NumericUpDown();
             ((System.ComponentModel.ISupportInitialize)(this.cu_print_papercount)).BeginInit();
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.cu_print_limiteddate)).BeginInit();
             this.SuspendLayout();
             // 
             // cu_print_midlotno
@@ -409,11 +412,35 @@
             this.cu_print_dateformat.Size = new System.Drawing.Size(114, 21);
             this.cu_print_dateformat.TabIndex = 71;
             // 
+            // label7
+            // 
+            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(770, 220);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(74, 21);
+            this.label7.TabIndex = 72;
+            this.label7.Text = "有效日期";
+            // 
+            // cu_print_limiteddate
+            // 
+            this.cu_print_limiteddate.Location = new System.Drawing.Point(850, 220);
+            this.cu_print_limiteddate.Maximum = new decimal(new int[] {
+            10000,
+            0,
+            0,
+            0});
+            this.cu_print_limiteddate.Name = "cu_print_limiteddate";
+            this.cu_print_limiteddate.Size = new System.Drawing.Size(62, 21);
+            this.cu_print_limiteddate.TabIndex = 73;
+            // 
             // CustomerRule
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1082, 634);
+            this.Controls.Add(this.cu_print_limiteddate);
+            this.Controls.Add(this.label7);
             this.Controls.Add(this.cu_print_dateformat);
             this.Controls.Add(this.FormatExample1);
             this.Controls.Add(this.FormatExample);
@@ -451,6 +478,7 @@
             this.groupBox1.PerformLayout();
             this.groupBox2.ResumeLayout(false);
             this.groupBox2.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.cu_print_limiteddate)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -461,7 +489,7 @@
         private System.Windows.Forms.CheckBox cu_print_midprod;
         private System.Windows.Forms.CheckBox cu_print_midspec;
         private System.Windows.Forms.CheckBox cu_print_midpo;
-        private CustomControl.RichText.RichTextAutoBottom cu_print_regexpression;
+        private System.Windows.Forms.RichTextBox cu_print_regexpression;
         private System.Windows.Forms.TreeView CustomerTreeView;
         private CustomControl.NormalButton ButtonSaveScanGroup;
         private System.Windows.Forms.TextBox Customer;
@@ -489,5 +517,7 @@
         private System.Windows.Forms.Label FormatExample;
         private System.Windows.Forms.Label FormatExample1;
         private System.Windows.Forms.TextBox cu_print_dateformat;
+        private System.Windows.Forms.Label label7;
+        private System.Windows.Forms.NumericUpDown cu_print_limiteddate;
     }
 }

+ 2 - 1
UAS-出货标签管理(吉利通)/CustomerRule.cs

@@ -50,7 +50,7 @@ namespace UAS_LabelMachine
             {
                 CUCODE = e.Node.Tag.ToString();
                 sql.Clear();
-                sql.Append("select cu_print_midlotno,cu_print_midspec,cu_print_dateformat,cu_print_checkdatecode,cu_print_recheck,cu_print_midpo,cu_print_midprod,nvl(cu_print_custprodmatchmodel,'Equal')cu_print_custprodmatchmodel,cu_print_outlotno,cu_print_outspec,cu_print_outpo");
+                sql.Append("select cu_print_midlotno,cu_print_midspec,cu_print_dateformat,nvl(cu_print_limiteddate,0)cu_print_limiteddate,cu_print_checkdatecode,cu_print_recheck,cu_print_midpo,cu_print_midprod,nvl(cu_print_custprodmatchmodel,'Equal')cu_print_custprodmatchmodel,cu_print_outlotno,cu_print_outspec,cu_print_outpo");
                 sql.Append(",cu_print_outprod,cu_print_checkonly,nvl(cu_print_papercount,0)cu_print_papercount,cu_print_regexpression from customer where cu_code='" + e.Node.Tag + "'");
                 dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 if (dt.Rows.Count > 0)
@@ -101,6 +101,7 @@ namespace UAS_LabelMachine
             sql.Append("cu_print_recheck='" + (CustProdAndSpec.Checked ? "CP" : "BR") + "',");
             sql.Append("cu_print_checkdatecode='" + (cu_print_checkdatecode.Checked ? -1 : 0) + "',");
             sql.Append("cu_print_dateformat='" + cu_print_dateformat.Text + "',");
+            sql.Append("cu_print_limiteddate=" + cu_print_limiteddate.Value + ",");
             sql.Append("cu_print_regexpression=:cu_print_regexpression where cu_code='" + CUCODE + "'");
             dh.ExecuteSql(sql.ToString(), "update", cu_print_regexpression.Text);
             MessageBox.Show("保存成功!", "提示");

+ 1 - 1
UAS-出货标签管理(吉利通)/PublicMethod/BaseUtil.cs

@@ -230,7 +230,7 @@ namespace UAS_LabelMachine
                         SetFormValue(collection[i].Controls, dt);
                     string controlName = collection[i].Name;
                     //默认给TextBox和Label赋值
-                    if (collection[i] is TextBox || collection[i] is Label || collection[i] is SearchTextBox || collection[i] is NumericUpDown || collection[i] is CheckBox || collection[i] is RichTextAutoBottom)
+                    if (collection[i] is TextBox || collection[i] is Label || collection[i] is SearchTextBox || collection[i] is NumericUpDown || collection[i] is CheckBox || collection[i] is RichTextAutoBottom || collection[i] is RichTextBox)
                     {
                         for (int j = 0; j < dt.Columns.Count; j++)
                         {

+ 4 - 2
UAS-出货标签管理(吉利通)/PublicMethod/LogicHandler.cs

@@ -63,16 +63,18 @@ namespace UAS_LabelMachine.PublicMethod
             oBarCode = param[9];
         }
 
-        public static void GetTimeFromDatecode(string iDatecode, string iCustcode, out string  oYear, out string oMonth ,out string oDay)
+        public static void GetTimeFromDatecode(string iDatecode, string iCustcode, out string oYear, out string oMonth, out string oDay, out string oDate)
         {
             oYear = "0";
             oMonth = "0";
             oDay = "0";
-            string[] param = new string[] { iDatecode, iCustcode, oYear , oMonth, oDay };
+            oDate = "19000101";
+            string[] param = new string[] { iDatecode, iCustcode, oYear, oMonth, oDay, oDate };
             dh.CallProcedure("GETTIMEFROMDATECODE", ref param);
             oYear = param[2];
             oMonth = param[3];
             oDay = param[4];
+            oDate = param[5];
         }
 
         /// <summary>

+ 31 - 1
UAS-出货标签管理(吉利通)/UAS_出货标签管理.Designer.cs

@@ -247,6 +247,8 @@
             this.FrontendCheck = new UAS_LabelMachine.CustomControl.SerialPortWithTag();
             this.PLC1 = new UAS_LabelMachine.CustomControl.SerialPortWithTag();
             this.ManBackendCheck = new UAS_LabelMachine.CustomControl.SerialPortWithTag();
+            this.label30 = new System.Windows.Forms.Label();
+            this.cu_print_limiteddate = new System.Windows.Forms.NumericUpDown();
             this.LogMenu.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.PageSizeNum)).BeginInit();
             this.CollectionProcess.SuspendLayout();
@@ -266,6 +268,7 @@
             ((System.ComponentModel.ISupportInitialize)(this.cu_print_papercount)).BeginInit();
             this.groupBoxWithBorder3.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.OutBoxCapacity)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.cu_print_limiteddate)).BeginInit();
             this.SuspendLayout();
             // 
             // ExportData
@@ -624,7 +627,7 @@
             // 
             this.GetGridOnly.AutoSize = true;
             this.GetGridOnly.Font = new System.Drawing.Font("微软雅黑", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.GetGridOnly.Location = new System.Drawing.Point(76, 38);
+            this.GetGridOnly.Location = new System.Drawing.Point(81, 68);
             this.GetGridOnly.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.GetGridOnly.Name = "GetGridOnly";
             this.GetGridOnly.Size = new System.Drawing.Size(77, 20);
@@ -2607,12 +2610,36 @@
             this.ManBackendCheck.SleepTime = 0;
             this.ManBackendCheck.Tag = "ManBackendCheck";
             // 
+            // label30
+            // 
+            this.label30.AutoSize = true;
+            this.label30.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label30.Location = new System.Drawing.Point(85, 155);
+            this.label30.Name = "label30";
+            this.label30.Size = new System.Drawing.Size(65, 20);
+            this.label30.TabIndex = 111;
+            this.label30.Text = "有效日期";
+            // 
+            // cu_print_limiteddate
+            // 
+            this.cu_print_limiteddate.Location = new System.Drawing.Point(153, 158);
+            this.cu_print_limiteddate.Maximum = new decimal(new int[] {
+            10000,
+            0,
+            0,
+            0});
+            this.cu_print_limiteddate.Name = "cu_print_limiteddate";
+            this.cu_print_limiteddate.Size = new System.Drawing.Size(61, 21);
+            this.cu_print_limiteddate.TabIndex = 112;
+            // 
             // UAS_出货标签打印
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(233)))), ((int)(((byte)(206)))));
             this.ClientSize = new System.Drawing.Size(1387, 746);
+            this.Controls.Add(this.cu_print_limiteddate);
+            this.Controls.Add(this.label30);
             this.Controls.Add(this.cu_print_dateformat);
             this.Controls.Add(this.label29);
             this.Controls.Add(this.ResetBarcode);
@@ -2694,6 +2721,7 @@
             this.groupBoxWithBorder3.ResumeLayout(false);
             this.groupBoxWithBorder3.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.OutBoxCapacity)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.cu_print_limiteddate)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -2918,5 +2946,7 @@
         private System.Windows.Forms.Button ResetBarcode;
         private System.Windows.Forms.Label label29;
         private System.Windows.Forms.Label cu_print_dateformat;
+        private System.Windows.Forms.Label label30;
+        private System.Windows.Forms.NumericUpDown cu_print_limiteddate;
     }
 }

+ 25 - 9
UAS-出货标签管理(吉利通)/UAS_出货标签管理.cs

@@ -456,6 +456,20 @@ namespace UAS_LabelMachine
                                         {
                                             DateCode = matchs1.Groups[reg.GroupNumberFromName(groupName)].Value;
                                         }
+                                        string year = "";
+                                        string month = "";
+                                        string day = "";
+                                        string date = "";
+                                        LogicHandler.GetTimeFromDatecode(DateCode, pi_cardcode.Text, out year, out month, out day, out date);
+                                        System.DateTime dtime;
+                                        //有效期比对
+                                        if (System.DateTime.TryParseExact(date, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtime))
+                                        {
+                                            if ((System.DateTime.Now - dtime).Days > cu_print_limiteddate.Value)
+                                            {
+                                                MessageLog.AppendText(">>超出有效期\n", Color.Red);
+                                            }
+                                        }
                                         break;
                                     case "LotNo":
                                         LotNo = matchs1.Groups[reg.GroupNumberFromName(groupName)].Value;
@@ -508,13 +522,11 @@ namespace UAS_LabelMachine
                                         if (si_expression != "")
                                         {
                                             si_exp = new Regex(si_expression);
-                                            Console.WriteLine(matchs1.Groups[reg.GroupNumberFromName(groupName)].Value);
                                             Match mat = si_exp.Match(matchs1.Groups[reg.GroupNumberFromName(groupName)].Value);
                                             foreach (var dtgroup in si_exp.GetGroupNames())
                                             {
                                                 if (dtgroup == dt.Rows[j]["si_name"].ToString())
                                                 {
-                                                    Console.WriteLine(mat.Groups[si_exp.GroupNumberFromName(dtgroup)].Value);
                                                     QTY = mat.Groups[si_exp.GroupNumberFromName(dtgroup)].Value;
                                                 }
                                             }
@@ -680,6 +692,7 @@ namespace UAS_LabelMachine
                         string year = "0";
                         string month = "0";
                         string day = "0";
+                        string date = "";
                         DataRow[] dr = LabelInfDataTable.Select("pib_id=" + pibid1 + " and pr_orispeccode='" + PN + "'");
                         if (dr.Length > 0)
                         {
@@ -688,7 +701,7 @@ namespace UAS_LabelMachine
                             dr[0]["pib_datecode"] = DateCode;
                             try
                             {
-                                LogicHandler.GetTimeFromDatecode(DateCode, "", out year, out month, out day);
+                                LogicHandler.GetTimeFromDatecode(DateCode, pi_cardcode.Text, out year, out month, out day, out date);
                                 dr[0]["pib_year"] = year;
                                 dr[0]["pib_month"] = month;
                                 dr[0]["pib_day"] = day;
@@ -759,11 +772,12 @@ namespace UAS_LabelMachine
                     string year = "0";
                     string month = "0";
                     string day = "0";
+                    string date = "";
                     LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value = DateCode;
                     //解析DateCode,将值设置到年月日
                     try
                     {
-                        LogicHandler.GetTimeFromDatecode(DateCode, "", out year, out month, out day);
+                        LogicHandler.GetTimeFromDatecode(DateCode, pi_cardcode.Text, out year, out month, out day, out date);
                         LabelInf.Rows[CurrentRowIndex].Cells["pib_year"].Value = year;
                         LabelInf.Rows[CurrentRowIndex].Cells["pib_month"].Value = month;
                         LabelInf.Rows[CurrentRowIndex].Cells["pib_day"].Value = day;
@@ -956,7 +970,7 @@ namespace UAS_LabelMachine
                     //}
                     //获取客户自定义设置
                     sql.Clear();
-                    sql.Append("select cu_print_middc,cu_print_outdc,cu_print_dateformat,cu_print_checkdatecode,cu_print_midlotno,nvl(cu_print_custprodmatchmodel,'Equal')cu_print_custprodmatchmodel,cu_print_midspec,cu_print_midpo,cu_print_midprod,cu_print_outlotno,cu_print_outspec,cu_print_outpo");
+                    sql.Append("select cu_print_middc,cu_print_limiteddate,cu_print_outdc,cu_print_dateformat,cu_print_checkdatecode,cu_print_midlotno,nvl(cu_print_custprodmatchmodel,'Equal')cu_print_custprodmatchmodel,cu_print_midspec,cu_print_midpo,cu_print_midprod,cu_print_outlotno,cu_print_outspec,cu_print_outpo");
                     sql.Append(",cu_print_outprod,cu_print_checkonly,nvl(cu_print_papercount,0)cu_print_papercount,cu_print_regexpression,cu_print_recheck from customer where cu_code='" + pi_cardcode.Text + "'");
                     dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                     if (dt.Rows.Count > 0)
@@ -1384,7 +1398,6 @@ namespace UAS_LabelMachine
             }
             sql.Append("1,");
             DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + (pib_outboxcode1 == "" ? "0" : pib_outboxcode1), "select");
-            Console.WriteLine("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + (pib_outboxcode1 == "" ? "0" : pib_outboxcode1));
             for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
             {
                 DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
@@ -2310,7 +2323,8 @@ namespace UAS_LabelMachine
             string year = "0";
             string month = "0";
             string day = "0";
-            LogicHandler.GetTimeFromDatecode(datecode, "", out year, out month, out day);
+            string date = "";
+            LogicHandler.GetTimeFromDatecode(DateCode, pi_cardcode.Text, out year, out month, out day, out date);
             adh.ExecuteSql("update prodiobarcode set pib_ifpick=-1,pib_ifmodify=-1,pib_lotno='" + lotno + "',pib_datecode='" + datecode + "',pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "' where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno, "update");
             LoadGridData();
             setvalue.FindForm().Close();
@@ -2325,7 +2339,8 @@ namespace UAS_LabelMachine
             string year = "0";
             string month = "0";
             string day = "0";
-            LogicHandler.GetTimeFromDatecode(datecode, "", out year, out month, out day);
+            string date = "";
+            LogicHandler.GetTimeFromDatecode(DateCode, pi_cardcode.Text, out year, out month, out day, out date);
             adh.ExecuteSql("update prodiobarcode set pib_ifpick=-1,pib_ifmodify=-1,pib_ifprint=-1,pib_lotno='" + lotno + "',pib_datecode='" + datecode + "',pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "' where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno, "update");
             LoadGridData();
             DataTable pibid_dt = (DataTable)adh.ExecuteSql("select pib_id from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno, "select");
@@ -2353,10 +2368,11 @@ namespace UAS_LabelMachine
             string year = "0";
             string month = "0";
             string day = "0";
+            string date = "";
             //解析DateCode,将值设置到年月日
             try
             {
-                LogicHandler.GetTimeFromDatecode(DateCode, "", out year, out month, out day);
+                LogicHandler.GetTimeFromDatecode(DateCode, pi_cardcode.Text, out year, out month, out day, out date);
                 LabelInf.Rows[CurrentRowIndex].Cells["pib_year"].Value = year;
                 LabelInf.Rows[CurrentRowIndex].Cells["pib_month"].Value = month;
                 LabelInf.Rows[CurrentRowIndex].Cells["pib_day"].Value = day;

+ 4 - 4
UAS-出货标签管理(吉利通)/采集策略_NEW.Designer.cs

@@ -71,8 +71,8 @@
             this.Brand = new System.Windows.Forms.TextBox();
             this.label1 = new System.Windows.Forms.Label();
             this.ButtonSaveScanGroup = new UAS_LabelMachine.CustomControl.NormalButton();
-            this.si_expression4 = new UAS_LabelMachine.CustomControl.RichText.RichTextAutoBottom();
-            this.si_expression3 = new UAS_LabelMachine.CustomControl.RichText.RichTextAutoBottom();
+            this.si_expression4 = new System.Windows.Forms.RichTextBox();
+            this.si_expression3 = new System.Windows.Forms.RichTextBox();
             this.sg_script = new System.Windows.Forms.RichTextBox();
             this.AddNew = new UAS_LabelMachine.CustomControl.NormalButton();
             ((System.ComponentModel.ISupportInitialize)(this.sg_step)).BeginInit();
@@ -617,10 +617,10 @@
         private System.Windows.Forms.RichTextBox sg_script;
         private System.Windows.Forms.Label label13;
         private System.Windows.Forms.Label ScanGroupName_label;
-        private CustomControl.RichText.RichTextAutoBottom si_expression3;
+        private System.Windows.Forms.RichTextBox si_expression3;
         private System.Windows.Forms.Label PNScript_label;
         private System.Windows.Forms.Label DateCodeScript_label;
-        private CustomControl.RichText.RichTextAutoBottom si_expression4;
+        private System.Windows.Forms.RichTextBox si_expression4;
         private System.Windows.Forms.TextBox sg_name;
         private System.Windows.Forms.NumericUpDown sg_step;
         private System.Windows.Forms.Label ScanStep_label;