-1

Bin/Lot/Serial アイテムを Acumatica 出荷ラインに追加する Web サービスを介して Acumatica 出荷を作成できますが、グリッド内の各ラインに Bin/Lot Number を追加する際に問題が発生します。出荷時にドキュメント詳細行が 1 つしかない場合は正常に機能していますが、ドキュメント詳細に複数の行がある場合、コードは機能していないようです。これを達成するために私が使用している Acumatica コードを以下に示します。

SO302000Content soShipcontent = content.SO302000GetSchema();
List<Command> scmds = new List<Command>();
List<LineDetails> splits = new List<LineDetails>();
CreateShipmentHeader(soShipcontent, hparams, ref scmds, Ordernumber);
var shipmentresults = content.SO302000Submit(scmds.ToArray());
if (shipmentresults != null && shipmentresults.Length > 0)
{
int linen = 0;
List<Command> cmds = new List<Command>();
foreach (var row in shipmentresults)
{                           
SO302000Content c = (SO302000Content)row;
cmds.Add(new Value { Value = linen.ToString(), LinkedCommand = soShipcontent.AddSalesOrder.ServiceCommands.RowNumber });
cmds.Add(new Value { Value = "True", LinkedCommand = soShipcontent.AddSalesOrder.Selected, Commit = true });
LineDetails ld = details.Find(x => x.InventoryId == c.AddSalesOrder.InventoryID.Value.ToString().Trim());
if (ld != null)
{
LineDetails splitno = new LineDetails();
splitno.InventoryId = ld.InventoryId;
splitno.Location = ld.Location;
splitno.LotNo = ld.LotNo;
splitno.Quantity = c.AddSalesOrder.Quantity.Value.ToString().Trim();
splitno.LineNumber = (linen).ToString();
splits.Add(splitno);
} 
linen++;
}

cmds.Add(soShipcontent.Actions.AddSO);
content.SO302000Submit(cmds.ToArray());

foreach (LineDetails s in splits)
{
List<Command> cmdsplit = new List<Command>();
cmdsplit.Add(new Value { Value = s.LineNumber, LinkedCommand = soShipcontent.BinLotSerialNumbers.ServiceCommands.RowNumber });
cmdsplit.Add(new Value { Value = s.InventoryId, LinkedCommand = soShipcontent.BinLotSerialNumbers.InventoryID, Commit = true });
cmdsplit.Add(new Value { Value = s.Location, LinkedCommand = soShipcontent.BinLotSerialNumbers.Location, Commit = true });
cmdsplit.Add(new Value { Value = s.LotNo, LinkedCommand = soShipcontent.BinLotSerialNumbers.LotSerialNbr });
cmdsplit.Add(new Value { Value = s.Quantity, LinkedCommand = soShipcontent.BinLotSerialNumbers.Quantity });                            
content.SO302000Submit(cmdsplit.ToArray());                         
}                      
}

List<Command> cmds1 = new List<Command>();
string shipmentnbr = string.Empty;
cmds1.Add(soShipcontent.Actions.Save);
cmds1.Add(soShipcontent.ShipmentSummary.ShipmentNbr);
content.SO302000Submit(cmds1.ToArray());

以下のコードも試しました:

cmds.Add(soShipcontent.BinLotSerialNumbers.ServiceCommands.NewRow);
cmdsplit.Add(new Value { Value = s.Location, LinkedCommand = soShipcontent.BinLotSerialNumbers.Location});
cmdsplit.Add(new Value { Value = s.LotNo, LinkedCommand = soShipcontent.BinLotSerialNumbers.LotSerialNbr });
cmdsplit.Add(new Value { Value = s.Quantity, LinkedCommand = soShipcontent.BinLotSerialNumbers.Quantity, Commit = true });
cmdsplit.Add(new Value { Value = s.InventoryId, LinkedCommand = soShipcontent.BinLotSerialNumbers.InventoryID });
cmdsplit.Add(new Key { Value = "='" + s.InventoryId + "'", FieldName = soShipcontent.DocumentDetails.InventoryID.FieldName, ObjectName = soShipcontent.DocumentDetails.InventoryID.ObjectName });
4

1 に答える 1

0

実際には私はあなたのコードに従っていませんが、acumatica の割り当て SN はアイテムの設定に自動的に依存すると思います。それ以外の場合は、SN を手動で割り当てることができます。

最も単純な例は、詳細レベルで数量 = 1 の場合です。以下のコードを参照してください。

            Content[] result = context.Submit(
            new Command[]
            {
                new Value { Value = "000200", LinkedCommand = SO302000.ShipmentSummary.ShipmentNbr, Commit = true },

                //navigate to line
                new Key
                {
                    ObjectName = SO302000.DocumentDetails.InventoryID.ObjectName,
                    FieldName = SO302000.DocumentDetails.InventoryID.FieldName,
                    Value = "='INCLUTA009'"
                },

                new Value { Value = "20SP0610", LinkedCommand = SO302000.DocumentDetails.LotSerialNbr, Commit = true },

                SO302000.Actions.Save
            }
        );
于 2014-09-17T10:23:31.087 に答える