Beispiel #1
0
 /// <summary>
 ///     治疗任务的姓名的下拉列表框
 /// </summary>
 /// <returns></returns>
 public IEnumerable<SelectListItem> GetCureTaskEmployee()
 {
     var taskService = new TaskService();
     var tasktypeService = new TaskTypeService();
     var taskEmployeeService = new TaskEmployeeService();
     long curetaskid = tasktypeService.FindByName("治疗").Id;
     List<task> tasks = taskService.FindByTaskTypeId(curetaskid);
     List<task_employee> taskEmployees =
         tasks.SelectMany(task => taskEmployeeService.FindByTaskId(task.Id)).ToList();
     if (taskEmployees.Count >= 2)
     {
         for (int i = 0; i < taskEmployees.Count; i++)
         {
             task_employee employee = taskEmployees[i];
             for (int j = i + 1; j < taskEmployees.Count; j++)
             {
                 if (taskEmployees[j].employee.Name.Equals(employee.employee.Name))
                 {
                     taskEmployees.Remove(taskEmployees[j]);
                 }
             }
         }
     }
     IEnumerable<SelectListItem> feedTaskEmployeelist = taskEmployees.Select(taskEmployee => new SelectListItem
                                                                                                 {
                                                                                                     Text =
                                                                                                         taskEmployee
                                                                                                         .
                                                                                                         employee
                                                                                                         .Name,
                                                                                                     Value =
                                                                                                         taskEmployee
                                                                                                             .
                                                                                                             employee
                                                                                                             .Id +
                                                                                                         string.
                                                                                                             Empty,
                                                                                                 })
                                                                     .OrderBy(m => m.Text);
     return feedTaskEmployeelist;
 }
Beispiel #2
0
        public void GetTaskType_Success_Test()
        {
            // Arrange
            int        id       = 1;
            R_TaskType taskType = SampleTaskType(id);

            // create mock for repository
            var mock = new Mock <ITaskTypeRepository>();

            mock.Setup(s => s.GetTaskType(Moq.It.IsAny <int>())).Returns(taskType);

            // service
            TaskTypeService taskTypeService = new TaskTypeService();

            TaskTypeService.Repository = mock.Object;

            // Act
            TaskTypeDTO result = taskTypeService.GetTaskType(id);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.TaskTypeId);
        }
