Browse Source

需求单No.136598

master
robin 8 years ago
parent
commit
7785d486e6
7 changed files with 914 additions and 48 deletions
  1. +23
    -23
      BWP.B3_YunKen.Web/BWP.B3_YunKen.Web.csproj
  2. +410
    -0
      BWP.B3_YunKen.Web/Pages/B3YunKen/SaleForecastUpdateList_/SaleForecastUpdateEdit.cs
  3. +82
    -0
      BWP.B3_YunKen.Web/Pages/B3YunKen/SaleForecastUpdateList_/SaleForecastUpdateEdit.xml
  4. +307
    -0
      BWP.B3_YunKen.Web/Pages/B3YunKen/SaleForecastUpdateList_/SaleForecastUpdateList.cs
  5. +82
    -0
      BWP.B3_YunKen.Web/Pages/B3YunKen/SaleForecastUpdateList_/SaleForecastUpdateList.xml
  6. +4
    -22
      BWP.B3_YunKen/BWP.B3_YunKen.csproj
  7. +6
    -3
      WebFolder/Config/Plugins/B3_YunKen.Plugin

+ 23
- 23
BWP.B3_YunKen.Web/BWP.B3_YunKen.Web.csproj View File

@ -8,29 +8,11 @@
<ProjectGuid>{E1923EA0-A58E-407B-B90C-837DAB197495}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BWP.Web.Pages</RootNamespace>
<RootNamespace>BWP.Web</RootNamespace>
<AssemblyName>B3_YunKen.Web</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<FileAlignment>512</FileAlignment>
<KeyContainerName>BwpApp</KeyContainerName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -40,7 +22,7 @@
<DefineConstants>TRACE;DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -52,10 +34,17 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="B3Frameworks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL" />
<Reference Include="B3Frameworks.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL" />
<Reference Include="B3Sale, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\B3Sale.dll</HintPath>
</Reference>
<Reference Include="B3Sale.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3a973053c7ebf11c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\B3Sale.Web.dll</HintPath>
</Reference>
<Reference Include="B3UnitedInfos, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL" />
<Reference Include="Forks.EnterpriseServices, Version=3.1.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL" />
<Reference Include="Forks.Utils, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6911f69af04f1ecb, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@ -83,6 +72,12 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Pages\B3YunKen\SaleForecastUpdateList_\SaleForecastUpdateEdit.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3YunKen\SaleForecastUpdateList_\SaleForecastUpdateList.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PluginClass.cs" />
</ItemGroup>
@ -93,7 +88,6 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Pages\YunKen\Reports\" />
<Folder Include="Tools\" />
</ItemGroup>
<ItemGroup>
@ -113,6 +107,12 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3YunKen\SaleForecastUpdateList_\SaleForecastUpdateList.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3YunKen\SaleForecastUpdateList_\SaleForecastUpdateEdit.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.


+ 410
- 0
BWP.B3_YunKen.Web/Pages/B3YunKen/SaleForecastUpdateList_/SaleForecastUpdateEdit.cs View File

