|
|
|
@ -8,6 +8,7 @@ using System.Web.UI.WebControls; |
|
|
|
using B3_DongFangWanQi.BO; |
|
|
|
using BWP.B3Frameworks; |
|
|
|
using BWP.B3Frameworks.BO; |
|
|
|
using BWP.B3Frameworks.BO.MoneyTemplate; |
|
|
|
using BWP.B3Frameworks.BO.NamedValueTemplate; |
|
|
|
using BWP.B3Frameworks.Utils; |
|
|
|
using BWP.B3Sale.BO; |
|
|
|
@ -60,9 +61,9 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
layoutManager.Add("Customer_ID", _customerInput = QueryCreator.DFChoiceBox(_dFInfo.Fields["Customer_ID"], B3SaleDataSources.用户配置客户)); |
|
|
|
|
|
|
|
_customerCatalogt = QueryCreator.DFChoiceBox(_dFInfo.Fields["CustomerCatalog_ID"], B3SaleDataSources.客户分类); |
|
|
|
layoutManager.Add("CustomerCatalog_ID", new SimpleLabel("客户分类"), _customerCatalogt ); |
|
|
|
layoutManager.Add("CustomerCatalog_ID", new SimpleLabel("客户分类"), _customerCatalogt); |
|
|
|
var config = new AutoLayoutConfig(); |
|
|
|
|
|
|
|
config.Add("LoadTime"); |
|
|
|
config.Add("OrderDate"); |
|
|
|
config.Add("AccountingUnit_ID"); |
|
|
|
config.Add("Employee_ID"); |
|
|
|
@ -77,7 +78,7 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
section.SetDisplayName("GoodsProperty_ID", "存货属性"); |
|
|
|
section.SetDisplayName("GoodsPropertyCatalog_ID", "存货属性分类"); |
|
|
|
VLayoutPanel vp; |
|
|
|
titlePanel.Controls.Add(vp=new VLayoutPanel()); |
|
|
|
titlePanel.Controls.Add(vp = new VLayoutPanel()); |
|
|
|
vp.Add(layoutManager.CreateLayout()); |
|
|
|
|
|
|
|
var tsbtn = new TSButton("开始查询"); |
|
|
|
@ -91,7 +92,7 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
|
|
|
|
AddDetails(form.EAdd(new TitlePanel("订单明细", "订单明细"))); |
|
|
|
mDFContainer.ID = "DFContainer"; |
|
|
|
form.Controls.Add(mDFContainer); |
|
|
|
form.Controls.Add(mDFContainer); |
|
|
|
|
|
|
|
var vPanel = new VLayoutPanel(); |
|
|
|
form.Controls.Add(vPanel); |
|
|
|
@ -137,9 +138,9 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
|
|
|
|
DFBrowseGrid _grid; |
|
|
|
void AddDetails(TitlePanel tPanel) { |
|
|
|
|
|
|
|
|
|
|
|
tPanel.Controls.Add(new LiteralControl("<br /><br />")); |
|
|
|
|
|
|
|
|
|
|
|
var editor = new DFDataTableEditor(); |
|
|
|
_grid = new DFBrowseGrid(editor) { |
|
|
|
Width = Unit.Percentage(100), |
|
|
|
@ -148,47 +149,55 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
}; |
|
|
|
|
|
|
|
_grid.Columns.Add(new DFBrowseGridColumn("GoodsProperty_Name")); |
|
|
|
_grid.Columns.Add(new DFBrowseGridColumn("UnitNum")); |
|
|
|
_grid.Columns.Add(new DFBrowseGridColumn("UnitNum")); |
|
|
|
_grid.Columns.Add(new DFBrowseGridColumn("库存数量")); |
|
|
|
_grid.Columns.Add(new DFBrowseGridColumn("测算数量")); |
|
|
|
_grid.Columns.Add(new DFBrowseGridColumn("可用数量")); |
|
|
|
_grid.Columns.Add(new DFBrowseGridColumn("差异数量")); |
|
|
|
|
|
|
|
_grid.Columns.Add(new DFBrowseGridColumn("测算数量")); |
|
|
|
_grid.Columns.Add(new DFBrowseGridColumn("可用数量")); |
|
|
|
_grid.Columns.Add(new DFBrowseGridColumn("预计剩余数量")); |
|
|
|
_grid.Columns.Add(new DFBrowseGridColumn("预计剩余头数")); |
|
|
|
_grid.OnDetailDataBound += (htmlRow, dataRow, o) => { |
|
|
|
var row = dataRow as DFDataRow; |
|
|
|
if (row == null) |
|
|
|
return; |
|
|
|
var diff = (decimal?)row["差异数量"]; |
|
|
|
var numberIndext = 5; |
|
|
|
var bt = new DialogButton(); |
|
|
|
bt.CssClass = "btn"; |
|
|
|
bt.Text = htmlRow.Cells[numberIndext].InnerText; |
|
|
|
|
|
|
|
if (o % 2 != 1) { |
|
|
|
bt.CssClass = "btn evenbtn"; |
|
|
|
} |
|
|
|
|
|
|
|
if (diff < 0) { |
|
|
|
bt.BorderStyle = BorderStyle.Solid; |
|
|
|
bt.BorderColor = Color.Red; |
|
|
|
bt.BorderWidth = 1; |
|
|
|
} |
|
|
|
htmlRow.Cells[numberIndext].InnerHtml = ""; |
|
|
|
htmlRow.Cells[numberIndext].Controls.Add(bt); |
|
|
|
var idField = (long?)row["GoodsProperty_ID"]; |
|
|
|
var number = ((decimal?)row["可用数量"]) ?? 0; |
|
|
|
var url = AspUtil.UpdateUrlParam("SaleOrderUpdateEdit.aspx", "GoodsProperty_ID", ( idField??0).ToString()); |
|
|
|
url = AspUtil.UpdateUrlParam(url, "number", number.ToString()); |
|
|
|
url = AspUtil.UpdateUrlParam(url, "cacheid", "'+__DFContainer.getValue('$HiddenField01')+'"); |
|
|
|
bt.Url = url; |
|
|
|
bt.Width = 100; |
|
|
|
bt.Click += delegate { |
|
|
|
_grid.DataBind(); |
|
|
|
}; |
|
|
|
var diff = (decimal?)row["预计剩余数量"]; |
|
|
|
|
|
|
|
AddLinkBt(o, row, 5, diff, htmlRow); |
|
|
|
AddLinkBt(o, row, 6, diff, htmlRow); |
|
|
|
}; |
|
|
|
|
|
|
|
tPanel.Controls.Add(_grid); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void AddLinkBt(int o, DFDataRow row, int numberIndext, decimal? diff, HtmlTableRow htmlRow) |
|
|
|
{ |
|
|
|
var bt = new DialogButton(); |
|
|
|
bt.CssClass = "btn"; |
|
|
|
bt.Text = htmlRow.Cells[numberIndext].InnerText; |
|
|
|
|
|
|
|
if (o%2 != 1) |
|
|
|
{ |
|
|
|
bt.CssClass = "btn evenbtn"; |
|
|
|
} |
|
|
|
|
|
|
|
if (diff < 0) |
|
|
|
{ |
|
|
|
bt.BorderStyle = BorderStyle.Solid; |
|
|
|
bt.BorderColor = Color.Red; |
|
|
|
bt.BorderWidth = 1; |
|
|
|
} |
|
|
|
htmlRow.Cells[numberIndext].InnerHtml = ""; |
|
|
|
htmlRow.Cells[numberIndext].Controls.Add(bt); |
|
|
|
|
|
|
|
|
|
|
|
var idField = (long?) row["GoodsProperty_ID"]; |
|
|
|
var number = ((decimal?) row["可用数量"]) ?? 0; |
|
|
|
var url = AspUtil.UpdateUrlParam("SaleOrderUpdateEdit.aspx", "GoodsProperty_ID", (idField ?? 0).ToString()); |
|
|
|
url = AspUtil.UpdateUrlParam(url, "number", number.ToString()); |
|
|
|
url = AspUtil.UpdateUrlParam(url, "cacheid", "'+__DFContainer.getValue('$HiddenField01')+'"); |
|
|
|
bt.Url = url; |
|
|
|
bt.Width = 100; |
|
|
|
bt.Click += delegate { _grid.DataBind(); }; |
|
|
|
} |
|
|
|
|
|
|
|
private void DataBindGrid() { |
|
|
|
@ -202,30 +211,77 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
} |
|
|
|
|
|
|
|
private DQueryDom GetQueryDom() { |
|
|
|
|
|
|
|
var bill = new JoinAlias(typeof(OrderTmp)); |
|
|
|
var goodsProperty = new JoinAlias(typeof(GoodsProperty)); |
|
|
|
var storeDetail = new JoinAlias(typeof(StoreDetailTmp)); |
|
|
|
var output = new JoinAlias(typeof(OutputTmp)); |
|
|
|
var dom = new DQueryDom(bill); |
|
|
|
var outputConfig = new JoinAlias(typeof(OutputConfigTmp)); |
|
|
|
var dom = new DQueryDom(bill); |
|
|
|
OrganizationUtil.RegisterOrganizationQueryTable(dom); |
|
|
|
dom.RegisterQueryTable(typeof(OrderTmp), new[] { "GoodsProperty_ID", "Number", "SecondNumber", "UnitNum" }, GetOrderDQueryDom()); |
|
|
|
dom.RegisterQueryTable(typeof(OrderTmp), new[] { "GoodsProperty_ID", "Number", "SecondNumber", "UnitNum" }, GetOrderDQueryDom()); |
|
|
|
dom.RegisterQueryTable(typeof(StoreDetailTmp), new[] { "GoodsProperty_ID", "Number", "SecondNumber" }, GetStoreDetailDQueryDom()); |
|
|
|
dom.RegisterQueryTable(typeof(OutputTmp), new[] { "GoodsProperty_ID", "Number" }, GetOutputDQueryDom()); |
|
|
|
|
|
|
|
dom.RegisterQueryTable(typeof(OutputTmp), new[] { "GoodsProperty_ID", "Number" }, GetOutputDQueryDom()); |
|
|
|
dom.RegisterQueryTable(typeof(OutputConfigTmp), new[] { "GoodsProperty_ID", "Number" }, GetOutputConfigureDom()); |
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(goodsProperty), DQCondition.EQ(bill, "GoodsProperty_ID", goodsProperty, "ID")); |
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(storeDetail), DQCondition.EQ(bill, "GoodsProperty_ID", storeDetail, "GoodsProperty_ID")); |
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(output), DQCondition.EQ(bill, "GoodsProperty_ID", output, "GoodsProperty_ID")); |
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(outputConfig), DQCondition.EQ(bill, "GoodsProperty_ID", outputConfig, "GoodsProperty_ID")); |
|
|
|
dom.Columns.Add(DQSelectColumn.Field("GoodsProperty_ID", bill)); |
|
|
|
dom.Columns.Add(DQSelectColumn.Field("GoodsProperty_Name", bill)); |
|
|
|
dom.Columns.Add(DQSelectColumn.Field("UnitNum", bill)); |
|
|
|
dom.Columns.Add(DQSelectColumn.Field("GoodsProperty_Name", bill)); |
|
|
|
dom.Columns.Add(DQSelectColumn.Field("UnitNum", bill)); |
|
|
|
|
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(storeDetail, "Number"), "库存数量")); |
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(output, "Number"), "测算数量")); |
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(output, "Number"), "测算数量")); |
|
|
|
|
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(storeDetail, "Number").EAdd(DQExpression.Field(output, "Number")), "可用数量")); |
|
|
|
|
|
|
|
dom.Columns.Add(DQSelectColumn.Create( |
|
|
|
ESubtract(DQExpression.Field(storeDetail, "Number").EAdd(DQExpression.Field(output, "Number")), DQExpression.Field(bill, "UnitNum")), "预计剩余数量")); |
|
|
|
|
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(storeDetail, "Number").EAdd(DQExpression.Field(output, "Number")), "可用数量")); |
|
|
|
dom.Columns.Add(DQSelectColumn.Create( |
|
|
|
ESubtract(DQExpression.Field(storeDetail, "Number").EAdd(DQExpression.Field(output, "Number")), DQExpression.Field(bill, "UnitNum")), "差异数量")); |
|
|
|
return dom; |
|
|
|
ESubtract(DQExpression.Field(storeDetail, "Number").EAdd(DQExpression.Field(output, "Number")), DQExpression.Field(bill, "UnitNum")).ESafeDivide(DQExpression.Field(outputConfig, "Number")).ECastType<Money<二位小数>?>(), "预计剩余头数")); |
|
|
|
|
|
|
|
return dom; |
|
|
|
} |
|
|
|
|
|
|
|
class OutputConfigTmp { |
|
|
|
public long GoodsProperty_ID { get; set; } |
|
|
|
|
|
|
|
[LogicName("主数量")] |
|
|
|
public Money<decimal>? Number { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
private DQueryDom GetOutputConfigureDom() { |
|
|
|
|
|
|
|
var dom = new DQueryDom(new JoinAlias(typeof(OutputConfigure))); |
|
|
|
dom.Columns.Add(DQSelectColumn.Max("ID")); |
|
|
|
dom.Where.Conditions.Add(DQCondition.EQ("Domain_ID", DomainContext.Current.ID)); |
|
|
|
dom.Where.Conditions.Add(DQCondition.EQ("Stopped", false)); |
|
|
|
var id = dom.EExecuteScalar<long?>() ?? 0; |
|
|
|
|
|
|
|
var detail = new JoinAlias(typeof(OutputConfigure_Detail)); |
|
|
|
var bill = new JoinAlias(typeof(OutputConfigure)); |
|
|
|
var goodsPropertyCatalog = new JoinAlias(typeof(GoodsPropertyCatalog)); |
|
|
|
var goodsProperty = new JoinAlias(typeof(GoodsProperty)); |
|
|
|
|
|
|
|
var query = new DQueryDom(detail); |
|
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(bill), |
|
|
|
DQCondition.EQ(bill, "ID", detail, "OutputConfigure_ID")); |
|
|
|
|
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(goodsProperty), DQCondition.EQ(goodsProperty, "ID", detail, "GoodsProperty_ID")); |
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(goodsPropertyCatalog), DQCondition.EQ(goodsProperty, "GoodsPropertyCatalog_ID", goodsPropertyCatalog, "ID")); |
|
|
|
|
|
|
|
AddGoodsCondition(goodsPropertyCatalog, goodsProperty, query); |
|
|
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Field("GoodsProperty_ID")); |
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field("Number")), "主数量")); |
|
|
|
|
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field("GoodsProperty_ID")); |
|
|
|
query.Where.Conditions.Add(DQCondition.EQ(bill, "ID", id)); |
|
|
|
query.Where.Conditions.Add(DQCondition.GreaterThan(detail, "GoodsProperty_ID", 0)); |
|
|
|
return query; |
|
|
|
} |
|
|
|
|
|
|
|
static IDQExpression ESubtract(IDQExpression expression, IDQExpression right) { |
|
|
|
@ -234,7 +290,7 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
|
|
|
|
[DFClass] |
|
|
|
class OrderTmp { |
|
|
|
[LogicName("存货属性")] |
|
|
|
[LogicName("存货属性")] |
|
|
|
public long? GoodsProperty_ID { get; set; } |
|
|
|
|
|
|
|
[LogicName("主数量")] |
|
|
|
@ -245,12 +301,12 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
|
|
|
|
[LogicName("订货报价数量")] |
|
|
|
public Money<decimal>? UnitNum { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
[LogicName("存货属性名称")] |
|
|
|
[ReferenceTo(typeof(GoodsProperty), "Name")] |
|
|
|
[Join("GoodsProperty_ID", "ID")] |
|
|
|
public string GoodsProperty_Name { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
class StoreDetailTmp { |
|
|
|
@ -279,10 +335,10 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
var dom = _queryContainer.Build(); |
|
|
|
var bill = dom.From.RootSource.Alias; |
|
|
|
var detail = new JoinAlias("detail", typeof(Order_Detail)); |
|
|
|
var goodsPropertyCatalog = new JoinAlias("_gpc",typeof(GoodsPropertyCatalog)); |
|
|
|
var goodsProperty = new JoinAlias("_gp",typeof(GoodsProperty)); |
|
|
|
var goods = new JoinAlias("_g",typeof(SaleGoods)); |
|
|
|
var customer = new JoinAlias("_c",typeof(Customer)); |
|
|
|
var goodsPropertyCatalog = new JoinAlias("_gpc", typeof(GoodsPropertyCatalog)); |
|
|
|
var goodsProperty = new JoinAlias("_gp", typeof(GoodsProperty)); |
|
|
|
var goods = new JoinAlias("_g", typeof(SaleGoods)); |
|
|
|
var customer = new JoinAlias("_c", typeof(Customer)); |
|
|
|
dom.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), |
|
|
|
DQCondition.EQ(bill, "ID", detail, "Order_ID")); |
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(detail, "SaleGoods_ID", goods, "ID")); |
|
|
|
@ -291,14 +347,14 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(customer), DQCondition.EQ(bill, "Customer_ID", customer, "ID")); |
|
|
|
|
|
|
|
AddGoodsCondition(goodsPropertyCatalog, goodsProperty, dom); |
|
|
|
dom.Columns.Add(DQSelectColumn.Field("ID", goodsProperty)); |
|
|
|
dom.Columns.Add(DQSelectColumn.Field("ID", goodsProperty)); |
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(detail, "Number")), "主数量")); |
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(detail, "SecondNumber")), "主数量")); |
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(detail, "UnitNum")), "主数量")); |
|
|
|
|
|
|
|
dom.GroupBy.Expressions.Add(DQExpression.Field(goodsProperty, "ID")); |
|
|
|
dom.GroupBy.Expressions.Add(DQExpression.Field(goodsProperty, "ID")); |
|
|
|
dom.Where.Conditions.Add(DQCondition.EQ("BillState", 单据状态.未审核)); |
|
|
|
|
|
|
|
|
|
|
|
dom.Where.Conditions.Add(DQCondition.EQ(bill, "Domain_ID", DomainContext.Current.ID)); |
|
|
|
if (!_customerCatalogt.IsEmpty) { |
|
|
|
var strs = B3SaleWebUtil.GetDeepByTreeName(_customerCatalogt.DisplayValue); |
|
|
|
@ -311,7 +367,7 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
dom.Where.Conditions.Add(DQCondition.Or(conditions)); |
|
|
|
} |
|
|
|
uint id = ViewStateUtil.Current.SaveToPersistenceMedium(dom.Where.Conditions); |
|
|
|
hidden.Value = id.ToString(); |
|
|
|
hidden.Value = id.ToString(); |
|
|
|
OrganizationUtil.AddOrganizationLimit(dom, typeof(Order)); |
|
|
|
return dom; |
|
|
|
} |
|
|
|
@ -332,7 +388,7 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
|
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(store), DQCondition.EQ(store, "ID", storeDetail, "Store_ID")); |
|
|
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Field("ID", goodsProperty)); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("ID", goodsProperty)); |
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field("Number")), "主数量")); |
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field("SecondNumber")), "主数量")); |
|
|
|
|
|
|
|
@ -354,11 +410,11 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
var bill = new JoinAlias(typeof(OutputForecast)); |
|
|
|
var goodsPropertyCatalog = new JoinAlias(typeof(GoodsPropertyCatalog)); |
|
|
|
var goodsProperty = new JoinAlias(typeof(GoodsProperty)); |
|
|
|
|
|
|
|
|
|
|
|
var query = new DQueryDom(detail); |
|
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(bill), |
|
|
|
DQCondition.EQ(bill, "ID", detail, "OutputForecast_ID")); |
|
|
|
|
|
|
|
|
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(goodsProperty), DQCondition.EQ(goodsProperty, "ID", detail, "GoodsProperty_ID")); |
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(goodsPropertyCatalog), DQCondition.EQ(goodsProperty, "GoodsPropertyCatalog_ID", goodsPropertyCatalog, "ID")); |
|
|
|
|
|
|
|
@ -395,6 +451,6 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Tools { |
|
|
|
DataBindGrid(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |