Allow to add a mapping at a later station.
This commit is contained in:
parent
90077e84f7
commit
07a303d469
@ -27,14 +27,15 @@ import {
|
||||
IWaMOCarrierMapper,
|
||||
IWaMOConverter,
|
||||
IWaMOConverterModuleDescription,
|
||||
IWaMOLineConnector,
|
||||
IWaMOLineDescription,
|
||||
|
||||
IWaMOLineDescription, IWaMOSimpleLineConnector,
|
||||
|
||||
IWaMOTransportManagerConfig
|
||||
} from "../types/interfaces";
|
||||
|
||||
export interface CONVERTER extends INopeModule, IWaMOConverter {}
|
||||
export interface BASEMODULE extends INopeModule, IWaMOBaseModule {}
|
||||
export interface LINECONNECTOR extends INopeModule, IWaMOLineConnector {}
|
||||
export interface LINECONNECTOR extends INopeModule, IWaMOSimpleLineConnector {}
|
||||
export interface CARRIERMAPPER extends INopeModule, IWaMOCarrierMapper {}
|
||||
|
||||
// Custom Sleep Function
|
||||
@ -128,7 +129,8 @@ export class WaMOLineManager extends InjectableNopeBaseModule {
|
||||
|
||||
public async init(
|
||||
options: IWaMOLineDescription,
|
||||
reset = true
|
||||
reset = true,
|
||||
demo = false,
|
||||
): Promise<void> {
|
||||
// Define the Author.
|
||||
this.author = {
|
||||
@ -229,13 +231,16 @@ export class WaMOLineManager extends InjectableNopeBaseModule {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (element == firstStation) {
|
||||
// Map the Carrier with the Product. But only if
|
||||
// it is the First station.
|
||||
// Check if there doesnt exist a mapping for the carrier.
|
||||
// Therefore we have to check if we are the first station
|
||||
// and there doesnt exists a mapping.
|
||||
if (element == firstStation && !await _this.carrierMapper.isProductLinkedToCarrier(options.checkedInWorkpieceCarrier)) {
|
||||
// Map the Carrier with the Product.
|
||||
_this.carrierMapper.addProductToCarrier(
|
||||
options.checkedInWorkpieceCarrier,
|
||||
options.tasks[0].lotId
|
||||
);
|
||||
// And now return the Task
|
||||
return options.tasks[0];
|
||||
}
|
||||
|
||||
@ -243,6 +248,21 @@ export class WaMOLineManager extends InjectableNopeBaseModule {
|
||||
options.checkedInWorkpieceCarrier
|
||||
);
|
||||
|
||||
if (element != lastStation && product === undefined){
|
||||
// This is our special usecase, where we have unregistered carriers,
|
||||
// which will receive a new task from the MES. Therefore we perform
|
||||
// the Linking, as at station 01.
|
||||
_this._logger.warn("Assigning new Task at a station, that shouldn't be allowed");
|
||||
// Map the Carrier with the Product.
|
||||
_this.carrierMapper.addProductToCarrier(
|
||||
options.checkedInWorkpieceCarrier,
|
||||
options.tasks[0].lotId
|
||||
);
|
||||
// And now return the Task
|
||||
return options.tasks[0];
|
||||
}
|
||||
|
||||
// ERROR: Remove only, if there are not task left, or it must be removed.
|
||||
if (element == lastStation) {
|
||||
// Remove the Mapping, but only on the Last Station.
|
||||
_this.carrierMapper.removeProductFromCarrier(
|
||||
@ -253,7 +273,8 @@ export class WaMOLineManager extends InjectableNopeBaseModule {
|
||||
return product;
|
||||
},
|
||||
reset,
|
||||
false
|
||||
false,
|
||||
demo
|
||||
];
|
||||
|
||||
const promise = _this._dispatcher.generateInstance<BASEMODULE>({
|
||||
@ -266,10 +287,11 @@ export class WaMOLineManager extends InjectableNopeBaseModule {
|
||||
// Subscribe to Changes of the Base-Modules:
|
||||
mod.baseInformation.subscribe((description) => {
|
||||
// If Workpiece Carrier has checked in, register the Carrier:
|
||||
if (description.physical.checkedInWorkpieceCarrier)
|
||||
if (description.physical.checkedInWorkpieceCarrier){
|
||||
_this.carrierMapper.registerCarrier(
|
||||
description.physical.checkedInWorkpieceCarrier
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// create a PLC Connector:
|
||||
|
Loading…
Reference in New Issue
Block a user