I use Epicors WCF services to update a lot of my data. I’ve been toggling OrderHed.ReadyToCalc in this way for quite some time. However it’s been brought to my attention that some BookDtl records are missing. If I manually uncheck and check Ready to Process in Order Entry it seems to resolve it. When I do the same through DMT I get the following error (even though there is an error in dmt the data seems to get fixed).
{ORDERNUM} Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
Table: OrderRelTax
Company=’{COMPANY}’ OrderNum=’{ORDERNUM}’ OrderLine=’{ORDERLINE}’ OrderRelNum=’{ORDERRELNUM}’ TaxCode=‘AVA0000045’ RateCode=‘AVALARA’ ECAcquisitionSeq=‘0’ SysRowID=’{SYSROWID}’: ForeignKeyConstraint OrderRelOrderRelTax requires the child key values ({COMPANY}, {ORDERNUM}, {ORDERLINE}, {ORDERRELNUM}) to exist in the parent table.
Currently I update ReadyToCalc with a method similar to the bellow code (interaction.SalesOrderClient is just a reference to Erp.BO.SalesOrderSvc).
bool value = true;
var soTableSet = interaction.SalesOrderClient.GetByID(orderNum);
Guid sysRow = soTableSet.OrderHed.Single().SysRowID;
if (value)
{
soTableSet.OrderHed[0].RowMod = “U”;
soTableSet.OrderHed[0].ReadyToCalc = value;
soTableSet.OrderHed[0].CurrencySwitch = false;
interaction.SalesOrderClient.SetReadyToCalc(orderNum, ref soTableSet);
soTableSet = interaction.SalesOrderClient.GetBySysRowID(sysRow);
}
soTableSet.OrderHed[0].ReadyToCalc = value;
soTableSet.OrderHed[0].CurrencySwitch = false;
soTableSet.OrderHed[0].RowMod = “U”;
interaction.SalesOrderClient.Update(ref soTableSet);
Are there additional fields that should be set or methods that should be called to prevent this from happening or repair it if I encounter it again? Right now I’m at a loss. Currently our version is 10.1.600.4 and we do use tax connect. Let me know if you need more info.