Пример #1
0
        public List <Insemination> GetInseminationListOfCurrentBreedPeriod()
        {
            InseminationBLL bllInsem      = new InseminationBLL();
            DateTime        latestCalTime = new DateTime(1900, 1, 1);
            Calving         cal           = GetLatestCalving(this.earNum);

            if (cal != null)
            {
                latestCalTime = cal.Birthday;
            }
            else
            {
                latestCalTime = this.BirthDate;
            }
            List <Insemination> list = bllInsem.GetInseminationList(this.earNum, latestCalTime);

            return(list);
        }
Пример #2
0
        /// <summary>
        /// 点击[繁殖-发情配种],增加发情/配种任务
        /// </summary>
        public void CompleteInsemination(DairyTask task, Insemination insemination)
        {
            CowInfo cow = new CowInfo(insemination.EarNum);

            // 添加任务记录,添加即已完成 Todo
            task.Status    = DairyTaskStatus.Completed;
            task.InputTime = DateTime.Now;
            taskDAL.InsertTask(task);

            // 删除无效的妊检任务单
            RemovePreviousInspectionTasks(insemination.EarNum, true);
            RemovePreviousInspectionTasks(insemination.EarNum, false);

            // 产生新妊检任务单
            DairyTask initialInspectionTask = new DairyTask();

            initialInspectionTask.TaskType    = TaskType.InitialInspectionTask;
            initialInspectionTask.Status      = DairyTaskStatus.Initial;
            initialInspectionTask.ArrivalTime = task.CompleteTime.AddDays(DairyParameterBLL.GetCurrentParameterDictionary(cow.FarmCode)[FarmInfo.PN_DAYSOFINITIALINSPECTION]);

            // 3 days to complete task
            initialInspectionTask.DeadLine = initialInspectionTask.ArrivalTime.AddDays(3.0);
            initialInspectionTask.EarNum   = insemination.EarNum;

            // 分配配种员
            initialInspectionTask.OperatorID = AssignTask(task.PastureID, task.EarNum, Role.FARM_INSEMINATOR_ID);

            initialInspectionTask.RoleID    = task.RoleID;
            initialInspectionTask.PastureID = task.PastureID;
            initialInspectionTask.InputTime = DateTime.Now;
            taskDAL.InsertTask(initialInspectionTask);

            // 添加配种记录
            InseminationBLL insemBLL = new InseminationBLL();

            insemBLL.InsertInseminationInfo(insemination);

            // 更新牛繁殖状态
            CowBLL cowBLL = new CowBLL();

            cowBLL.UpdateCowBreedStatus(insemination.EarNum, "已配未检");
        }
Пример #3
0
        /// <summary>
        /// 取本轮配种记录列表
        /// </summary>
        /// <param name="earNum"></param>
        /// <returns></returns>
        public static List <Insemination> GetInseminationListOfCurrentBreedPeriod(int earNum)
        {
            InseminationBLL bllInsem      = new InseminationBLL();
            DateTime        latestCalTime = new DateTime(1900, 1, 1);
            Calving         cal           = GetLatestCalving(earNum);

            if (cal != null)
            {
                latestCalTime = cal.Birthday;
            }
            else
            {
                CowBLL cb    = new CowBLL();
                Cow    myCow = cb.GetCowInfo(earNum);
                latestCalTime = myCow.BirthDate;
            }
            List <Insemination> list = bllInsem.GetInseminationList(earNum, latestCalTime);

            return(list);
        }
Пример #4
0
        /// <summary>
        /// 获取最新配种记录
        /// </summary>
        /// <param name="earNum"></param>
        /// <returns></returns>
        public static Insemination GetLatestInsemination(int earNum)
        {
            InseminationBLL insem1 = new InseminationBLL();

            return(insem1.GetLatestInsemination(earNum));
        }