| | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | var count = db.Queryable<MesQa>().Where(s => s.QsType == "3" |
| | | && s.ItemId == itemId && s.Fsubmit == 1).Count(); |
| | | && s.ItemId == itemId && s.Fsubmit == 1).Count(); |
| | | |
| | | if (count <= 0) return []; |
| | | |
| | | var qsItemOqcItems = db |
| | | .Queryable<MesQualityStandard>() |
| | | .Where(b => b.QsType == "3" |
| | | && b.ItemId == itemId).Select( |
| | | b => new QsItemOqcItem |
| | | { |
| | | ProjName = b.ProjName, |
| | | // ItemMod = b.ItemMod, |
| | | InspectionMethod = b.InspectionMethod, |
| | | UsingInstruments = b.UsingInstruments, |
| | | LevelNum = SqlFunc.IsNull( |
| | | SqlFunc.IsNull(Convert.ToDecimal(b.LevelNum) * Convert.ToDecimal(b.InspectionLevel), 1), |
| | | Convert.ToDecimal(b.InspectionLevel)), |
| | | MaxValue = Convert.ToDecimal(b.MaxValue), |
| | | StandardValue = Convert.ToDecimal(b.StandardValue), |
| | | MinValue = Convert.ToDecimal(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.ItemId == itemId).Select(b => new QsItemOqcItem |
| | | { |
| | | ProjName = b.ProjName, |
| | | // ItemMod = b.ItemMod, |
| | | InspectionMethod = b.InspectionMethod, |
| | | UsingInstruments = b.UsingInstruments, |
| | | LevelNum = SqlFunc.IsNull( |
| | | SqlFunc.IsNull( |
| | | Convert.ToDecimal(b.LevelNum) * |
| | | Convert.ToDecimal(b.InspectionLevel), 1), |
| | | Convert.ToDecimal(b.InspectionLevel)), |
| | | MaxValue = Convert.ToDecimal(b.MaxValue), |
| | | StandardValue = Convert.ToDecimal(b.StandardValue), |
| | | MinValue = Convert.ToDecimal(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 => |
| | | { |
| | |
| | | break; |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(LEV)) throw new Exception("该物料未维护检验项目或检验水平为空"); |
| | | if (string.IsNullOrEmpty(LEV)) |
| | | throw new Exception("该物料未维护检验项目或检验水平为空"); |
| | | |
| | | var sql = |
| | | "SELECT " + LEV + |
| | |
| | | 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>() |
| | |
| | | lineNo = _baseService.getUserLineNo(queryObj.createUser); |
| | | |
| | | return db.Queryable<QsItemOqcReq, RKJDaa001>((a, b) => |
| | | new JoinQueryInfos(JoinType.Left, a.Id == b.ItemInId && a.ItemId == b.ItemId)) |
| | | .WhereIF(lineNo != null && lineNo.Length > 0, (a, b) => lineNo.Contains(b.LineNo)) |
| | | new JoinQueryInfos(JoinType.Left, |
| | | a.Id == b.ItemInId && a.ItemId == b.ItemId)) |
| | | .WhereIF(lineNo != null && lineNo.Length > 0, |
| | | (a, b) => lineNo.Contains(b.LineNo)) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && "未完成".Equals(queryObj.result), |
| | | (a, b) => a.FcheckResu == null || a.Fsubmit == null || a.Fsubmit == 0) |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | "未完成".Equals(queryObj.result), |
| | | (a, b) => a.Fsubmit == null || |
| | | a.Fsubmit == 0) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | !"未完成".Equals(queryObj.result), |
| | | (a, b) => a.FcheckResu != null && a.Fsubmit != null && a.Fsubmit != 0) |
| | | (a, b) => a.Fsubmit == 1) |
| | | .WhereIF(id > 0, (a, b) => a.Id == id) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.itemCj), (a,b) => b.itemCj.Contains(queryObj.itemCj)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.itemCj), |
| | | (a, b) => b.itemCj.Contains(queryObj.itemCj)) |
| | | .Select((a, b) => new QsItemOqcReq |
| | | { |
| | | Id = a.Id, |
| | |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit); |
| | | } |
| | | |
| | | /// 使用 MergeTable + 返回最终扁平结构:data.tbBillList = List<T> |
| | | public class PageResult<T> |
| | | { |
| | | public List<T> tbBillList { get; set; } = new(); |
| | | } |
| | | |
| | | public PageResult<QsItemOqcReq> getSearchPage(XJPageResult queryObj) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | |
| | | lineNo = _baseService.getUserLineNo(queryObj.createUser); |
| | | |
| | | var query = db.Queryable<QsItemOqcReq, RKJDaa001>((a, b) => |
| | | new JoinQueryInfos(JoinType.Left, a.Id == b.ItemInId && a.ItemId == b.ItemId)) |
| | | .WhereIF(lineNo != null && lineNo.Length > 0, (a, b) => lineNo.Contains(b.LineNo)) |
| | | .WhereIF(StringUtil.IsNotNullOrEmpty(queryObj.result) && "未完成".Equals(queryObj.result), |
| | | (a, b) => a.FcheckResu == null || a.Fsubmit == null || a.Fsubmit == 0) |
| | | .WhereIF(StringUtil.IsNotNullOrEmpty(queryObj.result) && !"未完成".Equals(queryObj.result), |
| | | (a, b) => a.FcheckResu != null && a.Fsubmit != null && a.Fsubmit != 0) |
| | | new JoinQueryInfos(JoinType.Left, |
| | | a.Id == b.ItemInId && a.ItemId == b.ItemId)) |
| | | .WhereIF(lineNo != null && lineNo.Length > 0, |
| | | (a, b) => lineNo.Contains(b.LineNo)) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | "未完成".Equals(queryObj.result), |
| | | (a, b) => a.FcheckResu == null || a.Fsubmit == null || |
| | | a.Fsubmit == 0) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | !"未完成".Equals(queryObj.result), |
| | | (a, b) => a.FcheckResu != null && a.Fsubmit != null && |
| | | a.Fsubmit != 0) |
| | | .WhereIF(id > 0, (a, b) => a.Id == id) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.ItemNo), (a, b) => a.ItemNo.Contains(queryObj.ItemNo)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.ItemModel), (a, b) => b.ItemModel.Contains(queryObj.ItemModel)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SongJ), (a, b) => a.FcheckBy.Contains(queryObj.SongJ)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SongNo), (a, b) => a.ReleaseNo.Contains(queryObj.SongNo)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.ItemName), (a, b) => b.ItemName.Contains(queryObj.ItemName)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.itemCj), (a, b) => b.itemCj.Contains(queryObj.itemCj)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.ItemCode), (a, b) => a.BillNo.Contains(queryObj.ItemCode)) |
| | | |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.ItemNo), |
| | | (a, b) => a.ItemNo.Contains(queryObj.ItemNo)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.ItemModel), |
| | | (a, b) => b.ItemModel.Contains(queryObj.ItemModel)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SongJ), |
| | | (a, b) => a.FcheckBy.Contains(queryObj.SongJ)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.SongNo), |
| | | (a, b) => a.ReleaseNo.Contains(queryObj.SongNo)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.ItemName), |
| | | (a, b) => b.ItemName.Contains(queryObj.ItemName)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.itemCj), |
| | | (a, b) => b.itemCj.Contains(queryObj.itemCj)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.ItemCode), |
| | | (a, b) => a.BillNo.Contains(queryObj.ItemCode)) |
| | | .Select((a, b) => new |
| | | { |
| | | a.Id, |
| | |
| | | .OrderBy(it => it.CreateDate, OrderByType.Desc); |
| | | |
| | | var totalCountRef = 0; |
| | | var rawList = query.ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCountRef); |
| | | var rawList = query.ToPageList(queryObj.PageIndex, queryObj.Limit, |
| | | ref totalCountRef); |
| | | |
| | | var resultList = rawList.Select(it => new QsItemOqcReq |
| | | { |
| | |
| | | { |
| | | var items = rkjDto.items; |
| | | var userNo = rkjDto.userNo; |
| | | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | db.Deleteable<QsItemOqcItem>() |
| | | .Where(s => s.Pid == rkjDto.gid) |
| | | .ExecuteCommand(); |
| | | |
| | | db.Deleteable<QsItemOqcItemDetail>() |
| | | .Where(s => s.Gid == rkjDto.gid) |
| | | .ExecuteCommand(); |
| | | |
| | | SqlSugarHelper.UseTransactionWithOracle(db => |
| | | { |
| | |
| | | try |
| | | { |
| | | // 定义输出参数 |
| | | var outputResult = new SugarParameter("o_Result", null, DbType.Int32, ParameterDirection.Output, |
| | | var outputResult = new SugarParameter("o_Result", null, |
| | | DbType.Int32, ParameterDirection.Output, |
| | | 4000); |
| | | |
| | | var outputMessage = new SugarParameter("o_Msg", null, DbType.String, ParameterDirection.Output, 4000); |
| | | var outputMessage = new SugarParameter("o_Msg", null, DbType.String, |
| | | ParameterDirection.Output, 4000); |
| | | |
| | | // 定义输入参数 |
| | | var parameters = new List<SugarParameter> |
| | | { |
| | | new("p_Id", item.gid, DbType.Int32, ParameterDirection.Input), |
| | | new("p_Flag", 1, DbType.Int32, ParameterDirection.Input), |
| | | new("p_User", item.userNo, DbType.String, ParameterDirection.Input), |
| | | new("p_User", item.userNo, DbType.String, |
| | | ParameterDirection.Input), |
| | | outputResult, |
| | | outputMessage |
| | | }; |
| | |
| | | var resultValue = outputResult.Value?.ToString(); |
| | | var messageValue = outputMessage.Value?.ToString(); |
| | | |
| | | if ("1".Equals(resultValue)) |
| | | { |
| | | throw new Exception(messageValue); |
| | | } |
| | | if ("1".Equals(resultValue)) throw new Exception(messageValue); |
| | | |
| | | if ("0".Equals(resultValue)) |
| | | { |
| | | throw new Exception(messageValue); |
| | | } |
| | | if ("0".Equals(resultValue)) throw new Exception(messageValue); |
| | | |
| | | return true; |
| | | } |
| | |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// 使用 MergeTable + 返回最终扁平结构:data.tbBillList = List |
| | | /// <T> |
| | | public class PageResult<T> |
| | | { |
| | | public List<T> tbBillList { get; set; } = new(); |
| | | } |
| | | } |