From ed05efdc17aab076146b134ebe105b6382f221d7 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期四, 10 七月 2025 10:09:29 +0800 Subject: [PATCH] 格式化代码 --- MES.Service/service/QC/RKJService.cs | 204 ++++++++++++++++++++++++++++++-------------------- 1 files changed, 123 insertions(+), 81 deletions(-) diff --git a/MES.Service/service/QC/RKJService.cs b/MES.Service/service/QC/RKJService.cs index 48afe60..56e9ef3 100644 --- a/MES.Service/service/QC/RKJService.cs +++ b/MES.Service/service/QC/RKJService.cs @@ -1,5 +1,4 @@ -锘縰sing System.Net.NetworkInformation; -using MES.Service.DB; +锘縰sing MES.Service.DB; using MES.Service.Dto.service; using MES.Service.Modes; using MES.Service.util; @@ -74,29 +73,28 @@ var qsItemOqcItems = db .Queryable<MesQualityStandard>() .Where(b => b.QsType == "3" - && b.ItemNo == itemNo).Select( - b => new QsItemOqcItem - { - ProjName = b.ProjName, - ItemMod = b.ItemMod, - InspectionMethod = b.InspectionMethod, - UsingInstruments = b.UsingInstruments, - LevelNum = SqlFunc.IsNull( - SqlFunc.IsNull(b.LevelNum * b.InspectionLevel, 1), - b.InspectionLevel), - MaxValue = b.MaxValue, - StandardValue = b.StandardValue, - MinValue = b.MinValue, - Notes = b.Notes, - FcheckLevel = b.FcheckLevel, - FacLevel = b.FacLevel, - QsCode = b.QsCode, - QsName = b.QsName, - Result = "鏈娴�", - isCheck = 0, - Picture = b.Picture, - Picturename = b.Picturename - }).ToList(); + && b.ItemNo == itemNo).Select(b => new QsItemOqcItem + { + ProjName = b.ProjName, + ItemMod = b.ItemMod, + InspectionMethod = b.InspectionMethod, + UsingInstruments = b.UsingInstruments, + LevelNum = SqlFunc.IsNull( + SqlFunc.IsNull(b.LevelNum * b.InspectionLevel, 1), + b.InspectionLevel), + MaxValue = b.MaxValue, + StandardValue = b.StandardValue, + MinValue = b.MinValue, + Notes = b.Notes, + FcheckLevel = b.FcheckLevel, + FacLevel = b.FacLevel, + QsCode = b.QsCode, + QsName = b.QsName, + Result = "鏈娴�", + isCheck = 0, + Picture = b.Picture, + Picturename = b.Picturename + }).ToList(); qsItemOqcItems.ForEach(item => { @@ -227,10 +225,17 @@ { var commit = 0; - xj.CreateBy = userNo; - xj.CreateDate = DateTime.Now; + // xj.CreateBy = userNo; + // xj.CreateDate = DateTime.Now; - var pid = db.Insertable(xj).ExecuteReturnIdentity(); + var qsItemOqcReq = db.Queryable<QsItemOqcReq>() + .Where(s => s.Id == xj.Id) + .First(); + + decimal? pid = 0; + pid = qsItemOqcReq == null + ? db.Insertable(xj).ExecuteReturnIdentity() + : qsItemOqcReq.Id; xj.Id = pid; @@ -352,8 +357,8 @@ result = 1; else if (count - passCount < QsItemOqcItem.FreQty) result = 1; - var useTransactionWithOracle = SqlSugarHelper.UseTransactionWithOracle( - db => + var useTransactionWithOracle = + SqlSugarHelper.UseTransactionWithOracle(db => { var commit = 0; commit += db.Updateable<QsItemOqcItem>() @@ -404,21 +409,19 @@ // saveDetect02(detail.Gid, detail.CreateBy); - var oqcReq = db.Queryable<QsItemOqcReq>() - .Where(s => s.Id == detail.Gid) - .Select<string?>(s=>s.BillNo) - .First(); + var oqcReq = db.Queryable<QsItemOqcReq>() + .Where(s => s.Id == detail.Gid) + .Select<string?>(s => s.BillNo) + .First(); if (oqcReq != null) - { //FSTATUS //CHECK_RES db.Updateable<MesInvItemIns>() .SetColumns(s => s.Fstatus == 1) - .SetColumns(s=>s.CheckRes == FcheckResu) + .SetColumns(s => s.CheckRes == FcheckResu) .Where(s => s.BillNo == oqcReq) .ExecuteCommand(); - } return useTransactionWithOracle; } @@ -468,53 +471,68 @@ } - public List<QsItemOqcReq> getPage(XJPageResult queryObj) + public (List<QsItemOqcReq> items, int TotalCount) getPage( + XJPageResult queryObj) { var db = SqlSugarHelper.GetInstance(); - return db - .Queryable<QsItemOqcReq, MesItems, MesInvItemIns, Womdaa, MesInvTransaction, RKJDaa001, MesLine>( - (a, b, c, da, ca, m, l) => new JoinQueryInfos( - JoinType.Left, a.ItemNo == b.Id.ToString(), - JoinType.Left, a.BillNo == c.BillNo, - JoinType.Left, da.Daa001 == c.RbillNo, - JoinType.Left, c.TransctionNo == ca.TransactionNo.ToString() - && c.Company == ca.Company - && c.Factory == ca.Factory, - JoinType.Left, m.ItemInId == c.Id, - JoinType.Left, l.LineNo == da.Daa015 - )) - //.WhereIF(!"PL017".Equals(queryObj.createUser), - // (a, b, c, da, ca, m) => lineNo.Contains(da.Daa015)) - .WhereIF(!string.IsNullOrEmpty(queryObj.id), (a, b, c, da, ca, m, l) => a.Id.ToString() == queryObj.id) - .WhereIF( - StringUtil.IsNotNullOrEmpty(queryObj.result) && "鏈畬鎴�".Equals(queryObj.result), - (a, b, c, da, ca, m, l) => a.FcheckResu == null) - .WhereIF( - StringUtil.IsNotNullOrEmpty(queryObj.result) && !"鏈畬鎴�".Equals(queryObj.result), - (a, b, c, da, ca, m, l) => a.FcheckResu != null) - .Select((a, b, c, da, ca, m, l) => new QsItemOqcReq - { - BillNo = a.BillNo, - Remarks = a.Remarks, - Id = a.Id, - CreateDate = a.CreateDate, - CreateBy = a.CreateBy, - FcheckResu = a.FcheckResu, - ItemNo = b.ItemNo, - FcheckBy = a.FcheckBy, - FcheckDate = a.FcheckDate, - ReleaseNo = a.ReleaseNo, - ItemName = b.ItemName, - ItemModel = b.ItemModel, - TaskNo = c.RbillNo, - //CbillNo = c.CbillNo, - //LineNo = da.Daa015, - LineNo = l.LineName, - Quantity = m.Quantity - }) - .OrderBy(a => a.CreateDate, OrderByType.Desc) - .ToPageList(queryObj.PageIndex, queryObj.Limit); + var totalCount = 0; + + var qsItemOqcReqs = db + .Queryable<QsItemOqcReq, MesItems, MesInvItemIns, Womdaa, + MesInvTransaction, RKJDaa001, + MesLine>((a, b, c, da, ca, m, l) => new JoinQueryInfos( + JoinType.Left, a.ItemNo == b.Id.ToString(), + JoinType.Left, a.BillNo == c.BillNo, + JoinType.Left, da.Daa001 == c.RbillNo, + JoinType.Left, c.TransctionNo == ca.TransactionNo.ToString() + && c.Company == ca.Company + && c.Factory == ca.Factory, + JoinType.Left, m.ItemInId == c.Id, + JoinType.Left, l.LineNo == da.Daa015 + )) + //.WhereIF(!"PL017".Equals(queryObj.createUser), + // (a, b, c, da, ca, m) => lineNo.Contains(da.Daa015)) + .WhereIF(!string.IsNullOrEmpty(queryObj.id), + (a, b, c, da, ca, m, l) => a.Id.ToString() == queryObj.id) + .WhereIF( + StringUtil.IsNotNullOrEmpty(queryObj.result) && + "鏈畬鎴�".Equals(queryObj.result), + (a, b, c, da, ca, m, l) => a.FcheckResu == null) + .WhereIF( + StringUtil.IsNotNullOrEmpty(queryObj.result) && + !"鏈畬鎴�".Equals(queryObj.result), + (a, b, c, da, ca, m, l) => a.FcheckResu != null) + .WhereIF( + StringUtil.IsNotNullOrEmpty(queryObj.SearchValue), + (a, b, c, da, ca, m, l) => + a.ReleaseNo.Contains(queryObj.SearchValue) + || b.ItemNo.Contains(queryObj.SearchValue) + ) + .Select((a, b, c, da, ca, m, l) => new QsItemOqcReq + { + BillNo = a.BillNo, + Remarks = a.Remarks, + Id = a.Id, + CreateDate = a.CreateDate, + CreateBy = a.CreateBy, + FcheckResu = a.FcheckResu, + ItemNo = b.ItemNo, + FcheckBy = a.FcheckBy, + FcheckDate = a.FcheckDate, + ReleaseNo = a.ReleaseNo, + ItemName = b.ItemName, + ItemModel = b.ItemModel, + TaskNo = c.RbillNo, + //CbillNo = c.CbillNo, + //LineNo = da.Daa015, + LineNo = l.LineName, + Quantity = m.Quantity + }) + .OrderBy(a => a.CreateDate, OrderByType.Desc) + .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); + + return (qsItemOqcReqs, totalCount); } //鍒犻櫎涓昏〃骞朵笖杩炵骇鍒犻櫎瀛愯〃鍜屽瓩琛� @@ -667,4 +685,28 @@ return Convert.ToInt32(rkjDto.gid); } + + public List<MesInvItemInCDetails2> GetRKDetail(RKJDto rkjDto) + { + //鐗╂枡鏉$爜鍜岀墿鏂欑紪鐮侊紝鏁伴噺 MES_INV_ITEM_IN_C_DETAILS2 + var db = SqlSugarHelper.GetInstance(); + + var oqcReq = db.Queryable<QsItemOqcReq>() + .Where(s => s.Id == rkjDto.gid) + .Select<string?>(s => s.BillNo) + .First(); + + if (oqcReq != null) + { + //FSTATUS + //CHECK_RES + var mesInvItemIns = db.Queryable<MesInvItemIns>() + .Where(s => s.BillNo == oqcReq).First(); + + return db.Queryable<MesInvItemInCDetails2>() + .Where(a => a.ItemInId == mesInvItemIns.Id).ToList(); + } + + return new List<MesInvItemInCDetails2>(); + } } \ No newline at end of file -- Gitblit v1.9.3