示例#1
0
        public List <DailyReport> GetDailyReport(int pastureID, DateTime startDate, DateTime endDate)
        {
            List <DailyReport> list  = new List <DailyReport>();
            ReportDAL          dal   = new ReportDAL();
            DataTable          table = dal.GetDailyReportTable(pastureID, startDate.Date, endDate.Date);

            foreach (DataRow item in table.Rows)
            {
                DailyReport myReport = WrapDailyReportItem(item);
                myReport.PastureID = pastureID;

                //产犊
                myReport.CalvingNumber    = FarmInfo.GetSumCalving(this.pastureID, myReport.ReportDate);
                myReport.MaleCalfNumber   = FarmInfo.GetSumMaleCalf(this.pastureID, myReport.ReportDate);
                myReport.FemaleCalfNumber = FarmInfo.GetSumFemaleCalf(this.pastureID, myReport.ReportDate);

                //产奶
                MilkRecord milk = new MilkRecord(this.pastureID, myReport.ReportDate);
                myReport.SaleMilk         = milk.TotalMilkSale;
                myReport.AbnormalSaleMilk = milk.OtherMilkRecord.AbnormalSaleMilk;
                myReport.MilkForCalf      = milk.OtherMilkRecord.MilkForCalf;
                myReport.BadMilk          = milk.OtherMilkRecord.BadMilk;
                myReport.LeftMilk         = milk.OtherMilkRecord.LeftMilk;

                list.Add(myReport);
            }
            return(list);
        }
示例#2
0
        public DailyReport GetDailyReport(int pastureID, DateTime date)
        {
            DailyReport myReport;
            ReportDAL   dal   = new ReportDAL();
            DataTable   table = dal.GetDailyReportTable(pastureID, date.Date);

            if (table.Rows.Count == 1)
            {
                myReport           = WrapDailyReportItem(table.Rows[0]);
                myReport.PastureID = pastureID;

                //产犊
                myReport.CalvingNumber    = FarmInfo.GetSumCalving(this.pastureID, myReport.ReportDate);
                myReport.MaleCalfNumber   = FarmInfo.GetSumMaleCalf(this.pastureID, myReport.ReportDate);
                myReport.FemaleCalfNumber = FarmInfo.GetSumFemaleCalf(this.pastureID, myReport.ReportDate);

                //产奶
                MilkRecord milk = new MilkRecord(this.pastureID, myReport.ReportDate);
                myReport.SaleMilk         = milk.TotalMilkSale;
                myReport.AbnormalSaleMilk = milk.OtherMilkRecord.AbnormalSaleMilk;
                myReport.MilkForCalf      = milk.OtherMilkRecord.MilkForCalf;
                myReport.BadMilk          = milk.OtherMilkRecord.BadMilk;
                myReport.LeftMilk         = milk.OtherMilkRecord.LeftMilk;

                //离群
                StrayBLL sBLL = new StrayBLL();
                myReport.SoldCowNum      = sBLL.GetSoldStrayNumber(pastureID, date.Date);
                myReport.DeadCowNum      = sBLL.GetStrayNumberByStrayType(pastureID, date.Date, 1);
                myReport.ElimintedCowNum = sBLL.GetStrayNumberByStrayType(pastureID, date.Date, 0);
            }
            else
            {
                myReport = null;
            }
            return(myReport);
        }