Browse Source

导出文件调整

章政 6 years ago
parent
commit
385e6d4d2c

+ 15 - 3
UAS-出货标签管理/UAS_出货标签管理.Designer.cs

@@ -28,7 +28,6 @@
         /// </summary>
         private void InitializeComponent()
         {
-            this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UAS_出货标签打印));
             this.pi_inoutno_label = new System.Windows.Forms.Label();
             this.label1 = new System.Windows.Forms.Label();
@@ -62,7 +61,7 @@
             this.CleanInputAfterCollect = new System.Windows.Forms.CheckBox();
             this.AllCollected = new System.Windows.Forms.Button();
             this.PowerSetting = new System.Windows.Forms.Button();
-            this.RefreshDBConnect = new System.Windows.Forms.Timer(this.components);
+            this.RefreshDBConnect = new System.Windows.Forms.Timer();
             this.GetGridOnly = new System.Windows.Forms.CheckBox();
             this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -90,7 +89,7 @@
             this.dataGridViewTextBoxColumn21 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn22 = 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.ExportFileDialog = new System.Windows.Forms.FolderBrowserDialog();
             this.groupBoxWithBorder1 = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
@@ -178,6 +177,7 @@
             this.OutBoxLabelAutoPrint = new System.Windows.Forms.CheckBox();
             this.OutBoxCombox = new System.Windows.Forms.ComboBox();
             this.AttachInfo = new System.Windows.Forms.Button();
+            this.pi_date = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.Si_ItemDGV)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
             this.groupBoxWithBorder1.SuspendLayout();
@@ -1730,12 +1730,23 @@
             this.AttachInfo.UseVisualStyleBackColor = true;
             this.AttachInfo.Click += new System.EventHandler(this.AttachInfo_Click);
             // 
+            // pi_date
+            // 
+            this.pi_date.AutoSize = true;
+            this.pi_date.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pi_date.Location = new System.Drawing.Point(5, 158);
+            this.pi_date.Name = "pi_date";
+            this.pi_date.Size = new System.Drawing.Size(0, 20);
+            this.pi_date.TabIndex = 86;
+            this.pi_date.Visible = false;
+            // 
             // UAS_出货标签打印
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(233)))), ((int)(((byte)(206)))));
             this.ClientSize = new System.Drawing.Size(1257, 686);
+            this.Controls.Add(this.pi_date);
             this.Controls.Add(this.AttachInfo);
             this.Controls.Add(this.groupBoxWithBorder1);
             this.Controls.Add(this.ChooseAll);
@@ -1954,5 +1965,6 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode2;
         private System.Windows.Forms.Button AttachInfo;
+        private System.Windows.Forms.Label pi_date;
     }
 }

+ 7 - 6
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -1115,11 +1115,12 @@ namespace UAS_LabelMachine
             if (e.KeyCode == Keys.Enter)
             {
                 sql.Clear();
-                sql.Append("select pi_id,pi_cardcode from prodinout where pi_inoutno='" + pi_inoutno.Text + "'");
+                sql.Append("select pi_id,pi_cardcode,to_char(pi_date,'yyyymmdd')pi_date from prodinout where pi_inoutno='" + pi_inoutno.Text + "'");
                 dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 if (dt.Rows.Count > 0)
                 {
                     pi_cardcode.Text = dt.Rows[0]["pi_cardcode"].ToString();
+                    pi_date.Text = dt.Rows[0]["pi_date"].ToString();
                     PI_ID = dt.Rows[0]["pi_id"].ToString();
                     LoadGridData(sender, e);
                     //重新输入单号后清除缓存
@@ -2022,13 +2023,12 @@ namespace UAS_LabelMachine
             else
             {
                 sql.Clear();
-                sql.Append("select pd_custprodcode,pd_custprodspec,pd_pocode,pib_madein,pib_custbarcode,pib_id,pib_datecode1,pib_pdid,pib_piid,pib_pdno,pib_prodcode,pr_brand,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,");
+                sql.Append("select pd_custprodcode,pd_custprodspec,pd_pocode,pib_madein,pib_custbarcode,pib_id,pib_datecode1,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,");
                 sql.Append("pib_lotno,pib_datecode,pib_qty,pib_barcode,pib_outboxcode1,pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint");
-                sql.Append(",sa_pocode from prodiobarcode left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
+                sql.Append(" from prodiobarcode left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
                 sql.Append(" pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode ");
                 sql.Append("where pib_piid='" + PI_ID + "' order by to_number(pib_outboxcode1),pib_id,pd_prodcode");
             }
-            Console.WriteLine(sql.ToString());
             dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
             MidSource.DataSource = dt;
             BaseUtil.FillDgvWithDataTable(LabelInf, (DataTable)MidSource.DataSource);
@@ -2526,13 +2526,14 @@ namespace UAS_LabelMachine
                         if (dt.Columns[i].ColumnName.ToLower() == LabelInf.Columns[j].DataPropertyName.ToLower())
                         {
                             dt.Columns[i].ColumnName = LabelInf.Columns[j].HeaderText;
+                            break;
                         }
                     }
                 }
-                eh.ExportExcel(dt, ExportFileDialog.SelectedPath, 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();
                 if (close.ToString() == "Yes")
-                    System.Diagnostics.Process.Start(ExportFileDialog.SelectedPath + "\\" + pi_inoutno.Text + ".xls");
+                    System.Diagnostics.Process.Start(ExportFileDialog.SelectedPath + "\\" + pi_date.Text + "-" + pi_inoutno.Text + ".xls");
             }
         }
 

+ 1 - 0
UAS-出货标签管理/附件内容打印.cs

@@ -50,6 +50,7 @@ namespace UAS_LabelMachine
                 dh.ExecuteSql(SQL, "insert");
             }
             MessageBox.Show("保存成功");
+            Close();
         }
     }
 }