Home > Back-end >  Pray god help delphi6 SQL
Pray god help delphi6 SQL

Time:11-29

Existing for the subsidiary, in accordance with the "first-in first-out" principle, will be put in storage according to the outbound time sharing, to spread out, all kinds of situations, such as the outbound & gt;=warehousing and inventory all contributing to dispatch on the same day, the rest of the outbound by a Shared library, when outbound & lt; Warehousing, inventory according to the dispatch date, split, in turn until the previous outbound spread out, have the same outbound and inbound, warehouse don't make up for the day, just before the date of dispatch, need to automatically increase the share data on the original table, and change the start date for the "up", in-out warehouse any time there may be, not according to my date example, table data will have tens of thousands of article, hope that processing speed is fast,

Database: sql2000
Datea fields: date, for the A1 (positive is outbound, negative is put in storage), the balance amount A2, start date Dbegin

Example: the original table
Datea A1 A2 Dbegin 1 100-1 100-1 1 0 1-2-2-100
1-3, 100, 100 1-3
1-4 60 40 1-4
1-5, 100, 140 1-5
1-8-10 150 1-8
1-8-160-1-8-10
1-10 of 10 0 1-10
1-12 October 10-12
1 to 13-13 20 30
1-15-30 0 1-15
1-15 October 10-15
1-10 of 17 0 1-17 share data into the table after

Datea A1 A2 Dbegin
1 100-1 100-1
1 0 1-2-2-100
100 make up 1-1
1-3, 100, 100 1-3
1-4 60 40 1-4
1-3 60 complement
1-5, 100, 140 1-5
1-8-10 150 1-8
1-8-160-1-8-10
1-5, 100 for
1-3 40 complement
1-10 of 10 0 1-10
1-12 October 10-12
1 to 13-13 20 30
1-12 10 complement
1-10 of 10 for
1-8-10 complement
1-15-30 0 1-15
1-15 October 10-15
1-13 20 complement
1-10 of 17 0 1-17

CodePudding user response:

You this should be enters sells saves, belongs to a kind of MIS, as the name suggests, your business data should be divided into a library table, an outbound table, a list of inventory, warehousing, outbound simply records, inventory can be updated dynamically when inbound/outbound, don't mix, so that the logic is clear, code is simple,
  • Related