Epicor 10在BPM工作流设计器中链接BAQ(避免自定义代码)

时间:2017-05-24 20:55:36

标签: erp epicor10

目前,我的任务是审查由Epicor创建的BPM,该BPM未按预期运行。目前,基于以下代码的BPM,其目的是引用系统中的订单,并且如果价格发生变化,订单/部件的时间将反映新的价格。似乎代码导致从不期望的客户检索不正确的价格表。例如,价格表附加到客户#1242,但是它根据客户#1269更新价格。 (猜测他们共享一个共同部分#并且代码检索最新值)

现在我的问题是我没有编写代码的经验,我之前已经审查了代码,但在很小的程度上,以及我上面提供给我的内容。现在我认为可能更容易理解的是在BPM中创建BAQ和参考,并使用BAQ作为BPM更新价格的参考。

通过研究一些论坛和Epicors培训材料,我还没有找到关于如何在BPM中链接BAQ的明确答案。

(如果我的描述有意义并且代码反映了问题,请随意猜猜)

BPM代码:

var ttShipHead_xRow = (from ttShipHead_Row in ttShipHead
                      where ttShipHead_Row.ReadyToInvoice == true
                      select ttShipHead_Row).FirstOrDefault();
if (ttShipHead_xRow != null)
{

foreach (var ShipDtl_iterator in (from ShipDtl_Row in Db.ShipDtl
                                            where ttShipHead_xRow.PackNum == ShipDtl_Row.PackNum
                                            && ttShipHead_xRow.Company == ShipDtl_Row.Company
                                            select ShipDtl_Row))
{
var ShipDtl_xRow = ShipDtl_iterator;
//ShipDtl_xRow.UnitPrice = 1;
var today = DateTime.Today;
 var PriceList_xRow = (from PriceLst_Row in Db.PriceLst
                                                from PriceLstParts_Row in Db.PriceLstParts
                                             where ShipDtl_xRow.PartNum == PriceLstParts_Row.PartNum
                                                && PriceLst_Row.ListCode == PriceLstParts_Row.ListCode
                                                && PriceLst_Row.Company == PriceLstParts_Row.Company
                                                && PriceLst_Row.Company == ShipDtl_xRow.Company
                                                && PriceLst_Row.EndDate >= today
                             select PriceLstParts_Row).FirstOrDefault();                                     
                    if (PriceList_xRow != null)
                  {
                                    var OrderDtl_xRow = (from OrderDtl_Row in Db.OrderDtl
                                                                       where ShipDtl_xRow.OrderLine == OrderDtl_Row.OrderLine
                                                                       && ShipDtl_xRow.PartNum == OrderDtl_Row.PartNum
                                                                          && ShipDtl_xRow.OrderNum == OrderDtl_Row.OrderNum
                                                                            && ShipDtl_xRow.Company == OrderDtl_Row.Company
                                                                            select OrderDtl_Row).FirstOrDefault(); 
                                                    {                                     
                                             if (OrderDtl_xRow != null)
                                                    {
                                                                                            if (ShipDtl_xRow.UnitPrice != PriceList_xRow.BasePrice)
                                                                                            {
                                                                                                ShipDtl_xRow.UnitPrice = PriceList_xRow.BasePrice;
                                                                                            }
                                                                                            if (ShipDtl_xRow.UnitPrice != OrderDtl_xRow.UnitPrice)
                                                                                            {
                                                                                                OrderDtl_xRow.DocUnitPrice = PriceList_xRow.BasePrice;
                                                                                                OrderDtl_xRow.UnitPrice = PriceList_xRow.BasePrice;     
                                                                                            }
                                                    } 
                                                     }
          } 
        } 
    }

1 个答案:

答案 0 :(得分:0)

我解决了代码但仍然无法确定在BPM中链接BAQ的有效方法

问题是以下代码丢失了:

&& ttShipHead_xRow.CustNum == ShipDtl_Row. CustNum

到第一个foreach声明。