Browse Source

代码优化

章政 7 years ago
parent
commit
6978acdeb0

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

@@ -27,7 +27,7 @@ namespace UAS_LabelMachine.PublicForm
             loadingCircle1.OuterCircleRadius = 20;
             loadingCircle1.OuterCircleRadius = 20;
             loadingCircle1.InnerCircleRadius = 12;
             loadingCircle1.InnerCircleRadius = 12;
             loadingCircle1.Active = true;
             loadingCircle1.Active = true;
-            
+            LoadingThread.ApartmentState = ApartmentState.STA;
             LoadingThread.Start();
             LoadingThread.Start();
             //在本窗体新建一个进程用来判断传递的进程是否执行结束
             //在本窗体新建一个进程用来判断传递的进程是否执行结束
             Thread t1 = new Thread(SetLoadFinish);
             Thread t1 = new Thread(SetLoadFinish);

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

@@ -28,7 +28,6 @@
         /// </summary>
         /// </summary>
         private void InitializeComponent()
         private void InitializeComponent()
         {
         {
-            this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UAS_出货标签打印));
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UAS_出货标签打印));
             this.pi_inoutno_label = new System.Windows.Forms.Label();
             this.pi_inoutno_label = new System.Windows.Forms.Label();
             this.label24 = new System.Windows.Forms.Label();
             this.label24 = new System.Windows.Forms.Label();
@@ -38,7 +37,7 @@
             this.pi_cardcode = new System.Windows.Forms.Label();
             this.pi_cardcode = new System.Windows.Forms.Label();
             this.pi_cardcode_label = new System.Windows.Forms.Label();
             this.pi_cardcode_label = new System.Windows.Forms.Label();
             this.Fresh = new System.Windows.Forms.LinkLabel();
             this.Fresh = new System.Windows.Forms.LinkLabel();
-            this.RefreshDBConnect = new System.Windows.Forms.Timer(this.components);
+            this.RefreshDBConnect = new System.Windows.Forms.Timer();
             this.GetGridOnly = new System.Windows.Forms.CheckBox();
             this.GetGridOnly = new System.Windows.Forms.CheckBox();
             this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -66,7 +65,7 @@
             this.dataGridViewTextBoxColumn21 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn21 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn22 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn22 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn23 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn23 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.MidSource = new System.Windows.Forms.BindingSource(this.components);
+            this.MidSource = new System.Windows.Forms.BindingSource();
             this.ChooseAll = new System.Windows.Forms.Button();
             this.ChooseAll = new System.Windows.Forms.Button();
             this.ExportFileDialog = new System.Windows.Forms.FolderBrowserDialog();
             this.ExportFileDialog = new System.Windows.Forms.FolderBrowserDialog();
             this.AttachInfo = new System.Windows.Forms.Button();
             this.AttachInfo = new System.Windows.Forms.Button();
@@ -254,7 +253,6 @@
             this.GetGridOnly.TabIndex = 82;
             this.GetGridOnly.TabIndex = 82;
             this.GetGridOnly.Text = "仅获取表格";
             this.GetGridOnly.Text = "仅获取表格";
             this.GetGridOnly.UseVisualStyleBackColor = true;
             this.GetGridOnly.UseVisualStyleBackColor = true;
-            this.GetGridOnly.Visible = false;
             // 
             // 
             // dataGridViewCheckBoxColumn1
             // dataGridViewCheckBoxColumn1
             // 
             // 

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

@@ -490,7 +490,7 @@ namespace UAS_LabelMachine
                 }
                 }
             if (MidLabelCombox.Text != "")
             if (MidLabelCombox.Text != "")
             {
             {
-                MidReport.Load(ftpOperater.DownLoadTo+ MidLabelCombox.Text);
+                MidReport.Load(ftpOperater.DownLoadTo + MidLabelCombox.Text);
             }
             }
             //缓存中盒参数
             //缓存中盒参数
             sql.Clear();
             sql.Clear();
@@ -759,7 +759,15 @@ namespace UAS_LabelMachine
                 }
                 }
                 for (int i = 0; i < MidOutBoxCodeIndex.Count; i++)
                 for (int i = 0; i < MidOutBoxCodeIndex.Count; i++)
                 {
                 {
-                    MidBoxCodePrint(la_id, MidOutBoxCodeIndex[i]);
+                    try
+                    {
+                        MidBoxCodePrint(la_id, MidOutBoxCodeIndex[i]);
+                    }
+                    catch (Exception e)
+                    {
+                        MessageBox.Show(e.Message);
+                        return;
+                    }
                 }
                 }
                 return;
                 return;
             }
             }
