指定的演员表在 Acumatica ERP 系统的新主屏幕中无效 [英] Specified Cast is not Valid in new Master Screen of Acumatica ERP System

查看:23
本文介绍了指定的演员表在 Acumatica ERP 系统的新主屏幕中无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 Acumatica 中创建了新的附加主屏幕 (ListView).以下代码为页面源代码:

I already create new additional master screen (ListView) in Acumatica. The following code is the source code of the page :

<%@ Page Language="C#" MasterPageFile="~/MasterPages/ListView.master" AutoEventWireup="true" ValidateRequest="false" CodeFile="CS213000.aspx.cs" Inherits="Page__213000" Title="Untitled Page" %>
<%@ MasterType VirtualPath="~/MasterPages/ListView.master" %>
<asp:Content ID="cont1" ContentPlaceHolderID="phDS" runat="Server">
<px:PXDataSource ID="ds" runat="server" Visible="True" PrimaryView="RoomMaster" SuspendUnloading="False" TypeName="SGLCustomizeProject.RoomMaint" >
</px:PXDataSource>
</asp:Content>

<asp:Content ID="cont2" ContentPlaceHolderID="phL" runat="Server">
<px:PXGrid ID="grid" runat="server" Height="400px" Width="100%" Style="z-index: 100"
    AllowPaging="True" AllowSearch="True" AdjustPageSize="Auto" DataSourceID="ds" SkinID="Inquire" TabIndex="900" 
    AllowAdd="True" TemporaryFilterCaption="Filter Applied">
<Levels>
<px:PXGridLevel DataMember="RoomMaster">
<Columns>
<px:PXGridColumn DataField="BranchID" Width="120px">
                </px:PXGridColumn>
                <px:PXGridColumn DataField="BuildingID">
                </px:PXGridColumn>
                <px:PXGridColumn DataField="RoomCD" Width="200px">
                </px:PXGridColumn>
                <px:PXGridColumn DataField="RoomDescription" Width="200px">
                </px:PXGridColumn>
                <px:PXGridColumn DataField="Status">
                </px:PXGridColumn>
</Columns>
        </px:PXGridLevel>
    </Levels>
<AutoSize Container="Window" Enabled="True" MinHeight="200" />
</px:PXGrid>

以下代码是PXGraph的源代码:

The following code is the source code of PXGraph :

using System;
using System.Collections;
using System.Collections.Generic;
using PX.SM;
using PX.Data;
namespace SGLCustomizeProject
{
    public class RoomMaint : PXGraph<RoomMaint>
    {
        public PXCancel<RoomMaster> Cancel;
        public PXSave<RoomMaster> Save;
        public PXInsert<RoomMaster> Insert;
        public PXSelect<RoomMaster> RoomMaster;
    }
}

以下代码是DAC的源代码:

The following code is the source code of DAC :

namespace SGLCustomizeProject
{
using System;
using PX.Data;
using PX.Objects.GL;
using PX.Objects.AR;
using PX.Objects.CR;
using PX.Objects.FA;

[System.SerializableAttribute()]
public class RoomMaster : PX.Data.IBqlTable
{
    #region BranchID
    public abstract class branchID : PX.Data.IBqlField
    {
    }
    protected Int32? _BranchID;
    [PXDBInt(IsKey = true)]
    [PXDefault()]
    //[PXUIField(DisplayName = "BranchID")]
    [Branch()]
    public virtual Int32? BranchID
    {
        get
        {
            return this._BranchID;
        }
        set
        {
            this._BranchID = value;
        }
    }
    #endregion

    #region BuildingID
    public abstract class buildingID : PX.Data.IBqlField
    {
    }
    protected Int32? _BuildingID;
    [PXDBInt()]
    [PXDefault()]
    [PXSelector(typeof(Search<Building.buildingID, 
                        Where<Building.branchID, 
                         Equal<Current<FALocationHistory.locationID>>>>),
        SubstituteKey = typeof(Building.buildingCD), DescriptionField = typeof(Building.description))]
    [PXUIField(DisplayName = "Building")]
    public virtual Int32? BuildingID
    {
        get
        {
            return this._BuildingID;
        }
        set
        {
            this._BuildingID = value;
        }
    }
    #endregion

    #region RoomCD
    public abstract class roomCD : PX.Data.IBqlField
    {
    }
    protected string _RoomCD;
    [PXDBString(50, IsUnicode = true, IsKey = true)]
    [PXDefault()]
    [PXUIField(DisplayName = "Kode Area")]
    public virtual string RoomCD
    {
        get
        {
            return this._RoomCD;
        }
        set
        {
            this._RoomCD = value;
        }
    }
    #endregion

    #region RoomID
    public abstract class roomID : PX.Data.IBqlField
    {
    }
    protected int? _RoomID;
    [PXDBIdentity()]
    [PXUIField(Enabled = false)]
    public virtual int? RoomID
    {
        get
        {
            return this._RoomID;
        }
        set
        {
            this._RoomID = value;
        }
    }
    #endregion

    #region RoomDescription
    public abstract class roomDescription : PX.Data.IBqlField
    {
    }
    protected string _RoomDescription;
    [PXDBString(75, IsUnicode = true)]
    [PXUIField(DisplayName = "Deskripsi Area")]
    public virtual string RoomDescription
    {
        get
        {
            return this._RoomDescription;
        }
        set
        {
            this._RoomDescription = value;
        }
    }
    #endregion

