Вы находитесь на странице: 1из 24

:

, -01

1. .......................2
2. ........................2
3. . 3
1. .....3
2. -,
..........................................................5
4.
....................................6
5.
....................................7
6.
................................8
7.
.........................................................9
8. .................................................10
3. .................................................11
9. ...............13
10.
. . .13
11.
. ........14
12.
.....................................................................14
13. ..........................15
14. .........................15
15.
........................................................16
16. ......................................17
17. ........................................................18
18. .................................18
19. - ................................19
20. - .....................20
21. - -..........................................21
22. - -.......................22
23. 3 ...23
24. 3
....................................................................23
25. : .......24
26. , .
..............................................................24

1.

2.
2

3.
1.


3


1
1

2


---

--


---

4
5

6
--

---


--
---

14
( )

---

---

--

7
8
9

14
( )
--

-- (
)

--

--

--

10

10


12
. --

11

11

-----

12

---

13

14

15

5000 .

14
---

--;

16

17

16

17
18
19

---

---

18
-----

2. -,

1.

2.

3. ,
(, , )
4. (
),

5. (),
5000 .
6. , ,
,
7. ,
,
5

8. ,

9. ,
,

10.


10 . (
) 3000 (
)
11.

100,000,000
12.
200 3

4.

5.


PK

PK

FK1

PK,FK2
PK,FK1

PK


PK

PK

FK1

PK
FK3
FK2
FK4

FK1

FK2

PK

FK2
FK2
FK1


PK

FK3
FK1
FK2





AutomobileState


PK

FK1
FK2

PK


PK

PK

PK

-
PK,FK2
PK,FK1


Min
Max
(%)

PK

PK

FK2
FK3

FK2

FK1

FK1


PK


PK

PK

(%)

PK,FK1
PK,FK2

RecipeId
MedicineId

MedicineId
IngredientId

Quantity

PK

FK1
FK2

PK

PK

FK1
FK2

PK

MedicineStuff


PK,FK1
PK,FK2

FK1

PK

FK1
FK2

Incompatibility
PK,FK1
PK,FK2

1
2

PK

PK

PK

PK

FK1

PK

FK1

6.

7.

S3

S4

S1

S8

S5

S2

S6

S9

S7

S1
0

S0

S1
9

S1
2

S2
0

S1
6

S1
1

S2
1

S1
4

S2
2

S1
7

S1
5

S1
3

S1
8

8.
10

3.

()
S0


-
-

S1

S2
,


S3

S4

S5

S6

F
S0
S1
S3
S5
S10
S8
S9
S11
S16
S17
S19
S20
S21
S22
S2

S4

-
-

S6

S8

S9

S8
S9

S7

11

S7

S8

S9

S10
S11

S12

S3
S10

S12
S13
S5
S14
S15

S13
S14

S15

S16

S13
S12

S17

S18
S19

S20
S21
S22

S18

12

--
CREATE TRIGGER trgContractConsumerUpdate
ON ContractConsumer
FOR INSERT, UPDATE
AS
BEGIN
IF UPDATE(ContractStateId)
BEGIN
update Automobile
set State = 1
where AutoId in
(
select AutoId
from AutoToContract
where ContractNum in
(
select ContractNum
from inserted ins
where ins.ContractStateId = 4 or
ins.ContractStateId = 5
)
)
END
END

9.
create procedure sp__math_getorders
@contractNum int
as
begin
declare @consumerDistance int
--
select @consumerDistance = ct.Distance
from ContractConsumer cntr
left outer join Client cl
on cntr.ClientId = cl.ClientId
left outer join City ct
on cl.CityId = ct.CityId
where cntr.ContractNum = @contractNum
select
cl.ClientId as SupplierId,
SUM(o.Count*m.Volume/1000000) as TotalVolume,
SUM(o.Cost*o.Count) as TotalCost,
(ct.Distance+@consumerDistance)*2 as TotalDistance
from Orders o
left outer join Medicine m
on o.MedicineId = m.MedicineId
left outer join Client cl
on o.SupplierId = cl.ClientId
left outer join City ct
on cl.CityId = ct.CityId
where ContractNum = @contractNum and m.MinTemperature IS NULL
group by cl.ClientId, (ct.Distance+@consumerDistance)*2
end

10.
.

13

create procedure sp__math_setAutoToContract


@contractNum int,
@supplierId int,
@totalDistance int,
@ownerNo int,
@autotypeNo int,
@autoCount int
as
begin
declare @autoid int, @autocost int, @i int
declare cAuto cursor for
select a.AutoId, ap.PricePerDay
from Automobile a
left outer join AutomobilePrice ap
on a.OwnerNo = ap.ClientId
and a.TypeNo = ap.AutomobileTypeId
where a.OwnerNo = @ownerNo
and a.TypeNo = @autotypeNo
and a.State = 1
open cAuto
fetch next from cAuto into @autoid, @autocost
set @i = 1
WHILE @@FETCH_STATUS = 0
BEGIN
if @i <= @autoCount
begin
insert into AutoToContract
(ContractNum, AutoId, SupplierId, AutoCost)
values (@contractNum, @autoid,
@supplierId, @autocost*@totalDistance)
update Automobile
set Automobile.State = 2
where Automobile.AutoId = @autoid
end
fetch next from cAuto into @autoid, @autocost
set @i = @i + 1
END
close cAuto
deallocate cAuto
end

11.
.

12.

14

13.

14.

15

, ,

()

15.


. : ,
, , , , ,
,

. : , (), ,
, , .
.

16

:
-
-
-

:
,

16.

17


( )

( ) . ()
()
k- () ()
()
:

17.

UnitZCLP.pas

UnitMatrix.pas

UnitMathPrepare.pas

18.

18

,
,

(k = 0),

19. -

19


,
,

(k = 0),

-,

,

j

20. -

20

(
), -.
- .

Simplex Step
-

21. - -

21

22. - -

22

1)

2)

,
23. 3
1)

24.

2)

23

25. :

26. , .

24

Вам также может понравиться