@@ -815,34 +823,26 @@ namespace UAS_LabelMachine
             {
             {
                 for (int i = 0; i < LabelInf.RowCount; i++)
                 for (int i = 0; i < LabelInf.RowCount; i++)
                 {
                 {
-                    if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString().ToLower() == "true")
-                    {
-                        string outboxcode2 = LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString();
-                        //富为使用包装单的逻辑
-                        //如果不包含该箱号则进行添加
-                        if (!Outboxcode.Contains(outboxcode2))
-                            Outboxcode.Add(outboxcode2);
-                    }
+                    string outboxcode2 = LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString();
+                    //富为使用包装单的逻辑
+                    //如果不包含该箱号则进行添加
+                    if (!Outboxcode.Contains(outboxcode2))
+                        Outboxcode.Add(outboxcode2);
                 }
                 }
                 //按获取到的箱号列表进行打印
                 //按获取到的箱号列表进行打印
                 if (Outboxcode.ToArray().Length > 0)
                 if (Outboxcode.ToArray().Length > 0)
                 {
                 {
-                    //try
-                    //{
-                        // 循环打印外箱号
-                        for (int i = 0; i < Outboxcode.ToArray().Length; i++)
+                    for (int i = 0; i < Outboxcode.ToArray().Length; i++)
+                    {
+                        for (int h = 0; h < LabelInf.RowCount; h++)
                         {
                         {
-                            for (int h = 0; h < LabelInf.RowCount; h++)
+                            if (LabelInf.Rows[h].Cells["pib_outboxcode2"].Value.ToString() == Outboxcode.ToArray()[i])
                             {
                             {
-                                if (LabelInf.Rows[h].Cells["pib_outboxcode2"].Value.ToString() == Outboxcode.ToArray()[i])
-                                {
-                                    OutBoxCodePrint(la_id, h);
-                                    break;
-                                }
+                                OutBoxCodePrint(la_id, h);
+                                break;
                             }
                             }
                         }
                         }
-                    //}
-                    //catch { }
+                    }
                 }
                 }
                 else
                 else
                 {
                 {
@@ -894,19 +894,12 @@ namespace UAS_LabelMachine
                 //名称相等的时候,取SQL进行值的查询
                 //名称相等的时候,取SQL进行值的查询
                 string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
                 string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
                 string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
                 string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
-                DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiomidinfo_view where =" + pib_id + "' and 中盒号='" + pib_outboxcode1 + "'", "select");
+                DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiomidinfo_view where 出货单号='" + pi_inoutno.Text + "' and 中盒号='" + pib_outboxcode1 + "'", "select");
                 MidReport.RegisterData(dt, "prodiomidinfo_view");
                 MidReport.RegisterData(dt, "prodiomidinfo_view");
                 MidReport.GetDataSource("prodiomidinfo_view").Enabled = true;
                 MidReport.GetDataSource("prodiomidinfo_view").Enabled = true;
+                MidReport.PrintSettings.ShowDialog = false;
                 MidReport.PrintSettings.Printer = MidLabelPrinter.Text;
                 MidReport.PrintSettings.Printer = MidLabelPrinter.Text;
-                try
-                {
-                    MidReport.Print();
-                }
-                catch (Exception e)
-                {
-                    MessageBox.Show(e.Message);
-                    return;
-                }
+                MidReport.Print();
                 Properties.Settings.Default.MPrinter = MidLabelPrinter.Text;
                 Properties.Settings.Default.MPrinter = MidLabelPrinter.Text;
                 Properties.Settings.Default.Save();
                 Properties.Settings.Default.Save();
             }
             }
@@ -1430,13 +1423,13 @@ namespace UAS_LabelMachine
         private void PrintFooter_Click(object sender, EventArgs e)
         private void PrintFooter_Click(object sender, EventArgs e)
         {
         {
             DataTable dt = (DataTable)dh.ExecuteSql("select pib_outboxcode2,max(pib_id) pib_id from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' group by pib_outboxcode2 order by pib_outboxcode2", "select");
             DataTable dt = (DataTable)dh.ExecuteSql("select pib_outboxcode2,max(pib_id) pib_id from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' group by pib_outboxcode2 order by pib_outboxcode2", "select");
-            string SQL = "select pib_outboxcode2||'/'||(select max(pib_outboxcode2) from prodiobarcode where pib_inoutno='"+pi_inoutno.Text+"') from prodiobarcode  where pib_id=";
+            string SQL = "select pib_outboxcode2||'/'||(select max(pib_outboxcode2) from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "') from prodiobarcode  where pib_id=";
             for (int i = 0; i < dt.Rows.Count; i++)
             for (int i = 0; i < dt.Rows.Count; i++)
             {
             {
-                DataTable dt1 = (DataTable)dh.ExecuteSql(SQL+dt.Rows[i]["pib_id"].ToString(), "select");
+                DataTable dt1 = (DataTable)dh.ExecuteSql(SQL + dt.Rows[i]["pib_id"].ToString(), "select");
                 FootReport.SetParameterValue("唛头", dt1.Rows[0][0].ToString());
                 FootReport.SetParameterValue("唛头", dt1.Rows[0][0].ToString());
                 FootReport.PrintSettings.ShowDialog = false;
                 FootReport.PrintSettings.ShowDialog = false;
-                FootReport.PrintSettings.Printer= SingleLabelPrinter.Text;
+                FootReport.PrintSettings.Printer = SingleLabelPrinter.Text;
                 FootReport.Print();
                 FootReport.Print();
             }
             }
             LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "打印唛头", "成功");
             LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "打印唛头", "成功");

+ 30 - 15
UAS-出货标签管理(泽天)/客户标签维护.Designer.cs

@@ -55,7 +55,7 @@ namespace UAS_LabelMachine
             this.la_name = new System.Windows.Forms.TextBox();
             this.la_name = new System.Windows.Forms.TextBox();
             this.la_name_label = new System.Windows.Forms.Label();
             this.la_name_label = new System.Windows.Forms.Label();
             this.FTPShare = new System.Windows.Forms.CheckBox();
             this.FTPShare = new System.Windows.Forms.CheckBox();
-            this.CodeSoft = new System.Windows.Forms.RadioButton();
+            this.FastReport = new System.Windows.Forms.RadioButton();
             this.pictureBox1 = new System.Windows.Forms.PictureBox();
             this.pictureBox1 = new System.Windows.Forms.PictureBox();
             this.pagination1 = new UAS_LabelMachine.CustomControl.Pagination();
             this.pagination1 = new UAS_LabelMachine.CustomControl.Pagination();
             this.NewLabel = new UAS_LabelMachine.CustomControl.NormalButton();
             this.NewLabel = new UAS_LabelMachine.CustomControl.NormalButton();
@@ -273,19 +273,19 @@ namespace UAS_LabelMachine
             this.FTPShare.Text = "FTP共享";
             this.FTPShare.Text = "FTP共享";
             this.FTPShare.UseVisualStyleBackColor = true;
             this.FTPShare.UseVisualStyleBackColor = true;
             // 
             // 
-            // CodeSoft
+            // FastReport
             // 
             // 
-            this.CodeSoft.AutoSize = true;
-            this.CodeSoft.Checked = true;
-            this.CodeSoft.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CodeSoft.Location = new System.Drawing.Point(1058, 86);
-            this.CodeSoft.Name = "CodeSoft";
-            this.CodeSoft.Size = new System.Drawing.Size(99, 25);
-            this.CodeSoft.TabIndex = 161;
-            this.CodeSoft.TabStop = true;
-            this.CodeSoft.Text = "CodeSoft";
-            this.CodeSoft.UseVisualStyleBackColor = true;
-            this.CodeSoft.Visible = false;
+            this.FastReport.AutoSize = true;
+            this.FastReport.Checked = true;
+            this.FastReport.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.FastReport.Location = new System.Drawing.Point(1058, 86);
+            this.FastReport.Name = "FastReport";
+            this.FastReport.Size = new System.Drawing.Size(110, 25);
+            this.FastReport.TabIndex = 161;
+            this.FastReport.TabStop = true;
+            this.FastReport.Text = "FastReport";
+            this.FastReport.UseVisualStyleBackColor = true;
+            this.FastReport.Visible = false;
             // 
             // 
             // pictureBox1
             // pictureBox1
             // 
             // 
@@ -332,17 +332,22 @@ namespace UAS_LabelMachine
             // 
             // 
             // la_code
             // la_code
             // 
             // 
+            this.la_code.AllPower = null;
             this.la_code.Caller = null;
             this.la_code.Caller = null;
             this.la_code.Condition = null;
             this.la_code.Condition = null;
+            this.la_code.DBTitle = null;
             this.la_code.FormName = null;
             this.la_code.FormName = null;
             this.la_code.Location = new System.Drawing.Point(659, 455);
             this.la_code.Location = new System.Drawing.Point(659, 455);
             this.la_code.Name = "la_code";
             this.la_code.Name = "la_code";
+            this.la_code.Power = null;
+            this.la_code.ReturnData = null;
             this.la_code.SelectField = null;
             this.la_code.SelectField = null;
             this.la_code.SetValueField = null;
             this.la_code.SetValueField = null;
             this.la_code.Size = new System.Drawing.Size(161, 21);
             this.la_code.Size = new System.Drawing.Size(161, 21);
             this.la_code.TabIndex = 179;
             this.la_code.TabIndex = 179;
             this.la_code.TableName = null;
             this.la_code.TableName = null;
             this.la_code.Tag = "la_code";
             this.la_code.Tag = "la_code";
+            this.la_code.TextBoxEnable = false;
             // 
             // 
             // Save
             // Save
             // 
             // 
@@ -519,31 +524,41 @@ namespace UAS_LabelMachine
             // 
             // 
             // 客户编号
             // 客户编号
             // 
             // 
+            this.客户编号.AllPower = null;
             this.客户编号.Caller = null;
             this.客户编号.Caller = null;
             this.客户编号.Condition = null;
             this.客户编号.Condition = null;
+            this.客户编号.DBTitle = null;
             this.客户编号.FormName = null;
             this.客户编号.FormName = null;
             this.客户编号.Location = new System.Drawing.Point(116, 453);
             this.客户编号.Location = new System.Drawing.Point(116, 453);
             this.客户编号.Name = "客户编号";
             this.客户编号.Name = "客户编号";
+            this.客户编号.Power = null;
+            this.客户编号.ReturnData = null;
             this.客户编号.SelectField = null;
             this.客户编号.SelectField = null;
             this.客户编号.SetValueField = null;
             this.客户编号.SetValueField = null;
             this.客户编号.Size = new System.Drawing.Size(136, 21);
             this.客户编号.Size = new System.Drawing.Size(136, 21);
             this.客户编号.TabIndex = 168;
             this.客户编号.TabIndex = 168;
             this.客户编号.TableName = null;
             this.客户编号.TableName = null;
             this.客户编号.Tag = "cu_code";
             this.客户编号.Tag = "cu_code";
+            this.客户编号.TextBoxEnable = false;
             // 
             // 
             // cu_code
             // cu_code
             // 
             // 
+            this.cu_code.AllPower = null;
             this.cu_code.Caller = null;
             this.cu_code.Caller = null;
             this.cu_code.Condition = null;
             this.cu_code.Condition = null;
+            this.cu_code.DBTitle = null;
             this.cu_code.FormName = null;
             this.cu_code.FormName = null;
             this.cu_code.Location = new System.Drawing.Point(127, 16);
             this.cu_code.Location = new System.Drawing.Point(127, 16);
             this.cu_code.Name = "cu_code";
             this.cu_code.Name = "cu_code";
+            this.cu_code.Power = null;
+            this.cu_code.ReturnData = null;
             this.cu_code.SelectField = null;
             this.cu_code.SelectField = null;
             this.cu_code.SetValueField = null;
             this.cu_code.SetValueField = null;
             this.cu_code.Size = new System.Drawing.Size(150, 21);
             this.cu_code.Size = new System.Drawing.Size(150, 21);
             this.cu_code.TabIndex = 159;
             this.cu_code.TabIndex = 159;
             this.cu_code.TableName = null;
             this.cu_code.TableName = null;
             this.cu_code.Tag = "cl_custcode";
             this.cu_code.Tag = "cl_custcode";
+            this.cu_code.TextBoxEnable = false;
             // 
             // 
             // UpdateGrid
             // UpdateGrid
             // 
             // 
@@ -612,7 +627,7 @@ namespace UAS_LabelMachine
             this.Controls.Add(this.PrintTest);
             this.Controls.Add(this.PrintTest);
             this.Controls.Add(this.客户编号);
             this.Controls.Add(this.客户编号);
             this.Controls.Add(this.label1);
             this.Controls.Add(this.label1);
-            this.Controls.Add(this.CodeSoft);
+            this.Controls.Add(this.FastReport);
             this.Controls.Add(this.cu_code);
             this.Controls.Add(this.cu_code);
             this.Controls.Add(this.UpdateGrid);
             this.Controls.Add(this.UpdateGrid);
             this.Controls.Add(this.Screen);
             this.Controls.Add(this.Screen);
@@ -671,7 +686,7 @@ namespace UAS_LabelMachine
         private CheckBox FTPShare;
         private CheckBox FTPShare;
         private NormalButton NewLabel;
         private NormalButton NewLabel;
         private Pagination pagination1;
         private Pagination pagination1;
-        private RadioButton CodeSoft;
+        private RadioButton FastReport;
         private DataGridViewCheckBoxColumn Choose;
         private DataGridViewCheckBoxColumn Choose;
         private DataGridViewTextBoxColumn la_id;
         private DataGridViewTextBoxColumn la_id;
         private DataGridViewTextBoxColumn cu_name1;
         private DataGridViewTextBoxColumn cu_name1;

+ 5 - 5
UAS-出货标签管理(泽天)/客户标签维护.cs

@@ -167,9 +167,9 @@ namespace UAS_LabelMachine
         {
         {
             string LabelSoft = "";
             string LabelSoft = "";
             //需要处理新增的行和原有数据然后更新的行
             //需要处理新增的行和原有数据然后更新的行
-            if (CodeSoft.Checked)
+            if (FastReport.Checked)
             {
             {
-                LabelSoft = "CodeSoft";
+                LabelSoft = "FastReport";
             }
             }
             DataTable dt = (DataTable)LabelDataGridView.DataSource;
             DataTable dt = (DataTable)LabelDataGridView.DataSource;
             //如果有改变的行才传递到后台
             //如果有改变的行才传递到后台
@@ -203,7 +203,7 @@ namespace UAS_LabelMachine
         private void OpenFolder_Click(object sender, EventArgs e)
         private void OpenFolder_Click(object sender, EventArgs e)
         {
         {
             //根据勾选的不同设置不同的文件后缀过滤
             //根据勾选的不同设置不同的文件后缀过滤
-            if (CodeSoft.Checked)
+            if (FastReport.Checked)
             {
             {
                 openFileDialog1.Filter = "(*.frx)|*.frx";
                 openFileDialog1.Filter = "(*.frx)|*.frx";
             }
             }
@@ -315,7 +315,7 @@ namespace UAS_LabelMachine
                 {
                 {
                     ftpOperater ftp = new ftpOperater();
                     ftpOperater ftp = new ftpOperater();
                     ftp.UpLoadFile(sourcePath, fileName);
                     ftp.UpLoadFile(sourcePath, fileName);
-                    string SoftWare = "CodeSoft";
+                    string SoftWare = "FastReport";
                     if (CL_ID2 != null)
                     if (CL_ID2 != null)
                     {
                     {
                         sql.Clear();
                         sql.Clear();
@@ -356,7 +356,7 @@ namespace UAS_LabelMachine
                             Directory.CreateDirectory(targetPath);
                             Directory.CreateDirectory(targetPath);
                         //将文件复制到指定位置
                         //将文件复制到指定位置
                         File.Copy(sourceFile, destFile, true);
                         File.Copy(sourceFile, destFile, true);
-                        string SoftWare = "CodeSoft";
+                        string SoftWare = "FastReport";
                         sql.Clear();
                         sql.Clear();
                         sql.Append("insert into customerlabel (cl_id,cl_labelcode,cl_custcode,cl_labeltype,cl_labelurl,cl_labelname,cl_labelsoft,cl_date) values( customerlabel_seq.nextval, ");
                         sql.Append("insert into customerlabel (cl_id,cl_labelcode,cl_custcode,cl_labeltype,cl_labelurl,cl_labelname,cl_labelsoft,cl_date) values( customerlabel_seq.nextval, ");
                         sql.Append("'" + la_code.Text + "','" + (客户编号.Text == "" ? "共用" : 客户编号.Text) + "','" + la_type1.Text + "','" + destFile + "','" + la_name.Text + "','" + SoftWare + "',sysdate)");
                         sql.Append("'" + la_code.Text + "','" + (客户编号.Text == "" ? "共用" : 客户编号.Text) + "','" + la_type1.Text + "','" + destFile + "','" + la_name.Text + "','" + SoftWare + "',sysdate)");