PCID Build / Split / Merge From Stock - Help

image
Not error,just doesn’t add stock to PCID,Does anyone know how to deal with this?

image
No error, just doesn’t add stock to PCID,What can I do to solve this problem?

Gonna have to show your whole code.

using (var pkgSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.PkgControlIDBuildSplitMergeSvcContract>(Db))
{
   
    var Source_Part = CurrentUD101AR.ShortChar02;
    var Source_Qty = CurrentUD101AR.Number03;
   
    var Source_WareHouseCode = rcvDtl.WareHouseCode;
    var Source_BinNum = rcvDtl.BinNum;
    var Destination_PCID = CurrentUD101AR.ShortChar04;
    var Destination_BinNum = rcvDtl.BinNum;
    var destinationTabel = new Erp.Tablesets.PCIDBuildSplitMergeDestTableset();
    var partTable = new Erp.Tablesets.PCIDBuildSplitMergeSourcePartTableset();
 
    pkgSvc.GetNewPCIDDestination(ref destinationTabel);
    pkgSvc.GetNewPCIDPart(ref partTable);
    string warehouseCode = Source_WareHouseCode;
    string warehouseDesc = "";
    pkgSvc.GetDefaultWarehouse(out warehouseCode, out warehouseDesc);

    //----------------------------Source Part----------------------------------

    var newSourcePartNum = Source_Part;
    var newSourceWarehouseCode = Source_WareHouseCode;
    if (partTable.PCIDBuildSplitMergeSourcePart.FirstOrDefault().WarehouseCode != Source_WareHouseCode)
    {
        partTable.PCIDBuildSplitMergeSourcePart.FirstOrDefault().WarehouseCode = Source_WareHouseCode;
        partTable.PCIDBuildSplitMergeSourcePart.FirstOrDefault().WarehouseDescription = warehouseDesc;
    }
    pkgSvc.OnChangeSourcePartNum(newSourcePartNum, newSourceWarehouseCode, ref partTable);

    var newSourceBinNum = Source_BinNum;
    pkgSvc.OnChangeSourcePartBinNum(newSourceBinNum, ref partTable);

    var sourceQuantity = Source_Qty;
    pkgSvc.OnChangeSourceQty(sourceQuantity, ref partTable);

    //----------------------------Source Part----------------------------------

    //----------------------------Destination PCID----------------------------------
    var newDestPCID = Destination_PCID;
    var getPCIDContents = true;

    if (destinationTabel.PCIDBuildSplitMergeDest.FirstOrDefault().WarehouseCode != Source_WareHouseCode)
    {
        destinationTabel.PCIDBuildSplitMergeDest.FirstOrDefault().WarehouseCode = Source_WareHouseCode;
        destinationTabel.PCIDBuildSplitMergeDest.FirstOrDefault().WarehouseDescription = warehouseDesc;
    }
    pkgSvc.OnChangeDestPCID(newDestPCID, getPCIDContents, ref destinationTabel);

    if (destinationTabel.PCIDBuildSplitMergeDest.FirstOrDefault().BinNum != Destination_BinNum)
    {
        destinationTabel.PCIDBuildSplitMergeDest.FirstOrDefault().BinNum = Destination_BinNum;
        destinationTabel.PCIDBuildSplitMergeDest.FirstOrDefault().BinNumEnabled = true;
    }
    //----------------------------Destination PCID----------------------------------



    string negativeQuantityAction = "";
    string message = "";
    pkgSvc.NegativeInventoryTest(Source_Part, Source_WareHouseCode, Source_BinNum, "", 0, "", "EA", 1, Source_Qty, out negativeQuantityAction, out message);
    var destPCID = Destination_PCID;
    pkgSvc.AddPartToPCID(ref pkgPartTabel, ref pkgDestinationTabel); //didn't add part to PCID
    
 
}

This is my entire code
pkgSvc.AddPartToPCID(ref pkgPartTabel, ref pkgDestinationTabel); //didn’t add part to PCID

Are you trying to create a new destination pcid on the fly with this?

If, so, I do not believe you can this way.

PCIDs need to be generated first.

The PCID is created in advance, and it’s all empty.

