标签:代码 search 需要 class hang sele gen tin plugin
标准件和非标准件入库和出库的件数,规格,重量记录方案
标准件入库:
只需填写包装规格和总重量,自动计算入库件数,入库的标准袋重量和非标准袋重量;数据存入入库单表和库存快照表
非标准件入库:
只需填写件数和总重量,包装规格无需填写,自动计算标准重量为0,非标准件重量等于总重量;数据存入入库单表和库存快照表
标准件出库:
只需填写出库总重量,包装规格自动从入库单带出,剩余标准重量和剩余非标准重量自动带出,件数自动计算,标准重量自动计算,非标准重量自动计算;出库量小于非标准重量则直接从非标准重量出库,出库量大于剩余非标准重量则需要拆包
非标准件出库:
用户填写出库件数和出库总重量,直接扣除件数和出库重量和非标准重量
原料入库单业务逻辑js代码:
<tr> <td class="item-label"> <label class="control-label">计件类型<span class="error">(必填)</span></label> <?= \backend\widgets\CusTooltipsWidget::widget(["key"=>"计件类型"]);?> </td> <td colspan="2"> <?= $form->field($model, ‘piece_type‘)->widget(\kartik\widgets\Select2::classname(), [ ‘hideSearch‘ => true, ‘data‘ => \core\models\WmsManager::getPieceTypeOptions(), ‘options‘ => [‘placeholder‘ => ‘选择计件类型‘], ‘pluginEvents‘ => [ "select2:select" => ‘function(){ handlePieceTypeTrigger(); handlePackageNumber(); }‘, ] ]) ?> </td> <td class="item-label"> <label class="control-label">件数<span class="error">(必填)</span></label> <?= \backend\widgets\CusTooltipsWidget::widget(["key"=>"件数"]);?> </td> <td colspan="2"> <?= $form->field($model, ‘wms_material_in_sheet_package_number‘)->textInput([ ‘onchange‘=>‘afterPackageNumberInput($(this))‘, ‘onkeyup‘=>‘afterPackageNumberInput($(this))‘, ]) ?> </td> <td class="item-label"> <label class="control-label">包装规格<span class="error">(必填)</span></label> <?= \backend\widgets\CusTooltipsWidget::widget(["key"=>"包装规格"]);?> </td> <td colspan="2"> <?= $form->field($model, ‘wms_material_in_sheet_weight_per_package‘)->textInput([ ‘value‘=>!empty(floatval($model->wms_material_in_sheet_weight_per_package)) ? $model->wms_material_in_sheet_weight_per_package : ‘‘, ‘onchange‘=>‘afterWeightPerPackageInput($(this))‘, ‘onkeyup‘=>‘afterWeightPerPackageInput($(this))‘, ]) ?> </td> </tr> <tr> <td class="item-label"> <label class="control-label">标准件重量<span class="error">(必填)</span></label> <?= \backend\widgets\CusTooltipsWidget::widget(["key"=>"标准件重量"]);?> </td> <td colspan="2"> <?= $form->field($model, ‘standard_weight‘)->textInput([ ‘readOnly‘=>true, ‘value‘=>!empty(floatval($model->standard_weight)) ? $model->standard_weight : ‘‘, ‘onchange‘=>‘afterStandardWeightInput($(this))‘, ‘onkeyup‘=>‘afterStandardWeightInput($(this))‘, ]) ?> </td> <td class="item-label"> <label class="control-label">非标准件重量<span class="error">(必填)</span></label> <?= \backend\widgets\CusTooltipsWidget::widget(["key"=>"非标准件重量"]);?> </td> <td colspan="2"> <?= $form->field($model, ‘off_standard_weight‘)->textInput([ ‘readOnly‘=>true, ‘value‘=>!empty(floatval($model->off_standard_weight)) ? $model->off_standard_weight : ‘‘, ‘onchange‘=>‘afterOffStandardWeightInput($(this))‘, ‘onkeyup‘=>‘afterOffStandardWeightInput($(this))‘, ]) ?> </td> </tr>
//处理标准重量和非标准重量的计算 function handlePieceTypeTrigger(){ var total_weight = $(‘#wmsmaterialinsheet-wms_material_in_sheet_purchase_weight‘).val(); var piece_type = $(‘#wmsmaterialinsheet-piece_type‘).val(); var package_number = $(‘#wmsmaterialinsheet-wms_material_in_sheet_package_number‘).val(); var weight_per_package = $(‘#wmsmaterialinsheet-wms_material_in_sheet_weight_per_package‘).val(); var standard_weight = $(‘#wmsmaterialinsheet-standard_weight‘).val(); var off_standard_weight = $(‘#wmsmaterialinsheet-off_standard_weight‘).val(); if (total_weight > 0 && piece_type == 1 && package_number >= 1 && weight_per_package > 0){ package_number = Math.floor(total_weight/weight_per_package); standard_weight = package_number * weight_per_package; off_standard_weight = total_weight - standard_weight; $(‘#wmsmaterialinsheet-wms_material_in_sheet_package_number‘).val(package_number); $(‘#wmsmaterialinsheet-standard_weight‘).val(standard_weight.toFixed(2)); $(‘#wmsmaterialinsheet-off_standard_weight‘).val(off_standard_weight.toFixed(2)); } if (total_weight > 0 && piece_type == 2){ standard_weight = 0; off_standard_weight = total_weight - standard_weight; $(‘#wmsmaterialinsheet-standard_weight‘).val(standard_weight.toFixed(2)); $(‘#wmsmaterialinsheet-off_standard_weight‘).val(off_standard_weight.toFixed(2)); } } /** * 根据计件类型控制件数的只读属性 */ function handlePackageNumber(){ if($(‘#wmsmaterialinsheet-piece_type‘).val() == ‘1‘){ $(‘#wmsmaterialinsheet-wms_material_in_sheet_package_number‘).attr(‘readOnly‘, true); }else{ $(‘#wmsmaterialinsheet-wms_material_in_sheet_package_number‘).attr(‘readOnly‘, false); } } /** * 结算重量改变触发器 * @param ele */ function afterTotalWeightInput(ele){ handlePieceTypeTrigger(); } /** * 计件类型改变触发器 * @param ele */ function afterPieceTypeSelect(ele){ handlePieceTypeTrigger(); } /** * 件数输入触发器 * @param ele */ function afterPackageNumberInput(ele){ handlePieceTypeTrigger(); } /** * 包装规格输入触发器 * @param ele */ function afterWeightPerPackageInput(ele){ handlePieceTypeTrigger(); } /** * 标准重量触发器 * @param ele */ function afterStandardWeightInput(ele){ handlePieceTypeTrigger(); } /** * 非标准重量输入触发器 * @param ele */ function afterOffStandardWeightInput(ele){ handlePieceTypeTrigger(); }
标签:代码 search 需要 class hang sele gen tin plugin
原文地址:https://www.cnblogs.com/liuzhiqaingxyz/p/9188615.html