Click or drag to resize

clsImportPlanning Class

Import for single planning lines
Inheritance Hierarchy
SystemObject
  MARIInterfaceclsImportBase
    MARIInterfaceclsImportPlanning

Namespace:  MARIInterface
Assembly:  MARIInterface (in MARIInterface.dll) Version: 8.0.0.100
Syntax
public class clsImportPlanning : clsImportBase

The clsImportPlanning type exposes the following members.

Constructors
  NameDescription
Public methodclsImportPlanning
Initializes a new instance of the clsImportPlanning class
Top
Properties
  NameDescription
Public propertyActivity
Planning text for additional information.
Public propertyCalendarMode
Change the handling type, when a planning bar is moved in the GANNT. See clsImportPlanningeCalendarMode for details.
Public propertyContractID
Contract ID. Link to the sales contract. This field can be a mandatory field, based on a basic setting by project business unit.
Public propertyContractNumberWithDescription
Informational Property for the OutLook AddIn
Public propertyContractPos
Contract Position. Link to the sales contract position. This field can be a mandatory field, based on a basic setting by project business unit. The position type of the contract position must correspond to the ressource type.
Public propertyContractPosName
Informational Property for the OutLook AddIn
Public propertyCosts
Costs of the planning line in system currency. Use only for PlanningResourceType=Item or GLAccount
Public propertyDateFrom
Start date of this planning line
Public propertyDateTo
End data of this planning element
Public propertyOnlyOnWorkingDays
Flag: Create only on working days. Stored with other flags in SpreadMode
Public propertyPhaseID
Phase ID. Link to the phase for his planning line. Mandatory, if project/planningversion does have phases.
Public propertyPhaseName
Informational Property for the OutLook AddIn
Public propertyPlanningJobDayID
Informational Property for the OutLook AddIn
Public propertyPlanningJobDaysID
Informational Property for the OutLook AddIn
Public propertyPlanningMemo
Additional text for a planning line
Public propertyPlanningResourceType
Type of ressource used in planning. Default=Employee Planning. See clsImportPlanningePlanningResourceType for details.
Public propertyPlanningType
Type of planning in the database. Default is ePlanningType.DayPlanning.
Public propertyPlanningVersion
Planning Version for this planning line (3=actual planning). Must be aligned with the phase id (if used). If Empty(0), the current project standard is used.
Public propertyProjectName
Informational Property for the OutLook AddIn
Public propertyProjectNumber
Project number for the planning. The project must exist. See clsImportProject.
Public propertyQuantityResources
Quantity of resources for the planning. This can be the number of employees in a pool planning, the number of equipments when planning an equipment category or the number of items in an item plannning. In all other cases this value will be ignored.
Public propertyQuantityTime
Quantity days or hours for planning depending on TimeUnit. Default is eTimeUnit.Hours".
Public propertyResourceID
Resource Key, depending on clsImportPlanningePlanningResourceType. Default = Employee
  • Employee number:
  • GL Account
  • Pool number
  • Item Code
  • Travel Expense category
  • Equpment Category/Costtype
Public propertyTargetedRevenues
Planed Revenues in system currency. Use only for PlanningResourceType=Item or GLAccount
Public propertyTimeUnit
Time Unit used for planning. Default is eTimeUnit.Hours". Only used in this object. In the database, all planning is stored in hours (and fractions of hours)
Top
Methods
  NameDescription
