Exemple #1
0
        /// <summary>
        /// 产前7天任务
        /// </summary>
        public void CompleteDay7ToBorn(DairyTask task, int cowHouseId, int cowGroupId)
        {
            // 更新任务记录,标记完成
            UpdateTask(task);

            // 产生调群任务,进产房
            DairyTask groupingTask = new DairyTask();

            groupingTask.TaskType = TaskType.GroupingTask;
            DateTime time = DateTime.Now;

            groupingTask.ArrivalTime = time;
            groupingTask.InputTime   = time;
            groupingTask.EarNum      = task.EarNum;
            groupingTask.DeadLine    = time.AddDays(1.0);
            AddTask(groupingTask);

            // 取回这条任务
            DairyTask groupingTaskCopy = GetUnfinishedTasks(UserBLL.Instance.CurrentUser.Pasture.ID).Find(p => p.ArrivalTime == time && p.TaskType == TaskType.GroupingTask);
            // 关联调群记录,任务单找到如何调群
            GroupingRecord groupingRecord = new GroupingRecord();

            groupingRecord.EarNum = groupingTaskCopy.EarNum;
            groupingRecord.TaskID = groupingTaskCopy.ID;
            CowBLL cowBLL = new CowBLL();
            Cow    myCow  = cowBLL.GetCowInfo(groupingTaskCopy.EarNum);

            groupingRecord.OriginalGroupID = myCow.GroupID;
            groupingRecord.OriginalHouseID = myCow.HouseID;
            groupingRecord.TargetGroupID   = cowGroupId;
            groupingRecord.TargetHouseID   = cowHouseId;
            GroupingRecordBLL gBLL = new GroupingRecordBLL();

            gBLL.InsertGroupingRecord(groupingRecord);
        }
Exemple #2
0
        /// <summary>
        /// 产后10天任务
        /// </summary>
        public void CompleteDay10AfterBorn(DairyTask task, int cowHouseId, int cowGroupId)
        {
            //此任务单在,产犊界面/事件中产生,或者流产早产;流产等会取消之前的未完成产前任务单
            //更新任务记录,标记完成
            task.Status       = DairyTaskStatus.Completed;
            task.CompleteTime = DateTime.Now;
            UpdateTask(task);

            //牛调群至,初产牛群或高产牛群
            DairyTask groupingTask = new DairyTask();

            groupingTask.TaskType = TaskType.GroupingTask;
            DateTime time = DateTime.Now;

            groupingTask.ArrivalTime = time;
            groupingTask.EarNum      = task.EarNum;
            groupingTask.DeadLine    = time.AddDays(1.0);
            AddTask(groupingTask);
            //取回这条任务
            DairyTask groupingTaskCopy = GetUnfinishedTasks(UserBLL.Instance.CurrentUser.Pasture.ID).Find(p => p.ArrivalTime == time && p.TaskType == TaskType.GroupingTask);
            //关联调群记录,任务单找到如何调群
            GroupingRecord groupingRecord = new GroupingRecord();

            groupingRecord.EarNum = groupingTaskCopy.EarNum;
            groupingRecord.TaskID = groupingTaskCopy.ID;
            CowBLL cowBLL = new CowBLL();
            Cow    myCow  = cowBLL.GetCowInfo(groupingTaskCopy.EarNum);

            groupingRecord.OriginalGroupID = myCow.GroupID;
            groupingRecord.OriginalHouseID = myCow.HouseID;
            groupingRecord.TargetGroupID   = cowGroupId;
            groupingRecord.TargetHouseID   = cowHouseId;
            GroupingRecordBLL gBLL = new GroupingRecordBLL();

            gBLL.InsertGroupingRecord(groupingRecord);
        }