创建SO并链接到PO ... SO Line Split错误地更新了SO Line Qty

问题描述

我希望能够从PO生成SO,并将SO线路链接回PO。我已经使用了SO PO表单中的LINK PO按钮中的代码,并且非常接近它。我正在更新正确的INItemPlan记录,并使用PO信息更新SOLinesplit。

我似乎遇到的问题是,当我将SOLinesplit写回数据库时,我要清除SOLine上的数量。我已将其精简到最低程度,似乎如果我创建了SO和SOLine,将其保存,然后加载该行的SOLinesplit并将其写回(不作任何更改),就可以消除数量。我一定想念一些东西:

            SOOrderEntry graph = PXGraph.CreateInstance<SOOrderEntry>();

        // This section has a bunch of code to setup the header and the rest of the dat for the line.

        // tran is the SOLine,Line is the POLine I'm creating from...
        tran.BaseQty = line.OrderQty; // I've treid OrderQty and BaseQty

        tran = (SOLine)graph.Transactions.Update(tran); // Update this line in the graph

        graph.Actions.PressSave(); // Save the record

        // Load the splits for the newly created SO
        var spiltstek2 = PXSelect<SOLinesplit,Where<SOLinesplit.orderType,Equal<required<SOLinesplit.orderType>>,And<SOLinesplit.orderNbr,Equal<required<SOLinesplit.orderNbr>>,And<SOLinesplit.lineNbr,Equal<required<SOLinesplit.lineNbr>>>>>>.Select(graph,tran.OrderType,tran.OrderNbr,tran.LineNbr);
        
        foreach (SOLinesplit thesline in spiltstek2)
        {   
            SOLinesplit solscopy = (SOLinesplit)graph.Caches[typeof(SOLinesplit)].Createcopy(thesline);

            //solscopy.Qty = line.OrderQty; // Code for testing. This section would have the code to link it back to the PO,but is removed becuase even this much breaks it.
            
            graph.splits.Update(solscopy);
        }

        graph.Actions.PressSave(); // Save the record
        // At this point the SO is created and the OrderQty is 0
        

关于SOLinesplit和SOLine.OrderQty之间的关系,我一定会有所遗漏。

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)