Fix manufacuring efficiency on bom lines.
This commit is contained in:
parent
9f5bde2131
commit
bfb9739ae8
@ -520,7 +520,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
// Common attributes
|
||||
$keyforbreak = 'efficiency';
|
||||
$keyforbreak = 'duration';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||
|
||||
// Other attributes
|
||||
|
||||
@ -95,7 +95,7 @@ class BOM extends CommonObject
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
|
||||
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
|
||||
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
|
||||
//'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'),
|
||||
'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
|
||||
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>102),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-2, 'position'=>161, 'notnull'=>-1,),
|
||||
@ -1056,7 +1056,7 @@ class BOMLine extends CommonObjectLine
|
||||
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',),
|
||||
'qty_frozen' => array('type'=>'smallint', 'label'=>'QuantityFrozen', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>105, 'css'=>'maxwidth50imp', 'help'=>'QuantityConsumedInvariable'),
|
||||
'disable_stock_change' => array('type'=>'smallint', 'label'=>'DisableStockChange', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>108, 'css'=>'maxwidth50imp', 'help'=>'DisableStockChangeHelp'),
|
||||
//'efficiency' => array('type'=>'double(24,8)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfEfficiencyConsumedMeans'),
|
||||
'efficiency' => array('type'=>'double(24,8)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfEfficiencyConsumedMeans'),
|
||||
'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
||||
);
|
||||
|
||||
@ -98,11 +98,11 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled))
|
||||
if (!empty($conf->global->ENTREPOT_EXTRA_STATUS))
|
||||
{
|
||||
// hide products in closed warehouse, but show products for internal transfer
|
||||
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array'));
|
||||
$form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array'));
|
||||
$form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array'));
|
||||
}
|
||||
|
||||
echo '</span>';
|
||||
@ -128,11 +128,10 @@ $coldisplay++;
|
||||
print '<td class="bordertop nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"'.(GETPOST("disable_stock_change", 'alpha') ? ' checked="checked"' : '').'">';
|
||||
print '</td>';
|
||||
|
||||
//$coldisplay++;
|
||||
//print '<td class="bordertop nobottom nowrap linecollost right">';
|
||||
//print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.(GETPOSTISSET("efficiency")?GETPOST("efficiency", 'alpha'):1).'">';
|
||||
//print '</td>';
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="bordertop nobottom nowrap linecollost right">';
|
||||
print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.(GETPOSTISSET("efficiency")?GETPOST("efficiency", 'alpha'):1).'">';
|
||||
print '</td>';
|
||||
|
||||
$coldisplay += $colspan;
|
||||
print '<td class="bordertop nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
|
||||
|
||||
@ -124,9 +124,9 @@ $coldisplay++;
|
||||
print '<td class="nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"'.(GETPOSTISSET('disablestockchange')?(GETPOST("disable_stock_change", 'int')?' checked="checked"':''):($line->disable_stock_change?' checked="checked"':'')).'">';
|
||||
print '</td>';
|
||||
|
||||
//$coldisplay++;
|
||||
//print '<td class="nobottom nowrap linecollost right">';
|
||||
//print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>';
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom nowrap linecollost right">';
|
||||
print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>';
|
||||
|
||||
$coldisplay+=$colspan;
|
||||
print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
|
||||
|
||||
@ -66,7 +66,7 @@ print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('QtyFro
|
||||
print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).'</td>';
|
||||
|
||||
// Efficiency
|
||||
//print '<td class="linecollost right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('XXX')).'</td>';
|
||||
print '<td class="linecollost right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';
|
||||
|
||||
print '<td class="linecoledit"></td>'; // No width to allow autodim
|
||||
|
||||
|
||||
@ -98,10 +98,10 @@ $coldisplay++;
|
||||
echo $line->disable_stock_change ? yn($line->disable_stock_change) : ''; // Yes, it is a quantity, not a price, but we just want the formating role of function price
|
||||
print '</td>';
|
||||
|
||||
//print '<td class="linecolqty nowrap right">';
|
||||
//$coldisplay++;
|
||||
//echo $line->efficiency;
|
||||
//print '</td>';
|
||||
print '<td class="linecolefficiency nowrap right">';
|
||||
$coldisplay++;
|
||||
echo $line->efficiency;
|
||||
print '</td>';
|
||||
|
||||
if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines' ) {
|
||||
print '<td class="linecoledit center">';
|
||||
|
||||
@ -2400,9 +2400,10 @@ class Form
|
||||
* @param string $selected Preselected value
|
||||
* @param int $hidepriceinlabel Hide price in label
|
||||
* @param string $filterkey Filter key to highlight
|
||||
* @param int $novirtualstock Do not load virtual stock, even if slow option STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO is on.
|
||||
* @return void
|
||||
*/
|
||||
protected function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '')
|
||||
protected function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '', $novirtualstock = 0)
|
||||
{
|
||||
global $langs, $conf, $user, $db;
|
||||
|
||||
@ -2639,7 +2640,7 @@ class Form
|
||||
}
|
||||
$outval .= $langs->transnoentities("Stock").':'.$objp->stock;
|
||||
$outval .= '</span>';
|
||||
if (!empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) // Warning, this option may slow down combo list generation
|
||||
if (empty($novirtualstock) && !empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) // Warning, this option may slow down combo list generation
|
||||
{
|
||||
$langs->load("stocks");
|
||||
|
||||
|
||||
@ -24,7 +24,9 @@ WatermarkOnDraftMOs=Watermark on draft MO
|
||||
ConfirmCloneBillOfMaterials=Are you sure you want to clone the bill of material %s ?
|
||||
ConfirmCloneMo=Are you sure you want to clone the Manufacturing Order %s ?
|
||||
ManufacturingEfficiency=Manufacturing efficiency
|
||||
ConsumptionEfficiency=Consumption efficiency
|
||||
ValueOfMeansLoss=Value of 0.95 means an average of 5%% of loss during the production
|
||||
ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss of produced product
|
||||
DeleteBillOfMaterials=Delete Bill Of Materials
|
||||
DeleteMo=Delete Manufacturing Order
|
||||
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Material?
|
||||
|
||||
@ -648,7 +648,7 @@ class Mo extends CommonObject
|
||||
if ($line->qty_frozen) {
|
||||
$moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce
|
||||
} else {
|
||||
$moline->qty = round($line->qty * $this->qty / $bom->efficiency, 2);
|
||||
$moline->qty = round($line->qty * $this->qty / $line->efficiency, 2);
|
||||
}
|
||||
if ($moline->qty <= 0) {
|
||||
$error++;
|
||||
@ -1268,7 +1268,7 @@ class Mo extends CommonObject
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Ref').'</td>';
|
||||
print '<td class="right">'.$langs->trans('Qty').'</td>';
|
||||
print '<td class="right">'.$langs->trans('Qty').' <span class="opacitymedium">('.$langs->trans("ForAQuantityOf1").')</span></td>';
|
||||
print '<td class="center">'.$langs->trans('QtyFrozen').'</td>';
|
||||
print '<td class="center">'.$langs->trans('DisableStockChange').'</td>';
|
||||
//print '<td class="right">'.$langs->trans('Efficiency').'</td>';
|
||||
@ -1337,7 +1337,7 @@ class Mo extends CommonObject
|
||||
$this->tpl['qty'] = $line->qty;
|
||||
$this->tpl['qty_frozen'] = $line->qty_frozen;
|
||||
$this->tpl['disable_stock_change'] = $line->disable_stock_change;
|
||||
//$this->tpl['efficiency'] = $line->efficiency;
|
||||
$this->tpl['efficiency'] = $line->efficiency;
|
||||
|
||||
$tpl = DOL_DOCUMENT_ROOT.'/mrp/tpl/originproductline.tpl.php';
|
||||
$res = include $tpl;
|
||||
|
||||
@ -287,7 +287,7 @@ if ($action == 'create')
|
||||
print '</div>';
|
||||
|
||||
if (GETPOST('fk_bom', 'int') > 0) {
|
||||
print load_fiche_titre($langs->trans("ToConsume").' ('.$langs->trans("ForAQuantityOf1").')');
|
||||
print load_fiche_titre($langs->trans("ToConsume"));
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
@ -23,13 +23,14 @@ if (empty($conf) || ! is_object($conf))
|
||||
exit;
|
||||
}
|
||||
|
||||
if (! is_object($form)) $form = new Form($db);
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE originproductline.tpl.php -->
|
||||
<?php
|
||||
print '<tr class="oddeven'.(empty($this->tpl['strike'])?'':' strikefordisabled').'">';
|
||||
print '<td>'.$this->tpl['label'].'</td>';
|
||||
print '<td class="right">'.$this->tpl['qty'].'</td>';
|
||||
print '<td class="right">'.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")) . ' = ' . round($this->tpl['qty'] / $this->tpl['efficiency'], 2) : '').'</td>';
|
||||
print '<td class="center">'.($this->tpl['qty_frozen'] ? yn($this->tpl['qty_frozen']) : '').'</td>';
|
||||
print '<td class="center">'.($this->tpl['disable_stock_change'] ? yn($this->tpl['disable_stock_change']) : '').'</td>';
|
||||
//print '<td class="right">'.$this->tpl['efficiency'].'</td>';
|
||||
|
||||
@ -4775,6 +4775,8 @@ class Product extends CommonObject
|
||||
$stock_reception_fournisseur = 0;
|
||||
$stock_inproduction = 0;
|
||||
|
||||
//dol_syslog("load_virtual_stock");
|
||||
|
||||
if (!empty($conf->commande->enabled))
|
||||
{
|
||||
$result = $this->load_stats_commande(0, '1,2', 1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user