Browse Source

调整参数

章政 6 years ago
parent
commit
64579079f0
1 changed files with 49 additions and 24 deletions
  1. 49 24
      UAS-出货标签管理(吉利通)/UAS_出货标签管理.cs

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

@@ -414,7 +414,10 @@ namespace UAS_LabelMachine
                 MessageLog.AppendText("接收返回消息异常!具体原因:" + ex.Message + ex.StackTrace, Color.Red);
                 MessageLog.AppendText("接收返回消息异常!具体原因:" + ex.Message + ex.StackTrace, Color.Red);
             }
             }
         }
         }
-
+        string year = "";
+        string month = "";
+        string day = "";
+        string date = "";
         private bool RegexMatch(string CheckType, string msg, out string ErrorMsg)
         private bool RegexMatch(string CheckType, string msg, out string ErrorMsg)
         {
         {
             ErrorMsg = "";
             ErrorMsg = "";
@@ -433,10 +436,6 @@ namespace UAS_LabelMachine
                     int rownum = 0;
                     int rownum = 0;
                     Matched = true;
                     Matched = true;
                     string ItemStr = "";
                     string ItemStr = "";
-                    string year = "";
-                    string month = "";
-                    string day = "";
-                    string date = "";
                     foreach (var groupName in reg.GetGroupNames())
                     foreach (var groupName in reg.GetGroupNames())
                     {
                     {
                         for (int j = 0; j < dt.Rows.Count; j++)
                         for (int j = 0; j < dt.Rows.Count; j++)
@@ -549,20 +548,6 @@ namespace UAS_LabelMachine
                             }
                             }
                         }
                         }
                     }
                     }
