Browse Source

特殊报表修改

callm 5 months ago
parent
commit
5908b6e647

+ 16 - 2
UAS_MES_LGDZ/DataOperate/ExcelHandler.cs

@@ -75,6 +75,12 @@ namespace UAS_MES_NEW.DataOperate
             string SheetName = "";
             //表格数据游标
             int DataRowCount = 8;
+            string sumqty = "";
+            for (int i = 0; i < 10; i++)
+            {
+                if (sumqty == "")
+                    sumqty = DataTable.Rows[i]["sumqty"].ToString();
+            }
             for (int i = 0; i < DataTable.Rows.Count; i++)
             {
                 if (DataTable.Rows[i]["STF_MACHINE"].ToString() != "" && DataTable.Rows[i]["STF_MACHINE"].ToString() != "***" && i != DataTable.Rows.Count - 1)
@@ -84,8 +90,16 @@ namespace UAS_MES_NEW.DataOperate
                     ISheet sheet1 = book.CreateSheet(DataTable.Rows[i]["STF_MACHINE"].ToString() + "-" + DataTable.Rows[i + 1]["STF_MACHINE"].ToString().Substring(0, 1));
                     SheetName = DataTable.Rows[i]["STF_MACHINE"].ToString() + "-" + DataTable.Rows[i + 1]["STF_MACHINE"].ToString().Substring(0, 1);
                     IRow row1 = sheet1.CreateRow(0);
-                    row1.CreateCell(0); row1.Cells[0].SetCellValue("       SMT程式料表     ");
+                    row1.CreateCell(0); row1.CreateCell(1); row1.Cells[0].SetCellValue("       SMT程式料表     ");
+                    row1.Cells[0].CellStyle = style; row1.Cells[1].CellStyle = style;
+                    row1.CreateCell(2); row1.CreateCell(3);
 
+                    row1.Cells[2].CellStyle = style;
+                    row1.Cells[2].CellStyle = style; row1.Cells[3].CellStyle = style;
+                    row1.CreateCell(4); row1.CreateCell(5); row1.Cells[4].SetCellValue("点数:" + sumqty); row1.Cells[4].CellStyle = style;
+                    row1.Cells[4].CellStyle = style; row1.Cells[5].CellStyle = style;
+                    row1.CreateCell(6); row1.CreateCell(7); row1.Cells[6].CellStyle = style;
+                    row1.Cells[6].CellStyle = style; row1.Cells[7].CellStyle = style;
 
                     //客户抬头
                     IRow row2 = sheet1.CreateRow(1);
@@ -134,7 +148,7 @@ namespace UAS_MES_NEW.DataOperate
                     sheet1.AddMergedRegion(cellRangeAddress10);
                     row4.CreateCell(0); row4.CreateCell(1); row4.Cells[0].SetCellValue("程序名称\t\r\n");
                     row4.Cells[0].CellStyle = style; row4.Cells[1].CellStyle = style;
-                    row4.CreateCell(2); row4.CreateCell(3); row4.Cells[2].SetCellValue("CY-it9220-LS2404-B1-V2.0-MB\t\r\n");
+                    row4.CreateCell(2); row4.CreateCell(3); row4.Cells[2].SetCellValue(DataTable.Rows[i]["STF_CODE"].ToString() + "\t\r\n");
                     row4.Cells[2].CellStyle = style; row4.Cells[3].CellStyle = style;
                     row4.CreateCell(4); row4.CreateCell(5); row4.Cells[4].SetCellValue("面别:    AB面\t\r\n");
                     row4.Cells[4].CellStyle = style; row4.Cells[5].CellStyle = style;

+ 2 - 1
UAS_MES_LGDZ/FunctionCode/Query/Query_SpecialReport.cs

@@ -201,7 +201,8 @@ namespace UAS_MES_NEW.Query
                     new string[] { "STF_MODEL", "STF_FEEDER", "STF_FEEDERNO", "STF_LOCATION", "STF_MACHINE" }, STF_MODEL.ToArray(), STF_FEEDER.ToArray(), STF_FEEDERNO.ToArray(), STF_LOCATION.ToArray(), STF_MACHINE.ToArray());
                 dh.ExecuteSql("delete from SMTTRACEFILE where ( STF_MODEL is null and  STF_FEEDER is null and STF_FEEDERNO is null and STF_MACHINE is null ) or stf_model in ('料槽','数量','印刷板') or STF_MACHINE in('贴片生产线:','设置:','***') ", "delete");
                 dataGridView1.DataSource = dt;
-                DataTable dt1 = (DataTable)dh.ExecuteSql("select STF_ID, STF_MODEL,STF_MACHINE, STF_FEEDER, STF_FEEDERNO, STF_LOCATION,replace(pr_orispeccode,' ','\n')pr_orispeccode,bo_mothercode,bd_baseqty,bd_soncode,bd_location, STF_CODE, STF_INDATE, STF_INMAN from SMTTRACEFILE left join (\r\nselect bo_mothercode,bd_baseqty,bd_soncode,replace(bd_location,',',' ')bd_location from BOMDetail \r\nLEFT JOIN bom on bd_bomid=bo_id left join Product ON bd_soncode=pr_code left join ProdReplace on pre_bdid =bd_id where bo_mothercode='" + pr_code.Text + "' ) on bo_mothercode=stf_prodcode and bd_soncode=STF_LOCATION \r\nleft join product on pr_code=STF_LOCATION where stf_prodcode='" + pr_code.Text + "' order by stf_id", "select");
+                DataTable dt1 = (DataTable)dh.ExecuteSql("select STF_ID, STF_MODEL,STF_MACHINE, STF_FEEDER, STF_FEEDERNO, STF_LOCATION,replace(pr_orispeccode,' ','\n')pr_orispeccode,bo_mothercode,bd_baseqty,bd_soncode,bd_location, STF_CODE, STF_INDATE, STF_INMAN,sumqty from SMTTRACEFILE left join (select bo_mothercode,bd_baseqty,bd_soncode,replace(bd_location,',',' ')bd_location from BOMDetail LEFT JOIN bom on bd_bomid=bo_id left join Product ON bd_soncode=pr_code left join ProdReplace on pre_bdid =bd_id where bo_mothercode='" + pr_code.Text + "' ) on bo_mothercode=stf_prodcode and bd_soncode=STF_LOCATION left join product on pr_code=STF_LOCATION " +
+                    "left join (select sum(bd_baseqty)sumqty,bo_mothercode mothercode from BOMDetail LEFT JOIN bom on bd_bomid=bo_id left join Product ON bd_soncode=pr_code left join ProdReplace on pre_bdid =bd_id where bo_mothercode='" + pr_code.Text + "' group by bo_mothercode)on mothercode=bo_mothercode where stf_prodcode='" + pr_code.Text + "' order by stf_id", "select");
                 ExportFileDialog.Description = "选择导出的路径";
                 DialogResult result1 = ExportFileDialog.ShowDialog();
                 if (result1 == DialogResult.OK)