Модуль GMD R12.GMD.A.6 (Разработка продукции УНП; Process Manufacturing Product Development)
Процедура добавления ингредиента в формулу
-------------------------------------------------------------------- -- Добавляем новый ингредиент в формулу procedure insert_formuladetail(p_formula_id NUMBER, p_ingredient_id NUMBER, p_new_qty NUMBER, p_uom VARCHAR2 default null, p_return_status OUT VARCHAR2, p_message OUT VARCHAR2) is l_api_version CONSTANT NUMBER := 1.0; l_init_msg_list VARCHAR2(1) := FND_API.G_TRUE ; l_commit VARCHAR2(1) := FND_API.G_FALSE; l_called_from_forms VARCHAR2(10):= 'NO'; l_return_status VARCHAR2(1); l_msg_count NUMBER; l_msg_data VARCHAR2(400); l_formula_detail_tbl GMD_FORMULA_DETAIL_PUB.formula_insert_dtl_tbl_type; -- l_formula_head fm_form_mst_b%rowtype; l_line_no number; -- i pls_integer := 1; no_proc_finish exception; begin if (p_formula_id is null) then p_message := 'Параметр p_formula_id не может быть пустой'; raise no_proc_finish; end if; begin select * into l_formula_head from fm_form_mst_b fm where fm.formula_id = p_formula_id; exception when others then p_message := 'Не удалось найти формулу'; raise no_proc_finish; end; begin select max(fm.line_no) into l_line_no from fm_matl_dtl fm where fm.FORMULA_ID = p_formula_id and fm.line_type = -1; exception when others then p_message := 'Не удалось найти строку формулы'; raise no_proc_finish; end; gme_common_pvt.set_who; l_formula_detail_tbl(i).formula_id := p_formula_id; l_formula_detail_tbl(i).formula_no := l_formula_head.formula_no; l_formula_detail_tbl(i).formula_vers := l_formula_head.formula_vers; l_formula_detail_tbl(i).line_type := -1; l_formula_detail_tbl(i).line_no := l_line_no + 1; l_formula_detail_tbl(i).inventory_item_id := p_ingredient_id; l_formula_detail_tbl(i).QTY := p_new_qty; l_formula_detail_tbl(i).release_type := 1; -- вручную if (p_uom is not null) then l_formula_detail_tbl(i).DETAIL_UOM := p_uom; end if; gmd_formula_detail_pub.insert_formuladetail( p_api_version => l_api_version ,p_init_msg_list => l_init_msg_list ,p_commit => l_commit ,p_called_from_forms => l_called_from_forms ,x_return_status => l_return_status ,x_msg_count => l_msg_count ,x_msg_data => l_msg_data ,p_formula_detail_tbl => l_formula_detail_tbl ); if l_return_status <> FND_API.g_ret_sts_success THEN if l_msg_count = 1 THEN p_message := FND_MSG_PUB.get(1,'F'); RAISE no_proc_finish; else for l in 1..l_msg_count loop FND_MSG_PUB.get (p_msg_index => l ,p_encoded => 'F' ,p_data => p_message ,p_msg_index_out => l_msg_count); end loop; RAISE no_proc_finish; end if; end if; p_return_status := 'S'; exception when no_proc_finish then p_return_status := 'E'; when others then p_message := SQLERRM; p_return_status := 'E'; end;
Последние комментарии