| @ -0,0 +1,130 @@ | |||||
| using BWP.B3ClientService.BO; | |||||
| using BWP.Web.Utils; | |||||
| using BWP.Web.WebControls; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using TSingSoft.WebPluginFramework.Controls; | |||||
| using TSingSoft.WebPluginFramework.Pages; | |||||
| using TSingSoft.WebControls2; | |||||
| using BWP.B3Frameworks.Utils; | |||||
| using System.Web.UI.WebControls; | |||||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||||
| using Forks.EnterpriseServices.SqlDoms; | |||||
| using Forks.EnterpriseServices.DataForm; | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using TSingSoft.WebPluginFramework; | |||||
| using Forks.Utils; | |||||
| namespace BWP.Web.Pages.B3ClientService.Reports.SectionInOutStoreAnalyse_ | |||||
| { | |||||
| class SectionDetailDialog : ServerPage | |||||
| { | |||||
| long? GoodsID | |||||
| { | |||||
| get | |||||
| { | |||||
| if (string.IsNullOrEmpty(Request.QueryString["Goods_ID"])) | |||||
| return null; | |||||
| return long.Parse(Request.QueryString["Goods_ID"]); | |||||
| } | |||||
| } | |||||
| int Flag | |||||
| { | |||||
| get { return int.Parse(Request.QueryString["flag"]); } | |||||
| } | |||||
| DateTime startTime { get { return DateTime.Parse(Request.QueryString["Start"]); } } | |||||
| DateTime endTime { get { return DateTime.Parse(Request.QueryString["End"]); } } | |||||
| protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form) | |||||
| { | |||||
| var pageTitle = BuildTitle(); | |||||
| form.Controls.Add(new PageTitle(pageTitle)); | |||||
| CreateResultPanel(form.EAdd(new TitlePanel("查询结果"))); | |||||
| } | |||||
| string BuildTitle() | |||||
| { | |||||
| var goodsName = string.Empty; | |||||
| if (GoodsID.HasValue) | |||||
| goodsName = WebBLUtil.GetDmoPropertyByID<string>(typeof(Goods), "Name", GoodsID.Value); | |||||
| var billName = "期初"; | |||||
| switch (Flag) | |||||
| { | |||||
| case 0: | |||||
| billName = "入库"; | |||||
| break; | |||||
| case 1: | |||||
| billName = "出库"; | |||||
| break; | |||||
| case -2: | |||||
| billName = "期初"; | |||||
| break; | |||||
| } | |||||
| return string.Format("{0}{1}信息", goodsName, billName); | |||||
| } | |||||
| DFBrowseGrid mBrowseGrid; | |||||
| private void CreateResultPanel(TitlePanel titlePanel) | |||||
| { | |||||
| mBrowseGrid = titlePanel.EAdd(new DFBrowseGrid(new DFDataTableEditor()) { Width = Unit.Percentage(100) }); | |||||
| mBrowseGrid.Columns.Add(new DFBrowseGridAutoColumn()); | |||||
| } | |||||
| void StartQuery() | |||||
| { | |||||
| var sumColumns = new List<int>(); | |||||
| var query = new DQueryDom(new JoinAlias(typeof(SectionStoreView))); | |||||
| query.Columns.Add(DQSelectColumn.Field("ProductBatch_Name", "批次")); | |||||
| if (Flag < 0) | |||||
| { | |||||
| var numCol = DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("InStore", true), DQExpression.Value("1"), DQExpression.Value(-1))); | |||||
| var weightCol = DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("InStore", true), DQExpression.Field("Weight"), DQExpression.Multiply(DQExpression.Value(-1), DQExpression.Field("Weight")))); | |||||
| query.Columns.Add(DQSelectColumn.Create(numCol.ECastType<int>(), "头数")); | |||||
| query.Columns.Add(DQSelectColumn.Create(weightCol.ECastType<Money<decimal>?>(), "重量")); | |||||
| query.Having.Conditions.Add(DQCondition.Or(DQCondition.InEQ(DQExpression.IfNull(numCol, DQExpression.Value(0)), DQExpression.Value(0)), DQCondition.InEQ(DQExpression.IfNull(weightCol, DQExpression.Value(0)), DQExpression.Value(0)))); | |||||
| } | |||||
| else | |||||
| { | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Value(1)).ECastType<int?>(), "头数")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field("Weight")), "重量")); | |||||
| query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Flag", Flag), DQCondition.GreaterThanOrEqual("Time", startTime))); | |||||
| query.Having.Conditions.Add(DQCondition.Or(DQCondition.InEQ(DQExpression.Sum(DQExpression.Value(1)), DQExpression.Value(0)), DQCondition.InEQ(DQExpression.IfNull(DQExpression.Sum(DQExpression.Field("Weight")), DQExpression.Value(0)), DQExpression.Value(0)))); | |||||
| } | |||||
| query.GroupBy.Expressions.Add(DQExpression.Field("ProductBatch_Name")); | |||||
| if (Flag == -1)//期初 | |||||
| query.Where.Conditions.Add(DQCondition.LessThan("Time", startTime)); | |||||
| else | |||||
| query.Where.Conditions.Add(DQCondition.LessThanOrEqual("Time", endTime)); | |||||
| if (GoodsID.HasValue) | |||||
| query.Where.Conditions.Add(DQCondition.EQ("Goods_ID", GoodsID)); | |||||
| else | |||||
| query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("Goods_ID"))); | |||||
| var args = new LoadArguments(query); | |||||
| for (var idx = 1; idx < query.Columns.Count; idx++) | |||||
| { | |||||
| args.SumColumns.Add(idx); | |||||
| args.GroupSumColumns.Add(idx); | |||||
| } | |||||
| mBrowseGrid.LoadArguments = args; | |||||
| mBrowseGrid.DataBind(); | |||||
| } | |||||
| protected override void OnLoad(EventArgs e) | |||||
| { | |||||
| base.OnLoad(e); | |||||
| if (!IsPostBack) | |||||
| StartQuery(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,163 @@ | |||||
| using BWP.B3ClientService; | |||||
| using BWP.B3ClientService.BO; | |||||
| using BWP.B3Frameworks.Utils; | |||||
| using BWP.Web.Utils; | |||||
| using BWP.Web.WebControls; | |||||
| using Forks.EnterpriseServices.DataForm; | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||||
| using Forks.EnterpriseServices.SqlDoms; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Security; | |||||
| using System.Text; | |||||
| using System.Web.UI; | |||||
| using System.Web.UI.HtmlControls; | |||||
| using System.Web.UI.WebControls; | |||||
| using TSingSoft.WebControls2; | |||||
| using TSingSoft.WebPluginFramework.Controls; | |||||
| using TSingSoft.WebPluginFramework.Pages; | |||||
| using TSingSoft.WebPluginFramework; | |||||
| using System.Web; | |||||
| namespace BWP.Web.Pages.B3ClientService.Reports.SectionInOutStoreAnalyse_ | |||||
| { | |||||
| class SectionInOutStoreAnalyse : ServerPage | |||||
| { | |||||
| protected override void OnInit(EventArgs e) | |||||
| { | |||||
| if (!User.IsInRole("B3ClientService.报表展示.条段进销存")) | |||||
| throw new SecurityException(); | |||||
| base.OnInit(e); | |||||
| } | |||||
| DFBrowseGrid mBrowseGrid; | |||||
| protected override void InitForm(HtmlForm form) | |||||
| { | |||||
| form.EAdd(new PageTitle("条段进销存")); | |||||
| var queryPanel = new Panel(); | |||||
| queryPanel.Style.Add(HtmlTextWriterStyle.BackgroundColor, "white"); | |||||
| queryPanel.CssClass = "QueryPanel PrintInVisible"; | |||||
| form.Controls.Add(queryPanel); | |||||
| AddQueryControl(queryPanel); | |||||
| var mZone = new TitlePanelZone(); | |||||
| form.Controls.Add(mZone); | |||||
| mZone.Add(CreateResultTab()); | |||||
| mBrowseGrid.OnDetailDataBound = (tr, obj, index) => | |||||
| { | |||||
| var row = obj as DFDataRow; | |||||
| var gid = string.Format("{0}", row["Goods_ID"]); | |||||
| var url = BuildUrl(string.Format("{0}", gid)); | |||||
| url = WpfPageUrl.ToGlobal(url); | |||||
| url = AspUtil.AddParamToUrl(url, "flag", "-1"); | |||||
| SetCellAtt(tr.Cells[1], url, "进销存明细");//期初 | |||||
| url = AspUtil.UpdateUrlParam(url, "flag", "0"); | |||||
| SetCellAtt(tr.Cells[3], url, "进销存明细");//入库 | |||||
| url = AspUtil.UpdateUrlParam(url, "flag", "1"); | |||||
| SetCellAtt(tr.Cells[5], url, "进销存明细");//出库 | |||||
| url = AspUtil.UpdateUrlParam(url, "flag", "-2"); | |||||
| SetCellAtt(tr.Cells[7], url, "进销存明细");//期末 | |||||
| }; | |||||
| } | |||||
| string BuildUrl(string goodsID) | |||||
| { | |||||
| var url = "~/B3ClientService/Reports/SectionInOutStoreAnalyse_/SectionDetailDialog.aspx"; | |||||
| url = AspUtil.AddParamToUrl(url, "Start", HttpUtility.UrlEncode(startTime.ToString("yyyy/MM/dd HH:mm:ss"))); | |||||
| url = AspUtil.AddParamToUrl(url, "End", HttpUtility.UrlEncode(endTime.ToString("yyyy/MM/dd HH:mm:ss"))); | |||||
| url = AspUtil.AddParamToUrl(url, "Goods_ID", goodsID); | |||||
| return url; | |||||
| } | |||||
| void SetCellAtt(HtmlTableCell cell, string url, string title) | |||||
| { | |||||
| cell.Attributes["onclick"] = "OpenUrlInTopTab('" + url + "','" + title + "');"; | |||||
| cell.Style.Add("color", "blue"); | |||||
| cell.Style.Add("text-decoration", "underline"); | |||||
| cell.Style.Add("cursor", "pointer"); | |||||
| } | |||||
| DFDateTimeInput startInput; | |||||
| DFDateTimeInput endInput; | |||||
| DateTime startTime; | |||||
| DateTime endTime; | |||||
| private void AddQueryControl(Panel queryPanel) | |||||
| { | |||||
| var hPanel = queryPanel.EAdd(new Panel()); | |||||
| hPanel.Style.Add("float", "right"); | |||||
| hPanel.EAdd(new SimpleLabel("期间")); | |||||
| startInput = hPanel.EAdd(new DFDateTimeInput() { Date = DateTime.Today, DefaultTime = DateInputDefaultTime.minValue }); | |||||
| hPanel.EAdd(new LiteralControl("-")); | |||||
| endInput = hPanel.EAdd(new DFDateTimeInput() { Date = DateTime.Today + new TimeSpan(23, 59, 59), DefaultTime = DateInputDefaultTime.maxValue }); | |||||
| hPanel.EAdd(new TSButton("开始查询", delegate { StartQuery(); })); | |||||
| hPanel.EAdd(new RedirectTSButton("清除条件")); | |||||
| } | |||||
| private TitlePanel CreateResultTab() | |||||
| { | |||||
| var result = new TitlePanel("查询结果"); | |||||
| mBrowseGrid = result.EAdd(new DFBrowseGrid(new DFDataTableEditor()) { Width = Unit.Percentage(100) }); | |||||
| mBrowseGrid.Columns.Add(new DFBrowseGridAutoColumn("Goods_ID")); | |||||
| var hPanel = result.EAdd(new HLayoutPanel()); | |||||
| PageUtil.AddExcelExportPanel(hPanel, mBrowseGrid, "条段进销存"); | |||||
| return result; | |||||
| } | |||||
| void StartQuery() | |||||
| { | |||||
| startTime = new DateTime(2017, 10, 10); | |||||
| endTime = DateTime.Today + new TimeSpan(23, 59, 59); | |||||
| if (startInput.Value.HasValue) | |||||
| startTime = startInput.Date; | |||||
| if (endInput.Value.HasValue) | |||||
| endTime = endInput.Date; | |||||
| var sumColumns = new List<int>(); | |||||
| var query = new DQueryDom(new JoinAlias(typeof(SectionStoreView))); | |||||
| query.Columns.Add(DQSelectColumn.Field("Goods_ID")); | |||||
| query.Columns.Add(DQSelectColumn.Field("Goods_Name", "存货名称")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.LessThan("Time", startTime), DQExpression.LogicCase(DQCondition.EQ("InStore", true), DQExpression.Value(1), DQExpression.Value(-1)))).ECastType<int?>(), "期初库存|头数")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.LessThan("Time", startTime), DQExpression.LogicCase(DQCondition.EQ("InStore", true), DQExpression.Field("Weight"), DQExpression.Multiply(DQExpression.Value(-1), DQExpression.Field("Weight"))))), "期初库存|重量")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.And(DQCondition.GreaterThanOrEqual("Time", startTime), DQCondition.EQ("InStore",true)), DQExpression.Value(1))).ECastType<int?>(), "入库|头数")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.And(DQCondition.GreaterThanOrEqual("Time", startTime), DQCondition.EQ("InStore", true)), DQExpression.Field("Number"))), "入库|重量")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.And(DQCondition.GreaterThanOrEqual("Time", startTime), DQCondition.EQ("InStore", false)), DQExpression.Value(1))).ECastType<int?>(), "出库|头数")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.And(DQCondition.GreaterThanOrEqual("Time", startTime), DQCondition.EQ("InStore", false)), DQExpression.Field("Number"))), "出库|重量")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("InStore", true), DQExpression.Value(1), DQExpression.Value(-1))).ECastType<int?>(), "期初库存|头数")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("InStore", true), DQExpression.Field("Weight"), DQExpression.Multiply(DQExpression.Value(-1), DQExpression.Field("Weight")))), "期初库存|重量")); | |||||
| query.GroupBy.Expressions.Add(DQExpression.Field("Goods_ID")); | |||||
| query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Name")); | |||||
| query.Where.Conditions.Add(DQCondition.LessThanOrEqual("Time", endTime)); | |||||
| query.Having.Conditions.Add(DQCondition.Or(DQCondition.InEQ(DQExpression.IfNull(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("InStore", true), DQExpression.Value(1), DQExpression.Value(-1))), DQExpression.Value(0)), DQExpression.Value(0)), DQCondition.InEQ(DQExpression.IfNull(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("InStore", true), DQExpression.Field("Weight"), DQExpression.Multiply(DQExpression.Value(-1), DQExpression.Field("Weight")))), DQExpression.Value(0)), DQExpression.Value(0)))); | |||||
| var args = new LoadArguments(query); | |||||
| for (var idx = 2; idx < query.Columns.Count; idx++) | |||||
| { | |||||
| args.SumColumns.Add(idx); | |||||
| args.GroupSumColumns.Add(idx); | |||||
| } | |||||
| mBrowseGrid.LoadArguments = args; | |||||
| mBrowseGrid.DataBind(); | |||||
| } | |||||
| protected override void OnLoad(EventArgs e) | |||||
| { | |||||
| base.OnLoad(e); | |||||
| if (!IsPostBack) | |||||
| StartQuery(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,131 @@ | |||||
| //using BWP.B3ClientService; | |||||
| //using BWP.B3ClientService.BO; | |||||
| //using BWP.B3Frameworks.Utils; | |||||
| //using BWP.Web.Utils; | |||||
| //using BWP.Web.WebControls; | |||||
| //using Forks.EnterpriseServices.DataForm; | |||||
| //using Forks.EnterpriseServices.DomainObjects2; | |||||
| //using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||||
| //using Forks.EnterpriseServices.SqlDoms; | |||||
| //using System; | |||||
| //using System.Collections.Generic; | |||||
| //using System.Linq; | |||||
| //using System.Security; | |||||
| //using System.Text; | |||||
| //using System.Web.UI; | |||||
| //using System.Web.UI.HtmlControls; | |||||
| //using System.Web.UI.WebControls; | |||||
| //using TSingSoft.WebControls2; | |||||
| //using TSingSoft.WebPluginFramework.Controls; | |||||
| //using TSingSoft.WebPluginFramework.Pages; | |||||
| //using TSingSoft.WebPluginFramework; | |||||
| //namespace BWP.Web.Pages.B3ClientService.Reports.SectionLossAnalyse_ | |||||
| //{ | |||||
| // class SectionLossAnalyse : ServerPage | |||||
| // { | |||||
| // protected override void OnInit(EventArgs e) | |||||
| // { | |||||
| // if (!User.IsInRole("B3ClientService.报表展示.条段损耗")) | |||||
| // throw new SecurityException(); | |||||
| // base.OnInit(e); | |||||
| // } | |||||
| // DFBrowseGrid mBrowseGrid; | |||||
| // protected override void InitForm(HtmlForm form) | |||||
| // { | |||||
| // form.EAdd(new PageTitle("条段损耗")); | |||||
| // var queryPanel = new Panel(); | |||||
| // queryPanel.Style.Add(HtmlTextWriterStyle.BackgroundColor, "white"); | |||||
| // queryPanel.CssClass = "QueryPanel PrintInVisible"; | |||||
| // form.Controls.Add(queryPanel); | |||||
| // AddQueryControl(queryPanel); | |||||
| // var mZone = new TitlePanelZone(); | |||||
| // form.Controls.Add(mZone); | |||||
| // mZone.Add(CreateResultTab()); | |||||
| // } | |||||
| // ChoiceBox batchSelect; | |||||
| // private void AddQueryControl(Panel queryPanel) | |||||
| // { | |||||
| // var hp = queryPanel.EAdd(new Panel()); | |||||
| // hp.Style.Add("float", "right"); | |||||
| // hp.EAdd(new SimpleLabel("生产批次")); | |||||
| // batchSelect = hp.EAdd(new ChoiceBox(B3ClientServiceConsts.DataSources.生产批次) { EnableInputArgument = true, EnableTopItem = true, AutoPostBack = true, Width = Unit.Pixel(180) }); | |||||
| // var batch = GetYesterdayBatch(); | |||||
| // if (batch != null) | |||||
| // batchSelect.Fill(batch.Item1.ToString(), batch.Item2); | |||||
| // batchSelect.SelectedValueChanged += delegate | |||||
| // { | |||||
| // StartQuery(); | |||||
| // }; | |||||
| // } | |||||
| // Tuple<long, string> GetYesterdayBatch() | |||||
| // { | |||||
| // var dom = new DQueryDom(new JoinAlias(typeof(ProductBatch))); | |||||
| // dom.Columns.Add(DQSelectColumn.Field("ID")); | |||||
| // dom.Columns.Add(DQSelectColumn.Field("Name")); | |||||
| // dom.OrderBy.Expressions.Add(DQOrderByExpression.Create("Date", true)); | |||||
| // dom.Where.Conditions.Add(DQCondition.LessThan("Date", DateTime.Today)); | |||||
| // dom.Range = SelectRange.Top(1); | |||||
| // return dom.EExecuteScalar<long, string>(); | |||||
| // } | |||||
| // private TitlePanel CreateResultTab() | |||||
| // { | |||||
| // var result = new TitlePanel("查询结果"); | |||||
| // mBrowseGrid = result.EAdd(new DFBrowseGrid(new DFDataTableEditor()) { Width = Unit.Percentage(100) }); | |||||
| // mBrowseGrid.Columns.Add(new DFBrowseGridAutoColumn()); | |||||
| // var hPanel = result.EAdd(new HLayoutPanel()); | |||||
| // PageUtil.AddExcelExportPanel(hPanel, mBrowseGrid, "条段损耗"); | |||||
| // return result; | |||||
| // } | |||||
| // void StartQuery() | |||||
| // { | |||||
| // var sumColumns = new List<int>(); | |||||
| // var groupSumColumns = new List<int>(); | |||||
| // var main = new JoinAlias(typeof(SectionStoreDetail)); | |||||
| // var goods = new JoinAlias("iGoods", typeof(Goods)); | |||||
| // var query = new DQueryDom(main); | |||||
| // query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, "Goods_ID", goods, "ID")); | |||||
| // query.Columns.Add(DQSelectColumn.Field("Name", goods, "存货名称")); | |||||
| // query.GroupBy.Expressions.Add(DQExpression.Field(goods, "Name")); | |||||
| // query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Value(1)).ECastType<int?>(), "头数")); | |||||
| // sumColumns.Add(query.Columns.Count - 1); | |||||
| // groupSumColumns.Add(query.Columns.Count - 1); | |||||
| // query.Columns.Add(DQSelectColumn.Sum("GradeWeight", "胴体重量")); | |||||
| // sumColumns.Add(query.Columns.Count - 1); | |||||
| // query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(inGoods, "Name"), "存货名称")); | |||||
| // query.GroupBy.Expressions.Add(DQExpression.Field(inGoods, "Name")); | |||||
| // query.Columns.Add(DQSelectColumn.Sum("InStoreWeight", "入库重量")); | |||||
| // sumColumns.Add(query.Columns.Count - 1); | |||||
| // query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Subtract(DQExpression.Field("GradeWeight"), DQExpression.IfNull(DQExpression.Field("InStoreWeight"), DQExpression.Value(0)))), "损耗")); | |||||
| // sumColumns.Add(query.Columns.Count - 1); | |||||
| // groupSumColumns.Add(query.Columns.Count - 1); | |||||
| // if (!batchSelect.IsEmpty) | |||||
| // query.Where.Conditions.Add(DQCondition.EQ("ProductBatch_ID", long.Parse(batchSelect.Value))); | |||||
| // var args = new LoadArguments(query); | |||||
| // foreach (var idx in sumColumns) | |||||
| // args.SumColumns.Add(idx); | |||||
| // foreach (var idx in groupSumColumns) | |||||
| // args.GroupSumColumns.Add(idx); | |||||
| // mBrowseGrid.LoadArguments = args; | |||||
| // mBrowseGrid.DataBind(); | |||||
| // } | |||||
| // protected override void OnLoad(EventArgs e) | |||||
| // { | |||||
| // base.OnLoad(e); | |||||
| // if (!IsPostBack) | |||||
| // StartQuery(); | |||||
| // } | |||||
| // } | |||||
| //} | |||||
| @ -0,0 +1,69 @@ | |||||
| using Forks.EnterpriseServices; | |||||
| using Forks.EnterpriseServices.DataForm; | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||||
| using Forks.EnterpriseServices.SqlDoms; | |||||
| using Forks.Utils.Data; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using TSingSoft.WebPluginFramework; | |||||
| namespace BWP.B3ClientService.BO | |||||
| { | |||||
| [DFClass] | |||||
| [Serializable] | |||||
| [MapToView] | |||||
| public class SectionStoreView : ICreateView | |||||
| { | |||||
| public long Goods_ID { get; set; } | |||||
| public long? ProductBatch_ID { get; set; } | |||||
| public decimal Weight { get; set; } | |||||
| public DateTime Time { get; set; } | |||||
| public bool InStore { get; set; } | |||||
| public int Flag { get; set; } | |||||
| [ReferenceTo(typeof(Goods),"Name")] | |||||
| [Join("Goods_ID", "ID")] | |||||
| public string Goods_Name { get; set; } | |||||
| public ISqlDom CreateView() | |||||
| { | |||||
| var u1 = GetInStore(); | |||||
| u1.UnionNext.Select =GetOutStore(); | |||||
| u1.UnionNext.Type = UnionType.All; | |||||
| var sqlDom1 = u1.Build(DbProviderType.SqlClient, DbmsType.sqlserver); | |||||
| return sqlDom1; | |||||
| } | |||||
| private DQueryDom GetInStore() | |||||
| { | |||||
| var query = new DQueryDom(new JoinAlias("_inStore", typeof(SectionStoreDetail))); | |||||
| query.Columns.Add(DQSelectColumn.Field("ProductBatch_ID")); | |||||
| query.Columns.Add(DQSelectColumn.Field("Goods_ID")); | |||||
| query.Columns.Add(DQSelectColumn.Field("Weight")); | |||||
| query.Columns.Add(DQSelectColumn.Field("InStoreTime", "Time")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(true), "InStore")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(0), "Flag")); | |||||
| return query; | |||||
| } | |||||
| private DQueryDom GetOutStore() | |||||
| { | |||||
| var query = new DQueryDom(new JoinAlias("_outStore", typeof(SectionStoreDetail))); | |||||
| query.Columns.Add(DQSelectColumn.Field("ProductBatch_ID")); | |||||
| query.Columns.Add(DQSelectColumn.Field("Goods_ID")); | |||||
| query.Columns.Add(DQSelectColumn.Field("Weight")); | |||||
| query.Columns.Add(DQSelectColumn.Field("OutStoreTime", "Time")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(false), "InStore")); | |||||
| query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "Flag")); | |||||
| query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field("OutStoreTime"))); | |||||
| return query; | |||||
| } | |||||
| } | |||||
| } | |||||