Acumatica:UOM的单位基础是只读的吗?

问题描述 投票:0回答:1

我正在更新非/库存项目,因为错误的UOM,但某些项目的单位基数是只读的。我该如何更新?

我想避免再次删除和添加项目。

acumatica
1个回答
0
投票

基本答案是:Base UOM cannot be changed for the item in use.

通常,in use的含义是指在已发布文档的交易明细中使用该库存项目。

验证机制使用PreventEditIfExists类位于DAC中。

InventoryItem DAC具有通用验证查询:

public abstract class baseUnit : PX.Data.IBqlField
{
    public class PreventEditIfExists<TSelect> : PreventEditOf<baseUnit>.On<InventoryItemMaintBase>.IfExists<TSelect>
        where TSelect : BqlCommand, new()
    {
        protected override String CreateEditPreventingReason(GetEditPreventingReasonArgs arg, Object firstPreventingEntity, String fieldName, String currentTableName, String foreignTableName)
            => PXMessages.Localize(Messages.BaseUnitCouldNotBeChanged);
    }
}

其他DAC使用通用查询类型<TSelect>来验证库存项是否为in use

例如,这是在INTran字段上的INTran.InventoryID DAC中定义的验证查询:

public abstract class inventoryID : PX.Data.IBqlField
{
    public class InventoryBaseUnitRule :
        InventoryItem.baseUnit.PreventEditIfExists<
            Select<INTran,
            Where<inventoryID, Equal<Current<InventoryItem.inventoryID>>,
                And<released, NotEqual<True>>>>>
    { }
}

因此,如果我创建一个新的库存项目,我可以更改它的BaseUOM字段,因为它不是任何地方的in use。如果我然后为该项目创建库存收据并将其释放,则会创建已发布的INTran交易,因此该项目的BaseUOM将变为in use且不可编辑。

我认为这种行为的原因是为了保留过去事务的统计准确性,而不必在每个事务上缓存(复制)UOM,以防用户稍后更改它。如果是这种情况,那么在让用户随时更改任何内容并保持数据库大小受到大交易量控制之间需要权衡。

验证不仅限于收据交易。您可以在源代码页(SM204570)中搜索baseUnit.PreventEditIfExists的Acumatica源代码,找到其他DAC的验证请求:enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.