Browse Source

勾选自动打印

章政 7 years ago
parent
commit
61cc8655aa

+ 6 - 0
UAS-出货标签管理(泽天)/UAS_出货标签管理.Designer.cs

@@ -237,6 +237,10 @@
             this.Fresh.Text = "刷新";
             this.Fresh.Text = "刷新";
             this.Fresh.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.Refresh_LinkClicked);
             this.Fresh.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.Refresh_LinkClicked);
             // 
             // 
+            // RefreshDBConnect
+            // 
+            this.RefreshDBConnect.Tick += new System.EventHandler(this.RefreshDBConnect_Tick);
+            // 
             // GetGridOnly
             // GetGridOnly
             // 
             // 
             this.GetGridOnly.AutoSize = true;
             this.GetGridOnly.AutoSize = true;
@@ -1030,6 +1034,8 @@
             // SingleLabelAutoPrint
             // SingleLabelAutoPrint
             // 
             // 
             this.SingleLabelAutoPrint.AutoSize = true;
             this.SingleLabelAutoPrint.AutoSize = true;
+            this.SingleLabelAutoPrint.Checked = true;
+            this.SingleLabelAutoPrint.CheckState = System.Windows.Forms.CheckState.Checked;
             this.SingleLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.SingleLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.SingleLabelAutoPrint.Location = new System.Drawing.Point(8, 95);
             this.SingleLabelAutoPrint.Location = new System.Drawing.Point(8, 95);
             this.SingleLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SingleLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);

+ 10 - 12
UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

@@ -129,8 +129,6 @@ namespace UAS_LabelMachine
 
 
         string OutSQL = "";
         string OutSQL = "";
 
 
-        DataTable Attach;
-
         private bool EnablePrint = true;
         private bool EnablePrint = true;
 
 
         string[] PIBID;
         string[] PIBID;
@@ -572,7 +570,7 @@ namespace UAS_LabelMachine
                     }
                     }
                 }
                 }
                 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] + " and lp_name in(" + ParamCondition + ") order by lp_detno", "select");
                 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] + " and lp_name in(" + ParamCondition + ") order by lp_detno", "select");
-                Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "' and lap_param in(" + ParamCondition + ")", "select");
+                DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "' and lap_param in(" + ParamCondition + ")", "select");
                 SingleSQL = "select * from ";
                 SingleSQL = "select * from ";
                 for (int i = 0; i < SingleLabelParam.Rows.Count; i++)
                 for (int i = 0; i < SingleLabelParam.Rows.Count; i++)
                 {
                 {
@@ -626,11 +624,11 @@ namespace UAS_LabelMachine
                     }
                     }
                 }
                 }
                 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] + " and lp_name in(" + ParamCondition + ")  order by lp_detno", "select");
                 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] + " and lp_name in(" + ParamCondition + ")  order by lp_detno", "select");
-                Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "' and lap_param in(" + ParamCondition + ")", "select");
+                DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "' and lap_param in(" + ParamCondition + ")", "select");
                 MidSQL = "select * from ";
                 MidSQL = "select * from ";
                 for (int i = 0; i < MidLabelParam.Rows.Count; i++)
                 for (int i = 0; i < MidLabelParam.Rows.Count; i++)
                 {
                 {
-                    if (i != MidLabelParam.Rows.Count - 1 && Attach.Rows.Count > 0)
+                    if (i != MidLabelParam.Rows.Count - 1 || Attach.Rows.Count > 0)
                         MidSQL += "(" + MidLabelParam.Rows[i]["lp_sql"].ToString() + "),";
                         MidSQL += "(" + MidLabelParam.Rows[i]["lp_sql"].ToString() + "),";
                     else
                     else
                         MidSQL += "(" + MidLabelParam.Rows[i]["lp_sql"].ToString() + ")";
                         MidSQL += "(" + MidLabelParam.Rows[i]["lp_sql"].ToString() + ")";
@@ -681,11 +679,11 @@ namespace UAS_LabelMachine
                     }
                     }
                 }
                 }
                 OutLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + OutBoxCombox.SelectedValue.ToString().Split('#')[0] + " and lp_name in(" + ParamCondition + ")  order by lp_detno", "select");
                 OutLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + OutBoxCombox.SelectedValue.ToString().Split('#')[0] + " and lp_name in(" + ParamCondition + ")  order by lp_detno", "select");
