Lock PO Release Qty and Date

Andrew ClementsEpicor Developement

MRP was generating a lot of expedite and postpone PO suggestions, which are just not feasible in some supply chains (e.g Bring a part with a lead time of 30 days forward so that it has a lead time of 3 – nice idea, just not realistic).

If MRP generates the change suggestions, it also assumes the changes will be acted upon in it subsequent calculations.

A simple way to stop the change suggestions been generated and new PO suggestions to be generated is to lock the quantity and date at release level.

This can be done manually by the users at order entry, or via a intransaction data directive on the PORel table.

The code below locks the fields.

bool foundComxRefRecord = false;
string setLockDate = "Yes";
string setLockQty = "Yes";
Erp.Tables.COMXref COMXref;
foreach (var ttPORel_iterator in (from ttPORel_Row in ttPORel
where ttPORel_Row.PORelNum != 0
select ttPORel_Row))
var ttPORelRow = ttPORel_iterator;
string strPO = ttPORelRow.PONum.ToString();
string strPOL = ttPORelRow.POLine.ToString();
string strPOR = ttPORelRow.PORelNum.ToString();
COMXref = (from COMXref_Row in Db.COMXref
where string.Compare(COMXref_Row.Company, ttPORelRow.Company, true) == 0
&& string.Compare(COMXref_Row.File, "PORel_Mapping", true) == 0
&& COMXref_Row.Key1 == strPO
&& COMXref_Row.Key2 == strPOL
&& COMXref_Row.Key3 == strPOR
select COMXref_Row).FirstOrDefault();
if (COMXref != null)
COMXref.foreignKey1 = setLockDate;
COMXref.foreignKey2 = setLockQty;
foundComxRefRecord = true;
Db.Release(ref    COMXref);
if (!foundComxRefRecord)
COMXref = new Erp.Tables.COMXref();
COMXref.Company = ttPORelRow.Company;
COMXref.File = "PORel_Mapping";
COMXref.Key1 = System.Convert.ToString(ttPORelRow.PONum);
COMXref.Key2 = System.Convert.ToString(ttPORelRow.POLine);
COMXref.Key3 = System.Convert.ToString(ttPORelRow.PORelNum);
COMXref.foreignKey1 = setLockDate;
COMXref.foreignKey2 = setLockQty;