Public methodbDelete
Deletes the planning entry for one day.
Public methodbDeletePlanJob
Deletes the planning.
Public methodbDoProjectBooking
Create a Timesheet entry based on a planning entry. Copied ProjectNumber,ContractID,PhaseID and ContractPositionID from the planning
Public methodbUpdate
Update an existing planning
Top
Remarks
Examples
Create a day planning for an employee
private int CreatePlanningEmployee(string sEmployee, DateTime dtPlanDate) {
    Log($"CreatePlanningEmployee({sEmployee}, {dtPlanDate.ToShortDateString()})");
    //Create one day planning for one employee

    clsImportPlanning NewPlanning = new clsImportPlanning();
    NewPlanning.ProjectNumber = "P100005";
    NewPlanning.ContractID = 100008; // SELECT ContractID FROM MARIContract WHERE ProjectNumber=N'P100005'
    NewPlanning.ContractPos = 100031; // SELECT ContractPositionId FROM MARIContractPositions WHERE ContractID=100008 AND PositionType=4 --(ServiceAtCost)
    NewPlanning.PhaseID = 100018; // SELECT PhaseID FROM MARIProjectPhases WHERE ProjectNumber=N'P100005'
    NewPlanning.DateFrom = dtPlanDate;
    NewPlanning.Activity = "Plantext";
    NewPlanning.PlanningType = clsImportPlanning.ePlanningType.DayPlanning; //default
    NewPlanning.PlanningResourceType = clsImportPlanning.ePlanningResourceType.Employee; //default
    NewPlanning.ResourceID = sEmployee;
    //NewPlanning.QuantityTime = ... When no time is given, the planning will use the standard calendar for the full day planning.
    //Costs /  TargetedRevenues are calculated from the employees political cost and the sales position


    if (oMPInterface.bImportPlanning(NewPlanning, clsImportBase.eImportMode.ValidateAndImport)) {
        return NewPlanning.PlanningJobDayID;
    } else {
        throw new Exception(oMPInterface.oErrors.PrintErrors());
    }
}
Create a resource pool planning
private int CreatePlanningPoolPeriodPlanning(DateTime dtPlanDate) {
    Log($"CreatePlanningPoolPeriodPlanning({dtPlanDate.ToShortDateString()})");
    clsImportPlanning NewPlanning = new clsImportPlanning();
    NewPlanning.ProjectNumber = "P100024";
    NewPlanning.ContractID = 102036; //sales contract. Can be mandatory for planning, depending on settnig
    NewPlanning.ContractPos = 102304; // sales contract position
    NewPlanning.PhaseID = 100032; //Erdarbeiten
    NewPlanning.DateFrom = dtPlanDate;
    NewPlanning.PlanningResourceType = clsImportPlanning.ePlanningResourceType.Pool;
    NewPlanning.ResourceID = "00002"; // Ressource pool id: CAD-Designer
    NewPlanning.PlanningType = clsImportPlanning.ePlanningType.PeriodPlanning;
    NewPlanning.TimeUnit = clsImportPlanning.eTimeUnit.Days;
    NewPlanning.QuantityTime = 10; //hours
    NewPlanning.QuantityResources = 2; //two employees are expected to work together on this task
    NewPlanning.Activity = "Pool Planning";

    if (oMPInterface.bImportPlanning(NewPlanning, clsImportBase.eImportMode.ValidateAndImport)) {
        return NewPlanning.PlanningJobDayID;
    } else {
        throw new Exception(oMPInterface.oErrors.PrintErrors());
    }
}