-                Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "' and lap_param in(" + ParamCondition + ")", "select");
+                DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "' and lap_param in(" + ParamCondition + ")", "select");
                 OutSQL = "select * from ";
                 OutSQL = "select * from ";
                 for (int i = 0; i < OutLabelParam.Rows.Count; i++)
                 for (int i = 0; i < OutLabelParam.Rows.Count; i++)
                 {
                 {
-                    if (i != OutLabelParam.Rows.Count - 1)
+                    if (i != OutLabelParam.Rows.Count - 1 || Attach.Rows.Count > 0)
                         OutSQL += "(" + OutLabelParam.Rows[i]["lp_sql"].ToString() + "),";
                         OutSQL += "(" + OutLabelParam.Rows[i]["lp_sql"].ToString() + "),";
                     else
                     else
                         OutSQL += "(" + OutLabelParam.Rows[i]["lp_sql"].ToString() + ")";
                         OutSQL += "(" + OutLabelParam.Rows[i]["lp_sql"].ToString() + ")";
@@ -923,6 +921,7 @@ namespace UAS_LabelMachine
                 stw = new SetLoadingWindow(thread, "正在打印单盘");
                 stw = new SetLoadingWindow(thread, "正在打印单盘");
                 BaseUtil.SetFormCenter(stw);
                 BaseUtil.SetFormCenter(stw);
                 stw.ShowDialog();
                 stw.ShowDialog();
+                Input.Focus();
             }
             }
             else
             else
             {
             {
@@ -1225,7 +1224,7 @@ namespace UAS_LabelMachine
                         //获取对应行的pib_id
                         //获取对应行的pib_id
                         string ParamName = OutLabelParam.Rows[k]["lp_name"].ToString();
                         string ParamName = OutLabelParam.Rows[k]["lp_name"].ToString();
                         OutBoxDoc.Variables.FreeVariables.Item(ParamName).Value = dt.Rows[0][k].ToString();
                         OutBoxDoc.Variables.FreeVariables.Item(ParamName).Value = dt.Rows[0][k].ToString();
-                        LogManager.DoLog("打印参数【" + OutBoxDoc.Variables.FreeVariables.Item(ParamName).Name + "】赋值" + ",取到值" + OutBoxDoc.Variables.FreeVariables.Item(ParamName).Value);
+                        LogManager.DoLog("打印参数【" + OutBoxDoc.Variables.FreeVariables.Item(ParamName).Name + "】赋值" + ",取到值" + OutBoxDoc.Variables.FreeVariables.Item(ParamName).Value);
                     }
                     }
                     //保存参数打印
                     //保存参数打印
                     OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
                     OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
@@ -1271,6 +1270,7 @@ namespace UAS_LabelMachine
                 stw = new SetLoadingWindow(thread, "正在打印外箱");
                 stw = new SetLoadingWindow(thread, "正在打印外箱");
                 BaseUtil.SetFormCenter(stw);
                 BaseUtil.SetFormCenter(stw);
                 stw.ShowDialog();
                 stw.ShowDialog();
+                Input.Focus();
             }
             }
             else
             else
                 MessageBox.Show("未维护外箱标签", "提示");
                 MessageBox.Show("未维护外箱标签", "提示");
@@ -1511,7 +1511,7 @@ namespace UAS_LabelMachine
                 eh.ExportExcel(dt, ExportFileDialog.SelectedPath, pi_date.Text + "-" + pi_inoutno.Text);
                 eh.ExportExcel(dt, ExportFileDialog.SelectedPath, pi_date.Text + "-" + pi_inoutno.Text);
                 string close = MessageBox.Show(this.ParentForm, "导出成功,是否打开文件", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
                 string close = MessageBox.Show(this.ParentForm, "导出成功,是否打开文件", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
                 if (close.ToString() == "Yes")
                 if (close.ToString() == "Yes")
-                    System.Diagnostics.Process.Start(ExportFileDialog.SelectedPath + "\\" + pi_date.Text + "-" + pi_inoutno.Text + ".xls");
+                    Process.Start(ExportFileDialog.SelectedPath + "\\" + pi_date.Text + "-" + pi_inoutno.Text + ".xls");
             }
             }
         }
         }
 
 
@@ -1545,7 +1545,7 @@ namespace UAS_LabelMachine
 
 
         private void RefreshDBConnect_Tick(object sender, EventArgs e)
         private void RefreshDBConnect_Tick(object sender, EventArgs e)
         {
         {
-            dh.ExecuteSql("select count(1) from employee", "select");
+            dh.ExecuteSql("select sysdate from dual", "select");
         }
         }
 
 
         private void LoadPrcodeData()
         private void LoadPrcodeData()
@@ -1563,8 +1563,6 @@ namespace UAS_LabelMachine
             }
             }
         }
         }
 
 
-
-
         private void OutBoxNum_Click(object sender, EventArgs e)
         private void OutBoxNum_Click(object sender, EventArgs e)
         {
         {
             OutBoxNum.Items.Clear();
             OutBoxNum.Items.Clear();