Erp.Contract.BO.Quote.dll Issue in Custom Code


(Ian Castellanos) #1

We have a program that was written that takes our exports from a CAM program we use and imports them into Epicor. Before we can do any upgrades we have to confirm that the code is working with Epicor before we deploy to end users.

We use OrderHed_UD columns in our code to bring in some information. We have this same code working in 10.1.400 and tested it in 10.1.600. We are testing 10.2.200 and when running the code with the new dlls released with 10.2.200 and I am getting an error that one of our custom fields (CheckBox01) does not belong to QuoteHed. I copied the code over as is and just replaced all the dlls we used in the code and made no other changes besides changed the framework target and recompiling the code.

Were there any changes to the Erp.Contract.BO.Quote.dll from earlier versions that would cause this issue? We are also using the Ice.Contract.BO.UD03.dll as well. Unless I am missing a step somewhere…


(Jose C Gomez) #2

Did you Regen your data motel?


(Ian Castellanos) #3

Yes sir. Made sure that was the first thing I did when we did the upgrade and I did it again before we started our testing.


(Chris Conn) #4

Did you explicitly create that field CheckBox01? In older versions, it was there by default, at some point, they went away. I guess thats the long way of saying - are you sure that field exists?


(Jose C Gomez) #5

Share the code specifically the area where you are seeing this error?


(Ian Castellanos) #6

I will share what I can because the project is quite large.

HedRow CreateQuoteHedRow(Quote quote, CamductJob job)
        {
            var hed = quote.NewHedRow();

            var firstOLine = job.OFile.FirstOrDefault();
            if (firstOLine == null)
            {
                throw new NoFirstOLineException(job.Name);
            }

            var oDataConverter = new TypeODataConverter(firstOLine, _cache);

            hed.CustomerCustID = job.GetCustomerId();
            // hed.QuoteComment = job.Plant + " " + job.Name; // 12/2/2016 removed w/UD fields
            hed["CheckBox01"] = true;
            hed["ShortChar01"] = job.Plant + "-" + job.Name;
            hed["ShortChar06"] = oDataConverter.GetHedShortChar06();
            hed["ShortChar07"] = oDataConverter.GetHedShortChar07();
            hed["ShortChar08"] = oDataConverter.GetHedShortChar08();
            hed["ShortChar09"] = oDataConverter.GetHedShortChar09();
            hed["ShortChar10"] = oDataConverter.GetHedShortChar10();
            hed["ShortChar11"] = oDataConverter.GetHedShortChar11();

            var customer = _cache.CustomerCache.FirstOrDefault(c => c.CustID == hed.CustomerCustID);
            if (customer != null)
            {
                hed.CustNum = customer.CustNum;
                hed.SalesRepCode = customer.SalesRepCode;
                hed.TerritoryID = customer.TerritoryID;
                hed.TerritoryTerritoryDesc = customer.TerritoryTerritoryDesc;
                hed.TermsCode = customer.TermsCode;
                hed.ShipViaCode = customer.ShipViaCode;
            }
            else
            {
                throw new NoCustomerFoundInCacheException(job.GetCustomerId());
            }

            var shipto = _cache.ShipToCache.FirstOrDefault(s => s.CustNum == hed.CustNum);
            if (shipto != null)
            {
                hed.ShipToCustNum = shipto.CustNum;
                hed.ShipToCustID = shipto.CustNumCustID;
            } // skips these, they are automatically filled out by Epicor using the customer if not present.

            return hed;
        }

This is the instance of the code that I am seeing an error at in the logger. The import process fails after this.

There are other instances of checkbox01 through the code but this is the first instance of it in the program flow.

This is at the beginning of the code:

using HedRow = Erp.BO.UpdExtQuoteDataSet.QuoteHedRow;

(Ian Castellanos) #7

I am sure it does. It is in the UD table in SQL and the tables show that they are in sync.

When did they go away? We are on 10.1.400.38 currently and want to get to 10.2.200 by the end of the year.


(Chris Conn) #8

By go away, I just mean those fields (Char01, ShortChar01, Number01) arent there by default in later versions… not sure which one. You can add them yourself though.Also, if you are uplifting your DB, then they’ll still be there.


(Jose C Gomez) #9

Can you look in UD Field Maintenance and make sure you do indeed have that field defined? also it may be case sensitive… It may be Checkbox01


(Ian Castellanos) #10

This is what is showing up in the UD maintenance. It is exactly the same as in 10.1.400.38.

image


(Chris Conn) #11

Perhaps try:

 hed.SetUDField<bool>("CheckBox01") = boolValue;

or read with 

bool boolValue =  hed.UDField<bool>("CheckBox01") ;

(Jason Stephens) #12

Your screenshot shows that CheckBox01 exists on the OrderHed_UD table, but isn’t your code above creating a new QuoteHed row?


(Ian Castellanos) #13

I tested the code in 10.1.600.23 and was able to get it working without issue. Just had to change the dll files, the target framework, and recompile (which are the same steps I did in 10.2.200).

I also updated our 10.2.200 version to 10.2.200.13 and am still getting the same error.

Might just make more sense to go to 10.1.600 at this point and scrap plans for 10.2 for the foreseeable future.


(Chris Conn) #14

You sure are losing alot of great features and bug fixes by avoiding 10.2.

I am curious why you arent using the QuoteDataSet and BO. By using these objects, you shouldnt have any issues.

QuoteDataSet myQuoteDS = new QuoteDataSet();
QuoteBO.GetNewQuoteHead(myQuoteDS);
var hed = myQuoteDS.QuoteHed.Rows[0];
///the same code you had before here....

(Ian Castellanos) #15

All this code is running externally and it not located anywhere inside of Epicor. I am using the QuoteDataSet written as:

using HedRow = Erp.BO.UpdExtQuoteDataSet.QuoteHedRow;

Which I believe is from the Erp.Contracts.BO.Quote.dll

I just don’t understand why it doesn’t work in 10.2.200 but in the other 2 revisions I have tested it in. I should also mention that I took over this code from a previous programmer so you guys all know how that can of worms can go sometimes.


(Chris Conn) #16

Out of curiosity, have you tried:
hed[“CheckBox01_c”] = true;


(Jose C Gomez) #17

This is external? Are you using the wcf services?


(Jose C Gomez) #18

I’m a bit confused as to what the quote object is here… It should either be an adapter or a WCFImpl…or maybe a REST class… That looks like none of those…
I’d Quote something custom?


(Chris Conn) #19

It looks likes he’s instaciating a new row directly, mostly likely passing that to the BO later. By doing it direct, I think it bypasses the epiMagic of bringing in those UDs. Why it worked before - I dunno


(Ian Castellanos) #20

Yes this is external code and the WCFservices are being used here:

public class Epicor10
    {
        Session _session;
        QuoteImpl _quoteBo;
        QuoteAsmImpl _quoteAsmBo;
        CustomerImpl _customerBo;
        PartImpl _partBo;
        PartCostSearchImpl _partCostBo;
        UD03Impl _ud03Bo;

        public Epicor10(EpicorParameter epi)
        { 
            _session = new Session("username", "password", epi.AppServerUrl);
            _session.PlantID = epi.Plant;

            _quoteBo = WCFServiceSupport.CreateImpl<QuoteImpl>(_session, QuoteImpl.UriPath);
            _quoteAsmBo = WCFServiceSupport.CreateImpl<QuoteAsmImpl>(_session, QuoteAsmImpl.UriPath);
            _customerBo = WCFServiceSupport.CreateImpl<CustomerImpl>(_session, CustomerImpl.UriPath);
            _partBo = WCFServiceSupport.CreateImpl<PartImpl>(_session, PartImpl.UriPath);
            _partCostBo = WCFServiceSupport.CreateImpl<PartCostSearchImpl>(_session, PartCostSearchImpl.UriPath);
            _ud03Bo = WCFServiceSupport.CreateImpl<UD03Impl>(_session, UD03Impl.UriPath);
        }

Below is the basic functionality of the code.

We use a program called CAMduct that our programmers create pieces of duct work for HVAC companies. We have a custom export file that comes out as 3 separate .txt files. This program sweeps the files and then imports them into Epicor as a new quote.

The code was contracted out to a third party before I took over development at the company last year. So I do not know why things were done they way they were. I was hoping to not have to go through this piece by piece but it is looking like I will need to get my hands dirty and get a better handle on the BOs and how they work within Epicor as I am still a newbie into the Epicor dev world.

Seems testing on 10.2 is where the issues started but I am wary as this code is integral to how our company operates and is going to put a hinder on us moving forward as we cannot stay on 10.1.400 or 10.1.600 forever.