Beispiel #3
0
        public void DeleteTaskType_Success_Test()
        {
            // Arrange
            TaskTypeDTO dto = SampleTaskTypeDTO(1);

            dto.IsDeleted = false;

            // create mock for repository
            var mock = new Mock <ITaskTypeRepository>();

            mock.Setup(s => s.DeleteTaskType(Moq.It.IsAny <R_TaskType>())).Verifiable();

            // service
            TaskTypeService taskTypeService = new TaskTypeService();

            TaskTypeService.Repository = mock.Object;

            // Act
            taskTypeService.DeleteTaskType(dto);

            // Assert
            Assert.IsTrue(true);
        }
        public MedicineTakeModel GetCureTaskByEmployeeId(long employeeId)
        {
            var medicineTakeModel = new MedicineTakeModel();

            var tasktypeService = new TaskTypeService();
            var taskEmployeeService = new TaskEmployeeService();
            var taskService = new TaskService();
            var cureTaskMethodService = new CureTaskMethodService();
            var cureTaskCourseService = new CureTaskCourseService();
            var cureTaskMedicineService = new CureTaskMedicineService();
            int taskflag = 0;
            long employeeTaskId = 0;
            long cureCourseId = 0;
            List<task_employee> alltask = taskEmployeeService.FindByEmployeeId(employeeId);
            //根据任务id找到任务类型,若是当天的治疗任务,记录taskid
            foreach (task_employee task in alltask)
            {
                long tasktypeid = taskService.Find(task.TaskId).TaskTypeId;
                string tasktype = tasktypeService.Find(tasktypeid).Name;
                if (tasktype == "治疗")
                {
                    //判断当前记录的时间是否和任务中某一个疗程的开始时间相同,若是,则代表当天有治疗任务
                    List<cure_task_course> cureTaskCourses = cureTaskCourseService.FindByTaskId(task.TaskId);
                    foreach (cure_task_course cureTaskCourse in cureTaskCourses)
                    {
                        if (cureTaskCourse.Time.ToShortDateString() == DateTime.Now.ToShortDateString())
                        {
                            taskflag = 1;
                            employeeTaskId = task.TaskId;
                            cureCourseId = cureTaskCourse.Id;
                            medicineTakeModel.TaskCourseId = cureCourseId;
                        }
                    }
                }
            }
            if (taskflag == 1)
            {
                List<cure_task_method> cureTaskMethods = cureTaskMethodService.FindByCureTaskCourseId(cureCourseId);
                var cureDetails = new List<CureDetail>();
                CureDetail cureDetail = null;
                medicineTakeModel.CureTaskType = cureDetails;
                foreach (cure_task_method cureTaskMethod in cureTaskMethods)
                {
                    cureDetail = new CureDetail();
                    cureDetail.CureType = cureTaskMethod.cure_type.Name;
                    cureDetails.Add(cureDetail);
                    var cureMedicineDetails = new List<CureMedicineDetail>();
                    cureDetail.CureMedicineDetail = cureMedicineDetails;
                    CureMedicineDetail cureMedicineDetail = null;
                    List<cure_task_medicine> cureTaskMedicines =
                        cureTaskMedicineService.FindByCureTaskMethodId(cureTaskMethod.Id);
                    foreach (cure_task_medicine cureTaskMedicine in cureTaskMedicines)
                    {
                        cureMedicineDetail = new CureMedicineDetail();
                        cureMedicineDetail.Medicine = cureTaskMedicine.medicine.Name;
                        cureMedicineDetail.Quality = cureTaskMedicine.Quality;
                        cureMedicineDetail.Unit = cureTaskMedicine.unit.Name;
                        cureMedicineDetails.Add(cureMedicineDetail);
                    }
                }

                medicineTakeModel.TaskNumber = taskService.Find(employeeTaskId).TaskNumber;
                List<task_employee> allemployees = taskEmployeeService.FindByTaskId(employeeTaskId);
                int i;
                string reAllEmployeeName = "";
                for (i = 0; i < allemployees.Count - 1; i++)
                {
                    reAllEmployeeName = reAllEmployeeName + allemployees[i].employee.Name + ",";
                }
                reAllEmployeeName = reAllEmployeeName + allemployees[i].employee.Name;
                medicineTakeModel.EmloyeeName = reAllEmployeeName;
            }
            return medicineTakeModel;
        }
Beispiel #5
0
 /// <summary>
 ///     获得任务下拉列表
 /// </summary>
 /// <returns>返回集合</returns>
 public IEnumerable<SelectListItem> GetTaskNameList()
 {
     IEnumerable<SelectListItem> taskNameList =
         new TaskTypeService().FindAll().Select(taskNameItem => new SelectListItem
                                                                    {
                                                                        Text = taskNameItem.Name,
                                                                        Value = taskNameItem.Name
                                                                    }).OrderBy(m => m.Text);
     return taskNameList;
 }
