Переглянути джерело

Merge branch 'master' of ssh://10.10.100.21/source/mes-client

Hcsy 6 роки тому
батько
коміт
34cb13064d

+ 1 - 2
UAS-出货标签管理(泽天)/PublicMethod/DataHelper.cs

@@ -49,7 +49,7 @@ namespace UAS_LabelMachine
         //泽天ERP地址
         public static readonly string ERPAddesss = "http://183.47.41.2:8099/ERP/";
         //泽天FTP
-        public static readonly string FTPAdress = "ftp://10.2.10.241|uas|Lz201478c";
+        public static readonly string FTPAdress = "ftp://183.47.41.3:21|uas|Zt2018";
         //Oracle端口
         public static readonly string OraclePort = "1521";
         //需要显示的账套
@@ -830,7 +830,6 @@ namespace UAS_LabelMachine
                     command.Parameters.Add(new OracleParameter(addpar[i].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
                 }
             }
-            Console.WriteLine(SQL);
             switch (Type.ToUpper())
             {
                 case "SELECT":

+ 10 - 65
UAS-出货标签管理/UAS_出货标签管理.Designer.cs

@@ -172,10 +172,6 @@
             this.GetOutBoxCode = new System.Windows.Forms.Button();
             this.OutBoxNum = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.label10 = new System.Windows.Forms.Label();
-            this.WeightNet = new UAS_LabelMachine.CustomControl.EnterTextBox();
-            this.label9 = new System.Windows.Forms.Label();
-            this.WeightGross = new UAS_LabelMachine.CustomControl.EnterTextBox();
-            this.label8 = new System.Windows.Forms.Label();
             this.label6 = new System.Windows.Forms.Label();
             this.OutBoxPrinter = new UAS_LabelMachine.CustomControl.PrinterCombox();
             this.OutboxCapacity = new System.Windows.Forms.NumericUpDown();
@@ -532,6 +528,10 @@
             this.PowerSetting.Visible = false;
             this.PowerSetting.Click += new System.EventHandler(this.PowerSetting_Click);
             // 
+            // RefreshDBConnect
+            // 
+            this.RefreshDBConnect.Tick += new System.EventHandler(this.RefreshDBConnect_Tick);
+            // 
             // GetGridOnly
             // 
             this.GetGridOnly.AutoSize = true;
@@ -771,7 +771,6 @@
             this.AttachInfo.TabIndex = 85;
             this.AttachInfo.Text = "附加信息设置";
             this.AttachInfo.UseVisualStyleBackColor = true;
-            this.AttachInfo.Visible = false;
             this.AttachInfo.Click += new System.EventHandler(this.AttachInfo_Click);
             // 
             // pi_date
@@ -1588,10 +1587,6 @@
             this.OutBoxLabel.Controls.Add(this.GetOutBoxCode);
             this.OutBoxLabel.Controls.Add(this.OutBoxNum);
             this.OutBoxLabel.Controls.Add(this.label10);
-            this.OutBoxLabel.Controls.Add(this.WeightNet);
-            this.OutBoxLabel.Controls.Add(this.label9);
-            this.OutBoxLabel.Controls.Add(this.WeightGross);
-            this.OutBoxLabel.Controls.Add(this.label8);
             this.OutBoxLabel.Controls.Add(this.label6);
             this.OutBoxLabel.Controls.Add(this.OutBoxPrinter);
             this.OutBoxLabel.Controls.Add(this.OutboxCapacity);
@@ -1623,7 +1618,7 @@
             // GetOutBoxCode
             // 
             this.GetOutBoxCode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.GetOutBoxCode.Location = new System.Drawing.Point(89, 146);
+            this.GetOutBoxCode.Location = new System.Drawing.Point(89, 167);
             this.GetOutBoxCode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.GetOutBoxCode.Name = "GetOutBoxCode";
             this.GetOutBoxCode.Size = new System.Drawing.Size(76, 26);
@@ -1636,7 +1631,7 @@
             // 
             this.OutBoxNum.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.OutBoxNum.ID = null;
-            this.OutBoxNum.Location = new System.Drawing.Point(46, 180);
+            this.OutBoxNum.Location = new System.Drawing.Point(46, 201);
             this.OutBoxNum.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OutBoxNum.Name = "OutBoxNum";
             this.OutBoxNum.Size = new System.Drawing.Size(37, 23);
@@ -1649,63 +1644,17 @@
             // 
             this.label10.AutoSize = true;
             this.label10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label10.Location = new System.Drawing.Point(6, 178);
+            this.label10.Location = new System.Drawing.Point(6, 204);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(32, 17);
             this.label10.TabIndex = 90;
             this.label10.Text = "箱号";
             // 
-            // WeightNet
-            // 
-            this.WeightNet.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.WeightNet.ID = null;
-            this.WeightNet.Location = new System.Drawing.Point(128, 210);
-            this.WeightNet.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.WeightNet.Name = "WeightNet";
-            this.WeightNet.Size = new System.Drawing.Size(37, 23);
-            this.WeightNet.Str = null;
-            this.WeightNet.Str1 = null;
-            this.WeightNet.Str2 = null;
-            this.WeightNet.TabIndex = 89;
-            // 
-            // label9
-            // 
-            this.label9.AutoSize = true;
-            this.label9.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label9.Location = new System.Drawing.Point(86, 210);
-            this.label9.Name = "label9";
-            this.label9.Size = new System.Drawing.Size(32, 17);
-            this.label9.TabIndex = 88;
-            this.label9.Text = "净重";
-            // 
-            // WeightGross
-            // 
-            this.WeightGross.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.WeightGross.ID = null;
-            this.WeightGross.Location = new System.Drawing.Point(46, 210);
-            this.WeightGross.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.WeightGross.Name = "WeightGross";
-            this.WeightGross.Size = new System.Drawing.Size(37, 23);
-            this.WeightGross.Str = null;
-            this.WeightGross.Str1 = null;
-            this.WeightGross.Str2 = null;
-            this.WeightGross.TabIndex = 85;
-            // 
-            // label8
-            // 
-            this.label8.AutoSize = true;
-            this.label8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label8.Location = new System.Drawing.Point(6, 210);
-            this.label8.Name = "label8";
-            this.label8.Size = new System.Drawing.Size(32, 17);
-            this.label8.TabIndex = 83;
-            this.label8.Text = "毛重";
-            // 
             // label6
             // 
             this.label6.AutoSize = true;
             this.label6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label6.Location = new System.Drawing.Point(6, 148);
+            this.label6.Location = new System.Drawing.Point(6, 172);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(32, 17);
             this.label6.TabIndex = 87;
@@ -1723,7 +1672,7 @@
             // OutboxCapacity
             // 
             this.OutboxCapacity.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OutboxCapacity.Location = new System.Drawing.Point(46, 147);
+            this.OutboxCapacity.Location = new System.Drawing.Point(46, 168);
             this.OutboxCapacity.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OutboxCapacity.Name = "OutboxCapacity";
             this.OutboxCapacity.Size = new System.Drawing.Size(38, 23);
@@ -1750,7 +1699,7 @@
             // OutBoxLabelPrint
             // 
             this.OutBoxLabelPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OutBoxLabelPrint.Location = new System.Drawing.Point(90, 178);
+            this.OutBoxLabelPrint.Location = new System.Drawing.Point(90, 199);
             this.OutBoxLabelPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OutBoxLabelPrint.Name = "OutBoxLabelPrint";
             this.OutBoxLabelPrint.Size = new System.Drawing.Size(76, 26);
@@ -1863,10 +1812,6 @@
         private CustomControl.GroupBoxWithBorder.GroupBoxWithBorder OutBoxLabel;
         private CustomControl.EnterTextBox OutBoxNum;
         private System.Windows.Forms.Label label10;
-        private CustomControl.EnterTextBox WeightNet;
-        private System.Windows.Forms.Label label9;
-        private CustomControl.EnterTextBox WeightGross;
-        private System.Windows.Forms.Label label8;
         private CustomControl.PrinterCombox OutBoxPrinter;
         private System.Windows.Forms.Button OutBoxLabelPrint;
         private System.Windows.Forms.ComboBox OutBoxCombox;

+ 57 - 192
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -145,6 +145,8 @@ namespace UAS_LabelMachine
 
         List<string> OutParam = new List<string>();
 
+        DataTable Attach;
+
         public UAS_出货标签打印(string Master)
         {
             InitializeComponent();
@@ -378,6 +380,12 @@ namespace UAS_LabelMachine
                     return;
                 }
                 CollectInputData();
+                DataTable savedt = (LabelInf.DataSource as DataTable);
+                if (savedt != null && savedt.GetChanges() != null)
+                {
+                    MidSource.EndEdit();
+                    dh.SaveDataTable(savedt.GetChanges(), "ProdioBarCode", "pib_id");
+                }
             }
         }
 
