| @ -0,0 +1,210 @@ | |||||
| using BWP.B3Frameworks; | |||||
| using BWP.B3Frameworks.BO.NamedValueTemplate; | |||||
| using BWP.B3Frameworks.Utils; | |||||
| using BWP.B3Sale.BO; | |||||
| using BWP.B3Sale.Utils; | |||||
| using BWP.Web.Layout; | |||||
| using BWP.Web.Utils; | |||||
| using Forks.EnterpriseServices.DataForm; | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||||
| using Forks.EnterpriseServices.SqlDoms; | |||||
| using Forks.Utils; | |||||
| 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; | |||||
| namespace BWP.Web.Pages.B3YunKen.Dialogs | |||||
| { | |||||
| public class ReturnApplication_CustomerAcceptDialog : AppBasePage | |||||
| { | |||||
| protected QueryContainer mQueryContainer; | |||||
| protected static DFInfo mDFInfo = DFInfo.Get(typeof(CustomerAccept)); | |||||
| protected DFContainer dfContainer; | |||||
| 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); | |||||
| CreateQuery(vPanel); | |||||
| CreateQueryGrid(vPanel); | |||||
| } | |||||
| private void CreateQuery(VLayoutPanel vPanel) | |||||
| { | |||||
| var layoutManager = new LayoutManager("", mDFInfo, mQueryContainer); | |||||
| var config = new AutoLayoutConfig(); | |||||
| layoutManager.Config = config; | |||||
| config.Add("ID"); | |||||
| config.Add("LoadTime"); | |||||
| config.Add("AccountingUnit_ID"); | |||||
| config.Add("Customer_ID"); | |||||
| vPanel.Add(layoutManager.CreateLayout()); | |||||
| HLayoutPanel hPanel = new HLayoutPanel() { Align = HorizontalAlign.Left }; | |||||
| TSButton qButton = new TSButton("开始查询"); | |||||
| hPanel.Add(qButton); | |||||
| qButton.Click += delegate | |||||
| { | |||||
| _grid.Query = GetDQueryDom(); | |||||
| _grid.DataBind(); | |||||
| }; | |||||
| dfContainer.AddNonDFControl(qButton, "$btnsearch"); | |||||
| hPanel.Add(new RedirectTSButton("清除条件")); | |||||
| vPanel.Add(hPanel); | |||||
| } | |||||
| DFBrowseGrid _grid; | |||||
| void CreateQueryGrid(VLayoutPanel panel) | |||||
| { | |||||
| _grid = new DFBrowseGrid(new DFDataTableEditor()) | |||||
| { | |||||
| Width = Unit.Percentage(100) | |||||
| }; | |||||
| _grid.MultiSelectionEnabled = true; | |||||
| CreateQueryGridColumns(_grid); | |||||
| panel.Add(_grid); | |||||
| var hPanel = new HLayoutPanel() { Align = HorizontalAlign.Left }; | |||||
| var button = new TSButton("选中"); | |||||
| hPanel.Add(button); | |||||
| panel.Add(hPanel); | |||||
| button.Click += GridMultiSelection; | |||||
| } | |||||
| void GridMultiSelection(object sender, EventArgs e) | |||||
| { | |||||
| IList<ReturnApplication_Detail> selectedList = new List<ReturnApplication_Detail>(); | |||||
| _grid.GetFromUI(); | |||||
| foreach (var row in _grid.GetSelectedItems()) | |||||
| { | |||||
| if ((Money<decimal>?)row["UnitNum"] < (Money<decimal>?)row["退货报价数量"]) | |||||
| { | |||||
| throw new Exception("退货数量不得超过出库数量!"); | |||||
| } | |||||
| var detail = new ReturnApplication_Detail(); | |||||
| detail.CustomerAccept_ID = (long?)row["ID"]; | |||||
| detail.SaleGoods_ID = (long)row["SaleGoods_ID"]; | |||||
| detail.Goods_Name = (string)row["Goods_Name"]; | |||||
| detail.Goods_Code = (string)row["Goods_Code"]; | |||||
| detail.Goods_Spec = (string)row["Goods_Spec"]; | |||||
| detail.Unit = (string)row["Unit"]; | |||||
| detail.UnitNum = (Money<decimal>?)row["退货报价数量"]; | |||||
| detail.Goods_SecondUnit = (string)row["Goods_SecondUnit"]; | |||||
| //detail.SecondNumber = (Money<decimal>?)row["UnitNum"] * (Money<decimal>?)row["RightRatio"]; | |||||
| detail.Price = (Money<decimal>?)row["Price"]; | |||||
| detail.Goods_UnitConvertDirection = (NamedValue<主辅转换方向>?)row["Goods_UnitConvertDirection"]; | |||||
| detail.Goods_MainUnitRatio = (Money<decimal>?)row["Goods_MainUnitRatio"]; | |||||
| detail.Goods_SecondUnitRatio = (Money<decimal>?)row["Goods_SecondUnitRatio"]; | |||||
| detail.LeftRatio = (Money<decimal>)row["LeftRatio"]; | |||||
| detail.RightRatio = (Money<decimal>)row["RightRatio"]; | |||||
| detail.Money = detail.Price * detail.UnitNum; | |||||
| detail.CustomerAcceptDetail_ID = (long)row["DetailID"]; | |||||
| detail.Customer_ID = (long?)row["Customer_ID"]; | |||||
| detail.Customer_Name = (string)row["Customer_Name"]; | |||||
| detail.ReturnsManner = 退货处理方式.退货拉回; | |||||
| detail.GoodsBatch_ID = (long?)row["GoodsBatch_ID"]; | |||||
| detail.GoodsBatch_Name = (string)row["GoodsBatch_Name"]; | |||||
| detail.BrandItem_ID = (long?)row["BrandItem_ID"]; | |||||
| detail.BrandItem_Name = (string)row["BrandItem_Name"]; | |||||
| selectedList.Add(detail); | |||||
| } | |||||
| DialogUtil.SetCachedObj(this, selectedList); | |||||
| } | |||||
| void CreateQueryGridColumns(DFBrowseGrid grid) | |||||
| { | |||||
| grid.Columns.Add(new DFBrowseGridAutoColumn("退货报价数量", "Goods_UnitConvertDirection", "Goods_MainUnitRatio", "Goods_SecondUnitRatio", "LeftRatio", "RightRatio", "DetailID", "Customer_ID", "GoodsBatch_ID", "GoodsBatch_Name", "BrandItem_ID")); | |||||
| grid.Columns.Add(new DFEditGridColumn<DFTextBox>("退货报价数量")); | |||||
| } | |||||
| protected override void OnLoad(EventArgs e) | |||||
| { | |||||
| base.OnLoad(e); | |||||
| if (!IsPostBack) | |||||
| { | |||||
| _grid.Query = GetDQueryDom(); | |||||
| _grid.DataBind(); | |||||
| } | |||||
| } | |||||
| private class ReturnApplicationData | |||||
| { | |||||
| public Money<decimal>? UnitNum { get; set; } | |||||
| public long? CustomerAcceptDetail_ID { get; set; } | |||||
| } | |||||
| private DQueryDom GetReturnApplication() | |||||
| { | |||||
| var returnApplication = new JoinAlias(typeof(ReturnApplication)); | |||||
| var returnApplication_Detail = new JoinAlias(typeof(ReturnApplication_Detail)); | |||||
| var query = new DQueryDom(returnApplication); | |||||
| query.From.AddJoin(JoinType.Left, new DQDmoSource(returnApplication_Detail), DQCondition.EQ(returnApplication_Detail, "ReturnApplication_ID", returnApplication, "ID")); | |||||
| query.Columns.Add(DQSelectColumn.Sum(returnApplication_Detail, "UnitNum")); | |||||
| query.Columns.Add(DQSelectColumn.Field("CustomerAcceptDetail_ID", returnApplication_Detail)); | |||||
| query.GroupBy.Expressions.Add(DQExpression.Field(returnApplication_Detail, "CustomerAcceptDetail_ID")); | |||||
| return query; | |||||
| } | |||||
| private DQueryDom GetDQueryDom() | |||||
| { | |||||
| DQueryDom dom = mQueryContainer.Build(); | |||||
| var returnApplicationData = new JoinAlias(typeof(ReturnApplicationData)); | |||||
| dom.RegisterQueryTable(typeof(ReturnApplicationData), new string[] { "UnitNum", "CustomerAcceptDetail_ID" }, GetReturnApplication()); | |||||
| var notedetail = new JoinAlias(typeof(CustomerAccept_Detail)); | |||||
| dom.From.AddJoin(JoinType.Right, new DQDmoSource(notedetail), DQCondition.EQ(dom.From.RootSource.Alias, "ID", notedetail, "CustomerAccept_ID")); | |||||
| dom.From.AddJoin(JoinType.Left, new DQDmoSource(returnApplicationData), DQCondition.EQ(notedetail, "ID", returnApplicationData, "CustomerAcceptDetail_ID")); | |||||
| dom.Columns.Add(DQSelectColumn.Field("LoadTime")); | |||||
| dom.Columns.Add(DQSelectColumn.Field("ID", dom.From.RootSource.Alias)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Customer_ID", dom.From.RootSource.Alias)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Customer_Name", dom.From.RootSource.Alias)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("SaleGoods_ID", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_Name", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_Code", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_Spec", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Unit", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("UnitNum", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_SecondUnit", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("SecondNumber", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Price", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_UnitConvertDirection", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_MainUnitRatio", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_SecondUnitRatio", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("LeftRatio", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("RightRatio", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(notedetail, "ID"), "DetailID")); | |||||
| dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet<Money<decimal>?>("null"), "退货报价数量")); | |||||
| dom.Columns.Add(DQSelectColumn.Field("GoodsBatch_ID", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("GoodsBatch_Name", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("BrandItem_ID", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("BrandItem_Name", notedetail)); | |||||
| dom.Where.Conditions.Add(DQCondition.Or(DQCondition.EQ(dom.From.RootSource.Alias, "BillState", 单据状态.已完毕), DQCondition.EQ(dom.From.RootSource.Alias, "BillState", 单据状态.已审核))); | |||||
| dom.Where.Conditions.Add(DQCondition.EQ(dom.From.RootSource.Alias, "Domain_ID", DomainContext.Current.ID)); | |||||
| dom.Where.Conditions.Add(DQCondition.LessThan(DQExpression.IfNull(DQExpression.Field(returnApplicationData, "UnitNum"), DQExpression.Value(0)), DQExpression.Field(notedetail, "UnitNum"))); | |||||
| if (Request.QueryString["Customer_ID"] != "") | |||||
| { | |||||
| dom.Where.Conditions.Add(DQCondition.EQ(dom.From.RootSource.Alias, "Customer_ID", long.Parse(Request["Customer_ID"]))); | |||||
| } | |||||
| if (Request.QueryString["AccountingUnit_ID"] != "") | |||||
| { | |||||
| dom.Where.Conditions.Add(DQCondition.EQ(dom.From.RootSource.Alias, "AccountingUnit_ID", long.Parse(Request["AccountingUnit_ID"]))); | |||||
| } | |||||
| return dom; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,28 @@ | |||||
| <?xml version="1.0" encoding="utf-8" ?> | |||||
| <Select xmlns="urn:XDQuery"> | |||||
| <Columns> | |||||
| </Columns> | |||||
| <From> | |||||
| <DmoClass class="BWP.B3Sale.BO.CustomerAccept, B3Sale"/> | |||||
| </From> | |||||
| <Where> | |||||
| <And> | |||||
| <EQ> | |||||
| <Field name="ID" /> | |||||
| <QBE paramName="ID"/> | |||||
| </EQ> | |||||
| <EQ> | |||||
| <Field name="Customer_ID"/> | |||||
| <QBE paramName="Customer_ID"/> | |||||
| </EQ> | |||||
| <GreaterThanOrEqual> | |||||
| <Field name="LoadTime"/> | |||||
| <QBE paramName="MinLoadTime" /> | |||||
| </GreaterThanOrEqual> | |||||
| <LessThanOrEqual> | |||||
| <Field name="LoadTime"/> | |||||
| <QBE paramName="MaxLoadTime"/> | |||||
| </LessThanOrEqual> | |||||
| </And> | |||||
| </Where> | |||||
| </Select> | |||||
| @ -0,0 +1,244 @@ | |||||
| using BWP.B3Frameworks; | |||||
| using BWP.B3Frameworks.BO.MoneyTemplate; | |||||
| using BWP.B3Frameworks.BO.NamedValueTemplate; | |||||
| using BWP.B3Frameworks.Utils; | |||||
| using BWP.B3Sale.BO; | |||||
| using BWP.B3Sale.Utils; | |||||
| using BWP.Web.Layout; | |||||
| using BWP.Web.Utils; | |||||
| using Forks.EnterpriseServices.DataForm; | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||||
| using Forks.EnterpriseServices.SqlDoms; | |||||
| using Forks.Utils; | |||||
| 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; | |||||
| namespace BWP.Web.Pages.B3YunKen.Dialogs | |||||
| { | |||||
| public class ReturnInStore_CustomerAcceptDialog : AppBasePage | |||||
| { | |||||
| protected QueryContainer mQueryContainer; | |||||
| protected static DFInfo mDFInfo = DFInfo.Get(typeof(CustomerAccept)); | |||||
| protected DFContainer dfContainer; | |||||
| long? AccountingUnit_ID | |||||
| { | |||||
| get | |||||
| { | |||||
| var str = Request.QueryString["accountingUnit_ID"]; | |||||
| if (string.IsNullOrEmpty(str)) | |||||
| { | |||||
| return null; | |||||
| } | |||||
| return long.Parse(str); | |||||
| } | |||||
| } | |||||
| 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); | |||||
| CreateQuery(vPanel); | |||||
| CreateQueryGrid(vPanel); | |||||
| } | |||||
| private void CreateQuery(VLayoutPanel vPanel) | |||||
| { | |||||
| var layoutManager = new LayoutManager("", mDFInfo, mQueryContainer); | |||||
| var config = new AutoLayoutConfig(); | |||||
| layoutManager.Config = config; | |||||
| config.Add("ID"); | |||||
| config.Add("LoadTime"); | |||||
| config.Add("Customer_ID"); | |||||
| vPanel.Add(layoutManager.CreateLayout()); | |||||
| HLayoutPanel hPanel = new HLayoutPanel() { Align = HorizontalAlign.Left }; | |||||
| TSButton qButton = new TSButton("开始查询"); | |||||
| hPanel.Add(qButton); | |||||
| qButton.Click += delegate | |||||
| { | |||||
| _grid.Query = GetDQueryDom(); | |||||
| _grid.DataBind(); | |||||
| }; | |||||
| dfContainer.AddNonDFControl(qButton, "$btnsearch"); | |||||
| hPanel.Add(new RedirectTSButton("清除条件")); | |||||
| vPanel.Add(hPanel); | |||||
| } | |||||
| DFBrowseGrid _grid; | |||||
| void CreateQueryGrid(VLayoutPanel panel) | |||||
| { | |||||
| _grid = new DFBrowseGrid(new DFDataTableEditor()) | |||||
| { | |||||
| Width = Unit.Percentage(100) | |||||
| }; | |||||
| _grid.MultiSelectionEnabled = true; | |||||
| CreateQueryGridColumns(_grid); | |||||
| panel.Add(_grid); | |||||
| var hPanel = new HLayoutPanel() { Align = HorizontalAlign.Left }; | |||||
| var button = new TSButton("选中"); | |||||
| hPanel.Add(button); | |||||
| panel.Add(hPanel); | |||||
| button.Click += GridMultiSelection; | |||||
| } | |||||
| void GridMultiSelection(object sender, EventArgs e) | |||||
| { | |||||
| IList<ReturnInStore_Detail> selectedList = new List<ReturnInStore_Detail>(); | |||||
| _grid.GetFromUI(); | |||||
| foreach (var row in _grid.GetSelectedItems()) | |||||
| { | |||||
| if ((Money<decimal>?)row["UnitNum"] < (Money<decimal>?)row["退货报价数量"]) | |||||
| { | |||||
| throw new Exception("退货数量不得超过出库数量!"); | |||||
| } | |||||
| var detail = new ReturnInStore_Detail(); | |||||
| detail.CustomerAccept_ID = (long?)row["ID"]; | |||||
| detail.SaleGoods_ID = (long)row["SaleGoods_ID"]; | |||||
| detail.Goods_Name = (string)row["Goods_Name"]; | |||||
| detail.Goods_Code = (string)row["Goods_Code"]; | |||||
| detail.Goods_Spec = (string)row["Goods_Spec"]; | |||||
| detail.Unit = (string)row["Unit"]; | |||||
| detail.UnitNum = (Money<decimal>?)row["退货报价数量"]; | |||||
| detail.SecondNumber = (Money<decimal>?)row["退货报价辅数量"]; | |||||
| detail.Goods_SecondUnit = (string)row["Goods_SecondUnit"]; | |||||
| detail.Price = (Money<decimal>?)row["Price"]; | |||||
| detail.Goods_UnitConvertDirection = (NamedValue<主辅转换方向>?)row["Goods_UnitConvertDirection"]; | |||||
| detail.Goods_MainUnitRatio = (Money<decimal>?)row["Goods_MainUnitRatio"]; | |||||
| detail.Goods_SecondUnitRatio = (Money<decimal>?)row["Goods_SecondUnitRatio"]; | |||||
| detail.LeftRatio = (Money<decimal>)row["LeftRatio"]; | |||||
| detail.RightRatio = (Money<decimal>)row["RightRatio"]; | |||||
| detail.Money = detail.Price * detail.UnitNum; | |||||
| detail.CustomerAcceptDetail_ID = (long)row["DetailID"]; | |||||
| detail.Customer_ID = (long?)row["Customer_ID"]; | |||||
| detail.Customer_Name = (string)row["Customer_Name"]; | |||||
| detail.ReturnsManner = 退货处理方式.退货拉回; | |||||
| detail.GoodsBatch_ID = (long?)row["GoodsBatch_ID"]; | |||||
| detail.GoodsBatch_Name = (string)row["GoodsBatch_Name"]; | |||||
| detail.GoodsTaxRate = (Money<税率>?)row["GoodsTaxRate"]; | |||||
| detail.BrandItem_ID = (long?)row["BrandItem_ID"]; | |||||
| detail.BrandItem_Name = (string)row["BrandItem_Name"]; | |||||
| if (detail.LeftRatio != 0) | |||||
| detail.Number = detail.UnitNum / detail.LeftRatio * detail.RightRatio; | |||||
| else | |||||
| { | |||||
| detail.Number = detail.UnitNum; | |||||
| } | |||||
| if (detail.Goods_UnitConvertDirection == 主辅转换方向.双向转换 || detail.Goods_UnitConvertDirection == 主辅转换方向.由主至辅) | |||||
| { | |||||
| detail.SecondNumber = detail.Number / (detail.Goods_MainUnitRatio ?? 1) * (detail.Goods_SecondUnitRatio ?? 1); | |||||
| } | |||||
| selectedList.Add(detail); | |||||
| } | |||||
| DialogUtil.SetCachedObj(this, selectedList); | |||||
| } | |||||
| void CreateQueryGridColumns(DFBrowseGrid grid) | |||||
| { | |||||
| grid.Columns.Add(new DFBrowseGridAutoColumn("退货报价数量", "退货报价辅数量", "Goods_UnitConvertDirection", "Goods_MainUnitRatio", "Goods_SecondUnitRatio", "LeftRatio", "RightRatio", "DetailID", "Customer_ID", "GoodsBatch_ID", "GoodsBatch_Name", "BrandItem_ID")); | |||||
| grid.Columns.Add(new DFEditGridColumn<DFTextBox>("退货报价数量")); | |||||
| grid.Columns.Add(new DFEditGridColumn<DFTextBox>("退货报价辅数量")); | |||||
| grid.ValueColumns.Add("Goods_SecondUnitRatio"); | |||||
| grid.ValueColumns.Add("Goods_MainUnitRatio"); | |||||
| grid.ValueColumns.Add("LeftRatio"); | |||||
| grid.ValueColumns.Add("RightRatio"); | |||||
| grid.ValueColumns.Add("Goods_UnitConvertDirection"); | |||||
| new MainToSecondConvertRowMangerWithMoneyChange(grid, "退货报价数量", "退货报价辅数量"); | |||||
| } | |||||
| protected override void OnLoad(EventArgs e) | |||||
| { | |||||
| base.OnLoad(e); | |||||
| if (!IsPostBack) | |||||
| { | |||||
| _grid.Query = GetDQueryDom(); | |||||
| _grid.DataBind(); | |||||
| } | |||||
| } | |||||
| private class ReturnInStoreData | |||||
| { | |||||
| public Money<decimal>? UnitNum { get; set; } | |||||
| public long? CustomerAcceptDetail_ID { get; set; } | |||||
| } | |||||
| private DQueryDom GetReturnInStore() | |||||
| { | |||||
| var returnInStore = new JoinAlias(typeof(ReturnInStore)); | |||||
| var returnInStore_Detail = new JoinAlias(typeof(ReturnInStore_Detail)); | |||||
| var query = new DQueryDom(returnInStore); | |||||
| query.From.AddJoin(JoinType.Left, new DQDmoSource(returnInStore_Detail), DQCondition.EQ(returnInStore_Detail, "ReturnInStore_ID", returnInStore, "ID")); | |||||
| query.Columns.Add(DQSelectColumn.Sum(returnInStore_Detail, "UnitNum")); | |||||
| query.Columns.Add(DQSelectColumn.Field("CustomerAcceptDetail_ID", returnInStore_Detail)); | |||||
| query.GroupBy.Expressions.Add(DQExpression.Field(returnInStore_Detail, "CustomerAcceptDetail_ID")); | |||||
| return query; | |||||
| } | |||||
| private DQueryDom GetDQueryDom() | |||||
| { | |||||
| DQueryDom dom = mQueryContainer.Build(); | |||||
| var notedetail = new JoinAlias(typeof(CustomerAccept_Detail)); | |||||
| var returnInStoreData = new JoinAlias(typeof(ReturnInStoreData)); | |||||
| dom.RegisterQueryTable(typeof(ReturnInStoreData), new string[] { "UnitNum", "CustomerAcceptDetail_ID" }, GetReturnInStore()); | |||||
| dom.From.AddJoin(JoinType.Right, new DQDmoSource(notedetail), DQCondition.EQ(dom.From.RootSource.Alias, "ID", notedetail, "CustomerAccept_ID")); | |||||
| dom.From.AddJoin(JoinType.Left, new DQDmoSource(returnInStoreData), DQCondition.EQ(notedetail, "ID", returnInStoreData, "CustomerAcceptDetail_ID")); | |||||
| dom.Where.Conditions.Add(DQCondition.Or(DQCondition.EQ(dom.From.RootSource.Alias, "BillState", 单据状态.已完毕), DQCondition.EQ(dom.From.RootSource.Alias, "BillState", 单据状态.已审核))); | |||||
| dom.Columns.Add(DQSelectColumn.Field("LoadTime")); | |||||
| dom.Columns.Add(DQSelectColumn.Field("ID", dom.From.RootSource.Alias)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Customer_ID", dom.From.RootSource.Alias)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Customer_Name", dom.From.RootSource.Alias)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("SaleGoods_ID", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_Name", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_Code", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_Spec", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Unit", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("UnitNum", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_SecondUnit", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("SecondNumber", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Price", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_UnitConvertDirection", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_MainUnitRatio", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("Goods_SecondUnitRatio", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("LeftRatio", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("RightRatio", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(notedetail, "ID"), "DetailID")); | |||||
| dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet<Money<decimal>?>("null"), "退货报价数量")); | |||||
| dom.Columns.Add(DQSelectColumn.Create(DQExpression.Snippet<Money<decimal>?>("null"), "退货报价辅数量")); | |||||
| dom.Columns.Add(DQSelectColumn.Field("GoodsBatch_ID", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("GoodsBatch_Name", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("GoodsTaxRate", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("BrandItem_ID", notedetail)); | |||||
| dom.Columns.Add(DQSelectColumn.Field("BrandItem_Name", notedetail)); | |||||
| dom.Where.Conditions.Add(DQCondition.EQ(dom.From.RootSource.Alias, "Domain_ID", DomainContext.Current.ID)); | |||||
| dom.Where.Conditions.Add(DQCondition.EQ(dom.From.RootSource.Alias, "AccountingUnit_ID", AccountingUnit_ID)); | |||||
| dom.Where.Conditions.Add(DQCondition.LessThan(DQExpression.IfNull(DQExpression.Field(returnInStoreData, "UnitNum"), DQExpression.Value(0)), DQExpression.Field(notedetail, "UnitNum"))); | |||||
| if (Request.QueryString["Customer_ID"] != "") | |||||
| { | |||||
| dom.Where.Conditions.Add(DQCondition.EQ(dom.From.RootSource.Alias, "Customer_ID", long.Parse(Request["Customer_ID"]))); | |||||
| } | |||||
| return dom; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,28 @@ | |||||
| <?xml version="1.0" encoding="utf-8" ?> | |||||
| <Select xmlns="urn:XDQuery"> | |||||
| <Columns> | |||||
| </Columns> | |||||
| <From> | |||||
| <DmoClass class="BWP.B3Sale.BO.CustomerAccept, B3Sale"/> | |||||
| </From> | |||||
| <Where> | |||||
| <And> | |||||
| <EQ> | |||||
| <Field name="ID" /> | |||||
| <QBE paramName="ID"/> | |||||
| </EQ> | |||||
| <EQ> | |||||
| <Field name="Customer_ID"/> | |||||
| <QBE paramName="Customer_ID"/> | |||||
| </EQ> | |||||
| <GreaterThanOrEqual> | |||||
| <Field name="LoadTime"/> | |||||
| <QBE paramName="MinLoadTime" /> | |||||
| </GreaterThanOrEqual> | |||||
| <LessThanOrEqual> | |||||
| <Field name="LoadTime"/> | |||||
| <QBE paramName="MaxLoadTime"/> | |||||
| </LessThanOrEqual> | |||||
| </And> | |||||
| </Where> | |||||
| </Select> | |||||
| @ -0,0 +1,57 @@ | |||||
| using BWP.B3Sale.BO; | |||||
| using BWP.Web.Pages.B3Sale.Bills.ReturnApplication_; | |||||
| using BWP.Web.Utils; | |||||
| using BWP.Web.WebControls; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using TSingSoft.WebControls2; | |||||
| namespace BWP.Web.Pages.B3YunKen.Overlays | |||||
| { | |||||
| class ReturnApplicationEdit_Ext : ReturnApplicationEdit | |||||
| { | |||||
| protected override void BeforeDetailGridApplyLayout(DFEditGrid dFEditGrid) | |||||
| { | |||||
| dFEditGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("CustomerAccept_ID")); | |||||
| } | |||||
| protected override void AddDetailBtnHPanel(HLayoutPanel hPanel, Func<DFEditGrid> getDetailGrid) | |||||
| { | |||||
| if (CanSave) | |||||
| { | |||||
| var storebutton = hPanel.Add(new DialogButton | |||||
| { | |||||
| Text = "选择客户验收单", | |||||
| }); | |||||
| // storebutton.Url = AspUtil.AddParamToUrl("~/B3Sale/Bills/ReturnInStore_/SaleOutStoreDialog.aspx", "Customer_ID", "'+__DFContainer.getValue('Customer_ID')+'"); | |||||
| storebutton.Url = | |||||
| "~/B3YunKen/Dialogs/ReturnApplication_CustomerAcceptDialog.aspx?accountingUnit_ID='+__DFContainer.getValue('AccountingUnit_ID')+'&Customer_ID='+__DFContainer.getValue('Customer_ID')+'"; | |||||
| storebutton.Click += delegate | |||||
| { | |||||
| var detailGrid = getDetailGrid(); | |||||
| detailGrid.GetFromUI(); | |||||
| var details = DialogUtil.GetCachedObj<ReturnApplication_Detail>(this); | |||||
| foreach (var returnDetail in details) | |||||
| { | |||||
| if (Dmo.Details.Any(x => x.CustomerAcceptDetail_ID == returnDetail.CustomerAcceptDetail_ID)) | |||||
| continue; | |||||
| Dmo.Details.Add(returnDetail); | |||||
| } | |||||
| detailGrid.DataBind(); | |||||
| }; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,54 @@ | |||||
| using BWP.B3Sale.BO; | |||||
| using BWP.Web.Pages.B3Sale.Bills.ReturnInStore_; | |||||
| using BWP.Web.Utils; | |||||
| using BWP.Web.WebControls; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using TSingSoft.WebControls2; | |||||
| namespace BWP.Web.Pages.B3YunKen.Overlays | |||||
| { | |||||
| class ReturnInStoreEdit_Ext: ReturnInStoreEdit | |||||
| { | |||||
| protected override void BeforeDetailGridApplyLayout(DFEditGrid dFEditGrid) | |||||
| { | |||||
| dFEditGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("CustomerAccept_ID")); | |||||
| } | |||||
| protected override void AddDetailBtnHPanel(HLayoutPanel hPanel, Func<DFEditGrid> getDetailGrid) | |||||
| { | |||||
| if (CanSave) | |||||
| { | |||||
| var storebutton = hPanel.Add(new DialogButton | |||||
| { | |||||
| Text = "选择客户验收单", | |||||
| }); | |||||
| // storebutton.Url = AspUtil.AddParamToUrl("~/B3Sale/Bills/ReturnInStore_/SaleOutStoreDialog.aspx", "Customer_ID", "'+__DFContainer.getValue('Customer_ID')+'"); | |||||
| storebutton.Url = | |||||
| "~/B3YunKen/Dialogs/ReturnInStore_CustomerAcceptDialog.aspx?accountingUnit_ID='+__DFContainer.getValue('AccountingUnit_ID')+'&Customer_ID='+__DFContainer.getValue('Customer_ID')+'"; | |||||
| storebutton.Click += delegate | |||||
| { | |||||
| var detailGrid = getDetailGrid(); | |||||
| detailGrid.GetFromUI(); | |||||
| var details = DialogUtil.GetCachedObj<ReturnInStore_Detail>(this); | |||||
| foreach (var returnDetail in details) | |||||
| { | |||||
| if (Dmo.Details.Any(x => x.CustomerAcceptDetail_ID == returnDetail.CustomerAcceptDetail_ID)) | |||||
| continue; | |||||
| Dmo.Details.Add(returnDetail); | |||||
| } | |||||
| detailGrid.DataBind(); | |||||
| }; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||