| | |
| | | [HttpGet("workPieceProcessMachiningPage")] |
| | | public async Task<PageResult<WorkPieceProcessOutput>> WorkPieceProcessMachiningPage([FromQuery] WorkPieceProcessSearch input) |
| | | { |
| | | //var LeftJoin = from emp in ListOfEmployees |
| | | // join dept in ListOfDepartment |
| | | // on emp.DeptID equals dept.ID into JoinedEmpDept |
| | | // from dept in JoinedEmpDept.DefaultIfEmpty() |
| | | // select new |
| | | // { |
| | | // EmployeeName = emp.Name, |
| | | // DepartmentName = dept != null ? dept.Name : null |
| | | // }; |
| | | var workPieceProcesss = await (from process in _workPieceProcessRep.DetachedEntities |
| | | join baseinfo in _equipmentBaseInfoRep.DetachedEntities on process.EquipmentID equals baseinfo.EquipmentId into joinedEmpty |
| | | from baseinfo2 in joinedEmpty.DefaultIfEmpty() |
| | | join workPiece in _workPieceInfoRep.DetachedEntities on process.WorkPieceID equals workPiece.WorkPieceID into joined2Empty |
| | | from workPiece2 in joined2Empty.DefaultIfEmpty() |
| | | |
| | | |
| | | where process.IsDeleted == false && process.WorkPieceID.Contains(string.IsNullOrEmpty(input.WorkPieceID) ? "" : input.WorkPieceID) |
| | | && process.QualityState == (input.QualityState.HasValue ? input.QualityState.Value : process.QualityState) |
| | | && process.EquipmentID == (string.IsNullOrEmpty(input.EquipmentID) ? process.EquipmentID : input.EquipmentID) |
| | | && process.WorkingProcedureCurrent == (string.IsNullOrEmpty(input.WorkingProcedureCurrent) ? process.WorkingProcedureCurrent : input.WorkingProcedureCurrent) |
| | | && workPiece2.OP80NewCode == (string.IsNullOrEmpty(input.OP80NewCode) ? workPiece2.OP80NewCode : input.OP80NewCode) |
| | | |
| | | && process.CreatedUserName.Contains(string.IsNullOrEmpty(input.createUserName) ? "" : input.createUserName) |
| | | && process.UpdatedUserName.Contains(string.IsNullOrEmpty(input.updatedUserName) ? "" : input.updatedUserName) |
| | | |
| | | && ( |
| | | (input.IsHaveOP80Code == "N" && string.IsNullOrEmpty(workPiece2.OP80NewCode)) |
| | | || (input.IsHaveOP80Code == "Y" && !string.IsNullOrEmpty(workPiece2.OP80NewCode)) |
| | | || (string.IsNullOrEmpty(input.IsHaveOP80Code) && 1 == 1) |
| | | ) |
| | | |
| | | && process.EquipmentID == (string.IsNullOrEmpty(input.EquipmentID) ? process.EquipmentID : input.EquipmentID) |
| | | && process.OperationType == (string.IsNullOrEmpty(input.OperationType) ? process.OperationType : input.OperationType) |
| | | && !string.IsNullOrEmpty(process.WorkPieceID) |
| | | && process.StartTime >= (input.StartTimeBeginTime.HasValue ? input.StartTimeBeginTime : DateTime.MinValue) |
| | | && process.StartTime <= (input.StartTimeEndTime.HasValue ? input.StartTimeEndTime : DateTime.MaxValue) |
| | | |
| | | |
| | | |
| | | |
| | | select new WorkPieceProcessOutput |
| | | { |
| | | JiaJuGongWei = process.JiaJuGongWei, |
| | | UpdatedUserName = process.UpdatedUserName, |
| | | DataCapturePointCname = process.DataCapturePointCname, |
| | | UpdateDataCapturePointCname = process.UpdateDataCapturePointCname, |
| | | QualityNoOk = process.QualityNoOk, |
| | | QualityNoOkReason = process.QualityNoOkReason, |
| | | Id = process.Id, |
| | |
| | | .ProjectToType<WorkPieceProcessOutput>() |
| | | .ToADPagedListAsync(input.PageNo, input.PageSize); |
| | | |
| | | // var workPieceProcesss1 = _workPieceProcessRep.DetachedEntities.GroupJoin(_equipmentBaseInfoRep.DetachedEntities |
| | | // , process => process.EquipmentID |
| | | //, baseinfo => baseinfo.EquipmentId |
| | | //, (process, baseinfo) => new { a = process, b = baseinfo.FirstOrDefault() }) |
| | | // .Where(!string.IsNullOrEmpty(input.WorkPieceID), u => u.a.WorkPieceID.Contains(input.WorkPieceID)) |
| | | //.Where(!string.IsNullOrEmpty(input.QualityState.ToString()), u => u.a.QualityState == input.QualityState) |
| | | //.Where(!string.IsNullOrEmpty(input.EquipmentID), u => u.a.EquipmentID.Equals(input.EquipmentID)) |
| | | //.Where(!string.IsNullOrEmpty(input.WorkingProcedureCurrent), u => u.a.WorkingProcedureCurrent.Equals(input.WorkingProcedureCurrent)) |
| | | //.Where(!string.IsNullOrEmpty(input.StartTime.ToString()), u => u.a.StartTime >= input.StartTime) |
| | | //.Where(!string.IsNullOrEmpty(input.EndTime.ToString()), u => u.a.EndTime <= input.EndTime) |
| | | //.Select(s => new WorkPieceProcessOutput |
| | | //{ |
| | | // Id = s.a.Id, |
| | | // WorkPieceID = s.a.WorkPieceID, |
| | | // EquipmentID = s.a.EquipmentID, |
| | | // EquipmentName = (s.b == null ? "" : s.b.EquipmentName), |
| | | // WorkingProcedureCurrent = s.a.WorkingProcedureCurrent, |
| | | // StartTime = s.a.StartTime, |
| | | // EndTime = s.a.EndTime, |
| | | // QualityState = s.a.QualityState, |
| | | // QualityDataInfoID = s.a.QualityDataInfoID |
| | | //}).ToList(); |
| | | // .OrderBy(PageInputOrder.OrderBuilder<WorkPieceProcessSearch>(input)) |
| | | //.ProjectToType<WorkPieceProcessOutput>() |
| | | // .ToADPagedListAsync(input.PageNo, input.PageSize) |
| | | ; |
| | | |
| | | |
| | | //var workPieceProcesss = await _workPieceProcessRep.DetachedEntities |
| | | // .Join(_equipmentBaseInfoRep.DetachedEntities, a => a.EquipmentID, b => b.EquipmentId, (a, b) => new { a, b }) |
| | | // .Join(_sysDictDataRep.DetachedEntities, e => e.a.QualityState.ToString(), f => f.Code, (e, f) => new { e, f }) |
| | | // .Join(_sysDictTypeRep.DetachedEntities, g => g.f.TypeId, h => h.Id, (f, g) => new { f, g }) |
| | | // .Where(x => (x.g.Code.Equals("quality_state"))) |
| | | // .Where(!string.IsNullOrEmpty(input.WorkPieceID), u => u.f.e.a.WorkPieceID.Contains(input.WorkPieceID)) |
| | | // .Where(!string.IsNullOrEmpty(input.EquipmentID), u => u.f.e.a.EquipmentID.Equals(input.EquipmentID)) |
| | | // .Where(!string.IsNullOrEmpty(input.QualityState.ToString()), u => u.f.e.a.QualityState == input.QualityState) |
| | | // .Where(!string.IsNullOrEmpty(input.WorkingProcedureCurrent), u => u.f.e.a.WorkingProcedureCurrent.Equals(input.WorkingProcedureCurrent)) |
| | | // .Where(input.OnlineTimeBeginTime != null, u => u.f.e.a.StartTime >= input.OnlineTimeBeginTime) |
| | | // .Where(input.OnlineTimeEndTime != null, u => u.f.e.a.StartTime <= input.OnlineTimeEndTime) |
| | | // .Select(s => new WorkPieceProcessOutput |
| | | // { |
| | | // Id = s.f.e.a.Id, |
| | | // WorkPieceID = s.f.e.a.WorkPieceID, |
| | | // WorkingProcedureCurrent = s.f.e.a.WorkingProcedureCurrent, |
| | | // EquipmentID = s.f.e.a.EquipmentID, |
| | | // EquipmentName = s.f.e.b.EquipmentName, |
| | | // StartTime = s.f.e.a.StartTime, |
| | | // EndTime = s.f.e.a.EndTime, |
| | | // QualityStateName = s.f.f.Value, |
| | | // }) |
| | | // .Distinct() |
| | | // .OrderBy(PageInputOrder.OrderBuilder<WorkPieceProcessSearch>(input)) |
| | | // .ProjectToType<WorkPieceProcessOutput>() |
| | | // .ToADPagedListAsync(input.PageNo, input.PageSize); |
| | | return workPieceProcesss; |
| | | } |
| | | |
| | |
| | | && process.WorkingProcedureCurrent == (string.IsNullOrEmpty(input.WorkingProcedureCurrent) ? process.WorkingProcedureCurrent : input.WorkingProcedureCurrent) |
| | | && process.EquipmentID == (string.IsNullOrEmpty(input.EquipmentID) ? process.EquipmentID : input.EquipmentID) |
| | | && workPiece2.OP80NewCode == (string.IsNullOrEmpty(input.OP80NewCode) ? workPiece2.OP80NewCode : input.OP80NewCode) |
| | | |
| | | && process.CreatedUserName.Contains(string.IsNullOrEmpty(input.createUserName) ? "" : input.createUserName) |
| | | && process.UpdatedUserName.Contains(string.IsNullOrEmpty(input.updatedUserName) ? "" : input.updatedUserName) |
| | | |
| | | |
| | | && ( |
| | | (input.IsHaveOP80Code == "N" && string.IsNullOrEmpty(workPiece2.OP80NewCode)) |
| | | || (input.IsHaveOP80Code == "Y" && !string.IsNullOrEmpty(workPiece2.OP80NewCode)) |
| | | || (string.IsNullOrEmpty(input.IsHaveOP80Code) && 1 == 1) |
| | | ) |
| | | |
| | | && process.OperationType == (string.IsNullOrEmpty(input.OperationType) ? process.OperationType : input.OperationType) |
| | | && !string.IsNullOrEmpty(process.WorkPieceID) |
| | | && process.StartTime >= (input.StartTimeBeginTime.HasValue ? input.StartTimeBeginTime : DateTime.MinValue) |
| | | && process.StartTime <= (input.StartTimeEndTime.HasValue ? input.StartTimeEndTime : DateTime.MaxValue) |
| | | select new WorkPieceProcessExcelOutput |
| | | { |
| | | |
| | | OP80NewCode = workPiece2.OP80NewCode, |
| | | |
| | | Id = process.Id, |
| | |
| | | .ProjectToType<WorkPieceProcessExcelOutput>() |
| | | .ToListAsync(); |
| | | |
| | | //var workPieceMachiningInfos = await _workPieceProcessRep.DetachedEntities |
| | | // .Join(_equipmentBaseInfoRep.DetachedEntities, a => a.EquipmentID, b => b.EquipmentId, (a, b) => new { a, b }) |
| | | // .Join(_sysDictDataRep.DetachedEntities, e => e.a.QualityState.ToString(), f => f.Code, (e, f) => new { e, f }) |
| | | // .Join(_sysDictTypeRep.DetachedEntities, g => g.f.TypeId, h => h.Id, (f, g) => new { f, g }) |
| | | // .Where(x => (x.g.Code.Equals("quality_state"))) |
| | | // .Where(!string.IsNullOrEmpty(input.WorkPieceID), u => u.f.e.a.WorkPieceID.Contains(input.WorkPieceID)) |
| | | // .Where(!string.IsNullOrEmpty(input.EquipmentID), u => u.f.e.a.EquipmentID.Equals(input.EquipmentID)) |
| | | // .Where(!string.IsNullOrEmpty(input.QualityState.ToString()), u => u.f.e.a.QualityState == input.QualityState) |
| | | // .Where(!string.IsNullOrEmpty(input.WorkingProcedureCurrent), u => u.f.e.a.WorkingProcedureCurrent.Equals(input.WorkingProcedureCurrent)) |
| | | // .Where(input.OnlineTimeBeginTime != null, u => u.f.e.a.StartTime >= input.OnlineTimeBeginTime) |
| | | // .Where(input.OnlineTimeEndTime != null, u => u.f.e.a.StartTime <= input.OnlineTimeEndTime) |
| | | // .Select(s => new WorkPieceProcessExcelOutput |
| | | // { |
| | | // Id = s.f.e.a.Id, |
| | | // WorkPieceID = s.f.e.a.WorkPieceID, |
| | | // WorkingProcedureCurrent = s.f.e.a.WorkingProcedureCurrent, |
| | | // EquipmentName = s.f.e.b.EquipmentName, |
| | | // StartTime = s.f.e.a.StartTime.ToString(), |
| | | // EndTime = s.f.e.a.EndTime.ToString(), |
| | | // QualityStateName = s.f.f.Value, |
| | | // }) |
| | | // .Distinct() |
| | | // .OrderBy(PageInputOrder.OrderBuilder<WorkPieceProcessSearch>(input)) |
| | | // .ProjectToType<WorkPieceProcessExcelOutput>() |
| | | // .ToListAsync(); |
| | | |
| | | foreach (WorkPieceProcessExcelOutput item in workPieceMachiningInfos) |
| | | { |
| | |
| | | .Where(!string.IsNullOrEmpty(input.WorkPieceID), u => u.WorkPieceID.Contains(input.WorkPieceID)) |
| | | .Where(!string.IsNullOrEmpty(input.workingProcedure), u => u.WorkingProcedure.Contains(input.workingProcedure)) |
| | | .Where(!string.IsNullOrEmpty(input.createdUserName), u => u.CreatedUserName.Contains(input.createdUserName)) |
| | | .Where(!string.IsNullOrEmpty(input.DataCapturePointCname), u => u.DataCapturePointCname.Contains(input.DataCapturePointCname)) |
| | | .Where(!string.IsNullOrEmpty(input.PieceLogTypeName), u => u.PieceLogTypeName.Contains(input.PieceLogTypeName)) |
| | | .Where(input.PieceLogType != null, u => u.PieceLogType == input.PieceLogType) |
| | | .Where(!string.IsNullOrEmpty(input.remarks), u => u.Remarks.Contains(input.remarks)) |
| | | .Where(!string.IsNullOrEmpty(input.StartTimeBeginTime.ToString()), u => u.CreatedTime >= input.StartTimeBeginTime) |
| | | .Where(!string.IsNullOrEmpty(input.StartTimeEndTime.ToString()), u => u.CreatedTime <= input.StartTimeEndTime) |
| | | |
| | |
| | | .Where(x => (x.g.Code.Equals("workpiece_state") && (string.IsNullOrEmpty(input.WorkPieceState.ToString()) ? true : x.f.f.Code.Equals(input.WorkPieceState.ToString())))) |
| | | .Where(!string.IsNullOrEmpty(input.WorkPieceID), u => u.f.e.a.WorkPieceID.Contains(input.WorkPieceID)) |
| | | .Where(!string.IsNullOrEmpty(input.OP80NewCode), u => u.f.e.a.OP80NewCode.Contains(input.OP80NewCode)) |
| | | |
| | | .Where(input.IsHaveOP80Code == "Y", u => !string.IsNullOrEmpty(u.f.e.a.OP80NewCode)) |
| | | .Where(input.IsHaveOP80Code == "N", u => string.IsNullOrEmpty(u.f.e.a.OP80NewCode)) |
| | | |
| | | .Where(!string.IsNullOrEmpty(input.WorkPieceState.ToString()), u => u.f.e.a.WorkPieceState == input.WorkPieceState) |
| | | .Where(!string.IsNullOrEmpty(input.EquipmentID), u => u.f.e.a.EquipmentID.Equals(input.EquipmentID)) |
| | | .Where(!string.IsNullOrEmpty(input.WorkingProcedureCurrent), u => u.f.e.a.WorkingProcedureCurrent.Equals(input.WorkingProcedureCurrent)) |
| | |
| | | .Where(x => (x.g.Code.Equals("workpiece_state") && (string.IsNullOrEmpty(input.WorkPieceState.ToString()) ? true : x.f.f.Code.Equals(input.WorkPieceState.ToString())))) |
| | | .Where(!string.IsNullOrEmpty(input.WorkPieceID), u => u.f.e.a.WorkPieceID.Contains(input.WorkPieceID)) |
| | | .Where(!string.IsNullOrEmpty(input.OP80NewCode), u => u.f.e.a.OP80NewCode.Contains(input.OP80NewCode)) |
| | | |
| | | .Where(input.IsHaveOP80Code == "Y", u => !string.IsNullOrEmpty(u.f.e.a.OP80NewCode)) |
| | | .Where(input.IsHaveOP80Code == "N", u => string.IsNullOrEmpty(u.f.e.a.OP80NewCode)) |
| | | |
| | | .Where(!string.IsNullOrEmpty(input.WorkPieceState.ToString()), u => u.f.e.a.WorkPieceState == input.WorkPieceState) |
| | | .Where(!string.IsNullOrEmpty(input.EquipmentID), u => u.f.e.a.EquipmentID.Equals(input.EquipmentID)) |
| | | .Where(!string.IsNullOrEmpty(input.WorkingProcedureCurrent), u => u.f.e.a.WorkingProcedureCurrent.Equals(input.WorkingProcedureCurrent)) |