1 Like

Then try retrieving it like this:

pkgSvc.GetDestPCID(Destination_PCID, false, ref destinationTabel);

Instead of making a new row with: pkgSvc.GetNewPCIDDestination(ref destinationTabel);

string strCompany = callContextClient.CurrentCompany;
var context = Ice.Services.ContextFactory.CreateContext<ErpContext>();
var erpContext = new Erp.Internal.Lib.CCredChk(context);
using (var pkgSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.PkgControlIDBuildSplitMergeSvcContract>(context))
{
    var destinationTabel = new Erp.Tablesets.PCIDBuildSplitMergeDestTableset();
    var partTable = new Erp.Tablesets.PCIDBuildSplitMergeSourcePartTableset();
    
    
        
    string newSourcePartNum = "3STXXXX",newSourceWarehouseCode = "2",newSourceBinNum = "001",newSourceLotNum = "552_50",newDestPCID = "P0507241439311003",message = "",negativeQuantityAction = "";
    decimal decQty = 1;
    
    string strware = "";
    string warehouseDesc = "12F";
      
    
    1.pkgSvc.GetDestPCID(newDestPCID,true,ref destinationTabel);
    
    2.pkgSvc.GetNewPCIDPart(ref partTable);
    
    3.pkgSvc.OnChangeSourcePartNum(newSourcePartNum,newSourceWarehouseCode,ref partTable);
    partTable.PCIDBuildSplitMergeSourcePart.FirstOrDefault().WarehouseCode = newSourceWarehouseCode;
    partTable.PCIDBuildSplitMergeSourcePart.FirstOrDefault().WarehouseDescription = warehouseDesc;
    4.pkgSvc.OnChangeSourcePartBinNum(newSourceBinNum,ref partTable);
    
    5.pkgSvc.OnChangeSourcePartLotNum(newSourceLotNum,ref partTable);
    
    6.pkgSvc.OnChangeSourceQty(decQty,ref partTable);
    
    7.pkgSvc.OnChangeDestPCID(newDestPCID,true,ref destinationTabel);
    
    destinationTabel.PCIDBuildSplitMergeDest.FirstOrDefault().BinNum = newSourceBinNum;
    destinationTabel.PCIDBuildSplitMergeDest.FirstOrDefault().BinDescription = newSourceBinNum;    
        
    8.pkgSvc.NegativeInventoryTest(newSourcePartNum,newSourceWarehouseCode,newSourceBinNum,newSourceLotNum,0,"","EA",1,decQty,out message,out negativeQuantityAction);        
    
    9.pkgSvc.AddPartToPCIDAndRefreshDest(ref partTable,ref destinationTabel,newDestPCID,newSourceWarehouseCode);
    
}

context.Dispose();
erpContext.Dispose();

I tried the new code, but it still didn’t work

I cleaned up your code and put it in a function.

Hopefully this will be clearer what’s going on.

wuwenben2.efxb (4.7 KB)

Function Code:


try
{
    string strCompany = Session.CompanyID;
    
    CallService<Erp.Contracts.PkgControlIDBuildSplitMergeSvcContract>(pkgSvc =>
    {
        var destinationTable = new Erp.Tablesets.PCIDBuildSplitMergeDestTableset();
        var sourceTable        = new Erp.Tablesets.PCIDBuildSplitMergeSourcePartTableset();
    
    
        string
          message = "",
          negativeQuantityAction = "";
          
          
        pkgSvc.GetNewPCIDPart(ref sourceTable);
        pkgSvc.GetDestPCID(destPCID, true, ref destinationTable);
        
        
        var sourceRow = sourceTable.PCIDBuildSplitMergeSourcePart.FirstOrDefault();
        var destRow   = destinationTable.PCIDBuildSplitMergeDest.FirstOrDefault();
        
        output2 = JsonConvert.SerializeObject(sourceRow);
        
        pkgSvc.OnChangeSourcePartNum(partNum, sourceWarehouseCode, ref sourceTable);
    
        sourceRow.WarehouseCode        = sourceWarehouseCode;
        sourceRow.WarehouseDescription = sourceWarehouseDesc;
        
        pkgSvc.OnChangeSourcePartBinNum(sourceBinNum, ref sourceTable);
        
        pkgSvc.OnChangeSourcePartLotNum(sourceLotNum, ref sourceTable);
        
        pkgSvc.OnChangeSourceQty(decQty, ref sourceTable);
        
        output3 = JsonConvert.SerializeObject(sourceRow);
        
        pkgSvc.OnChangeDestPCID(destPCID, true, ref destinationTable);
        
        destRow.BinNum         = destBinNum;
        destRow.BinDescription = destBinNum;
        
        output4 = JsonConvert.SerializeObject(destRow);
            
        pkgSvc.NegativeInventoryTest(partNum, sourceWarehouseCode, sourceBinNum, sourceLotNum, 0, "", dimCode, 1, decQty, out message, out negativeQuantityAction);  //No PCID, this is from stock
        
        output5 = message + Environment.NewLine + negativeQuantityAction;
        
        pkgSvc.AddPartToPCIDAndRefreshDest(ref sourceTable, ref destinationTable, destPCID, destWarehouseCode);
        
    });
    
}
catch (Exception ex)
{
    output = ex.Message; 
}