-                    //查询设置解析的DateCode的值
-                    DataRow[] dr = LabelInfDataTable.Select("pib_id=" + LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value);
-                    if (dr.Length > 0)
-                    {
-                        try
-                        {
-                            dr[0]["pib_year"] = year;
-                            dr[0]["pib_month"] = month;
-                            dr[0]["pib_day"] = day;
-                        }
-                        catch (Exception)
-                        {
-                        }
-                    }
                     //如果品牌不对应的话则不能使用本次的匹配规则
                     //如果品牌不对应的话则不能使用本次的匹配规则
                     if (ErrorMsg == "" && ItemStr.Contains("QTY") && LabelInf.Rows[CurrentRowIndex].Cells["pib_qty"].Value.ToString() != QTY.ToString())
                     if (ErrorMsg == "" && ItemStr.Contains("QTY") && LabelInf.Rows[CurrentRowIndex].Cells["pib_qty"].Value.ToString() != QTY.ToString())
                     {
                     {
@@ -706,19 +691,34 @@ namespace UAS_LabelMachine
                 {
                 {
                     if (CheckItem.Count == 0 || (ManualCheckCount.Count == 1 && CheckItem.Count == 1))
                     if (CheckItem.Count == 0 || (ManualCheckCount.Count == 1 && CheckItem.Count == 1))
                     {
                     {
+                        string year = "0";
+                        string month = "0";
+                        string day = "0";
+                        string date = "";
                         DataRow[] dr = LabelInfDataTable.Select("pib_id=" + pibid1 + " and pr_orispeccode='" + PN + "'");
                         DataRow[] dr = LabelInfDataTable.Select("pib_id=" + pibid1 + " and pr_orispeccode='" + PN + "'");
                         if (dr.Length > 0)
                         if (dr.Length > 0)
                         {
                         {
                             dr[0]["pib_ifrecheck"] = -1;
                             dr[0]["pib_ifrecheck"] = -1;
                             dr[0]["pib_lotno"] = LotNo;
                             dr[0]["pib_lotno"] = LotNo;
                             dr[0]["pib_datecode"] = DateCode;
                             dr[0]["pib_datecode"] = DateCode;
+                            try
+                            {
+                                LogicHandler.GetTimeFromDatecode(dh1, 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;
+                            }
+                            catch (Exception)
+                            {
+
+                            }
                         }
                         }
                         else
                         else
                         {
                         {
                             ErrorMsg = "未匹配到合适的原厂型号";
                             ErrorMsg = "未匹配到合适的原厂型号";
                             return false;
                             return false;
                         }
                         }
-                        back_adh.ExecuteSql("update prodiobarcode set pib_ifrecheck=-1,pib_datecode='" + DateCode + "',pib_lotno='" + LotNo + "' where pib_id=" + pibid1 + " and pr_orispeccode='" + PN + "'", "update");
+                        back_adh.ExecuteSql("update prodiobarcode set pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "',pib_ifrecheck=-1,pib_datecode='" + DateCode + "',pib_lotno='" + LotNo + "' where pib_id=" + pibid1 + " and pr_orispeccode='" + PN + "'", "update");
                     }
                     }
                 }
                 }
                 else
                 else
@@ -771,13 +771,25 @@ namespace UAS_LabelMachine
             {
             {
                 if (RegexMatch("BackCheck", msg, out ErrorMsg))
                 if (RegexMatch("BackCheck", msg, out ErrorMsg))
                 {
                 {
+                    string year = "0";
+                    string month = "0";
+                    string day = "0";
+                    string date = "";
                     LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value = DateCode;
                     LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value = DateCode;
                     //解析DateCode,将值设置到年月日
                     //解析DateCode,将值设置到年月日
+                    try
+                    {
+                        LogicHandler.GetTimeFromDatecode(dh1, 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;
+                    }
+                    catch (Exception) { }
                     LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value = LotNo;
                     LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value = LotNo;
                     LabelInf.Rows[CurrentRowIndex].Cells["pib_ifmodify"].Value = true;
                     LabelInf.Rows[CurrentRowIndex].Cells["pib_ifmodify"].Value = true;
                     LabelInf.Rows[CurrentRowIndex].Cells["pib_ifrecheck"].Value = true;
                     LabelInf.Rows[CurrentRowIndex].Cells["pib_ifrecheck"].Value = true;
                     LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
                     LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
-                    adh.ExecuteSQLTran("update prodiobarcode set pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "',pib_ifpick=-1,pib_ifmodify=-1,pib_ifrecheck=-1 where pib_id=" + LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value);
+                    adh.ExecuteSQLTran("update prodiobarcode set pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "',pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "',pib_ifpick=-1,pib_ifmodify=-1,pib_ifrecheck=-1 where pib_id=" + LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value);
                     LogicHandler.CheckUploadData(pi_inoutno.Text, UploadNum);
                     LogicHandler.CheckUploadData(pi_inoutno.Text, UploadNum);
                     LabelInf.Invalidate();
                     LabelInf.Invalidate();
                     return true;
                     return true;
@@ -2341,10 +2353,23 @@ namespace UAS_LabelMachine
 
 
         private void SetOutboxBarcode()
         private void SetOutboxBarcode()
         {
         {
-            string year = LabelInf.Rows[CurrentRowIndex].Cells["pib_year"].Value.ToString();
-            string month = LabelInf.Rows[CurrentRowIndex].Cells["pib_month"].Value.ToString();
-            string day = LabelInf.Rows[CurrentRowIndex].Cells["pib_day"].Value.ToString();
             string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
             string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
+            //解析DateCode,将值设置到年月日
+            try
+            {
+                DataRow[] dr = LabelInfDataTable.Select("pib_id=" + pib_id);
+                if (dr.Length > 0)
+                {
+                    try
+                    {
+                        dr[0]["pib_year"] = year;
+                        dr[0]["pib_month"] = month;
+                        dr[0]["pib_day"] = day;
+                    }
+                    catch { }
+                }
+            }
+            catch (Exception) { }
             int outboxcode1 = int.Parse(Process_midboxcode.Text == "" ? "1" : Process_midboxcode.Text);
             int outboxcode1 = int.Parse(Process_midboxcode.Text == "" ? "1" : Process_midboxcode.Text);
             int outboxcode2 = int.Parse(Process_outboxcode.Text == "" ? "1" : Process_outboxcode.Text);
             int outboxcode2 = int.Parse(Process_outboxcode.Text == "" ? "1" : Process_outboxcode.Text);
             string pd_id = LabelInf.Rows[CurrentRowIndex].Cells["pd_id"].Value.ToString();
             string pd_id = LabelInf.Rows[CurrentRowIndex].Cells["pd_id"].Value.ToString();