Epicor - Job to Receive Error

Hi All,

We have our own custom script for receiving job to inventory which suddenly stopped working.

After debugging the code from visual basic it pops us the error:

Date of 11/26/2023 is less than the allowed earliest apply date of 1/1/2024.

Please find the error log:

System.Transactions Critical: 0 : Microsoft Learn: Build skills that open doors in your careerUnhandled exceptionMESTOEPICOR.exeIce.Common.BusinessObjectException, Epicor.ServiceModel, Version=3.2.700.0, Culture=neutral, PublicKeyToken=37a5ccb872c00aec Date of 11/26/2023 is less than the allowed earliest apply date of 1/1/2024. at Epicor.ServiceModel.Channels.ImplBase1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets) at Erp.Proxy.BO.ReceiptsFromMfgImpl.ReceiveMfgPartToInventory(ReceiptsFromMfgDataSet ds, Decimal pdSerialNoQty, Boolean plNegQtyAction, String&amp;amp; pcMessage, String&amp;amp; pcPartTranPKs, String pcProcessID) at Erp.Adapters.ReceiptsFromMfgAdapter.ReceiveMfgPartToInventory(Decimal pdSerialNoQty, Boolean plNegQtyAction, String&amp;amp; pcMessage, String&amp;amp; pcPartTranPKs, String pcProcessID) at MESTOEPICOR.MESIntegrations.Submit(ILauncher launch123, String pcJobNum, Int32 piAssemblySeq, Int32 Quantity, String SRNumber, DateTime TranDate) in C:\Job To Receive\MESTOEPICOR\POSTOEPICOR\MESIntegrations.cs:line 166 at MESTOEPICOR.MESIntegrations.btnCreateClick(ILauncher launch123) in C:\Job To Receive\MESTOEPICOR\POSTOEPICOR\MESIntegrations.cs:line 126 at MESTOEPICOR.MESIntegrations.JobToReceive(String strcompany) in C:\Job To Receive\MESTOEPICOR\POSTOEPICOR\MESIntegrations.cs:line 92 at MESTOEPICOR.Program.Main() in C:\Job To Receive\MESTOEPICOR\POSTOEPICOR\Program.cs:line 25</StackTrace><ExceptionString>Ice.Common.BusinessObjectException: Date of 11/26/2023 is less than the allowed earliest apply date of 1/1/2024. at Epicor.ServiceModel.Channels.ImplBase1.ShouldRethrowNonRetryableException(Exception ex, DataSet dataSets)
at Erp.Proxy.BO.ReceiptsFromMfgImpl.ReceiveMfgPartToInventory(ReceiptsFromMfgDataSet ds, Decimal pdSerialNoQty, Boolean plNegQtyAction, String&amp; pcMessage, String&amp; pcPartTranPKs, String pcProcessID)
at Erp.Adapters.ReceiptsFromMfgAdapter.ReceiveMfgPartToInventory(Decimal pdSerialNoQty, Boolean plNegQtyAction, String&amp; pcMessage, String&amp; pcPartTranPKs, String pcProcessID)
at MESTOEPICOR.MESIntegrations.Submit(ILauncher launch123, String pcJobNum, Int32 piAssemblySeq, Int32 Quantity, String SRNumber, DateTime TranDate) in C:\Job To Receive\MESTOEPICOR\POSTOEPICOR\MESIntegrations.cs:line 166
at MESTOEPICOR.MESIntegrations.btnCreateClick(ILauncher launch123) in C:\Job To Receive\MESTOEPICOR\POSTOEPICOR\MESIntegrations.cs:line 126
at MESTOEPICOR.MESIntegrations.JobToReceive(String strcompany) in C:\Job To Receive\MESTOEPICOR\POSTOEPICOR\MESIntegrations.cs:line 92
at MESTOEPICOR.Program.Main() in C:\Job To Receive\MESTOEPICOR\POSTOEPICOR\Program.cs:line 25CorrelationID1475af1a-dc82-4123-9b3e-6371ef1b5970
An unhandled exception of type ‘Ice.Common.BusinessObjectException’ occurred in Erp.Adapters.ReceiptsfromMfg.dll
Date of 11/26/2023 is less than the allowed earliest apply date of 1/1/2024.

