章政 6 жил өмнө
parent
commit
89a215df87

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

@@ -37,7 +37,7 @@ namespace UAS_LabelMachine
 
         public static char GetSplitChar(string Str)
         {
-            char[] splitchar = new char[] { ',', '@', '#', '|', '&',' ' };
+            char[] splitchar = new char[] { ',', '@', '#', '|', '&',' ','、' };
             char[] arr = Str.ToCharArray();
             char split = new char();
             int Count = 0;

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

@@ -227,9 +227,15 @@ namespace UAS_LabelMachine
                     case "FrontendCheck":
                         //比对当前箱数量和容量
                         FrontCollect.Text = msg;
-                        if (!FrontCheckFunction(msg))
+                        string ErrorMsg = "";
+                        if (!FrontCheckFunction(msg, out ErrorMsg))
                         {
-                            MessageLog.AppendText(">>未能匹配到合适的采集策略\n", Color.Red);
+                            MessageLog.AppendText(">>" + ErrorMsg + "\n", Color.Red);
+                        }
+                        else
+                        {
+                            LabelInfDataTable.Rows[CurrentRowIndex]["pib_ifpick"] = true;
+                            LabelInf.Refresh();
                         }
                         break;
                     case "BackendCheck":
@@ -247,12 +253,12 @@ namespace UAS_LabelMachine
             }
         }
 
-        private bool FrontCheckFunction(string msg)
+        private bool FrontCheckFunction(string msg, out string ErrorMsg)
         {
             int GroupCount = 0;
+            ErrorMsg = "";
             for (int i = 0; i < ScanGroup.Rows.Count; i++)
             {
-
                 string sg_name = ScanGroup.Rows[i]["sg_name"].ToString();
                 string sg_brand = ScanGroup.Rows[i]["sg_brand"].ToString();
                 string sg_script = ScanGroup.Rows[i]["sg_script"].ToString();
@@ -277,7 +283,7 @@ namespace UAS_LabelMachine
                     }
                 }
                 //成功获取到了分隔符号并且匹配的项次相等, 如果不包含分隔符只需要一项
-                if ((SplitChar.Contains(Splitor.ToString()) && ItemIndex.Count == dt.Rows.Count) || (!SplitChar.Contains(Splitor.ToString()) && ItemIndex.Count == 1))
+                if (matchs1.Value.ToString() != "" && ((SplitChar.Contains(Splitor.ToString()) && ItemIndex.Count == dt.Rows.Count) || (!SplitChar.Contains(Splitor.ToString()) && ItemIndex.Count == 1 && arr.Length == 1)))
                 {
                     for (int j = 0; j < dt.Rows.Count; j++)
                     {
@@ -295,24 +301,22 @@ namespace UAS_LabelMachine
                                 {
                                     DateCode = arr[ItemIndex[j]];
                                 }
-                                LabelInfDataTable.Rows[CurrentRowIndex]["pib_datecode"] = DateCode;
                                 break;
                             case "LotNo":
                                 LotNo = arr[ItemIndex[j]];
-                                LabelInfDataTable.Rows[CurrentRowIndex]["pib_lotno"] = LotNo;
                                 break;
                             case "PN":
                                 PN = arr[ItemIndex[j]];
                                 if (LabelInfDataTable.Rows[CurrentRowIndex]["pd_custprodspec"].ToString() != PN)
                                 {
-                                    MessageLog.AppendText(">>客户物料型号不匹配\n", Color.Red);
+                                    ErrorMsg = "客户物料型号不匹配";
                                 }
                                 break;
                             case "Order":
                                 Order = arr[ItemIndex[j]];
                                 if (LabelInfDataTable.Rows[CurrentRowIndex]["pd_pocode"].ToString() != Order)
                                 {
-                                    MessageLog.AppendText(">>订单号不匹配\n", Color.Red);
+                                    ErrorMsg = "订单号不匹配";
                                 }
                                 break;
                             case "QTY":
@@ -327,7 +331,7 @@ namespace UAS_LabelMachine
                                 }
                                 if (LabelInfDataTable.Rows[CurrentRowIndex]["pib_qty"].ToString() != QTY.ToString())
                                 {
-                                    MessageLog.AppendText(">>数量不匹配\n", Color.Red);
+                                    ErrorMsg = "数量不匹配";
                                 }
                                 break;
                             case "OutBox":
@@ -336,6 +340,7 @@ namespace UAS_LabelMachine
                             default:
                                 break;
                         }
