Hello!
I hope someone could help me with this issue:
I’m working on a solution that creates a kit specification. I haven’t done any extensions for the kit specification DAC or Graph, I’m working with an stock 24R1 instance. However, when I save the record, I get this error:
Cannot insert the value NULL into column 'NoteID', table '24R1.dbo.INKitSpecHdr'; column does not allow nulls. INSERT fails. The statement has been terminated.
I haven’t came across this issue before… Usually, when I save a record I don’t have to care about genereting the noteID. Specially if its not a customized DAC and graph.
Is there something I’m Missing?
private static void ACUCreateKit(INKitSpecMaint kitGraph, USRMXCBOMSProduct productToSync)
{
kitGraph.Clear();
INKitSpecHdr kitSpec = new INKitSpecHdr();
kitSpec.KitInventoryID = productToSync.InventoryID;
kitSpec.RevisionID = "WEB";
kitSpec.Descr = productToSync.MPlaceName + " - " + productToSync.MPlaceType;
kitSpec.IsActive = true;
kitSpec.AllowCompAddition = false;
kitGraph.Hdr.Insert(kitSpec);
List<string> kitDetails = productToSync.GroupedProducts.Split(',').ToList();
int added = 0;
int inMP = kitDetails.Count();
foreach (string detail in kitDetails)
{
List<USRMXCBOMSProduct> componentList = SelectFrom<USRMXCBOMSProduct>
.Where<USRMXCBOMSProduct.mPlaceProductID.IsEqual<@P.AsString>
.And<USRMXCBOMSProduct.active.IsEqual<@P.AsBool>>>.View.Select(kitGraph, detail.Trim(), true).RowCast<USRMXCBOMSProduct>().ToList();
if (componentList.Count() == 1)
{
USRMXCBOMSProduct component = componentList.FirstOrDefault();
InventoryItem itemType = InventoryItem.PK.Find(kitGraph, component.InventoryID);
if (itemType.StkItem.Value)
{
INKitSpecStkDet kitDetStk = new INKitSpecStkDet();
kitDetStk.CompInventoryID = component.InventoryID;
kitDetStk.DfltCompQty = 1;
kitGraph.StockDet.Insert(kitDetStk);
}
else
{
INKitSpecNonStkDet kitDetNStk = new INKitSpecNonStkDet();
kitDetNStk.CompInventoryID = component.InventoryID;
kitDetNStk.DfltCompQty = 1;
}
added++;
}
}
if (added == inMP)
{
kitGraph.Hdr.Update(kitSpec);
kitGraph.Actions.PressSave();
}
Thanks for your comments in advance.