Входные параметры
Параметр | Тип | Описание |
---|---|---|
ORDERITEMID |
INTEGER |
|
Выходные параметры
Параметр | Тип | Описание |
---|---|---|
ORDERLOADITEMID |
INTEGER |
|
HUMIDITY |
NUMERIC(9,2) |
|
DIRT |
NUMERIC(9,2) |
|
SCREENING |
NUMERIC(9,2) |
|
SUMWEIGHT |
INTEGER |
|
INVENTORYID |
INTEGER |
|
QUALITYID |
INTEGER |
|
Описание
(Нет описания для процедуры FORWARDER_REQUALITY)
Определение
CREATE PROCEDURE FORWARDER_REQUALITY(
ORDERITEMID INTEGER)
RETURNS (
ORDERLOADITEMID INTEGER,
HUMIDITY NUMERIC(9,2),
DIRT NUMERIC(9,2),
SCREENING NUMERIC(9,2),
SUMWEIGHT INTEGER,
INVENTORYID INTEGER,
QUALITYID INTEGER)
AS
BEGIN
FOR
select
OrderLoadItems.OrderLoadItemID,
IT.LabQualityID,
IT.InventoryID,
cast(Sum(Quality_Select.Humidity * EAIV.Weight) / Sum(nullif(EAIV.Weight, 0) + Quality_Select.Humidity - Quality_Select.Humidity) as numeric(9,2)) Humidity,
cast(Sum(Quality_Select.Dirt * EAIV.Weight) / Sum(nullif(EAIV.Weight, 0) + Quality_Select.Dirt - Quality_Select.Dirt) as numeric(9,2)) Dirt,
cast(Sum(Quality_Select.Screening * EAIV.Weight) / Sum(nullif(EAIV.Weight, 0) + Quality_Select.Screening - Quality_Select.Screening) as numeric(9,2)) Screening,
Sum(EAIV.Weight) as SumWeight
from ExportActs
left join ExportActItems_View EAIV on (ExportActs.ExportActID = EAIV.ExportActID)
left join Quality on (ExportActs.QualityID = Quality.QualityID)
left join OrderLoadItems on (ExportActs.OrderItemID = OrderLoadItems.OrderLoadITemID)
left join OrderLoad on (OrderLoadItems.OrderLoadID = OrderLoad.OrderLoadID)
left join IT on (OrderLoadItems.OrderLoadItemID = IT.OrderLoadItemID)
left join Quality_Select(IT.LabQualityID) on (0 = 0)
where ExportActs.OrderItemID = :OrderItemID
and EAIV.OperationID = 17
and EAIV.Weight > 0
group by
OrderLoadItems.OrderLoadItemID,
IT.LabQualityID,
IT.InventoryID
INTO :ORDERLOADITEMID,
:QUALITYID,
:INVENTORYID,
:HUMIDITY,
:DIRT,
:SCREENING,
:SUMWEIGHT
DO
BEGIN
SUSPEND;
END
END