|
|
using BWP.B3Frameworks;
|
|
|
using BWP.B3Frameworks.BO;
|
|
|
using BWP.B3Frameworks.BO.MoneyTemplate;
|
|
|
using BWP.B3Frameworks.BO.NamedValueTemplate;
|
|
|
using BWP.B3Frameworks.Utils;
|
|
|
using BWP.B3QingDaoWanFu.BO;
|
|
|
using BWP.B3Sale.BO;
|
|
|
using BWP.B3Sale.Utils;
|
|
|
using BWP.B3UnitedInfos;
|
|
|
using BWP.B3UnitedInfos.BO;
|
|
|
using BWP.Web.Layout;
|
|
|
using BWP.Web.Pages.B3Sale.Reports;
|
|
|
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 Forks.Utils;
|
|
|
using System;
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Web.UI.HtmlControls;
|
|
|
using System.Web.UI.WebControls;
|
|
|
using TSingSoft.WebControls2;
|
|
|
using TSingSoft.WebControls2.DFGrids;
|
|
|
using TSingSoft.WebControls2.QBELinks;
|
|
|
using TSingSoft.WebPluginFramework;
|
|
|
using TSingSoft.WebPluginFramework.Controls;
|
|
|
using TSingSoft.WebPluginFramework.Exports;
|
|
|
|
|
|
namespace BWP.Web.Pages.B3QingDaoWanFu.SaleOutStore_
|
|
|
{
|
|
|
|
|
|
public class SaleOutStoreSimpleAnayse:DFBrowseGridReportPage
|
|
|
{
|
|
|
protected override string Caption
|
|
|
{
|
|
|
get { return "万福销售出库分析"; }
|
|
|
}
|
|
|
|
|
|
protected override bool EnableExcelExport
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private QueryResult GetQueryResult(LoadArguments arg)
|
|
|
{
|
|
|
var data = new DFDataTableEditor().Load(arg);
|
|
|
return new QueryResult(data.TotalCount, data.Data.Rows, data.Data.Columns, arg.SumColumns.Any() ? data.Data.SumRow : null);
|
|
|
}
|
|
|
|
|
|
protected override string AccessRoleName
|
|
|
{
|
|
|
get { return "B3QingDaoWanFu.报表.销售出库分析"; }
|
|
|
}
|
|
|
protected override bool EnableQueryPanel
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
readonly DFInfo _mainInfo = DFInfo.Get(typeof(SaleOutStore));
|
|
|
readonly DFInfo _detailInfo = DFInfo.Get(typeof(SaleOutStore_Detail));
|
|
|
|
|
|
|
|
|
private CustomPriviewAction previewAction;
|
|
|
private CustomPrintAction printAction;
|
|
|
private DFChoiceBox deliverLineInput;
|
|
|
private DFNamedValueInput<单据状态> billStateInput;
|
|
|
|
|
|
protected override void InitForm(HtmlForm form)
|
|
|
{
|
|
|
var group = new ButtonGroup();
|
|
|
previewAction = new CustomPriviewAction();
|
|
|
printAction = new CustomPrintAction();
|
|
|
|
|
|
var billReportSelect = new BillReportSelectAction(PrintUtil.GetTemplateFile(PluginName, "SaleOutStoreSimpleAnaysePrint.xml"));
|
|
|
group.Actions.Add(previewAction);
|
|
|
group.Actions.Add(printAction);
|
|
|
group.Actions.Add(billReportSelect);
|
|
|
|
|
|
|
|
|
var hPanel = new HLayoutPanel();
|
|
|
hPanel.Add(group);
|
|
|
form.Controls.Add(hPanel);
|
|
|
|
|
|
base.InitForm(form);
|
|
|
}
|
|
|
|
|
|
protected override void InitQueryPanel(QueryPanel queryPanel)
|
|
|
{
|
|
|
base.InitQueryPanel(queryPanel);
|
|
|
|
|
|
|
|
|
queryPanel.EAdd(new HLayoutPanel() { new SimpleLabel("显示格式"), _showTypeList });
|
|
|
mQueryControls.Add("显示格式", _showTypeList);
|
|
|
}
|
|
|
private ChoiceBox _goodsPropertyCatalog;
|
|
|
private CheckBoxList _showTypeList;
|
|
|
protected override void AddQueryControls(VLayoutPanel vPanel)
|
|
|
{
|
|
|
var layout = new LayoutManager("Main", _mainInfo);
|
|
|
layout.Add("DeliverGoodsLine_ID", mQueryContainer.AddLink(new ChoiceBoxMultiSelectLink(deliverLineInput = QueryCreator.DFChoiceBoxEnableMultiSelection(_mainInfo.Fields["DeliverGoodsLine_ID"], B3SaleDataSources.送货线路), s => long.Parse(s)), "DeliverGoodsLine_ID"));
|
|
|
|
|
|
layout["DeliverGoodsLine_ID"].NotAutoAddToContainer = true;
|
|
|
layout.Add("LoadTime", QueryCreator.TimeRange(_mainInfo.Fields["LoadTime"], mQueryContainer, "MinLoadTime", "MaxLoadTime",DateTime.Today, DateTime.Today.AddDays(1).AddSeconds(-1)));
|
|
|
|
|
|
var state = mQueryContainer.Add(billStateInput = QueryCreator.一般单据状态(_mainInfo.Fields["BillState"], true, false, true, true), "BillState");
|
|
|
((ChoiceBox)state).Value = 单据状态.已审核.Value.ToString() + "|";
|
|
|
state.DisplayValue = "已审核;";
|
|
|
state.EnableInputArgument = true;
|
|
|
layout.Add("BillState", state);
|
|
|
|
|
|
layout.Add("OrderDate", QueryCreator.TimeRange(_mainInfo.Fields["OrderDate"], mQueryContainer, "MinOrderDate", "MaxOrderDate"));
|
|
|
_goodsPropertyCatalog = QueryCreator.DFChoiceBoxEnableMultiSelection(_detailInfo.Fields["GoodsPropertyCatalog_ID"], B3UnitedInfosConsts.DataSources.存货属性分类);
|
|
|
layout.Add("GoodsPropertyCatalog_ID", new SimpleLabel("属性分类"), mQueryContainer.AddLink(new ChoiceBoxMultiSelectLink(_goodsPropertyCatalog, s => long.Parse(s)), "GoodsPropertyCatalog_ID"));
|
|
|
layout["GoodsPropertyCatalog_ID"].NotAutoAddToContainer = true;
|
|
|
layout.Add("Customer_ID", mQueryContainer.AddLink(new ChoiceBoxMultiSelectLink(QueryCreator.DFChoiceBoxEnableMultiSelection(_mainInfo.Fields["Customer_ID"], B3SaleDataSources.用户配置客户全部), s => long.Parse(s)), "Customer_ID"));
|
|
|
layout.Add("TakeGoods_Type", mQueryContainer.AddLink(new ChoiceBoxMultiSelectLink(QueryCreator.DFNameValueInputEnableMultiSelection<配送方式>(_mainInfo.Fields["TakeGoods_Type"]), s => long.Parse(s)), "TakeGoods_Type"));
|
|
|
layout["GoodsPropertyCatalog_ID"].NotAutoAddToContainer = true;
|
|
|
|
|
|
|
|
|
_showTypeList = new CheckBoxList
|
|
|
{
|
|
|
RepeatColumns = 6,
|
|
|
RepeatDirection = RepeatDirection.Horizontal
|
|
|
};
|
|
|
_showTypeList.Items.Add(new ListItem("合并单元格")
|
|
|
{
|
|
|
Selected = true
|
|
|
});
|
|
|
layout.Add("合并单元格",new SimpleLabel("合并单元格"), _showTypeList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var config = layout.CreateDefaultConfig(4);
|
|
|
config.Expand = false;
|
|
|
var section = mPageLayoutManager.AddSection("查询条件", "查询条件");
|
|
|
section.ApplyLayout(layout, config, mPageLayoutManager, _mainInfo);
|
|
|
section.SetDisplayName("DeliverGoodsLine_ID", "送货线路");
|
|
|
section.SetDisplayName("LoadTime", "发货时间");
|
|
|
section.SetDisplayName("BillState", "单据状态");
|
|
|
section.SetDisplayName("OrderDate", "订货时间");
|
|
|
vPanel.Add(layout.CreateLayout(), new VLayoutOption(HorizontalAlign.Left));
|
|
|
}
|
|
|
|
|
|
private Dictionary<string, string> fieldInfo = new Dictionary<string, string>() { { "DeliverGoodsLine_Name", "送货线路名称" }, { "Customer_Name", "购货客户" }, { "Goods_Name", "存货名称" }, { "Goods_Spec", "存货规格" }, { "UnitNum", "报价数量" }, { "SecondNumber", "辅数量" }, { "Goods_SecondUnit", "辅单位" } };
|
|
|
|
|
|
|
|
|
protected override void PrepareData()
|
|
|
{
|
|
|
base.PrepareData();
|
|
|
var maxLoad = mQueryContainer.GetControl<DFDateTimeInput>("MaxLoadTime");
|
|
|
var minLoad = mQueryContainer.GetControl<DFDateTimeInput>("MinLoadTime");
|
|
|
var maxOrder = mQueryContainer.GetControl<DFDateTimeInput>("MaxOrderDate");
|
|
|
var minOrder = mQueryContainer.GetControl<DFDateTimeInput>("MinOrderDate");
|
|
|
var customer = mQueryContainer.GetControl<DFChoiceBox>("Customer_ID");
|
|
|
var take = mQueryContainer.GetControl<DFNamedValueInput<配送方式>>("TakeGoods_Type");
|
|
|
var info = new SaleOutStorePrintInfo();
|
|
|
if (!maxLoad.IsEmpty)
|
|
|
{
|
|
|
info.MaxLoadTime = maxLoad.Date;
|
|
|
}
|
|
|
|
|
|
if (!maxOrder.IsEmpty)
|
|
|
{
|
|
|
info.MaxOrderDate = maxOrder.Date;
|
|
|
}
|
|
|
|
|
|
if (!minLoad.IsEmpty)
|
|
|
{
|
|
|
info.MinLoadTime = minLoad.Date;
|
|
|
}
|
|
|
|
|
|
if (!minOrder.IsEmpty)
|
|
|
{
|
|
|
info.MinOrderDate = minOrder.Date;
|
|
|
}
|
|
|
if(!customer.IsEmpty)
|
|
|
{
|
|
|
info.Customers = customer.Value;
|
|
|
}
|
|
|
if(!take.IsEmpty)
|
|
|
{
|
|
|
info.TakeGoodsTypes = string.Join("|", take.GetValues().Select(x => x.Value));
|
|
|
}
|
|
|
|
|
|
info.BillStates = string.Join("|", billStateInput.GetValues().Select(x => x.Value));
|
|
|
info.DeliverGoodsLines = deliverLineInput.Value;
|
|
|
info.GoodsPropertyCatalogs = _goodsPropertyCatalog.Value;
|
|
|
info.GoodsPropertyCatalogDisplayValue = _goodsPropertyCatalog.DisplayValue;
|
|
|
|
|
|
info.Save();
|
|
|
printAction.Url = "SaleOutStoreSimpleAnaysePrint.aspx";
|
|
|
previewAction.Url = "SaleOutStoreSimpleAnaysePrint.aspx";
|
|
|
|
|
|
}
|
|
|
protected override DQueryDom GetQueryDom()
|
|
|
{
|
|
|
mBrowseGrid.EnableRowsGroup = _showTypeList.Items.FindByText("合并单元格").Selected;
|
|
|
var dom = base.GetQueryDom();
|
|
|
var root = dom.From.RootSource.Alias;
|
|
|
var detail = JoinAlias.Create("detail");
|
|
|
var goods = new JoinAlias(typeof(SaleGoods));
|
|
|
var goodsProperty = new JoinAlias(typeof(GoodsProperty));
|
|
|
var goodsPropertyCatalog = new JoinAlias(typeof(GoodsPropertyCatalog));
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(detail, "SaleGoods_ID", goods, "ID"));
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(goodsProperty), DQCondition.EQ(goodsProperty, "ID", goods, "GoodsProperty_ID"));
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(goodsPropertyCatalog), DQCondition.EQ(goodsProperty, "GoodsPropertyCatalog_ID", goodsPropertyCatalog, "ID"));
|
|
|
|
|
|
|
|
|
dom.Where.Conditions.Add(DQCondition.EQ(root, "Domain_ID", DomainContext.Current.ID));
|
|
|
OrganizationUtil.AddOrganizationLimit(dom, typeof(SaleOutStore));
|
|
|
if (!_goodsPropertyCatalog.IsEmpty)
|
|
|
{
|
|
|
|
|
|
var strs = B3SaleWebUtil.GetDeepByTreeName(_goodsPropertyCatalog.DisplayValue);
|
|
|
var conditions = new List<IDQExpression>();
|
|
|
var values = _goodsPropertyCatalog.GetValues();
|
|
|
for (int index = 0; index < values.Length; index++)
|
|
|
{
|
|
|
var value = values[index];
|
|
|
conditions.Add(DQCondition.EQ(goodsPropertyCatalog, "TreeDeep" + strs[index] + "ID", value));
|
|
|
}
|
|
|
dom.Where.Conditions.Add(DQCondition.Or(conditions));
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach (var item in fieldInfo)
|
|
|
{
|
|
|
switch (item.Key)
|
|
|
{
|
|
|
case "Customer_Name":
|
|
|
case "DeliverGoodsLine_Name":
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(root, item.Key), item.Value));
|
|
|
dom.GroupBy.Expressions.Add(DQExpression.Field(root, item.Key));
|
|
|
break;
|
|
|
case "Goods_Name":
|
|
|
case "Goods_Spec":
|
|
|
case "Goods_SecondUnit":
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(detail, item.Key), item.Value));
|
|
|
dom.GroupBy.Expressions.Add(DQExpression.Field(detail, item.Key));
|
|
|
break;
|
|
|
case "SecondNumber":
|
|
|
case "UnitNum":
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(detail, item.Key)), item.Value));
|
|
|
SumColumnIndexs.Add(dom.Columns.Count - 1);
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return dom;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|