public ProjectGridViewModel(IEnumerable <Project> Projects, IProjectPhaseRepository ProjectPhaseRepository, IProjectRoleRepository ProjectRoleRepository, IAttachFileInfoRepository AttachFileInfoRepository, IProjectRepository ProjectRepository, List <Phase> Phases) { //int TotalProjects = 3000; ////int PageNo = 1, //int PageCount = 300; ////page = PageNo; //total = TotalProjects / PageCount + 1; //records = TotalProjects * 3; rows = new List <ProjectGridRowModel>(); List <ProjectRole> _role; string _flitter; foreach (Project _project in Projects) { _role = ProjectRoleRepository.ProjectRoles.Where(f => f.ProjectID == _project.ProjectID).OrderBy(p => p.RoleID).ToList(); //.Where(f => f.RoleID == 3).FirstOrDefault(); //if (_role == null) //{ // _flitter = ""; //} //else //{ // _flitter = _role.UserName; //} int _attQty = AttachFileInfoRepository.GetAttachByObj(_project.ProjectID.ToString(), "Projects").Count(); string _mainProJName; if (_project.ParentID == 0) { _mainProJName = _project.Name; } else { Project _mainProJ = ProjectRepository.GetByID(_project.ParentID); _mainProJName = _mainProJ.Name; } rows.AddRange(new ProjectGridRowModels(_project, ProjectPhaseRepository.GetProjectPhases(_project.ProjectID), _role, Phases, _attQty, _mainProJName).ProjectRows); } }
/// <summary> /// 数据源:外发 /// </summary> /// <param name="Tasks"></param> /// <param name="_viewmodel"></param> /// <param name="ProjectPhaseRepository"></param> /// <param name="SteelDrawingRepo"></param> /// <param name="TaskRepository"></param> public PurchaseContentGridViewModel(IEnumerable <Task> Tasks, List <SetupTaskStart> _viewmodel, IProjectPhaseRepository ProjectPhaseRepository, ISteelCAMDrawingRepository SteelDrawingRepo, ITaskRepository TaskRepository, IWHPartRepository WHPartRepository, IPurchaseTypeRepository PurchaseTypeRepository, string mrPurDate = "" ) { rows = new List <PurchaseContentGridRowModel>(); foreach (var m in _viewmodel) { Task _task = TaskRepository.QueryByTaskID(m.TaskID) ?? new Task(); rows.Add(new PurchaseContentGridRowModel(_task, m, mrPurDate, ProjectPhaseRepository, SteelDrawingRepo, WHPartRepository, PurchaseTypeRepository, _task.Time)); } Page = 1; Total = Tasks.Count(); Records = 500; }
public TaskGridViewModel(IEnumerable <Task> Tasks, IUserRepository UserRepository, string CAMDrawingPath, ICNCMachInfoRepository MachInfoRepository, IEDMDetailRepository EDMDetailRepository, ITaskRepository TaskRepository, IProjectPhaseRepository ProjectPhaseRepository, IMGSettingRepository MGSettingRepository, IWEDMSettingRepository WEDMSettingRepository, ITaskHourRepository TaskHourRepository , ISystemConfigRepository SystemConfigRepo , ITaskTypeRepository TasktypeRepo , IMachinesInfoRepository MachInfoRepo) { ProjectPhase _phase; string _cad, _cam, _workshop, _qc, _planDate; int _phaseID = 0; rows = new List <TaskGridRowModel>(); List <WEDMSetting> _wedmSettings = WEDMSettingRepository.WEDMSettings.ToList(); List <MGSetting> _mgSettings = MGSettingRepository.MGSettings.ToList(); List <User> _users = UserRepository.Users.ToList(); List <ProjectPhase> _pjPhases = ProjectPhaseRepository.ProjectPhases.ToList(); List <TaskHour> _taskhours = TaskHourRepository.TaskHours.ToList(); List <MachinesInfo> _machineInfos = MachInfoRepo.MachinesInfo.ToList(); List <TaskType> _tasktypes = TasktypeRepo.TaskTypes.ToList(); List <CNCMachInfo> _cncmachInfos = MachInfoRepository.CNCMachInfoes.ToList(); List <Task> _tasks = TaskRepository.Tasks.ToList(); List <EDMDetail> _edmDetails = EDMDetailRepository.EDMDetails.ToList(); foreach (Task _task in Tasks) { WEDMSetting wedmsetting = new WEDMSetting(); MGSetting mgsetting = new MGSetting(); switch (_task.TaskType) { case 1: _phaseID = 8; break; case 2: _phaseID = 9; break; case 3: wedmsetting = _wedmSettings.Where(s => s.ID == _task.ProgramID).FirstOrDefault() ?? new WEDMSetting(); //WEDMSettingRepository.QueryByTaskID(_task.TaskID); _phaseID = 10; break; case 4: _phaseID = 8; break; case 6: mgsetting = _mgSettings.Where(s => s.ID == _task.ProgramID).FirstOrDefault() ?? new MGSetting(); //MGSettingRepository.QueryByTaskID(_task.TaskID); _phaseID = 7; break; } _cad = _task.CADUser > 0 ? (_users.Where(u => u.UserID == _task.CADUser).FirstOrDefault() ?? new User()).FullName : ""; //UserRepository.GetUserByID(_task.CADUser).FullName : ""; _cam = _task.CAMUser > 0? (_users.Where(u => u.UserID == _task.CAMUser).FirstOrDefault() ?? new User()).FullName : ""; //UserRepository.GetUserByID(_task.CAMUser).FullName:""; _workshop = _task.WorkshopUser > 0? (_users.Where(u => u.UserID == _task.WorkshopUser).FirstOrDefault() ?? new User()).FullName : ""; //UserRepository.GetUserByID(_task.WorkshopUser).FullName:""; _qc = _task.QCUser > 0 ? (_users.Where(u => u.UserID == _task.QCUser).FirstOrDefault() ?? new User()).FullName : ""; //UserRepository.GetUserByID(_task.QCUser).FullName : ""; CNCMachInfo _machinfo = GetCNCMachinfo(_task, _cncmachInfos, _tasks, _edmDetails); //GetCNCMachinfo(_task,MachInfoRepository, TaskRepository, EDMDetailRepository); decimal TaskHour = 0; try { _phase = _pjPhases.Where(p => p.ProjectID == _task.ProjectID && p.PhaseID == _phaseID).FirstOrDefault() ?? new ProjectPhase();//ProjectPhaseRepository.GetProjectPhases(_task.ProjectID).Where(p => p.PhaseID == _phaseID).FirstOrDefault(); _planDate = _phase.PlanCFinish == new DateTime(1, 1, 1) ? _phase.PlanFinish.ToString("yyyy-MM-dd") : _phase.PlanCFinish.ToString("yyyy-MM-dd"); } catch { _planDate = "-"; } try { TaskHour = GetTotalHourByTaskID(_taskhours, _task.TaskID);//TaskHourRepository.GetTotalHourByTaskID(_task.TaskID); } catch { TaskHour = 0; } string _machineCode = GetMachineByTask(_taskhours, _machineInfos, _task.TaskID); //TaskHourRepository.GetMachineByTask(_task.TaskID) ?? ""; string Operater = GetOperaterByTaskID(_taskhours, _task.TaskID); //TaskHourRepository.GetOperaterByTaskID(_task.TaskID) ?? ""; SetupTaskStart _setupTask = new SetupTaskStart { TaskID = _task.TaskID, TaskName = _task.TaskName, State = Enum.GetName(typeof(TaskStatus), _task.State), MachinesCode = "", MachinesName = _machineCode, TotalTime = Convert.ToInt32(TaskHour), UserID = 0, UserName = Operater, }; //string _camDrawingPath = string.Empty; if (string.IsNullOrEmpty(CAMDrawingPath)) { if (_task.TaskType == 6) { CAMDrawingPath = SystemConfigRepo.GetTaskDrawingPath("CAD"); } else { CAMDrawingPath = SystemConfigRepo.GetTaskDrawingPath(); } } string taskType = string.Empty; int _mgtype = (_tasktypes.Where(t => t.ShortName == "MG" && t.Enable).FirstOrDefault() ?? new TaskType()).TaskID;//(TasktypeRepo.TaskTypes.Where(t => t.ShortName == "MG" && t.Enable).FirstOrDefault() ?? new TaskType()).TaskID;//6 if (_task.TaskType != _mgtype) { taskType = (_tasktypes.Where(t => t.TaskID == _task.TaskType && t.Enable).FirstOrDefault() ?? new TaskType()).Name;//TasktypeRepo.TaskTypes.Where(t => t.TaskID == _task.TaskType).Select(t => t.Name).FirstOrDefault(); } else { string _typeID = (_mgtype.ToString() + _task.OldID.ToString()); taskType = (_tasktypes.Where(t => t.TaskID == Convert.ToInt32(_typeID) && t.Enable).FirstOrDefault() ?? new TaskType()).Name;//TasktypeRepo.TaskTypes.ToList().Where(t => t.TaskID == Convert.ToInt32(_typeID)).Select(t => t.Name).FirstOrDefault(); } rows.Add(new TaskGridRowModel(_task, _cad, _cam, _workshop, _qc, CAMDrawingPath, _planDate, _setupTask, _machinfo, wedmsetting, mgsetting, taskType)); } }
public WorkHourController(ITaskRepository TaskRepository, IPartRepository PartRepository, IProjectRepository ProjectRepository, IUserRepository UserRepository, ICNCItemRepository CNCItemRepository, IQCInfoRepository QCInfoRepository, IWarehouseStockRepository WarehouseStockRepository, IMachineRepository MachineRepository, ICNCMachInfoRepository CNCMachInfoRepository, ISteelGroupProgramRepository SteelGroupProgramRepository, ISteelProgramRepository SteelProgramRepository, IEDMSettingRepository EDMSettingRepository, IEDMDetailRepository EDMDetailRepository, IQCPointProgramRepository QCPointProgramRepository, ISystemConfigRepository SystemConfigRepository, IQCSteelPointRepository QCSteelPointRepository, ISteelCAMDrawingRepository SteelCAMDrawingRepository, ISteelDrawingCADPartRepository SteelDrawingCADPartRepository, ICAMDrawingRepository CAMDrawingRepository, IProjectPhaseRepository ProjectPhaseRepository, IPOContentRepository POContentRepository, IQCTaskRepository QCTaskRepository, IQCCmmReportRepository QCCmmReportRepository, IQCCmmFileSettingRepository QCCmmFileSettingRepository, IPRContentRepository PRContentRepository, IPurchaseRequestRepository PurchanseRequestRepository, ICharmillRepository CharmillRepository, IEDMTaskRecordRepository EDMTaskRepository, IDepartmentRepository DepartmentRepository, IMGSettingRepository MGSettingRepository, IWEDMSettingRepository WEDMSettingRepository, ITaskHourRepository TaskHourRepository, IMachinesInfoRepository MachinesInfoRepository, ITaskTypeRepository TaskTypeRepositroy, IWH_WorkTypeRepository WorkTypeRepository) { _taskRepository = TaskRepository; _partRepository = PartRepository; _projectRepository = ProjectRepository; _userRepository = UserRepository; _cncItemRepository = CNCItemRepository; _qcInfoRepository = QCInfoRepository; _whStockRepository = WarehouseStockRepository; _machineRepository = MachineRepository; _machInfoRepository = CNCMachInfoRepository; _steelGroupProgramRepository = SteelGroupProgramRepository; _steelProgramRepository = SteelProgramRepository; _edmSettingRepository = EDMSettingRepository; _edmDetailRepository = EDMDetailRepository; _qcPointProgramRepository = QCPointProgramRepository; _systemConfigRepository = SystemConfigRepository; _qcSteelPointRepository = QCSteelPointRepository; _steelCAMDrawingRepository = SteelCAMDrawingRepository; _steelDrawingCADPartRepository = SteelDrawingCADPartRepository; _camDrawingRepository = CAMDrawingRepository; _projectPhaseRepository = ProjectPhaseRepository; _poContentRepository = POContentRepository; _qcTaskRepository = QCTaskRepository; _qcCmmReportRepository = QCCmmReportRepository; _qcCmmFileSettingRepository = QCCmmFileSettingRepository; _prContentRepository = PRContentRepository; _prRepository = PurchanseRequestRepository; _charmillRepository = CharmillRepository; _edmRecordRepository = EDMTaskRepository; _departmentRepository = DepartmentRepository; _mgSettingRepository = MGSettingRepository; _wedmSettingRepository = WEDMSettingRepository; _taskHourRepository = TaskHourRepository; _machinesinfoRepository = MachinesInfoRepository; _taskTyprRepository = TaskTypeRepositroy; _workTyprRepository = WorkTypeRepository; }
public ProjectManager(IProjectRepository projectRepository, IProjectPhaseRepository projectPhaseRepository, IOrganisationManager organisationManager) { _projectRepository = projectRepository; _projectPhaseRepository = projectPhaseRepository; _organisationManager = organisationManager; }
//外发任务 public PurchaseContentGridRowModel(Task Task, SetupTaskStart _setuptaskStart, string mrPurDate, IProjectPhaseRepository ProjectPhaseRepository, ISteelCAMDrawingRepository SteelDrawingRepo , IWHPartRepository WHPartRepository, IPurchaseTypeRepository PurchaseTypeRepository, double time) { int _phaseID = 0; string _partNum = WHPartRepository.GetwfTaskPartNum(Task.TaskID); cell = new string[28]; cell[0] = ""; cell[1] = "0"; cell[2] = Task.TaskID.ToString(); cell[3] = "0"; //零件名 taskname+processname cell[4] = Task.TaskName + "_" + Task.ProcessName + "(V" + string.Format("{0:00}", Task.Version) + ")"; //数量 if (Task.TaskType == 1) { cell[5] = (Task.R + Task.F).ToString(); } else { //cell[5] = Task.Quantity.ToString(); cell[5] = _setuptaskStart.Qty.ToString(); } ////物料编号 模具号-taskid cell[6] = _partNum;//Task.MoldNumber+"-"+Task.TaskID.ToString(); //规格 cell[7] = Task.Raw; //材料 cell[8] = Task.Material; //硬度 cell[9] = Task.HRC; //零件号 cell[10] = _partNum.Split('-')[1]; cell[11] = ""; cell[12] = _setuptaskStart.MachinesName ?? ""; cell[13] = "true"; cell[14] = "新建"; cell[15] = "0"; cell[16] = mrPurDate ?? Task.PlanTime.ToString("yyyy-MM-dd"); cell[17] = Task.MoldNumber; cell[18] = ""; cell[19] = ""; cell[20] = ""; cell[21] = Task.Memo; cell[22] = _setuptaskStart.UserName ?? ""; cell[23] = _setuptaskStart.MachinesName ?? ""; cell[24] = _setuptaskStart.MachinesCode ?? ""; cell[25] = Task.Quantity.ToString(); int _purchaseType = 0; if (Task.TaskType == 6) { switch (Task.OldID)//0 铣/1 磨/4 全加工/3 车 { case 0: _purchaseType = PurchaseTypeRepository.QueryByName("铣床外发").PurchaseTypeID; break; case 1: _purchaseType = PurchaseTypeRepository.QueryByName("磨床外发").PurchaseTypeID; break; case 3: _purchaseType = PurchaseTypeRepository.QueryByName("车外发").PurchaseTypeID; break; case 4: _purchaseType = PurchaseTypeRepository.QueryByName("全加工外发").PurchaseTypeID; break; default: _purchaseType = PurchaseTypeRepository.QueryByName("铣磨外发").PurchaseTypeID; break; } } else { _purchaseType = PurchaseTypeRepository.PurchaseTypes.ToList().Where(t => Task.TaskType.Equals(Convert.ToInt32(t.TaskType))).FirstOrDefault().PurchaseTypeID; } cell[26] = _purchaseType.ToString(); cell[27] = time.ToString(); }