Beispiel #6
0
 /// <summary>
 ///     喂饲任务的任务编号的下拉列表框
 /// </summary>
 /// <returns></returns>
 public IEnumerable<SelectListItem> GetFeedTaskNumber()
 {
     var taskService = new TaskService();
     var tasktypeService = new TaskTypeService();
     long feedtaskid = tasktypeService.FindByName("喂饲").Id;
     List<task> feedtasks = taskService.FindByTaskTypeId(feedtaskid);
     IEnumerable<SelectListItem> feedTaskSelect = feedtasks.Select(feedtask => new SelectListItem
                                                                                   {
                                                                                       Text = feedtask.TaskNumber,
                                                                                       Value =
                                                                                           feedtask.Id +
                                                                                           string.Empty,
                                                                                   }).OrderBy(m => m.Text);
     return feedTaskSelect;
 }
 //判断类型是否重复
 public bool JudgeNameByType(string name, string typename)
 {
     var cureTypeService = new CureTypeService();
     var medicineService = new MedicineService();
     var unitService = new UnitService();
     var fodderTypeService = new FodderTypeService();
     var excetionTypeService = new ExceptionTypeService();
     var pigTypeService = new PigTypeService();
     var pigHouseTypeService = new PigHouseTypeService();
     var taskStatusTypeService = new TaskStatusTypeService();
     var taskTypeService = new TaskTypeService();
     var roleTypeService = new RoleTypeService();
     var preventionTypeService = new PreventionTypeService();
     var customerService = new CustomerService();
     if (typename == "治疗")
     {
         if (cureTypeService.FindByName(name) == null)
             return true;
     }
     if (typename == "单位")
     {
         if (unitService.FindByName(name) == null)
             return true;
     }
     if (typename == "药物")
     {
         if (medicineService.FindByName(name) == null)
             return true;
     }
     if (typename == "异常")
     {
         if (excetionTypeService.FindByName(name).Count == 0)
             return true;
     }
     if (typename == "饲料")
     {
         if (fodderTypeService.FindByName(name) == null)
             return true;
     }
     if (typename == "生猪")
     {
         if (pigTypeService.FindByName(name) == null)
             return true;
     }
     if (typename == "防疫")
     {
         if (preventionTypeService.FindByName(name) == null)
             return true;
     }
     if (typename == "猪舍")
     {
         if (pigHouseTypeService.FindByName(name) == null)
             return true;
     }
     if (typename == "任务状态")
     {
         if (taskStatusTypeService.FindByName(name) == null)
             return true;
     }
     if (typename == "任务类型")
     {
         if (taskTypeService.FindByName(name) == null)
             return true;
     }
     if (typename == "角色")
     {
         if (roleTypeService.FindByName(name) == null)
             return true;
     }
     if (typename == "客户名称")
     {
         if (customerService.FindByName(name) == null)
             return true;
     }
     return false;
 }
        /// <summary>
        ///     根据类型id查找关联它的表是否为0
        /// </summary>
        /// <param name="typeid">类型id</param>
        /// <param name="typename">类型名字</param>
        /// <returns></returns>
        public string GetRelationtById(long typeid, string typename)
        {
            var cureTypeService = new CureTypeService();
            var medicineService = new MedicineService();
            var unitService = new UnitService();
            var fodderTypeService = new FodderTypeService();
            var excetionTypeService = new ExceptionTypeService();
            var pigTypeService = new PigTypeService();
            var pigHouseTypeService = new PigHouseTypeService();
            var taskStatusTypeService = new TaskStatusTypeService();
            var taskTypeService = new TaskTypeService();
            var roleTypeService = new RoleTypeService();
            var preventionTypeService = new PreventionTypeService();
            var roleAuthorityService = new RoleAuthorityService();
            var customerService = new CustomerService();
            if (typeid == 0)
            {
                return "不存在于数据库,可以删除";
            }
            try
            {
                if (typename == "治疗")
                {
                    cureTypeService.Delete(cureTypeService.Find(typeid));
                }
                if (typename == "单位")
                {
                    unitService.Delete(unitService.Find(typeid));
                }
                if (typename == "药物")
                {
                    medicineService.Delete(medicineService.Find(typeid));
                }
                if (typename == "异常")
                {
                    excetionTypeService.Delete(excetionTypeService.Find(typeid));
                }
                if (typename == "饲料")
                {
                    fodderTypeService.Delete(fodderTypeService.Find(typeid));
                }
                if (typename == "生猪")
                {
                    if (pigTypeService.Find(typeid).Name == "母猪" || pigTypeService.Find(typeid).Name == "公猪")
                    {
                        return "不可删除";
                    }
                    pigTypeService.Delete(pigTypeService.Find(typeid));
                }
                if (typename == "防疫")
                {
                    preventionTypeService.Delete(preventionTypeService.Find(typeid));
                }
                if (typename == "猪舍")
                {
                    pigHouseTypeService.Delete(pigHouseTypeService.Find(typeid));
                }
                if (typename == "任务状态")
                {
                    if (taskStatusTypeService.Find(typeid).Name == "未完成" ||
                        taskStatusTypeService.Find(typeid).Name == "已完成" ||
                        taskStatusTypeService.Find(typeid).Name == "正在进行")
                    {
                        return "不可删除";
                    }
                    taskStatusTypeService.Delete(taskStatusTypeService.Find(typeid));
                }
                if (typename == "任务类型")
                {
                    if (taskTypeService.Find(typeid).Name == "喂饲" || taskTypeService.Find(typeid).Name == "防疫" ||
                        taskTypeService.Find(typeid).Name == "巡查" || taskTypeService.Find(typeid).Name == "治疗" ||
                        taskTypeService.Find(typeid).Name == "销售" || taskTypeService.Find(typeid).Name == "转栏" ||
                        taskTypeService.Find(typeid).Name == "添加生猪")
                    {
                        return "不可删除";
                    }
                    taskTypeService.Delete(taskTypeService.Find(typeid));
                }
                if (typename == "角色")
                {
                    foreach (role_authority c in roleAuthorityService.FindByRoleTypeId(typeid))
                        roleAuthorityService.Delete(roleAuthorityService.Find(c.Id));
                    roleTypeService.Delete(roleTypeService.Find(typeid));
                }
                if (typename == "客户名称")
                {
                    customerService.Delete(customerService.Find(typeid));
                }
            }
            catch (Exception)
            {
                return "不可删除";
            }

            return "";
        }
 /// <summary>
 ///     根据喂饲任务类型id得到所有的喂饲人员编号和名字
 /// </summary>
 /// <returns>所有的喂饲人员编号和名字</returns>
 public string GetFeedTaskEmployee()
 {
     var taskTypeService = new TaskTypeService();
     var feedService = new FeedService();
     try
     {
         long feedTaskTypeId = taskTypeService.FindByName("喂饲").Id;
         return feedService.GetFeedTaskEmployeeNameAndNumber(feedTaskTypeId);
     }
     catch (Exception)
     {
         return null;
     }
 }
        /// <summary>
        ///     根据id返回是否有喂饲任务
        /// </summary>
        /// <param name="employeeId">人员id</param>
        /// <returns>返回是否有喂饲任务</returns>
        public string GetFeedTaskById(long employeeId)
        {
            var tasktypeService = new TaskTypeService();
            var taskEmployeeService = new TaskEmployeeService();
            var taskIntervalCycleService = new TaskIntervalCycleService();
            int taskflag = 0;

            var taskService = new TaskService();
            List<task_employee> alltask = taskEmployeeService.FindByEmployeeId(employeeId);
            //根据任务id找到任务类型,若是当天的喂饲任务,记录taskid
            foreach (task_employee task in alltask)
            {
                long tasktypeid = taskService.Find(task.TaskId).TaskTypeId;
                string tasktype = tasktypeService.Find(tasktypeid).Name;
                if (tasktype == "喂饲")
                {
                    List<task_interval_cycle> taskInterval = taskIntervalCycleService.FindByTaskId(task.TaskId);
                    foreach (task_interval_cycle taskinterval in taskInterval)
                    {
                        for (int i = 0; i < 1000; i++)
                        {
                            //根据任务的循环时间匹配是否有当天的任务
                            if (
                                taskinterval.FirstExecuteDate.AddDays(Convert.ToDouble(taskinterval.CycleDays * i))
                                            .
                                             ToShortDateString() == DateTime.Now.ToShortDateString())
                            {
                                taskflag = 1; //标志
                                break;
                            }
                        }
                    }
                }
            }
            if (taskflag == 0)
            {
                return "今天该员工没有喂饲任务";
            }
            return "";
        }
 /// <summary>
 ///     根据id查找当天是否有治疗任务
 /// </summary>
 /// <param name="employeeId">人员id</param>
 /// <returns>返回是否当天有治疗任务</returns>
 public string GetCureTaskById(long employeeId)
 {
     var tasktypeService = new TaskTypeService();
     var taskEmployeeService = new TaskEmployeeService();
     var taskService = new TaskService();
     var cureTaskCourseService = new CureTaskCourseService();
     int taskflag = 0;
     List<task_employee> alltask = taskEmployeeService.FindByEmployeeId(employeeId);
     //根据任务id找到任务类型,若是当天的治疗任务,记录taskid
     foreach (task_employee task in alltask)
     {
         long tasktypeid = taskService.Find(task.TaskId).TaskTypeId;
         string tasktype = tasktypeService.Find(tasktypeid).Name;
         if (tasktype == "治疗")
         {
             //判断当前记录的时间是否和任务中某一个疗程的开始时间相同,若是,则代表当天有治疗任务
             List<cure_task_course> cureTaskCourses = cureTaskCourseService.FindByTaskId(task.TaskId);
             foreach (cure_task_course cureTaskCourse in cureTaskCourses)
             {
                 if (cureTaskCourse.Time.ToShortDateString() == DateTime.Now.ToShortDateString())
                 {
                     taskflag = 1;
                 }
             }
         }
     }
     if (taskflag == 1)
     {
         return "1";
     }
     return "2";
 }
 public BasicInfoModel ReadBasicInfo(string type)
 {
     var basicInfoModel = new BasicInfoModel {Type = type};
     var names = new List<NameModel>();
     basicInfoModel.Names = names;
     if (type == "治疗")
     {
         List<cure_type> cureTypes = new CureTypeService().FindAll();
         foreach (cure_type cureType in cureTypes)
         {
             var nameModel = new NameModel {Name = cureType.Name, Id = cureType.Id};
             names.Add(nameModel);
         }
     }
     else if (type == "药物")
     {
         List<medicine> medicineTypes = new MedicineService().FindAll();
         foreach (medicine medicineType in medicineTypes)
         {
             var nameModel = new NameModel {Name = medicineType.Name, Id = medicineType.Id};
             names.Add(nameModel);
         }
     }
     else if (type == "单位")
     {
         List<unit> unitTypes = new UnitService().FindAll();
         foreach (unit unitType in unitTypes)
         {
             var nameModel = new NameModel {Name = unitType.Name, Id = unitType.Id};
             names.Add(nameModel);
         }
     }
     else if (type == "异常")
     {
         List<exception_type> exceptionTypes = new ExceptionTypeService().FindAll();
         foreach (exception_type exceptionType in exceptionTypes)
         {
             var nameModel = new NameModel {Name = exceptionType.Name, Id = exceptionType.Id};
             names.Add(nameModel);
         }
     }
     else if (type == "饲料")
     {
         List<fodder_type> fodderTypes = new FodderTypeService().FindAll();
         foreach (fodder_type fodderType in fodderTypes)
         {
             var nameModel = new NameModel {Name = fodderType.Name, Id = fodderType.Id};
             names.Add(nameModel);
         }
     }
     else if (type == "生猪")
     {
         List<pig_type> pigTypes = new PigTypeService().FindAll();
         foreach (pig_type pigType in pigTypes)
         {
             var nameModel = new NameModel {Name = pigType.Name, Id = pigType.Id};
             names.Add(nameModel);
         }
     }
     else if (type == "防疫")
     {
         List<prevention_type> preventionTypes = new PreventionTypeService().FindAll();
         foreach (prevention_type preventionType in preventionTypes)
         {
             var nameModel = new NameModel
                                 {
                                     Name = preventionType.Name,
                                     Id = preventionType.Id,
                                     MedicineId = preventionType.MedicineId,
                                     Quality = Convert.ToInt32(preventionType.Quality),
                                     UnitId = preventionType.UnitId
                                 };
             names.Add(nameModel);
         }
     }
     else if (type == "猪舍")
     {
         List<pig_house_type> pigHouseTypes = new PigHouseTypeService().FindAll();
         foreach (pig_house_type pigHouseType in pigHouseTypes)
         {
             var nameModel = new NameModel {Name = pigHouseType.Name, Id = pigHouseType.Id};
             names.Add(nameModel);
         }
     }
     else if (type == "任务状态")
     {
         List<task_status_type> taskStatusTypes = new TaskStatusTypeService().FindAll();
         foreach (task_status_type taskStatusType in taskStatusTypes)
         {
             var nameModel = new NameModel {Name = taskStatusType.Name, Id = taskStatusType.Id};
             names.Add(nameModel);
         }
     }
     else if (type == "任务类型")
     {
         List<task_type> taskTypes = new TaskTypeService().FindAll();
         foreach (task_type taskType in taskTypes)
         {
             var nameModel = new NameModel {Name = taskType.Name, Id = taskType.Id};
             names.Add(nameModel);
         }
     }
     else if (type == "角色")
     {
         List<role_type> roleTypes = new RoleTypeService().FindAll();
         foreach (role_type roleType in roleTypes)
         {
             var nameModel = new NameModel {Name = roleType.Name, Id = roleType.Id};
             names.Add(nameModel);
         }
     }
     else if (type == "客户名称")
     {
         List<customer> customerTypes = new CustomerService().FindAll();
         foreach (customer customer in customerTypes)
         {
             var nameModel = new NameModel {Name = customer.Name, Id = customer.Id};
             names.Add(nameModel);
         }
     }
     if (names.Count == 0)
     {
         var nullNameModel = new NameModel();
         names.Add(nullNameModel);
     }
     return basicInfoModel;
 }
