diff --git a/ZR.Service/mes/qc/FirstFQCService.cs b/ZR.Service/mes/qc/FirstFQCService.cs index 8373564c..ec424498 100644 --- a/ZR.Service/mes/qc/FirstFQCService.cs +++ b/ZR.Service/mes/qc/FirstFQCService.cs @@ -1,5 +1,6 @@ using AutoMapper.Configuration.Conventions; using Infrastructure.Attribute; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using SqlSugar; @@ -321,7 +322,7 @@ namespace ZR.Service.mes.qc //更新实时记录表 QcFirstinspectionRecord record = new QcFirstinspectionRecord(); - record.Id = DateTime.Now.ToString("YYMMddHHmmss"); + record.Id = DateTime.Now.ToString("yyMMddHHmmss"); record.InspectionModule = InspectionModule; record.FKWorkorderId = workorder_id; record.FKInpectionId = checkid.Substring(0, 3); @@ -373,7 +374,7 @@ namespace ZR.Service.mes.qc { //更新实时记录表 QcAgaininspectionRecord record = new QcAgaininspectionRecord(); - record.Id = DateTime.Now.ToString("YYMMddHHmmss"); + record.Id = DateTime.Now.ToString("yyMMddHHmmss"); record.InspectionModule = InspectionModule; record.FkWorkorderId = workorder_id; record.FkInpectionId = checkid.Substring(0, 3); @@ -423,7 +424,7 @@ namespace ZR.Service.mes.qc { //更新实时记录表 QcFinalinspectionRecord record = new QcFinalinspectionRecord(); - record.Id = DateTime.Now.ToString("YYMMddHHmmss"); + record.Id = DateTime.Now.ToString("yyMMddHHmmss"); record.InspectionModule = InspectionModule; record.FkWorkorderId = workorder_id; record.FkInpectionId = checkid.Substring(0, 3); @@ -1371,8 +1372,9 @@ namespace ZR.Service.mes.qc if (!string.IsNullOrEmpty(workorderID)) { #region 首检 + #region 抛光 QcQualityStatisticsFirst first = new QcQualityStatisticsFirst(); - first.Id = DateTime.Now.ToString("YYMMddHHmmss"); + first.Id = SnowFlakeSingle.Instance.NextId().ToString(); first.WorkorderId = workorderID; ProWorkorder_v2 workorder_item = Context.Queryable().Where(it => it.ClientWorkorder == workorderID).First(); @@ -1382,164 +1384,194 @@ namespace ZR.Service.mes.qc first.ProductDescription = workorder_item.ProductDescription; first.RequireNumber = workorder_item.PreviousNumber; first.StartTime = workorder_item.CreatedTime;//这地方是不妥的 - - } - - first.Team = team; - first.QualifiedNumber = 0; - first.QualifiedRate = 0; - first.PaoguangTotal = 0; - first.DamoTotal = 0; - first.BaofeiTotal = 0; - first.EndTime = DateTime.Now; first.Remark = "抛光"; first.Remark2 = 1; + int paoguang_total = 0; //抛光总数 - List firstrecordList = Context.Queryable().Where(it => it.FKWorkorderId == workorderID).ToList(); + List firstrecordList = Context.Queryable().Where(it => it.FKWorkorderId == workorderID).Where(it => SqlFunc.Contains(it.FKInpectionId, "_1_")).ToList(); if (firstrecordList != null && firstrecordList.Count > 0) { for (int i = 0; i < firstrecordList.Count; i++) { - if (firstrecordList[i].FKInpectionId=="111") + if (firstrecordList[i].FKInpectionId == "111") { first.PaintSuokong = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "112") { first.PaintZhengkong = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "113") { first.PaintShiguang = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "114") { first.PaintSecha = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "115") { first.PaintDianzi = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "116") { first.PaintOther = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "211") { first.DeviceShuiban = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "212") { first.DeviceZandian = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "213") { first.DeviceBianxing = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "214") { first.DeviceYouzhu = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "215") { first.DeviceTuoluo = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "216") { first.DeviceZhuangshang = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "217") { first.DeviceOther = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } - if (firstrecordList[i].FKInpectionId == "217") - { - first.DeviceOther = firstrecordList[i].Counter; - } + if (firstrecordList[i].FKInpectionId == "311") { first.BlankMaoci = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "312") { first.BlankSuoyin = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "313") { first.BlankCanshuang = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "314") { first.BlankShaying = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "315") { first.BlankZangdian = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "316") { first.BlankDamo = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "411") { first.ProgramLiuguang = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "412") { first.ProgramSeqiqueqi = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "413") { first.ProgramQingqiqueqi = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "414") { first.ProgramJupi = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "415") { first.ProgramOther = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } if (firstrecordList[i].FKInpectionId == "415") { first.ProgramOther = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; + } + if (firstrecordList[i].FKInpectionId == "511") + { + first.TeamTuoluocanshuang = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; + } + if (firstrecordList[i].FKInpectionId == "512") + { + first.TeamQingqiqikuai = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; + } + if (firstrecordList[i].FKInpectionId == "513") + { + first.TeamSeqiqikuai = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; + } + if (firstrecordList[i].FKInpectionId == "514") + { + first.TeamFahua = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; + } + if (firstrecordList[i].FKInpectionId == "515") + { + first.TeamLiangbang = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; + } + if (firstrecordList[i].FKInpectionId == "516") + { + first.TeamPenglou = firstrecordList[i].Counter; + paoguang_total = paoguang_total + (int)firstrecordList[i].Counter; } } } - - - - - - - - - first.TeamTuoluocanshuang = 0; - first.TeamQingqiqikuai = 0; - first.TeamSeqiqikuai = 0; - first.TeamFahua = 0; - first.TeamLiangbang = 0; - first.TeamPenglou = 0; + first.CreatedTime = DateTime.Now; first.UpdatedTime = DateTime.Now; @@ -1547,6 +1579,1402 @@ namespace ZR.Service.mes.qc + #endregion + #region 打磨 + QcQualityStatisticsFirst first2 = new QcQualityStatisticsFirst(); + first2.Id = SnowFlakeSingle.Instance.NextId().ToString(); + first2.WorkorderId = workorderID; + + ProWorkorder_v2 workorder_item2 = Context.Queryable().Where(it => it.ClientWorkorder == workorderID).First(); + if (workorder_item2 != null) + { + first2.FinishedPartNumber = workorder_item2.FinishedPartNumber; + first2.ProductDescription = workorder_item2.ProductDescription; + first2.RequireNumber = workorder_item2.PreviousNumber; + first2.StartTime = workorder_item2.CreatedTime;//这地方是不妥的 + + + } + + + + + first2.Team = team; + + + first2.EndTime = DateTime.Now; + first2.Remark = "打磨"; + first2.Remark2 = 2; + int damo_total = 0; + + + List firstrecordList2 = Context.Queryable().Where(it => it.FKWorkorderId == workorderID).Where(it => SqlFunc.Contains(it.FKInpectionId, "_2_")).ToList(); + if (firstrecordList2 != null && firstrecordList2.Count > 0) + { + for (int i = 0; i < firstrecordList2.Count; i++) + { + + if (firstrecordList2[i].FKInpectionId == "121") + { + first2.PaintSuokong = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + + if (firstrecordList2[i].FKInpectionId == "122") + { + first2.PaintZhengkong = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + + if (firstrecordList2[i].FKInpectionId == "123") + { + first2.PaintShiguang = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + + + if (firstrecordList2[i].FKInpectionId == "124") + { + first2.PaintSecha = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + + + if (firstrecordList2[i].FKInpectionId == "125") + { + first2.PaintDianzi = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + + + if (firstrecordList2[i].FKInpectionId == "126") + { + first2.PaintOther = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + + if (firstrecordList2[i].FKInpectionId == "221") + { + first2.DeviceShuiban = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + + if (firstrecordList2[i].FKInpectionId == "222") + { + first2.DeviceZandian = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "223") + { + first2.DeviceBianxing = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + + if (firstrecordList2[i].FKInpectionId == "224") + { + first2.DeviceYouzhu = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + + if (firstrecordList2[i].FKInpectionId == "225") + { + first2.DeviceTuoluo = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "226") + { + first2.DeviceZhuangshang = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "227") + { + first2.DeviceOther = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + + if (firstrecordList2[i].FKInpectionId == "321") + { + first2.BlankMaoci = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "322") + { + first2.BlankSuoyin = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "323") + { + first2.BlankCanshuang = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "324") + { + first2.BlankShaying = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "325") + { + first2.BlankZangdian = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "326") + { + first2.BlankDamo = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "421") + { + first2.ProgramLiuguang = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "422") + { + first2.ProgramSeqiqueqi = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "423") + { + first2.ProgramQingqiqueqi = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "424") + { + first2.ProgramJupi = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "425") + { + first2.ProgramOther = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "425") + { + first2.ProgramOther = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "521") + { + first2.TeamTuoluocanshuang = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "522") + { + first2.TeamQingqiqikuai = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "523") + { + first2.TeamSeqiqikuai = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "524") + { + first2.TeamFahua = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "525") + { + first2.TeamLiangbang = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + if (firstrecordList2[i].FKInpectionId == "526") + { + first2.TeamPenglou = firstrecordList2[i].Counter; + damo_total = damo_total + (int)firstrecordList2[i].Counter; + } + } + + } + + first2.CreatedTime = DateTime.Now; + first2.UpdatedTime = DateTime.Now; + + + + + + + #endregion + #region 报废 + QcQualityStatisticsFirst first3 = new QcQualityStatisticsFirst(); + first3.Id = SnowFlakeSingle.Instance.NextId().ToString(); + first3.WorkorderId = workorderID; + + ProWorkorder_v2 workorder_item3 = Context.Queryable().Where(it => it.ClientWorkorder == workorderID).First(); + if (workorder_item3 != null) + { + first3.FinishedPartNumber = workorder_item3.FinishedPartNumber; + first3.ProductDescription = workorder_item3.ProductDescription; + first3.RequireNumber = workorder_item3.PreviousNumber; + first3.StartTime = workorder_item3.CreatedTime;//这地方是不妥的 + + + } + + + + + first3.Team = team; + + + first3.EndTime = DateTime.Now; + first3.Remark = "报废"; + first3.Remark2 = 3; + int baofei_total = 0; + + List firstrecordList3 = Context.Queryable().Where(it => it.FKWorkorderId == workorderID).Where(it => SqlFunc.Contains(it.FKInpectionId, "_3_")).ToList(); + if (firstrecordList3 != null && firstrecordList3.Count > 0) + { + for (int i = 0; i < firstrecordList3.Count; i++) + { + + if (firstrecordList3[i].FKInpectionId == "131") + { + first3.PaintSuokong = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + + if (firstrecordList3[i].FKInpectionId == "132") + { + first3.PaintZhengkong = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + + if (firstrecordList3[i].FKInpectionId == "133") + { + first3.PaintShiguang = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + + + if (firstrecordList3[i].FKInpectionId == "134") + { + first3.PaintSecha = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + + + if (firstrecordList3[i].FKInpectionId == "135") + { + first3.PaintDianzi = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + + + if (firstrecordList3[i].FKInpectionId == "136") + { + first3.PaintOther = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + + if (firstrecordList3[i].FKInpectionId == "231") + { + first3.DeviceShuiban = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + + if (firstrecordList3[i].FKInpectionId == "232") + { + first3.DeviceZandian = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "233") + { + first3.DeviceBianxing = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + + if (firstrecordList3[i].FKInpectionId == "234") + { + first3.DeviceYouzhu = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + + if (firstrecordList3[i].FKInpectionId == "235") + { + first3.DeviceTuoluo = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "236") + { + first3.DeviceZhuangshang = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "237") + { + first3.DeviceOther = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + + if (firstrecordList3[i].FKInpectionId == "331") + { + first3.BlankMaoci = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "332") + { + first3.BlankSuoyin = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "333") + { + first3.BlankCanshuang = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "334") + { + first3.BlankShaying = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "335") + { + first3.BlankZangdian = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "336") + { + first3.BlankDamo = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "431") + { + first3.ProgramLiuguang = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "432") + { + first3.ProgramSeqiqueqi = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "433") + { + first3.ProgramQingqiqueqi = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "434") + { + first3.ProgramJupi = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "435") + { + first3.ProgramOther = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "435") + { + first3.ProgramOther = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "531") + { + first3.TeamTuoluocanshuang = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "532") + { + first3.TeamQingqiqikuai = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "533") + { + first3.TeamSeqiqikuai = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "534") + { + first3.TeamFahua = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "535") + { + first3.TeamLiangbang = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + if (firstrecordList3[i].FKInpectionId == "536") + { + first3.TeamPenglou = firstrecordList3[i].Counter; + baofei_total = baofei_total + (int)firstrecordList3[i].Counter; + } + } + + } + + first3.CreatedTime = DateTime.Now; + first3.UpdatedTime = DateTime.Now; + + + + + + + #endregion + #region 计算汇总 + int qualifiedNumber_No_all = paoguang_total + damo_total + baofei_total; + + first.QualifiedNumber = first.RequireNumber - qualifiedNumber_No_all; + first.QualifiedRate = Math.Round(((decimal)first.QualifiedNumber / (decimal)first.RequireNumber) * 100, 3); + first.PaoguangTotal = paoguang_total; + first.DamoTotal = damo_total; + first.BaofeiTotal = baofei_total; + + + var x = Context.Storageable(first).WhereColumns(it => new { it.WorkorderId, it.Remark2 }).ToStorage(); + x.AsInsertable.ExecuteCommand();//不存在插入 + x.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand();//存在更新 + + first2.QualifiedNumber = first2.RequireNumber - qualifiedNumber_No_all; + first2.QualifiedRate = Math.Round(((decimal)first2.QualifiedNumber / (decimal)first2.RequireNumber) * 100, 3); + first2.PaoguangTotal = paoguang_total; + first2.DamoTotal = damo_total; + first2.BaofeiTotal = baofei_total; + + var x2 = Context.Storageable(first2).WhereColumns(it => new { it.WorkorderId, it.Remark2 }).ToStorage(); + x2.AsInsertable.ExecuteCommand();//不存在插入 + x2.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand();//存在更新 + + + + first3.QualifiedNumber = first3.RequireNumber - qualifiedNumber_No_all; + first3.QualifiedRate = Math.Round(((decimal)first3.QualifiedNumber / (decimal)first3.RequireNumber) * 100, 3); + first3.PaoguangTotal = paoguang_total; + first3.DamoTotal = damo_total; + first3.BaofeiTotal = baofei_total; + + var x3 = Context.Storageable(first3).WhereColumns(it => new { it.WorkorderId, it.Remark2 }).ToStorage(); + x3.AsInsertable.ExecuteCommand();//不存在插入 + x3.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand();//存在更新 + #endregion + + + + #endregion + #region 二检 + + #region 打磨 + QcQualityStatisticsAgain again2 = new QcQualityStatisticsAgain(); + again2.Id = SnowFlakeSingle.Instance.NextId().ToString(); + again2.WorkorderId = workorderID; + + ProWorkorder_v2 workorder_again2 = Context.Queryable().Where(it => it.ClientWorkorder == workorderID).First(); + if (workorder_again2 != null) + { + again2.FinishedPartNumber = workorder_again2.FinishedPartNumber; + again2.ProductDescription = workorder_again2.ProductDescription; + again2.RequireNumber = workorder_again2.PreviousNumber; + again2.StartTime = workorder_again2.CreatedTime;//这地方是不妥的 + + + } + + + + + again2.Team = team; + + + again2.EndTime = DateTime.Now; + again2.Remark = "打磨"; + again2.Remark2 = 2; + int damo_total_again = 0; + + + List againrecordList2 = Context.Queryable().Where(it => it.FkWorkorderId == workorderID).Where(it => SqlFunc.Contains(it.FkInpectionId, "_2_")).ToList(); + if (againrecordList2 != null && againrecordList2.Count > 0) + { + for (int i = 0; i < againrecordList2.Count; i++) + { + + if (againrecordList2[i].FkInpectionId == "121") + { + again2.PaintSuokong = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + + if (againrecordList2[i].FkInpectionId == "122") + { + again2.PaintZhengkong = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + + if (againrecordList2[i].FkInpectionId == "123") + { + again2.PaintShiguang = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + + + if (againrecordList2[i].FkInpectionId == "124") + { + again2.PaintSecha = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + + + if (againrecordList2[i].FkInpectionId == "125") + { + again2.PaintDianzi = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + + + if (againrecordList2[i].FkInpectionId == "126") + { + again2.PaintOther = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + + if (againrecordList2[i].FkInpectionId == "221") + { + again2.DeviceShuiban = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + + if (againrecordList2[i].FkInpectionId == "222") + { + again2.DeviceZandian = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "223") + { + first2.DeviceBianxing = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + + if (againrecordList2[i].FkInpectionId == "224") + { + again2.DeviceYouzhu = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + + if (againrecordList2[i].FkInpectionId == "225") + { + again2.DeviceTuoluo = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "226") + { + again2.DeviceZhuangshang = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "227") + { + again2.DeviceOther = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + + if (againrecordList2[i].FkInpectionId == "321") + { + again2.BlankMaoci = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "322") + { + again2.BlankSuoyin = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "323") + { + again2.BlankCanshuang = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "324") + { + again2.BlankShaying = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "325") + { + again2.BlankZangdian = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "326") + { + again2.BlankDamo = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "421") + { + again2.ProgramLiuguang = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "422") + { + again2.ProgramSeqiqueqi = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "423") + { + again2.ProgramQingqiqueqi = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "424") + { + again2.ProgramJupi = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "425") + { + again2.ProgramOther = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "425") + { + again2.ProgramOther = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "521") + { + again2.TeamTuoluocanshuang = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "522") + { + again2.TeamQingqiqikuai = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "523") + { + again2.TeamSeqiqikuai = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "524") + { + again2.TeamFahua = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "525") + { + again2.TeamLiangbang = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + if (againrecordList2[i].FkInpectionId == "526") + { + again2.TeamPenglou = againrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)againrecordList2[i].Counter; + } + } + + } + + again2.CreatedTime = DateTime.Now; + again2.UpdatedTime = DateTime.Now; + + + + + + + #endregion + #region 报废 + QcQualityStatisticsAgain again3 = new QcQualityStatisticsAgain(); + again3.Id = SnowFlakeSingle.Instance.NextId().ToString(); + again3.WorkorderId = workorderID; + + ProWorkorder_v2 workorder_again3 = Context.Queryable().Where(it => it.ClientWorkorder == workorderID).First(); + if (workorder_again3 != null) + { + again3.FinishedPartNumber = workorder_again3.FinishedPartNumber; + again3.ProductDescription = workorder_again3.ProductDescription; + again3.RequireNumber = workorder_again3.PreviousNumber; + again3.StartTime = workorder_again3.CreatedTime;//这地方是不妥的 + + + } + + + again3.Team = team; + again3.EndTime = DateTime.Now; + again3.Remark = "报废"; + again3.Remark2 = 3; + int baofei_total_again3 = 0; + + List againrecordList3 = Context.Queryable().Where(it => it.FkWorkorderId == workorderID).Where(it => SqlFunc.Contains(it.FkWorkorderId, "_3_")).ToList(); + if (againrecordList3 != null && againrecordList3.Count > 0) + { + for (int i = 0; i < againrecordList3.Count; i++) + { + + if (againrecordList3[i].FkInpectionId == "131") + { + again3.PaintSuokong = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + + if (againrecordList3[i].FkInpectionId == "132") + { + again3.PaintZhengkong = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + + if (againrecordList3[i].FkInpectionId == "133") + { + again3.PaintShiguang = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + + + if (againrecordList3[i].FkInpectionId == "134") + { + again3.PaintSecha = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + + + if (againrecordList3[i].FkInpectionId == "135") + { + again3.PaintDianzi = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + + + if (againrecordList3[i].FkInpectionId == "136") + { + again3.PaintOther = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + + if (againrecordList3[i].FkInpectionId == "231") + { + again3.DeviceShuiban = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + + if (againrecordList3[i].FkInpectionId == "232") + { + again3.DeviceZandian = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "233") + { + again3.DeviceBianxing = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + + if (againrecordList3[i].FkInpectionId == "234") + { + again3.DeviceYouzhu = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + + if (againrecordList3[i].FkInpectionId == "235") + { + again3.DeviceTuoluo = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "236") + { + again3.DeviceZhuangshang = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "237") + { + again3.DeviceOther = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + + if (againrecordList3[i].FkInpectionId == "331") + { + again3.BlankMaoci = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "332") + { + again3.BlankSuoyin = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "333") + { + again3.BlankCanshuang = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "334") + { + again3.BlankShaying = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "335") + { + again3.BlankZangdian = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "336") + { + again3.BlankDamo = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "431") + { + again3.ProgramLiuguang = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "432") + { + again3.ProgramSeqiqueqi = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "433") + { + again3.ProgramQingqiqueqi = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "434") + { + again3.ProgramJupi = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "435") + { + again3.ProgramOther = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "435") + { + again3.ProgramOther = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "531") + { + again3.TeamTuoluocanshuang = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "532") + { + again3.TeamQingqiqikuai = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "533") + { + again3.TeamSeqiqikuai = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "534") + { + again3.TeamFahua = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "535") + { + again3.TeamLiangbang = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + if (againrecordList3[i].FkInpectionId == "536") + { + again3.TeamPenglou = againrecordList3[i].Counter; + baofei_total_again3 = baofei_total_again3 + (int)againrecordList3[i].Counter; + } + } + + } + + again3.CreatedTime = DateTime.Now; + again3.UpdatedTime = DateTime.Now; + + + + + + + #endregion + #region 计算汇总 + int qualifiedNumber_No_all_again = damo_total_again + baofei_total_again3; + + again2.QualifiedNumber = again2.RequireNumber - qualifiedNumber_No_all_again; + again2.QualifiedRate = Math.Round(((decimal)again2.QualifiedNumber / (decimal)again2.RequireNumber) * 100, 3); + + again2.DamoTotal = damo_total_again; + again2.BaofeiTotal = baofei_total_again3; + + + var x_again_2 = Context.Storageable(again2).WhereColumns(it => new { it.WorkorderId, it.Remark2 }).ToStorage(); + x_again_2.AsInsertable.ExecuteCommand();//不存在插入 + x_again_2.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand();//存在更新 + + + + + again3.QualifiedNumber = again3.RequireNumber - qualifiedNumber_No_all_again; + again3.QualifiedRate = Math.Round(((decimal)again3.QualifiedNumber / (decimal)again3.RequireNumber) * 100, 3); + + again3.DamoTotal = damo_total_again; + again3.BaofeiTotal = baofei_total_again3; + + var x_again_3 = Context.Storageable(again3).WhereColumns(it => new { it.WorkorderId, it.Remark2 }).ToStorage(); + x_again_3.AsInsertable.ExecuteCommand();//不存在插入 + x_again_3.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand();//存在更新 + #endregion + + + #endregion + #region 三检 + + + #region 打磨 + QcQualityStatisticsFinal final2 = new QcQualityStatisticsFinal(); + final2.Id = SnowFlakeSingle.Instance.NextId().ToString(); + final2.WorkorderId = workorderID; + + ProWorkorder_v2 workorder_final2 = Context.Queryable().Where(it => it.ClientWorkorder == workorderID).First(); + if (workorder_final2 != null) + { + final2.FinishedPartNumber = workorder_final2.FinishedPartNumber; + final2.ProductDescription = workorder_final2.ProductDescription; + final2.RequireNumber = workorder_final2.PreviousNumber; + final2.StartTime = workorder_final2.CreatedTime;//这地方是不妥的 + + + } + + + + + final2.Team = team; + + + final2.EndTime = DateTime.Now; + final2.Remark = "打磨"; + final2.Remark2 = 2; + int damo_total_final = 0; + + + List finalrecordList2 = Context.Queryable().Where(it => it.FkWorkorderId == workorderID).Where(it => SqlFunc.Contains(it.FkInpectionId, "_2_")).ToList(); + if (finalrecordList2 != null && finalrecordList2.Count > 0) + { + for (int i = 0; i < finalrecordList2.Count; i++) + { + + if (finalrecordList2[i].FkInpectionId == "121") + { + final2.PaintSuokong = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + + if (finalrecordList2[i].FkInpectionId == "122") + { + final2.PaintZhengkong = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + + if (finalrecordList2[i].FkInpectionId == "123") + { + final2.PaintShiguang = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + + + if (finalrecordList2[i].FkInpectionId == "124") + { + final2.PaintSecha = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + + + if (finalrecordList2[i].FkInpectionId == "125") + { + final2.PaintDianzi = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + + + if (finalrecordList2[i].FkInpectionId == "126") + { + final2.PaintOther = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + + if (finalrecordList2[i].FkInpectionId == "221") + { + final2.DeviceShuiban = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + + if (finalrecordList2[i].FkInpectionId == "222") + { + final2.DeviceZandian = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "223") + { + first2.DeviceBianxing = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + + if (finalrecordList2[i].FkInpectionId == "224") + { + final2.DeviceYouzhu = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + + if (finalrecordList2[i].FkInpectionId == "225") + { + final2.DeviceTuoluo = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "226") + { + final2.DeviceZhuangshang = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "227") + { + final2.DeviceOther = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + + if (finalrecordList2[i].FkInpectionId == "321") + { + final2.BlankMaoci = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "322") + { + final2.BlankSuoyin = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "323") + { + final2.BlankCanshuang = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "324") + { + final2.BlankShaying = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "325") + { + final2.BlankZangdian = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "326") + { + final2.BlankDamo = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "421") + { + final2.ProgramLiuguang = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "422") + { + final2.ProgramSeqiqueqi = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "423") + { + final2.ProgramQingqiqueqi = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "424") + { + final2.ProgramJupi = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "425") + { + final2.ProgramOther = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "425") + { + final2.ProgramOther = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "521") + { + final2.TeamTuoluocanshuang = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "522") + { + final2.TeamQingqiqikuai = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "523") + { + final2.TeamSeqiqikuai = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "524") + { + final2.TeamFahua = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "525") + { + final2.TeamLiangbang = finalrecordList2[i].Counter; + damo_total_final = damo_total_final + (int)finalrecordList2[i].Counter; + } + if (finalrecordList2[i].FkInpectionId == "526") + { + final2.TeamPenglou = finalrecordList2[i].Counter; + damo_total_again = damo_total_again + (int)finalrecordList2[i].Counter; + } + } + + } + + final2.CreatedTime = DateTime.Now; + final2.UpdatedTime = DateTime.Now; + + + + + + + #endregion + #region 报废 + QcQualityStatisticsFinal final3 = new QcQualityStatisticsFinal(); + final3.Id = SnowFlakeSingle.Instance.NextId().ToString(); + final3.WorkorderId = workorderID; + + ProWorkorder_v2 workorder_final3 = Context.Queryable().Where(it => it.ClientWorkorder == workorderID).First(); + if (workorder_again3 != null) + { + final3.FinishedPartNumber = workorder_final3.FinishedPartNumber; + final3.ProductDescription = workorder_final3.ProductDescription; + final3.RequireNumber = workorder_final3.PreviousNumber; + final3.StartTime = workorder_final3.CreatedTime;//这地方是不妥的 + + + } + + + final3.Team = team; + final3.EndTime = DateTime.Now; + final3.Remark = "报废"; + final3.Remark2 = 3; + int baofei_total_final = 0; + + List finalrecordList3 = Context.Queryable().Where(it => it.FkWorkorderId == workorderID).Where(it => SqlFunc.Contains(it.FkWorkorderId, "_3_")).ToList(); + if (finalrecordList3 != null && finalrecordList3.Count > 0) + { + for (int i = 0; i < finalrecordList3.Count; i++) + { + + if (finalrecordList3[i].FkInpectionId == "131") + { + final3.PaintSuokong = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + + if (finalrecordList3[i].FkInpectionId == "132") + { + final3.PaintZhengkong = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + + if (finalrecordList3[i].FkInpectionId == "133") + { + final3.PaintShiguang = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + + + if (finalrecordList3[i].FkInpectionId == "134") + { + final3.PaintSecha = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + + + if (finalrecordList3[i].FkInpectionId == "135") + { + final3.PaintDianzi = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + + + if (finalrecordList3[i].FkInpectionId == "136") + { + final3.PaintOther = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + + if (finalrecordList3[i].FkInpectionId == "231") + { + final3.DeviceShuiban = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + + if (finalrecordList3[i].FkInpectionId == "232") + { + final3.DeviceZandian = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "233") + { + final3.DeviceBianxing = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + + if (finalrecordList3[i].FkInpectionId == "234") + { + final3.DeviceYouzhu = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + + if (finalrecordList3[i].FkInpectionId == "235") + { + final3.DeviceTuoluo = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "236") + { + final3.DeviceZhuangshang = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "237") + { + final3.DeviceOther = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + + if (finalrecordList3[i].FkInpectionId == "331") + { + final3.BlankMaoci = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "332") + { + final3.BlankSuoyin = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "333") + { + final3.BlankCanshuang = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "334") + { + final3.BlankShaying = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "335") + { + final3.BlankZangdian = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "336") + { + final3.BlankDamo = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "431") + { + final3.ProgramLiuguang = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "432") + { + final3.ProgramSeqiqueqi = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "433") + { + final3.ProgramQingqiqueqi = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "434") + { + final3.ProgramJupi = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "435") + { + final3.ProgramOther = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "435") + { + final3.ProgramOther = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "531") + { + final3.TeamTuoluocanshuang = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "532") + { + final3.TeamQingqiqikuai = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "533") + { + final3.TeamSeqiqikuai = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "534") + { + final3.TeamFahua = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "535") + { + final3.TeamLiangbang = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + if (finalrecordList3[i].FkInpectionId == "536") + { + final3.TeamPenglou = finalrecordList3[i].Counter; + baofei_total_final = baofei_total_final + (int)finalrecordList3[i].Counter; + } + } + + } + + final3.CreatedTime = DateTime.Now; + final3.UpdatedTime = DateTime.Now; + + + + + + + #endregion + #region 计算汇总 + int qualifiedNumber_No_all_final = baofei_total_final+ damo_total_final; + + final2.QualifiedNumber = final3.RequireNumber - qualifiedNumber_No_all_final; + final2.QualifiedRate = Math.Round(((decimal)final2.QualifiedNumber / (decimal)final2.RequireNumber) * 100, 3); + + final2.DamoTotal = damo_total_final; + final2.BaofeiTotal = baofei_total_final; + + + var x_final_2 = Context.Storageable(final2).WhereColumns(it => new { it.WorkorderId, it.Remark2 }).ToStorage(); + x_final_2.AsInsertable.ExecuteCommand();//不存在插入 + x_final_2.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand();//存在更新 + + + + + final3.QualifiedNumber = final3.RequireNumber - qualifiedNumber_No_all_final; + final3.QualifiedRate = Math.Round(((decimal)final3.QualifiedNumber / (decimal)final3.RequireNumber) * 100, 3); + + final3.DamoTotal = damo_total_final; + final3.BaofeiTotal = baofei_total_final; + + var x_final_3 = Context.Storageable(final3).WhereColumns(it => new { it.WorkorderId, it.Remark2 }).ToStorage(); + x_final_3.AsInsertable.ExecuteCommand();//不存在插入 + x_final_3.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand();//存在更新 + #endregion + + + #endregion + #region 总报表 + #region 打磨 将二检的打磨和三检的打磨合并 + QcQualityStatisticsTotal total2 = new QcQualityStatisticsTotal(); + total2.Id = SnowFlakeSingle.Instance.NextId().ToString(); + total2.WorkorderId = workorderID; + + + total2.FinishedPartNumber = again2.FinishedPartNumber; + total2.ProductDescription = again2.ProductDescription; + total2.RequireNumber = again2.RequireNumber; + total2.StartTime = again2.CreatedTime;//这地方是不妥的 @@ -1554,6 +2982,138 @@ namespace ZR.Service.mes.qc + total2.Team = team; + + + total2.EndTime = DateTime.Now; + total2.Remark = "打磨"; + total2.Remark2 = 2; + total2.PaintSuokong = again2.PaintSuokong + final2.PaintSuokong; + total2.PaintZhengkong = again2.PaintZhengkong + final2.PaintZhengkong; + total2.PaintShiguang = again2.PaintShiguang + final2.PaintShiguang; + total2.PaintSecha = again2.PaintSecha + final2.PaintSecha; + total2.PaintDianzi = again2.PaintDianzi + final2.PaintDianzi; + total2.DeviceShuiban = again2.DeviceShuiban + final2.DeviceShuiban; + total2.PaintOther = again2.PaintOther + final2.PaintOther; + total2.DeviceZandian = again2.DeviceZandian + final2.DeviceZandian; + total2.DeviceBianxing = again2.DeviceBianxing + final2.DeviceBianxing; + total2.DeviceYouzhu = again2.DeviceYouzhu + final2.DeviceYouzhu; + total2.DeviceTuoluo = again2.DeviceTuoluo + final2.DeviceTuoluo; + total2.DeviceZhuangshang = again2.DeviceZhuangshang + final2.DeviceZhuangshang; + total2.DeviceOther = again2.DeviceOther + final2.DeviceOther; + total2.BlankMaoci = again2.BlankMaoci + final2.BlankMaoci; + total2.BlankSuoyin = again2.BlankSuoyin + final2.BlankSuoyin; + total2.BlankCanshuang = again2.BlankCanshuang + final2.BlankCanshuang; + total2.BlankShaying = again2.BlankShaying + final2.BlankShaying; + total2.BlankZangdian = again2.BlankZangdian + final2.BlankZangdian; + total2.BlankDamo = again2.BlankDamo + final2.BlankDamo; + total2.ProgramLiuguang = again2.ProgramLiuguang + final2.ProgramLiuguang; + total2.ProgramSeqiqueqi = again2.ProgramSeqiqueqi + final2.ProgramSeqiqueqi; + total2.ProgramQingqiqueqi = again2.ProgramQingqiqueqi + final2.ProgramQingqiqueqi; + total2.ProgramJupi = again2.ProgramJupi + final2.ProgramJupi; + total2.TeamTuoluocanshuang = again2.TeamTuoluocanshuang + final2.TeamTuoluocanshuang; + total2.ProgramOther = again2.ProgramOther + final2.ProgramOther; + total2.TeamQingqiqikuai = again2.TeamQingqiqikuai + final2.TeamQingqiqikuai; + total2.TeamSeqiqikuai = again2.TeamSeqiqikuai + final2.TeamSeqiqikuai; + total2.TeamFahua = again2.TeamFahua + final2.TeamFahua; + total2.TeamLiangbang = again2.TeamLiangbang + final2.TeamLiangbang; + total2.TeamPenglou = again2.TeamPenglou + final2.TeamPenglou; + + + + + + total2.CreatedTime = DateTime.Now; + total2.UpdatedTime = DateTime.Now; + + #endregion + #region 报废 =二检报废+三检报废 + QcQualityStatisticsTotal total3 = new QcQualityStatisticsTotal(); + total3.Id = SnowFlakeSingle.Instance.NextId().ToString(); + total3.WorkorderId = workorderID; + + + total3.FinishedPartNumber = again3.FinishedPartNumber; + total3.ProductDescription = again3.ProductDescription; + total3.RequireNumber = again3.RequireNumber; + total3.StartTime = again3.CreatedTime;//这地方是不妥的 + + + + + total3.Team = team; + total3.EndTime = DateTime.Now; + total3.Remark = "报废"; + total3.Remark2 = 3; + + total3.PaintSuokong = again3.PaintSuokong + final3.PaintSuokong; + total3.PaintZhengkong = again3.PaintZhengkong + final3.PaintZhengkong; + total3.PaintShiguang = again3.PaintShiguang + final3.PaintShiguang; + total3.PaintSecha = again3.PaintSecha + final3.PaintSecha; + total3.PaintDianzi = again3.PaintDianzi + final3.PaintDianzi; + total3.DeviceShuiban = again3.DeviceShuiban + final3.DeviceShuiban; + total3.PaintOther = again3.PaintOther + final3.PaintOther; + total3.DeviceZandian = again3.DeviceZandian + final3.DeviceZandian; + total3.DeviceBianxing = again3.DeviceBianxing + final3.DeviceBianxing; + total3.DeviceYouzhu = again3.DeviceYouzhu + final3.DeviceYouzhu; + total3.DeviceTuoluo = again3.DeviceTuoluo + final3.DeviceTuoluo; + total3.DeviceZhuangshang = again3.DeviceZhuangshang + final3.DeviceZhuangshang; + total3.DeviceOther = again3.DeviceOther + final3.DeviceOther; + total3.BlankMaoci = again3.BlankMaoci + final3.BlankMaoci; + total3.BlankSuoyin = again3.BlankSuoyin + final3.BlankSuoyin; + total3.BlankCanshuang = again3.BlankCanshuang + final3.BlankCanshuang; + total3.BlankShaying = again3.BlankShaying + final3.BlankShaying; + total3.BlankZangdian = again3.BlankZangdian + final3.BlankZangdian; + total3.BlankDamo = again3.BlankDamo + final3.BlankDamo; + total3.ProgramLiuguang = again3.ProgramLiuguang + final3.ProgramLiuguang; + total3.ProgramSeqiqueqi = again3.ProgramSeqiqueqi + final3.ProgramSeqiqueqi; + total3.ProgramQingqiqueqi = again3.ProgramQingqiqueqi + final3.ProgramQingqiqueqi; + total3.ProgramJupi = again3.ProgramJupi + final3.ProgramJupi; + total3.TeamTuoluocanshuang = again3.TeamTuoluocanshuang + final3.TeamTuoluocanshuang; + total3.ProgramOther = again3.ProgramOther + final3.ProgramOther; + total3.TeamQingqiqikuai = again3.TeamQingqiqikuai + final3.TeamQingqiqikuai; + total3.TeamSeqiqikuai = again3.TeamSeqiqikuai + final3.TeamSeqiqikuai; + total3.TeamFahua = again3.TeamFahua + final3.TeamFahua; + total3.TeamLiangbang = again3.TeamLiangbang + final3.TeamLiangbang; + total3.TeamPenglou = again3.TeamPenglou + final3.TeamPenglou; + + + + total3.CreatedTime = DateTime.Now; + total3.UpdatedTime = DateTime.Now; + + + #endregion + #region 计算汇总 + int qualifiedNumber_No_all_total = qualifiedNumber_No_all_again + qualifiedNumber_No_all_final; + + total2.QualifiedNumber = again2.RequireNumber - qualifiedNumber_No_all_total; + total2.QualifiedRate = Math.Round(((decimal)total2.QualifiedNumber / (decimal)total2.RequireNumber) * 100, 3); + + total2.DamoTotal = damo_total_again+ damo_total_final; + total2.BaofeiTotal = baofei_total_again3+baofei_total_final; + + + var x_total_2 = Context.Storageable(total2).WhereColumns(it => new { it.WorkorderId, it.Remark2 }).ToStorage(); + x_total_2.AsInsertable.ExecuteCommand();//不存在插入 + x_total_2.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand();//存在更新 + + total3.QualifiedNumber = again3.RequireNumber - qualifiedNumber_No_all_total; + total3.QualifiedRate = Math.Round(((decimal)total3.QualifiedNumber / (decimal)total3.RequireNumber) * 100, 3); + + total3.DamoTotal = damo_total_again + damo_total_final; + total3.BaofeiTotal = baofei_total_again3 + baofei_total_final; + + + var x_total_3 = Context.Storageable(total3).WhereColumns(it => new { it.WorkorderId, it.Remark2 }).ToStorage(); + x_total_3.AsInsertable.ExecuteCommand();//不存在插入 + x_total_3.AsUpdateable.IgnoreColumns(z => z.CreatedTime).ExecuteCommand();//存在更新 + + + + #endregion + + #endregion @@ -1561,24 +3121,9 @@ namespace ZR.Service.mes.qc - - - - - - - - - - - - //二检 - //三检 - //总报表 } - - throw new NotImplementedException(); + return 1; } } } diff --git a/ZR.Service/mes/qc/QcRoughService.cs b/ZR.Service/mes/qc/QcRoughService.cs index 25cdf0cf..f5301dd3 100644 --- a/ZR.Service/mes/qc/QcRoughService.cs +++ b/ZR.Service/mes/qc/QcRoughService.cs @@ -42,7 +42,6 @@ namespace ZR.Service.mes.qu Id = qc.Id, FkMaterialrequisitionId = qc.FkMaterialrequisitionId, Workblankpartnumber = wm.Workblankpartnumber, - Status = wm.Status, Year = wm.Year, Week = wm.Week,