using BWP.Web.Pages.B3Sale.Bills.SaleForecast_;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BWP.B3Frameworks.Utils;
|
|
using BWP.B3Sale.BO;
|
|
using BWP.Web.Layout;
|
|
using Forks.EnterpriseServices.DomainObjects2;
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery;
|
|
using Forks.EnterpriseServices.SqlDoms;
|
|
using TSingSoft.WebControls2;
|
|
|
|
namespace BWP.Web.Pages.B3YunKen.Overlays
|
|
{
|
|
public class SaleForecastEdit_Ext: SaleForecastEdit
|
|
{
|
|
protected override void AddCustomerLayoutConfig(AutoLayoutConfig config)
|
|
{
|
|
config.AddAfter("FreightBear", "DeliverAddress");
|
|
}
|
|
|
|
protected override void AddCustomerToolBar(HLayoutPanel toobar)
|
|
{
|
|
var btn=new TSButton("载入存货");
|
|
btn.Click += Btn_Click;
|
|
toobar.Add(btn);
|
|
}
|
|
|
|
private void Btn_Click(object sender, EventArgs e)
|
|
{
|
|
Dmo.Details.Clear();
|
|
foreach (SaleForecast_Detail detail in LoadList())
|
|
{
|
|
Dmo.Details.Add(detail);
|
|
}
|
|
_detailGrid.DataBind();
|
|
}
|
|
|
|
List<SaleForecast_Detail> LoadList()
|
|
{
|
|
var list=new List<SaleForecast_Detail>();
|
|
|
|
var bill = new JoinAlias(typeof(CustomerGoodsTable));
|
|
var detail = new JoinAlias(typeof(CustomerGoodsTable_Detail));
|
|
var query = new DQueryDom(bill);
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(bill, "ID", detail, "CustomerGoodsTable_ID"));
|
|
query.Where.Conditions.Add(DQCondition.EQ("AccountingUnit_ID", Dmo.AccountingUnit_ID));
|
|
query.Where.Conditions.Add(DQCondition.EQ("Customer_ID", Dmo.Customer_ID));
|
|
query.Columns.Add(DQSelectColumn.Field("SaleGoods_ID", detail));
|
|
query.Columns.Add(DQSelectColumn.Field("Goods_Name", detail));
|
|
query.Columns.Add(DQSelectColumn.Field("Goods_Brand", detail));
|
|
using (var session=Forks.EnterpriseServices.DomainObjects2.Dmo.NewSession())
|
|
{
|
|
using (var reader=session.ExecuteReader(query))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
var dmodetail = new SaleForecast_Detail()
|
|
{
|
|
SaleGoods_ID = (long) reader[0],
|
|
Goods_Name = (string) reader[1],
|
|
Goods_Brand = (string) reader[2]
|
|
};
|
|
list.Add(dmodetail);
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach (SaleForecast_Detail forecastDetail in list)
|
|
{
|
|
DmoUtil.RefreshDependency(forecastDetail, "SaleGoods_ID");
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
}
|
|
}
|