行在保存时删除了吗?

时间:2018-07-11 19:09:39

标签: acumatica

我创建的三部分屏幕出现问题。该屏幕在顶部具有PMProject.ContractCD作为选择器,在下图中的ProjectID上具有与其相关的PMTran。在第二个图中是与TranID上的PMTran相关的自定义图。 It looks like this

我在底部图形上输入新行时发生错误,如果在保存之前选择另一行,则在保存新输入的行时将删除所选行。如果我在保存整个内容之前不选择另一行,则可以保存所有内容。 Example

这是页面的ASPX:

<%@ Page Language="C#" MasterPageFile="~/MasterPages/FormDetail.master" AutoEventWireup="true" ValidateRequest="false" CodeFile="GR300000.aspx.cs" Inherits="Page_GR300000" Title="Untitled     Page" %>    
<%@ Mast    erType VirtualPath="~/MasterPages/FormDetail.master" %>    

<asp:Content ID="cont1" ContentPlaceHolderID="phDS" Runat="Server">
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%"
    TypeName="GrantAmount.GrantAmountEntry"
    PrimaryView="Project">
</px:PXDataSource>
</asp:Content>
<asp:Content ID="cont2" ContentPlaceHolderID="phF" Runat="Server">
<px:PXFormView SyncPosition="True" SkinID="Transparent" ID="form" runat="server" DataSourceID="ds" DataMember="Project" Width="100%" Height="30%" AllowAutoHide="false">
    <Template>
        <px:PXLayoutRule ID="PXLayoutRule1" runat="server" StartRow="True"></px:PXLayoutRule>
        <px:PXSegmentMask runat="server" ID="CstPXSegmentMask28" DataField="ContractCD" /></Template>

    <CallbackCommands>
        <Refresh RepaintControlsIDs="grid" CommitChanges="True" ></Refresh></CallbackCommands></px:PXFormView>
</asp:Content>
<asp:Content ID="cont3" ContentPlaceHolderID="phG" Runat="Server">
<px:PXGrid SyncPosition="True" KeepPosition="True" ID="grid" runat="server" DataSourceID="ds" Width="100%" Height="25 px" SkinID="Details" AllowAutoHide="false">
    <Levels>
        <px:PXGridLevel DataMember="PMTranView">
            <Columns>
            <px:PXGridColumn DataField="BAccountID" Width="120" ></px:PXGridColumn>
            <px:PXGridColumn DataField="OrigTranType" Width="70" ></px:PXGridColumn>
            <px:PXGridColumn DataField="Date" Width="90" ></px:PXGridColumn>
            <px:PXGridColumn DataField="RefNbr" Width="70" ></px:PXGridColumn>
            <px:PXGridColumn DataField="SubID" Width="120" ></px:PXGridColumn>
            <px:PXGridColumn DataField="Description" Width="200" ></px:PXGridColumn>
            <px:PXGridColumn DataField="Amount" Width="100" ></px:PXGridColumn>
            <px:PXGridColumn DataField="TranID" Width="70" ></px:PXGridColumn>
            <px:PXGridColumn DataField="ProjectID" Width="70" ></px:PXGridColumn>
            <px:PXGridColumn DataField="ProjectID_description" Width="200" ></px:PXGridColumn></Columns>
        </px:PXGridLevel>
    </Levels>
    <AutoSize Container="Window" Enabled="True" MinHeight="150" ></AutoSize>
    <ActionBar >
    </ActionBar>

    <AutoCallBack Target="CstPXGrid1" Command="Refresh" ActiveBehavior="True" >
            <Behavior RepaintControlsIDs="CstPXGrid1" /></AutoCallBack></px:PXGrid>
<px:PXGrid DataSourceID="ds" Width="100%" SkinID="Details" Height="100 px" runat="server" ID="CstPXGrid1">
    <Levels>
        <px:PXGridLevel DataMember="GrantAmountsView" >
            <Columns>
                <px:PXGridColumn DataField="GrantID" Width="70" ></px:PXGridColumn>
                <px:PXGridColumn DataField="Amount" Width="100" ></px:PXGridColumn>
                <px:PXGridColumn DataField="Tranid" Width="70" ></px:PXGridColumn></Columns>
            </px:PXGridLevel></Levels>
    <ActionBar><Actions><Save Enabled="true" /></Actions></ActionBar>
</px:PXGrid></asp:Content>

C#:

using System;
using PX.Data;
using GrantTrackingTables;
using PX.Objects.PM;
using PX.Objects.CR;
using PX.Data.EP;
using PX.Objects.GL;
using PX.Objects.CM;
using PX.Common;
namespace GrantAmount
{
    public class GrantAmountEntry : PXGraph<GrantAmountEntry>
{
    #region Constants

    public class string_CIP : Constant<string>
    {
        public string_CIP()
            : base("CIP")
        {
        }
    }
    #endregion
    #region Views
    public PXSave<PMProject> Save;
    public PXDelete<PMProject> Delete;
    public PXCancel<PMProject> Cancel;
    public PXFirst<PMProject> First;
    public PXPrevious<PMProject> Previous;
    public PXNext<PMProject> Next;
    public PXLast<PMProject> Last;
    public PXSelect<PMProject, Where<PMProject.baseType, Equal<PMProject.ProjectBaseType>,
        And<PMProject.isTemplate, Equal<False>>>> Project;
    public PXSelectJoin<PMTran,
        InnerJoin<PMTask, On<PMTask.projectID, Equal<PMTran.projectID>,
            And<PMTask.taskCD, Equal<string_CIP>, And<PMTran.projectID,
                Equal<Current<PMProject.contractID>>>>>>> PMTranView;
    public PXSelect<GrantAmounts, Where<GrantAmounts.tranid, Equal<Current<PMTran.tranID>>>> GrantAmountsView;
    #endregion
}
}

不太复杂,但是很显然我在这里丢失了一些东西,可能与视图之间的关联方式有关?

编辑: GrantAmounts DAC:

using System;
using PX.Data;

namespace GrantTrackingTables
{
[Serializable]
public class GrantAmounts: IBqlTable
{

#region GrantID
public class grantID : IBqlField{}
[PXDBString(9, IsKey = true, IsUnicode = true, InputMask = ">CCCCCCCCC")]
[PXSelector(typeof(Search<Grants.grantID, Where<Grants.isActive, Equal<True>>>), typeof(Grants.grantDesc))]
[PXUIField(DisplayName = "Grant ID")]
public string GrantID { get; set; }
#endregion

#region Amount
public class amount : IBqlField{}
[PXDBDecimal(2)]
[PXDefault(TypeCode.Decimal, "0.0", PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Amount")]
public decimal? Amount { get; set; }
#endregion

#region Tranid
[PXDBLong(IsKey = true)]
[PXUIField(DisplayName = "Tranid", Visible = true)]
public long? Tranid { get; set; }
public class tranid : IBqlField{}
#endregion
}
}

授予DAC:

using System;
using PX.Data;

namespace GrantTrackingTables
{
[Serializable]
public class Grants: IBqlTable
{


#region GrantID

[PXDBString(9, IsKey = true, IsUnicode = true, InputMask = ">CCCCCCCCC")]
[PXUIField(DisplayName = "Grant ID")]
public string GrantID { get; set; }

public class grantID : IBqlField{}

#endregion


#region GrantDesc

[PXDBString(40, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Grant Desc")]
public string GrantDesc { get; set; }

public class grantDesc : IBqlField{}

#endregion


#region IsActive

[PXDBBool]
[PXDefault(true)]
[PXUIField(DisplayName = "Is Active")]
public bool? IsActive { get; set; }

public class isActive : IBqlField{}

    #endregion

    #region CreatedByID


    [PXDBCreatedByID()]
    public Guid? CreatedByID { get; set; }

    public class createdByID : IBqlField { }

    #endregion


    #region CreatedByScreenID


    [PXDBCreatedByScreenID()]
    public string CreatedByScreenID { get; set; }

    public class createdByScreenID : IBqlField { }

    #endregion


    #region CreatedDateTime


    [PXDBCreatedDateTime()]
    public DateTime? CreatedDateTime { get; set; }

    public class createdDateTime : IBqlField { }

    #endregion


    #region LastModifiedByID


    [PXDBLastModifiedByID()]
    public Guid? LastModifiedByID { get; set; }

    public class lastModifiedByID : IBqlField { }

    #endregion


    #region LastModifiedByScreenID


    [PXDBLastModifiedByScreenID()]
    public string LastModifiedByScreenID { get; set; }

    public class lastModifiedByScreenID : IBqlField { }

    #endregion


    #region LastModifiedDateTime


    [PXDBLastModifiedDateTime()]
    public DateTime? LastModifiedDateTime { get; set; }

    public class lastModifiedDateTime : IBqlField { }

    #endregion
}
}

从RowDeleted调用堆栈:

    RuntimeCode_6E630598B291BE5.dll!GrantAmount.GrantAmountEntry.GrantAmounts_RowDeleted(PX.Data.PXCache sender, PX.Data.PXRowDeletedEventArgs e, PX.Data.PXRowDeleted del) Line 41
PX.Data.dll!PX.Data.PXCache.OnRowDeleted(object item, bool externalCall)
PX.Data.dll!PX.Data.PXCache<GrantTrackingTables.GrantAmounts>.Delete(System.Collections.IDictionary keys, System.Collections.IDictionary values)
PX.Data.dll!PX.Data.PXGraph.ExecuteDelete(string viewName, System.Collections.IDictionary keys, System.Collections.IDictionary values, object[] parameters)
PX.Web.UI.dll!PX.Web.UI.PXBaseDataSource.ExecuteDelete(string viewName, System.Collections.IDictionary keys, System.Collections.IDictionary oldValues)
System.Web.dll!System.Web.UI.DataSourceView.Delete(System.Collections.IDictionary keys, System.Collections.IDictionary oldValues, System.Web.UI.DataSourceViewOperationCallback callback)
PX.Web.UI.dll!PX.Web.UI.PXGrid.PerformDelete(System.Collections.Specialized.IOrderedDictionary keys, System.Collections.Specialized.IOrderedDictionary oldValues)
PX.Web.UI.dll!PX.Web.UI.PXGrid.af()
PX.Web.UI.dll!PX.Web.UI.PXGrid.ah()
PX.Web.UI.dll!PX.Web.UI.PXGrid.System.Web.UI.IPostBackDataHandler.LoadPostData(string key, System.Collections.Specialized.NameValueCollection postCollection)
PX.Web.UI.dll!PX.Web.UI.PXPage.a(System.Web.UI.ControlCollection A_0, System.Collections.Specialized.NameValueCollection A_1, System.Collections.ArrayList A_2)
PX.Web.UI.dll!PX.Web.UI.PXPage.a(System.Web.UI.ControlCollection A_0, System.Collections.Specialized.NameValueCollection A_1, System.Collections.ArrayList A_2)
PX.Web.UI.dll!PX.Web.UI.PXPage.a(System.Web.UI.ControlCollection A_0, System.Collections.Specialized.NameValueCollection A_1, System.Collections.ArrayList A_2)
PX.Web.UI.dll!PX.Web.UI.PXPage.a(System.Web.UI.ControlCollection A_0, System.Collections.Specialized.NameValueCollection A_1, System.Collections.ArrayList A_2)
PX.Web.UI.dll!PX.Web.UI.PXPage.a(System.Web.UI.ControlCollection A_0, System.Collections.Specialized.NameValueCollection A_1, System.Collections.ArrayList A_2)
PX.Web.UI.dll!PX.Web.UI.PXPage.OnPreLoad(System.EventArgs e)
System.Web.dll!System.Web.UI.Page.ProcessRequestMain(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint)
System.Web.dll!System.Web.UI.Page.ProcessRequest(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint)
System.Web.dll!System.Web.UI.Page.ProcessRequest()
System.Web.dll!System.Web.UI.Page.ProcessRequest(System.Web.HttpContext context)
PX.Web.UI.dll!PX.Web.UI.PXPage.ProcessRequest(System.Web.HttpContext context)
App_Web_eesmr4wd.dll!ASP.cstpublished_pages_gr_gr300000_aspx.ProcessRequest(System.Web.HttpContext context)
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
System.Web.dll!System.Web.HttpApplication.ExecuteStepImpl(System.Web.HttpApplication.IExecutionStep step)
System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step, ref bool completedSynchronously)
System.Web.dll!System.Web.HttpApplication.PipelineStepManager.ResumeSteps(System.Exception error)
System.Web.dll!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext context, System.AsyncCallback cb)
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest wr, System.Web.HttpContext context)
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
[Native to Managed Transition]  
[Managed to Native Transition]  
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)
[AppDomain Transition]      

1 个答案:

答案 0 :(得分:0)

PXDBString(IsUnicode = true)映射到数据库类型nvarchar,当IsUnicode = true时,应使用带有前缀'n'的类型,例如'nchar'和'nvarchar'。

当IsFixed = true时,应使用

类型'char'。 IsFixed = false时键入“ varchar”,因为“ var”表示变量,如未固定。通常省略IsFixed属性,因为这是默认值。

已知不匹配类型会导致轻微问题,因此,当您遇到奇怪的数据库持久性故障时,应仔细检查。