// DLX_BUG1707_MngmtNCDummy - 20170224 - Mirco Z
[
DataContractAttribute,
SysOperationContractProcessingAttribute(classStr(DLX_GenerateReworkDummyNCUIBuilder)),
SysOperationGroupAttribute('Data', literalStr("@SYS55057"), '1'),
SysOperationGroupAttribute('Transfer', literalStr("@SYS13891"), '2')
]
class DLX_GenerateReworkDummyNCDC extends SysOperationDataContractBase
{
// parameters non conformance
InventTestDefectQty testDefectQty;
ItemId itemId;
InventNonConformanceType inventNonConformanceType;
VendAccount vendAccount;
InventTestProblemTypeId problemType;
DLX_ScrapReasonCodeId scrapReasonCode;
//parameters inventDim
InventLocationId inventLocationId,
inventLocationTO; // DLX_BUG3520_DummyNCTransferIntersite - 20170926 - Mirco Z
InventSiteId inventSiteId,
inventSiteTO; // DLX_BUG3520_DummyNCTransferIntersite - 20170926 - Mirco Z
WMSLocationId wmsLocationId;
WHSInventStatusId inventStatusId;
WHSLicensePlateId licensPlateId;
DLX_InventSiteAssociationId inventSiteIdTo; // DLX_7403_ReworkNCFilterBySite - 20190215 - Mirco Z - necessary cause filter by site
}
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Data'),
SysOperationDisplayOrderAttribute('8')
]
public InventLocationId parmInventLocationId(InventLocationId _inventLocationId = inventLocationId)
{
inventLocationId = _inventLocationId;
return inventLocationId;
}
// DLX_BUG3520_DummyNCTransferIntersite - 20170926 - Mirco Z
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Transfer'),
SysOperationLabelAttribute(literalStr("@DLX2752")),
SysOperationDisplayOrderAttribute('2')
]
public InventLocationId parmInventLocationTO(InventLocationId _inventLocationTO = inventLocationTO)
{
inventLocationTO = _inventLocationTO;
return inventLocationTO;
}
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Data'),
SysOperationDisplayOrderAttribute('1')
]
public InventNonConformanceType parmInventNonConformanceType(InventNonConformanceType _inventNonConformanceType = inventNonConformanceType)
{
inventNonConformanceType = _inventNonConformanceType;
return inventNonConformanceType;
}
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Data'),
SysOperationDisplayOrderAttribute('7')
]
public InventSiteId parmInventSiteId(InventSiteId _inventSiteId = inventSiteId)
{
inventSiteId = _inventSiteId;
return inventSiteId;
}
// DLX_BUG3520_DummyNCTransferIntersite - 20170926 - Mirco Z
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Transfer'),
SysOperationLabelAttribute(literalStr("@DLX2751")),
SysOperationDisplayOrderAttribute('1')
]
// DLX_7403_ReworkNCFilterBySite - 20190215 - Mirco Z - Begin
//public InventSiteId parmInventSiteTO(InventSiteId _inventSiteTO = inventSiteTO)
public DLX_InventSiteAssociationId parmInventSiteTO(DLX_InventSiteAssociationId _inventSiteIdTo = inventSiteIdTo)
// DLX_7403_ReworkNCFilterBySite - 20190215 - Mirco Z - End
{
inventSiteIdTo = _inventSiteIdTo;
return inventSiteIdTo;
}
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Data'),
SysOperationDisplayOrderAttribute('10')
]
public WHSInventStatusId parmInventStatusId(WHSInventStatusId _inventStatusId = inventStatusId)
{
inventStatusId = _inventStatusId;
return inventStatusId;
}
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Data'),
SysOperationDisplayOrderAttribute('2')
]
public ItemId parmItemId(ItemId _itemId = itemId)
{
itemId = _itemId;
return itemId;
}
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Data'),
SysOperationDisplayOrderAttribute('11')
]
public WHSLicensePlateId parmLicensPlateId(WHSLicensePlateId _licensPlateId = licensPlateId)
{
licensPlateId = _licensPlateId;
return licensPlateId;
}
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Data'),
SysOperationDisplayOrderAttribute('3')
]
public InventTestProblemTypeId parmProblemType(InventTestProblemTypeId _problemType = problemType)
{
problemType = _problemType;
return problemType;
}
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Data'),
SysOperationDisplayOrderAttribute('4')
]
public DLX_ScrapReasonCodeId parmScrapReasonCode(DLX_ScrapReasonCodeId _scrapReasonCode = scrapReasonCode)
{
scrapReasonCode = _scrapReasonCode;
return scrapReasonCode;
}
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Data'),
SysOperationDisplayOrderAttribute('6')
]
public InventTestDefectQty parmTestDefectQty(InventTestDefectQty _testDefectQty = testDefectQty)
{
testDefectQty = _testDefectQty;
return testDefectQty;
}
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Data'),
SysOperationDisplayOrderAttribute('5')
]
public VendAccount parmVendAccount(VendAccount _vendAccount = vendAccount)
{
vendAccount = _vendAccount;
return vendAccount;
}
[
DataMemberAttribute,
SysOperationGroupMemberAttribute('Data'),
SysOperationDisplayOrderAttribute('9')
]
public WMSLocationId parmWMSLocationId(WMSLocationId _wmsLocationId = wmsLocationId)
{
wmsLocationId = _wmsLocationId;
return wmsLocationId;
}
// DLX_BUG1707_MngmtNCDummy - 20170224 - Mirco Z
class DLX_GenerateReworkDummyNCController extends SysOperationServiceController
{
DLX_GenerateReworkDummyNCDC generateReworkDummyNCDC;
}
// it will be usefull, to set other parameters or queries
public void initFromCaller(Args _args)
{
this.initializeFromArgs(_args);
}
public static DLX_GenerateReworkDummyNCController construct()
{
return new DLX_GenerateReworkDummyNCController();
}
public static void main(Args args)
{
DLX_GenerateReworkDummyNCController generateReworkDummyNCController = DLX_GenerateReworkDummyNCController::construct();
;
generateReworkDummyNCController.initFromCaller(args);
if(generateReworkDummyNCController)
{
xSysLastValue::deleteLast(generateReworkDummyNCController);
generateReworkDummyNCController.startOperation();
xSysLastValue::deleteLast(generateReworkDummyNCController);
}
}
// DLX_BUG1707_MngmtNCDummy - 20170224 - Mirco Z
class DLX_GenerateReworkDummyNCService extends SysOperationServiceBase
{
}
[SysEntryPointAttribute(true)]
public void generateReworkDummyNC(DLX_GenerateReworkDummyNCDC _generateReworkDummyNCDC)
{
DLX_GenerateReworkDummyNCMng generateReworkDummyNCMng = DLX_GenerateReworkDummyNCMng::construct();
;
if(generateReworkDummyNCMng)
{
generateReworkDummyNCMng.parmGenerateReworkDummyNCDC(_generateReworkDummyNCDC);
generateReworkDummyNCMng.run();
}
}
// DLX_BUG1707_MngmtNCDummy - 20170224 - Mirco Z
class DLX_GenerateReworkDummyNCMng
{
DLX_GenerateReworkDummyNCDC generateReworkDummyNCDC;
InventDim inventDimNC;
}
// DLX_SCMBUG3228_NCReworkOrderFixes - 20170726 - Mirco Z
public InventDim changeInventoryStatus(ItemId _itemId,
InventQty _qtyNC
)
{
InventDim inventDimNew;
DLX_SCMParametersDim parDim = DLX_SCMParametersDim::find(inventDimNC.inventDimId);
;
DLX_WHSChangeInventStatus::convertInventStatus(_itemId,
_qtyNC,
inventDimNC,
parDim.ReworkInventStatusId );
inventDimNew.clear();
inventDimNew.data(inventDimNC);
inventDimNew.InventStatusId = parDim.ReworkInventStatusId;
inventDimNew = InventDim::findOrCreate(inventDimNew);
return inventDimNew;
}
// DLX_2528_NCMultiActivities - 20180614 - Mirco Z
private DLX_NCReleaseMng createNCReleaseMng(InventNonConformanceTable _inventNonConformanceTable,
InventDimId _inventDimIdRework
)
{
DLX_NCReleaseMng ncReleaseMng;
;
ncReleaseMng.clear();
ncReleaseMng.initDefault(_inventNonConformanceTable);
ncReleaseMng.ActivityType = DLX_ActivityType::ExternalRecovery;
ncReleaseMng.Qty = generateReworkDummyNCDC.parmTestDefectQty();
ncReleaseMng.ActionType = DLX_NCActionType::CreatePurchOrder;
ncReleaseMng.VendAccount = _inventNonConformanceTable.VendAccount;
ncReleaseMng.InventDimId = _inventDimIdRework;
ncReleaseMng.insert();
return ncReleaseMng;
}
public void findOrCreateDim(DLX_GenerateReworkDummyNCDC _generateReworkDummyNCDC)
{
inventDimNC.clear();
inventDimNC.InventLocationId = _generateReworkDummyNCDC.parmInventLocationId();
inventDimNC.InventSiteId = _generateReworkDummyNCDC.parmInventSiteId();
inventDimNC.wMSLocationId = _generateReworkDummyNCDC.parmWMSLocationId();
inventDimNC.InventStatusId = _generateReworkDummyNCDC.parmInventStatusId();
inventDimNC.LicensePlateId = _generateReworkDummyNCDC.parmLicensPlateId();
inventDimNC = InventDim::findOrCreate(inventDimNC);
}
public DLX_GenerateReworkDummyNCDC parmGenerateReworkDummyNCDC(DLX_GenerateReworkDummyNCDC _generateReworkDummyNCDC = generateReworkDummyNCDC)
{
generateReworkDummyNCDC = _generateReworkDummyNCDC;
return generateReworkDummyNCDC;
}
public void run()
{
InventNonConformanceTable inventNonConformanceTable;
NumberSeq numberSeq;
boolean isFromFunction = true;
// parameters
VendAccount vendAccount;
InventTestDefectQty testDefectQty;
InventNonConformanceType inventNonConformanceType;
ItemId itemId;
InventTestProblemTypeId problemType;
DLX_ScrapReasonCodeId scrapReasonCodeId;
DLX_NCReleaseMng ncReleaseMng; // DLX_2528_NCMultiActivities - 20180614 - Mirco Z
PurchId purchId; //DLX_7319 20190506 E. Tufano
;
try
{
if (this.parmGenerateReworkDummyNCDC() )
{
inventNonConformanceType = generateReworkDummyNCDC.parmInventNonConformanceType();
if (inventNonConformanceType == InventNonConformanceType::Dummy_dlx )
{
vendAccount = generateReworkDummyNCDC.parmVendAccount();
testDefectQty = generateReworkDummyNCDC.parmTestDefectQty();
itemId = generateReworkDummyNCDC.parmItemId();
problemType = generateReworkDummyNCDC.parmProblemType();
scrapReasonCodeId = generateReworkDummyNCDC.parmScrapReasonCode();
this.findOrCreateDim(generateReworkDummyNCDC);
inventDimNC = this.changeInventoryStatus(itemId, testDefectQty); // DLX_SCMBUG3228_NCReworkOrderFixes - 20170726 - Mirco Z
// create non conformance
inventNonConformanceTable.clear();
numberSeq = NumberSeq::newGetNumFromId(InventParameters::numRefNonConformanceId().NumberSequenceId);
inventNonConformanceTable.InventNonConformanceID = numberSeq.num();
inventNonConformanceTable.InventNonConformanceType = inventNonConformanceType;
inventNonConformanceTable.ItemId = itemId;
inventNonConformanceTable.initFromInventTable(InventTable::find(itemId));
inventNonConformanceTable.TestDefectQty = testDefectQty;
inventNonConformanceTable.TestDefectQtyExtRec_dlx = testDefectQty; //DLX_7319 - 20190506 E. Tufano
inventNonConformanceTable.VendAccount = vendAccount;
inventNonConformanceTable.VendId_dlx = vendAccount;
inventNonConformanceTable.InventDimId = inventDimNC.inventDimId;
inventNonConformanceTable.InventNonConformanceApproval = InventNonConformanceApproval::Released;
inventNonConformanceTable.NonConformanceDate = systemDateGet();
inventNonConformanceTable.ApprovalDate_dlx = systemDateGet();
inventNonConformanceTable.InventTestProblemTypeId = problemType;
inventNonConformanceTable.ScrapReasonCodeId_dlx = scrapReasonCodeId;
inventNonConformanceTable.ReleaseDate_dlx = systemDateGet(); //DLX_7372_DummyRNC - 20190306 E. Tufano
inventNonConformanceTable.insert();
// create History
InventNonConformanceHistory::insertCreate(inventNonConformanceTable.InventNonConformanceID, DirPersonUser::findUserWorkerReference());
ncReleaseMng = this.createNCReleaseMng(inventNonConformanceTable, inventDimNC.inventDimId); // DLX_2528_NCMultiActivities - 20180614 - Mirco Z
// create new Purchase Order
purchId = inventNonConformanceTable.createTransferOrderFromDummyNC_dlx(isFromFunction,
generateReworkDummyNCDC.parmInventSiteTO(), // DLX_BUG3520_DummyNCTransferIntersite - 20170926 - Mirco Z
generateReworkDummyNCDC.parmInventLocationTO() ); // DLX_BUG3520_DummyNCTransferIntersite - 20170926 - Mirco Z
// DLX_2528_NCMultiActivities - 20180614 - Mirco Z - Begin
ttsBegin;
ncReleaseMng.selectForUpdate(true);
ncReleaseMng.ReleaseNum = DLX_NCReleaseMng::lastLineNum(inventNonConformanceTable.InventNonConformanceID) +1;
ncReleaseMng.update();
ttsCommit;
// DLX_2528_NCMultiActivities - 20180614 - Mirco Z - End
//DLX_7319 20190506 E. Tufano start
if (purchId != "")
{
ttsBegin;
inventNonConformanceTable.GeneratedPurchOrder_dlx = purchId;
inventNonConformanceTable.update();
ttsCommit;
}
//DLX_7319 20190506 E. Tufano end
}
else
throw error("@DLX2161");
}
}
catch
{
throw error("@SYS70403");
}
}
public static DLX_GenerateReworkDummyNCMng construct()
{
return new DLX_GenerateReworkDummyNCMng();
}
// DLX_BUG1707_MngmtNCDummy - 20170224 - Mirco Z
class DLX_GenerateReworkDummyNCUIBuilder extends SysOperationAutomaticUIBuilder
{
DLX_GenerateReworkDummyNCDC generateReworkDummyNCDC;
DialogField fldInventNonConformanceType;
DialogField fldItemId;
DialogField fldProblemType;
DialogField fldTestDefectQty;
DialogField fldScrapReasonCode;
DialogField fldInventSiteId,
fldInventSiteTO; // DLX_BUG3520_DummyNCTransferIntersite - 20170926 - Mirco Z
DialogField fldInventLocationId,
fldInventLocationTO; // DLX_BUG3520_DummyNCTransferIntersite - 20170926 - Mirco Z
DialogField fldWMSLocationId;
DialogField fldInventStatusId;
DialogField fldLicensePlateId;
DialogField fldVendAccount; // DLX_BUG3520_DummyNCTransferIntersite - 20171004 - Mirco Z
}
public void getFromDialog()
{
super();
if (!fldLicensePlateId.value() )
throw error(strFmt("@DLX1971"));
}
public void lookUpProblemType(FormControl _formControl, str _filterStr)
{
InventProblemType::lookupProblemType(fldProblemType.control(), fldInventNonConformanceType.value());
}
public void lookUpScrapReasonCode(FormControl _formControl, str _filterStr)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(DLX_ScrapReasonCodes), fldScrapReasonCode.control());
Query query = new Query();
QueryBuildDataSource queryBuildDataSource = query.addDataSource(tableNum(DLX_ScrapReasonCodes));
sysTableLookup.addLookupfield(fieldNum(DLX_ScrapReasonCodes, ScrapReasonCodeId));//, true);
sysTableLookup.addLookupfield(fieldNum(DLX_ScrapReasonCodes, Name));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
// DLX_BUG3520_DummyNCTransferIntersite - 20170926 - Mirco Z
public boolean modifiedInventSiteTO(FormStringControl _formstringcontrol)
{
boolean ret = true;
;
fldInventLocationTO.value(InventLocation::findDefaultODTLocation_dlx(fldInventSiteTO.value()).InventLocationId);
return ret;
}
public boolean modifiedItemId(FormStringControl _formstringcontrol)
{
boolean ret = true;
InventDim inventDim;
;
inventDim.initFromInventTable(InventTable::find(fldItemId.value()), InventItemOrderSetupType::Invent);
// set inventory dimensions
fldInventSiteId.value(inventDim.InventSiteId);
fldInventLocationId.value(inventDim.InventLocationId);
fldWMSLocationId.value(inventDim.wMSLocationId);
fldInventStatusId.value(inventDim.InventStatusId);
fldLicensePlateId.value(inventDim.LicensePlateId);
return ret;
}
public boolean modifiedLicensePlateId(FormStringControl _formstringcontrol)
{
boolean ret = true;
InventDim inventDimFilter;
InventSum inventSum;
;
select firstOnly ItemId, AvailPhysical, InventDimId from inventSum
order by inventDimFilter.InventDimId
where inventSum.ItemId == fldItemId.value()
&& inventSum.AvailPhysical > 0
join inventDimFilter
where inventDimFilter.inventDimId == inventSum.inventDimId
&& inventDimFilter.InventSiteId == fldInventSiteId.value()
&& inventDimFilter.InventLocationId == fldInventLocationId.value()
&& inventDimFilter.LicensePlateId == fldLicensePlateId.value();
if (inventSum.InventDimId && inventDimFilter.LicensePlateId)
{
fldWMSLocationId.value(inventDimFilter.wMSLocationId);
fldInventStatusId.value(inventDimFilter.InventStatusId);
fldTestDefectQty.value(inventSum.AvailPhysical);
}
else
{
fldWMSLocationId.value('');
fldInventStatusId.value('');
fldTestDefectQty.value('');
}
return ret;
}
// DLX_BUG3520_DummyNCTransferIntersite - 20171004 - Mirco Z
public boolean modifiedVendAccount(FormStringControl _formstringcontrol)
{
boolean ret = true;
DirPartyTable dirPartyTable = VendTable::find(fldVendAccount.value()).DirPartyTable();
;
if (dirPartyTable.RecId && dirPartyTable.InventSiteId_dlx )
{
// DLX_7403_ReworkNCFilterBySite - 20190215 - Mirco Z - Begin
/* Origin
fldInventSiteTO.value(dirPartyTable.inventSiteCross_dlx().SiteId);
*/
fldInventSiteTO.value(Dlx_SiteAssociation::findByRefRecId(dirPartyTable.InventSiteId_dlx).InventSiteId); // necessary for filter by site
// DLX_7403_ReworkNCFilterBySite - 20190215 - Mirco Z - End
fldInventLocationTO.value(InventLocation::findDefaultODTLocation_dlx(fldInventSiteTO.value()).InventLocationId);
}
return ret;
}
public void postBuild()
{
super();
generateReworkDummyNCDC = this.dataContractObject() as DLX_GenerateReworkDummyNCDC;
fldInventNonConformanceType = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmInventNonConformanceType));
fldItemId = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmItemId));
fldProblemType = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmProblemType));
fldTestDefectQty = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmTestDefectQty));
fldScrapReasonCode = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmScrapReasonCode));
fldVendAccount = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmVendAccount)); // DLX_BUG3520_DummyNCTransferIntersite - 20171004 - Mirco Z
fldInventSiteId = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmInventSiteId));
fldInventLocationId = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmInventLocationId));
fldWMSLocationId = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmWMSLocationId));
fldInventStatusId = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmInventStatusId));
fldLicensePlateId = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmLicensPlateId));
// DLX_BUG3520_DummyNCTransferIntersite - 20170926 - Mirco Z - Begin
fldInventSiteTO = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmInventSiteTO));
fldInventLocationTO = this.bindInfo().getDialogField(generateReworkDummyNCDC, methodStr(DLX_GenerateReworkDummyNCDC, parmInventLocationTO));
// DLX_BUG3520_DummyNCTransferIntersite - 20170926 - Mirco Z - End
fldInventNonConformanceType.value(InventNonConformanceType::Dummy_dlx);
fldInventNonConformanceType.allowEdit(false);
// override method "modified" for Item
fldItemId.registerOverrideMethod(methodStr(FormStringControl, modified),
methodStr(DLX_GenerateReworkDummyNCUIBuilder, modifiedItemId),
this);
// override method "lookUp" for problem type
fldProblemType.registerOverrideMethod(methodStr(FormStringControl, lookUp),
methodStr(DLX_GenerateReworkDummyNCUIBuilder, lookUpProblemType),
this);
// override method "modified" for license plate
fldLicensePlateId.registerOverrideMethod(methodStr(FormStringControl, modified),
methodStr(DLX_GenerateReworkDummyNCUIBuilder, modifiedLicensePlateId),
this);
// override method "lookUp" for scrap reason code
fldScrapReasonCode.registerOverrideMethod(methodStr(FormStringControl, lookUp),
methodStr(DLX_GenerateReworkDummyNCUIBuilder, lookUpScrapReasonCode),
this);
// DLX_BUG3520_DummyNCTransferIntersite - 20171004 - Mirco Z - Begin
// override method "modified" for Site Transfer Order
fldInventSiteTO.registerOverrideMethod(methodStr(FormStringControl, modified),
methodStr(DLX_GenerateReworkDummyNCUIBuilder, modifiedInventSiteTO),
this);
// override method "modified" for Site Transfer Order
fldVendAccount.registerOverrideMethod(methodStr(FormStringControl, modified),
methodStr(DLX_GenerateReworkDummyNCUIBuilder, modifiedVendAccount),
this);
// DLX_BUG3520_DummyNCTransferIntersite - 20171004 - Mirco Z - End
}