Beispiel #13
0
 public void TaskTypeSaveChanges(BasicInfoModel model)
 {
     var typeService = new TaskTypeService();
     List<task_type> types = typeService.FindAll();
     foreach (task_type type in types)
     {
         int idFlag = 0;
         int nameFlag = 0;
         string newname = "";
         foreach (NameModel name in model.Names)
         {
             if (type.Id == name.Id)
             {
                 idFlag = 1;
                 if (type.Name.Equals(name.Name))
                 {
                     nameFlag = 1;
                 }
                 else
                 {
                     newname = name.Name;
                 }
             }
         }
         //若存在此Id,但是name变化了的,则需要修改数据库
         if (idFlag == 1)
         {
             if (nameFlag == 0)
             {
                 if (newname == "")
                 {
                     throw new Exception();
                 }
                 task_type modifyCure = typeService.Find(type.Id);
                 modifyCure.Name = newname;
                 typeService.Update(modifyCure);
             }
         }
     }
     //如果model里的Id为0,说明是新建的类型
     foreach (NameModel name in model.Names)
     {
         if (name.Id == 0 && typeService.FindByName(name.Name) == null)
         {
             var newType = new task_type {Name = name.Name};
             typeService.Insert(newType);
         }
     }
 }
Beispiel #14
0
        public FodderTakeModel GetFodderDetail(FodderTakeModel model)
        {
            //初始化
            var newFodderDetails = new List<FodderDetail>();
            //var newFodderDetail=new FodderDetail();
            //newFodderDetails.Add(newFodderDetail);
            model.TaskDetail = newFodderDetails;

            var pigstyService = new PigstyService();
            var tasktypeService = new TaskTypeService();
            var taskEmployeeService = new TaskEmployeeService();
            var taskpigstyservice = new TaskPigstyService();
            var feedTaskQualityService = new FeedTaskQualityService();
            var taskIntervalCycleService = new TaskIntervalCycleService();
            int taskflag = 0;
            long employeeTaskId = 0;
            var taskService = new TaskService();
            List<task_employee> alltask = taskEmployeeService.FindByEmployeeId(model.ActualEmployeeId);
            //根据任务id找到任务类型,若是当天的喂饲任务,记录taskid
            foreach (task_employee task in alltask)
            {
                long tasktypeid = taskService.Find(task.TaskId).TaskTypeId;
                string tasktype = tasktypeService.Find(tasktypeid).Name;
                if (tasktype == "喂饲")
                {
                    List<task_interval_cycle> taskInterval = taskIntervalCycleService.FindByTaskId(task.TaskId);
                    foreach (task_interval_cycle taskinterval in taskInterval)
                    {
                        for (int i = 0; i < 1000; i++)
                        {
                            //根据任务的循环时间匹配是否有当天的任务
                            if (
                                taskinterval.FirstExecuteDate.AddDays(Convert.ToDouble(taskinterval.CycleDays*i))
                                            .
                                             ToShortDateString() == DateTime.Now.ToShortDateString())
                            {
                                taskflag = 1; //标志
                                employeeTaskId = task.TaskId;
                                break;
                            }
                        }
                    }
                }
            }
            if (taskflag == 1)
            {
                List<task_pigsty> taskPisties = taskpigstyservice.FindByTaskId(employeeTaskId);

                //遍历该任务的所有的猪栏,并将其对应的饲料添加到model.TaskDetail中
                int i;
                foreach (task_pigsty taskPigsty in taskPisties)
                {
                    List<feed_task_quality> taskQuality = feedTaskQualityService.FindByFeedTaskPigstyId(taskPigsty.Id);
                    if (model.TaskDetail.Count == 0)
                    {
                        var fodderDetail = new FodderDetail
                                               {
                                                   FodderTypeName = taskQuality[0].fodder_type.Name,
                                                   //Quality = taskQuality[0].Quality * pigstyService.GetPignumbers(Convert.ToInt64(taskPigsty.PigstyId)),
                                                   //UnitName = taskQuality[0].unit.Name,
                                                   FodderTypeId = taskQuality[0].FodderTypeId,
                                                   //UnitId = taskQuality[0].UnitId
                                               };
                        model.TaskDetail.Add(fodderDetail);
                    }
                    else
                    {
                        int knt = 0; //判断该猪栏的饲料是否跟
                        for (i = 0; i < model.TaskDetail.Count; i++)
                        {
                            if (model.TaskDetail[i].FodderTypeName == taskQuality[0].fodder_type.Name)
                            {
                                //model.TaskDetail[i].Quality = taskQuality[0].Quality*
                                //                              pigstyService.GetPignumbers(
                                //                                  Convert.ToInt64(taskPigsty.PigstyId)) +
                                //                              model.TaskDetail[i].Quality;
                                knt = 1;
                            }
                        }
                        if (knt == 0)
                        {
                            var fodderDetail = new FodderDetail
                                                   {
                                                       FodderTypeName = taskQuality[0].fodder_type.Name,
                                                       //Quality = taskQuality[0].Quality * pigstyService.GetPignumbers(Convert.ToInt64(taskPigsty.PigstyId)),
                                                       //UnitName = taskQuality[0].unit.Name,
                                                       FodderTypeId = taskQuality[0].FodderTypeId,
                                                       //UnitId = taskQuality[0].UnitId
                                                   };
                            model.TaskDetail.Add(fodderDetail);
                        }
                    }
                }
                model.TaskNumber = taskService.Find(employeeTaskId).TaskNumber;
                //任务的全部人员
                List<task_employee> allemployees = taskEmployeeService.FindByTaskId(employeeTaskId);
                string reAllEmployeeName = "";
                for (i = 0; i < allemployees.Count - 1; i++)
                {
                    reAllEmployeeName = reAllEmployeeName + allemployees[i].employee.Name + ",";
                }
                reAllEmployeeName = reAllEmployeeName + allemployees[i].employee.Name;
                model.TaskEmployeeName = reAllEmployeeName;
            }
            return model;
        }