Acumatica 如何在确认前检查装运线?

Acumatica 如何在确认前检查装运线?,acumatica,Acumatica,在确认验证数据之前,我正在尝试循环通过SOShipLines。我有超控功能,但似乎不知道我是如何在记录中移动的。错误(设置为“始终跳闸”)始终返回0行。我很确定我需要查看shiporder变量,但不知道如何查看 public void confirmShipping(SOOrderEntry docgraph、SoShipping ShippOrder、confirmShippmentDelegate baseMethod) { 整数=0; 内线=0; 字符串TheTest=“”; SOShi

在确认验证数据之前,我正在尝试循环通过SOShipLines。我有超控功能,但似乎不知道我是如何在记录中移动的。错误(设置为“始终跳闸”)始终返回0行。我很确定我需要查看
shiporder
变量,但不知道如何查看


public void confirmShipping(SOOrderEntry docgraph、SoShipping ShippOrder、confirmShippmentDelegate baseMethod)
{
整数=0;
内线=0;
字符串TheTest=“”;
SOShipLineExt TheSOLineExt=null;
foreach(Base.Transactions.Select()中的SOShipLine行)
{
这些线+=1;
TheSOLineExt=PXCache.GetExtension(行);
测试+=“-”+SOLINEEXT.USRSpeedShippedPieces;
if(TheSOLineExt.usrspeedShippedPieces==null)
{
计数+=1;
}
//UpdateLineDirect(Base.Caches[typeof(SOLine)],行);
};
//}; 如果(计数>0)
抛出新的PXException(“见鬼!!!”+Convert.ToString(TheCount)+“/”+Convert.ToString(TheLines));
基本方法(docgraph、shiporder);
}
提前谢谢


-Travis

问题似乎出现在未定义的当前
SOShipping
记录中。请查看
Base.Transactions
视图-那里有
当前的定义

public PXSelect<SOShipLine, 
    Where<SOShipLine.shipmentNbr, Equal<Current<SOShipment.shipmentNbr>>>, 
    OrderBy<Asc<SOShipLine.shipmentNbr, Asc<SOShipLine.sortOrder>>>> Transactions;
我假设当前的
soshipping
记录在
confirmShipping
方法之前的某个地方跳过-这就是
Base.Transactions.Select()
不返回任何内容的原因

从我的角度来看,有两种可能的解决方案:


将当前
SoShipping
记录设置为与
SoShipping ShippOrder
参数相等,因为它是在基本
confirmShipping
方法中完成的

Base.Clear() // maybe this is a good idea to call the Clear method too
Document.Current = Document.Search<SOShipment.shipmentNbr>(shiporder.ShipmentNbr);
Base.Clear()//也许调用Clear方法也是个好主意
Document.Current=Document.Search(shiporder.ShipmentNbr);

使用所需参数而不是当前参数编写您自己的BQL选择

foreach (SOShipLine line in PXSelect<SOShipLine,
    Where<SOShipLine.shipmentNbr, Equal<Required<SOShipment.shipmentNbr>>>,
    OrderBy<Asc<SOShipLine.shipmentNbr, Asc<SOShipLine.sortOrder>>>>
    .Select(Base, shiporder.ShipmentNbr))
{
    // do something here
}
foreach(PXSelect中的SOShipLine行
.选择(基本,shiporder.ShipmentNbr))
{
//在这里做点什么
}

查看solineext.usrspeedShippedPieces==null->您确定该值为null而不是0吗?也许可以尝试一下(TheSOLineExt.UsrSpeedyShippedPieces==null | | TheSOLineExt.UsrSpeedyShippedPieces==0){},看看这是否符合您的条件。另外,如果您没有在VisualStudio中使用Debug来监视foreach循环,您可以在foreach块中嵌入PXTrace.WriteInformation(“您在这里”),以确保它实际按照预期检索记录。因为PXException在foreach块之后,所以即使您没有找到任何SOShipLine记录,它也会触发。正如Brian Stevens所说,应该对其进行调试。
foreach (SOShipLine line in PXSelect<SOShipLine,
    Where<SOShipLine.shipmentNbr, Equal<Required<SOShipment.shipmentNbr>>>,
    OrderBy<Asc<SOShipLine.shipmentNbr, Asc<SOShipLine.sortOrder>>>>
    .Select(Base, shiporder.ShipmentNbr))
{
    // do something here
}