Browse Source

需求单No.138374

master
duanluohua 7 years ago
parent
commit
29af5f54c7
5 changed files with 451 additions and 4 deletions
  1. +11
    -3
      B3_DongFangWanQi.Web/B3_DongFangWanQi.Web.csproj
  2. +258
    -0
      B3_DongFangWanQi.Web/Overlays/CarLoadingAnalyse_/CarLoadingAnalyse.cs
  3. +56
    -0
      B3_DongFangWanQi.Web/Overlays/CarLoadingAnalyse_/CarLoadingAnalyse.xml
  4. +3
    -1
      B3_DongFangWanQi.Web/PluginClass.cs
  5. +123
    -0
      B3_DongFangWanQi.Web/Utils/CustomInputCreator.cs

+ 11
- 3
B3_DongFangWanQi.Web/B3_DongFangWanQi.Web.csproj View File

@ -37,11 +37,13 @@
<Reference Include="B3ButcherManage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\B3ButcherManage.dll</HintPath>
<Private>False</Private></Reference>
<Private>False</Private>
</Reference>
<Reference Include="B3CowButcherManage.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\B3CowButcherManage.Web.dll</HintPath>
<Private>False</Private></Reference>
<Private>False</Private>
</Reference>
<Reference Include="B3Frameworks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
@ -119,6 +121,9 @@
<Compile Include="Overlays\B3CowProductTaskEdit.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Overlays\CarLoadingAnalyse_\CarLoadingAnalyse.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Overlays\SaleOutStoreAnalyse_Ext.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@ -155,6 +160,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PluginClass.cs" />
<Compile Include="TypeIOCs\OrderAfterSaveTypeIoc.cs" />
<Compile Include="Utils\CustomInputCreator.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\B3_DongFangWanQi\B3_DongFangWanQi.csproj">
@ -165,7 +171,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Tools\" />
<Folder Include="Utils\" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
@ -199,6 +204,9 @@
<ItemGroup>
<EmbeddedResource Include="Pages\B3_DongFangWanQi\Bills\ProductionNotification_\SelectOrderDialog.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Overlays\CarLoadingAnalyse_\CarLoadingAnalyse.xml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.


+ 258
- 0
B3_DongFangWanQi.Web/Overlays/CarLoadingAnalyse_/CarLoadingAnalyse.cs View File

@ -0,0 +1,258 @@
using System.Collections.Generic;
using System.Web.UI.WebControls;
using BWP.B3Frameworks;
using BWP.B3Frameworks.BO.NamedValueTemplate;
using BWP.B3Frameworks.Utils;
using BWP.Web.Layout;
using BWP.Web.Utils;
using BWP.Web.WebControls;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.SqlDoms;
using Forks.Utils;
using TSingSoft.WebControls2;
using TSingSoft.WebControls2.QBELinks;
using BWP.B3Sale.BO;
using BWP.B3Sale.Utils;
using BWP.B3Frameworks.BO;
using TSingSoft.WebPluginFramework;
using System;
using BWP.B3Sale;
using Sale = BWP.Web.Pages.B3Sale.Reports.CarLoadingAnalyse_;
namespace BWP.Web.Overlays.CarLoadingAnalyse_
{
public class CarLoadingAnalyse: DFBrowseGridReportPage
{
protected override string Caption
{
get { return "装车单分析"; }
}
protected override string AccessRoleName
{
get { return "B3Sale.装车单.访问"; }
}
protected override bool EnableQueryPanel
{
get
{
return true;
}
}
readonly DFInfo _mainInfo = DFInfo.Get(typeof(CarLoading));
readonly DFInfo _detailInfo = DFInfo.Get(typeof(CarLoading_BillDetail));
protected virtual void AddShowFields(List<Tuple<string, string>> showFields)
{
}
CheckBoxListWithReverseSelect _checkbox;
readonly Dictionary<string, DFInfo> _fileInfo = new Dictionary<string, DFInfo>();
protected override void InitQueryPanel(QueryPanel queryPanel)
{
base.InitQueryPanel(queryPanel);
var panel = queryPanel.CreateTab("显示字段");
_fileInfo.Add("Date", _mainInfo);
_fileInfo.Add("ID", _mainInfo);
_fileInfo.Add("Car_Name", _mainInfo);
_fileInfo.Add("Employee_Name", _mainInfo);
_fileInfo.Add("Deliveryman_Name", _mainInfo);
_fileInfo.Add("AccountingUnit_Name", _mainInfo);
_fileInfo.Add("DeliverGoodsLine_Name", _mainInfo);
_fileInfo.Add("Remark", _mainInfo);
_fileInfo.Add("总数量", _mainInfo);
_fileInfo.Add("金额", _mainInfo);
_checkbox = new CheckBoxListWithReverseSelect { RepeatColumns = 6, RepeatDirection = RepeatDirection.Horizontal };
var showFields = new List<Tuple<string, string>>();
foreach (var item in _fileInfo)
{
if (item.Key == "总数量" || item.Key == "金额")
showFields.Add(new Tuple<string, string>(item.Key, item.Key));
else
showFields.Add(new Tuple<string, string>(item.Key, item.Value.Fields[item.Key].Prompt));
}
AddShowFields(showFields);
var section = mPageLayoutManager.AddSection("显示字段", "显示字段");
section.ApplyLayout(showFields, mPageLayoutManager);
foreach (var item in showFields)
{
_checkbox.Items.Add(new ListItem(item.Item2, item.Item1));
}
panel.EAdd(_checkbox);
var hPanel = new HLayoutPanel();
CreateDataRangePanel(hPanel);
queryPanel.ConditonPanel.EAdd(hPanel);
mQueryControls.Add("显示字段", _checkbox);
mQueryControls.EnableHoldLastControlNames.Add("显示字段");
}
void CreateDataRangePanel(HLayoutPanel hPanel)
{
hPanel.Add(new SimpleLabel(_mainInfo.Fields["Date"].Prompt));
hPanel.Add(QueryCreator.TimeRange(_mainInfo.Fields["Date"], mQueryContainer, "MinDate", "MaxDate"));
}
private ChoiceBox departmentSelect, custoemrSelect;
protected override void AddQueryControls(VLayoutPanel vPanel)
{
var layout = new LayoutManager("Main", _mainInfo);
layout.Add("ID", mQueryContainer.Add(new DFTextBox(_mainInfo.Fields["ID"]), "ID"));
layout.Add("Car_ID", mQueryContainer.AddLink(new ChoiceBoxMultiSelectLink(QueryCreator.DFChoiceBoxEnableMultiSelection(_mainInfo.Fields["Car_ID"], B3SaleDataSources.), s => long.Parse(s)), "Car_ID"));
layout.Add("Employee_ID", mQueryContainer.AddLink(new ChoiceBoxMultiSelectLink(QueryCreator.DFChoiceBoxEnableMultiSelection(_mainInfo.Fields["Employee_ID"], B3FrameworksConsts.DataSources.), s => long.Parse(s)), "Employee_ID"));
layout.Add("Deliveryman_ID", mQueryContainer.AddLink(new ChoiceBoxMultiSelectLink(QueryCreator.DFChoiceBoxEnableMultiSelection(_mainInfo.Fields["Deliveryman_ID"], B3FrameworksConsts.DataSources.), s => long.Parse(s)), "Deliveryman_ID"));
layout.Add("AccountingUnit_ID", mQueryContainer.AddLink(new ChoiceBoxMultiSelectLink(QueryCreator.DFChoiceBoxEnableMultiSelection(_mainInfo.Fields["AccountingUnit_ID"], B3FrameworksConsts.DataSources.), s => long.Parse(s)), "AccountingUnit_ID"));
layout.Add("Customer_ID", new SimpleLabel("购货客户"), custoemrSelect = new ChoiceBox() { DataKind = B3SaleDataSources., Width = Unit.Empty, EnableTopItem = true, EnableMultiSelection = false, EnableMultiSelectionViewer = false, EnableInputArgument = true });
layout.Add("Department_ID", new SimpleLabel("销售部门"), departmentSelect = new ChoiceBox() { DataKind = B3FrameworksConsts.DataSources., Width = Unit.Empty, EnableTopItem = true, EnableMultiSelection = true, EnableMultiSelectionViewer = true, EnableInputArgument = true });
var state = mQueryContainer.Add(CustomInputCreator_WQ.(_mainInfo.Fields["BillState"], true, false, true, true), "BillState");
((ChoiceBox)state).Value = ..Value.ToString() + "|";
state.DisplayValue = "已审核;";
state.EnableInputArgument = true;
layout.Add("BillState", state);
layout.Add("Remark", mQueryContainer.Add(new DFTextBox(_mainInfo.Fields["Remark"]), "Remark"));
var config = layout.CreateDefaultConfig(4);
config.Expand = false;
var section = mPageLayoutManager.AddSection("查询条件", "查询条件");
section.ApplyLayout(layout, config, mPageLayoutManager, _mainInfo);
section.SetDisplayName("ID", "单号");
section.SetDisplayName("Car_ID", "运输车辆");
section.SetDisplayName("Employee_ID", "经办人");
section.SetDisplayName("Deliveryman_ID", "送货人员");
section.SetDisplayName("AccountingUnit_ID", "会计单位");
section.SetDisplayName("Department_ID", "部门");
section.SetDisplayName("Customer_ID", "客户");
section.SetDisplayName("BillState", "单据状态");
section.SetDisplayName("Remark", "摘要");
vPanel.Add(layout.CreateLayout(), new VLayoutOption(HorizontalAlign.Left));
}
protected override DQueryDom GetQueryDom()
{
var dom = base.GetQueryDom();
var alias = dom.From.RootSource.Alias;
var department = new JoinAlias(typeof(Department));
dom.From.AddJoin(JoinType.Left, new DQDmoSource(department), DQCondition.EQ(alias, "Department_ID", department, "ID"));
foreach (ListItem field in _checkbox.Items)
{
if (field.Selected)
{
switch (field.Value)
{
case "ExtendField3":
case "ExtendField2":
case "ExtendField1":
dom.Columns.Add(DQSelectColumn.Field(field.Value, alias, field.Text));
dom.GroupBy.Expressions.Add(DQExpression.Field(field.Value));
break;
case "总数量":
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(JoinDetail(dom, alias), "Number")), field.Value));
break;
case "金额":
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(JoinDetail(dom, alias), "Money")), field.Value));
break;
case "BillTypeID":
dom.Columns.Add(DQSelectColumn.Create(DQExpression.LogicCase(DQCondition.EQ(JoinDetail(dom, alias), "BillTypeID", 777), DQExpression.Value("销售出库"), DQExpression.Value("调拨出库")), field.Text));
dom.GroupBy.Expressions.Add(DQExpression.Field(JoinDetail(dom, alias), "BillTypeID"));
break;
default:
dom.Columns.Add(DQSelectColumn.Field(field.Value, alias));
dom.GroupBy.Expressions.Add(DQExpression.Field(alias, field.Value));
break;
}
}
}
var _sd2 = mQueryContainer.GetControl<DFDateTimeInput>("MinDate");
if (_sd2.Value.HasValue)
{
dom.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("Date", _sd2.Value.Value));
}
var _ed2 = mQueryContainer.GetControl<DFDateTimeInput>("MaxDate");
if (_ed2.Value.HasValue)
{
dom.Where.Conditions.Add(DQCondition.LessThanOrEqual("Date", _ed2.Value.Value));
}
if (!custoemrSelect.IsEmpty)
{
dom.Where.Conditions.Add(DQCondition.Like("ExtendField2", custoemrSelect.DisplayValue));
}
if (!departmentSelect.IsEmpty)
{
var strs = B3SaleWebUtil.GetDeepByTreeName(departmentSelect.DisplayValue);
var conditions = new List<IDQExpression>();
var values = departmentSelect.GetValues();
for (int index = 0; index < values.Length; index++)
{
var value = values[index];
conditions.Add(DQCondition.EQ(department, "TreeDeep" + strs[index] + "ID", value));
}
dom.Where.Conditions.Add(DQCondition.Or(conditions));
}
dom.Where.Conditions.Add(DQCondition.EQ("Domain_ID", DomainContext.Current.ID));
OrganizationUtil.AddOrganizationLimit(dom, typeof(AcceptDiff));
return dom;
}
JoinAlias _detailAlias;
JoinAlias JoinDetail(DQueryDom query, JoinAlias alias)
{
if (_detailAlias != null)
return _detailAlias;
_detailAlias = new JoinAlias(typeof(DetailTmp));
query.RegisterQueryTable(typeof(DetailTmp), new[] { "CarLoading_ID", "BillTypeID", "Number", "Money" }, GetDetailDom());
query.From.AddJoin(JoinType.Left, new DQDmoSource(_detailAlias), DQCondition.EQ(alias, "ID", _detailAlias, "CarLoading_ID"));
return _detailAlias;
}
private DQueryDom GetDetailDom()
{
var detail = new JoinAlias(typeof(CarLoading_BillDetail));
var outdetail = new JoinAlias(typeof(SaleOutStore_Detail));
var query = new DQueryDom(detail);
query.From.AddJoin(JoinType.Left, new DQDmoSource(outdetail), DQCondition.EQ(detail, "BillID", outdetail, "SaleOutStore_ID"));
query.Columns.Add(DQSelectColumn.Field("CarLoading_ID", detail));
query.Columns.Add(DQSelectColumn.Field("BillTypeID", detail));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(detail, "Number")), "Number"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(outdetail, "Money")), "Money"));
query.GroupBy.Expressions.Add(DQExpression.Field(detail, "CarLoading_ID"));
query.GroupBy.Expressions.Add(DQExpression.Field(detail, "BillTypeID"));
return query;
}
class DetailTmp
{
public long CarLoading_ID { get; set; }
[LogicName("单据类型")]
public short BillTypeID { get; set; }
[LogicName("数量")]
public Money<decimal>? Number { get; set; }
[LogicName("金额")]
public Money<decimal>? Money { get; set; }
}
}
}

+ 56
- 0
B3_DongFangWanQi.Web/Overlays/CarLoadingAnalyse_/CarLoadingAnalyse.xml View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
</Columns>
<From>
<DmoClass class="BWP.B3Sale.BO.CarLoading, B3Sale" alias="main"/>
</From>
<Where>
<And>
<EQ>
<Field name="ID"/>
<QBE paramName="ID"/>
</EQ>
<QBEIn>
<Field name="AccountingUnit_ID"/>
<QBE paramName="AccountingUnit_ID"/>
</QBEIn>
<QBEIn>
<Field name="Car_ID"/>
<QBE paramName="Car_ID"/>
</QBEIn>
<QBEIn>
<Field name="Customer_ID"/>
<QBE paramName="Customer_ID"/>
</QBEIn>
<QBEIn>
<Field name="Department_ID"/>
<QBE paramName="Department_ID"/>
</QBEIn>
<QBEIn>
<Field name="Employee_ID"/>
<QBE paramName="Employee_ID"/>
</QBEIn>
<QBEIn>
<Field name="Deliveryman_ID"/>
<QBE paramName="Deliveryman_ID"/>
</QBEIn>
<QBEIn>
<Field name="BillState"/>
<QBE paramName ="BillState"/>
</QBEIn>
<Like>
<Field name="Remark"/>
<QBE paramName="Remark"/>
</Like>
<GreaterThanOrEqual>
<Field name="Date"/>
<QBE paramName="MinDate" />
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="Date"/>
<QBE paramName="MaxDate"/>
</LessThanOrEqual>
</And>
</Where>
</Select>