+                      
                         index = index + 1;
                     }
                 }
@@ -345,13 +350,17 @@ namespace UAS_LabelMachine
                 }
             }
             if (GroupCount == ScanGroup.Rows.Count)
+            {
+                ErrorMsg = "未匹配到合适的采集策略";
+            }
+            if (ErrorMsg != "")
             {
                 return false;
             }
             else
             {
-                LabelInfDataTable.Rows[CurrentRowIndex]["pib_ifpick"] = true;
-                LabelInf.Refresh();
+                LabelInfDataTable.Rows[CurrentRowIndex]["pib_datecode"] = DateCode;
+                LabelInfDataTable.Rows[CurrentRowIndex]["pib_lotno"] = LotNo;
                 return true;
             }
         }
@@ -1346,7 +1355,7 @@ namespace UAS_LabelMachine
                 back_sg_separator.Text = dt.Rows[0]["splitfront"].ToString();
             }
             //获取所有的匹配脚本
-            ScanGroup = (DataTable)dh.ExecuteSql("select distinct sg_brand,sg_id,sg_name,sg_script from prodiobarcode left join scangroup on pib_brand=sg_brand where pib_inoutno='" + pi_inoutno.Text + "' and sg_id is not null", "select");
+            ScanGroup = (DataTable)dh.ExecuteSql("select distinct sg_brand,sg_id,sg_name,sg_script from prodiobarcode left join scangroup on pib_brand=sg_brand where pib_inoutno='" + pi_inoutno.Text + "' and sg_id is not null and nvl(sg_autolabel,0)<>0", "select");
             //绑定数据之后往下找到未采集的数据显示在当前采集的栏目
             for (int i = 0; i < LabelInf.RowCount; i++)
             {
@@ -1733,7 +1742,8 @@ namespace UAS_LabelMachine
         {
             string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
             int pib_pdno = int.Parse(LabelInf.Rows[CurrentRowIndex].Cells["pib_pdno"].Value.ToString());
-            FrontCheckFunction("");
+            string ErrorMsg = "";
+            FrontCheckFunction("", out ErrorMsg);
         }
 
         private void ButtonRecheckPass_Click(object sender, EventArgs e)

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

@@ -1,5 +1,6 @@
 using System;
 using System.Data;
+using System.Drawing;
 using System.Text;
 using System.Windows.Forms;
 using UAS_LabelMachine.Entity;
@@ -48,10 +49,15 @@ namespace UAS_LabelMachine
             if (e.Node.Level == 0)
             {
                 e.Node.Nodes.Clear();
-                dt = (DataTable)dh.ExecuteSql("select sg_id,sg_name from scangroup where sg_brand='" + e.Node.Text + "'", "select");
+                dt = (DataTable)dh.ExecuteSql("select sg_id,sg_name,nvl(sg_autolabel,0)sg_autolabel from scangroup where sg_brand='" + e.Node.Text + "'", "select");
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
                     TreeNode tn = new TreeNode(dt.Rows[i]["sg_name"].ToString());
+                    if (dt.Rows[i]["sg_autolabel"].ToString() != "0")
+                    {
+                        tn.BackColor = Color.Green;
+                        tn.ForeColor = Color.White;
+                    }
                     tn.Tag = dt.Rows[i]["sg_id"].ToString();
                     e.Node.Nodes.Add(tn);
                 }