我在采购收据的分配面板上添加了一个客户字段“UsrWgtIndex”。它的值是另一个自定义字段“UsrWgtPerUnit”的总和。
但奇怪的事情发生了。当我打开不同的分配面板时,UsrWgtIndex的值保持不变。它始终是第一行转换的价值。
我的代码如下,我对此感到困惑。在逻辑中,代码将对每行转换求和,并分配“UsrWgtIndex”的每一行。但它始终是第一行的价值。
任何人都可以提供帮助吗?非常感谢!
namespace PX.Objects.PO {
public class POReceiptEntry_Extension: PXGraphExtension < POReceiptEntry > {
#region Event Handlers
decimal totalCgt = 0 M,
tempTotal = 0 M;
protected void POReceiptLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e) {
POReceiptLine poRLine = (POReceiptLine) e.Row;
if (poRLine != null) {
totalCgt = 0 M;
foreach(POReceiptLineSplit line in Base.splits.Select()) {
POReceiptLineSplitExt poReceiptLineSplitExt = line.GetExtension < POReceiptLineSplitExt > ();
var recentQty = poReceiptLineSplitExt.UsrWgtPerUnit;
var temp = Convert.ToDecimal(recentQty);
totalCgt = totalCgt + temp;
};
var cgt = Convert.ToDecimal(totalCgt);
if (totalCgt != null) {
cache.SetValue < POReceiptLineExt.usrTotalWgt > (poRLine, cgt);
//This line is setting the value of usrWgtIndex
cache.SetValue < POReceiptLineExt.usrWgtIndex > (poRLine, cgt);
};
}
}
}
}
更多细节更新:
更多细节更新2:
我没有在DAC LotSerOptions上添加“UsrWgtIndex”。我在POReceiptLine上添加了它。因为当我在LotSerOptions上添加自定义字段时,我无法使用setValueEXT方法分配其值,似乎没有名为“LotSerOptionsExt”的DAC。 所以我只把“UsrWgtIndex”放在DAC POReceiptLine上,并用
赋值cache.SetValue<POReceiptLineExt.usrWgtIndex>(poRLine, cgt);
答案 0 :(得分:0)
&#39;分裂&#39; DataView依赖于&#39; Current&#39; POReceiptLine:
PXSelect<POReceiptLineSplit, Where<POReceiptLineSplit.receiptNbr, Equal<Current<POReceiptLine.receiptNbr>>,
And<POReceiptLineSplit.lineNbr, Equal<Current<POReceiptLine.lineNbr>>,
And<Where<POLineType.goodsForInventory, Equal<Current<POReceiptLine.lineType>>,
Or<POLineType.goodsForSalesOrder, Equal<Current<POReceiptLine.lineType>>,
Or<POLineType.goodsForDropShip, Equal<Current<POReceiptLine.lineType>>>>>>>>> splits;
问题在于&#39;当前&#39;当用户在&#39;交易中点击(选择)另一个POReceiptLine时,POReceiptLine不会改变。网格。设置网格&#39; SyncPosition&#39;在您的自定义项目中应该确保&#39;当前&#39;用户更改网格中的记录选择时正确设置值: