|
|
using BWP.B3UnitedInfos.BO;
|
|
|
using Forks.EnterpriseServices.DataForm;
|
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery;
|
|
|
using Forks.Utils;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using TSingSoft.WebPluginFramework;
|
|
|
using Forks.Utils.Collections;
|
|
|
using TSingSoft.WebControls2;
|
|
|
using BWP.Web.WebControls;
|
|
|
using BWP.Web.Layout;
|
|
|
using Forks.EnterpriseServices.DomainObjects2;
|
|
|
using BWP.B3Frameworks.Utils;
|
|
|
using BWP.B3UnitedInfos;
|
|
|
using BWP.Web.Utils;
|
|
|
using BWP.B3CowButcherManage.BO;
|
|
|
using Forks.EnterpriseServices.SqlDoms;
|
|
|
using System.Web.UI;
|
|
|
|
|
|
namespace BWP.Web.Pages.B3_QiLianMuGe.Dialogs
|
|
|
{
|
|
|
class QueryBarCode : DmoMultiSelectDialog<StockTakeCEUploadBarCode, BWP.B3CowButcherManage.BO.Goods>
|
|
|
{
|
|
|
protected override void SetResultFromDFDataRow(BWP.B3CowButcherManage.BO.Goods dmo, DFDataRow row)
|
|
|
{
|
|
|
//dmo.Goods_ID = (long)row["ID"];
|
|
|
//dmo.Number = (Money<decimal>?)row["数量"];
|
|
|
//dmo.SecondNumber = (Money<decimal>?)row["辅数量"];
|
|
|
//dmo.BrandItem_ID = (long?)row["品牌项"];
|
|
|
//if (dmo.BrandItem_ID != null)
|
|
|
// dmo.BrandItem_Name = WebBLUtil.GetDmoPropertyByID<string>(typeof(BrandItem), "Name", dmo.BrandItem_ID.Value);
|
|
|
}
|
|
|
|
|
|
protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form)
|
|
|
{
|
|
|
base.InitForm(form);
|
|
|
|
|
|
//form.Controls.Add(new GoodsEditGridScriptManager(base.queryGrid, "数量", "辅数量", "UnitConvertDirection", "MainUnitRatio", "SecondUnitRatio"));
|
|
|
}
|
|
|
|
|
|
protected override void CreateQuery(VLayoutPanel vPanel)
|
|
|
{
|
|
|
var layoutManager = new LayoutManager("main", mDFInfo, mQueryContainer);
|
|
|
layoutManager.Add("ScanTime", QueryCreator.TimeRange(mDFInfo.Fields["ScanTime"],mQueryContainer, "MinScanTime", "MaxScanTime"));
|
|
|
layoutManager.Add("UploadTime", QueryCreator.TimeRange(mDFInfo.Fields["UploadTime"], mQueryContainer, "MinUploadTime", "MaxUploadTime"));
|
|
|
var config = new AutoLayoutConfig();
|
|
|
config.Add("BarCode");
|
|
|
config.Add("ScanTime");
|
|
|
config.Add("UploadTime");
|
|
|
layoutManager.Config = config;
|
|
|
vPanel.Add(layoutManager.CreateLayout());
|
|
|
base.CreateQuery(vPanel);
|
|
|
}
|
|
|
|
|
|
|
|
|
protected override void AddSelectButtons(Control parent)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
protected override void CreateQueryGridColumns(DFBrowseGrid grid)
|
|
|
{
|
|
|
grid.Columns.Add(new DFBrowseGridColumn("BarCode") { HeaderText = "条码"});
|
|
|
grid.Columns.Add(new DFBrowseGridColumn("goodsName") { HeaderText = "存货名称"});
|
|
|
grid.Columns.Add(new DFBrowseGridColumn("MainUnit") { HeaderText = "主单位"});
|
|
|
grid.Columns.Add(new DFBrowseGridColumn("PWeight") { HeaderText = "主数量"});
|
|
|
grid.Columns.Add(new DFBrowseGridColumn("SecondUnit") { HeaderText = "辅单位"});
|
|
|
grid.Columns.Add(new DFBrowseGridColumn("Num") { HeaderText = "辅数量"});
|
|
|
grid.Columns.Add(new DFBrowseGridColumn("ScanTime") { HeaderText = "扫描时间" });
|
|
|
grid.Columns.Add(new DFBrowseGridColumn("UploadTime") { HeaderText = "上传时间" });
|
|
|
}
|
|
|
|
|
|
protected override Forks.EnterpriseServices.DomainObjects2.DQuery.DQueryDom GetQueryDom()
|
|
|
{
|
|
|
var ceBarCode = new JoinAlias("_s",typeof(StockTakeCEUploadBarCode));
|
|
|
var barCode = new JoinAlias("_l",typeof(BarCodeProductionInfo));
|
|
|
var rightBarCode = new JoinAlias("_r",typeof(BarCodeProductionInfo));
|
|
|
var goods = new JoinAlias("_g",typeof(BWP.B3CowButcherManage.BO.Goods));
|
|
|
var query = new DQueryDom(ceBarCode);
|
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(barCode),DQCondition.And(DQCondition.EQ(barCode,"BarType",3),DQCondition.EQ(ceBarCode, "BarCode", barCode, "BarCode")));
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(goods),DQCondition.EQ(barCode, "Goods_ID", goods, "ID"));
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(rightBarCode), DQCondition.EQ(barCode, "ID", rightBarCode, "PackageID"));
|
|
|
query.Columns.Add(DQSelectColumn.Field("BarCode", ceBarCode));
|
|
|
query.Columns.Add(DQSelectColumn.Field("ScanTime", ceBarCode));
|
|
|
query.Columns.Add(DQSelectColumn.Field("UploadTime", ceBarCode));
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goods, "Name"), "goodsName"));
|
|
|
query.Columns.Add(DQSelectColumn.Field("MainUnit", goods));
|
|
|
query.Columns.Add(DQSelectColumn.Field("SecondUnit", goods));
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.LogicCase(DQCondition.IsNull(DQExpression.Field(goods, "PackageWeight")),DQExpression.Sum(DQExpression.Field(rightBarCode,"Weight")), DQExpression.Field(goods, "PackageWeight")), "PWeight"));
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Count(DQExpression.Field(rightBarCode,"ID")), "Num"));
|
|
|
query.Where.Conditions.Add(DQCondition.Or(DQCondition.IsNull(DQExpression.Field(barCode,"IsOpen")),DQCondition.EQ(barCode,"IsOpen",false)));
|
|
|
query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field(barCode, "PickTime")));
|
|
|
if (!string.IsNullOrEmpty(Request.QueryString["Store_ID"]))
|
|
|
{
|
|
|
var storeId = long.Parse(Request.QueryString["Store_ID"].ToString());
|
|
|
query.Where.Conditions.Add(DQCondition.EQ(rightBarCode, "Store_ID", storeId));
|
|
|
}
|
|
|
var txtbarCode = mQueryContainer.GetControl<DFTextBox>("BarCode");
|
|
|
if (!txtbarCode.IsEmpty)
|
|
|
{
|
|
|
query.Where.Conditions.Add(DQCondition.Like(ceBarCode,"BarCode",txtbarCode.Text));
|
|
|
}
|
|
|
var minScanTime = mQueryContainer.GetControl<DFDateTimeInput>("MinScanTime");
|
|
|
var maxScanTime = mQueryContainer.GetControl<DFDateTimeInput>("MaxScanTime");
|
|
|
var minUploadTime = mQueryContainer.GetControl<DFDateTimeInput>("MinUploadTime");
|
|
|
var maxUploadTime = mQueryContainer.GetControl<DFDateTimeInput>("MaxUploadTime");
|
|
|
if (!minScanTime.IsEmpty)
|
|
|
{
|
|
|
query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(ceBarCode, "ScanTime", minScanTime.Value));
|
|
|
}
|
|
|
if (!maxScanTime.IsEmpty)
|
|
|
{
|
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual(ceBarCode, "ScanTime", maxScanTime.Value));
|
|
|
}
|
|
|
if (!minUploadTime.IsEmpty)
|
|
|
{
|
|
|
query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(ceBarCode, "UploadTime", minUploadTime.Value));
|
|
|
}
|
|
|
if (!maxUploadTime.IsEmpty)
|
|
|
{
|
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual(ceBarCode, "UploadTime", maxUploadTime.Value));
|
|
|
}
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field("BarCode"));
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field("ScanTime"));
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field("UploadTime"));
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field(goods,"Name"));
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field(goods, "MainUnit"));
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field(goods, "SecondUnit"));
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field(goods, "PackageWeight"));
|
|
|
|
|
|
var ceBarCode2 = new JoinAlias("_s2",typeof(StockTakeCEUploadBarCode));
|
|
|
var barCode2 = new JoinAlias("_l2",typeof(BarCodeProductionInfo));
|
|
|
var goods2 = new JoinAlias("_g2",typeof(BWP.B3CowButcherManage.BO.Goods));
|
|
|
var query2 = new DQueryDom(ceBarCode2);
|
|
|
query2.From.AddJoin(JoinType.Inner, new DQDmoSource(barCode2), DQCondition.And(DQCondition.InEQ(barCode2, "BarType", 3), DQCondition.EQ(ceBarCode2, "BarCode", barCode2, "BarCode")));
|
|
|
query2.From.AddJoin(JoinType.Left, new DQDmoSource(goods2), DQCondition.EQ(barCode2, "Goods_ID", goods2, "ID"));
|
|
|
query2.Columns.Add(DQSelectColumn.Field("BarCode", ceBarCode2));
|
|
|
query2.Columns.Add(DQSelectColumn.Field("ScanTime", ceBarCode2));
|
|
|
query2.Columns.Add(DQSelectColumn.Field("UploadTime", ceBarCode2));
|
|
|
query2.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goods2, "Name"), "goodsName"));
|
|
|
query2.Columns.Add(DQSelectColumn.Field("MainUnit", goods2));
|
|
|
query2.Columns.Add(DQSelectColumn.Field("SecondUnit", goods2));
|
|
|
query2.Columns.Add(DQSelectColumn.Field("Weight", barCode2, "PWeight"));
|
|
|
query2.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet<int>("1"), "Num"));
|
|
|
query2.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field(barCode2,"PackageID")));
|
|
|
query2.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field(barCode2, "InStoreTime")));
|
|
|
query2.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field(barCode2, "PickTime")));
|
|
|
|
|
|
if (!txtbarCode.IsEmpty)
|
|
|
{
|
|
|
query2.Where.Conditions.Add(DQCondition.Like(ceBarCode2, "BarCode", txtbarCode.Text));
|
|
|
}
|
|
|
if (!minScanTime.IsEmpty)
|
|
|
{
|
|
|
query2.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(ceBarCode2, "ScanTime", minScanTime.Value));
|
|
|
}
|
|
|
if (!maxScanTime.IsEmpty)
|
|
|
{
|
|
|
query2.Where.Conditions.Add(DQCondition.LessThanOrEqual(ceBarCode2, "ScanTime", maxScanTime.Value));
|
|
|
}
|
|
|
if (!minUploadTime.IsEmpty)
|
|
|
{
|
|
|
query2.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(ceBarCode2, "UploadTime", minUploadTime.Value));
|
|
|
}
|
|
|
if (!maxUploadTime.IsEmpty)
|
|
|
{
|
|
|
query2.Where.Conditions.Add(DQCondition.LessThanOrEqual(ceBarCode2, "UploadTime", maxUploadTime.Value));
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(Request.QueryString["Store_ID"]))
|
|
|
{
|
|
|
var storeId = long.Parse(Request.QueryString["Store_ID"].ToString());
|
|
|
query2.Where.Conditions.Add(DQCondition.EQ(barCode2, "Store_ID", storeId));
|
|
|
}
|
|
|
query.UnionNext.Select = query2;
|
|
|
query.UnionNext.Type = UnionType.Default;
|
|
|
return query;
|
|
|
}
|
|
|
}
|
|
|
}
|