Example #1
0
        /// <summary>
        /// 获取需要调群的牛
        /// </summary>
        /// <returns></returns>
        public List <CowInfo> GetNeedRegroupingCows(int pastrure)
        {
            CowGroupBLL     cowGroupBll = new CowGroupBLL();
            List <CowGroup> groups      = cowGroupBll.GetCowGroupList(pastrure);

            List <CowInfo> list = new List <CowInfo>();

            foreach (CowInfo item in this.CowInfoList)
            {
                item.CheckGrouping(groups);
                if (item.NeedGrouping)
                {
                    list.Add(item);
                }
            }
            return(list);
        }
Example #2
0
        /// <summary>
        /// 在产犊界面调用本方法
        /// 产生产后三任务
        /// </summary>
        /// <param name="calving"></param>
        public void CreateAfterBornTasks(Calving calving)
        {
            // 分配兽医,饲养员
            CowGroupBLL g  = new CowGroupBLL();
            CowBLL      c  = new CowBLL();
            Cow         cc = c.GetCowInfo(calving.EarNum);
            CowGroup    gg = g.GetCowGroupList(cc.FarmCode).Find(p => p.ID == cc.GroupID);

            // 产犊界面,输入产犊信息,调用本方法产生3个产后任务和犊牛饲喂任务
            DairyTask t1 = new DairyTask();

            t1.PastureID   = gg.PastureID;
            t1.EarNum      = calving.EarNum;
            t1.ArrivalTime = calving.Birthday.AddDays(3.0);
            t1.DeadLine    = t1.ArrivalTime.AddDays(1.0);
            t1.OperatorID  = gg.DoctorID;
            t1.TaskType    = TaskType.Day3AfterBornTask;
            t1.InputTime   = DateTime.Now;
            this.AddTask(t1);

            DairyTask t2 = new DairyTask();

            t2.PastureID   = gg.PastureID;
            t2.EarNum      = calving.EarNum;
            t2.ArrivalTime = calving.Birthday.AddDays(10.0);
            t2.DeadLine    = t2.ArrivalTime.AddDays(1.0);
            t2.OperatorID  = gg.DoctorID;
            t2.TaskType    = TaskType.Day10AfterBornTask;
            t2.InputTime   = DateTime.Now;
            this.AddTask(t2);

            DairyTask t3 = new DairyTask();

            t3.PastureID   = gg.PastureID;
            t3.EarNum      = calving.EarNum;
            t3.ArrivalTime = calving.Birthday.AddDays(15.0);
            t3.DeadLine    = t3.ArrivalTime.AddDays(1.0);
            t3.OperatorID  = gg.DoctorID;
            t3.TaskType    = TaskType.Day15AfterBornTask;
            t3.InputTime   = DateTime.Now;
            this.AddTask(t3);

            return;
        }
Example #3
0
        /// <summary>
        /// 取牧场某牛的饲养员、配种员或兽医的责任人ID
        /// </summary>
        /// <param name="pastureID">牧场ID</param>
        /// <param name="earNum">耳号</param>
        /// <param name="roleID">角色ID</param>
        /// <returns></returns>
        public int AssignTask(int pastureID, int earNum, int roleID)
        {
            int         userID;
            CowGroupBLL g        = new CowGroupBLL();
            CowBLL      c        = new CowBLL();
            Cow         cc       = c.GetCowInfo(earNum);
            CowGroup    cowGroup = g.GetCowGroupList(pastureID).Find(p => p.ID == cc.GroupID);

            if (cowGroup != null && cowGroup.InsemOperatorID != 0)
            {
                userID = cowGroup.InsemOperatorID;
            }
            else
            {
                //牛群未分配,则分配给场长
                userID = UserBLL.Instance.GetUsers(UserBLL.Instance.CurrentUser.Pasture.ID, Role.FARM_ADMIN_ID)[0].ID;
            }

            return(userID);
        }
Example #4
0
        /// <summary>
        /// 插入假配种记录,为入群用
        /// </summary>
        /// <param name="earNum"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public int InsertFakeInsemination(int earNum, DateTime date)
        {
            Insemination i = new Insemination();

            i.EarNum      = earNum;
            i.OperateDate = date;
            CowBLL      cb   = new CowBLL();
            CowGroupBLL gBLL = new CowGroupBLL();

            i.operatorID       = 0;//gBLL.GetCowGroupInfo(cb.GetCowInfo(earNum).GroupID).InsemOperatorID;
            i.InseminationNum  = 1;
            i.EstrusFindPerson = "孙悟空";
            i.EstrusDate       = date;
            i.EstrusFindType   = 0;
            i.Description      = "";
            i.SemenNum         = "NA";
            i.SemenType        = 0;
            i.Description      = "";
            i.EstrusType       = 0;
            return(InsertInseminationInfo(i));
        }