Эх сурвалжийг харах

富为账套不启用编辑DateCode1

章政 6 жил өмнө
parent
commit
7134f5dd3b

+ 14 - 11
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -2245,20 +2245,23 @@ namespace UAS_LabelMachine
         {
             if (e.RowIndex >= 0)
             {
-                if (LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode")
+                if (!(DataHelper.DBConnectionString.Contains("richwell") || DataHelper.DBConnectionString.Contains("192.168.0.88")))
                 {
-                    string datecode = LabelInf.Rows[e.RowIndex].Cells["pib_datecode"].Value.ToString();
-                    try
+                    if (LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode")
                     {
-                        System.DateTime dt = System.DateTime.ParseExact(datecode, "yyyyMMdd", CultureInfo.CurrentCulture);
-                        GregorianCalendar gc = new GregorianCalendar();
-                        int weekOfYear = gc.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
-                        if (weekOfYear < 10)
-                            LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + "0" + weekOfYear;
-                        else
-                            LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + weekOfYear;
+                        string datecode = LabelInf.Rows[e.RowIndex].Cells["pib_datecode"].Value.ToString();
+                        try
+                        {
+                            System.DateTime dt = System.DateTime.ParseExact(datecode, "yyyyMMdd", CultureInfo.CurrentCulture);
+                            GregorianCalendar gc = new GregorianCalendar();
+                            int weekOfYear = gc.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
+                            if (weekOfYear < 10)
+                                LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + "0" + weekOfYear;
+                            else
+                                LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + weekOfYear;
+                        }
+                        catch (Exception) { }
                     }
-                    catch (Exception) { }
                 }
             }
         }