mirror of
https://github.com/Karaka-Management/oms-ItemManagement.git
synced 2026-02-16 04:08:43 +00:00
update
This commit is contained in:
parent
10752eee16
commit
609071e480
|
|
@ -91,10 +91,10 @@
|
||||||
"values": []
|
"values": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "maximum_order_interval",
|
"name": "minimum_order_quantity",
|
||||||
"l11n": {
|
"l11n": {
|
||||||
"en": "Maximum order interval",
|
"en": "MOQ",
|
||||||
"de": "Maximale Bestellhäufigkeit"
|
"de": "Mindestbestellmenge"
|
||||||
},
|
},
|
||||||
"value_type": 1,
|
"value_type": 1,
|
||||||
"is_custom_allowed": true,
|
"is_custom_allowed": true,
|
||||||
|
|
@ -104,10 +104,23 @@
|
||||||
"values": []
|
"values": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "minimum_order_quantity",
|
"name": "order_quantity_steps",
|
||||||
"l11n": {
|
"l11n": {
|
||||||
"en": "MOQ",
|
"en": "Order quantity steps",
|
||||||
"de": "Mindestbestellmenge"
|
"de": "Bestellschritte"
|
||||||
|
},
|
||||||
|
"value_type": 1,
|
||||||
|
"is_custom_allowed": true,
|
||||||
|
"validation_pattern": "",
|
||||||
|
"is_required": false,
|
||||||
|
"default_value": "",
|
||||||
|
"values": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "minimum_stock_range",
|
||||||
|
"l11n": {
|
||||||
|
"en": "Minimum stock range",
|
||||||
|
"de": "Mindestreichweite"
|
||||||
},
|
},
|
||||||
"value_type": 1,
|
"value_type": 1,
|
||||||
"is_custom_allowed": true,
|
"is_custom_allowed": true,
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,11 @@
|
||||||
"type": "TINYINT(1)",
|
"type": "TINYINT(1)",
|
||||||
"null": false
|
"null": false
|
||||||
},
|
},
|
||||||
|
"itemmgmt_item_createdat": {
|
||||||
|
"name": "itemmgmt_item_createdat",
|
||||||
|
"type": "DATETIME",
|
||||||
|
"null": false
|
||||||
|
},
|
||||||
"itemmgmt_item_parent": {
|
"itemmgmt_item_parent": {
|
||||||
"name": "itemmgmt_item_parent",
|
"name": "itemmgmt_item_parent",
|
||||||
"type": "INT(11)",
|
"type": "INT(11)",
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ final class ApiController extends Controller
|
||||||
$uploadedFiles = $request->files['item_profile_image'] ?? [];
|
$uploadedFiles = $request->files['item_profile_image'] ?? [];
|
||||||
if (!empty($uploadedFiles)) {
|
if (!empty($uploadedFiles)) {
|
||||||
// upload image
|
// upload image
|
||||||
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
|
$uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
||||||
names: [],
|
names: [],
|
||||||
fileNames: [],
|
fileNames: [],
|
||||||
files: $uploadedFiles,
|
files: $uploadedFiles,
|
||||||
|
|
@ -676,7 +676,7 @@ final class ApiController extends Controller
|
||||||
|
|
||||||
$path = $this->createItemDir($item);
|
$path = $this->createItemDir($item);
|
||||||
|
|
||||||
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
|
$uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
||||||
names: $request->getDataList('names'),
|
names: $request->getDataList('names'),
|
||||||
fileNames: $request->getDataList('filenames'),
|
fileNames: $request->getDataList('filenames'),
|
||||||
files: $uploadedFiles,
|
files: $uploadedFiles,
|
||||||
|
|
|
||||||
|
|
@ -216,62 +216,15 @@ final class BackendController extends Controller
|
||||||
$reserved = [];
|
$reserved = [];
|
||||||
$ordered = [];
|
$ordered = [];
|
||||||
if ($this->app->moduleManager->isActive('WarehouseManagement')) {
|
if ($this->app->moduleManager->isActive('WarehouseManagement')) {
|
||||||
$itemIds = \array_map(function (Item $item) { return $item->id;
|
$itemIds = \array_map(function (Item $item) {
|
||||||
|
return $item->id;
|
||||||
}, $items);
|
}, $items);
|
||||||
$itemIdsString = \implode(',', $itemIds);
|
|
||||||
|
|
||||||
// @todo only select sales stock. Therefore we need a place to define the sales stock(s)
|
$distributions = \Modules\WarehouseManagement\Models\StockMapper::getStockDistribution($itemIds);
|
||||||
$temp = \Modules\WarehouseManagement\Models\StockDistributionMapper::getAll()
|
|
||||||
->where('item', $itemIds, 'IN')
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
foreach ($temp as $t) {
|
$dists = $distributions['dists'];
|
||||||
if (!isset($dists[$t->item])) {
|
$reserved = $distributions['reserved'];
|
||||||
$dists[$t->item] = [];
|
$ordered = $distributions['ordered'];
|
||||||
}
|
|
||||||
|
|
||||||
// @todo These numbers might need adjustments for delivery notes/invoices depending on
|
|
||||||
// how we implement them in the warehouse management (maybe flag them in the transaction protocol as reserved?)
|
|
||||||
// also remember the SD issue where delivery notes can be technically still in stock -> stock value still belongs to company
|
|
||||||
// solution: "just" do a soft adjust of the available numbers?! but don't change the actual stock in the db
|
|
||||||
// the SD solution where actually delivered delivery notes can be adjusted after "archiving" will not be allowed
|
|
||||||
// to allow them to see what happened with such a delivery note maybe we can implement a view shows how many of the items are
|
|
||||||
// actually still outstanding. This shouldn't be anything special since we need importing of delivery notes anyways and marking
|
|
||||||
// old delivery note elements in a way to show which line items or even sub-line items got invoiced/returned etc.
|
|
||||||
$dists[$t->item][] = $t;
|
|
||||||
}
|
|
||||||
|
|
||||||
$stockIdentifier = StockIdentifierType::NONE;
|
|
||||||
|
|
||||||
$sql = <<<SQL
|
|
||||||
SELECT billing_bill_element.billing_bill_element_item,
|
|
||||||
billing_type.billing_type_name,
|
|
||||||
SUM(billing_bill_element.billing_bill_element_quantity) AS quantity
|
|
||||||
FROM billing_bill_element
|
|
||||||
LEFT JOIN itemmgmt_item ON billing_bill_element.billing_bill_element_item = itemmgmt_item.itemmgmt_item_id
|
|
||||||
LEFT JOIN billing_bill ON billing_bill_element.billing_bill_element_bill = billing_bill.billing_bill_id
|
|
||||||
LEFT JOIN billing_type ON billing_bill.billing_bill_type = billing_type.billing_type_id
|
|
||||||
WHERE billing_bill_element.billing_bill_element_item IN ({$itemIdsString})
|
|
||||||
AND itemmgmt_item.itemmgmt_item_stockidentifier != {$stockIdentifier}
|
|
||||||
AND billing_type.billing_type_name IN ('sales_order_confirmation', 'purchase_order')
|
|
||||||
GROUP BY billing_bill_element.billing_bill_element_item, billing_type.billing_type_name;
|
|
||||||
SQL;
|
|
||||||
|
|
||||||
$query = new Builder($this->app->dbPool->get());
|
|
||||||
$results = $query->raw($sql)->execute()->fetchAll(\PDO::FETCH_ASSOC);
|
|
||||||
|
|
||||||
foreach ($results as $result) {
|
|
||||||
if (!isset($reserved[(int) $result['billing_bill_element_item']])) {
|
|
||||||
$reserved[(int) $result['billing_bill_element_item']] = 0;
|
|
||||||
$ordered[(int) $result['billing_bill_element_item']] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result['billing_type_name'] === 'sales_order_confirmation') {
|
|
||||||
$reserved[(int) $result['billing_bill_element_item']] += (int) $result['quantity'];
|
|
||||||
} else {
|
|
||||||
$ordered[(int) $result['billing_bill_element_item']] += (int) $result['quantity'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$view->data['dists'] = $dists;
|
$view->data['dists'] = $dists;
|
||||||
|
|
@ -457,10 +410,8 @@ final class BackendController extends Controller
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
// Get item profile image
|
// Get item profile image
|
||||||
// It might not be part of the 5 newest item files from above
|
// @feature Create a new read mapper function that returns relation models instead of its own model
|
||||||
// @todo It would be nice to have something like this as a default method in the model e.g.
|
// https://github.com/Karaka-Management/phpOMS/issues/320
|
||||||
// ItemManagement::getRelations()->with('types')->where(...);
|
|
||||||
// This should return the relations and NOT the model itself
|
|
||||||
$query = new Builder($this->app->dbPool->get());
|
$query = new Builder($this->app->dbPool->get());
|
||||||
$results = $query->selectAs(ItemMapper::HAS_MANY['files']['external'], 'file')
|
$results = $query->selectAs(ItemMapper::HAS_MANY['files']['external'], 'file')
|
||||||
->from(ItemMapper::TABLE)
|
->from(ItemMapper::TABLE)
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ final class ItemMapper extends DataMapperFactory
|
||||||
'itemmgmt_item_purchaseprice' => ['name' => 'itemmgmt_item_purchaseprice', 'type' => 'Serializable', 'internal' => 'purchasePrice'],
|
'itemmgmt_item_purchaseprice' => ['name' => 'itemmgmt_item_purchaseprice', 'type' => 'Serializable', 'internal' => 'purchasePrice'],
|
||||||
'itemmgmt_item_parent' => ['name' => 'itemmgmt_item_parent', 'type' => 'int', 'internal' => 'parent'],
|
'itemmgmt_item_parent' => ['name' => 'itemmgmt_item_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||||
'itemmgmt_item_unit' => ['name' => 'itemmgmt_item_unit', 'type' => 'int', 'internal' => 'unit'],
|
'itemmgmt_item_unit' => ['name' => 'itemmgmt_item_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||||
|
'itemmgmt_item_createdat' => ['name' => 'itemmgmt_item_createdat', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -616,10 +616,7 @@ echo $this->data['nav']->render(); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
@todo
|
@todo make container in packaging department that can be used by packaging for sales and purchase
|
||||||
maybe put a master variations selection at the beginning so that you need to change it for other variations...
|
|
||||||
this way you will however not be able to see all at once only one at a time
|
|
||||||
make container in packaging department that can be used by packaging for sales and purchase
|
|
||||||
Shelf life (stock???)
|
Shelf life (stock???)
|
||||||
Packaging dimension+weight+units for different types (pallet, case etc.)
|
Packaging dimension+weight+units for different types (pallet, case etc.)
|
||||||
Language for all variations based on variables: e.g. ${size} T-shirt in ${color}
|
Language for all variations based on variables: e.g. ${size} T-shirt in ${color}
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,7 @@ echo $this->data['nav']->render();
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$monthlySalesCosts = SalesBillMapper::getItemMonthlySalesCosts($item->id, (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'));
|
$monthlySalesCosts = SalesBillMapper::getItemMonthlySalesCosts([$item->id], (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'));
|
||||||
if (!empty($monthlySalesCosts)) : ?>
|
if (!empty($monthlySalesCosts)) : ?>
|
||||||
<div class="col-xs-12 col-lg-6">
|
<div class="col-xs-12 col-lg-6">
|
||||||
<section class="portlet">
|
<section class="portlet">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user