@@ -687,49 +695,16 @@ namespace UAS_LabelMachine
                         DataRow[] dr = SingleBoxCacheData.Select("pib_id=" + pib_id);
                         if (arg.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name))
                             SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
-                        if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("datecode1"))
-                        {
-                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value != null)
-                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value.ToString();
-                        }
-                        else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("lotno"))
-                        {
-                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value != null)
-                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
-                        }
-                        else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("datecode"))
-                        {
-                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value != null)
-                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
-                        }
-                        else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("产地"))
-                        {
-                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_madein"].Value != null)
-                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_madein"].Value.ToString();
-                        }
-                        else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("pib_cusbarcode"))
-                        {
-                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_cusbarcode"].Value != null)
-                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_cusbarcode"].Value.ToString();
-                        }
                         if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
                         {
-                            try
-                            {
-                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
-                            }
-                            catch (Exception)
+                            DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
+                            if (dr1.Length > 0)
                             {
-
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
                             }
                         }
                         ParamLog.AppendLine("pib_id:" + LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString() + ",SingleDoc打印参数【" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(j + 1).Value);
                     }
-                    else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == "DateCode1")
-                    {
-                        if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value != null)
-                            SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value.ToString();
-                    }
                 }
             }
             LogManager.DoLog(ParamLog.ToString());
