Acumatica - 保存自定义 PO 屏幕时出现订单日期不能为空错误

问题描述 投票:0回答:0

我必须开发用于输入客户采购订单详细信息的新屏幕。 在我的自定义屏幕中,当我单击“添加购买”按钮时,需要打开一个智能面板,其中包含与所选客户相关的采购订单详细信息。 enter image description here 然后用户可以在选中复选框时选择任何多边形并单击“添加和关闭”按钮。 enter image description here 我的问题是在将采购订单详细信息添加到我的详细信息表中之后,在保存它时显示如下错误。 enter image description here

这是我的图形扩展代码。

using PX.Data;
using PX.Objects.PM;
using PX.Objects.PO;
using System.Collections;

namespace GRIProformaInvoice.Extension
{
    // Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
    public class APProformaEntry_Extension : PXGraphExtension<ProformaEntry>
    {

        public PXSelectJoin<POLine,
          InnerJoin<POOrder, On<POLine.orderNbr, Equal<POOrder.orderNbr>,
          And<POLine.orderType, Equal<POOrder.orderType>>>>, Where<POLine.vendorID, Equal<Current<APProforma.customerID>>>>
          POrdersView;

        public PXAction<APProforma> MyAction;
        [PXUIField(DisplayName = "Add Purchase", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
        [PXButton(CommitChanges = true)]
        public virtual IEnumerable myAction(PXAdapter adapter)
        {
            try
            {
                if (POrdersView.AskExt() == WebDialogResult.OK)
                {
                    return InsertSelectedLines(adapter);
                }
            }
            catch (PXDialogRequiredException ex)
            {
                PXTrace.WriteError(ex);
                throw;

            }
            return adapter.Get();
        }

        public virtual IEnumerable InsertSelectedLines(PXAdapter adapter)
        {
            if (POrdersView != null)
            {
                int lineNbr = Base.APProformaItems.Select().Count + 1;

                foreach (PXResult<POLine, POOrder> result in POrdersView.Select())
                {
                    POOrder order = result;
                    POLine line = result;

                    if (line.Selected == false)
                        continue;
                    {
                        APProformaItemList toBeInserted = new APProformaItemList();
                        //toBeInserted.Ponbr = order.OrderNbr;
                        toBeInserted.Ponbr = order.OrderNbr;
                        //order.OrderNbr;
                        toBeInserted.LineNbr = lineNbr++;
                        toBeInserted.POLineNbr = line.LineNbr;
                        toBeInserted.POrderQty = 30;
                        toBeInserted.Itemid = 25;
                        toBeInserted.Description = line?.TranDesc;
                        //toBeInserted.OrderDate = order.OrderDate;                        //toBeInserted.
                        toBeInserted.Amount = line.ExtCost;

                        toBeInserted = Base.APProformaItems.Insert(toBeInserted);
                        Base.APProformaItems.Update(toBeInserted);
                    }
                }
            }
            return adapter.Get();
        }

        protected virtual void POLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
        {
            PXUIFieldAttribute.SetEnabled(cache, e.Row, false);
            PXUIFieldAttribute.SetEnabled<POLine.selected>(cache, e.Row, true);
            //PXUIFieldAttribute.SetReadOnly<POLine.selected>(cache, e.Row, false);
            // POrdersView.Cache.AllowUpdate = false;
            //PXUIFieldAttribute.SetEnabled<POLine.selected>(cache, e.Row, true);
            /*PXUIFieldAttribute.SetReadOnly(cache, row, true);
             PXUIFieldAttribute.SetEnabled(cache, row, false);*/
        }
    }
}
sql-server customization acumatica acumatica-kb
© www.soinside.com 2019 - 2024. All rights reserved.