continue implementations

This commit is contained in:
Dennis Eichhorn 2024-01-12 00:30:21 +00:00
parent b9ab6faeb5
commit 588b32ebba
8 changed files with 102 additions and 26 deletions

View File

@ -0,0 +1,72 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Purchase
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Purchase\Controller;
use Modules\ItemManagement\Models\ItemMapper;
use Modules\ItemManagement\Models\StockIdentifierType;
use phpOMS\Contract\RenderableInterface;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Views\View;
/**
* Purchase controller class.
*
* @package Modules\Purchase
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
* @codeCoverageIgnore
*/
final class CliController extends Controller
{
/**
* Method which generates the general settings view.
*
* In this view general settings for the entire application can be seen and adjusted. Settings which can be modified
* here are localization, password, database, etc.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Response can be rendered
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function cliGenerateOrderSuggestion(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
// @todo define order details per item+stock
$items = ItemMapper::getAll()
->with('attributes')
->with('attributes/type')
->where('stockIdentifier', StockIdentifierType::NONE, '!=')
->where('attributes/type/name', [
'primary_supplier', 'lead_time', 'qc_time',
'maximum_stock_quantity', 'minimum_stock_quantity',
'maximum_order_interval', 'minimum_order_quantity',
'order_suggestion_type', 'order_suggestion_optimization_type',
'order_suggestion_history_duration', 'order_suggestion_averaging_method',
'order_suggestion_comparison_duration_type'
], 'IN')
->execute();
foreach ($items as $item) {
}
}
}

View File

@ -12,14 +12,14 @@
*/
declare(strict_types=1);
namespace Modules\Purchase\OrderSuggestion;
namespace Modules\Purchase\Models\OrderSuggestion;
use Modules\Purchase\Models\OrderSuggestionInterface;
use Modules\Purchase\Models\OrderSuggestion\OrderSuggestionInterface;
/**
* OMS order suggestion class
*
* @package Modules\Purchase\OrderSuggestion
* @package Modules\Purchase\Models\OrderSuggestion
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
@ -40,7 +40,7 @@ final class DefaultOrderSuggestion implements OrderSuggestionInterface
* @var int
* @since 1.0.0
*/
public int $historicComparisonDurationType = OrderSuggestionComparisonDurationType::ANNUALY;
public int $historicComparisonDurationType = OrderSuggestionComparisonDurationType::ANNUALLY;
/**
* How many years should used for the analysis.
@ -69,7 +69,7 @@ final class DefaultOrderSuggestion implements OrderSuggestionInterface
/**
* How greedy should the algorithm be?
*
* The number represents how many items in % can be bought in additon to the optimal stock quantity.
* The number represents how many items in % can be bought in addition to the optimal stock quantity.
*
* Higher means more room for adjustments.
*

View File

@ -4,7 +4,7 @@
*
* PHP Version 8.1
*
* @package Modules\Purchase\Models
* @package Modules\Purchase\Models\OrderSuggestion
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
@ -12,12 +12,12 @@
*/
declare(strict_types=1);
namespace Modules\Purchase\Models;
namespace Modules\Purchase\Models\OrderSuggestion;
/**
* OrderSuggestion class.
*
* @package Modules\Purchase\Models
* @package Modules\Purchase\Models\OrderSuggestion
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0

View File

@ -4,7 +4,7 @@
*
* PHP Version 8.1
*
* @package Modules\Purchase\OrderSuggestion
* @package Modules\Purchase\Models\OrderSuggestion
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
@ -12,14 +12,14 @@
*/
declare(strict_types=1);
namespace Modules\Purchase\OrderSuggestion;
namespace Modules\Purchase\Models\OrderSuggestion;
use phpOMS\Stdlib\Base\Enum;
/**
* Suggestion type enum.
*
* @package Modules\Purchase\OrderSuggestion
* @package Modules\Purchase\Models\OrderSuggestion
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0

View File

@ -4,7 +4,7 @@
*
* PHP Version 8.1
*
* @package Modules\Purchase\OrderSuggestion
* @package Modules\Purchase\Models\OrderSuggestion
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
@ -12,23 +12,27 @@
*/
declare(strict_types=1);
namespace Modules\Purchase\OrderSuggestion;
namespace Modules\Purchase\Models\OrderSuggestion;
use phpOMS\Stdlib\Base\Enum;
/**
* Suggestion type enum.
*
* @package Modules\Purchase\OrderSuggestion
* @package Modules\Purchase\Models\OrderSuggestion
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
abstract class OrderSuggestionComparisonDurationType extends Enum
{
public const ANNUALY = 1;
public const ANNUALLY = 1;
public const MONTHLY = 2; // The basis is every month, the different months are considered the same
public const MONTHLY_ANNUAL = 3; // The basis is the same month, e.g. helpful for seasonal data
public const WEEKLY = 3;
public const MONTHLY_ANNUAL = 4; // The basis is the same monthly, e.g. helpful for seasonal data
public const WEEKLY_ANNUAL = 5; // The basis is the same weekly, e.g. helpful for seasonal data
}

View File

@ -4,7 +4,7 @@
*
* PHP Version 8.1
*
* @package Modules\Purchase\Models
* @package Modules\Purchase\Models\OrderSuggestion
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
@ -12,12 +12,12 @@
*/
declare(strict_types=1);
namespace Modules\Purchase\Models;
namespace Modules\Purchase\Models\OrderSuggestion;
/**
* Order suggestion interface.
*
* @package Modules\Purchase\Models
* @package Modules\Purchase\Models\OrderSuggestion
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0

View File

@ -4,7 +4,7 @@
*
* PHP Version 8.1
*
* @package Modules\Purchase\OrderSuggestion
* @package Modules\Purchase\Models\OrderSuggestion
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
@ -12,14 +12,14 @@
*/
declare(strict_types=1);
namespace Modules\Purchase\OrderSuggestion;
namespace Modules\Purchase\Models\OrderSuggestion;
use phpOMS\Stdlib\Base\Enum;
/**
* Suggestion type enum.
*
* @package Modules\Purchase\OrderSuggestion
* @package Modules\Purchase\Models\OrderSuggestion
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0

View File

@ -4,7 +4,7 @@
*
* PHP Version 8.1
*
* @package Modules\Purchase\OrderSuggestion
* @package Modules\Purchase\Models\OrderSuggestion
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
@ -12,14 +12,14 @@
*/
declare(strict_types=1);
namespace Modules\Purchase\OrderSuggestion;
namespace Modules\Purchase\Models\OrderSuggestion;
use phpOMS\Stdlib\Base\Enum;
/**
* Suggestion type enum.
*
* @package Modules\Purchase\OrderSuggestion
* @package Modules\Purchase\Models\OrderSuggestion
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
@ -30,5 +30,5 @@ abstract class OrderSuggestionType extends Enum
public const HISTORIC = 2; // Suggestion based on: available stock + current orders + historic demand
public const TREND = 3; // Suggestion based on: available stock + current orders + trend
public const TREND = 4; // Suggestion based on: available stock + current orders + trend
}