@@ -1067,7 +1042,7 @@ namespace UAS_LabelMachine
         private void GetInOutInfAndLabelFile()
         {
             ComBoxClickChangeLabelDoc = false;
-            DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql  from LabelAttachPARAMETER where lap_custcode='" + pi_cardcode.Text + "'", "select");
+            Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql  from LabelAttachPARAMETER where lap_custcode='" + pi_cardcode.Text + "'", "select");
             sql.Clear();
             sql.Append("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl||'#'||to_char(cl_date,'YYYY-MM-DD HH24:Mi:SS')  la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
             sql.Append("left join customer on cu_code=cl_custcode left join label on la_code=CL_LABELCODE where ((pi_cardcode='" + pi_cardcode.Text + "' ");
@@ -1092,7 +1067,6 @@ namespace UAS_LabelMachine
             {
                 SingleDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + SingleLabelCombox.Text);
                 SingleLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + SingleLabelCombox.SelectedValue.ToString().Split('#')[0], "select");
-                SingleLabelParam.Merge(Attach);
                 for (int i = 0; i < SingleDoc.Variables.FreeVariables.Count; i++)
                 {
                     SingleParam.Add(SingleDoc.Variables.FreeVariables.Item(i + 1).Name);
@@ -1122,7 +1096,6 @@ namespace UAS_LabelMachine
             {
                 MidDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + MidLabelCombox.Text);
                 MidLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + MidLabelCombox.SelectedValue.ToString().Split('#')[0], "select");
-                MidLabelParam.Merge(Attach);
             }
             //缓存中盒参数
             sql.Clear();
@@ -1149,11 +1122,11 @@ namespace UAS_LabelMachine
             {
                 OutBoxDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + OutBoxCombox.Text);
                 OutLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + OutBoxCombox.SelectedValue.ToString().Split('#')[0], "select");