private int CreatePlanningStandardPool(DateTime dtPlanDate) {
    Log($"CreatePlanningStandardPool({dtPlanDate.ToShortDateString()})");
    clsImportPlanning NewPlanning = new clsImportPlanning();
    NewPlanning.ProjectNumber = "P100024";
    NewPlanning.ContractID = 102036; // can be mandatory, depending on settnig
    NewPlanning.ContractPos = 102304;
    NewPlanning.PhaseID = 100032; //Erdarbeiten
    NewPlanning.DateFrom = dtPlanDate;
    NewPlanning.ResourceID = ""; // will be the standard pool
    NewPlanning.PlanningResourceType = clsImportPlanning.ePlanningResourceType.StandardPool;
    NewPlanning.PlanningType = clsImportPlanning.ePlanningType.PeriodPlanning;
    NewPlanning.QuantityTime = 8;
    NewPlanning.QuantityResources = 2;
    NewPlanning.Activity = "StandardPool Planning";

    if (oMPInterface.bImportPlanning(NewPlanning, clsImportBase.eImportMode.ValidateAndImport)) {
        return NewPlanning.PlanningJobDayID;
    } else {
        throw new Exception(oMPInterface.oErrors.PrintErrors());
    }
}
Create a reservation planning on an equipment category or on an equipment
private int CreatePlanningEquipmentCatDay(DateTime dtPlanDate) {
    Log($"CreatePlanningEquipmentCatDay({dtPlanDate.ToShortDateString()})");
    clsImportPlanning NewPlanning = new clsImportPlanning();
    NewPlanning.ProjectNumber = "P100024";
    NewPlanning.ContractID = 102036; // sales contract for the rental of the digger
    NewPlanning.ContractPos = 102285; //sales contract position for the duration of the digger rental
    NewPlanning.PhaseID = 100031; //selected phase
    NewPlanning.DateFrom = dtPlanDate;
    NewPlanning.DateTo = dtPlanDate.AddDays(5);
    NewPlanning.PlanningResourceType = clsImportPlanning.ePlanningResourceType.EquipmentCategoryDays;
    NewPlanning.ResourceID = "100001"; // digger equipment category
    NewPlanning.PlanningType = clsImportPlanning.ePlanningType.DayPlanning;
    NewPlanning.TimeUnit = clsImportPlanning.eTimeUnit.Days;
    NewPlanning.QuantityResources = 2; //two digger at the same time
    NewPlanning.Activity = "EqCat Planning";

    if (oMPInterface.bImportPlanning(NewPlanning, clsImportBase.eImportMode.ValidateAndImport)) {
        return NewPlanning.PlanningJobDayID;
    } else {
        throw new Exception(oMPInterface.oErrors.PrintErrors());
    }
}
private int CreatePlanningEquipmentCat(DateTime dtPlanDate) {
    Log($"CreatePlanningEquipmentCat({dtPlanDate.ToShortDateString()})");
    clsImportPlanning NewPlanning = new clsImportPlanning();
    NewPlanning.ProjectNumber = "P100024";
    NewPlanning.ContractID = 102036; // sales contract for the rental of the digger
    NewPlanning.ContractPos = 102285; //sales contract position for the duration of the digger rental
    NewPlanning.PhaseID = 100031; //selected phase for the plan
    NewPlanning.DateFrom = dtPlanDate;
    NewPlanning.DateTo = dtPlanDate.AddDays(5);
    NewPlanning.PlanningResourceType = clsImportPlanning.ePlanningResourceType.EquipmentMasterDays;
    NewPlanning.ResourceID = "E110000"; // specific digger
    NewPlanning.PlanningType = clsImportPlanning.ePlanningType.DayPlanning;
    NewPlanning.TimeUnit = clsImportPlanning.eTimeUnit.Days;
    //NewPlanning.QuantityTime = 10;
    NewPlanning.QuantityResources = 2;
    NewPlanning.Activity = "Equipment Planning";

    if (oMPInterface.bImportPlanning(NewPlanning, clsImportBase.eImportMode.ValidateAndImport)) {
        return NewPlanning.PlanningJobDayID;
    } else {
        throw new Exception(oMPInterface.oErrors.PrintErrors());
    }
}
Item Planning
private int CreatePlanningItem(string ItemCode, DateTime FirstDayOfPeriod) {
    Log($"CreatePlanningItem({ItemCode}, {FirstDayOfPeriod.ToShortDateString()})");
    //Create one day planning for one employee

    clsImportPlanning NewPlanning = new clsImportPlanning();
    NewPlanning.ProjectNumber = "P100011";
    NewPlanning.ContractID = 100015; // SELECT ContractID FROM MARIContract WHERE ProjectNumber=N'P100011'
    NewPlanning.ContractPos = 100054; // SELECT ContractPositionId FROM MARIContractPositions WHERE ContractID=100008 AND WHERE PositionType=1 and ItemCode='230001' --(ItemAtCost)
    NewPlanning.PhaseID = 0; //(no phase on this project) SELECT PhaseID FROM MARIProjectPhases WHERE ProjectNumber=N'P100011'
    NewPlanning.DateFrom = FirstDayOfPeriod;
    NewPlanning.Activity = "material plan";
    NewPlanning.PlanningType = clsImportPlanning.ePlanningType.PeriodPlanning; //cost is planned in the month
    NewPlanning.PlanningResourceType = clsImportPlanning.ePlanningResourceType.Item;
    NewPlanning.ResourceID = ItemCode;
    NewPlanning.Costs = 800m;
    NewPlanning.TargetedRevenues = 1000m;
    NewPlanning.QuantityResources = 10;

    if (oMPInterface.bImportPlanning(NewPlanning, clsImportBase.eImportMode.ValidateAndImport)) {
        return NewPlanning.PlanningJobDayID;
    } else {
        throw new Exception(oMPInterface.oErrors.PrintErrors());
    }
}
See Also