@ -0,0 +1,410 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using BWP.B3Frameworks.BO.MoneyTemplate;
using BWP.B3Frameworks.BO.NamedValueTemplate;
using BWP.B3Frameworks.Utils;
using BWP.B3Sale.BL;
using BWP.B3Sale.BO;
using BWP.B3UnitedInfos.BO;
using BWP.Web.Utils;
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.SqlDoms;
using Forks.Utils;
using Forks.Utils.Collections;
using TSingSoft.WebControls2;
using TSingSoft.WebPluginFramework.Controls;
namespace BWP.Web.Pages.B3YunKen.SaleForecastUpdateList_ {
class SaleForecastUpdateEdit : AppBasePage {
long? SaleGoods_ID {
get {
if (string.IsNullOrEmpty(Request.QueryString["SaleGoods_ID"]))
return null;
return long.Parse(Request.QueryString["SaleGoods_ID"]);
}
}
string Goods_Name {
get {
return Request.QueryString["Goods_Name"];
}
}
long? Customer_ID {
get {
if (string.IsNullOrEmpty(Request.QueryString["Customer_ID"]))
return null;
return long.Parse(Request.QueryString["Customer_ID"]);
}
}
string AccountingUnit_Name {
get {
return Request.QueryString["AccountingUnit_Name"];
}
}
long? AccountingUnit_ID {
get {
if (string.IsNullOrEmpty(Request.QueryString["AccountingUnit_ID"]))
return null;
return long.Parse(Request.QueryString["AccountingUnit_ID"]);
}
}
long? SelectAccountingUnit_ID {
get {
if (string.IsNullOrEmpty(Request.QueryString["SelectAccountingUnit_ID"]))
return null;
return long.Parse(Request.QueryString["SelectAccountingUnit_ID"]);
}
}
long? SelectStore_ID {
get {
if (string.IsNullOrEmpty(Request.QueryString["SelectStore_ID"]))
return null;
return long.Parse(Request.QueryString["SelectStore_ID"]);
}
}
long? SelectCustomer_ID {
get {
if (string.IsNullOrEmpty(Request.QueryString["SelectCustomer_ID"]))
return null;
return long.Parse(Request.QueryString["SelectCustomer_ID"]);
}
}
string SelectGoodsProperty_Name {
get {
if (string.IsNullOrEmpty(Request.QueryString["SelectGoodsProperty_Name"]))
return null;
return Request.QueryString["SelectGoodsProperty_Name"];
}
}
long? SelectGoodsProperty_ID {
get {
if (string.IsNullOrEmpty(Request.QueryString["SelectGoodsProperty_ID"]))
return null;
return long.Parse(Request.QueryString["SelectGoodsProperty_ID"]);
}
}
string SelectGoodsPropertyCatalog_Name {
get {
if (string.IsNullOrEmpty(Request.QueryString["SelectGoodsPropertyCatalog_Name"]))
return null;
return Request.QueryString["SelectGoodsPropertyCatalog_Name"];
}
}
long? SelectGoodsPropertyCatalog_ID {
get {
if (string.IsNullOrEmpty(Request.QueryString["SelectGoodsPropertyCatalog_ID"]))
return null;
return long.Parse(Request.QueryString["SelectGoodsPropertyCatalog_ID"]);
}
}
SaleForecastUpdateList.EnumGroupKey GroupKey {
get {
if (ViewState["GroupKey"] == null) {
if (!string.IsNullOrEmpty(Request.QueryString["GroupKey"])) {
SaleForecastUpdateList.EnumGroupKey e;
if (Enum.TryParse(Request.QueryString["GroupKey"], out e))
ViewState["GroupKey"] = e;
} else {
ViewState["GroupKey"] = SaleForecastUpdateList.EnumGroupKey.;
}
}
return (SaleForecastUpdateList.EnumGroupKey)ViewState["GroupKey"];
}
set { ViewState["GroupKey"] = value; }
}
public List<SaleForecast_Detail> Details {
get {
if (ViewState["Details"] == null)
ViewState["Details"] = new List<SaleForecast_Detail>();
return (List<SaleForecast_Detail>)ViewState["Details"];
}
set { ViewState["Details"] = value; }
}
DateTime? MinTime {
get {
var str = Request.QueryString["MinDate"];
if (string.IsNullOrEmpty(str))
return null;
return DateTime.Parse(str);
}
}
DateTime? MaxTime {
get {
var str = Request.QueryString["MaxDate"];
if (string.IsNullOrEmpty(str))
return null;
return DateTime.Parse(str);
}
}
private DFEditGrid _goodsGrid;
private QueryContainer _queryContainer;
readonly static DFInfo DFInfo = DFInfo.Get(typeof(SaleForecast));
private Label _l1, _l2;
private DFContainer _dfContainer;
protected override void InitForm(HtmlForm form) {
_queryContainer = QueryContainer.FromResource(typeof(SaleForecastUpdateList).FullName + ".xml", GetType().Assembly);
QueryCreator.TimeRange(DFInfo.Fields["Date"], _queryContainer, "MinDate", "MaxDate", MinTime, MaxTime);
form.Controls.Add(new PageTitle("预报调整"));
var vPanel = new VLayoutPanel();
form.Controls.Add(vPanel);
_dfContainer = new DFContainer();
_dfContainer.ID = "DFContainer";
form.Controls.Add(_dfContainer);
var hpanel = new HLayoutPanel();
hpanel.Add(new LiteralControl(string.Format("<h2>产品:{0}</h2>", Goods_Name)));
vPanel.Add(hpanel);
var panel = new HLayoutPanel();
panel.Add(new SimpleLabel("合计报价数量"));
_l1 = new Label();
_l1.ID = "l1";
_l1.Font.Size = 14;
_l1.Width = 120;
_l1.Font.Bold = true;
panel.Add(_l1);
panel.Add(new SimpleLabel("合计金额"));
_l2 = new Label();
_l2.ID = "l2";
_l2.Font.Size = 14;
_l2.Font.Bold = true;
_l2.Width = 120;
panel.Add(_l2);
vPanel.Add(panel);
_dfContainer.AddNonDFControl(_l1, "$l1");
_dfContainer.AddNonDFControl(_l2, "$l2");
CreateGrid(vPanel);
}
private void CreateGrid(VLayoutPanel vPanel) {
var editor = new DFCollectionEditor<SaleForecast_Detail>(() => Details);
editor.CanDeleteFunc = detail => true;
editor.IsEditableFunc = (field, detail) => {
if (field.Name == "SecondNumber") {
var hasSecondUnit = !string.IsNullOrEmpty(detail.Goods_SecondUnit);
return hasSecondUnit;
}
return true;
};
_goodsGrid = new DFEditGrid(editor);
_goodsGrid.DFGridSetEnabled = false;
_goodsGrid.Width = Unit.Percentage(100);
if (GroupKey == SaleForecastUpdateList.EnumGroupKey.) {
_goodsGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("Customer_Name"));
}
_goodsGrid.ShowLineNo = true;
_goodsGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("Goods_Code"));
_goodsGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("Goods_Name"));
_goodsGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("Goods_Spec"));
_goodsGrid.Columns.EAdd(new DFEditGridColumn<DFTextBox>("UnitNum")).SumMode = SumMode.Sum;
_goodsGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("Unit"));
_goodsGrid.Columns.EAdd(new DFEditGridColumn<DFTextBox>("SecondNumber")).SumMode = SumMode.Sum;
_goodsGrid.Columns.EAdd(new DFEditGridColumn<DFValueLabel>("Goods_SecondUnit"));
_goodsGrid.Columns.EAdd(new DFEditGridColumn<DFValueLabel>("Money")).SumMode = SumMode.Sum;
_goodsGrid.Columns.EAdd(new DFEditGridColumn<DFValueLabel>("PolicyPrice"));
_goodsGrid.ValueColumns.Add("SaleGoods_ID");
_goodsGrid.ValueColumns.Add("Goods_UnitConvertDirection");
_goodsGrid.ValueColumns.Add("Goods_MainUnitRatio");
_goodsGrid.ValueColumns.Add("Goods_SecondUnitRatio");
_goodsGrid.ValueColumns.Add("LeftRatio");
_goodsGrid.ValueColumns.Add("RightRatio");
vPanel.Add(_goodsGrid);
new MainToSecondConvertRowManger(_goodsGrid);
_dfContainer.AddNonDFControl(_goodsGrid, "$Grid");
var saveBt = vPanel.Add(new TSButton("保存"), new VLayoutOption(HorizontalAlign.Center));
saveBt.Width = Unit.Pixel(80);
saveBt.Click += SaveBtClick;
}
void SaveBtClick(object sender, EventArgs e) {
_goodsGrid.GetFromUI();
var groupByOrderID = Details.GroupBy(x => x.SaleForecast_ID);
var bl = BIFactory.Create<ISaleForecastBL>();
var cannotUpdateID = new List<long>();
var updateIDs = new List<long>();
foreach (var orderDetails in groupByOrderID) {
var order = bl.Load(orderDetails.Key);
if (order == null)
continue;
var changed = false;
foreach (var cDetail in orderDetails) {
var detail = order.Details.FirstOrDefault(x => x.ID == cDetail.ID);
if (detail == null)
continue;
if (detail.UnitNum != cDetail.UnitNum) {
detail.UnitNum = cDetail.UnitNum;
changed = true;
}
if (detail.SecondNumber != cDetail.SecondNumber) {
detail.SecondNumber = cDetail.SecondNumber;
changed = true;
}
if (detail.Price != cDetail.Price) {
detail.Price = cDetail.Price;
changed = true;
}
}
if (changed) {
if (order.BillState != .) {
cannotUpdateID.Add(order.ID);
continue;
}
bl.Update(order);
updateIDs.Add(order.ID);
}
}
string msg;
if (updateIDs.Count > 0)
msg = string.Format("保存成功\n已更新销售预报No.{0}\n", string.Join(",", updateIDs));
else {
msg = "没有需要更新的产品!\n";
}
if (cannotUpdateID.Count > 0)
msg = string.Format("销售预报No.{0} 不是未审核状态,不能更新!", string.Join(",", cannotUpdateID));
AspUtil.Alert(this, msg);
BindGrid();
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
if (!IsPostBack) {
BindGrid();
}
}
private void BindGrid() {
var dom = _queryContainer.Build();
var order = dom.From.RootSource.Alias;
var detailAlias = new JoinAlias("detail", typeof(SaleForecast_Detail));
var goodsPropertyCatalog = new JoinAlias(typeof(GoodsPropertyCatalog));
var goodsProperty = new JoinAlias(typeof(GoodsProperty));
var goods = new JoinAlias(typeof(SaleGoods));
dom.From.AddJoin(JoinType.Inner, new DQDmoSource(detailAlias),
DQCondition.EQ(order, "ID", detailAlias, "SaleForecast_ID"));
dom.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(detailAlias, "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.Columns.Add(DQSelectColumn.Field("ID", detailAlias));
dom.Columns.Add(DQSelectColumn.Field("UnitNum", detailAlias));
dom.Columns.Add(DQSelectColumn.Field("SecondNumber", detailAlias));
dom.Columns.Add(DQSelectColumn.Field("Number", detailAlias));
dom.Columns.Add(DQSelectColumn.Field("Price", detailAlias));
dom.Columns.Add(DQSelectColumn.Field("PolicyPrice", detailAlias));
dom.Columns.Add(DQSelectColumn.Field("Unit", detailAlias));
dom.Columns.Add(DQSelectColumn.Field("SaleGoods_ID", detailAlias));
dom.Columns.Add(DQSelectColumn.Field("Money", detailAlias));
dom.Columns.Add(DQSelectColumn.Field("Customer_Name", order));
dom.Columns.Add(DQSelectColumn.Field("SaleForecast_ID", detailAlias));
if (SaleGoods_ID != null) {
dom.Where.Conditions.Add(DQCondition.EQ(detailAlias, "SaleGoods_ID", SaleGoods_ID));
}
if (AccountingUnit_ID != null) {
dom.Where.Conditions.Add(DQCondition.EQ(order, "AccountingUnit_ID", AccountingUnit_ID));
}
if ( SelectAccountingUnit_ID != null) {
dom.Where.Conditions.Add(DQCondition.EQ(order, "AccountingUnit_ID", SelectAccountingUnit_ID));
}
if (Customer_ID != null) {
dom.Where.Conditions.Add(DQCondition.EQ(order, "Customer_ID", Customer_ID));
}
if (SelectCustomer_ID != null) {
dom.Where.Conditions.Add(DQCondition.EQ(order, "Customer_ID", SelectCustomer_ID));
}
if (SelectStore_ID != null) {
dom.Where.Conditions.Add(DQCondition.EQ(order, "Store_ID", SelectStore_ID));
}
if (!string.IsNullOrEmpty(SelectGoodsPropertyCatalog_Name)) {
var strs = B3SaleWebUtil.GetDeepByTreeName(SelectGoodsPropertyCatalog_Name);
dom.Where.Conditions.Add(DQCondition.EQ(goodsPropertyCatalog, "TreeDeep" + strs[0] + "ID", SelectGoodsPropertyCatalog_ID));
}
if (SelectGoodsProperty_ID!=null) {
dom.Where.Conditions.Add(DQCondition.EQ(goodsProperty, "ID", SelectGoodsProperty_ID));
}
dom.Where.Conditions.Add(DQCondition.EQ("BillState", .));
OrganizationUtil.AddOrganizationLimit(dom, typeof(SaleForecast));
Details.Clear();
using (var context = new TransactionContext()) {
using (var reader = context.Session.ExecuteReader(dom)) {
while (reader.Read()) {
var detail = new SaleForecast_Detail {
ID = (long)reader[0],
UnitNum = (Money<decimal>?)reader[1],
SecondNumber = (Money<decimal>?)reader[2],
Number = (Money<decimal>?)reader[3],
Price = (Money<decimal>?)reader[4],
PolicyPrice = (Money<decimal>?)reader[5],
Unit = (string)reader[6],
SaleGoods_ID = (long)reader[7],
Money = (Money<>?)reader[8],
Customer_Name = (string)reader[9],
SaleForecast_ID = (long)reader[10],
};
Details.Add(detail);
}
}
}
foreach (var detail in Details) {
Dmo.RefreshDependency(detail, "SaleGoods_ID");
}
_goodsGrid.DataBind();
_l1.Text = Math.Round(Details.Sum(x => (decimal?)(x.UnitNum) ?? 0), 2).ToString();
_l2.Text = Math.Round(Details.Sum(x => (decimal?)(x.Money) ?? 0), 2).ToString();
}
}
}

+ 82
- 0
BWP.B3_YunKen.Web/Pages/B3YunKen/SaleForecastUpdateList_/SaleForecastUpdateEdit.xml View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
</Columns>
<From>
<DmoClass class="BWP.B3Sale.BO.SaleForecast, B3Sale"/>
</From>
<Where>
<And>
<EQ>
<Field name="ID"/>
<QBE paramName="ID"/>
</EQ>
<EQ>
<Field name="Customer_ID"/>
<QBE paramName="Customer_ID"/>
</EQ>
<Contains>
<Field name="CreateUser_Name"/>
<QBE paramName="CreateUser_Name"/>
</Contains>
<Contains>
<Field name="CheckUser_Name"/>
<QBE paramName="CheckUser_Name"/>
</Contains>
<Contains>
<Field name="DeliverAddress"/>
<QBE paramName="DeliverAddress"/>
</Contains>
<GreaterThanOrEqual>
<Field name="Date"/>
<QBE paramName="MinDate"/>
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="Date"/>
<QBE paramName="MaxDate"/>
</LessThanOrEqual>
<GreaterThanOrEqual>
<Field name="DeliveryTime"/>
<QBE paramName="MinDeliveryTime"/>
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="DeliveryTime"/>
<QBE paramName="MaxDeliveryTime"/>
</LessThanOrEqual>
<EQ>
<Field name="AccountingUnit_ID"/>
<QBE paramName="AccountingUnit_ID"/>
</EQ>
<EQ>
<Field name="Employee_ID"/>
<QBE paramName="Employee_ID"/>
</EQ>
<EQ>
<Field name="BillState"/>
<QBE paramName="BillState"/>
</EQ>
<EQ>
<Field name="IsLocked"/>
<QBE paramName="IsLocked"/>
</EQ>
<Contains>
<Field name="DepartmentWorkFlow_Detail_Name"/>
<QBE paramName="DepartmentWorkFlow_Detail_Name"/>
</Contains>
<EQ>
<Field name="DepartmentWorkFlowStateCategory_ID"/>
<QBE paramName="DepartmentWorkFlowStateCategory_ID"/>
</EQ>
<EQ>
<Field name="SaleKind_ID"/>
<QBE paramName="SaleKind_ID"/>
</EQ>
<EQ>
<Field name="Store_ID"/>
<QBE paramName="Store_ID"/>
</EQ>
</And>
</Where>
</Select>

