mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
seriennummern notification after stock addition
This commit is contained in:
parent
a653e52784
commit
a59e4a41e3
@ -1514,8 +1514,10 @@ public function NavigationHooks(&$menu)
|
|||||||
function FormatMenge($spalte, $decimals = 0)
|
function FormatMenge($spalte, $decimals = 0)
|
||||||
{
|
{
|
||||||
return ('FORMAT('.$spalte.','.$decimals.',\'de_DE\')');
|
return ('FORMAT('.$spalte.','.$decimals.',\'de_DE\')');
|
||||||
|
}
|
||||||
|
|
||||||
// return "replace(trim($spalte)+0,'.',',')";
|
function FormatMengeFuerFormular($spalte) {
|
||||||
|
return "trim($spalte)+0";
|
||||||
}
|
}
|
||||||
|
|
||||||
function FormatUCfirst($spalte)
|
function FormatUCfirst($spalte)
|
||||||
@ -2810,14 +2812,19 @@ public function NavigationHooks(&$menu)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function LieferscheinSeriennummernberechnen($id)
|
function LieferscheinSeriennummernberechnen($id)
|
||||||
{
|
{
|
||||||
/** @var Seriennummern $obj */
|
/** @var Seriennummern $obj */
|
||||||
$obj = $this->LoadModul('seriennummern');
|
$obj = $this->LoadModul('seriennummern');
|
||||||
if(!empty($obj) && method_exists($obj, 'LieferscheinSeriennummernberechnen')) {
|
if(!empty($obj) && method_exists($obj, 'LieferscheinSeriennummernberechnen')) {
|
||||||
$obj->LieferscheinSeriennummernberechnen($id);
|
$obj->LieferscheinSeriennummernberechnen($id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SeriennummernCheckWarnung($artikel_id) {
|
||||||
|
$obj = $this->LoadModul('seriennummern');
|
||||||
|
$obj->seriennummern_check_and_message_stock_added($artikel_id);
|
||||||
|
}
|
||||||
|
|
||||||
// @refactor in Lager Modul
|
// @refactor in Lager Modul
|
||||||
function ArtikelAnzahlLagerPlatzMitSperre($artikel,$lager_platz)
|
function ArtikelAnzahlLagerPlatzMitSperre($artikel,$lager_platz)
|
||||||
@ -20465,6 +20472,8 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->RunHook('LagerEinlagern_after',7, $artikel, $menge, $regal, $projekt, $grund, $doctype,$doctypeid);
|
$this->RunHook('LagerEinlagern_after',7, $artikel, $menge, $regal, $projekt, $grund, $doctype,$doctypeid);
|
||||||
|
|
||||||
|
$this->SeriennummernCheckWarnung($artikel);
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateLagerPlatzInhaltVPE($artikel, $menge, $gewicht, $laenge, $breite, $hoehe, $menge2 = 0, $gewicht2 = 0, $laenge2 = 0, $breite2 = 0, $hoehe2 = 0)
|
function CreateLagerPlatzInhaltVPE($artikel, $menge, $gewicht, $laenge, $breite, $hoehe, $menge2 = 0, $gewicht2 = 0, $laenge2 = 0, $breite2 = 0, $hoehe2 = 0)
|
||||||
@ -39577,7 +39586,7 @@ function Firmendaten($field,$projekt="")
|
|||||||
}
|
}
|
||||||
return $sipuid;
|
return $sipuid;
|
||||||
}
|
}
|
||||||
}
|
} // END erpAPI
|
||||||
|
|
||||||
|
|
||||||
function parse_csv($str,$parse_split_parameter="")
|
function parse_csv($str,$parse_split_parameter="")
|
||||||
|
@ -31,13 +31,14 @@ class Seriennummern {
|
|||||||
switch ($name) {
|
switch ($name) {
|
||||||
case "seriennummern_list":
|
case "seriennummern_list":
|
||||||
$allowed['seriennummern_list'] = array('list');
|
$allowed['seriennummern_list'] = array('list');
|
||||||
$heading = array('','','Artikel', 'Seriennummer','Adresse','Lieferschein','Lieferdatum', 'Menü');
|
$heading = array('','','Nummer','Artikel', 'Seriennummer','Erzeugt am','Adresse','Lieferschein','Lieferdatum', 'Menü');
|
||||||
$width = array('1%','1%','10%'); // Fill out manually later
|
$width = array('1%','1%','10%'); // Fill out manually later
|
||||||
|
|
||||||
// columns that are aligned right (numbers etc)
|
// columns that are aligned right (numbers etc)
|
||||||
// $alignright = array(4,5,6,7,8);
|
// $alignright = array(4,5,6,7,8);
|
||||||
|
|
||||||
$findcols = array('s.id','s.id','a.nummer', 's.seriennummer','ad.name','l.belegnr','l.datum','s.id');
|
$findcols = array('s.id','s.id', 'a.name_de', 'a.nummer', 's.seriennummer','s.logdatei','ad.name','l.belegnr','l.datum','s.id');
|
||||||
|
$searchsql = array('a.name_de', 'a.name_de', 'a.nummer', 's.seriennummer');
|
||||||
|
|
||||||
$defaultorder = 1;
|
$defaultorder = 1;
|
||||||
$defaultorderdesc = 0;
|
$defaultorderdesc = 0;
|
||||||
@ -58,8 +59,10 @@ class Seriennummern {
|
|||||||
SELECT SQL_CALC_FOUND_ROWS
|
SELECT SQL_CALC_FOUND_ROWS
|
||||||
s.id,
|
s.id,
|
||||||
$dropnbox,
|
$dropnbox,
|
||||||
a.nummer,
|
CONCAT('<a href=\"index.php?module=artikel&action=edit&id=',a.id,'\">',a.nummer,'</a>') as nummer,
|
||||||
|
a.name_de,
|
||||||
s.seriennummer,
|
s.seriennummer,
|
||||||
|
".$app->erp->FormatDateTime("s.logdatei").",
|
||||||
ad.name,
|
ad.name,
|
||||||
l.belegnr,
|
l.belegnr,
|
||||||
".$app->erp->FormatDate("l.datum").",
|
".$app->erp->FormatDate("l.datum").",
|
||||||
@ -110,7 +113,7 @@ class Seriennummern {
|
|||||||
'<a href="index.php?module=seriennummern&action=enter&artikel=',
|
'<a href="index.php?module=seriennummern&action=enter&artikel=',
|
||||||
['sql' => 'a.id'],
|
['sql' => 'a.id'],
|
||||||
'">',
|
'">',
|
||||||
'<img src="./themes/'.$app->Conf->WFconf['defaulttheme'].'/images/add.png" alt="Erfassen" border="0">',
|
'<img src="./themes/'.$app->Conf->WFconf['defaulttheme'].'/images/add.png" title="Neue Seriennummern erfassen" border="0">',
|
||||||
'</a>'
|
'</a>'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -119,7 +122,7 @@ class Seriennummern {
|
|||||||
$dropnbox,
|
$dropnbox,
|
||||||
CONCAT('<a href=\"index.php?module=artikel&action=edit&id=',a.id,'\">',a.nummer,'</a>') as nummer,
|
CONCAT('<a href=\"index.php?module=artikel&action=edit&id=',a.id,'\">',a.nummer,'</a>') as nummer,
|
||||||
a.name_de,
|
a.name_de,
|
||||||
auf_lager.anzahl,
|
".$app->erp->FormatMenge('auf_lager.anzahl').",
|
||||||
SUM(if(s.id IS NULL,0,1))-SUM(if(s.lieferscheinpos <> 0,1,0)),
|
SUM(if(s.id IS NULL,0,1))-SUM(if(s.lieferscheinpos <> 0,1,0)),
|
||||||
SUM(if(s.lieferscheinpos <> 0,1,0)),
|
SUM(if(s.lieferscheinpos <> 0,1,0)),
|
||||||
SUM(if(s.id IS NULL,0,1)),
|
SUM(if(s.id IS NULL,0,1)),
|
||||||
@ -183,7 +186,7 @@ class Seriennummern {
|
|||||||
$dropnbox,
|
$dropnbox,
|
||||||
CONCAT('<a href=\"index.php?module=artikel&action=edit&id=',a.id,'\">',a.nummer,'</a>') as nummer,
|
CONCAT('<a href=\"index.php?module=artikel&action=edit&id=',a.id,'\">',a.nummer,'</a>') as nummer,
|
||||||
a.name_de,
|
a.name_de,
|
||||||
auf_lager.anzahl,
|
".$app->erp->FormatMenge('auf_lager.anzahl').",
|
||||||
SUM(if(s.id IS NULL,0,1))-SUM(if(s.lieferscheinpos <> 0,1,0)),
|
SUM(if(s.id IS NULL,0,1))-SUM(if(s.lieferscheinpos <> 0,1,0)),
|
||||||
SUM(if(s.lieferscheinpos <> 0,1,0)),
|
SUM(if(s.lieferscheinpos <> 0,1,0)),
|
||||||
SUM(if(s.id IS NULL,0,1))
|
SUM(if(s.id IS NULL,0,1))
|
||||||
@ -296,7 +299,7 @@ class Seriennummern {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO seriennummern (seriennummer, artikel) VALUES ('".$this->app->DB->real_escape_string($seriennummer)."', '".$artikel_id."')";
|
$sql = "INSERT INTO seriennummern (seriennummer, artikel, logdatei) VALUES ('".$this->app->DB->real_escape_string($seriennummer)."', '".$artikel_id."', CURRENT_TIMESTAMP)";
|
||||||
try {
|
try {
|
||||||
$this->app->DB->Insert($sql);
|
$this->app->DB->Insert($sql);
|
||||||
} catch (mysqli_sql_exception $e) {
|
} catch (mysqli_sql_exception $e) {
|
||||||
@ -327,14 +330,14 @@ class Seriennummern {
|
|||||||
$seriennummern = array_unique($seriennummern);
|
$seriennummern = array_unique($seriennummern);
|
||||||
|
|
||||||
$check_seriennummern = $this->seriennummern_check_serials($artikel_id);
|
$check_seriennummern = $this->seriennummern_check_serials($artikel_id);
|
||||||
if (empty($check_seriennummern)) {
|
$check_seriennummern = $check_seriennummern[0];
|
||||||
|
|
||||||
|
$anzahl_fehlt = $check_seriennummern['menge_auf_lager']-$check_seriennummern['menge_nummern'];
|
||||||
|
|
||||||
|
if ($anzahl_fehlt == 0) {
|
||||||
$this->app->Tpl->addMessage('success', 'Seriennummern vollständig.');
|
$this->app->Tpl->addMessage('success', 'Seriennummern vollständig.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$check_seriennummern = $check_seriennummern[0];
|
|
||||||
|
|
||||||
$anzahl_fehlt = $check_seriennummern['menge_auf_lager']-$check_seriennummern['menge_nummern'];
|
|
||||||
|
|
||||||
if ($anzahl_fehlt < 0) {
|
if ($anzahl_fehlt < 0) {
|
||||||
$anzahl_fehlt = 0;
|
$anzahl_fehlt = 0;
|
||||||
}
|
}
|
||||||
@ -372,7 +375,7 @@ class Seriennummern {
|
|||||||
auf_lager.id,
|
auf_lager.id,
|
||||||
nummer,
|
nummer,
|
||||||
name,
|
name,
|
||||||
auf_lager.anzahl menge_auf_lager,
|
".$this->app->erp->FormatMenge('auf_lager.anzahl')." menge_auf_lager,
|
||||||
COALESCE(nummern_verfuegbar.anzahl,0) menge_nummern
|
COALESCE(nummern_verfuegbar.anzahl,0) menge_nummern
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
@ -405,8 +408,6 @@ class Seriennummern {
|
|||||||
auf_lager.id = nummern_verfuegbar.artikel
|
auf_lager.id = nummern_verfuegbar.artikel
|
||||||
GROUP BY
|
GROUP BY
|
||||||
auf_lager.id
|
auf_lager.id
|
||||||
HAVING
|
|
||||||
menge_nummern <> menge_auf_lager
|
|
||||||
";
|
";
|
||||||
|
|
||||||
$result = $this->app->DB->SelectArr($sql);
|
$result = $this->app->DB->SelectArr($sql);
|
||||||
@ -419,29 +420,46 @@ class Seriennummern {
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function seriennummern_create_notification($article)
|
protected function seriennummern_create_notification($artikel_id, $action, $title = 'Seriennummern', $message = 'Meldung', $button = 'Ok')
|
||||||
{
|
{
|
||||||
// Notification erstellen
|
// Notification erstellen
|
||||||
$message = new NotificationMessageData('default', 'Seriennummern check problem alter');
|
$notification_message = new NotificationMessageData('default', $title);
|
||||||
$message->setMessage('Nicht genug Seriendinges');
|
$artikel = $this->app->DB->SelectRow("SELECT name_de, nummer FROM artikel WHERE id = '".$artikel_id."' LIMIT 1");
|
||||||
$message->addTags(['seriennummern']);
|
$notification_message->setMessage($message.' Artikel ('.$artikel['nummer'].') '.$artikel['name']);
|
||||||
$message->setOption('id', $article);
|
$notification_message->addTags(['seriennummern']);
|
||||||
$message->setPriority(true);
|
$notification_message->setPriority(true);
|
||||||
|
|
||||||
$messageButtons = [
|
$messageButtons = [
|
||||||
[
|
[
|
||||||
'text' => 'Seriennummern pflegen',
|
'text' => $button,
|
||||||
'link' => sprintf('index.php?module=seriennummern&action=edit&article=%s', $article),
|
'link' => sprintf('index.php?module=seriennummern&action='.$action.'&artikel=%s', $artikel_id),
|
||||||
],
|
|
||||||
[
|
|
||||||
'text' => 'Zum Spooler',
|
|
||||||
'link' => '#'
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
$message->setOption('buttons', $messageButtons);
|
$notification_message->setOption('buttons', $messageButtons);
|
||||||
|
|
||||||
/** @var NotificationService $notification */
|
/** @var NotificationService $notification */
|
||||||
$notification = $this->app->Container->get('NotificationService');
|
$notification = $this->app->Container->get('NotificationService');
|
||||||
$notification->createFromData($this->app->User->GetID(), $message);
|
$notification->createFromData($this->app->User->GetID(), $notification_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if new numbers need to be entered, if yes, create notification
|
||||||
|
*/
|
||||||
|
public function seriennummern_check_and_message_stock_added(int $artikel_id) {
|
||||||
|
$check_seriennummern = $this->seriennummern_check_serials($artikel_id);
|
||||||
|
if ($check_seriennummern[0]['menge_nummern'] < $check_seriennummern[0]['menge_auf_lager']) {
|
||||||
|
$this->seriennummern_create_notification($artikel_id, 'enter', 'Seriennummern','Bitte Seriennummern für Einlagerung erfassen','Zur Eingabe');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if numbers need to be entered after stock removal, if yes, create notification
|
||||||
|
*/
|
||||||
|
public function seriennummern_check_and_message_stock_removed(int $artikel_id) {
|
||||||
|
$check_seriennummern = $this->seriennummern_check_serials($artikel_id);
|
||||||
|
if ($check_seriennummern[0]['menge_nummern'] > $check_seriennummern[0]['menge_auf_lager']) {
|
||||||
|
$this->seriennummern_create_notification($artikel_id, 'enter', 'Seriennummern','Bitte Seriennummern für Auslagerung erfassen','Zur Eingabe');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user