-                OutLabelParam.Merge(Attach);
             }
             //缓存外箱参数
             ComBoxClickChangeLabelDoc = true;
-            Parallel.Invoke(GetSingleBoxData, GetMidBoxData);
+            GetSingleBoxData();
+            GetMidBoxData();
         }
 
         /// <summary>
@@ -1311,46 +1284,17 @@ namespace UAS_LabelMachine
                             {
                                 if (arg.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name))
                                     SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
-                                if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
-                                {
-                                    if (LabelInf.Rows[i].Cells["pib_datecode1"].Value != null)
-                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_datecode1"].Value.ToString();
-                                }
-                                else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
-                                {
-                                    if (LabelInf.Rows[i].Cells["pib_lotno"].Value != null)
-                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_lotno"].Value.ToString();
-                                }
-                                else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
-                                {
-                                    if (LabelInf.Rows[i].Cells["pib_datecode"].Value != null)
-                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_datecode"].Value.ToString();
-                                }
-                                else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("产地"))
-                                {
-                                    if (LabelInf.Rows[i].Cells["pib_madein"].Value != null)
-                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_madein"].Value.ToString();
-                                }
-                                else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("pib_cusbarcode"))
-                                {
-                                    if (LabelInf.Rows[i].Cells["pib_cusbarcode"].Value != null)
-                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_cusbarcode"].Value.ToString();
-                                }
                                 if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
                                 {
-                                    try
-                                    {
-                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
-                                    }
-                                    catch (Exception)
+                                    DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
+                                    if (dr1.Length > 0)
                                     {
-
+                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
                                     }
                                 }
                                 ParamLog.AppendLine("pib_id:" + LabelInf.Rows[i].Cells["pib_id1"].Value.ToString() + ",SingleDoc打印参数【" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(j + 1).Value);
                             }
                             LogManager.DoLog(ParamLog.ToString());
-
                             SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
                             SingleDoc.PrintDocument();
                             if (MidLabelAutoPrint.Checked)
@@ -1775,9 +1719,6 @@ namespace UAS_LabelMachine
                 GetMidBoxData();
             }
             DataTable dt = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + la_id, "select");