+ 3
- 1
B3_DongFangWanQi.Web/PluginClass.cs View File

@ -1,5 +1,6 @@
using BWP.B3Sale;
using BWP.Web.Overlays;
using BWP.Web.Overlays.CarLoadingAnalyse_;
using BWP.Web.Pages.B3CowButcherManage.Bills.ProductTask_;
using BWP.Web.Pages.B3Sale.Reports;
using TSingSoft.WebPluginFramework;
@ -17,11 +18,12 @@ namespace B3_DongFangWanQi.Web
GlobalFlags.On(B3SaleConsts.Flags.CarLoadingAnalyseMoney);
WpfPageFactory.RegisterPageOverlay(typeof(SaleOutStoreAnalyse).FullName, typeof(SaleOutStoreAnalyse_Ext).FullName);
WpfPageFactory.RegisterPageOverlay(typeof(ProductTaskEdit).FullName, typeof(B3CowProductTaskEdit).FullName);
WpfPageFactory.RegisterPageOverlay(typeof(BWP.Web.Pages.B3Sale.Reports.CarLoadingAnalyse_.CarLoadingAnalyse).FullName, typeof(CarLoadingAnalyse).FullName);
}
public void OnUnitInit()
{
}
#endregion


+ 123
- 0
B3_DongFangWanQi.Web/Utils/CustomInputCreator.cs View File

@ -0,0 +1,123 @@
using System;
using System.Web.UI;
using TSingSoft.WebControls2;
using System.Web.UI.WebControls;
using Forks.EnterpriseServices.DataForm;
using BWP.B3Frameworks.BO.NamedValueTemplate;
namespace BWP.Web.Utils
{
public class CustomInputCreator_WQ
{
private static Unit _width = 180;
private static readonly Unit HalfWidth;
static CustomInputCreator_WQ()
{
double num = (_width.Value / 2.0) - 7.0;
HalfWidth = Unit.Pixel(int.Parse(num.ToString()));
}
public static Control DFDateRange(DFContainer container, string minParam, string maxParam)
{
DFDateInput child = container.Add<DFDateInput>(new TSingSoft.WebControls2.DFDateInput(), minParam);
DFDateInput input2 = container.Add<DFDateInput>(new TSingSoft.WebControls2.DFDateInput(), maxParam);
child.Width = HalfWidth;
input2.Width = HalfWidth;
Panel panel = new Panel();
panel.Controls.Add(child);
panel.Controls.Add(new LiteralControl("→"));
panel.Controls.Add(input2);
return panel;
}
public static Control QueryDateTimeRange(IDFField fieldInfo, QueryContainer container, string minParam, string maxParam)
{
DateTime? beginDefault = null;
return QueryDateTimeRange(fieldInfo, container, minParam, maxParam, beginDefault, null);
}
public static Control TimeRange(IDFField fieldInfo, QueryContainer container, string minParam, string maxParam, DateTime? beginDefault, DateTime? endDefault)
{
DFDateTimeInput minInput = container.Add(new DFDateTimeInput(fieldInfo), minParam);
DFDateTimeInput maxInput = container.Add(new DFDateTimeInput(fieldInfo), maxParam);
maxInput.DefaultTime = DateInputDefaultTime.maxValue;
minInput.DefaultTime = DateInputDefaultTime.minValue;
minInput.Style.Add("width", "73px");
maxInput.Style.Add("width", "73px");
if (beginDefault.HasValue)
minInput.Date = beginDefault.Value;
if (endDefault.HasValue)
maxInput.Date = endDefault.Value;
Panel panel = new Panel();
panel.Controls.Add(minInput);
panel.Controls.Add(new LiteralControl("→"));
panel.Controls.Add(maxInput);
return panel;
}
public static Control QueryDateTimeRange(IDFField fieldInfo, QueryContainer container, string minParam, string maxParam, DateTime? beginDefault, DateTime? endDefault)
{
TSingSoft.WebControls2.DFDateTimeInput child = container.Add<TSingSoft.WebControls2.DFDateTimeInput>(new TSingSoft.WebControls2.DFDateTimeInput(fieldInfo), minParam);
TSingSoft.WebControls2.DFDateTimeInput input2 = container.Add<TSingSoft.WebControls2.DFDateTimeInput>(new TSingSoft.WebControls2.DFDateTimeInput(fieldInfo), maxParam);
input2.DefaultTime = DateInputDefaultTime.maxValue;
child.DefaultTime = DateInputDefaultTime.minValue;
child.Width = HalfWidth;
input2.Width = HalfWidth;
if (beginDefault.HasValue)
{
child.Date = beginDefault.Value;
}
if (endDefault.HasValue)
{
input2.Date = endDefault.Value;
}
Panel panel = new Panel();
panel.Controls.Add(child);
panel.Controls.Add(new LiteralControl("→"));
panel.Controls.Add(input2);
return panel;
}
public static Control QueryDateRange(IDFField fieldInfo, QueryContainer container, string minParam, string maxParam)
{
DateTime? beginDefault = null;
return QueryDateRange(fieldInfo, container, minParam, maxParam, beginDefault, null);
}
public static Control QueryDateRange(IDFField fieldInfo, QueryContainer container, string minParam, string maxParam, DateTime? beginDefault, DateTime? endDefault)
{
TSingSoft.WebControls2.DFDateInput child = container.Add<TSingSoft.WebControls2.DFDateInput>(new TSingSoft.WebControls2.DFDateInput(fieldInfo), minParam);
TSingSoft.WebControls2.DFDateInput input2 = container.Add<TSingSoft.WebControls2.DFDateInput>(new TSingSoft.WebControls2.DFDateInput(fieldInfo), maxParam);
input2.DefaultTime = DateInputDefaultTime.maxValue;
child.DefaultTime = DateInputDefaultTime.minValue;
child.Width = HalfWidth;
input2.Width = HalfWidth;
if (beginDefault.HasValue)
{
child.Date = beginDefault.Value;
}
if (endDefault.HasValue)
{
input2.Date = endDefault.Value;
}
Panel panel = new Panel();
panel.Controls.Add(child);
panel.Controls.Add(new LiteralControl("→"));
panel.Controls.Add(input2);
return panel;
}
public static DFNamedValueInput<> (IDFField fieldInfo, bool enableTopItem, bool defaultValue, bool enableMultiSelection, bool enableMultiSelectionViewer)
{
var choiceBox = new DFNamedValueInput<>(fieldInfo) { EnableTopItem = enableTopItem, EnableMultiSelection = enableMultiSelection, EnableMultiSelectionViewer = enableMultiSelectionViewer, InputArgument = "一般单据", Width = Unit.Empty };
if (defaultValue)
choiceBox.Value = .;
choiceBox.Width = 160;
return choiceBox;
}
}
}

Loading…
Cancel
Save