From 8d8137e0354b186d79972319433334d292db7ca5 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Sat, 10 Mar 2018 08:47:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E6=AD=BB=E4=BA=A1=E6=80=A5=E5=AE=B0?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B3QingDaoWanFu.Web/DFGridReportPage.cs | 81 ++++++++------ .../B3QingDaoWanFu/Reports/ButcherPigInfo.cs | 104 +++++++++++++++++- .../B3QingDaoWanFu/Reports/ButcherPigInfo.xml | 45 ++------ .../Reports/ComprehensiveReport.cs | 57 ---------- .../config/plugins/B3QingDaoWanFu.plugin | 4 +- 5 files changed, 162 insertions(+), 129 deletions(-) diff --git a/B3QingDaoWanFu.Web/DFGridReportPage.cs b/B3QingDaoWanFu.Web/DFGridReportPage.cs index be2421f..1b0fb06 100644 --- a/B3QingDaoWanFu.Web/DFGridReportPage.cs +++ b/B3QingDaoWanFu.Web/DFGridReportPage.cs @@ -13,51 +13,66 @@ namespace BWP.Web protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form) { - if (fromSuperScreen) - { - mQueryContainer = QueryContainer.FromResource(BasisType.FullName + ".xml", BasisType.Assembly); - mQueryControls.QueryContainer = mQueryContainer; - var queryContainerScript = new QueryContainerScript(mQueryContainer) { ID = "QueryContainer" }; - form.Controls.Add(queryContainerScript); - var vPanel = form.EAdd(new VLayoutPanel()); - AddResultControls(vPanel); - if (!string.IsNullOrEmpty(ResultHeightClientExpression)) - { - vPanel.PreRender += (sender, e) => - { - var script = "$(function(){$('#{ClientID}').css('max-height',({ResultHeightClientExpression})+'px');});" - .Replace("{ClientID}", vPanel.ClientID) - .Replace("{ResultHeightClientExpression}", ResultHeightClientExpression); - vPanel.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ResultHeightClientExpression", script, true); - }; - } - } - else - base.InitForm(form); + base.InitForm(form); mDFGrid.HeaderPagerLock = true; mDFGrid.AllowColGroup = true; mDFGrid.AllowSorting = true; } - protected bool fromSuperScreen + protected override void AddResultControls(VLayoutPanel vbox) { - get { return !string.IsNullOrEmpty(Request.QueryString["type"]); } - } + base.AddResultControls(vbox); + mDFGrid.AllowSorting = true; + mDFGrid.HeaderPagerLock = true; + mDFGrid.Height = 650; + mDFGrid.Width = 1100; + string bodyHeight = Request.Form["__BodyHeight"]; + string bodyWidth = Request.Form["__BodyWidth"]; - protected override bool EnableExcelExport - { - get + if (bodyHeight != null) + { + int height; + if (int.TryParse(bodyHeight, out height) && height > 180) + { + mDFGrid.Height = height - 160; + } + else + { + mDFGrid.Height = 650; + } + } + if (bodyWidth != null) { - return !fromSuperScreen; + int width; + if (int.TryParse(bodyWidth, out width) && width > 100) + { + mDFGrid.Width = width - 30; + } + else + { + mDFGrid.Width = 1100; + } } + } - protected override bool EnablePrint + protected override void OnPreRender(EventArgs e) { - get - { - return !fromSuperScreen; - } + base.OnPreRender(e); + + var script = @" + + "; + ClientScript.RegisterHiddenField("__BodyHeight", ""); + ClientScript.RegisterHiddenField("__BodyWidth", ""); + ClientScript.RegisterClientScriptBlock(GetType(), "gridsc", script, false); } } } diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ButcherPigInfo.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ButcherPigInfo.cs index a940a49..e8fcc97 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ButcherPigInfo.cs +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ButcherPigInfo.cs @@ -1,8 +1,18 @@ using BWP.B3ButcherManage.BO; +using BWP.B3ButcherManage.NamedValueTemplate; +using BWP.B3Frameworks.BO.NamedValueTemplate; +using BWP.B3Frameworks.Utils; +using BWP.Web.Layout; +using BWP.Web.Utils; +using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.SqlDoms; using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Web.UI.WebControls; +using TSingSoft.WebControls2; namespace BWP.Web.Pages.B3QingDaoWanFu.Reports { @@ -10,12 +20,102 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports { protected override string AccessRoleName { - get { throw new NotImplementedException(); } + get { return "B3QingDaoWanFu.报表.异常猪分析"; } } protected override string Caption { - get { throw new NotImplementedException(); } + get { return "异常猪分析"; } + } + + + protected override void AddQueryControls(VLayoutPanel vPanel) + { + var layoutManager = new LayoutManager("Main", mDFInfo, mQueryContainer); + + DFNamedValueInput<单据状态> input; + layoutManager.Add("BillState", input = QueryCreator.一般单据状态(mDFInfo.Fields["BillState"], true)); + input.Value = 单据状态.已审核; + var config = new AutoLayoutConfig() { Cols = 4 }; + + layoutManager.Add("ID", new SimpleLabel("过磅单号"), QueryCreator.DFTextBox(mDFInfo.Fields["ID"])); + + config.Add("ID"); + config.Add("BillState"); + config.Add("Supplier_ID"); + config.Add("Employee_ID"); + config.Add("WeighTime"); + layoutManager.Config = config; + vPanel.Add(layoutManager.CreateLayout()); + } + + protected override DQueryDom GetQueryDom() + { + var query = base.GetQueryDom(); + var main = query.From.RootSource.Alias; + var detail = DeathPig.Register(query, main); + var hurry = OrderHurryPig.Register(query, main); + query.Columns.Add(DQSelectColumn.Field("Supplier_Name")); + query.Columns.Add(DQSelectColumn.Field("ID", "过磅单号")); + query.Columns.Add(DQSelectColumn.Field("BuyNum","总头数")); + SumColumnNames.Add("BuyNum"); + + query.Columns.Add(DQSelectColumn.Field("HurryNumber", hurry, "急宰头数")); + SumColumnNames.Add("HurryNumber"); + + query.Columns.Add(DQSelectColumn.Field("DeathNumber", detail, "死亡头数")); + SumColumnNames.Add("DeathNumber"); + foreach (var c in query.Columns) + ColumnNames.Add(c.Name); + OrganizationUtil.AddOrganizationLimit(query, typeof(WeighBill)); + return query; + } + + class OrderHurryPig + { + public long Weight_ID { get; set; } + + public int? HurryNumber { get; set; } + + public static JoinAlias Register(DQueryDom root, JoinAlias alias) + { + var main = new JoinAlias(typeof(ButcherOrder)); + var detail = new JoinAlias(typeof(ButcherOrder_Detail)); + var query = new DQueryDom(main); + query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "ButcherOrder_ID")); + query.Columns.Add(DQSelectColumn.Field("WeighBill_ID", detail)); + query.Columns.Add(DQSelectColumn.Sum(detail,"PlanNumber")); + query.GroupBy.Expressions.Add(DQExpression.Field(detail,"WeighBill_ID")); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(detail, "IsHurryButcher", true),DQCondition.InEQ("BillState",单据状态.已作废))); + + var t = new JoinAlias(typeof(OrderHurryPig)); + root.RegisterQueryTable(typeof(OrderHurryPig), new string[] { "Weight_ID", "HurryNumber" }, query); + root.From.AddJoin(JoinType.Left, new DQDmoSource(t), DQCondition.EQ(alias, "ID", t, "Weight_ID")); + return t; + } + } + + class DeathPig + { + public long Weight_ID { get; set; } + + public int? DeathNumber { get; set; } + + public static JoinAlias Register(DQueryDom root, JoinAlias alias){ + 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","死亡")); + + var t = new JoinAlias(typeof(DeathPig)); + root.RegisterQueryTable(typeof(DeathPig), new string[] { "Weight_ID", "DeathNumber" }, query); + root.From.AddJoin(JoinType.Left, new DQDmoSource(t), DQCondition.EQ(alias, "ID", t, "Weight_ID")); + return t; + } } } } diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ButcherPigInfo.xml b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ButcherPigInfo.xml index c3c8a7c..0e770db 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ButcherPigInfo.xml +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ButcherPigInfo.xml @@ -4,61 +4,34 @@ - + - + - - - - - - - - - - - - - + - + - - - - - + - - - - - - - - - - - - - + + - - + + diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs index 645b4b1..8285bc1 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs @@ -27,62 +27,6 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports { public class ComprehensiveReport : DFGridReportPage { - protected override void AddResultControls(VLayoutPanel vbox) - { - base.AddResultControls(vbox); - mDFGrid.AllowSorting = true; - mDFGrid.HeaderPagerLock = true; - mDFGrid.Height = 650; - mDFGrid.Width = 1100; - string bodyHeight = Request.Form["__BodyHeight"]; - string bodyWidth = Request.Form["__BodyWidth"]; - - if (bodyHeight != null) - { - int height; - if (int.TryParse(bodyHeight, out height) && height > 180) - { - mDFGrid.Height = height - 160; - } - else - { - mDFGrid.Height = 650; - } - } - if (bodyWidth != null) - { - int width; - if (int.TryParse(bodyWidth, out width) && width > 100) - { - mDFGrid.Width = width - 30; - } - else - { - mDFGrid.Width = 1100; - } - } - - } - - protected override void OnPreRender(EventArgs e) - { - base.OnPreRender(e); - - var script = @" - - "; - ClientScript.RegisterHiddenField("__BodyHeight", ""); - ClientScript.RegisterHiddenField("__BodyWidth", ""); - ClientScript.RegisterClientScriptBlock(GetType(), "gridsc", script, false); - } - protected override string Caption { get { return "收购综合报表"; } @@ -245,7 +189,6 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports vPanel.Add(layoutManager.CreateLayout()); } - private CheckBoxListWithReverseSelect _checkbox; protected override void InitQueryPanel(QueryPanel queryPanel) { diff --git a/WebFolder/config/plugins/B3QingDaoWanFu.plugin b/WebFolder/config/plugins/B3QingDaoWanFu.plugin index efd12c2..321b82a 100644 --- a/WebFolder/config/plugins/B3QingDaoWanFu.plugin +++ b/WebFolder/config/plugins/B3QingDaoWanFu.plugin @@ -19,7 +19,8 @@ - + + @@ -32,6 +33,7 @@ +