Pārlūkot izejas kodu

修改导出可选择模板

章政 4 gadi atpakaļ
vecāks
revīzija
fecbc8f41a

+ 8 - 0
UAS-出货标签管理(泽天)/PublicMethod/LogicHandler.cs

@@ -18,5 +18,13 @@ namespace UAS_LabelMachine.PublicMethod
             dh.CallProcedure("SP_GETDATASQL", ref param);
             oSQL = param[2];
         }
+
+        public static void GetExportDataSQL(string iCustCode,string iType, string iText, out string oSQL)
+        {
+            oSQL = "";
+            string[] param = new string[] { iCustCode, iType, iText, oSQL };
+            dh.CallProcedure("sp_getexportDataSql", ref param);
+            oSQL = param[3];
+        }
     }
 }

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 195 - 214
UAS-出货标签管理(泽天)/UAS_出货标签管理.Designer.cs


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

@@ -1367,15 +1367,30 @@ namespace UAS_LabelMachine
 
         private void ExportData_Click(object sender, EventArgs e)
         {
+            ShowMenu.Items.Clear();
+            DataTable dt = (DataTable)dh.ExecuteSql("select * from CS_EXPORTSETTING where es_custcode='" + pi_cardcode.Text + "'", "select");
+            if (dt.Rows.Count == 0)
+                dt = (DataTable)dh.ExecuteSql("select * from CS_EXPORTSETTING where es_custcode is null", "select");
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                ShowMenu.Items.Add(new ToolStripMenuItem(dt.Rows[i]["el_remark"].ToString() + "#" + dt.Rows[i]["el_type"].ToString()));
+            }
+            ShowMenu.Show(new Point(ExportData.Location.X, ExportData.Location.Y + 20));
+        }
+
+        private void ShowMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
+        {
+            //获取类型,单盘或者外箱
+            string type = e.ClickedItem.Text.Split('#')[1];
             ExportFileDialog.Description = "选择导出的路径";
             DialogResult result = ExportFileDialog.ShowDialog();
             if (result == DialogResult.OK)
             {
                 ExcelHandler eh = new ExcelHandler();
-                DataTable Field = (DataTable)dh.ExecuteSql("select * from CS_EXPORTSETTINGdetail left join CS_EXPORTSETTING on es_id=esd_esid where es_custcode='" + pi_cardcode.Text + "' and esd_enable=-1 and esd_filed is not null order by esd_detno", "select");
+                DataTable Field = (DataTable)dh.ExecuteSql("select * from CS_EXPORTSETTINGdetail left join CS_EXPORTSETTING on es_id=esd_esid where es_custcode='" + pi_cardcode.Text + "' and esd_enable=-1 and esd_filed is not null and el_type='" + type + "' order by esd_detno", "select");
                 if (Field.Rows.Count == 0)
                 {
-                    Field = (DataTable)dh.ExecuteSql("select * from CS_EXPORTSETTINGdetail left join CS_EXPORTSETTING on es_id=esd_esid where es_custcode is null and es_isdefault=-1 and esd_enable=-1 and esd_filed is not null order by esd_detno", "select");
+                    Field = (DataTable)dh.ExecuteSql("select * from CS_EXPORTSETTINGdetail left join CS_EXPORTSETTING on es_id=esd_esid where es_custcode is null and es_isdefault=-1 and esd_enable=-1 and esd_filed is not null and el_type='" + type + "'  order by esd_detno", "select");
                 }
                 string Fileds = "";
                 for (int i = 0; i < Field.Rows.Count; i++)
@@ -1383,13 +1398,14 @@ namespace UAS_LabelMachine
                     Fileds += Field.Rows[i]["esd_filed"].ToString() + ",";
                 }
                 sql.Clear();
-                sql.Append("select " + Fileds.Substring(0, Fileds.Length - 1) + " from ExportView where pib_inoutno='" + pi_inoutno.Text + "' order by pib_pdno");
-
-                DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                eh.ExportExcel(dt, Field, ExportFileDialog.SelectedPath, pi_date.Text + "-" + pi_inoutno.Text);
+                sql.Append("select " + Fileds.Substring(0, Fileds.Length - 1) + " from ExportView where pib_inoutno='" + pi_inoutno.Text + "'");
+                string finnalSQL = "";
+                LogicHandler.GetExportDataSQL(pi_cardcode.Text, type, sql.ToString(), out finnalSQL);
+                dt = (DataTable)dh.ExecuteSql(finnalSQL, "select");
+                eh.ExportExcel(dt, Field, ExportFileDialog.SelectedPath, pi_date.Text + "-" + pi_inoutno.Text+ type);
                 string close = MessageBox.Show(this.ParentForm, "导出成功,是否打开文件", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
                 if (close.ToString() == "Yes")
-                    Process.Start(ExportFileDialog.SelectedPath + "\\" + pi_date.Text + "-" + pi_inoutno.Text + ".xls");
+                    Process.Start(ExportFileDialog.SelectedPath + "\\" + pi_date.Text + "-" + pi_inoutno.Text + type + ".xls");
             }
         }
 

+ 3 - 0
UAS-出货标签管理(泽天)/UAS_出货标签管理.resx

@@ -129,6 +129,9 @@
   <metadata name="Com.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>442, 17</value>
   </metadata>
+  <metadata name="ShowMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>521, 17</value>
+  </metadata>
   <metadata name="pd_pdno.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels