更新Acumatica装运线的位置和ShipQty

时间:2016-05-13 11:33:48

标签: web-services acumatica

我在acumatica网络服务中遇到这个奇怪的问题,我正在使用webservices更新acumatica中的现有货件。我的代码应该更新Location和ShippedQty但是没有理由它更新除最后一个之外的所有项目。当货件有多个物品时会发生这种情况。请帮我解决这个问题,下面是我的代码和发货屏幕的图片,最后一项没有更新。

感谢。

var commands = new List<Acumatica_LSOne_Integration.SO302000.Command>();
        commands.Add(new SO302000.Value { Value = shipmentNbr, LinkedCommand = shipmentSchema.ShipmentSummary.ShipmentNbr });
        commands.Add(new SO302000.Value { Value = shipmentType, LinkedCommand = shipmentSchema.ShipmentSummary.Type });
        commands.Add(shipmentSchema.DocumentDetails.ShipmentNbr);
        commands.Add(shipmentSchema.DocumentDetails.LineNbr);
        commands.Add(shipmentSchema.DocumentDetails.InventoryID);
        commands.Add(shipmentSchema.DocumentDetails.Warehouse);
        commands.Add(shipmentSchema.DocumentDetails.Location);
        commands.Add(shipmentSchema.DocumentDetails.OrderedQty);
        var soLines = context.Submit(commands.ToArray());

        List<Acumatica_LSOne_Integration.SO302000.Command> commandList = new List<Acumatica_LSOne_Integration.SO302000.Command>();
        for (int index = 0; index < soLines.Length; index++)
        {
            string sShipNbr = soLines[index].DocumentDetails.ShipmentNbr.Value;
            string sLineNbr = soLines[index].DocumentDetails.LineNbr.Value;
            string sInventoryID = soLines[index].DocumentDetails.InventoryID.Value;
            string sWarehouse = soLines[index].DocumentDetails.Warehouse.Value;
            string sLocation = soLines[index].DocumentDetails.Location.Value;
            string sOrderedQty = soLines[index].DocumentDetails.OrderedQty.Value;

            commandList.Add(new SO302000.Key
            {
                ObjectName = shipmentSchema.DocumentDetails.ShipmentNbr.ObjectName,
                FieldName = shipmentSchema.DocumentDetails.ShipmentNbr.FieldName,
                Value = sShipNbr.Trim(), Commit = true                    
            });

            commandList.Add(new SO302000.Key
            {
                ObjectName = shipmentSchema.DocumentDetails.LineNbr.ObjectName,
                FieldName = shipmentSchema.DocumentDetails.LineNbr.FieldName,
                Value = sLineNbr.Trim(), Commit = true                    
            });
            commandList.Add(new SO302000.Value
            {
                Value = vLocation.Trim(),
                LinkedCommand = shipmentSchema.DocumentDetails.Location
            });
            commandList.Add(new SO302000.Value { Value = sOrderedQty, LinkedCommand = shipmentSchema.DocumentDetails.ShippedQty,IgnoreError = true, Commit = true });

        }

        commandList.Add(shipmentSchema.Actions.ConfirmShipmentAction);
        context.Submit(commandList.ToArray());

示例输出: enter image description here

2 个答案:

答案 0 :(得分:0)

我猜你已经允许你的库存有负数量,默认情况下,当某个项目在特定仓库中的数量为零时,该位置将设置为零,出货数量为零,并且正如我所见,你是代码,检查这个行代码

  

string sLocation = soLines [index] .DocumentDetails.Location.Value;

如果此soLine检索到一个值,我猜这条线是它不会更新的原因。

答案 1 :(得分:0)

我实际上已经提出了一个使用基于合同的Web服务运行良好的解决方案。以下是我的示例代码:

<TextBlock Text="1999-09-09 16:08" VerticalAlignment="Top" Visibility="Collapsed">
                                <TextBlock.Style>
                                    <Style BasedOn="{StaticResource TipTextYellow}" TargetType="TextBlock">
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding ElementName=Alcohol,Path=IsFocused}"  Value="True">
                                                <Setter Property="Visibility" Value="Visible"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </TextBlock.Style>
                            </TextBlock>