-            DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LabelAttachPARAMETER where lap_custcode='" + pi_cardcode.Text + "'", "select");
-            //用标签本身的变量作为最外层的循环条件去匹配;
-            dt.Merge(Attach);
             string[] arg = MidBoxArgument.ToArray();
             for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
             {
@@ -1803,22 +1744,7 @@ namespace UAS_LabelMachine
                             else
                             {
                                 DataRow[] dr = MidBoxCacheData.Select("pib_outboxcode1='" + pib_outboxcode1 + "'");
-                                if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
-                                {
-                                    if (LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value != null)
-                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value.ToString();
-                                }
-                                else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
-                                {
-                                    if (LabelInf.Rows[rowindex].Cells["pib_lotno"].Value != null)
-                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
-                                }
-                                else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
-                                {
-                                    if (LabelInf.Rows[rowindex].Cells["pib_datecode"].Value != null)
-                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
-                                }
-                                else if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
+                                if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
                                 {
                                     if (dr.Length > 0)
                                     {
@@ -1827,13 +1753,10 @@ namespace UAS_LabelMachine
                                 }
                                 if (MidDoc.Variables.FreeVariables.Item(j + 1).Value == "")
                                 {
-                                    try
+                                    DataRow[] dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
+                                    if (dr1.Length > 0)
                                     {
-                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
-                                    }
-                                    catch (Exception)
-                                    {
-
+                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
                                     }
                                 }
                                 LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + sql + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
@@ -1876,45 +1799,24 @@ namespace UAS_LabelMachine
                             }
                             else
                             {
-                                if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
-                                {
-                                    if (LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value != null)
-                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value.ToString();
-                                }
-                                else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
+                                if (sql.ToLower().Contains("pib_qty"))
                                 {
-                                    if (LabelInf.Rows[rowindex].Cells["pib_lotno"].Value != null)
-                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
-                                }
-                                else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
-                                {
-                                    if (LabelInf.Rows[rowindex].Cells["pib_datecode"].Value != null)
-                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
+                                    sql = sql.Substring(0, sql.IndexOf("{")) + pib_id + sql.Substring(sql.IndexOf("}") + 1);
+                                    sql = sql.Substring(0, sql.LastIndexOf("=")) + "='" + pib_outboxcode1 + "' group by pib_outboxcode1";
                                 }
                                 else
                                 {
-                                    if (sql.ToLower().Contains("pib_qty"))
-                                    {
-                                        sql = sql.Substring(0, sql.IndexOf("{")) + pib_id + sql.Substring(sql.IndexOf("}") + 1);
-                                        sql = sql.Substring(0, sql.LastIndexOf("=")) + "='" + pib_outboxcode1 + "' group by pib_outboxcode1";
-                                    }
-                                    else
-                                    {
-                                        sql = sql.Substring(0, sql.IndexOf("{"));
-                                        sql = sql.Substring(0, sql.LastIndexOf("="));
-                                        sql = sql + " in (select distinct pib_outboxcode1 from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "')" + " and pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1='" + pib_outboxcode1 + "'";
-                                    }
-                                    MidDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(sql).ToString();
+                                    sql = sql.Substring(0, sql.IndexOf("{"));
+                                    sql = sql.Substring(0, sql.LastIndexOf("="));
+                                    sql = sql + " in (select distinct pib_outboxcode1 from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "')" + " and pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1='" + pib_outboxcode1 + "'";
                                 }
+                                MidDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(sql).ToString();
                                 if (MidDoc.Variables.FreeVariables.Item(j + 1).Value == "")
                                 {
-                                    try
-                                    {
-                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
-                                    }
-                                    catch (Exception)
+                                    DataRow[] dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
+                                    if (dr1.Length > 0)
                                     {
-
+                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
                                     }
                                 }
                                 LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + sql + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
@@ -1938,9 +1840,6 @@ namespace UAS_LabelMachine
         private void OutBoxCodePrint(string la_id, int rowindex)
         {
             DataTable dt = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + la_id, "select");
-            DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql  from LabelAttachPARAMETER where lap_custcode='" + pi_cardcode.Text + "'", "select");
-            //用标签本身的变量作为最外层的循环条件去匹配;
-            dt.Merge(Attach);
             try
             {
                 for (int j = 0; j < OutBoxDoc.Variables.FreeVariables.Count; j++)
@@ -1951,70 +1850,33 @@ namespace UAS_LabelMachine
                         //名称相等的时候,取SQL进行值的查询
                         if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name == OutLabelParam.Rows[k]["lp_name"].ToString())
                         {
-                            //如果毛重填写的是毛重或者净重
-                            if (OutLabelParam.Rows[k]["lp_valuetype"].ToString() == "字符串" && OutLabelParam.Rows[k]["lp_sql"].ToString() == "GW")
-                            {
-                                OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = WeightGross.Text;
-                                LogManager.DoLog("打印参数【毛重】赋值," + WeightGross.Text);
-                            }
-                            else if (OutLabelParam.Rows[k]["lp_valuetype"].ToString() == "字符串" && OutLabelParam.Rows[k]["lp_sql"].ToString() == "NW")
-                            {
-                                OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = WeightNet.Text;
-                                LogManager.DoLog("打印参数【净重】赋值," + WeightNet.Text);
-                            }
-                            else
+                            //获取对应行的pib_id
+                            string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
+                            string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
+                            //获取打印执行的SQL
+                            string sql = OutLabelParam.Rows[k]["lp_sql"].ToString();
+                            //select * from productiobarcode where pib_id={pib_id} and pib_outboxcode1={pib_outboxcode1}
+                            try
                             {
-                                //获取对应行的pib_id
-                                string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
-                                string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
-                                //获取打印执行的SQL
-                                string sql = OutLabelParam.Rows[k]["lp_sql"].ToString();
-                                //select * from productiobarcode where pib_id={pib_id} and pib_outboxcode1={pib_outboxcode1}
-                                try
+                                string ExeSQL = "";
+                                ExeSQL = sql.ToLower().Replace("{pib_id}", "'" + pib_id + "'");
+                                ExeSQL = ExeSQL.Replace("{pib_outboxcode2}", "'" + pib_outboxcode2 + "'");
+                                OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(ExeSQL).ToString();
+                                if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value == "")
                                 {
-                                    string ExeSQL = "";
-                                    if (sql.ToLower().Contains("pib_lotno"))
-                                        OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
-                                    else if (sql.ToLower().Contains("pib_datecode"))
-                                        OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
-                                    else if (sql.ToLower().Contains("pib_madein"))
-                                        OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_madein"].Value.ToString();
-                                    else if (sql.ToLower().Contains("pib_cusbarcode"))
-                                        OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_cusbarcode"].Value.ToString();
-                                    else if (sql.ToLower().Contains("pib_cusoutboxcode"))
-                                        OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_cusoutboxcode"].Value.ToString();
-                                    else
+                                    DataRow[] dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
+                                    if (dr1.Length > 0)
                                     {
-                                        ExeSQL = sql.ToLower().Replace("{pib_id}", "'" + pib_id + "'");
-                                        ExeSQL = ExeSQL.Replace("{pib_outboxcode2}", "'" + pib_outboxcode2 + "'");
-                                        OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(ExeSQL).ToString();
-                                    }
-                                    if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value == "")
-                                    {
-                                        try
-                                        {
-                                            OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
-                                        }
-                                        catch (Exception)
-                                        {
-
-                                        }
+                                        OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
                                     }
-                                    LogManager.DoLog("打印参数【" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + ExeSQL + ",取到值" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value);
-                                }
-                                catch (Exception)
-                                {
-                                    LogManager.DoLog("SQL维护不正确,请检查SQL语句" + sql);
-                                    MessageBox.Show("SQL维护不正确,请检查SQL语句\n" + sql);
-                                    return;
                                 }
+                                LogManager.DoLog("打印参数【" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + ExeSQL + ",取到值" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value);
                             }
-                        }
-                        else if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name == "DateCode1")
-                        {
-                            if (LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value != null)
+                            catch (Exception)
                             {
-                                OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value.ToString();
+                                LogManager.DoLog("SQL维护不正确,请检查SQL语句" + sql);
+                                MessageBox.Show("SQL维护不正确,请检查SQL语句\n" + sql);
+                                return;
                             }
                         }
                     }