We cant seem to identify where the issue is occurring from.

Can someone help us in fixing it.

Thank you.

Welcome to the forum! Looks like your script is trying to use a date in the past (Nov 2023) and your fiscal period is closed in that month. Which makes sense. Maybe adjust the script to use today’s date or something in the current month.

2 Likes

Hi Dragos,

Thank you, appreciate it.

Script.docx (31.5 KB)

We have checked the code and its showing this “DateTime.Now”. Code has been attached for reference.

Fiscal Period screenshot:

It looks like the TranDate is coming from the BAQ the script calls.

DateTime TransDate = Convert.ToDateTime(dr["UD31_Date20"]).Date;

The BAQ it’s calling is BFG_BAQ_JobToReceiveByDate so I would check in that BAQ to see how it’s pulling UD31.Date20.

2 Likes

Also, you can use the ‘Preformatted text’ option for the code (or CTRL + E) just like below:

DateTime TransDate = Convert.ToDateTime(dr["UD31_Date20"]).Date;
2 Likes
Holy crap

I did not know that

Thanks!
1 Like

Hi

This is the code from the BAQ Designer


/*
 * Disclaimer!!!
 * This is not a real query being executed, but a simplified version for general vision.
 * Executing it with any other tool may produce a different result.
 */
 
select 
	[JobAsmbl].[JobNum] as [JobAsmbl_JobNum],
	[JobAsmbl].[AssemblySeq] as [JobAsmbl_AssemblySeq],
	[JobAsmbl].[PartNum] as [JobAsmbl_PartNum],
	[JobAsmbl].[Description] as [JobAsmbl_Description],
	[JobAsmbl].[RevisionNum] as [JobAsmbl_RevisionNum],
	[UD31].[Key2] as [UD31_Key2],
	[UD31].[Key5] as [UD31_Key5],
	[UD31].[Number19] as [UD31_Number19],
	[UD31].[Number20] as [UD31_Number20],
	[UD31].[Date06] as [UD31_Date06],
	[UD31].[ShortChar19] as [UD31_ShortChar19],
	[UD31].[Character10] as [UD31_Character10],
	('5148') as [Calculated_EmpID],
	[UD31].[Date02] as [UD31_Date02],
	[UD31].[Date20] as [UD31_Date20]
from Ice.UD31 as UD31
inner join Erp.JobAsmbl as JobAsmbl on 
	JobAsmbl.Company = UD31.Company
	and JobAsmbl.JobNum = UD31.Key1
	and JobAsmbl.AssemblySeq = UD31.Key3
	and ( JobAsmbl.JobNum = case when @JobNum<>'' then @JobNum else JobAsmbl.JobNum end  and JobAsmbl.PartNum = case when @PartNum<>'' then @PartNum else JobAsmbl.PartNum end  )

inner join Erp.JobHead as JobHead on 
	JobAsmbl.Company = JobHead.Company
	and JobAsmbl.JobNum = JobHead.JobNum
	and ( JobHead.JobReleased = 1  and JobHead.JobClosed = 0  )

where (UD31.ShortChar20 <> ''  and UD31.ShortChar19 = ''  and not UD31.Key5 in (select SerialNo_SerialNumber from (select 
	[SerialNo].[SerialNumber] as [SerialNo_SerialNumber]
from Erp.SerialNo as SerialNo) as SR)   and UD31.Date06 >= case when @fDate<>'' then @fDate else UD31.Date06 end)
order by JobAsmbl.JobNum, JobAsmbl.AssemblySeq Desc

Can you run the BAQ in the designer? What are the values (results) for Date20? Assuming you’ll see at least one dated 11/26/2023? We don’t know what that date represents in your data. Do you what you’re using that Date20 column for?

Hi David,

Thank you for your support.

We ran the BAQ and we got this information:

There are two fields with “TransDate” that has the date of “26-11-2023”

We searched for this particular invoice and found out in AR Invoice Entry that the same dates are showing in Apply Date and Invoice Date.

We are still investigating if any of these fields are linked to Date20.