From 91d75c5773260bd8f583a8f44cee8b75bbf2fc08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AD=A3=E6=98=93?= Date: Mon, 20 May 2024 15:09:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E6=8A=A5=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E6=8B=BC=E7=AE=B1=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/qc/FQC/QCStatisticsController.cs | 161 ++++++++++++++++-- ZR.Service/mes/qc/QCStatisticsService.cs | 152 ++++++++++++++++- ZR.Service/mes/wms/WmGoodsActionService.cs | 1 + 3 files changed, 296 insertions(+), 18 deletions(-) diff --git a/ZR.Admin.WebApi/Controllers/mes/qc/FQC/QCStatisticsController.cs b/ZR.Admin.WebApi/Controllers/mes/qc/FQC/QCStatisticsController.cs index f189bd94..7762fb8b 100644 --- a/ZR.Admin.WebApi/Controllers/mes/qc/FQC/QCStatisticsController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/qc/FQC/QCStatisticsController.cs @@ -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)); diff --git a/ZR.Service/mes/qc/QCStatisticsService.cs b/ZR.Service/mes/qc/QCStatisticsService.cs index e4319462..e3d2b944 100644 --- a/ZR.Service/mes/qc/QCStatisticsService.cs +++ b/ZR.Service/mes/qc/QCStatisticsService.cs @@ -275,7 +275,7 @@ namespace ZR.Service.mes.qc { WorkorderId = item.WorkorderId, FinishedPartNumber = item.FinishedPartNumber, - ProductDescription = product_description, + ProductDescription = GetDescription(item.FinishedPartNumber), Color = item.Color, RequireNumber = item.RequireNumber, Team = item.Team, @@ -286,6 +286,42 @@ namespace ZR.Service.mes.qc BaofeiTotal = item.BaofeiTotal ?? 0, StartTime = item.StartTime, EndTime = item.EndTime, + Remark = item.Remark ?? "", + // 油漆(6) + PaintSuokong = item.PaintSuokong ?? 0, + PaintZhengkong = item.PaintZhengkong ?? 0, + PaintShiguang = item.PaintShiguang ?? 0, + PaintSecha = item.PaintSecha ?? 0, + PaintDianzi = item.PaintDianzi ?? 0, + PaintOther = item.PaintOther ?? 0, + // 设备(7) + DeviceShuiban = item.DeviceShuiban ?? 0, + DeviceZandian = item.DeviceZandian ?? 0, + DeviceBianxing = item.DeviceBianxing ?? 0, + DeviceYouzhu = item.DeviceYouzhu ?? 0, + DeviceTuoluo = item.DeviceTuoluo ?? 0, + DeviceZhuangshang = item.DeviceZhuangshang ?? 0, + DeviceOther = item.DeviceOther ?? 0, + // 毛坯(6) + BlankMaoci = item.BlankMaoci ?? 0, + BlankSuoyin = item.BlankSuoyin ?? 0, + BlankCanshuang = item.BlankCanshuang ?? 0, + BlankShaying = item.BlankShaying ?? 0, + BlankZangdian = item.BlankZangdian ?? 0, + BlankDamo = item.BlankDamo ?? 0, + // 程序(5) + ProgramLiuguang = item.ProgramLiuguang ?? 0, + ProgramSeqiqueqi = item.ProgramSeqiqueqi ?? 0, + ProgramQingqiqueqi = item.ProgramQingqiqueqi ?? 0, + ProgramJupi = item.ProgramJupi ?? 0, + ProgramOther = item.ProgramOther ?? 0, + // 班组操作(6) + TeamTuoluocanshuang = item.TeamTuoluocanshuang ?? 0, + TeamQingqiqikuai = item.TeamQingqiqikuai ?? 0, + TeamSeqiqikuai = item.TeamSeqiqikuai ?? 0, + TeamFahua = item.TeamFahua ?? 0, + TeamLiangbang = item.TeamLiangbang ?? 0, + TeamPenglou = item.TeamPenglou ?? 0, }).ToList(); return newList; } @@ -296,7 +332,7 @@ namespace ZR.Service.mes.qc { WorkorderId = item.WorkorderId, FinishedPartNumber = item.FinishedPartNumber, - ProductDescription = product_description, + ProductDescription = GetDescription(item.FinishedPartNumber), Color = item.Color, RequireNumber = item.RequireNumber, Team = item.Team, @@ -307,6 +343,42 @@ namespace ZR.Service.mes.qc BaofeiTotal = item.BaofeiTotal ?? 0, StartTime = item.StartTime, EndTime = item.EndTime, + Remark = item.Remark ?? "", + // 油漆(6) + PaintSuokong = item.PaintSuokong ?? 0, + PaintZhengkong = item.PaintZhengkong ?? 0, + PaintShiguang = item.PaintShiguang ?? 0, + PaintSecha = item.PaintSecha ?? 0, + PaintDianzi = item.PaintDianzi ?? 0, + PaintOther = item.PaintOther ?? 0, + // 设备(7) + DeviceShuiban = item.DeviceShuiban ?? 0, + DeviceZandian = item.DeviceZandian ?? 0, + DeviceBianxing = item.DeviceBianxing ?? 0, + DeviceYouzhu = item.DeviceYouzhu ?? 0, + DeviceTuoluo = item.DeviceTuoluo ?? 0, + DeviceZhuangshang = item.DeviceZhuangshang ?? 0, + DeviceOther = item.DeviceOther ?? 0, + // 毛坯(6) + BlankMaoci = item.BlankMaoci ?? 0, + BlankSuoyin = item.BlankSuoyin ?? 0, + BlankCanshuang = item.BlankCanshuang ?? 0, + BlankShaying = item.BlankShaying ?? 0, + BlankZangdian = item.BlankZangdian ?? 0, + BlankDamo = item.BlankDamo ?? 0, + // 程序(5) + ProgramLiuguang = item.ProgramLiuguang ?? 0, + ProgramSeqiqueqi = item.ProgramSeqiqueqi ?? 0, + ProgramQingqiqueqi = item.ProgramQingqiqueqi ?? 0, + ProgramJupi = item.ProgramJupi ?? 0, + ProgramOther = item.ProgramOther ?? 0, + // 班组操作(6) + TeamTuoluocanshuang = item.TeamTuoluocanshuang ?? 0, + TeamQingqiqikuai = item.TeamQingqiqikuai ?? 0, + TeamSeqiqikuai = item.TeamSeqiqikuai ?? 0, + TeamFahua = item.TeamFahua ?? 0, + TeamLiangbang = item.TeamLiangbang ?? 0, + TeamPenglou = item.TeamPenglou ?? 0, }).ToList(); return newList; } @@ -318,7 +390,7 @@ namespace ZR.Service.mes.qc { WorkorderId = item.WorkorderId, FinishedPartNumber = item.FinishedPartNumber, - ProductDescription = product_description, + ProductDescription = GetDescription(item.FinishedPartNumber), Color = item.Color, RequireNumber = item.RequireNumber, Team = item.Team, @@ -329,6 +401,42 @@ namespace ZR.Service.mes.qc BaofeiTotal = item.BaofeiTotal ?? 0, StartTime = item.StartTime, EndTime = item.EndTime, + Remark = item.Remark ?? "", + // 油漆(6) + PaintSuokong = item.PaintSuokong ?? 0, + PaintZhengkong = item.PaintZhengkong ?? 0, + PaintShiguang = item.PaintShiguang ?? 0, + PaintSecha = item.PaintSecha ?? 0, + PaintDianzi = item.PaintDianzi ?? 0, + PaintOther = item.PaintOther ?? 0, + // 设备(7) + DeviceShuiban = item.DeviceShuiban ?? 0, + DeviceZandian = item.DeviceZandian ?? 0, + DeviceBianxing = item.DeviceBianxing ?? 0, + DeviceYouzhu = item.DeviceYouzhu ?? 0, + DeviceTuoluo = item.DeviceTuoluo ?? 0, + DeviceZhuangshang = item.DeviceZhuangshang ?? 0, + DeviceOther = item.DeviceOther ?? 0, + // 毛坯(6) + BlankMaoci = item.BlankMaoci ?? 0, + BlankSuoyin = item.BlankSuoyin ?? 0, + BlankCanshuang = item.BlankCanshuang ?? 0, + BlankShaying = item.BlankShaying ?? 0, + BlankZangdian = item.BlankZangdian ?? 0, + BlankDamo = item.BlankDamo ?? 0, + // 程序(5) + ProgramLiuguang = item.ProgramLiuguang ?? 0, + ProgramSeqiqueqi = item.ProgramSeqiqueqi ?? 0, + ProgramQingqiqueqi = item.ProgramQingqiqueqi ?? 0, + ProgramJupi = item.ProgramJupi ?? 0, + ProgramOther = item.ProgramOther ?? 0, + // 班组操作(6) + TeamTuoluocanshuang = item.TeamTuoluocanshuang ?? 0, + TeamQingqiqikuai = item.TeamQingqiqikuai ?? 0, + TeamSeqiqikuai = item.TeamSeqiqikuai ?? 0, + TeamFahua = item.TeamFahua ?? 0, + TeamLiangbang = item.TeamLiangbang ?? 0, + TeamPenglou = item.TeamPenglou ?? 0, }).ToList(); return newList; } @@ -339,7 +447,7 @@ namespace ZR.Service.mes.qc { WorkorderId = item.WorkorderId, FinishedPartNumber = item.FinishedPartNumber, - ProductDescription = product_description, + ProductDescription = GetDescription(item.FinishedPartNumber), Color = item.Color, RequireNumber = item.RequireNumber, Team = item.Team, @@ -350,6 +458,42 @@ namespace ZR.Service.mes.qc BaofeiTotal = item.BaofeiTotal ?? 0, StartTime = item.StartTime, EndTime = item.EndTime, + Remark = item.Remark ?? "", + // 油漆(6) + PaintSuokong = item.PaintSuokong ?? 0, + PaintZhengkong = item.PaintZhengkong ?? 0, + PaintShiguang = item.PaintShiguang ?? 0, + PaintSecha = item.PaintSecha ?? 0, + PaintDianzi = item.PaintDianzi ?? 0, + PaintOther = item.PaintOther ?? 0, + // 设备(7) + DeviceShuiban = item.DeviceShuiban ?? 0, + DeviceZandian = item.DeviceZandian ?? 0, + DeviceBianxing = item.DeviceBianxing ?? 0, + DeviceYouzhu = item.DeviceYouzhu ?? 0, + DeviceTuoluo = item.DeviceTuoluo ?? 0, + DeviceZhuangshang = item.DeviceZhuangshang ?? 0, + DeviceOther = item.DeviceOther ?? 0, + // 毛坯(6) + BlankMaoci = item.BlankMaoci ?? 0, + BlankSuoyin = item.BlankSuoyin ?? 0, + BlankCanshuang = item.BlankCanshuang ?? 0, + BlankShaying = item.BlankShaying ?? 0, + BlankZangdian = item.BlankZangdian ?? 0, + BlankDamo = item.BlankDamo ?? 0, + // 程序(5) + ProgramLiuguang = item.ProgramLiuguang ?? 0, + ProgramSeqiqueqi = item.ProgramSeqiqueqi ?? 0, + ProgramQingqiqueqi = item.ProgramQingqiqueqi ?? 0, + ProgramJupi = item.ProgramJupi ?? 0, + ProgramOther = item.ProgramOther ?? 0, + // 班组操作(6) + TeamTuoluocanshuang = item.TeamTuoluocanshuang ?? 0, + TeamQingqiqikuai = item.TeamQingqiqikuai ?? 0, + TeamSeqiqikuai = item.TeamSeqiqikuai ?? 0, + TeamFahua = item.TeamFahua ?? 0, + TeamLiangbang = item.TeamLiangbang ?? 0, + TeamPenglou = item.TeamPenglou ?? 0, }).ToList(); return newList; } diff --git a/ZR.Service/mes/wms/WmGoodsActionService.cs b/ZR.Service/mes/wms/WmGoodsActionService.cs index 57752655..84779105 100644 --- a/ZR.Service/mes/wms/WmGoodsActionService.cs +++ b/ZR.Service/mes/wms/WmGoodsActionService.cs @@ -200,6 +200,7 @@ namespace ZR.Service.Business { Id = SnowFlakeSingle.instance.NextId().ToString(), Partnumber = nowProduction.Partnumber, + WorkOrderId = newPatchCode.Substring(3, 9), PackageCode = newPatchCode, SerialNumber = newPatchCode.Split('_')[1], LocationCode = nowProduction.LocationCode,