@@ -2421,9 +2283,12 @@ namespace UAS_LabelMachine
                 for (int i = 0; i < LabelInf.Rows.Count; i++)
                 {
                     LabelInf.Rows[i].Cells["pib_outboxcode2"].Value = BoxCode;
-                    if (int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()) % OutboxCapacity.Value == 0)
+                    if (i + 1 < LabelInf.Rows.Count + 1)
                     {
-                        BoxCode = BoxCode + 1;
+                        if (int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()) % OutboxCapacity.Value == 0 && (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() != LabelInf.Rows[i + 1].Cells["pib_outboxcode1"].Value.ToString()))
+                        {
+                            BoxCode = BoxCode + 1;
+                        }
                     }
                 }
             }
@@ -2707,7 +2572,7 @@ namespace UAS_LabelMachine
 
         private void RefreshDBConnect_Tick(object sender, EventArgs e)
         {
-            dh.ExecuteSql("select count(1) from employee", "select");
+            dh.ExecuteSql("select sysdate from dual", "select");
         }
     }
 }

+ 2 - 3
UAS-出货标签管理/生成条码.cs

@@ -88,10 +88,10 @@ namespace UAS_LabelMachine
         private void GenerateBarCode_Click(object sender, EventArgs e)
         {
             //获取编码规则
-            DataTable Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_type,nrd_radix,nrd_sql,nrd_length from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode='" + CustCode + "' and nr_type='Single' order by nrd_detno", "select");
+            DataTable Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_type,nrd_radix,nrd_sql,nrd_length from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode='" + CustCode + "' order by nrd_detno", "select");
             //如果没有则取公共规则
             if (Nr.Rows.Count == 0)
-                Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_radix,nrd_type,nrd_sql,nrd_length from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode is null and nr_type='Single' and nr_isdefault <> 0 order by nrd_detno", "select");
+                Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_radix,nrd_type,nrd_sql,nrd_length from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode is null and nr_isdefault <> 0 order by nrd_detno", "select");
             //用于过滤参数的正则表达式
             Regex match = new Regex("{\\w+}");
             //用于存放每一项的明细的数据
@@ -266,7 +266,6 @@ namespace UAS_LabelMachine
                     else
                     {
                         ErrRowIndex += (i + 1) + ",";
-
                     }
                 }
             }

