质量报表,拼箱逻辑修改
This commit is contained in:
@@ -11,6 +11,8 @@ using NPOI.XSSF.UserModel;
|
||||
using NPOI.SS.UserModel;
|
||||
using ZR.Model.MES.wms;
|
||||
using SqlSugar;
|
||||
using NPOI.SS.Util;
|
||||
using NPOI.HSSF.Util;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers.mes.qc.FQC
|
||||
{
|
||||
@@ -112,8 +114,14 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc.FQC
|
||||
// 标题列表
|
||||
string[] titleDict = { "工单号", "零件号", "颜色", "描述", "生产投入数", "班次", "合格数", "合格率", "抛光总数", "打磨总数", "报废总数", "开始时间", "结束时间"};
|
||||
string[] titleGroupDict = {"油漆", "设备", "毛坯", "程序", "班组操作" };
|
||||
int[] titleGroupIndex = { 14, 20, 26, 32, 38 };
|
||||
string[] titleDetailDict = { "备注", "缩孔", "针孔", "失光","色差","点子","其他" };
|
||||
int[] titleGroupIndex = { 14, 20, 27, 33, 38 };
|
||||
string[] titleDetailDict = {
|
||||
"备注",
|
||||
"缩孔", "针孔", "失光","色差","点子","其他",
|
||||
"水斑", "脏点", "变形","油珠","脱落","撞伤","其他",
|
||||
"毛刺", "缩印", "擦伤","砂印","脏点","打磨",
|
||||
"流挂", "色漆 缺漆", "清漆缺漆","桔皮","其他",
|
||||
"脱落擦伤", "清漆漆块", "色漆漆块","发花","亮斑","喷漏",};
|
||||
// 标题列位于第几行
|
||||
int startTitle = 0;
|
||||
if (isShowDetail)
|
||||
@@ -121,14 +129,31 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc.FQC
|
||||
// 调整第一行分组
|
||||
startTitle = 1;
|
||||
var groupTitle = sheet.CreateRow(0);
|
||||
var titleCell1 = groupTitle.CreateCell(0);
|
||||
titleCell1.SetCellValue("工单信息");
|
||||
titleCell1.CellStyle = style;
|
||||
for (int i = 0; i < titleGroupDict.Length;i++)
|
||||
{
|
||||
var cell = groupTitle.CreateCell(i);
|
||||
cell.SetCellValue(titleGroupIndex[i]);
|
||||
var cell = groupTitle.CreateCell(titleGroupIndex[i]);
|
||||
cell.SetCellValue(titleGroupDict[i]);
|
||||
cell.CellStyle = style;
|
||||
}
|
||||
// 标题列表添加详情
|
||||
titleDict.Concat(titleDetailDict);
|
||||
titleDict = titleDict.Concat(titleDetailDict).ToArray();
|
||||
|
||||
// 合并标题列
|
||||
CellRangeAddress titleRange1 = new(0, 0, 0, titleGroupIndex[0]-1);
|
||||
sheet.AddMergedRegion(titleRange1);
|
||||
CellRangeAddress titleRange2 = new(0, 0, titleGroupIndex[0], titleGroupIndex[1] - 1);
|
||||
sheet.AddMergedRegion(titleRange2);
|
||||
CellRangeAddress titleRange3 = new(0, 0, titleGroupIndex[1], titleGroupIndex[2] - 1);
|
||||
sheet.AddMergedRegion(titleRange3);
|
||||
CellRangeAddress titleRange4 = new(0, 0, titleGroupIndex[2], titleGroupIndex[3] - 1);
|
||||
sheet.AddMergedRegion(titleRange4);
|
||||
CellRangeAddress titleRange5 = new(0, 0, titleGroupIndex[3], titleGroupIndex[4] - 1);
|
||||
sheet.AddMergedRegion(titleRange5);
|
||||
CellRangeAddress titleRange6 = new(0, 0, titleGroupIndex[4], titleGroupIndex[4] + 5);
|
||||
sheet.AddMergedRegion(titleRange6);
|
||||
}
|
||||
var rowTitle = sheet.CreateRow(startTitle);
|
||||
for (int i = 0; i < titleDict.Length; i++)
|
||||
@@ -138,7 +163,8 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc.FQC
|
||||
cell.CellStyle = style;
|
||||
}
|
||||
string _lastWorkOrderId = "";
|
||||
int rowIndex = 1;
|
||||
// 数据开始行
|
||||
int rowIndex = startTitle + 1;
|
||||
for (int i = 0;i< excelDataList.Count;i++) {
|
||||
var item = excelDataList[i];
|
||||
if (!isShowDetail &&_lastWorkOrderId == item.WorkorderId)
|
||||
@@ -158,7 +184,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc.FQC
|
||||
|
||||
// 描述
|
||||
var cell4 = row.CreateCell(3);
|
||||
cell4.SetCellValue(qcStatistics.GetDescription(item.FinishedPartNumber));
|
||||
cell4.SetCellValue(item.ProductDescription.ToString());
|
||||
cell4.CellStyle = style;
|
||||
// =====
|
||||
|
||||
@@ -191,30 +217,137 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc.FQC
|
||||
cell13.CellStyle = style;
|
||||
if(isShowDetail)
|
||||
{
|
||||
// 油漆
|
||||
// 备注
|
||||
var cell14 = row.CreateCell(13);
|
||||
cell14.SetCellValue(item.PaintSuokong.ToString());
|
||||
cell14.SetCellValue(item.Remark.ToString());
|
||||
cell14.CellStyle = style;
|
||||
// 油漆
|
||||
var cell15 = row.CreateCell(14);
|
||||
cell15.SetCellValue(item.PaintZhengkong.ToString());
|
||||
cell15.SetCellValue(item.PaintSuokong.ToString() == "0"? "": item.PaintSuokong.ToString());
|
||||
cell15.CellStyle = style;
|
||||
var cell16 = row.CreateCell(15);
|
||||
cell16.SetCellValue(item.PaintShiguang.ToString());
|
||||
cell16.SetCellValue(item.PaintZhengkong.ToString() == "0" ? "" : item.PaintZhengkong.ToString());
|
||||
cell16.CellStyle = style;
|
||||
var cell17 = row.CreateCell(16);
|
||||
cell17.SetCellValue(item.PaintSecha.ToString());
|
||||
cell17.SetCellValue(item.PaintShiguang.ToString() == "0" ? "" : item.PaintShiguang.ToString());
|
||||
cell17.CellStyle = style;
|
||||
var cell18 = row.CreateCell(17);
|
||||
cell18.SetCellValue(item.PaintDianzi.ToString());
|
||||
cell18.SetCellValue(item.PaintSecha.ToString() == "0" ? "" : item.PaintSecha.ToString());
|
||||
cell18.CellStyle = style;
|
||||
var cell19 = row.CreateCell(18);
|
||||
cell19.SetCellValue(item.PaintOther.ToString());
|
||||
cell19.SetCellValue(item.PaintDianzi.ToString() == "0" ? "" : item.PaintDianzi.ToString());
|
||||
cell19.CellStyle = style;
|
||||
var cell20 = row.CreateCell(19);
|
||||
cell20.SetCellValue(item.PaintOther.ToString() == "0" ? "" : item.PaintOther.ToString());
|
||||
cell20.CellStyle = style;
|
||||
// 设备
|
||||
var cell21 = row.CreateCell(20);
|
||||
cell21.SetCellValue(item.DeviceShuiban.ToString() == "0" ? "" : item.DeviceShuiban.ToString());
|
||||
cell21.CellStyle = style;
|
||||
var cell22 = row.CreateCell(21);
|
||||
cell22.SetCellValue(item.DeviceZandian.ToString() == "0" ? "" : item.DeviceZandian.ToString());
|
||||
cell22.CellStyle = style;
|
||||
var cell23 = row.CreateCell(22);
|
||||
cell23.SetCellValue(item.DeviceBianxing.ToString() == "0" ? "" : item.DeviceBianxing.ToString());
|
||||
cell23.CellStyle = style;
|
||||
var cell24 = row.CreateCell(23);
|
||||
cell24.SetCellValue(item.DeviceYouzhu.ToString() == "0" ? "" : item.DeviceYouzhu.ToString());
|
||||
cell24.CellStyle = style;
|
||||
var cell25 = row.CreateCell(24);
|
||||
cell25.SetCellValue(item.DeviceTuoluo.ToString() == "0" ? "" : item.DeviceTuoluo.ToString());
|
||||
cell25.CellStyle = style;
|
||||
var cell26 = row.CreateCell(25);
|
||||
cell26.SetCellValue(item.DeviceZhuangshang.ToString() == "0" ? "" : item.DeviceZhuangshang.ToString());
|
||||
cell26.CellStyle = style;
|
||||
var cell27 = row.CreateCell(26);
|
||||
cell27.SetCellValue(item.DeviceOther.ToString() == "0" ? "" : item.DeviceOther.ToString());
|
||||
cell27.CellStyle = style;
|
||||
// 毛坯
|
||||
var cell28 = row.CreateCell(27);
|
||||
cell28.SetCellValue(item.BlankMaoci.ToString() == "0" ? "" : item.BlankMaoci.ToString());
|
||||
cell28.CellStyle = style;
|
||||
var cell29 = row.CreateCell(28);
|
||||
cell29.SetCellValue(item.BlankSuoyin.ToString() == "0" ? "" : item.BlankSuoyin.ToString());
|
||||
cell29.CellStyle = style;
|
||||
var cell30 = row.CreateCell(29);
|
||||
cell30.SetCellValue(item.BlankCanshuang.ToString() == "0" ? "" : item.BlankCanshuang.ToString());
|
||||
cell30.CellStyle = style;
|
||||
var cell31 = row.CreateCell(30);
|
||||
cell31.SetCellValue(item.BlankShaying.ToString() == "0" ? "" : item.BlankShaying.ToString());
|
||||
cell31.CellStyle = style;
|
||||
var cell32 = row.CreateCell(31);
|
||||
cell32.SetCellValue(item.BlankZangdian.ToString() == "0" ? "" : item.BlankZangdian.ToString());
|
||||
cell32.CellStyle = style;
|
||||
var cell33 = row.CreateCell(32);
|
||||
cell33.SetCellValue(item.BlankDamo.ToString() == "0" ? "" : item.BlankDamo.ToString());
|
||||
cell33.CellStyle = style;
|
||||
// 程序
|
||||
var cell34 = row.CreateCell(33);
|
||||
cell34.SetCellValue(item.ProgramLiuguang.ToString() == "0" ? "" : item.ProgramLiuguang.ToString());
|
||||
cell34.CellStyle = style;
|
||||
var cell35 = row.CreateCell(34);
|
||||
cell35.SetCellValue(item.ProgramSeqiqueqi.ToString() == "0" ? "" : item.ProgramSeqiqueqi.ToString());
|
||||
cell35.CellStyle = style;
|
||||
var cell36 = row.CreateCell(35);
|
||||
cell36.SetCellValue(item.ProgramQingqiqueqi.ToString() == "0" ? "" : item.ProgramQingqiqueqi.ToString());
|
||||
cell36.CellStyle = style;
|
||||
var cell37 = row.CreateCell(36);
|
||||
cell37.SetCellValue(item.ProgramJupi.ToString() == "0" ? "" : item.ProgramJupi.ToString());
|
||||
cell37.CellStyle = style;
|
||||
var cell38 = row.CreateCell(37);
|
||||
cell38.SetCellValue(item.ProgramOther.ToString() == "0" ? "" : item.ProgramOther.ToString());
|
||||
cell38.CellStyle = style;
|
||||
// 班组操作
|
||||
var cell39 = row.CreateCell(38);
|
||||
cell39.SetCellValue(item.TeamTuoluocanshuang.ToString() == "0" ? "" : item.TeamTuoluocanshuang.ToString());
|
||||
cell39.CellStyle = style;
|
||||
var cell40 = row.CreateCell(39);
|
||||
cell40.SetCellValue(item.TeamQingqiqikuai.ToString() == "0" ? "" : item.TeamQingqiqikuai.ToString());
|
||||
cell40.CellStyle = style;
|
||||
var cell41 = row.CreateCell(40);
|
||||
cell41.SetCellValue(item.TeamSeqiqikuai.ToString() == "0" ? "" : item.TeamSeqiqikuai.ToString());
|
||||
cell41.CellStyle = style;
|
||||
var cell42 = row.CreateCell(41);
|
||||
cell42.SetCellValue(item.TeamFahua.ToString() == "0" ? "" : item.TeamFahua.ToString());
|
||||
cell42.CellStyle = style;
|
||||
var cell43 = row.CreateCell(42);
|
||||
cell43.SetCellValue(item.TeamLiangbang.ToString() == "0" ? "" : item.TeamLiangbang.ToString());
|
||||
cell43.CellStyle = style;
|
||||
var cell44 = row.CreateCell(43);
|
||||
cell44.SetCellValue(item.TeamPenglou.ToString() == "0" ? "" : item.TeamPenglou.ToString());
|
||||
cell44.CellStyle = style;
|
||||
// 单元格合并
|
||||
// 合并行数
|
||||
int checkIndex = rowIndex + 1;
|
||||
if (type == 3)
|
||||
{
|
||||
for (int rangeCol = 0; rangeCol < 13; rangeCol++)
|
||||
{
|
||||
if (rowIndex % 2 == 0)
|
||||
{
|
||||
CellRangeAddress cellRangeAddress = new(rowIndex, rowIndex + 1, rangeCol, rangeCol);
|
||||
sheet.AddMergedRegion(cellRangeAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int rangeCol = 0; rangeCol < 13; rangeCol++)
|
||||
{
|
||||
if (checkIndex % 3 == 0)
|
||||
{
|
||||
CellRangeAddress cellRangeAddress = new(rowIndex, rowIndex + 2, rangeCol, rangeCol);
|
||||
sheet.AddMergedRegion(cellRangeAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
_lastWorkOrderId = item.WorkorderId;
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 导出
|
||||
IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment));
|
||||
|
||||
Reference in New Issue
Block a user