我正在尝试在“销售类别”屏幕(IN204060)上添加与所选销售类别相关的明细表格
创建了一个保存网格数据的DAC:
public class INCategoryFilesCTC : IBqlTable
{
#region CategoryID
[PXDBInt(IsKey = true)]
[PXUIField(DisplayName = "Category ID")]
public virtual int? CategoryID { get; set; }
public abstract class categoryID : IBqlField { }
#endregion
#region Type
[PXDBString(1, IsFixed = true, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Type")]
public virtual string Type { get; set; }
public abstract class type : IBqlField { }
#endregion
#region NoteID
[PXNote()]
[PXUIField(DisplayName = "Price Source")]
public virtual Guid? NoteID { get; set; }
public abstract class noteID : IBqlField { }
#endregion
#region Uploaded
[PXDBDate()]
[PXUIField(DisplayName = "Uploaded")]
public virtual DateTime? Uploaded { get; set; }
public abstract class uploaded : IBqlField { }
#endregion
#region FileName
[PXDBString(50, IsFixed = true, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "File Name")]
public virtual string FileName { get; set; }
public abstract class fileName : IBqlField { }
#endregion
}
然后添加了一个数据视图委托选择(由于其余图形数据的非标准选择,Current <>出现了问题)
public PXSelect<INCategoryFilesCTC> CategoryFiles;
protected virtual IEnumerable categoryFiles()
{
var cache = Base.Caches[typeof(INCategoryFilesCTC)];
cache.AllowInsert = true;
cache.AllowUpdate = true;
cache.AllowDelete = true;
var select = PXSelect<INCategoryFilesCTC,
Where<INCategoryFilesCTC.categoryID,
Equal<Required<INCategoryFilesCTC.categoryID>>>>.Select(Base,Base.Folders.Current.CategoryID).FirstTableItems;
foreach (INCategoryFilesCTC item in select)
{
cache.SetStatus(item,PXEntryStatus.Held);
}
return cache.Cached;
}
网格位于拆分容器的1/2内,并且位于选项卡内。搜索ID =“ WebFiles”(是其中的一半,如果您想让我知道的话,我不会用aspx代码淹死你们)
<Template2>
<px:PXFormView ID="form" runat="server" DataSourceID="ds" DataMember="CurrentCategory"
Caption="Category Info" Width="100%">
<Template>
<px:PXLayoutRule ID="PXLayoutRule1" runat="server" StartColumn="True" LabelsWidth="S" ControlSize="SM" />
<px:PXTextEdit ID="edDescription" runat="server" DataField="Description" CommitChanges="True" />
<px:PXLayoutRule ID="PXLayoutRule2" runat="server" StartColumn="True" LabelsWidth="S" ControlSize="SM" />
<px:PXTreeSelector ID="edParentID" runat="server" DataField="ParentID" ShowRootNode="False"
TreeDataMember="ParentFolders" TreeDataSourceID="ds" AutoRefresh="True" ExpandDepth="1"
SyncPosition="True" DataMember="ParentFolders" AutoRepaint="True" CommitChanges="True" KeepPosition="True">
<DataBindings>
<px:PXTreeItemBinding DataMember="ParentFolders" TextField="Description" ValueField="CategoryID" />
</DataBindings>
</px:PXTreeSelector>
<px:PXLayoutRule ID="PXLayoutRule3" runat="server" StartColumn="True" LabelsWidth="S" ControlSize="SM" />
</Template>
</px:PXFormView>
<px:PXTab runat="server" >
<Items>
<px:PXTabItem Text="Category Members">
<Template>
<px:PXGrid ID="gridMembers" runat="server" ActionsPosition="Top" Width="100%"
SkinID="Details" CaptionVisible="true" SyncPosition="True"
AutoRepaint="True" AdjustPageSize="Auto">
<AutoSize Enabled="True" Container="Parent"/>
<Mode InitNewRow="True"></Mode>
<Levels>
<px:PXGridLevel DataMember="Members">
<Columns>
<px:PXGridColumn AllowCheckAll="True" AllowNull="False" DataField="CategorySelected" TextAlign="Center"
Type="CheckBox" Width="26px" />
<px:PXGridColumn DataField="InventoryID" CommitChanges="true" Width="140px" LinkCommand="viewDetails"/>
<px:PXGridColumn DataField="InventoryItem__Descr" Width="200px"/>
<px:PXGridColumn DataField="InventoryItem__ItemClassID" Width="140px"/>
<px:PXGridColumn AllowNull="False" DataField="InventoryItem__ItemStatus" RenderEditorText="True" Width="100px"/>
</Columns>
</px:PXGridLevel>
</Levels>
<ActionBar>
<Actions>
<Search Enabled="False" />
<EditRecord Enabled="False" />
<NoteShow Enabled="False" />
<FilterShow Enabled="False" />
<FilterSet Enabled="False" />
<ExportExcel Enabled="False" />
</Actions>
<CustomItems>
<px:PXToolBarButton Tooltip="Copy Selected Inventory Items" DisplayStyle="Image">
<AutoCallBack Command="Copy" Enabled="True" Target="ds" />
<Images Normal="main@Copy" />
</px:PXToolBarButton>
<px:PXToolBarButton Tooltip="Cut Selected Inventory Items" DisplayStyle="Image">
<AutoCallBack Command="Cut" Enabled="True" Target="ds" />
<Images Normal="main@Cut" />
</px:PXToolBarButton>
<px:PXToolBarButton Tooltip="Paste Inventory Items from Buffer" DisplayStyle="Image">
<AutoCallBack Command="Paste" Enabled="True" Target="ds" />
<Images Normal="main@Paste" />
</px:PXToolBarButton>
<px:PXToolBarButton>
<AutoCallBack Command="AddItemsbyClass" Target="ds" />
</px:PXToolBarButton>
<px:PXToolBarButton Text="Inventory Details" Key="cmdviewDetails" Visible="False">
<AutoCallBack Command="viewDetails" Target="ds" />
</px:PXToolBarButton>
</CustomItems>
</ActionBar>
</px:PXGrid>
</Template>
</px:PXTabItem>
<px:PXTabItem Text="Website Media">
<template>
<px:PXFormView ID="WebForm" runat="server" DataSourceID="ds" DataMember="CurrentCategory">
<Template>
<px:PxTextEdit ID="txtVideoURL" runat="server" DataField="CTCVideoURL" />
<px:PxTextEdit ID="txtCategoryDesc" runat="server" DataField="CTCCategoryDesc" />
</Template>
</px:PXFormView>
<px:PXGrid ID="WebFiles" runat="server" FilesIndicator="True" Height="300px" Width="100%" DataSourceID="ds">
<Levels>
<px:PXGridLevel DataMember="CategoryFiles" DataKeyNames="CategoryID">
<Columns>
<px:PXGridColumn DataField="CategoryID" />
<px:PXGridColumn DataField="Type" />
<px:PXGridColumn DataField="Filename" />
<px:PXGridColumn DataField="Uploaded"/>
</Columns>
</px:PXGridLevel>
</Levels>
<ActionBar>
<Actions>
<Delete Enabled="True" />
<AddNew Enabled="True" />
</Actions></ActionBar>
</px:PXGrid>
</template>
</px:PXTabItem>
</Items>
</px:PXTab>
</Template2>
当我选择一个树元素时,如果有一些记录会显示在我的自定义表中(树元素categoryID =网格记录categoryID),则会出现以下错误:
Error: an invalid argument has been specified
Parameter name selectParent
绝对没有任何痕迹,在调试过程中也没有任何痕迹,所以我有点茫然。
几件事:
当我注释掉自定义PXGrid时,错误消失了,即使添加了选项卡和组,我也可以正常使用屏幕
如果我注释掉网格CategoryID DAC字段上的PXParent和PXDBDefault属性,错误不会消失
如果所选树选择没有详细记录,则没有错误。如果我记录并保存,则会出现错误(插入的记录现在显示在网格中,保存的详细记录显示在数据库表中)
这使我相信选择详细记录时发生了某些事情。有什么建议吗?
谢谢 -凯尔
答案 0 :(得分:0)
好的,事实证明这比我想象的要基本。如果您想跳过阅读,原来是由于详细记录中有一个简单的密钥问题
首先,我删除了数据视图委托,“当前”销售类别ID很好用
ProcessSpeechRecognition(new RecognitionResult { Text = "test" });
第二,为master-detail链接添加了正确的PXParent和PXDBdefault属性(在类别ID上)
public PXSelect<INCategoryFilesCTC,
Where<INCategoryFilesCTC.categoryID,
Equal<Current<INCategory.categoryID>>>> CategoryFiles;
但是最后我添加了使用属性[PXLineNbr]的Row#样式列
#region CategoryID
[PXDBInt(IsKey=true)]
[PXParent(typeof(Select<INCategory, Where<INCategory.categoryID, Equal<Current<INCategory.categoryID>>>>))]
[PXDBDefault(typeof(INCategory.categoryID))]
public virtual int? CategoryID { get; set; }
public abstract class categoryID : IBqlField { }
#endregion
并拥有第二把钥匙立即解决了我的问题
所以总之,我认为是由于一些困难的自定义导致的错误,实际上是由于一些极其基本的东西哈哈..希望这篇文章可以防止人们忘记同一件事