Browse Source

修改提交

章政 6 years ago
parent
commit
06cd74bb7b
1 changed files with 96 additions and 0 deletions
  1. 96 0
      UAS-出货标签管理(贸易版)/ExportExcel.cs

+ 96 - 0
UAS-出货标签管理(贸易版)/ExportExcel.cs

@@ -130,5 +130,101 @@ namespace UAS_LabelMachine
         {
 
         }
+
+        private void ExportSetting_Click(object sender, EventArgs e)
+        {
+            StringBuilder sql = new StringBuilder();
+            List<CheckBox> conditionbox = new List<CheckBox>();
+            string custcode = dh.getFieldDataByCondition("prodinout", "pi_cardcode", "pi_inoutno='" + inoutno + "'").ToString();
+            if (!CH_PBCODE.Checked && BoxCode.Checked)
+            {
+                MessageBox.Show("勾选盒号分页,打印内容请勾选盒号");
+                return;
+            }
+            if (!CH_SPLITBATCH.Checked && BatchCode.Checked)
+            {
+                MessageBox.Show("勾选扩撒批分页,打印内容请勾选扩撒批号");
+                return;
+            }
+            conditionbox.Add(CH_BLUEFILM);
+            conditionbox.Add(CH_PBCODE);
+            conditionbox.Add(CH_REMARK);
+            conditionbox.Add(CH_SPLITBATCH);
+            conditionbox.Add(CH_WATERID);
+            conditionbox.Add(ch_code);
+            conditionbox.Add(percent);
+            conditionbox.Add(TS);
+            conditionbox.Add(BVCEO);
+            conditionbox.Add(FirstPage_WID);
+            conditionbox.Add(FirstPage_YIELD);
+            conditionbox.Add(FirstPage_REMARK);
+            string SplitType = "";
+            if (FixRow.Checked)
+            {
+                SplitType = FixRow.Name;
+            }
+            else if (BatchCode.Checked)
+            {
+                SplitType = BatchCode.Name;
+            }
+            else if (BoxCode.Checked)
+            {
+                SplitType = BoxCode.Name;
+            }
+            DataTable SQL1_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='DataPage' and es_enable=-1 and es_custcode='" + custcode + "' and nvl(es_istitle,0)<>-1 order by es_detno", "select");
+            //没有置顶客户的取空的
+            if (SQL1_.Rows.Count == 0)
+            {
+                SQL1_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='DataPage' and es_enable=-1 and es_custcode is null  and nvl(es_istitle,0)<>-1 order by es_detno", "select");
+            }
+            string es_field1 = "";
+            for (int i = 0; i < SQL1_.Rows.Count; i++)
+            {
+                es_field1 += SQL1_.Rows[i]["es_prefix"].ToString() + "||" + SQL1_.Rows[i]["es_filed"].ToString() + "||" + SQL1_.Rows[i]["es_suffix"].ToString() + ",";
+            }
+            //分页信息的DataTable
+            sql.Clear();
+            sql.Append("select " + es_field1.Substring(0, es_field1.Length - 1) + " from  prodinout left join prodiodetail on pi_id=pd_piid left join ");
+            sql.Append("chip_in_out on pd_id=io_pdid left join chip on ch_code=io_chipcode left join CHIP_WAFERTEST_VIEW on ch_code=chw_chipcode ");
+            sql.Append("left join CHIP_EDCDATA_VIEW on che_chipcode=ch_code left join product on pr_code=pd_prodcode left join prodiobarcode on ");
+            sql.Append("pib_piid=pi_id and pib_custbarcode=ch_code where pi_inoutno='" + inoutno + "' order by ch_code");
+            DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+
+            for (int i = 0; i < dt.Columns.Count; i++)
+            {
+                if (dt.Columns[i].ColumnName == (SQL1_.Rows[i]["es_prefix"].ToString() + "||" + SQL1_.Rows[i]["es_filed"].ToString() + "||" + SQL1_.Rows[i]["es_suffix"].ToString()).ToUpper())
+                {
+                    dt.Columns[i].Caption = SQL1_.Rows[i]["es_filed1"].ToString();
+                    dt.Columns[i].ColumnName = SQL1_.Rows[i]["es_caption"].ToString();
+                }
+            }
+
+            //获取首页需要展示的字段
+            DataTable SQL_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='First' and es_enable=-1 and es_custcode='" + custcode + "' and nvl(es_istitle,0)<>-1 order by es_detno", "select");
+            if (SQL_.Rows.Count == 0)
+            {
+                SQL_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='First' and es_enable=-1 and es_custcode is null and  nvl(es_istitle,0)<>-1 order by es_detno", "select");
+            }
+            string es_field = "";
+            for (int i = 0; i < SQL_.Rows.Count; i++)
+            {
+                es_field += SQL_.Rows[i]["es_prefix"].ToString() + "||" + SQL_.Rows[i]["es_filed"].ToString() + "||" + SQL_.Rows[i]["es_suffix"].ToString() + ",";
+            }
+            //首页信息的DataTable
+            sql.Clear();
+            sql.Append("select " + es_field.Substring(0, es_field.Length - 1) + "  from FIRSTPAGE_BATCH_VIEW where pi_inoutno='" + inoutno + "'");
+            DataTable dt1 = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            for (int i = 0; i < dt1.Columns.Count; i++)
+            {
+                if (dt1.Columns[i].ColumnName == (SQL_.Rows[i]["es_prefix"].ToString() + "||" + SQL_.Rows[i]["es_filed"].ToString() + "||" + SQL_.Rows[i]["es_suffix"].ToString()).ToUpper())
+                {
+                    dt1.Columns[i].Caption = SQL_.Rows[i]["es_filed1"].ToString();
+                    dt1.Columns[i].ColumnName = SQL_.Rows[i]["es_caption"].ToString();
+                }
+            }
+            ExportColumns ex = new ExportColumns(dt, dt1);
+            ex.WindowState = FormWindowState.Maximized;
+            ex.ShowDialog();
+        }
     }
 }