有没有一种方法可以自动而不是手动在“属性”字段中显示数据?

时间:2020-01-03 03:57:01

标签: acumatica

Is there a way to have the attribute field update itself from the fields above?

对于熨平板ID,请使用“项目(PM301000)”的属性功能区。由于项目很多,因此有一种方法可以根据上面的用户添加字段(随附的图片)中的数据字段自动更新属性字段。

下面的代码是字段的计算方式,并显示在顶部。这是否需要具有能够自动填充字段的属性?还是这不可能?

    {
        #region Event Handlers
        public delegate void _Delegate(RowSelected<PMProject> e);
        [PXOverride]
        public void _(RowSelected<PMProject> e, _Delegate baseMethod)
        {
            baseMethod(e);
            var row = e.Row as PMProject;
            if (row == null) return;
            var rowExt = Base.Project.Cache.GetExtension<ContractExt>(row);

            var listCodeBuget = Base.CostBudget.Select().FirstTableItems.ToList();
            var totalInitQty = decimal.Zero;
            var totalMoralityQty = decimal.Zero;
            var totalTransferQty = decimal.Zero;
            var totalAdmissionQty = decimal.Zero;
            foreach (var item in listCodeBuget)
            {
                PMTask task = PXSelectorAttribute.Select<PMCostBudget.projectTaskID>(Base.CostBudget.Cache, item) as PMTask;
                if (task != null)
                {
                    if (task.TaskCD.Trim() == "INITIAL ST")
                    {                   

                        totalInitQty += item.ActualQty.GetValueOrDefault() ;
                    }
                    if (task.TaskCD.Trim() == "MORTALITY")
                    {
                        totalMoralityQty += (item.ActualQty.GetValueOrDefault());
                    }

                    if (task.TaskCD.Trim() == "TRANSFER")
                    {
                        totalTransferQty += (item.ActualQty.GetValueOrDefault());
                    }
                    if (task.TaskCD.Trim() == "ADMISSION")
                    {
                        totalAdmissionQty += Math.Abs(item.ActualQty.GetValueOrDefault());
                    }
                }
            }
            rowExt.UsrInitialStockingQty = totalInitQty;
            rowExt.UsrMortalityTotalQty = totalMoralityQty;
            rowExt.UsrTransferTotalQty = totalTransferQty;
            rowExt.UsrAdmissionQty = totalAdmissionQty;
            rowExt.UsrNetAvaibility = totalInitQty + totalAdmissionQty + totalTransferQty + totalMoralityQty;


        }


        #endregion
    }
}

谢谢。

0 个答案:

没有答案