Browse Source

需求单No.138571 收购综合报表增加字段【死亡头数】

master
yibo 8 years ago
parent
commit
29fa57ac45
1 changed files with 39 additions and 8 deletions
  1. +39
    -8
      B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs

+ 39
- 8
B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs View File

@ -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;
}
}
}
}

Loading…
Cancel
Save