Home > database >  Strives for the great god, according to outbound update inventory!!!!!!!!!!
Strives for the great god, according to outbound update inventory!!!!!!!!!!

Time:11-10

Inventory stock list is as follows:
Id name sotck batch create_date
1 towel 50 123 2020-06-01
2 towels 22 32 2020-06-02
3 towels 32 56 2020-06-01
4 soap 10 11 2020-06-01
5 soap 52 115 2020-05-20
6 toothbrush 20 November 2020-04-01
7 toothpaste 12 November 2020-06-01



1, with varieties, batch number must be different, creation time could be the same,
2, and now want to according to the outbound data, to update the stock table, if inventory reduce create_date first under the condition of small enough, if same create_date first batch small reduction,

CodePudding user response:

Can consider this: first-in, first-out inventory

https://blog.csdn.net/yole_grise/article/details/38371705

CodePudding user response:

The
refer to the original poster ljl_5085 response:
inventory stock list is as follows:
Id name sotck batch create_date
1 towel 50 123 2020-06-01
2 towels 22 32 2020-06-02
3 towels 32 56 2020-06-01
4 soap 10 11 2020-06-01
5 soap 52 115 2020-05-20
6 toothbrush 20 November 2020-04-01
7 toothpaste 12 November 2020-06-01



1, with varieties, batch number must be different, creation time could be the same,
2, now want to according to the outbound data, to update the stock table, if inventory reduce create_date first under the condition of small enough, if same create_date first batch small reduction,


Table design needs to be modified, otherwise, as the date range stretched, data increase, the speed will slow,
A, stock inventory table, function is to record a time node all the inventory, the first day of each month, for example,
2, inventory table, the dispatch table (table), and other business
Three, real-time inventory=inventory inventory table + inventory table + dispatch table (table), and other business
4, pay attention to the three tables all need do date listed on the index
  • Related