创建装运后,销售订单状态不变

时间:2018-10-25 13:47:57

标签: acumatica

am在自定义屏幕上使用以下代码创建了类型为Transfer的货运,货运已成功创建,但Sales Order屏幕中的状态未更新,并且不允许我再次从Sales Order屏幕中创建货运货品未结,确认货品后状态会更新。有人可以帮我吗

soShipmentGraph.CreateShipment(soOrderGraph.Document.Current, graph.Document.Current.SiteID, graph.Document.Current.ShipDate, false, SOOperation.Issue, created);

1 个答案:

答案 0 :(得分:1)

如果在创建货件期间未引发任何异常,状态将根据SOOrder.UpdateShipmentCntr字段值更新到CreateShipment方法的末尾:

if (order.OpenShipmentCntr > 0)
{
   order.Status = SOOrderStatus.Shipping;
   order.Hold = false;
   soorder.Update(order);
}

OpenShipmentCntr字段由SOShipmentEntry.UpdateShipmentCntr方法更新:

protected virtual void UpdateShipmentCntr(PXCache sender, object Row, short? Counter)
{
    SOOrder order = (SOOrder)PXParentAttribute.SelectParent(sender, Row, typeof(SOOrder));
    if (order != null)
    {
        order.ShipmentDeleted = (Counter == -1) ? true : (bool?)null;
        order.ShipmentCntr += Counter;
        if (((SOOrderShipment)Row).Confirmed == false)
        {
            order.OpenShipmentCntr += Counter;
        }
        soorder.Cache.SetStatus(order, PXEntryStatus.Updated);
    }
}

在创建货件时,SOShipmentEntry应该插入一个SOOrderShipment记录,该记录将SOOrder(销售订单)与SOShipment(装运)记录链接在一起。 SOOrderShipment应该在货件的“订单”标签中可见:

enter image description here

在插入SOOrderShipment记录后,将引发SOShipmentEntry中的SOOrderShipment RowInserted事件:

protected virtual void SOOrderShipment_RowInserted(PXCache sender, PXRowInsertedEventArgs e)
{
    UpdateShipmentCntr(sender, e.Row, (short)1);
}

我无法确定状态不会更改的原因,所以我建议调试导致销售订单状态更改的步骤。