+ 307
- 0
BWP.B3_YunKen.Web/Pages/B3YunKen/SaleForecastUpdateList_/SaleForecastUpdateList.cs View File

@ -0,0 +1,307 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using BWP.B3Frameworks;
using BWP.B3Frameworks.BO.NamedValueTemplate;
using BWP.B3Frameworks.Utils;
using BWP.B3Sale.BO;
using BWP.B3Sale.Utils;
using BWP.B3UnitedInfos;
using BWP.B3UnitedInfos.BO;
using BWP.Web.Layout;
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 TSingSoft.WebControls2;
using TSingSoft.WebPluginFramework.Controls;
namespace BWP.Web.Pages.B3YunKen.SaleForecastUpdateList_ {
class SaleForecastUpdateList : AppBasePage {
QueryContainer _queryContainer;
readonly DFInfo _dFInfo = DFInfo.Get(typeof(SaleForecast));
private DFChoiceBox _goodsPropertyCatalog;
private ChoiceBox _goodsProperty;
public enum EnumGroupKey {
= 0,
= 1,
= 2
}
EnumGroupKey GroupKey {
get {
if (ViewState["GroupKey"] == null) {
if (!string.IsNullOrEmpty(Request.QueryString["GroupKey"])) {
EnumGroupKey e;
if (Enum.TryParse(Request.QueryString["GroupKey"], out e))
ViewState["GroupKey"] = e;
} else {
ViewState["GroupKey"] = EnumGroupKey.;
}
}
return (EnumGroupKey)ViewState["GroupKey"];
}
set { ViewState["GroupKey"] = value; }
}
private DFChoiceBox _storeInput, _accInput, _customerInput;
protected override void InitForm(HtmlForm form) {
_queryContainer = QueryContainer.FromResource(GetType().FullName + ".xml", GetType().Assembly);
form.Controls.Add(new PageTitle("销售预报调整"));
var titlePanel = form.EAdd(new TitlePanel("BaseProperties", "查询条件"));
titlePanel.SetPageLayoutSetting(mPageLayoutManager, titlePanel.Name);
var layoutManager = new LayoutManager("main", _dFInfo, _queryContainer);
_goodsProperty = QueryCreator.DFChoiceBox(_dFInfo.Fields["ID"], B3UnitedInfosConsts.DataSources.);
layoutManager.Add("GoodsProperty_ID", new SimpleLabel("存货属性"), _goodsProperty);
layoutManager["GoodsProperty_ID"].NotAutoAddToContainer = true;
_goodsPropertyCatalog = QueryCreator.DFChoiceBox(_dFInfo.Fields["ID"], B3UnitedInfosConsts.DataSources.);
layoutManager.Add("GoodsPropertyCatalog_ID", new SimpleLabel("存货属性分类"), _goodsPropertyCatalog);
layoutManager["GoodsPropertyCatalog_ID"].NotAutoAddToContainer = true;
layoutManager.Add("AccountingUnit_ID", new SimpleLabel("会计单位"), _accInput = QueryCreator.DFChoiceBox(_dFInfo.Fields["AccountingUnit_ID"], B3FrameworksConsts.DataSources.), false);
layoutManager.Add("Store_ID", new SimpleLabel("仓库"), _storeInput = QueryCreator.DFChoiceBox(_dFInfo.Fields["Store_ID"], B3FrameworksConsts.DataSources.), false);
layoutManager.Add("Customer_ID", _customerInput = QueryCreator.DFChoiceBox(_dFInfo.Fields["Customer_ID"], B3SaleDataSources.));
var config = new AutoLayoutConfig();
config.Add("Date");
config.Add("AccountingUnit_ID");
config.Add("Employee_ID");
config.Add("Customer_ID");
config.Add("Store_ID");
config.Add("GoodsProperty_ID");
config.Add("GoodsPropertyCatalog_ID");
layoutManager.Config = config;
var section = mPageLayoutManager.AddSection("BaseProperties", "查询条件");
section.ApplyLayout(layoutManager, config, mPageLayoutManager, _dFInfo);
section.SetDisplayName("GoodsProperty_ID", "存货属性");
section.SetDisplayName("GoodsPropertyCatalog_ID", "存货属性分类");
titlePanel.Controls.Add(layoutManager.CreateLayout());
var tsbtn = new TSButton("开始查询");
tsbtn.Click += delegate {
DataBindGrid(GroupKey);
};
titlePanel.Controls.Add(tsbtn);
AddDetails(form.EAdd(new TitlePanel("预报明细", "预报明细")));
var vPanel = new VLayoutPanel();
form.Controls.Add(vPanel);
// addOperations(vPanel);
}
DFBrowseGrid _grid;
void AddDetails(TitlePanel tPanel) {
HLayoutPanel hPanel;
tPanel.Controls.Add(new LiteralControl("<br />"));
tPanel.Controls.Add(hPanel = new HLayoutPanel());
var groupByGoods = hPanel.Add(new LinkButton());
groupByGoods.Text = "按产品汇总";
groupByGoods.Attributes["style"] = "font-size:20px";
groupByGoods.Click += (sender, e) => DataBindGrid(EnumGroupKey.);
hPanel.Add(new LiteralControl("&nbsp;"));
hPanel.Add(new LiteralControl("&nbsp;"));
var groupByBuyer = hPanel.Add(new LinkButton());
hPanel.Add(new LiteralControl("&nbsp;"));
hPanel.Add(new LiteralControl("&nbsp;"));
groupByBuyer.Text = "按客户汇总";
groupByBuyer.Attributes["style"] = "font-size:20px";
groupByBuyer.Click += (sender, e) => DataBindGrid(EnumGroupKey.);
var groupByAccountingUnit = hPanel.Add(new LinkButton());
hPanel.Add(new LiteralControl("&nbsp;"));
hPanel.Add(new LiteralControl("&nbsp;"));
groupByAccountingUnit.Text = "按会计单位汇总";
groupByAccountingUnit.Attributes["style"] = "font-size:20px";
groupByAccountingUnit.Click += (sender, e) => DataBindGrid(EnumGroupKey.);
var editor = new DFDataTableEditor();
_grid = new DFBrowseGrid(editor) {
Width = Unit.Percentage(100),
IgnoreItemsCount = true,
DFGridSetEnabled = false,
};
_grid.Columns.Add(new DFBrowseGridAutoColumn("SaleGoods_ID", "AccountingUnit_ID", "Customer_ID"));
_grid.OnDetailDataBound = (row, obj, index) => {
var dataRow = obj as DFDataRow;
if (dataRow == null) {
return;
}
var min = (DateTime?)_queryContainer.GetInput("MinDate");
var max = (DateTime?)_queryContainer.GetInput("MaxDate");
var staticParameter = new List<Tuple<string, string>>();
if (min != null) {
staticParameter.Add(new Tuple<string, string>("MinDate", min.Value.ToString("yyyy-MM-dd HH:mm")));
}
if (max != null) {
staticParameter.Add(new Tuple<string, string>("MaxDate", max.Value.ToString("yyyy-MM-dd HH:mm")));
}
if (!_accInput.IsEmpty) {
staticParameter.Add(new Tuple<string, string>("SelectAccountingUnit_ID", _accInput.Value));
}
if (!_storeInput.IsEmpty) {
staticParameter.Add(new Tuple<string, string>("SelectStore_ID", _storeInput.Value));
}
if (!_customerInput.IsEmpty) {
staticParameter.Add(new Tuple<string, string>("SelectCustomer_ID", _customerInput.Value));
}
if (!_goodsProperty.IsEmpty) {
staticParameter.Add(new Tuple<string, string>("SelectGoodsProperty_ID", _goodsProperty.Value));
staticParameter.Add(new Tuple<string, string>("SelectGoodsProperty_Name", _goodsProperty.DisplayValue));
}
if (!_goodsPropertyCatalog.IsEmpty) {
staticParameter.Add(new Tuple<string, string>("SelectGoodsPropertyCatalog_ID", _goodsPropertyCatalog.Value));
staticParameter.Add(new Tuple<string, string>("SelectGoodsPropertyCatalog_Name", _goodsPropertyCatalog.DisplayValue));
}
var html = "OpenUrlInTopTab('{0}','调整预报');";
var bt = new LinkButton();
bt.Text = row.Cells[0].InnerText;
row.Cells[0].InnerHtml = "";
row.Cells[0].Controls.Add(bt);
if (GroupKey == EnumGroupKey.) {
var field = "Goods";
var idField = dataRow["SaleGoods_ID"];
var nameField = dataRow[field + "_Name"];
staticParameter.Add(new Tuple<string, string>("SaleGoods_ID", idField.ToString()));
staticParameter.Add(new Tuple<string, string>(field + "_Name", nameField.ToString()));
var url = AspUtil.UpdateUrlParam("SaleForecastUpdateEdit.aspx", "GroupKey", HttpUtility.UrlEncode(EnumGroupKey..ToString()));
foreach (var tuple in staticParameter) {
url = AspUtil.UpdateUrlParam(url, tuple.Item1, HttpUtility.UrlEncode(tuple.Item2));
}
bt.OnClientClick = string.Format(html, url);
} else if (GroupKey == EnumGroupKey.) {
var field = "AccountingUnit";
var idField = dataRow[field + "_ID"];
var nameField = dataRow[field + "_Name"];
if (idField == null) {
AspUtil.Alert(this, "存在会计单位为空的预报!");
return;
}
staticParameter.Add(new Tuple<string, string>(field + "_ID", idField.ToString()));
staticParameter.Add(new Tuple<string, string>(field + "_Name", nameField.ToString()));
var url = AspUtil.UpdateUrlParam("SaleForecastUpdateEdit.aspx", "GroupKey", HttpUtility.UrlEncode(EnumGroupKey..ToString()));
foreach (var tuple in staticParameter) {
url = AspUtil.UpdateUrlParam(url, tuple.Item1, HttpUtility.UrlEncode(tuple.Item2));
}
bt.OnClientClick = string.Format(html, url);
} else if (GroupKey == EnumGroupKey.) {
var field = "Customer";
var idField = dataRow[field + "_ID"];
var nameField = dataRow[field + "_Name"];
staticParameter.Add(new Tuple<string, string>(field + "_ID", idField.ToString()));
staticParameter.Add(new Tuple<string, string>(field + "_Name", nameField.ToString()));
var url = AspUtil.UpdateUrlParam("SaleForecastUpdateEdit.aspx", "GroupKey", HttpUtility.UrlEncode(EnumGroupKey..ToString()));
foreach (var tuple in staticParameter) {
url = AspUtil.UpdateUrlParam(url, tuple.Item1, HttpUtility.UrlEncode(tuple.Item2));
}
bt.OnClientClick = string.Format(html, url);
}
};
tPanel.Controls.Add(_grid);
var section = mPageLayoutManager.AddSection("Columns", "预报明细");
section.ApplyLayout(_grid, mPageLayoutManager, _dFInfo);
}
private readonly List<int> _sumColumnsIndex = new List<int>();
private void DataBindGrid(EnumGroupKey groupKey) {
GroupKey = groupKey;
var args = new LoadArguments(GetQueryDom(groupKey));
foreach (var index in _sumColumnsIndex)
args.SumColumns.Add(index);
_grid.LoadArguments = args;
_grid.Reset();
_grid.CurrentPageIndex = 0;
_grid.DataBind();
}
private DQueryDom GetQueryDom(EnumGroupKey groupKey) {
var dom = _queryContainer.Build();
var bill = dom.From.RootSource.Alias;
var detail = new JoinAlias("detail", typeof(SaleForecast_Detail));
var goodsPropertyCatalog = new JoinAlias(typeof(GoodsPropertyCatalog));
var goodsProperty = new JoinAlias(typeof(GoodsProperty));
var goods = new JoinAlias(typeof(SaleGoods));
dom.From.AddJoin(JoinType.Inner, new DQDmoSource(detail),
DQCondition.EQ(bill, "ID", detail, "SaleForecast_ID"));
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"));
if (groupKey == EnumGroupKey.) {
dom.Columns.Add(DQSelectColumn.Field("SaleGoods_ID", detail));
dom.Columns.Add(DQSelectColumn.Field("Goods_Name", detail));
dom.Columns.Add(DQSelectColumn.Field("Goods_Code", detail));
dom.Columns.Add(DQSelectColumn.Sum(detail, "UnitNum", "总报价数量"));
dom.Columns.Add(DQSelectColumn.Sum(detail, "Money", "总金额"));
_sumColumnsIndex.Add(3);
_sumColumnsIndex.Add(4);
dom.GroupBy.Expressions.Add(DQExpression.Field(detail, "Goods_Code"));
dom.GroupBy.Expressions.Add(DQExpression.Field(detail, "Goods_Name"));
dom.GroupBy.Expressions.Add(DQExpression.Field(detail, "SaleGoods_ID"));
} else if (groupKey == EnumGroupKey.) {
dom.Columns.Add(DQSelectColumn.Field("AccountingUnit_ID", bill));
dom.Columns.Add(DQSelectColumn.Field("AccountingUnit_Name", bill));
dom.Columns.Add(DQSelectColumn.Sum(detail, "UnitNum", "总报价数量"));
dom.Columns.Add(DQSelectColumn.Sum(detail, "Money", "总金额"));
_sumColumnsIndex.Add(2);
_sumColumnsIndex.Add(3);
dom.GroupBy.Expressions.Add(DQExpression.Field(bill, "AccountingUnit_ID"));
dom.GroupBy.Expressions.Add(DQExpression.Field(bill, "AccountingUnit_Name"));
} else if (groupKey == EnumGroupKey.) {
dom.Columns.Add(DQSelectColumn.Field("Customer_ID", bill));
dom.Columns.Add(DQSelectColumn.Field("Customer_Name", bill));
dom.Columns.Add(DQSelectColumn.Sum(detail, "UnitNum", "总报价数量"));
dom.Columns.Add(DQSelectColumn.Sum(detail, "Money", "总金额"));
_sumColumnsIndex.Add(2);
_sumColumnsIndex.Add(3);
dom.GroupBy.Expressions.Add(DQExpression.Field(bill, "Customer_ID"));
dom.GroupBy.Expressions.Add(DQExpression.Field(bill, "Customer_Name"));
}
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));
}
if (!_goodsProperty.IsEmpty) {
dom.Where.Conditions.Add(DQCondition.EQ(goodsProperty, "ID", long.Parse(_goodsProperty.Value)));
}
dom.Where.Conditions.Add(DQCondition.EQ("BillState", .));
OrganizationUtil.AddOrganizationLimit(dom, typeof(SaleForecast));
return dom;
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
if (!IsPostBack) {
DataBindGrid(GroupKey);
}
}
}
}

+ 82
- 0
BWP.B3_YunKen.Web/Pages/B3YunKen/SaleForecastUpdateList_/SaleForecastUpdateList.xml View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
</Columns>
<From>
<DmoClass class="BWP.B3Sale.BO.SaleForecast, B3Sale"/>
</From>
<Where>
<And>
<EQ>
<Field name="ID"/>
<QBE paramName="ID"/>
</EQ>
<EQ>
<Field name="Customer_ID"/>
<QBE paramName="Customer_ID"/>
</EQ>
<Contains>
<Field name="CreateUser_Name"/>
<QBE paramName="CreateUser_Name"/>
</Contains>
<Contains>
<Field name="CheckUser_Name"/>
<QBE paramName="CheckUser_Name"/>
</Contains>
<Contains>
<Field name="DeliverAddress"/>
<QBE paramName="DeliverAddress"/>
</Contains>
<GreaterThanOrEqual>
<Field name="Date"/>
<QBE paramName="MinDate"/>
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="Date"/>
<QBE paramName="MaxDate"/>
</LessThanOrEqual>
<GreaterThanOrEqual>
<Field name="DeliveryTime"/>
<QBE paramName="MinDeliveryTime"/>
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="DeliveryTime"/>
<QBE paramName="MaxDeliveryTime"/>
</LessThanOrEqual>
<EQ>
<Field name="AccountingUnit_ID"/>
<QBE paramName="AccountingUnit_ID"/>
</EQ>
<EQ>
<Field name="Employee_ID"/>
<QBE paramName="Employee_ID"/>
</EQ>
<EQ>
<Field name="BillState"/>
<QBE paramName="BillState"/>
</EQ>
<EQ>
<Field name="IsLocked"/>
<QBE paramName="IsLocked"/>
</EQ>
<Contains>
<Field name="DepartmentWorkFlow_Detail_Name"/>
<QBE paramName="DepartmentWorkFlow_Detail_Name"/>
</Contains>
<EQ>
<Field name="DepartmentWorkFlowStateCategory_ID"/>
<QBE paramName="DepartmentWorkFlowStateCategory_ID"/>
</EQ>
<EQ>
<Field name="SaleKind_ID"/>
<QBE paramName="SaleKind_ID"/>
</EQ>
<EQ>
<Field name="Store_ID"/>
<QBE paramName="Store_ID"/>
</EQ>
</And>
</Where>
</Select>

