2016-05-13 6 views
0

私はacumatica webservicesでこの奇妙な問題を抱えています。私はwebservicesを使用してacumaticaの既存の出荷を更新しています。私のコードはLocationとShippedQtyを更新することになっていますが、それは最後のものを除くすべての項目を更新するものではありません。これは、出荷物に複数の品目がある場合に発生します。この問題を解決するのを手伝ってください。私のコードと最後のアイテムが更新されていない出荷画面のイメージがあります。Acumatica出荷ラインの場所とShipQtyの更新

ありがとうございました。

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

+0

コードはデバッグしようとしましたが、ループがすべての値を期待どおりに設定していることを確認しましたか? – Hybridzz

+0

これを試してみましたが、それはループして値をうまく設定します.... –

答えて

0

私は実際に契約ベースのWebサービスを使用してうまくいくソリューションを考え出しました。私のサンプルコードは以下の通りです:

0

私はあなたが項目がゼロの位置として設定されます、特定の倉庫の数量との出荷量を持っている場合、デフォルトでは、あなたの持ち物にマイナス数量を許可していることを推測あなたがコードであることがわかったので、この行コードを確認してください。

文字列sLocation = soLines [index] .DocumentDetails.Location.Value;

この行が値を取得する場合は、この行が更新されないためです。

+0

私はそうは思わない、別の場所変数を使ってvLocationのフィールドを更新する。 'commandList.Add(新しいSO302000.Value { 値= vLocation.Trim()、 LinkedCommand = shipmentSchema.DocumentDetails.Location }); –

関連する問題