Payload:

{
  "partNum": "048700-0400-011",
  "sourceWarehouseCode": "FIN",
  "sourceWarehouseDesc": "Finished Goods",
  "sourceBinNum": "WARE",
  "sourceLotNum": "10171412",
  "destPCID": "5012379",
  "destWarehouseCode": "FIN",
  "destBinNum": "WARE",
  "decQty": 5,
  "dimCode": "BG"
}

Before:

After:

Function Output:

{
  "output": null,
  "output2": "{\"ColumnNames\":0,\"Company\":\"NOPE\",\"Plant\":\"\",\"PartNum\":\"\",\"PartDescription\":\"\",\"BinNum\":\"\",\"BinDescription\":\"\",\"LotNum\":\"\",\"LotTrackedPart\":false,\"SerialTrackedPart\":false,\"OnHandQuantity\":0.0,\"SourceQuantity\":0.0,\"AvailableQuantity\":0.0,\"WarehouseCode\":\"\",\"WarehouseDescription\":\"\",\"SourceUOM\":\"\",\"AvailableUOM\":\"\",\"OnHandUOM\":\"\",\"AttributeSetID\":0,\"AttributeSetShortDescription\":\"\",\"AttributeSetDescription\":\"\",\"EnableAttributeSetSearch\":false,\"PartAttrClassID\":\"\",\"PartTrackInventoryAttributes\":false,\"DispNumberOfPieces\":0.0,\"PartTrackInventoryByRevision\":false,\"RevisionNum\":\"\",\"SysRowID\":\"2bb04325-da95-47b5-99b4-e71837c5aa95\",\"RowMod\":\"A\",\"SpecifiedProperties\":\"AQAADA==\",\"UserDefinedColumns\":{}}",
  "output3": "{\"ColumnNames\":0,\"Company\":\"NOPE\",\"Plant\":\"\",\"PartNum\":\"048700-0400-011\",\"PartDescription\":\"60 x 22 x112  4 MIL  (25 bgs/roll) MS-1420 (5600022-0050)\",\"BinNum\":\"WARE\",\"BinDescription\":\"Warehouse\",\"LotNum\":\"10171413\",\"LotTrackedPart\":true,\"SerialTrackedPart\":false,\"OnHandQuantity\":19.00000000,\"SourceQuantity\":5.0,\"AvailableQuantity\":19.00000000,\"WarehouseCode\":\"FIN\",\"WarehouseDescription\":\"Finished Goods\",\"SourceUOM\":\"BG\",\"AvailableUOM\":\"BG\",\"OnHandUOM\":\"BG\",\"AttributeSetID\":0,\"AttributeSetShortDescription\":\"\",\"AttributeSetDescription\":\"\",\"EnableAttributeSetSearch\":false,\"PartAttrClassID\":\"\",\"PartTrackInventoryAttributes\":false,\"DispNumberOfPieces\":0.0,\"PartTrackInventoryByRevision\":false,\"RevisionNum\":\"\",\"SysRowID\":\"2bb04325-da95-47b5-99b4-e71837c5aa95\",\"RowMod\":\"A\",\"SpecifiedProperties\":\"/f//Dw==\",\"UserDefinedColumns\":{}}",
  "output4": "{\"ColumnNames\":0,\"Company\":\"NOPE\",\"PCID\":\"5012379\",\"PkgControlStatus\":\"STOCK\",\"PkgControlIDCode\":\"PALLET\",\"PkgCode\":\"PALLET\",\"PkgControlIDDesc\":\"Pallet\",\"WarehouseCode\":\"FIN\",\"PreviousPCID\":\"\",\"Plant\":\"MfgSys\",\"PkgCodeDescription\":\"Pallet\",\"BinNum\":\"WARE\",\"BinDescription\":\"WARE\",\"WarehouseDescription\":\"\",\"PCIDContainsChildParts\":false,\"PCIDContainsChildPCIDs\":false,\"BinNumEnabled\":false,\"SerialNumberTracking\":false,\"SysRowID\":\"00000000-0000-0000-0000-000000000000\",\"RowMod\":\"A\",\"SpecifiedProperties\":\"f48H\",\"UserDefinedColumns\":{}}",
  "output5": "\r\n",
  "output6": null
}
2 Likes
try
{
    string strCompany = Session.CompanyID;
    
    CallService<Erp.Contracts.PkgControlIDBuildSplitMergeSvcContract>(pkgSvc =>
    {
        var destinationTable = new Erp.Tablesets.PCIDBuildSplitMergeDestTableset();
        var sourceTable        = new Erp.Tablesets.PCIDBuildSplitMergeSourcePartTableset();
    
    
        string
          message = "",
          negativeQuantityAction = "";
          
          
        pkgSvc.GetNewPCIDPart(ref sourceTable);
        pkgSvc.GetDestPCID(destPCID, true, ref destinationTable);
        
        
        var sourceRow = sourceTable.PCIDBuildSplitMergeSourcePart.FirstOrDefault();
        var destRow   = destinationTable.PCIDBuildSplitMergeDest.FirstOrDefault();
        
        output2 = JsonConvert.SerializeObject(sourceRow);
        
        pkgSvc.OnChangeSourcePartNum(partNum, sourceWarehouseCode, ref sourceTable);
    
        sourceRow.WarehouseCode        = sourceWarehouseCode;
        sourceRow.WarehouseDescription = sourceWarehouseDesc;
        
        pkgSvc.OnChangeSourcePartBinNum(sourceBinNum, ref sourceTable);
        
        pkgSvc.OnChangeSourcePartLotNum(sourceLotNum, ref sourceTable);
        
        pkgSvc.OnChangeSourceQty(decQty, ref sourceTable);
        
        output3 = JsonConvert.SerializeObject(sourceRow);
        
        pkgSvc.OnChangeDestPCID(destPCID, true, ref destinationTable);
        
        destRow.WarehouseCode        = sourceWarehouseCode;
        destRow.WarehouseDescription = sourceWarehouseDesc;
        destRow.BinNum         = destBinNum;
        destRow.BinDescription = destBinNum;
        
        output4 = JsonConvert.SerializeObject(destRow);
            
        pkgSvc.NegativeInventoryTest(partNum, sourceWarehouseCode, sourceBinNum, sourceLotNum, 0, "", dimCode, 1, decQty, out message, out negativeQuantityAction);  //No PCID, this is from stock
        
        output5 = message + Environment.NewLine + negativeQuantityAction;
        
        pkgSvc.AddPartToPCIDAndRefreshDest(ref sourceTable, ref destinationTable, destPCID, destWarehouseCode);
        
    });
    
}
catch (Exception ex)
{
    output = ex.Message; 
}

PayLoad:


After:

versions:
1720427510128

I tried the code you gave me, but it didn’t work :face_with_monocle:

It’s not the code that doesn’t work. Something is wrong with what you are sending it.

I tried your code again
AddPartToPCID is valid for static generated PCID
AddPartToPCID is invalid for dynamic generated PCID :broken_heart:


Don’t know what’s going on with yours. All my pcids are dynamic.

1 Like