+ 4
- 22
BWP.B3_YunKen/BWP.B3_YunKen.csproj View File

@ -10,27 +10,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BWP.B3_YunKen</RootNamespace>
<AssemblyName>B3_YunKen</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<KeyContainerName>BwpApp</KeyContainerName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -40,7 +22,7 @@
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>


+ 6
- 3
WebFolder/Config/Plugins/B3_YunKen.Plugin View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<Plugin xmlns="http://www.TSingSoft.com/Schemas/WPF.xsd" name="B3_YunKen" displayName="B3_YunKen" version="1.0" appVersion="$appVersion" schemaVersion="1.0" pluginClass="BWP.B3_YunKen.Web.PluginClass, BWP.B3_YunKen.Web">
<Plugin xmlns="http://www.TSingSoft.com/Schemas/WPF.xsd" name="B3_YunKen" displayName="B3耘垦模块" version="1.0" appVersion="$appVersion" schemaVersion="1.0" pluginClass="BWP.B3_YunKen.Web.PluginClass, B3_YunKen.Web">
<Requires>
</Requires>
<Assemblies>
@ -14,10 +14,13 @@
<UserProfile type="BWP.B3_YunKen.BO.UserProfile,BWP.B3_YunKen"/>
</Profiles>
<Security>
<FunctionGroup name="销售预报调整" roleSchemas="employee">
<Function index="0" name="访问" />
</FunctionGroup>
</Security>
<Menus>
<Menu id="0001" name="/B3耘垦模块/销售预报调整" roles="B3_YunKen.销售预报调整.访问" url="B3YunKen/SaleForecastUpdateList_/SaleForecastUpdateList.aspx"/>
</Menus>
</Plugin>

Loading…
Cancel
Save