Exemplo n.º 1
0
        /// <summary>
        /// 妊检复检任务
        /// </summary>
        public void CompleteReInspection(DairyTask task, ReInspection reInspection)
        {
            // 添加复检记录
            ReInspectionBLL rBLL = new ReInspectionBLL();

            reInspection.InseminationID = this.taskDAL.GetInseminationID(reInspection.EarNum);
            rBLL.InsertReInspection(reInspection);

            //更新任务记录,标记完成
            task.Status = DairyTaskStatus.Completed;
            //task.CompleteTime = DateTime.Now;
            task.InputTime = DateTime.Now;

            UpdateTask(task);

            CowBLL cowBLL = new CowBLL();

            if (reInspection.ReInspectResult == 1)
            {
                //复检+
                //生成产前21天任务单
                DairyTask day21ToBornTask = new DairyTask();
                day21ToBornTask.EarNum    = task.EarNum;
                day21ToBornTask.PastureID = task.PastureID;
                //分配兽医

                day21ToBornTask.OperatorID = AssignTask(task.PastureID, task.EarNum, Role.FARM_DOCTOR_ID);

                day21ToBornTask.Status = DairyTaskStatus.Initial;
                float normalCalvingDays = DairyParameterBLL.GetCurrentParameterDictionary(UserBLL.Instance.CurrentUser.Pasture.ID)[FarmInfo.PN_NORMALCALVINGDAYS];
                float reInspectionDays  = DairyParameterBLL.GetCurrentParameterDictionary(UserBLL.Instance.CurrentUser.Pasture.ID)[FarmInfo.PN_DAYSOFREINSEPECTION];
                day21ToBornTask.ArrivalTime = task.ArrivalTime.AddDays(-reInspectionDays + normalCalvingDays - 14);//NormalCalvingDays是进产房天数
                day21ToBornTask.DeadLine    = day21ToBornTask.ArrivalTime.AddDays(1.0);
                day21ToBornTask.TaskType    = TaskType.Day21ToBornTask;
                day21ToBornTask.InputTime   = DateTime.Now;
                AddTask(day21ToBornTask);
                // 更新牛繁殖状态
                cowBLL.UpdateCowBreedStatus(task.EarNum, "复检+");
            }
            else
            {
                //更新牛繁殖状态
                cowBLL.UpdateCowBreedStatus(task.EarNum, "复检-");
            }
        }
Exemplo n.º 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, "已配未检");
        }
Exemplo n.º 3
0
        /// <summary>
        /// 妊检初检任务
        /// </summary>
        public void CompleteInitialInspection(DairyTask task, InitialInspection initialInspetion)
        {
            //添加初检记录
            InitialInspectionBLL iBLL = new InitialInspectionBLL();

            initialInspetion.InseminationID = this.taskDAL.GetInseminationID(initialInspetion.EarNum);
            iBLL.InsertInitialInspection(initialInspetion);

            // 更新初检任务记录
            UpdateTask(task);

            CowBLL cowBLL = new CowBLL();

            if (initialInspetion.InspectResult == 1)
            {
                //初检+
                //生成新复检任务单
                DairyTask reinspectionTask = new DairyTask();
                reinspectionTask.EarNum    = task.EarNum;
                reinspectionTask.PastureID = task.PastureID;
                //分配配种员
                reinspectionTask.OperatorID = task.OperatorID;//复检和初检同一人

                reinspectionTask.Status = DairyTaskStatus.Initial;
                float initialInspectionDays = DairyParameterBLL.GetCurrentParameterDictionary(UserBLL.Instance.CurrentUser.Pasture.ID)[FarmInfo.PN_DAYSOFINITIALINSPECTION];
                float reInspectionDays      = DairyParameterBLL.GetCurrentParameterDictionary(UserBLL.Instance.CurrentUser.Pasture.ID)[FarmInfo.PN_DAYSOFREINSEPECTION];
                reinspectionTask.ArrivalTime = task.ArrivalTime.AddDays(reInspectionDays - initialInspectionDays);
                reinspectionTask.DeadLine    = reinspectionTask.ArrivalTime.AddDays(3.0);
                reinspectionTask.TaskType    = TaskType.ReInspectionTask;
                reinspectionTask.InputTime   = DateTime.Now;
                AddTask(reinspectionTask);
                //更新牛繁殖状态
                cowBLL.UpdateCowBreedStatus(task.EarNum, "初检+");
            }
            else
            {
                //更新牛繁殖状态
                cowBLL.UpdateCowBreedStatus(task.EarNum, "初检-");
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 产前21天任务
        /// </summary>
        public void CompleteDay21ToBorn(DairyTask task)
        {
            // 更新任务记录,标记完成
            UpdateTask(task);

            // 生成产前7天任务单
            DairyTask day7ToBornTask = new DairyTask();

            day7ToBornTask.EarNum    = task.EarNum;
            day7ToBornTask.PastureID = task.PastureID;
            // 分配兽医
            day7ToBornTask.OperatorID = task.OperatorID;//兽医不变

            day7ToBornTask.Status = DairyTaskStatus.Initial;
            float initialInspectionDays = DairyParameterBLL.GetCurrentParameterDictionary(UserBLL.Instance.CurrentUser.Pasture.ID)[FarmInfo.PN_DAYSOFINITIALINSPECTION];
            float reInspectionDays      = DairyParameterBLL.GetCurrentParameterDictionary(UserBLL.Instance.CurrentUser.Pasture.ID)[FarmInfo.PN_DAYSOFREINSEPECTION];

            day7ToBornTask.ArrivalTime = task.ArrivalTime.AddDays(14.0);
            day7ToBornTask.DeadLine    = day7ToBornTask.ArrivalTime.AddDays(3.0);
            day7ToBornTask.TaskType    = TaskType.Day7ToBornTask;
            day7ToBornTask.InputTime   = DateTime.Now;
            AddTask(day7ToBornTask);
        }