Browse Source

增加 价格调整

master
wushukun 8 years ago
parent
commit
b75113deff
5 changed files with 353 additions and 1 deletions
  1. +6
    -0
      BWP.B3_YunKen.Web/BWP.B3_YunKen.Web.csproj
  2. +281
    -0
      BWP.B3_YunKen.Web/Pages/B3YunKen/Bill/PriceBill_DetailAdjust.cs
  3. +49
    -0
      BWP.B3_YunKen.Web/Pages/B3YunKen/Bill/PriceBill_DetailAdjust.xml
  4. +13
    -0
      BWP.B3_YunKen/B3YunKenOnlineConfiguration.cs
  5. +4
    -1
      WebFolder/Config/Plugins/B3_YunKen.Plugin

+ 6
- 0
BWP.B3_YunKen.Web/BWP.B3_YunKen.Web.csproj View File

@ -94,6 +94,9 @@
<Compile Include="Pages\B3YunKen\Bill\GoodsPackageSet.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3YunKen\Bill\PriceBill_DetailAdjust.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3YunKen\Dialogs\ProductionCompletionDialog.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@ -211,6 +214,9 @@
<ItemGroup>
<EmbeddedResource Include="Pages\B3YunKen\Reports\ToFreightNetPriceReport.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3YunKen\Bill\PriceBill_DetailAdjust.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.


+ 281
- 0
BWP.B3_YunKen.Web/Pages/B3YunKen/Bill/PriceBill_DetailAdjust.cs View File

