diff --git a/ZR.Service/mes/op/OperationService.cs b/ZR.Service/mes/op/OperationService.cs index b4f1ecc2..a85d89ac 100644 --- a/ZR.Service/mes/op/OperationService.cs +++ b/ZR.Service/mes/op/OperationService.cs @@ -20,6 +20,7 @@ using static System.Runtime.InteropServices.JavaScript.JSType; using System.Drawing; using Newtonsoft.Json; using ZR.Model.MES.qu; +using static Microsoft.Extensions.Logging.EventSource.LoggingEventSource; namespace ZR.Service.MES.op { @@ -145,7 +146,7 @@ namespace ZR.Service.MES.op { case 1: // 首检抛光数量 - detailsList = Context.Queryable().LeftJoin((f, i) => f.FKInpectionId == i.InspectionCode).Where("f.FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 1 + "_" }) + detailsList = Context.Queryable().LeftJoin((f, i) => SqlFunc.ToInt32(f.FKInpectionId) == i.Id).Where(f => SqlFunc.Like(f.FKInpectionId, "_1_")).Where(f=>f.FKWorkorderId== fkWorkorderId) .Select((f, i) => new DetailsOfDetectionDTO { InspectionName = i.InspectionName, @@ -154,7 +155,7 @@ namespace ZR.Service.MES.op }).ToList(); break; case 2: // 首检打磨数量 - detailsList = Context.Queryable().LeftJoin((f, i) => f.FKInpectionId == i.InspectionCode).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 2 + "_" }) + detailsList = Context.Queryable().LeftJoin((f, i) => SqlFunc.ToInt32(f.FKInpectionId) == i.Id).Where(f => SqlFunc.Like(f.FKInpectionId, "_2_")) .Select((f, i) => new DetailsOfDetectionDTO { InspectionName = i.InspectionName, @@ -165,7 +166,8 @@ namespace ZR.Service.MES.op case 3: // 首检报废数量 - detailsList = Context.Queryable().LeftJoin((f, i) => f.FKInpectionId == i.InspectionCode).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 3 + "_" }) + detailsList = Context.Queryable().LeftJoin((f, i) => SqlFunc.ToInt32(f.FKInpectionId) == i.Id).Where(f => SqlFunc.Like(f.FKInpectionId, "_3_")) + .Select((f, i) => new DetailsOfDetectionDTO { InspectionName = i.InspectionName, @@ -176,7 +178,7 @@ namespace ZR.Service.MES.op case 4: // 二检打磨数量 - detailsList = Context.Queryable().LeftJoin((f, i) => f.FkInpectionId == i.InspectionCode).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 2 + "_" }) + detailsList = Context.Queryable().LeftJoin((f, i) => SqlFunc.ToInt32(f.FkInpectionId) == i.Id).Where(f => SqlFunc.Like(f.FkInpectionId, "_2_")) .Select((f, i) => new DetailsOfDetectionDTO { InspectionName = i.InspectionName, @@ -186,7 +188,7 @@ namespace ZR.Service.MES.op break; case 5: // 二检报废数量 - detailsList = Context.Queryable().LeftJoin((f, i) => f.FkInpectionId == i.InspectionCode).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 3 + "_" }) + detailsList = Context.Queryable().LeftJoin((f, i) => SqlFunc.ToInt32(f.FkInpectionId) == i.Id).Where(f => SqlFunc.Like(f.FkInpectionId, "_3_")) .Select((f, i) => new DetailsOfDetectionDTO { InspectionName = i.InspectionName, @@ -196,7 +198,7 @@ namespace ZR.Service.MES.op break; case 6: // 三检打磨数量 - detailsList = Context.Queryable().LeftJoin((f, i) => f.FkInpectionId == i.InspectionCode).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 2 + "_" }) + detailsList = Context.Queryable().LeftJoin((f, i) => SqlFunc.ToInt32(f.FkInpectionId) == i.Id).Where(f => SqlFunc.Like(f.FkInpectionId, "_2_")) .Select((f, i) => new DetailsOfDetectionDTO { InspectionName = i.InspectionName, @@ -207,7 +209,7 @@ namespace ZR.Service.MES.op break; case 7: // 三检报废数量 - detailsList = Context.Queryable().LeftJoin((f, i) => f.FkInpectionId == i.InspectionCode).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 3+ "_" }) + detailsList = Context.Queryable().LeftJoin((f, i) => SqlFunc.ToInt32(f.FkInpectionId) == i.Id).Where(f => SqlFunc.Like(f.FkInpectionId, "_3_")) .Select((f, i) => new DetailsOfDetectionDTO { InspectionName = i.InspectionName,