+ 6 - 2
UAS_DeviceMonitor/Main.Designer.cs

@@ -139,7 +139,7 @@ namespace UAS_DeviceMonitor
             this.GridWorkCenterStatus = new UAS_DeviceMonitor.CustomerControl.AutoDataGridControl.AutoDataGridControl();
             this.GridViewWorkCenterStatus = new UAS_DeviceMonitor.CustomerControl.GridViewWithSerialNum.GridViewWithSerialNum();
             this.TimerDeviceStatus = new System.Windows.Forms.Timer(this.components);
-            this.CommonTipController = new DevExpress.Utils.ToolTipController(this.components);
+            this.CommonTipController = new System.Windows.Forms.ToolTip(this.components);
             ((System.ComponentModel.ISupportInitialize)(this.RibbonNav)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MainTabControl)).BeginInit();
             this.MainTabControl.SuspendLayout();
@@ -1258,6 +1258,10 @@ namespace UAS_DeviceMonitor
             this.TimerDeviceStatus.Interval = 10000;
             this.TimerDeviceStatus.Tick += new System.EventHandler(this.TimerDeviceStatus_Tick);
             // 
+            // CommonTipController
+            // 
+            this.CommonTipController.ShowAlways = true;
+            // 
             // Main
             // 
             this.AllowFormGlass = DevExpress.Utils.DefaultBoolean.False;
@@ -1417,6 +1421,6 @@ namespace UAS_DeviceMonitor
         private GridViewWithSerialNum GridViewWorkCenterStatus;
         private XtraScrollableControl PanelDeviceStatus;
         private PictureEdit pictureEdit1;
-        private DevExpress.Utils.ToolTipController CommonTipController;
+        private System.Windows.Forms.ToolTip CommonTipController;
     }
 }

+ 2 - 4
UAS_DeviceMonitor/Main.cs

@@ -411,7 +411,6 @@ namespace UAS_DeviceMonitor
                 {
                     LastRowCount = Count % CountPerRow;
                 }
-                CommonTipController.ShowBeak = true;
                 for (int i = 0; i < (j == RowCount - 1 ? LastRowCount : CountPerRow); i++)
                 {
                     PictureEditWithText pic = new PictureEditWithText();
@@ -419,15 +418,14 @@ namespace UAS_DeviceMonitor
                     pic.Anchor = AnchorStyles.Left;
                     pic.Anchor = AnchorStyles.Top;
                     pic.Picedit.Properties.SizeMode = PictureSizeMode.Squeeze;
-
                     if (dt.Rows[j * CountPerRow + i]["dpc_status"].ToString() != "Running")
                     {
-                        CommonTipController.SetToolTip(pic, "离线");
+                        CommonTipController.SetToolTip(pic.Picedit, "离线");
                         pic.Picedit.Image = Properties.Resources.network_offline;
                     }
                     else
                     {
-                        CommonTipController.SetToolTip(pic, "在线");
+                        CommonTipController.SetToolTip(pic.Picedit, "在线");
                         pic.Picedit.Image = Properties.Resources.net_connected;
                     }
                     pic.Text = dt.Rows[j * CountPerRow + i]["de_code"].ToString();