mirror of
https://github.com/Karaka-Management/oms-WarehouseManagement.git
synced 2026-02-16 06:08:40 +00:00
fix phpstan/phpcs
This commit is contained in:
parent
3cc6b94a94
commit
2045b9b0bd
|
|
@ -29,8 +29,8 @@ class Navigation
|
||||||
/**
|
/**
|
||||||
* Install navigation providing
|
* Install navigation providing
|
||||||
*
|
*
|
||||||
* @param string $path Module path
|
* @param string $path Module path
|
||||||
* @param ApplicationAbstract $app Application
|
* @param ApplicationAbstract $app Application
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -34,24 +34,31 @@ use Modules\WarehouseManagement\Models\StockLocationMapper;
|
||||||
*/
|
*/
|
||||||
final class Installer extends InstallerAbstract
|
final class Installer extends InstallerAbstract
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function install(DatabasePool $dbPool, ModuleInfo $info, SettingsInterface $cfgHandler) : void
|
public static function install(DatabasePool $dbPool, ModuleInfo $info, SettingsInterface $cfgHandler) : void
|
||||||
{
|
{
|
||||||
parent::install($dbPool, $info, $cfgHandler);
|
parent::install($dbPool, $info, $cfgHandler);
|
||||||
|
|
||||||
self::createStock();
|
self::createDefaultStock();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function createStock() : void
|
/**
|
||||||
|
* Creates a default stock
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private static function createDefaultStock() : void
|
||||||
{
|
{
|
||||||
$stock = new Stock('Default');
|
$stock = new Stock('Default');
|
||||||
$stock->type = 0;
|
$stock->type = 0;
|
||||||
StockMapper::create($stock);
|
StockMapper::create($stock);
|
||||||
|
|
||||||
$stockLocation = new StockLocation((string) ($stock->getId() . '-1'));
|
$stockLocation = new StockLocation((string) ($stock->getId() . '-1'));
|
||||||
$stockLocation->stock = $stock;
|
$stockLocation->stock = $stock;
|
||||||
StockLocationMapper::create($stockLocation);
|
StockLocationMapper::create($stockLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ use Modules\WarehouseManagement\Models\StockShelfMapper;
|
||||||
*/
|
*/
|
||||||
final class ApiController extends Controller
|
final class ApiController extends Controller
|
||||||
{
|
{
|
||||||
public function eventStockCreateInternal(
|
public function eventStockCreateInternal(
|
||||||
int $account,
|
int $account,
|
||||||
mixed $old,
|
mixed $old,
|
||||||
mixed $new,
|
mixed $new,
|
||||||
int $type = 0,
|
int $type = 0,
|
||||||
|
|
@ -42,23 +42,23 @@ final class ApiController extends Controller
|
||||||
string $ref = null,
|
string $ref = null,
|
||||||
string $content = null,
|
string $content = null,
|
||||||
string $ip = null
|
string $ip = null
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
$stock = new Stock($new->number);
|
$stock = new Stock($new->number);
|
||||||
$stock->type = 1;
|
$stock->type = 1;
|
||||||
StockMapper::create($stock);
|
StockMapper::create($stock);
|
||||||
|
|
||||||
$stockLocation = new StockLocation($stock->name . '-1');
|
$stockLocation = new StockLocation($stock->name . '-1');
|
||||||
$stockLocation->stock = $stock->getId();
|
$stockLocation->stock = $stock->getId();
|
||||||
StockLocationMapper::create($stockLocation);
|
StockLocationMapper::create($stockLocation);
|
||||||
|
|
||||||
$stockShelf = new StockShelf($stockLocation->name . '-1');
|
$stockShelf = new StockShelf($stockLocation->name . '-1');
|
||||||
$stockShelf->location = $stockLocation->getId();
|
$stockShelf->location = $stockLocation->getId();
|
||||||
StockShelfMapper::create($stockShelf);
|
StockShelfMapper::create($stockShelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function eventBillUpdateInternal(
|
public function eventBillUpdateInternal(
|
||||||
int $account,
|
int $account,
|
||||||
mixed $old,
|
mixed $old,
|
||||||
mixed $new,
|
mixed $new,
|
||||||
int $type = 0,
|
int $type = 0,
|
||||||
|
|
@ -67,24 +67,24 @@ final class ApiController extends Controller
|
||||||
string $ref = null,
|
string $ref = null,
|
||||||
string $content = null,
|
string $content = null,
|
||||||
string $ip = null
|
string $ip = null
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
if ($trigger === 'POST:Module:Billing-bill_element-create') {
|
if ($trigger === 'POST:Module:Billing-bill_element-create') {
|
||||||
// @todo: if is bill element create, create stock movement
|
// @todo: if is bill element create, create stock movement
|
||||||
|
|
||||||
} elseif ($trigger === 'POST:Module:Billing-bill_element-update') {
|
} elseif ($trigger === 'POST:Module:Billing-bill_element-update') {
|
||||||
// quantity change
|
// quantity change
|
||||||
// lot changes
|
// lot changes
|
||||||
// stock changes
|
// stock changes
|
||||||
// all other changes ignore!
|
// all other changes ignore!
|
||||||
// check availability again, if not available abort bill
|
// check availability again, if not available abort bill
|
||||||
} elseif ($trigger === 'POST:Module:Billing-bill_element-delete') {
|
} elseif ($trigger === 'POST:Module:Billing-bill_element-delete') {
|
||||||
// @todo: delete stock movement
|
// @todo: delete stock movement
|
||||||
} elseif ($trigger === 'POST:Module:Billing-bill-delete') {
|
} elseif ($trigger === 'POST:Module:Billing-bill-delete') {
|
||||||
// @todo: delete stock movements
|
// @todo: delete stock movements
|
||||||
} elseif ($trigger === 'POST:Module:Billing-bill-update') {
|
} elseif ($trigger === 'POST:Module:Billing-bill-update') {
|
||||||
// is receiver update -> change all movements
|
// is receiver update -> change all movements
|
||||||
// is status update -> change all movements (delete = delete)
|
// is status update -> change all movements (delete = delete)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ use phpOMS\Views\View;
|
||||||
*/
|
*/
|
||||||
final class BackendController extends Controller
|
final class BackendController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Routing end-point for application behaviour.
|
* Routing end-point for application behaviour.
|
||||||
*
|
*
|
||||||
* @param RequestAbstract $request Request
|
* @param RequestAbstract $request Request
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,6 @@ use phpOMS\Stdlib\Base\Enum;
|
||||||
abstract class PermissionState extends Enum
|
abstract class PermissionState extends Enum
|
||||||
{
|
{
|
||||||
public const STOCK = 1;
|
public const STOCK = 1;
|
||||||
|
|
||||||
public const STOCK_LOCATION = 2;
|
public const STOCK_LOCATION = 2;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,17 +32,37 @@ class Stock
|
||||||
*/
|
*/
|
||||||
private int $id = 0;
|
private int $id = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NAme.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public string $name = '';
|
public string $name = '';
|
||||||
|
|
||||||
public int $type = 0;
|
public int $type = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $name Stock name
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function __construct(string $name = '')
|
public function __construct(string $name = '')
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function getId() : int
|
public function getId() : int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,27 @@ class StockLocation
|
||||||
|
|
||||||
public int $z = 0;
|
public int $z = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $name Stock name
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function __construct(string $name = '')
|
public function __construct(string $name = '')
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function getId() : int
|
public function getId() : int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,11 @@ class StockMovement
|
||||||
*/
|
*/
|
||||||
public \DateTimeImmutable $createdAt;
|
public \DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->createdBy = new NullAccount();
|
$this->createdBy = new NullAccount();
|
||||||
|
|
|
||||||
|
|
@ -26,21 +26,21 @@ use phpOMS\Stdlib\Base\Enum;
|
||||||
*/
|
*/
|
||||||
abstract class StockMovementType extends Enum
|
abstract class StockMovementType extends Enum
|
||||||
{
|
{
|
||||||
public const MERGE = 1;
|
public const MERGE = 1;
|
||||||
public const SPLIT = 2;
|
public const SPLIT = 2;
|
||||||
public const INCREASE = 4;
|
public const INCREASE = 4;
|
||||||
public const DECREASE = 8;
|
public const DECREASE = 8;
|
||||||
public const TRANSFER = 16;
|
public const TRANSFER = 16;
|
||||||
|
|
||||||
|
|
||||||
// @todo: subtypes, maybe creates as database subtypes during install.
|
// @todo: subtypes, maybe creates as database subtypes during install.
|
||||||
public const DESTROY = 1; // 8
|
public const DESTROY = 1; // 8
|
||||||
public const RETURN = 1; // 8
|
public const RETURN = 1; // 8
|
||||||
public const INVENTORY_PLUS = 1; // 4
|
public const INVENTORY_PLUS = 1; // 4
|
||||||
public const INVENTORY_MINUS = 1; // 8
|
public const INVENTORY_MINUS = 1; // 8
|
||||||
public const PURCHASE = 1; // 4
|
public const PURCHASE = 1; // 4
|
||||||
public const SALE = 1; // 4
|
public const SALE = 1; // 4
|
||||||
public const MANUFACTURE_CREATE = 1; // 4
|
public const MANUFACTURE_CREATE = 1; // 4
|
||||||
public const MANUFACTURE_USE = 1; // 8
|
public const MANUFACTURE_USE = 1; // 8
|
||||||
public const MANUAL = 1; // 1-16
|
public const MANUAL = 1; // 1-16
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,27 @@ class StockShelf
|
||||||
|
|
||||||
public int $z = 0;
|
public int $z = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $name Shelf name
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function __construct(string $name = '')
|
public function __construct(string $name = '')
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function getId() : int
|
public function getId() : int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user