|
|
@@ -9,6 +9,7 @@ using UAS_LabelMachine.Entity;
|
|
|
using UAS_LabelMachine.PublicMethod;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Windows.Forms;
|
|
|
+using System.Text.RegularExpressions;
|
|
|
|
|
|
namespace UAS_LabelMachine
|
|
|
{
|
|
|
@@ -43,7 +44,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
//创建一个内存流,用来接收转换成Excel的内容
|
|
|
MemoryStream ms;
|
|
|
- ms = DataTableToExcel1(firstsdt, dt, Type, PageSize, conditionbox);
|
|
|
+ ms = DataTableToExcel1(firstsdt, dt, Type, FileName, PageSize, conditionbox);
|
|
|
//以系统当前时间命名文件,FileMode.Create表示创建文件,FileAccess.Write表示拥有写的权限
|
|
|
string filePath = @FolderPath + "\\" + FileName + ".xls";
|
|
|
FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
|
|
|
@@ -228,10 +229,10 @@ namespace UAS_LabelMachine
|
|
|
style.FillPattern = FillPattern.BigSpots;
|
|
|
style.FillBackgroundColor = HSSFColor.LightGreen.Index;
|
|
|
//设置边框
|
|
|
- style.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thick;
|
|
|
- style.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thick;
|
|
|
- style.BorderRight = NPOI.SS.UserModel.BorderStyle.Thick;
|
|
|
- style.BorderTop = NPOI.SS.UserModel.BorderStyle.Thick;
|
|
|
+ style.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
+ style.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
+ style.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
+ style.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
row.HeightInPoints = 20;
|
|
|
//固定第一行
|
|
|
//row.RowStyle.IsLocked=true;
|
|
|
@@ -267,7 +268,7 @@ namespace UAS_LabelMachine
|
|
|
/// </summary>
|
|
|
/// <param name="DataTable"></param>
|
|
|
/// <returns></returns>
|
|
|
- public MemoryStream DataTableToExcel1(DataTable FirstDT, DataTable DataTable, string Type, int PageSize, List<CheckBox> conditionbox)
|
|
|
+ public MemoryStream DataTableToExcel1(DataTable FirstDT, DataTable DataTable, string Type,string Inoutno, int PageSize, List<CheckBox> conditionbox)
|
|
|
{
|
|
|
//转换为序列
|
|
|
CheckBox[] box = conditionbox.ToArray();
|
|
|
@@ -278,17 +279,24 @@ namespace UAS_LabelMachine
|
|
|
//Excel中的Sheet
|
|
|
ISheet sheet = book.CreateSheet("分页");
|
|
|
|
|
|
+ //更新箱号
|
|
|
+ List<string> ch_code = new List<string>();
|
|
|
+ //系统打印箱号
|
|
|
+ List<string> pib_outboxcode1 = new List<string>();
|
|
|
+
|
|
|
+ int BoxCode = 1;
|
|
|
ICellStyle style = book.CreateCellStyle();
|
|
|
style.VerticalAlignment = VerticalAlignment.Center;
|
|
|
style.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left;
|
|
|
|
|
|
ICellStyle styleborder = book.CreateCellStyle();
|
|
|
- styleborder.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thick;
|
|
|
- styleborder.BorderTop = NPOI.SS.UserModel.BorderStyle.Thick;
|
|
|
- styleborder.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thick;
|
|
|
- styleborder.BorderRight = NPOI.SS.UserModel.BorderStyle.Thick;
|
|
|
+ styleborder.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
+ styleborder.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
+ styleborder.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
+ styleborder.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
styleborder.VerticalAlignment = VerticalAlignment.Center;
|
|
|
styleborder.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left;
|
|
|
+ string pi_inoutno = "";
|
|
|
//设置列的宽度,根据首行的列的内容的长度来设置
|
|
|
for (int i = DataTable.Columns.Count - 1; i > 0; i--)
|
|
|
{
|
|
|
@@ -375,13 +383,7 @@ namespace UAS_LabelMachine
|
|
|
IRow row = sheet.CreateRow(0);
|
|
|
//冻结第一行
|
|
|
sheet.CreateFreezePane(0, 1, 0, 1);
|
|
|
- //style.FillPattern = FillPattern.BigSpots;
|
|
|
- //style.FillBackgroundColor = HSSFColor.LightGreen.Index;
|
|
|
- //设置边框
|
|
|
- //style.BorderBottom = BorderStyle.Thick;
|
|
|
- //style.BorderLeft = BorderStyle.Thick;
|
|
|
- //style.BorderRight = BorderStyle.Thick;
|
|
|
- //style.BorderTop = BorderStyle.Thick;
|
|
|
+
|
|
|
row.HeightInPoints = 20;
|
|
|
//固定第一行
|
|
|
//row.RowStyle.IsLocked=true;
|
|
|
@@ -433,6 +435,7 @@ namespace UAS_LabelMachine
|
|
|
DataRow dr = FirstDT.NewRow();
|
|
|
dr["pr_spec"] = DataTable.Rows[i]["pr_spec"].ToString();
|
|
|
dr["pi_inoutno"] = DataTable.Rows[i]["pi_inoutno"].ToString();
|
|
|
+ pi_inoutno = DataTable.Rows[i]["pi_inoutno"].ToString();
|
|
|
dr["pi_title"] = DataTable.Rows[i]["pi_title"].ToString();
|
|
|
dr["pi_date"] = DataTable.Rows[i]["pi_date"].ToString();
|
|
|
dr["pd_ordercode"] = First_OrderCode;
|
|
|
@@ -446,6 +449,7 @@ namespace UAS_LabelMachine
|
|
|
First_Prspec = "";
|
|
|
First_Batch = "";
|
|
|
First_WID.Clear();
|
|
|
+ BoxCode = BoxCode + 1;
|
|
|
for (int j = 0; j < columnNum - 4; j++)
|
|
|
{
|
|
|
if (j == 0)
|
|
|
@@ -640,6 +644,8 @@ namespace UAS_LabelMachine
|
|
|
row1.Cells[j].CellStyle = style;
|
|
|
}
|
|
|
}
|
|
|
+ ch_code.Add(DataTable.Rows[i]["ch_code"].ToString());
|
|
|
+ pib_outboxcode1.Add(BoxCode.ToString());
|
|
|
}
|
|
|
for (int i = 0; i < sheet.LastRowNum; i++)
|
|
|
{
|
|
|
@@ -660,6 +666,7 @@ namespace UAS_LabelMachine
|
|
|
//如果批号不相等的时候
|
|
|
if (LastBatchCode != "" && LastBatchCode != DataTable.Rows[i]["ch_splitbatch"].ToString())
|
|
|
{
|
|
|
+ BoxCode = BoxCode + 1;
|
|
|
for (int j = 0; j < columnNum - 4; j++)
|
|
|
{
|
|
|
if (j == 0)
|
|
|
@@ -830,6 +837,8 @@ namespace UAS_LabelMachine
|
|
|
row1.Cells[j].CellStyle = style;
|
|
|
}
|
|
|
}
|
|
|
+ ch_code.Add(DataTable.Rows[i]["ch_code"].ToString());
|
|
|
+ pib_outboxcode1.Add(BoxCode.ToString());
|
|
|
}
|
|
|
for (int i = 0; i < sheet.LastRowNum; i++)
|
|
|
{
|
|
|
@@ -850,6 +859,7 @@ namespace UAS_LabelMachine
|
|
|
//如果批号不相等的时候
|
|
|
if (LastBoxCode != "" && LastBoxCode != DataTable.Rows[i]["CH_PBCODE"].ToString())
|
|
|
{
|
|
|
+ BoxCode = BoxCode + 1;
|
|
|
for (int j = 0; j < columnNum - 4; j++)
|
|
|
{
|
|
|
if (j == 0)
|
|
|
@@ -1031,6 +1041,8 @@ namespace UAS_LabelMachine
|
|
|
row1.Cells[j].CellStyle = style;
|
|
|
}
|
|
|
}
|
|
|
+ ch_code.Add(DataTable.Rows[i]["ch_code"].ToString());
|
|
|
+ pib_outboxcode1.Add(BoxCode.ToString());
|
|
|
}
|
|
|
for (int i = 0; i < sheet.LastRowNum; i++)
|
|
|
{
|
|
|
@@ -1044,6 +1056,7 @@ namespace UAS_LabelMachine
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
+ dh.BatchInsert("update prodiobarcode set pib_outboxcode1=:pib_outboxcode1 where pib_inoutno='"+ Inoutno + "' and pib_custbarcode=:pib_custbarcode",new string[] { "pib_outboxcode1", "pib_custbarcode" },pib_outboxcode1.ToArray(), ch_code.ToArray());
|
|
|
//填充首页
|
|
|
sumCount = 0;
|
|
|
totalCount = 0;
|