From 29fa57ac45220bcdb5849825c77500f2c8ed0bcd Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Tue, 30 Jan 2018 09:07:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8D=95No.138571=20?= =?UTF-8?q?=E6=94=B6=E8=B4=AD=E7=BB=BC=E5=90=88=E6=8A=A5=E8=A1=A8=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AD=97=E6=AE=B5=E3=80=90=E6=AD=BB=E4=BA=A1=E5=A4=B4?= =?UTF-8?q?=E6=95=B0=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reports/ComprehensiveReport.cs | 47 +++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs index a50a0dc..f627a35 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs @@ -31,13 +31,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports { get { return "收购综合报表"; } } - // protected override string QueryOptionsTabName - // { - // get - // { - // return "显示字段"; - // } - // } + protected override string AccessRoleName { get { return "B3QingDaoWanFu.报表.收购综合报表"; } @@ -81,8 +75,16 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports SetCommonDivSumTable(table, "皮肉比", "皮肉重量", "到厂毛重", true); Set占比(table); - + if (_checkbox.Items.FindByText("死亡头数").Selected) + { + var n = 0; + foreach (DFDataRow row in table.Rows) + { + n += Convert.ToInt32(row["死亡头数"] ?? 0); + } + table.SumRow["死亡头数"] = n; + } // Set占比(table,); try @@ -204,6 +206,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports _checkbox.Items.Add(new ListItem("收购头数", "RealNumber")); + _checkbox.Items.Add(new ListItem("死亡头数", "DeathNumber")); _checkbox.Items.Add(new ListItem("均重", "均重")); _checkbox.Items.Add(new ListItem("毛猪等级", "HogGrade_Name")); _checkbox.Items.Add(new ListItem("原发毛重", "ShackWeight")); @@ -248,6 +251,9 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports var weight = new JoinAlias("mainweight", typeof(WeighBill)); query.From.AddJoin(JoinType.Left, new DQDmoSource(weight), DQCondition.EQ(bill, "Weigh_ID", weight, "ID")); + var abnormalRecord = new JoinAlias("war", typeof(AbnormalRecordingTemp)); + query.RegisterQueryTable(typeof(AbnormalRecordingTemp), new string[] { "Weigh_ID", "DeathNumber" }, AbnormalRecordingTemp.GetQueryDom()); + query.From.AddJoin(JoinType.Left, new DQDmoSource(abnormalRecord), DQCondition.EQ(weight, "ID", abnormalRecord, "Weigh_ID"));//死亡 var hotFreshInput = mQueryContainer.GetInput("HotFreshType"); if (hotFreshInput != null) ButcherOrderTemp.AddJoinWithCondition(query, weight, hotFreshInput); @@ -275,6 +281,11 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(weight, "Zone_Name"), field.Text)); query.GroupBy.Expressions.Add(DQExpression.Field(weight, "Zone_Name")); break; + case "死亡头数": + query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(abnormalRecord, field.Value), field.Text)); + query.GroupBy.Expressions.Add(DQExpression.Field(weight, "ID")); + query.GroupBy.Expressions.Add(DQExpression.Field(abnormalRecord, field.Value)); + break; case "收购日期": case "收购类型": case "供应商": @@ -902,5 +913,25 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports root.From.AddJoin(JoinType.Inner, new DQDmoSource(alias), DQCondition.EQ(weighBill, "ID", alias, "Weigh_ID")); } } + + class AbnormalRecordingTemp + { + public long Weigh_ID { get; set; } + + public int DeathNumber { get; set; } + + public static DQueryDom GetQueryDom() + { + var detail = new JoinAlias(typeof(Weigh_AbnormalRecording)); + var setting = new JoinAlias(typeof(SanctionSetting)); + var query = new DQueryDom(detail); + query.From.AddJoin(JoinType.Inner, new DQDmoSource(setting), DQCondition.EQ(detail, "Sanction_ID", setting, "ID")); + query.Columns.Add(DQSelectColumn.Field("Weigh_ID")); + query.Columns.Add(DQSelectColumn.Sum("Num")); + query.GroupBy.Expressions.Add(DQExpression.Field("Weigh_ID")); + query.Where.Conditions.Add(DQCondition.EQ(setting, "AbnormalItem_Name","死亡")); + return query; + } + } } }