using BWP.B3ClientService.BO;
|
|
using BWP.B3Frameworks.Utils;
|
|
using BWP.Web.Utils;
|
|
using Forks.EnterpriseServices.DomainObjects2;
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery;
|
|
using Forks.EnterpriseServices.SqlDoms;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Web.UI.WebControls;
|
|
using TSingSoft.WebControls2;
|
|
using TSingSoft.WebPluginFramework.Controls;
|
|
using TSingSoft.WebPluginFramework.Pages;
|
|
using TSingSoft.WebPluginFramework;
|
|
using Forks.Utils;
|
|
using BWP.B3Frameworks.BO.MoneyTemplate;
|
|
using Forks.EnterpriseServices.DataForm;
|
|
using BWP.B3ClientService.NamedValueTemplate;
|
|
|
|
namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInOutLossAnalyse_
|
|
{
|
|
class OutStoreDetail : ServerPage
|
|
{
|
|
long? GoodsID
|
|
{
|
|
get
|
|
{
|
|
if (string.IsNullOrEmpty(Request.QueryString["Goods_ID"]))
|
|
return null;
|
|
return long.Parse(Request.QueryString["Goods_ID"]);
|
|
}
|
|
}
|
|
|
|
DateTime? Date
|
|
{
|
|
get
|
|
{
|
|
if (string.IsNullOrEmpty(Request.QueryString["Date"]))
|
|
return null;
|
|
return DateTime.Parse(Request.QueryString["Date"]);
|
|
}
|
|
}
|
|
|
|
long? ProductBatchID
|
|
{
|
|
get
|
|
{
|
|
if (string.IsNullOrEmpty(Request.QueryString["ProductBatchID"]))
|
|
return null;
|
|
return long.Parse(Request.QueryString["ProductBatchID"]);
|
|
}
|
|
}
|
|
|
|
int Flag
|
|
{
|
|
get
|
|
{
|
|
return int.Parse(Request.QueryString["Flag"]);
|
|
}
|
|
}
|
|
|
|
DFBrowseGrid mBrowseGrid;
|
|
protected override void InitForm(HtmlForm form)
|
|
{
|
|
string lName = string.Empty;
|
|
if (GoodsID.HasValue)
|
|
lName = WebBLUtil.GetDmoPropertyByID<string>(typeof(Goods), "Name", GoodsID.Value);
|
|
form.Controls.Add(new PageTitle(string.Format("{0}{1}明细", lName, Flag == 1 ? "领用" : "销售")));
|
|
|
|
mBrowseGrid = form.EAdd(new DFBrowseGrid(new DFDataTableEditor()) { Width = Unit.Percentage(100) });
|
|
mBrowseGrid.Columns.Add(new DFBrowseGridAutoColumn());
|
|
}
|
|
|
|
void StartQuery()
|
|
{
|
|
var jF="InStoreGoods_ID";
|
|
if (Flag == 2)
|
|
jF = "SaleGoods_ID";
|
|
var main = new JoinAlias(typeof(CarcassFullInfo));
|
|
var goods = new JoinAlias(typeof(Goods));
|
|
var batch = new JoinAlias(typeof(ProductBatch));
|
|
var query = new DQueryDom(main);
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, jF, goods, "ID"));
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(batch), DQCondition.EQ(main, "ProductBatch_ID", batch, "ID"));
|
|
query.Columns.Add(DQSelectColumn.Field("Name", goods, "存货"));
|
|
query.GroupBy.Expressions.Add(DQExpression.Field(goods, "Name"));
|
|
|
|
query.Columns.Add(DQSelectColumn.Sum("PickNumber", "头数"));
|
|
query.Columns.Add(DQSelectColumn.Sum("PickWeight", "重量"));
|
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("PickType", Flag == 1 ? 领用类型.分割领用 : 领用类型.白条销售));
|
|
|
|
if (ProductBatchID.HasValue)
|
|
query.Where.Conditions.Add(DQCondition.EQ("ProductBatch_ID", ProductBatchID));
|
|
if (Date.HasValue)
|
|
query.Where.Conditions.Add(DQCondition.EQ(batch, "Date", Date));
|
|
if (GoodsID.HasValue)
|
|
query.Where.Conditions.Add(DQCondition.EQ("InStoreGoods_ID", GoodsID));
|
|
else
|
|
query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("InStoreGoods_ID")));
|
|
|
|
var args = new LoadArguments(query);
|
|
for (var i = 0; i < query.Columns.Count; i++)
|
|
{
|
|
if (i <= 0)
|
|
continue;
|
|
args.SumColumns.Add(i);
|
|
args.GroupSumColumns.Add(i);
|
|
}
|
|
mBrowseGrid.LoadArguments = args;
|
|
mBrowseGrid.DataBind();
|
|
}
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
base.OnLoad(e);
|
|
if (!IsPostBack)
|
|
StartQuery();
|
|
}
|
|
}
|
|
}
|