微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决创建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 举报,一经查实,本站将立刻删除。