我正在使用“操作”下拉列表和选择器的过程屏幕上工作。我希望选择器显示基于所选操作的值。 例如,我有两个值的“操作”下拉列表:“准备并下达发票”和“ 2.打印COnsolidated发票”和选择器,当选择第一个“操作”时,该选择器显示“已完成”状态的销售订单。谁能给我一个关于如何实现这一点的想法?以下是我的带有操作和选择器字段的过滤器表。
[Serializable()]
public partial class ImportInvoiceFilter : PX.Data.IBqlTable
{
public const string PrintConsolidatedInvoice = "PCI";
public const string PrepareAndReleaseInvoice = "PRI";
public class prepareAndReleaseInvoice : Constant<string> { public prepareAndReleaseInvoice() : base(PrepareAndReleaseInvoice) { } }
public class printConsolidatedInvoice : Constant<string> { public printConsolidatedInvoice() : base(PrintConsolidatedInvoice) { } }
#region ReferenceID
[PXString(30, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Customer Reference Nbr")]
[PXSelector(typeof(Search<SOOrder.customerRefNbr,
Where<Where2<Where<SOOrder.status,
Equal<SOOrderStatus.open>,
And<Current<ImportInvoiceFilter.selectAction>,
Equal<ImportInvoiceFilter.prepareAndReleaseInvoice>>>,
Or<Where2<Where<SOOrder.status,
Equal<SOOrderStatus.completed>>,
And<Current<ImportInvoiceFilter.selectAction>,
Equal<ImportInvoiceFilter.printConsolidatedInvoice>>>>>>>),
typeof(SOOrder.orderNbr),typeof(SOOrder.orderDesc),
typeof(SOOrder.customerRefNbr))]
public virtual string ReferenceID { get; set; }
public abstract class referenceID : IBqlField { }
#region SelectAction
public abstract class selectAction : PX.Data.IBqlField
{
}
protected string _SelectAction;
[PXUIField(DisplayName = "Select ")]
[PXStringList(new string[] { PrepareAndReleaseInvoice, PrintConsolidatedInvoice },
new string[] { "Prepare and Release Invoice", "Print Consolidated Invoice" })]
[PXDefault(PrepareAndReleaseInvoice)]
public virtual string SelectTemplate
{
get
{
return this._SelectAction;
}
set
{
this._SelectAction = value;
}
}
#endregion
}
ASPX:
<%@ Page Language="C#"
MasterPageFile="~/MasterPages/FormDetail.master"
AutoEventWireup="true" ValidateRequest="false"
CodeFile="KN506000.aspx.cs" Inherits="Page_KN506000" Title="Untitled
Page" %>
<%@ MasterType VirtualPath="~/MasterPages/FormDetail.master" %>
<asp:Content ID="cont1" ContentPlaceHolderID="phDS" Runat="Server">
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%"
PrimaryView="Filter" TypeName="KNLANOrderProcess.OrderInvoiceProcess">
</px:PXDataSource>
</asp:Content>
<asp:Content ID="cont2" ContentPlaceHolderID="phF" Runat="Server">
<px:PXFormView ID="form" runat="server" DataSourceID="ds" Style="z-
index: 100"
Width="100%" DataMember="Filter">
<Template>
<px:PXLayoutRule runat="server" ID="CstPXLayoutRule8" StartColumn="True" ></px:PXLayoutRule>
<px:PXDropDown runat="server" ID="CstPXDropDown10" DataField="SelectTemplate" CommitChanges="True" ></px:PXDropDown>
<px:PXSelector runat="server" ID="CstPXSelector9" DataField="ReferenceID" CommitChanges="True" AutoRefresh="True" ></px:PXSelector></Template>
</px:PXFormView>
</asp:Content>
<asp:Content ID="cont3" ContentPlaceHolderID="phG" Runat="Server">
<px:PXGrid ID="grid" runat="server" DataSourceID="ds" Style="z-index: 100"
Width="100%" Height="150px" SkinID="Details" TabIndex="300"
TemporaryFilterCaption="Filter Applied">
<EmptyMsg ComboAddMessage="No records found.
Try to change filter or modify parameters above to see records here."
NamedComboMessage="No records found as '{0}'.
Try to change filter or modify parameters above to see records here."
NamedComboAddMessage="No records found as '{0}'.
Try to change filter or modify parameters above to see records here."
FilteredMessage="No records found.
Try to change filter to see records here." FilteredAddMessage="No records
found.
Try to change filter to see records here." NamedFilteredMessage="No
records found as '{0}'.
Try to change filter to see records here." NamedFilteredAddMessage="No
records found as '{0}'.
Try to change filter to see records here." AnonFilteredMessage="No records
found.
Try to change filter to see records here." AnonFilteredAddMessage="No
records found.
Try to change filter to see records here."></EmptyMsg>
<Levels>
<px:PXGridLevel DataKeyNames="OrderType,OrderNbr,LineNbr"
DataMember="ImportInvoiceList">
<Columns>
<px:PXGridColumn DataField="OrderType">
</px:PXGridColumn>
<px:PXGridColumn DataField="OrderNbr">
</px:PXGridColumn>
<px:PXGridColumn DataField="OrderQty" TextAlign="Right" Width="100px">
</px:PXGridColumn></Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Container="Window" Enabled="True" MinHeight="150" ></AutoSize>
</px:PXGrid>
</asp:Content>
图:
public class OrderInvoiceProcess : PXGraph<OrderInvoiceProcess>
{
#region Views
public PXCancel<ImportInvoiceFilter> Cancel;
public PXFilter<ImportInvoiceFilter> Filter;
[PXFilterable]
public PXFilteredProcessing<SOOrder, ImportInvoiceFilter> ImportInvoiceList;
public PXSelect<SOOrder, Where<SOOrder.customerRefNbr, Equal<Current<ImportInvoiceFilter.referenceID>>
>> SOOrders;
#endregion
public OrderInvoiceProcess()
{
ImportInvoiceList.SetProcessCaption("Process");
ImportInvoiceList.SetProcessVisible(false);
ImportInvoiceList.SetProcessAllCaption("Process ALL");
ImportInvoiceFilter currentFilter = this.Filter.Current;
ImportInvoiceList.SetProcessDelegate(
delegate (List<SOOrder> list)
{
ProcessOrders(list, currentFilter, true);
});
}
public IEnumerable importInvoiceList()
{
PXSelectBase<SOOrder> ImportOrderListBase = null;
ImportInvoiceFilter currentInquiryfilter = Filter.Current;
if (currentInquiryfilter != null && !string.IsNullOrEmpty(currentInquiryfilter.SelectTemplate))
{
switch (currentInquiryfilter.SelectTemplate)
{
case ImportInvoiceFilter.PrepareAndReleaseInvoice:
ImportOrderListBase = new PXSelectJoin<SOOrder, LeftJoin<SOOrderShipment, On<SOOrder.orderNbr,
Equal<SOOrderShipment.orderNbr>>>, Where2<Where<SOOrderShipment.confirmed, Equal<True>,
And<Where<SOOrderShipment.invoiceNbr, IsNull, And<SOOrder.customerRefNbr, Equal<Current<ImportInvoiceFilter.referenceID>>>>>>,
And<Where<SOOrder.orderType, Equal<salesOrderTypeRO>,
Or<SOOrder.orderType, Equal<salesOrderTypeCO>>>>>>(this);
return ImportOrderListBase.Select();
case ImportInvoiceFilter.PrintConsolidatedInvoice:
break;
}
}
return ImportOrderListBase.Select();
}
}
答案 0 :(得分:2)
编辑:
另一个问题是您在SelectAction字段上缺少基本类型属性。您只有PXStringList:
[PXStringList(new string[] { PrepareAndReleaseInvoice, PrintConsolidatedInvoice },
new string[] { "Prepare and Release Invoice", "Print Consolidated Invoice" })]
PXStringList不是基本类型,因此您应该添加PXString属性,它是基本类型:
[PXString(30, IsUnicode = true, InputMask = "")]
[PXStringList(new string[] { PrepareAndReleaseInvoice, PrintConsolidatedInvoice },
new string[] { "Prepare and Release Invoice", "Print Consolidated Invoice" })]
您可以在选择器BQL查询中使用DAC过滤器字段(selectAction)根据过滤器字段过滤选择器数据:
[PXSelector(typeof(Search<SOOrder.orderNbr,
Where<Where2<Where<SOOrder.status, Equal<SOOrderStatus.open>, And<Current<SOImportFilter.selectAction>, Equal<SOImportFilter.createandConfirmShipment>>>,
Or<Where2<Where<SOOrder.status, Equal<SOOrderStatus.completed>>, And<Current<SOImportFilter.selectAction>, Equal<SOImportFilter.printInvoice>>>>>>>
在上述BQL请求中,where子句的逻辑等效于:
If (sales order status is open And select action is create and confirm shipment)
Or (sales order status is completed And select action is print invoice)
您可以使用自己的规则进行调整。
要使此过滤器正常工作,您需要使用ASPX控件上的CommitChanges和AutoRefresh属性来处理刷新行为。
您需要将CommitChanges设置为true,以在用户对其进行更改后立即将过滤器DAC修改发送回业务层:
// In a Grid
<px:PXGridColumn DataField="SelectAction" CommitChanges="True" />
// In a Form or in the RowTemplate of the Grid
<px:PXDropDown runat="server" ID="edSelectAction" DataField="SelectAction" CommitChanges="True" />
对于“销售订单”选择器,您需要将AutoRefresh设置为true,以便每次用户打开选择器时都执行选择器的BQL查询,而不是使用缓存中的陈旧值:
// In a Grid RowTemplate element
<px:PXGridLevel DataMember="YourDataView"
<RowTemplate>
<px:PXSelector runat="server" ID="edSalesOrderSelector" DataField="SalesOrderSelector" AutoRefresh="True" />
</RowTemplate>
<Columns>
<px:PXGridColumn DataField="SalesOrderSelector" CommitChanges="True" />
</Columns>
</px:PXGridLevel>
// In a Form
<px:PXSelector runat="server" ID="edSalesOrderSelector" DataField="SalesOrderSelector" AutoRefresh="True" />