@ -0,0 +1,281 @@
using BWP.B3Sale.BO;
using Forks.EnterpriseServices.DataForm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebControls2;
using System.Web.UI.HtmlControls;
using TSingSoft.WebPluginFramework.Controls;
using BWP.Web.Utils;
using BWP.Web.Layout;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using BWP.B3Frameworks.BO.NamedValueTemplate;
using BWP.B3_YunKen;
using Forks.Utils;
using Forks.EnterpriseServices.BusinessInterfaces;
using System.Web.UI.WebControls;
using Forks.Utils.Collections;
using TSingSoft.WebPluginFramework.Pages;
using BWP.B3Frameworks.Utils;
using System.Globalization;
using BWP.B3Sale.BL;
using System.Web;
using TSingSoft.WebControls2.QBELinks;
using BWP.B3Sale.Utils;
using BWP.B3UnitedInfos;
using Forks.EnterpriseServices.DomainObjects2;
using TSingSoft.WebPluginFramework;
namespace BWP.Web.Pages.B3YunKen.Bill
{
//class PriceBill_DetailAdjust
//{
//}
class PriceBill_DetailAdjust : AppBasePage
{
private DFBrowseGrid _grid;
private QueryContainer mQueryContainer;
private DFContainer dfContainer;
uint QueryID
{
get
{
return ViewState.EGetProp<uint>("QueryID", 0);
}
set
{
ViewState.ESetProp("QueryID", value);
}
}
long? GoodsClassID
{
get
{
long v;
if (long.TryParse(Request.QueryString["classID"], out v))
return v;
return null;
}
}
protected override void InitForm(HtmlForm form)
{
var vPanel = new VLayoutPanel();
form.Controls.Add(vPanel);
dfContainer = new DFContainer
{
ID = "DFContainer"
};
form.Controls.Add(dfContainer);
mQueryContainer = QueryContainer.FromResource(GetType().FullName + ".xml", GetType().Assembly);
form.Controls.Add(new PageTitle("定价单调整"));
AddQueryControls(vPanel);
CreateBrowseGrid(vPanel);
}
private ChoiceBox _goods, _goodsProperty, _priceClass;
readonly static DFInfo mDFInfo = DFInfo.Get(typeof(PriceBill));
readonly static DFInfo mDetailInfo = DFInfo.Get(typeof(PriceBill_Detail));
void AddQueryControls(VLayoutPanel vPanel)
{
var layoutManager = new LayoutManager("", mDFInfo, mQueryContainer);
_goods = QueryCreator.DFChoiceBoxEnableMultiSelection(mDetailInfo.Fields["SaleGoods_ID"], B3SaleDataSources.);
layoutManager.Add("SaleGoods_ID", new SimpleLabel("存货"), mQueryContainer.AddLink(new ChoiceBoxMultiSelectLink(_goods, s => long.Parse(s)), "SaleGoods_ID"));
layoutManager["SaleGoods_ID"].NotAutoAddToContainer = true;
_goodsProperty = QueryCreator.DFChoiceBoxEnableMultiSelection(mDetailInfo.Fields["GoodsProperty_ID"], B3UnitedInfosConsts.DataSources.);
layoutManager.Add("GoodsProperty_ID", new SimpleLabel("存货属性"), mQueryContainer.AddLink(new ChoiceBoxMultiSelectLink(_goodsProperty, s => long.Parse(s)), "GoodsProperty_ID"));
layoutManager["GoodsProperty_ID"].NotAutoAddToContainer = true;
_priceClass = QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["PriceClass_ID"], B3SaleDataSources.);
layoutManager.Add("PriceClass_ID", new SimpleLabel("价格分类"), mQueryContainer.AddLink(new ChoiceBoxMultiSelectLink(_priceClass, s => long.Parse(s)), "PriceClass_ID"));
layoutManager["PriceClass_ID"].NotAutoAddToContainer = true;
vPanel.Add(layoutManager.CreateLayout());
HLayoutPanel hPanel = new HLayoutPanel() { Align = HorizontalAlign.Center };
TSButton qButton = new TSButton("开始查询");
hPanel.Add(qButton);
qButton.Click += delegate
{
_grid.Query = CreateQueryGridQuery();
_grid.DataBind();
};
dfContainer.AddNonDFControl(qButton, "$btnsearch");
hPanel.Add(new RedirectTSButton("清除条件"));
vPanel.Add(hPanel);
}
private DQueryDom CreateQueryGridQuery()
{
var mainFields = new[] {"AccountingUnit_Name" };
var detailFields = new[] {"ID", "Goods_Name", "GoodsProperty_Name", "SourcePrice", "Price" };
var dom = mQueryContainer.Build();
var main = dom.From.RootSource.Alias;
var detail = JoinAlias.Create("detail");
foreach (var field in mainFields)
{
dom.Columns.Add(DQSelectColumn.Field(field, main));
}
foreach (var field in detailFields)
{
dom.Columns.Add(DQSelectColumn.Field(field, detail));
}
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet<string>("''"), "备注"));
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(main, "ID"), "MainID"));
QueryID = ViewStateUtil.Current.SaveToPersistenceMedium(dom.Where.Conditions);
dom.Where.Conditions.Add(DQCondition.EQ(main, "BillState", .));
var billFlowCataID = new B3YunKenOnlineConfiguration().PriceAdjustBillFlowState.Value;
if (billFlowCataID != 0)
{
dom.Where.Conditions.Add(DQCondition.EQ(main, "DepartmentWorkFlowStateCategory_ID", billFlowCataID));
}
dom.Where.Conditions.Add(DQExpression.Snippet(" (LEN(iSnull(detail.Remark,''))=0)"));
if (!_goods.IsEmpty)
{
dom.Where.Conditions.EFieldInList(DQExpression.Field(detail, "SaleGoods_ID"), _goods.GetValues());
}
if (!_goodsProperty.IsEmpty)
{
dom.Where.Conditions.EFieldInList(DQExpression.Field(detail, "GoodsProperty_ID"), _goodsProperty.GetValues());
}
if (!_priceClass.IsEmpty)
{
dom.Where.Conditions.EFieldInList(DQExpression.Field(main, "PriceClass_ID"), _priceClass.GetValues());
}
return dom;
}
private void CreateBrowseGrid(VLayoutPanel vPanel)
{
vPanel.Add(new TSButton("通过", delegate {
_grid.GetFromUI();
using (var context = new TransactionContext())
{
var bl = BIFactory.Create<IPriceBillBL>(context);
foreach (var row in _grid.GetSelectedItems())
{
DoApproval(row, true, bl);
}
context.Commit();
}
AspUtil.Alert(this, "操作成功\n" + BIFactory.GetLastMessage());
_grid.DataBind();
}), new VLayoutOption(HorizontalAlign.Left));
_grid = vPanel.Add(new DFBrowseGrid(new DFDataTableEditor()));
_grid.Width = Unit.Percentage(100);
_grid.GridSubKey = "Grid";
_grid.DFGridSetEnabled = false;
_grid.MultiSelectionEnabled = true;
_grid.Columns.EAdd(new DFBrowseGridColumn("Goods_Name")).HeaderText = "标准件";
_grid.Columns.Add(new DFBrowseGridColumn("AccountingUnit_Name"));
_grid.Columns.EAdd(new DFBrowseGridColumn( "GoodsProperty_Name")).HeaderText = "存货分类";
_grid.Columns.EAdd(new DFBrowseGridColumn("SourcePrice")).HeaderText = "原单价";
_grid.Columns.EAdd(new DFEditGridColumn<DFTextBox>("Price")).HeaderText = "调整单价";
_grid.Columns.EAdd(new DFBrowseGridCustomExtColumn((row, cell, rowIndex) => {
var lbt = new LinkButton
{
Text = "通过",
Width = Unit.Pixel(50)
};
var notlbt = new LinkButton
{
Text = "不通过",
Width = Unit.Pixel(50)
};
lbt.Command += (sender, e) => {
_grid.GetFromUI();
using (var context = new TransactionContext())
{
var bl = BIFactory.Create<IPriceBillBL>(context);
DoApproval(row, true, bl);
context.Commit();
}
AspUtil.Alert(this, "操作成功\n" + BIFactory.GetLastMessage());
_grid.DataBind();
};
notlbt.Command += (sender, e) => {
_grid.GetFromUI();
using (var context = new TransactionContext())
{
var bl = BIFactory.Create<IPriceBillBL>(context);
DoApproval(row, false, bl);
context.Commit();
}
AspUtil.Alert(this, "操作成功\n" + BIFactory.GetLastMessage());
_grid.DataBind();
};
cell.Controls.Add(lbt);
cell.Controls.Add(notlbt);
})).HeaderText = "是否通过";
_grid.Columns.EAdd(new DFEditGridColumn<DFMemoInfo>("备注")).InitEditControl += (sender, e) => {
e.Control.Width = 130;
e.Control.DataKind = "价格调整单备注";
};
}
private void DoApproval(DFDataRow row, bool pass, IPriceBillBL bl)
{
var Price = (Money<decimal>?)row["Price"];
var detailID = (long?)row["ID"];
var mainID = (long?)row["MainID"];
var remark = pass ? "已审批通过" : (string)row["备注"];
if (string.IsNullOrEmpty(remark))
{
throw new Exception("备注不能为空");
}
bl.Approval(mainID, detailID, Price, remark);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
_grid.Query = CreateQueryGridQuery();
_grid.Reset();
_grid.DataBind();
}
}
}
}

