Входные параметры
Параметр | Тип | Описание |
---|---|---|
HUMBAS |
NUMERIC(9,2) |
|
DIRTBAS |
NUMERIC(9,2) |
|
SCREENBAS |
NUMERIC(9,2) |
|
PLUGUNDERWORK |
INTEGER |
|
HUM |
NUMERIC(9,2) |
|
DIRT |
NUMERIC(9,2) |
|
SCREEN |
NUMERIC(9,2) |
|
ONENET |
INTEGER |
|
INCOMECOST |
NUMERIC(9,4) |
|
DRYCOST |
NUMERIC(9,4) |
|
CLEANCOST |
NUMERIC(9,4) |
|
Выходные параметры
Параметр | Тип | Описание |
---|---|---|
ALLDET |
NUMERIC(9,4) |
|
ALLNET |
INTEGER |
|
NETCOST |
NUMERIC(15,2) |
|
DRYNET |
NUMERIC(15,2) |
|
CLEANNET |
NUMERIC(15,2) |
|
INCOMEW |
NUMERIC(15,2) |
|
DRYW |
NUMERIC(15,2) |
|
CLEANW |
NUMERIC(15,2) |
|
Описание
(Нет описания для процедуры REGISTER_CALCQUALITY)
Определение
CREATE PROCEDURE REGISTER_CALCQUALITY(
HUMBAS NUMERIC(9,2),
DIRTBAS NUMERIC(9,2),
SCREENBAS NUMERIC(9,2),
PLUGUNDERWORK INTEGER,
HUM NUMERIC(9,2),
DIRT NUMERIC(9,2),
SCREEN NUMERIC(9,2),
ONENET INTEGER,
INCOMECOST NUMERIC(9,4),
DRYCOST NUMERIC(9,4),
CLEANCOST NUMERIC(9,4))
RETURNS (
ALLDET NUMERIC(9,4),
ALLNET INTEGER,
NETCOST NUMERIC(15,2),
DRYNET NUMERIC(15,2),
CLEANNET NUMERIC(15,2),
INCOMEW NUMERIC(15,2),
DRYW NUMERIC(15,2),
CLEANW NUMERIC(15,2))
AS
declare variable hump numeric(9,2);
declare variable dirtp numeric(9,2);
declare variable screenp numeric(9,2);
declare variable ph numeric(9,2);
declare variable pd numeric(9,2);
declare variable ps numeric(9,2);
declare variable deth numeric(9,4);
declare variable detd numeric(9,4);
declare variable dets numeric(9,4);
declare variable dethw integer;
declare variable detdw integer;
declare variable detsw integer;
declare variable sampleweight integer;
declare variable deterioration integer;
begin
if (:hum > :humbas) then begin
hump = :hum;
pH = :hum - :humbas;
end
else begin
hump = :humbas;
pH = 0;
end
if (:dirt > :dirtbas) then begin
dirtp = :dirt;
pD = :dirt - :dirtbas;
end
else begin
dirtp = :dirtbas;
pD = 0;
end
if (:screen > :screenbas) then begin
screenp = :screen;
pS = :screen - :screenbas;
end
else begin
screenp = :screenbas;
pS = 0;
end
if (:PlugUnderwork = 1) then
begin
detd = :dirtp - :dirtbas;
deth = (:hump - :humbas)*100/(100 - humbas);
dets = 0;
detHw = cast((detH/100 *netcost*1000) as numeric(9,0));
detDw = cast(detD/100*(netcost*1000 - detHw) as numeric(9,0));
deterioration = cast(100 - ((netcost*1000 - detDw - detHw)/(netcost*1000)*100) as numeric(9,0));
end else
if (:PlugUnderwork = 2) then
begin
detH = (((:HUMP - :humbas) * 100)/(100 - :humbas));
detD = (((:DIRTP - :dirtbas) * 100)/(100 - :dirtbas));
detS = (((:screenp - :screenbas) * 100)/(100 - :screenbas));
detDw = cast(detD*(netcost*1000)/100 as numeric(9,0));
detHw = cast(detH/100 *((netcost*1000) - detDw) as numeric(9,0));
detSw = cast(detS/100 *((netcost*1000) - detDw) as numeric(9,0));
deterioration = cast(100 - ((netcost*1000 - detDw - detHw - detSw)/(netcost*1000)*100) as numeric(9,0));
end else
if (:PlugUnderwork = 3) then
begin
deterioration = 0;
end else
if (:PlugUnderwork = 4) then
begin -- Лисичанск
deth = :hump - :humbas;
detd = :dirtp - :dirtbas;
dets = :screenp - :screenbas;
detHw = cast(detH*(netcost*1000)/100 as numeric(9,0));
detDw = cast(detD*(netcost*1000)/100 as numeric(9,0));
deterioration = deth + detD + detS;
alldet = cast((((100 - (deth + detd + dets))/100)) as numeric (16,4));
allnet = :onenet * alldet ;
end else
if (:PlugUnderwork = 5) then begin
deth = cast(100*(:hump - :humbas)/(100 - :humbas) as numeric (16,2));
detd = cast((100 - deth)*(:dirtp - :dirtbas)/(100 - :dirtbas) as numeric (16,2));
detHw = cast(detH*(netcost*1000)/100 as numeric(9,0));
detDw = cast(detD*(netcost*1000)/100 as numeric(9,0));
deterioration = deth + detD;
alldet = cast((100 - (deth + detd))/100 as numeric (16,4));
allnet = :onenet * alldet ;
end else
if (:PlugUnderwork = 6) then begin
deth = cast(100*(:hump - :humbas)/(100 - :humbas) as numeric (16,2));
detd = cast((100 - deth)*(:dirtp - :dirtbas)/(100 - :dirtbas) as numeric (16,2));
detHw = cast(detH*(netcost*1000)/100 as numeric(9,0));
detDw = cast(detD*(netcost*1000)/100 as numeric(9,0));
deterioration = deth + detD;
alldet = cast((100 - (deth + detd))/100 as numeric (16,4));
allnet = :onenet * alldet ;
end
else
begin
detH = (((:HUMP - :humbas) * 100)/(100 - :humbas));
detD = (((:DIRTP - :dirtbas) * 100)/(100 - :dirtbas));
detDw = (detD * NetCost*1000/100);
detHw = ((deth/100) * (NetCost*1000 - detDw));
Deterioration = (100- ((NetCost*1000- (detDW + detHW))/(NetCost*1000)*100));
allnet = :onenet;
end
--..--
if ((:PlugUnderwork = 1)
or (:PlugUnderwork = 3)
or (:onenet <= 50000)
) then
sampleweight = 2;
else
sampleweight = (:onenet / 20000 - 0.001);
if (:PlugUnderwork > 0 and :PlugUnderwork <= 6) then
netcost = cast(:onenet as numeric(15,2))/1000;
else
netcost = cast(:onenet + sampleweight as numeric(15,2))/1000;
DryNet = netcost*pH;
if (:PlugUnderwork = 5) then
CleanNet = netcost*pD;
else if (:PlugUnderwork = 6) then
CleanNet = netcost*pD;
else if (:PlugUnderwork = 4) then
CleanNet = netcost;
else
CleanNet = (netcost - dethw/1000)*pD;
IncomeW = netcost*incomecost;
DryW = DryCost*DryNet;
if (:PlugUnderwork = 5) then
CleanW = cleancost*pD*netcost/100;
else if (:PlugUnderwork = 6) then
CleanW = cleancost*pD*netcost/100;
else if (:PlugUnderwork = 4) then
CleanW = cleancost*netcost;
else CleanW = cleancost*CleanNet;
suspend;
end