| | |
| | | using System.Data; |
| | | using DnsClient.Protocol; |
| | | using MES.Service.DB; |
| | | using MES.Service.Dto.service; |
| | | using MES.Service.Modes; |
| | | using MES.Service.util; |
| | | using SqlSugar; |
| | | using DbType = System.Data.DbType; |
| | | |
| | | namespace MES.Service.service.QC; |
| | | |
| | | public class XJService |
| | |
| | | |
| | | //in的写法 https://www.donet5.com/Home/Doc?typeId=1187 |
| | | |
| | | return db.Queryable<Womdaa, MesItems>( |
| | | (a, c) => |
| | | new JoinQueryInfos( |
| | | JoinType.Left, a.Daa002 == c.Id.ToString() )) |
| | | .Where(a => a.Daa001 == daa001 ) |
| | | return db.Queryable<Womdaa, MesItems>((a, c) => |
| | | new JoinQueryInfos( |
| | | JoinType.Left, a.Daa002 == c.Id.ToString())) |
| | | .Where(a => a.Daa001 == daa001) |
| | | .Select((a, c) => new Womdaa |
| | | { |
| | | Daa001 = a.Daa001, |
| | |
| | | |
| | | return db.Queryable<Womdaa, MesLine>((a, b) => |
| | | new JoinQueryInfos(JoinType.Left, a.Daa015 == b.LineNo)) |
| | | .GroupBy((a, b) => new |
| | | .GroupBy((a, b) => new |
| | | { |
| | | a.Daa015, b.LineName |
| | | }) |
| | |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | return db.Queryable<Womdaa>().Where(a => |
| | | a.Daa015 == daa020 && |
| | | a.Daa002 == item ) |
| | | a.Daa015 == daa020 && |
| | | a.Daa002 == item) |
| | | .Select<Womdaa>(a => new Womdaa |
| | | { |
| | | Daa001 = a.Daa001, |
| | | // DetailMem = a.DetailMem |
| | | Daa001 = a.Daa001 |
| | | // DetailMem = a.DetailMem |
| | | }).ToList(); |
| | | } |
| | | |
| | |
| | | return db.Queryable<Womdaa>() |
| | | .Where(a => |
| | | a.Daa015 == lineNo) |
| | | .Select<Womdaa>(a => |
| | | .Select<Womdaa>(a => |
| | | new Womdaa |
| | | { |
| | | Daa002 = a.Daa002, |
| | |
| | | //DetailMem = a.DetailMem |
| | | }).OrderBy(a => a.Daa002).ToList(); |
| | | } |
| | | |
| | | public List<QsQaItemXj> getPage(XJPageResult queryObj) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | |
| | | .WhereIF(lineNo != null && lineNo.Length > 0, |
| | | (s, a) => lineNo.Contains(a.Daa015)) |
| | | .WhereIF( |
| | | (StringUtil.IsNotNullOrEmpty(queryObj.result) && "未完成".Equals(queryObj.result)), |
| | | (s, a) => s.FcheckResu == null || s.Fsubmit == null || s.Fsubmit == 0) |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | "未完成".Equals(queryObj.result), |
| | | (s, a) => s.FcheckResu == null || s.Fsubmit == null || |
| | | s.Fsubmit == 0) |
| | | .WhereIF( |
| | | (StringUtil.IsNotNullOrEmpty(queryObj.result) && !"未完成".Equals(queryObj.result)), |
| | | (s, a) => s.FcheckResu != null && s.Fsubmit != null && s.Fsubmit != 0) |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | !"未完成".Equals(queryObj.result), |
| | | (s, a) => s.FcheckResu != null && s.Fsubmit != null && |
| | | s.Fsubmit != 0) |
| | | .WhereIF(id > 0, (s, a) => s.Id == id) |
| | | .Select((s, a) => new QsQaItemXj |
| | | { |
| | |
| | | PlanQty = a.Daa008, // 工单数量 |
| | | ItemModel = a.Daa004, // 规格 |
| | | ItemName = a.Daa003, // 产品名称 |
| | | ItemId = a.Daa002, // 产品名称 |
| | | // Fsubmit = s.Fsubmit // 若需要返回 Fsubmit 字段 |
| | | ItemId = a.Daa002 // 产品名称 |
| | | // Fsubmit = s.Fsubmit // 若需要返回 Fsubmit 字段 |
| | | }) |
| | | .OrderBy(s => s.CreateDate, OrderByType.Desc) |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit); |
| | |
| | | FcheckBy = s.FcheckBy, |
| | | FcheckResu = s.FcheckResu, |
| | | Remarks = s.Remarks, |
| | | |
| | | |
| | | PlanQty = a.Daa008,//工单数量 |
| | | ItemModel = a.Daa004,//规格 |
| | | ItemName = a.Daa003,//产品名称 |
| | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | var count = db.Queryable<MesQa>().Where(s => s.QsType == "2" |
| | | && s.ItemId == itemId && s.Fsubmit == 1).Count(); |
| | | && s.ItemId == itemId && s.Fsubmit == 1).Count(); |
| | | |
| | | if (count <= 0) return new List<QsQaItemXj01>(); |
| | | |
| | | return db |
| | | .Queryable<MesQualityStandard>() |
| | | .Where(b => b.QsType == "2" |
| | | && b.ItemId == itemId).Select( |
| | | b => new QsQaItemXj01 |
| | | { |
| | | 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 QsQaItemXj01 |
| | | { |
| | | 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(); |
| | | } |
| | | |
| | | public List<QsQaItemXj01> getJYItem(decimal? pid, decimal? id) |
| | |
| | | |
| | | if (count == passCount) result = 1; |
| | | |
| | | var useTransactionWithOracle = SqlSugarHelper.UseTransactionWithOracle( |
| | | db => |
| | | var useTransactionWithOracle = |
| | | SqlSugarHelper.UseTransactionWithOracle(db => |
| | | { |
| | | var commit = 0; |
| | | commit += db.Updateable<QsQaItemXj01>() |
| | |
| | | .ExecuteCommand(); |
| | | }); |
| | | } |
| | | |
| | | |
| | | public bool XJQaSubmit(QsItem item) |
| | | { |
| | | var (factory, company) = UserUtil.GetFactory(item.userNo); |
| | | 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_Id", item.gid, DbType.Int32, ParameterDirection.Input), |
| | | new("p_Flag", 1, DbType.Int32, 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 ("0".Equals(resultValue)) {throw new Exception(messageValue);} |
| | | |
| | | if ("1".Equals(resultValue)) throw new Exception(messageValue); |
| | | if ("0".Equals(resultValue)) throw new Exception(messageValue); |
| | | |
| | | return true; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | LineName = b.LineName |
| | | }).OrderBy("a.Daa015").ToList(); |
| | | } |
| | | |
| | | } |