+ 49
- 0
BWP.B3_YunKen.Web/Pages/B3YunKen/Bill/PriceBill_DetailAdjust.xml View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
</Columns>
<From>
<Join type="Left">
<DmoClass class="BWP.B3Sale.BO.PriceBill, B3Sale" alias="main"/>
<DmoClass class="BWP.B3Sale.BO.PriceBill_Detail, B3Sale" alias="detail"/>
<Condition>
<EQ>
<Field name="ID" alias="main"/>
<Field name="PriceBill_ID" alias="detail"/>
</EQ>
</Condition>
</Join>
</From>
<Where>
<And>
<EQ>
<Field name="ID"/>
<QBE paramName="ID"/>
</EQ>
<QBEIn>
<Field name="PriceClass_ID"/>
<QBE paramName="PriceClass_ID"/>
</QBEIn>
<GreaterThanOrEqual>
<Field name="StartPriceDate"/>
<QBE paramName="MinStartPriceDate" />
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="StartPriceDate"/>
<QBE paramName="MaxStartPriceDate"/>
</LessThanOrEqual>
<Contains>
<Field name="Remark"/>
<QBE paramName="Remark"/>
</Contains>
<GreaterThanOrEqual>
<Field name="UpdateTime" alias="pricebillrecord"/>
<QBE paramName="MinUpdateTime" />
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="UpdateTime" alias="pricebillrecord"/>
<QBE paramName="MaxUpdateTime"/>
</LessThanOrEqual>
</And>
</Where>
</Select>

+ 13
- 0
BWP.B3_YunKen/B3YunKenOnlineConfiguration.cs View File

@ -38,5 +38,18 @@ namespace BWP.B3_YunKen
[DomainConfigurationItem]
public IntConfigRef AccountUnit_ID { get { return mAccountUnit_ID; } set { mAccountUnit_ID = value; } }//会计单位
private IntConfigRef _PriceAdjustBillFlowState = new IntConfigRef(0);
[LogicName("定价调整中显示默认流程状态分类")]
[ConfigurationItemGroup("耘垦模块")]
[ConfigurationItemDescription("定价调整中显示默认流程状态分类,默认为0,则全部显示")]
public IntConfigRef PriceAdjustBillFlowState
{
get { return _PriceAdjustBillFlowState; }
set { PriceAdjustBillFlowState = value; }
}
}
}

+ 4
- 1
WebFolder/Config/Plugins/B3_YunKen.Plugin View File

@ -34,7 +34,9 @@
<FunctionGroup name="产品包装物设置" roleSchemas="employee">
<Function index="0" name="访问" />
</FunctionGroup>
<FunctionGroup name="定价调整" roleSchemas="employee">
<Function index="0" name="访问" />
</FunctionGroup>
<FunctionGroup name="报表分析" roleSchemas="employee">
<Function index="0" name="物流分析表" />
<Function index="1" name="完工与入库对比" />
@ -51,6 +53,7 @@
<Menu id="0006" name="/B3耘垦模块/报表分析/物流分析表" roles="B3_YunKen.报表分析.物流分析表" url="B3YunKen/Reports/LogisticsAnalysisReport.aspx"/>
<Menu id="0007" name="/B3耘垦模块/报表分析/完工与入库对比" roles="B3_YunKen.报表分析.完工与入库对比" url="B3YunKen/Reports/ProduceFinishDiffReport.aspx"/>
<Menu id="0008" name="/B3耘垦模块/报表分析/去运费净价表" roles="B3_YunKen.报表分析.去运费净价表" url="B3YunKen/Reports/ToFreightNetPriceReport.aspx"/>
<Menu id="0009" name="/B3耘垦模块/定价调整" roles="B3_YunKen.定价调整.访问" url="B3YunKen/Bill/PriceBill_DetailAdjust.aspx"/>
</Menus>
</Plugin>

Loading…
Cancel
Save