    #region Status
    public abstract class status : PX.Data.IBqlField
    {
    }
    protected string _Status;
    [PXDBString(2, IsFixed = true)]
    [PXDefault()]
    [PXUIField(DisplayName = "Status")]
    [PXStringList(new string[]
        {
            "01",
            "02"
        },

        new string[]
        {
            "Active",
            "Inactive"
        })]
    public virtual string Status
    {
        get
        {
            return this._Status;
        }
        set
        {
            this._Status = value;
        }
    }
    #endregion

    #region tstamp
    public abstract class Tstamp : PX.Data.IBqlField
    {
    }
    protected byte[] _tstamp;
    [PXDBTimestamp()]
    public virtual byte[] tstamp
    {
        get
        {
            return this._tstamp;
        }
        set
        {
            this._tstamp = value;
        }
    }
    #endregion

    #region CreatedByID
    public abstract class createdByID : PX.Data.IBqlField
    {
    }
    protected Guid? _CreatedByID;
    //[PXDBField()]
    //[PXDefault()]
    //[PXUIField(DisplayName = "CreatedByID")]
    [PXDBCreatedByID]
    public virtual Guid? CreatedByID
    {
        get
        {
            return this._CreatedByID;
        }
        set
        {
            this._CreatedByID = value;
        }
    }
    #endregion

    #region CreatedByScreenID
    public abstract class createdByScreenID : PX.Data.IBqlField
    {
    }
    protected string _CreatedByScreenID;
    //[PXDBString(8, IsFixed = true)]
    //[PXDefault("")]
    //[PXUIField(DisplayName = "CreatedByScreenID")]
    [PXDBCreatedByScreenID]
    public virtual string CreatedByScreenID
    {
        get
        {
            return this._CreatedByScreenID;
        }
        set
        {
            this._CreatedByScreenID = value;
        }
    }
    #endregion

    #region CreatedDateTime
    public abstract class createdDateTime : PX.Data.IBqlField
    {
    }
    protected DateTime? _CreatedDateTime;
    //[PXDBDate()]
    //[PXDefault(TypeCode.DateTime, "01/01/1900")]
    //[PXUIField(DisplayName = "CreatedDateTime")]
    [PXDBCreatedDateTime]
    public virtual DateTime? CreatedDateTime
    {
        get
        {
            return this._CreatedDateTime;
        }
        set
        {
            this._CreatedDateTime = value;
        }
    }
    #endregion

    #region LastModifiedByID
    public abstract class lastModifiedByID : PX.Data.IBqlField
    {
    }
    protected Guid? _LastModifiedByID;
    //[PXDBField()]
    //[PXDefault()]
    //[PXUIField(DisplayName = "LastModifiedByID")]
    [PXDBLastModifiedByID]
    public virtual Guid? LastModifiedByID
    {
        get
        {
            return this._LastModifiedByID;
        }
        set
        {
            this._LastModifiedByID = value;
        }
    }
    #endregion

    #region LastModifiedDateTime
    public abstract class lastModifiedDateTime : PX.Data.IBqlField
    {
    }
    protected DateTime? _LastModifiedDateTime;
    //[PXDBDate()]
    //[PXDefault(TypeCode.DateTime, "01/01/1900")]
    //[PXUIField(DisplayName = "LastModifiedDateTime")]
    [PXDBLastModifiedDateTime]
    public virtual DateTime? LastModifiedDateTime
    {
        get
        {
            return this._LastModifiedDateTime;
        }
        set
        {
            this._LastModifiedDateTime = value;
        }
    }
    #endregion
}
}

当我第一次尝试添加新记录时没有关系,但是当我尝试添加另一条记录或打开屏幕时,我收到以下错误消息:

When I tried to add new record for the first time is doesn't matter, but when I tried to add another record or open the screen, I got the following error message :

有谁知道如何解决这个案子?谢谢

Does anyone know how to solve this case ? Thanks

推荐答案

BuildingID 字段上的 PXSelector 显示 WHERE 子句将结果限制为 Current FALocationHistory.locationID,但我在 RoomMaint 图的上下文中没有看到 FALocationHistory.您是否打算根据此新 RoomMaster 行中 BranchID 的选择来限制列表?如果为 true,那么您还需要在 BranchID 列上设置 CommitChanges=true,并且在网格级别的 RowTemplate 部分中的 BuildingID px:PXSelector 控件上设置 AutoRefresh=true,例如:

The PXSelector on BuildingID field shows a WHERE clause limiting results to Current FALocationHistory.locationID but I don't see FALocationHistory in the context of the RoomMaint graph. Did you intend to limit the list based on the choice of BranchID in this new RoomMaster row? If true, then you will also need CommitChanges=true on the BranchID column and also AutoRefresh=true on the BuildingID px:PXSelector control in a RowTemplate section of the gridlevel, such as:

<RowTemplate>

<px:PXSelector ID="edBuildingID" runat="server" DataField="BuildingID" 
                    DataSourceID="ds" AutoRefresh="True">

</RowTemplate>

在这种情况下,您可能需要在标记的 Grid 标记上添加 SyncPosition=true.还可以尝试仅将 IsKey=true 放置在 RoomID 标识字段上,而不是 BranchID/RoomCD.

You may need to add SyncPosition=true on the Grid tag of the markup in this case. Also try placing the IsKey=true only on the RoomID identity field instead of BranchID/RoomCD.

这篇关于指定的演员表在 Acumatica ERP 系统的新主屏幕中无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