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); }
public DailyReportBLL(int pastureID) { myFarm = new FarmInfo(pastureID); this.pastureID = pastureID; }