diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml index 11840f5..4a8b196 100644 --- a/.idea/dataSources.local.xml +++ b/.idea/dataSources.local.xml @@ -1,6 +1,6 @@ - + " diff --git a/.idea/dataSources/15dcd0e2-d09f-417a-adb8-9c908c90dd7e.xml b/.idea/dataSources/15dcd0e2-d09f-417a-adb8-9c908c90dd7e.xml index 486b3f3..4645e1b 100644 --- a/.idea/dataSources/15dcd0e2-d09f-417a-adb8-9c908c90dd7e.xml +++ b/.idea/dataSources/15dcd0e2-d09f-417a-adb8-9c908c90dd7e.xml @@ -1,6 +1,6 @@ - + mdy 1||-9223372036854775808|c|G @@ -11,7 +11,7 @@ 4||10|c|G 4||10|C|G 4||10|T|G - 866 + 1070 16.10 1762141219 true ACDT @@ -810,7 +810,7 @@ false posixrules 13273||10|C|G 13273||-9223372036854775808|U|G 13273||10|U|G - 866 + 1070 16384 postgres @@ -4235,11 +4235,11 @@ false posixrules 3 standard public schema 1 - 866 - 866 - 866 + 1070 + 1070 + 1070 3 - 2025-11-03.05:32:46 + 2025-11-04.02:08:09 2200 524 pg_database_owner @@ -4298,7 +4298,97 @@ false posixrules bigint|0s postgres - + + 2 + 16641 + 1 + 1 + 915 + bigint|0s + postgres + + + 2 + 16729 + 1 + 1 + 932 + bigint|0s + postgres + + + 2 + 16753 + 1 + 1 + 960 + bigint|0s + postgres + + + 2 + 16737 + 1 + 1 + 941 + bigint|0s + postgres + + + 2 + 16681 + 1 + 1 + 915 + bigint|0s + postgres + + + 2 + 16649 + 1 + 1 + 915 + bigint|0s + postgres + + + 2 + 16665 + 1 + 1 + 915 + bigint|0s + postgres + + + 2 + 16769 + 1 + 1 + 970 + bigint|0s + postgres + + + 2 + 16761 + 1 + 1 + 970 + bigint|0s + postgres + + + 2 + 16673 + 1 + 1 + 915 + bigint|0s + postgres + + 2 16497 1 @@ -4307,7 +4397,7 @@ false posixrules integer|0s postgres - + 2 16397 1 @@ -4316,7 +4406,7 @@ false posixrules integer|0s postgres - + 2 16389 1 @@ -4325,173 +4415,179 @@ false posixrules bigint|0s postgres - + 2 - 16588 + 16781 1 1 - 807 + 982 bigint|0s postgres - + 2 - 16596 + 16715 1 1 - 856 + 928 bigint|0s postgres - - 2 - 16543 - 1 - 1 - 773 - bigint|0s - postgres - - - 2 - 16535 - 1 - 1 - 773 - bigint|0s - postgres - - - 2 - 16566 - 1 - 1 - 799 - bigint|0s - postgres - - - 2 - 16557 - 1 - 1 - 792 - bigint|0s - postgres - - +
2164127452postgres
- +
2164207452postgres
- +
2164067452postgres
- +
2164267582postgres
- +
2164347452postgres
- +
2164407452postgres
- +
+ 2 + 16642 + 915 + 2 + postgres +
+ + 2 + 16730 + 932 + 2 + postgres +
+ + 2 + 16754 + 960 + 2 + postgres +
+ + 2 + 16738 + 956 + 2 + postgres +
+ + 2 + 16682 + 1055 + 2 + postgres +
+ + 2 + 16650 + 915 + 2 + postgres +
+ + 2 + 16666 + 915 + 2 + postgres +
+ + 2 + 16770 + 970 + 2 + postgres +
+ + 2 + 16762 + 970 + 2 + postgres +
+ + 2 + 16674 + 982 + 2 + postgres +
+ 2164987472postgres
- +
2163987452postgres
- +
2163907432postgres
- +
2165267632postgres
- +
2 - 16589 - 807 + 16782 + 10072postgres
- +
2 - 16597 - 856 + 16716 + 9282postgres
- - 2 - 16544 - 805 - 2 - postgres -
- - 2 - 16536 - 816 - 2 - postgres -
- - 2 - 16567 - 805 - 2 - postgres -
- - 2 - 16558 - 805 - 2 - postgres -
- + by-default 1 1 @@ -4500,14 +4596,14 @@ false posixrules 16411 23 - + 1 2 760 varchar(150)|0s 1043 - + id 1 16415 @@ -4516,7 +4612,7 @@ false posixrules 1 403 - + name 1 16523 @@ -4527,7 +4623,7 @@ false posixrules 100 pg_catalog - + name 16525 760 @@ -4539,20 +4635,20 @@ false posixrules 100 pg_catalog - + 1 16416 1 745 16415 - + 1 16524 760 16523 - + by-default 1 1 @@ -4561,21 +4657,21 @@ false posixrules 16419 20 - + 1 2 745 integer|0s 23 - + 1 3 745 integer|0s 23 - + group_id 1 1 @@ -4584,7 +4680,7 @@ false posixrules 1 16412 - + permission_id 1 1 @@ -4593,7 +4689,7 @@ false posixrules 1 16406 - + id 1 16423 @@ -4602,7 +4698,7 @@ false posixrules 1 403 - + group_id permission_id 16454 @@ -4610,31 +4706,31 @@ permission_id 1 403 - + group_id 16466 745 403 - + permission_id 16467 745 403 - + 1 16424 1 745 16423 - + 16455 745 16454 - + by-default 1 1 @@ -4643,28 +4739,28 @@ permission_id 16405 23 - + 1 2 752 varchar(255)|0s 1043 - + 1 3 745 integer|0s 23 - + 1 4 745 varchar(100)|0s 1043 - + content_type_id 1 1 @@ -4673,7 +4769,7 @@ permission_id 1 16398 - + id 1 16409 @@ -4682,7 +4778,7 @@ permission_id 1 403 - + content_type_id codename 16445 @@ -4696,25 +4792,25 @@ pg_catalog default - + content_type_id 16452 745 403 - + 1 16410 1 745 16409 - + 16446 745 16445 - + by-default 1 1 @@ -4723,76 +4819,76 @@ default 16425 23 - + 1 2 745 varchar(128)|0s 1043 - + 3 755 timestamp with time zone|0s 1184 - + 1 4 745 boolean|0s 16 - + 1 5 758 varchar(150)|0s 1043 - + 1 6 762 varchar(150)|0s 1043 - + 1 7 759 varchar(150)|0s 1043 - + 1 8 753 varchar(254)|0s 1043 - + 1 9 745 boolean|0s 16 - + 1 10 745 boolean|0s 16 - + 1 11 745 timestamp with time zone|0s 1184 - + id 1 16429 @@ -4801,7 +4897,7 @@ default 1 403 - + username 1 16518 @@ -4812,7 +4908,7 @@ default 100 pg_catalog - + username 16520 758 @@ -4824,20 +4920,20 @@ default 100 pg_catalog - + 1 16430 1 745 16429 - + 1 16519 758 16518 - + by-default 1 1 @@ -4846,21 +4942,21 @@ default 16433 20 - + 1 2 745 integer|0s 23 - + 1 3 745 integer|0s 23 - + user_id 1 1 @@ -4869,7 +4965,7 @@ default 1 16426 - + group_id 1 1 @@ -4878,7 +4974,7 @@ default 1 16412 - + id 1 16437 @@ -4887,7 +4983,7 @@ default 1 403 - + user_id group_id 16469 @@ -4895,31 +4991,31 @@ group_id 1 403 - + user_id 16481 745 403 - + group_id 16482 745 403 - + 1 16438 1 745 16437 - + 16470 745 16469 - + by-default 1 1 @@ -4928,21 +5024,21 @@ group_id 16439 20 - + 1 2 745 integer|0s 23 - + 1 3 745 integer|0s 23 - + user_id 1 1 @@ -4951,7 +5047,7 @@ group_id 1 16426 - + permission_id 1 1 @@ -4960,7 +5056,7 @@ group_id 1 16406 - + id 1 16443 @@ -4969,7 +5065,7 @@ group_id 1 403 - + user_id permission_id 16483 @@ -4977,37 +5073,838 @@ permission_id 1 403 - + user_id 16495 745 403 - + permission_id 16496 745 403 - + 1 16444 1 745 16443 - + 16484 745 16483 - + + 1 + 1 + 915 + timestamp with time zone|0s + 1184 + + + 1 + 2 + 915 + timestamp with time zone|0s + 1184 + + + by-default + 1 + 3 + 915 + bigint|0s + 16641 + 20 + + + 1 + 4 + 915 + varchar(100)|0s + 1043 + + + 1 + 5 + 915 + varchar(50)|0s + 1043 + + + 6 + 915 + text|0s + 25 + + + 7 + 915 + varchar(100)|0s + 1043 + + + id + 1 + 16647 + 1 + 915 + 1 + 403 + + + 1 + 16648 + 1 + 915 + 16647 + + + 1 + 1 + 932 + timestamp with time zone|0s + 1184 + + + 1 + 2 + 932 + timestamp with time zone|0s + 1184 + + + by-default + 1 + 3 + 932 + bigint|0s + 16729 + 20 + + + 1 + 4 + 932 + varchar(100)|0s + 1043 + + + 5 + 932 + varchar(100)|0s + 1043 + + + 6 + 932 + varchar(254)|0s + 1043 + + + 1 + 7 + 939 + varchar(20)|0s + 1043 + + + 8 + 936 + varchar|0s + 1043 + + + 9 + 932 + text|0s + 25 + + + id + 1 + 16735 + 1 + 932 + 1 + 403 + + + 1 + 16736 + 1 + 932 + 16735 + + + 1 + 1 + 960 + timestamp with time zone|0s + 1184 + + + 1 + 2 + 960 + timestamp with time zone|0s + 1184 + + + by-default + 1 + 3 + 960 + bigint|0s + 16753 + 20 + + + 1 + 4 + 960 + varchar(100)|0s + 1043 + + + 1 + 5 + 960 + varchar(20)|0s + 1043 + + + 1 + 6 + 960 + varchar(20)|0s + 1043 + + + 7 + 960 + date|0s + 1082 + + + 8 + 960 + date|0s + 1082 + + + 1 + 9 + 960 + boolean|0s + 16 + + + 10 + 960 + text|0s + 25 + + + id + 1 + 16759 + 1 + 960 + 1 + 403 + + + 1 + 16760 + 1 + 960 + 16759 + + + 1 + 1 + 941 + timestamp with time zone|0s + 1184 + + + 1 + 2 + 941 + timestamp with time zone|0s + 1184 + + + by-default + 1 + 3 + 941 + bigint|0s + 16737 + 20 + + + 1 + 4 + 941 + varchar(100)|0s + 1043 + + + 1 + 5 + 941 + varchar(20)|0s + 1043 + + + 6 + 941 + varchar(20)|0s + 1043 + + + 7 + 941 + varchar(100)|0s + 1043 + + + 10 + 941 + text|0s + 25 + + + 1 + 11 + 941 + varchar(20)|0s + 1043 + + + 12 + 956 + integer|0s + 23 + + + sys_user_id + 1 + 1 + 16748 + 956 + 1 + 16426 + + + id + 1 + 16743 + 1 + 941 + 1 + 403 + + + sys_user_id + 1 + 16746 + 956 + 1 + 403 + + + 1 + 16744 + 1 + 941 + 16743 + + + 1 + 16747 + 956 + 16746 + + + 1 + 1 + 915 + timestamp with time zone|0s + 1184 + + + 1 + 2 + 915 + timestamp with time zone|0s + 1184 + + + by-default + 1 + 3 + 915 + bigint|0s + 16681 + 20 + + + 1 + 4 + 915 + varchar(100)|0s + 1043 + + + 1 + 5 + 915 + varchar(100)|0s + 1043 + + + 6 + 915 + varchar(50)|0s + 1043 + + + 7 + 915 + numeric(10,2 digit)|0s + 1700 + + + 9 + 915 + varchar(100)|0s + 1043 + + + 10 + 915 + text|0s + 25 + + + 1 + 11 + 915 + bigint|0s + 20 + + + 15 + 1012 + numeric(10,4 digit)|0s + 1700 + + + 16 + 1055 + numeric(10,2 digit)|0s + 1700 + + + 17 + 1055 + numeric(10,2 digit)|0s + 1700 + + + category_id + 1 + 1 + 16697 + 915 + 3 + 16650 + + + id + 1 + 16687 + 1 + 915 + 1 + 403 + + + category_id + 16707 + 915 + 403 + + + 1 + 16688 + 1 + 915 + 16687 + + + 1 + 1 + 915 + timestamp with time zone|0s + 1184 + + + 1 + 2 + 915 + timestamp with time zone|0s + 1184 + + + by-default + 1 + 3 + 915 + bigint|0s + 16649 + 20 + + + 1 + 4 + 915 + varchar(100)|0s + 1043 + + + 5 + 915 + text|0s + 25 + + + 1 + 6 + 915 + varchar(5)|0s + 1043 + + + id + 1 + 16655 + 1 + 915 + 1 + 403 + + + 1 + 16656 + 1 + 915 + 16655 + + + 1 + 1 + 915 + timestamp with time zone|0s + 1184 + + + 1 + 2 + 915 + timestamp with time zone|0s + 1184 + + + by-default + 1 + 3 + 915 + bigint|0s + 16665 + 20 + + + 1 + 4 + 915 + varchar(100)|0s + 1043 + + + 5 + 915 + varchar(100)|0s + 1043 + + + 6 + 915 + varchar(254)|0s + 1043 + + + 7 + 915 + varchar(20)|0s + 1043 + + + 8 + 915 + text|0s + 25 + + + 9 + 915 + text|0s + 25 + + + id + 1 + 16671 + 1 + 915 + 1 + 403 + + + 1 + 16672 + 1 + 915 + 16671 + + + 1 + 1 + 970 + timestamp with time zone|0s + 1184 + + + 1 + 2 + 970 + timestamp with time zone|0s + 1184 + + + by-default + 1 + 3 + 970 + bigint|0s + 16769 + 20 + + + 1 + 4 + 970 + varchar(100)|0s + 1043 + + + 5 + 970 + varchar(20)|0s + 1043 + + + 6 + 970 + varchar(20)|0s + 1043 + + + 1 + 7 + 970 + date|0s + 1082 + + + 1 + 8 + 970 + bigint|0s + 20 + + + vehicle_type_id + 1 + 1 + 16775 + 970 + 3 + 16762 + + + id + 1 + 16773 + 1 + 970 + 1 + 403 + + + vehicle_type_id + 16780 + 970 + 403 + + + 1 + 16774 + 1 + 970 + 16773 + + + 1 + 1 + 970 + timestamp with time zone|0s + 1184 + + + 1 + 2 + 970 + timestamp with time zone|0s + 1184 + + + by-default + 1 + 3 + 970 + bigint|0s + 16761 + 20 + + + 1 + 4 + 970 + varchar(50)|0s + 1043 + + + 5 + 970 + text|0s + 25 + + + id + 1 + 16767 + 1 + 970 + 1 + 403 + + + 1 + 16768 + 1 + 970 + 16767 + + + 1 + 1 + 915 + timestamp with time zone|0s + 1184 + + + 1 + 2 + 915 + timestamp with time zone|0s + 1184 + + + by-default + 1 + 3 + 915 + bigint|0s + 16673 + 20 + + + 1 + 4 + 915 + varchar(100)|0s + 1043 + + + 5 + 915 + varchar(200)|0s + 1043 + + + 6 + 915 + varchar(100)|0s + 1043 + + + 7 + 915 + varchar(20)|0s + 1043 + + + 8 + 915 + varchar(100)|0s + 1043 + + + 9 + 915 + text|0s + 25 + + + id + 1 + 16679 + 1 + 915 + 1 + 403 + + + 1 + 16680 + 1 + 915 + 16679 + + action_flag 16501 action_flag >= 0 747 - + by-default 1 1 @@ -5016,54 +5913,54 @@ permission_id 16497 23 - + 1 2 747 timestamp with time zone|0s 1184 - + 3 747 text|0s 25 - + 1 4 747 varchar(200)|0s 1043 - + 1 5 747 smallint|0s 21 - + 1 6 747 text|0s 25 - + 7 747 integer|0s 23 - + 1 8 747 integer|0s 23 - + content_type_id 1 1 @@ -5072,7 +5969,7 @@ permission_id 1 16398 - + user_id 1 1 @@ -5081,7 +5978,7 @@ permission_id 1 16426 - + id 1 16504 @@ -5090,26 +5987,26 @@ permission_id 1 403 - + content_type_id 16516 747 403 - + user_id 16517 747 403 - + 1 16505 1 747 16504 - + by-default 1 1 @@ -5118,21 +6015,21 @@ permission_id 16397 23 - + 1 3 744 varchar(100)|0s 1043 - + 1 4 744 varchar(100)|0s 1043 - + id 1 16401 @@ -5141,7 +6038,7 @@ permission_id 1 403 - + app_label model 16403 @@ -5155,19 +6052,19 @@ default pg_catalog pg_catalog - + 1 16402 1 744 16401 - + 16404 744 16403 - + by-default 1 1 @@ -5176,28 +6073,28 @@ pg_catalog 16389 20 - + 1 2 743 varchar(255)|0s 1043 - + 1 3 743 varchar(255)|0s 1043 - + 1 4 743 timestamp with time zone|0s 1184 - + id 1 16395 @@ -5206,35 +6103,35 @@ pg_catalog 1 403 - + 1 16396 1 743 16395 - + 1 1 763 varchar(40)|0s 1043 - + 1 2 763 text|0s 25 - + 1 3 763 timestamp with time zone|0s 1184 - + session_key 1 16531 @@ -5246,7 +6143,7 @@ pg_catalog 100 pg_catalog - + session_key 16533 763 @@ -5258,463 +6155,213 @@ pg_catalog 100 pg_catalog - + expire_date 16534 763 403 - + 1 16532 1 763 16531 - + 1 1 - 807 + 982 timestamp with time zone|0s 1184 - + 1 2 - 807 + 982 timestamp with time zone|0s 1184 - + by-default 1 3 - 807 + 982 bigint|0s - 16588 + 16781 20 - + 1 4 - 807 + 982 + integer|0s + 23 + + + 5 + 982 + integer|0s + 23 + + + 6 + 982 varchar(100)|0s 1043 - - 1 - 5 - 807 - varchar(50)|0s - 1043 - - - 6 - 807 + + 7 + 982 text|0s 25 - - 7 - 807 - varchar(100)|0s - 1043 - - - id - 1 - 16594 - 1 - 807 - 1 - 403 - - - 1 - 16595 - 1 - 807 - 16594 - - + 1 - 1 - 856 - timestamp with time zone|0s - 1184 - - - 1 - 2 - 856 - timestamp with time zone|0s - 1184 - - - by-default - 1 - 3 - 856 - bigint|0s - 16596 - 20 - - - 1 - 4 - 856 - varchar(20)|0s - 1043 - - - 5 - 856 - text|0s - 25 - - - id - 1 - 16602 - 1 - 856 - 1 - 403 - - - 1 - 16603 - 1 - 856 - 16602 - - - by-default - 1 - 1 - 773 - bigint|0s - 16543 - 20 - - - 1 - 2 - 773 - varchar(100)|0s - 1043 - - - 1 - 3 - 773 - varchar(100)|0s - 1043 - - - 4 - 773 - varchar(50)|0s - 1043 - - - 5 - 773 - numeric(10,2 digit)|0s - 1700 - - - 6 - 852 - numeric(10,2 digit)|0s - 1700 - - - 7 - 773 - varchar(100)|0s - 1043 - - 8 - 773 - text|0s - 25 + 982 + bigint|0s + 20 - - 1 - 9 - 773 - varchar(20)|0s - 1043 - - + 1 10 - 773 + 982 bigint|0s 20 - - 1 + 11 - 805 - timestamp with time zone|0s - 1184 + 1007 + integer|0s + 23 - - 1 - 12 - 805 - timestamp with time zone|0s - 1184 - - - category_id + + product_id 1 1 - 16551 - 773 - 1 - 16536 + 16789 + 982 + 3 + 16682 - + + warehouse_id + 1 + 1 + 16799 + 982 + 3 + 16674 + + id 1 - 16549 + 16787 1 - 773 + 982 1 403 - - category_id - 16556 - 773 + + product_id + 16804 + 982 403 - + + warehouse_id + 16806 + 982 + 403 + + 1 - 16550 + 16788 1 - 773 - 16549 + 982 + 16787 - - by-default + 1 1 - 773 - bigint|0s - 16535 - 20 + 928 + timestamp with time zone|0s + 1184 - + 1 2 - 773 - varchar(100)|0s - 1043 + 928 + timestamp with time zone|0s + 1184 - + + by-default + 1 3 - 773 - text|0s - 25 + 928 + bigint|0s + 16715 + 20 - + 1 4 - 805 - timestamp with time zone|0s - 1184 - - - 1 - 5 - 805 - timestamp with time zone|0s - 1184 - - - 1 - 6 - 832 - varchar(5)|0s - 1043 - - - id - 1 - 16541 - 1 - 773 - 1 - 403 - - - 1 - 16542 - 1 - 773 - 16541 - - - by-default - 1 - 1 - 799 - bigint|0s - 16566 - 20 - - - 1 - 2 - 799 + 928 date|0s 1082 - + 1 - 3 - 799 + 5 + 928 numeric(15,2 digit)|0s 1700 - - 4 - 799 + + 6 + 928 text|0s 25 - + 1 - 5 - 799 + 7 + 928 bigint|0s 20 - - 1 - 6 - 805 - timestamp with time zone|0s - 1184 - - - 1 - 7 - 805 - timestamp with time zone|0s - 1184 - - + supplier_id 1 1 - 16574 - 799 - 1 - 16558 + 16723 + 928 + 3 + 16666 - + id 1 - 16572 + 16721 1 - 799 + 928 1 403 - + supplier_id - 16579 - 799 + 16728 + 928 403 - + 1 - 16573 + 16722 1 - 799 - 16572 - - - by-default - 1 - 1 - 792 - bigint|0s - 16557 - 20 - - - 1 - 2 - 792 - varchar(100)|0s - 1043 - - - 3 - 792 - varchar(100)|0s - 1043 - - - 4 - 792 - varchar(254)|0s - 1043 - - - 5 - 792 - varchar(20)|0s - 1043 - - - 6 - 792 - text|0s - 25 - - - 7 - 792 - text|0s - 25 - - - 1 - 8 - 805 - timestamp with time zone|0s - 1184 - - - 1 - 9 - 805 - timestamp with time zone|0s - 1184 - - - id - 1 - 16563 - 1 - 792 - 1 - 403 - - - 1 - 16564 - 1 - 792 - 16563 + 928 + 16721
\ No newline at end of file diff --git a/.idea/dataSources/15dcd0e2-d09f-417a-adb8-9c908c90dd7e/storage_v2/_src_/database/myapp.9Xw4Bg/schema/public.abK9xQ.meta b/.idea/dataSources/15dcd0e2-d09f-417a-adb8-9c908c90dd7e/storage_v2/_src_/database/myapp.9Xw4Bg/schema/public.abK9xQ.meta index 63df8e1..ed8a050 100644 --- a/.idea/dataSources/15dcd0e2-d09f-417a-adb8-9c908c90dd7e/storage_v2/_src_/database/myapp.9Xw4Bg/schema/public.abK9xQ.meta +++ b/.idea/dataSources/15dcd0e2-d09f-417a-adb8-9c908c90dd7e/storage_v2/_src_/database/myapp.9Xw4Bg/schema/public.abK9xQ.meta @@ -1,2 +1,2 @@ #n:public -! [866, 0, null, null, -2147483648, -2147483648] +! [1070, 0, null, null, -2147483648, -2147483648] diff --git a/.idea/db-forest-config.xml b/.idea/db-forest-config.xml new file mode 100644 index 0000000..454b8f6 --- /dev/null +++ b/.idea/db-forest-config.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/forwardedPorts.xml b/.idea/forwardedPorts.xml new file mode 100644 index 0000000..034e067 --- /dev/null +++ b/.idea/forwardedPorts.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/basic_info/migrations/0016_product_unit.py b/basic_info/migrations/0016_product_unit.py new file mode 100644 index 0000000..1cdfef7 --- /dev/null +++ b/basic_info/migrations/0016_product_unit.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.7 on 2025-11-04 02:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('basic_info', '0015_remove_product_single_price_product_single_price_in_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='product', + name='unit', + field=models.IntegerField(choices=[(1, '米'), (2, '码'), (3, '公斤')], default=1, verbose_name='单位'), + ), + ] diff --git a/basic_info/migrations/0017_product_image.py b/basic_info/migrations/0017_product_image.py new file mode 100644 index 0000000..b269168 --- /dev/null +++ b/basic_info/migrations/0017_product_image.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.7 on 2025-11-04 05:07 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('basic_info', '0016_product_unit'), + ] + + operations = [ + migrations.AddField( + model_name='product', + name='image', + field=models.ImageField(blank=True, null=True, upload_to='product_images/', verbose_name='产品图片'), + ), + ] diff --git a/basic_info/models.py b/basic_info/models.py index 41c6c4a..0feb0a3 100644 --- a/basic_info/models.py +++ b/basic_info/models.py @@ -117,8 +117,19 @@ class Product(ModelBase): blank=True, null=True, ) + unit = models.IntegerField( + choices=ProductUnitEnum.choices, + default=ProductUnitEnum.METER, + verbose_name='单位', + ) spec = models.CharField(max_length=100, blank=True, null=True, verbose_name='规格') description = models.TextField(blank=True, null=True, verbose_name='备注描述') + image = models.ImageField( + upload_to='product_images/', + blank=True, + null=True, + verbose_name='产品图片', + ) transform_rate = models.DecimalField( max_digits=10, decimal_places=4, diff --git a/flower/qiniu_patch.py b/flower/qiniu_patch.py new file mode 100644 index 0000000..f1649b2 --- /dev/null +++ b/flower/qiniu_patch.py @@ -0,0 +1,128 @@ +""" +七牛云 SDK 兼容性补丁 +修复 qiniu SDK 中 FormUploader 对空数据的判断问题 +""" + + +def patch_qiniu_form_uploader(): + """ + 修复 qiniu.services.storage.uploaders.form_uploader.FormUploader.upload 方法 + + 问题:原方法使用 `if not data` 来判断是否提供了 data 参数, + 但空字节串 b'' 在布尔上下文中为 False,导致误判。 + + 解决:Monkey patch 修改方法内部的检查逻辑。 + """ + try: + import types + from qiniu.services.storage.uploaders import form_uploader + from qiniu.services.storage.uploaders.form_uploader import FormUploader + + # 获取原始方法的代码 + original_upload = FormUploader.upload + original_code = original_upload.__code__ + + # 创建一个包装器来修复参数检查 + def upload_wrapper( + self, + key, + file_path=None, + data=None, + data_size=None, + modify_time=None, + part_size=None, + mime_type=None, + metadata=None, + file_name=None, + custom_vars=None, + **kwargs + ): + """包装原始 upload 方法,修复空数据检查问题""" + from io import BytesIO + from os import path + from time import time + from qiniu.compat import is_seekable + from qiniu.utils import b, io_crc32 + from qiniu.auth import Auth + + # 复制原始方法的逻辑,但修复检查 + bucket_name = kwargs.get('bucket_name', self.bucket_name) + + up_token = kwargs.get('up_token', None) + if not up_token: + up_token = self.get_up_token(**kwargs) + access_key = self.auth.get_access_key() + else: + access_key, _, _ = Auth.up_token_decode(up_token) + + crc32_int = kwargs.get('crc32_int', None) + + if not file_name and file_path: + file_name = path.basename(file_path) + + # *** 修复:使用 is None 进行检查 *** + if file_path is None and data is None: + raise TypeError('Must provide one of file_path or data.') + if file_path is not None and data is not None: + raise TypeError('Must provide only one of file_path or data.') + + if not modify_time: + if file_path: + modify_time = int(path.getmtime(file_path)) + else: + modify_time = int(time()) + + # 继续执行上传逻辑 + try: + if file_path: + data_size = path.getsize(file_path) + data = open(file_path, 'rb') + elif isinstance(data, bytes): + data_size = len(data) + data = BytesIO(data) + elif isinstance(data, str): + data_size = len(data) + data = BytesIO(b(data)) + + if not crc32_int: + crc32_int = self._FormUploader__get_crc32_int(data) + + fields = self._FormUploader__get_form_fields( + up_token=up_token, + key=key, + crc32_int=crc32_int, + custom_vars=custom_vars, + metadata=metadata + ) + + ret, resp = self._FormUploader__upload_data_with_retrier( + access_key=access_key, + bucket_name=bucket_name, + fields=fields, + file_name=file_name, + data=data, + data_size=data_size, + mime_type=mime_type + ) + finally: + if file_path: + data.close() + + return ret, resp + + # 替换方法 + FormUploader.upload = upload_wrapper + + print("✓ 七牛云 FormUploader 补丁已应用") + return True + + except Exception as e: + print(f"⚠ 应用七牛云补丁时出错: {e}") + import traceback + traceback.print_exc() + return False + + +def apply_all_patches(): + """应用所有第三方库补丁""" + patch_qiniu_form_uploader() diff --git a/flower/settings.py b/flower/settings.py index 9b73261..febd0cf 100644 --- a/flower/settings.py +++ b/flower/settings.py @@ -10,9 +10,21 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/5.2/ref/settings/ """ +# 兼容旧版 django-qiniu-storage +try: + from django.utils.encoding import force_text +except ImportError: + from django.utils.encoding import force_str as force_text + import django.utils.encoding + django.utils.encoding.force_text = force_text + from pathlib import Path from environ import Env +# 应用七牛云 SDK 补丁(必须在导入其他模块之前) +from flower.qiniu_patch import apply_all_patches +apply_all_patches() + env = Env( DEBUG=(bool, False), ) @@ -45,7 +57,7 @@ INSTALLED_APPS = [ 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', - 'django.contrib.staticfiles', + 'django.contrib.staticfiles', # 使用七牛云存储,不需要staticfiles app 'basic_info', 'stock', ] @@ -126,7 +138,30 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/5.2/howto/static-files/ -STATIC_URL = 'static/' +# 七牛云存储配置 +QINIU_ACCESS_KEY = 'IySZff0zEN7jHeDuxj5PrQNMv0qjKoVqBRCuFMzi' +QINIU_SECRET_KEY = 'Mph5XkjUQO3VHFPT1JulYHY442uMOya2bXjbSZp8' +QINIU_BUCKET_NAME = 'yunwenerp' +QINIU_BUCKET_DOMAIN = 't5510mjho.hn-bkt.clouddn.com' +QINIU_SECURE_URL = False + +STORAGES = { + 'default': { + 'BACKEND': 'qiniustorage.backends.QiniuStorage', + }, + 'staticfiles': { + 'BACKEND': 'qiniustorage.backends.QiniuStorage', + }, +} + +DEFAULT_FILE_STORAGE = 'qiniustorage.backends.QiniuStorage' +STATICFILES_STORAGE = 'qiniustorage.backends.QiniuStorage' + +# 静态文件URL(直接从七牛云访问) +STATIC_URL = f'http://{QINIU_BUCKET_DOMAIN}/static/' +STATIC_ROOT = 'static' + +MEDIA_URL = f'http://{QINIU_BUCKET_DOMAIN}/media/' # Default primary key field type # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field diff --git a/pyproject.toml b/pyproject.toml index 32a32fd..9823b72 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,9 @@ dependencies = [ "django-cors>=0.1", "django-environ>=0.12.0", "django-ninja>=1.4.5", + "django-qiniu-storage>=2.3.1", "django-simpleui>=2025.6.24", + "pillow>=12.0.0", ] [dependency-groups] diff --git a/stock/admin.py b/stock/admin.py index c76aca0..43044c4 100644 --- a/stock/admin.py +++ b/stock/admin.py @@ -1,5 +1,6 @@ from django.contrib import admin -from . import models +from django.contrib.admin import action +from . import models, services @admin.register(models.PurchaseOrder) @@ -24,7 +25,82 @@ class InventoryAdmin(admin.ModelAdmin): ) search_fields = ('product__name', 'warehouse__name') list_filter = ('warehouse',) + ordering = ('-updated_at',) @admin.display(description='颜色') def product_color(self, obj): return obj.product.color + + +@admin.register(models.StockSnapshot) +class StockSnapshotAdmin(admin.ModelAdmin): + list_display = ( + 'id', + 'product__name', + 'warehouse__name', + 'delta', + 'quantity_before', + 'quantity_after', + 'stock_change_record', + 'created_at', + ) + search_fields = ('product__name', 'warehouse__name', 'stock_change_record__id') + list_filter = ('stock_change_record__type',) + ordering = ('-created_at', ) + + def has_add_permission(self, request): + # 禁止通过admin界面添加库存快照 + return False + + def has_change_permission(self, request, obj = ...): + # 禁止通过admin界面修改库存快照 + return False + + def has_delete_permission(self, request, obj = ...): + # 禁止通过admin界面删除库存快照 + return False + + def get_readonly_fields(self, request, obj = ...): + # 所有字段均为只读 + return [field.name for field in self.model._meta.fields] + + +@admin.register(models.StockChangeRecord) +class StockChangeRecordAdmin(admin.ModelAdmin): + list_display = ( + 'id', + 'type', + 'product', + 'warehouse', + 'quantity', + 'source_type', + 'source_id', + 'is_finished', + 'finished_at', + 'created_by', + 'created_at', + ) + search_fields = ('product__name', 'warehouse__name', 'source_id') + list_filter = ('type', 'source_type', 'type', 'is_finished', 'created_at') + ordering = ('-created_at', '-updated_at') + readonly_fields = ('created_by', 'is_finished', 'finished_at') + + def save_model(self, request, obj: models.StockChangeRecord, form, change): + if not change: + if obj.is_finished is True: + # Prevent setting is_finished to True on creation + obj.is_finished = False + if not obj.created_by: + # 新建记录时,设置创建人 + obj.created_by = request.user + return super().save_model(request, obj, form, change) + + @action(description='标记选中的库存变动记录为已完成') + def make_selected_stock_changes_completed(self, request, queryset): + if queryset.count() > 1: + self.message_user(request, '一次只能处理一条库存变动记录。', level='error') + return + record = queryset.first() + services.make_stock_change_completed(record) + + actions = [make_selected_stock_changes_completed] \ No newline at end of file diff --git a/stock/migrations/0019_alter_inventory_unique_together.py b/stock/migrations/0019_alter_inventory_unique_together.py new file mode 100644 index 0000000..16d7d70 --- /dev/null +++ b/stock/migrations/0019_alter_inventory_unique_together.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.7 on 2025-11-04 05:18 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('basic_info', '0017_product_image'), + ('stock', '0018_remove_inventory_unit'), + ] + + operations = [ + migrations.AlterUniqueTogether( + name='inventory', + unique_together={('product', 'warehouse')}, + ), + ] diff --git a/stock/migrations/0020_stockchangerecord.py b/stock/migrations/0020_stockchangerecord.py new file mode 100644 index 0000000..5387842 --- /dev/null +++ b/stock/migrations/0020_stockchangerecord.py @@ -0,0 +1,28 @@ +# Generated by Django 5.2.7 on 2025-11-04 05:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0019_alter_inventory_unique_together'), + ] + + operations = [ + migrations.CreateModel( + name='StockChangeRecord', + fields=[ + ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')), + ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')), + ('id', models.BigAutoField(primary_key=True, serialize=False)), + ('type', models.IntegerField(choices=[(1, '入库'), (2, '出库')], verbose_name='变动类型')), + ('source_type', models.IntegerField(choices=[(1, '采购'), (2, '销退'), (3, '调入'), (4, '盘盈'), (5, '销售'), (6, '采购退货'), (7, '调出'), (8, '盘亏')], verbose_name='变动来源')), + ('remarks', models.TextField(blank=True, null=True, verbose_name='备注')), + ], + options={ + 'verbose_name': '出入库记录', + 'verbose_name_plural': '出入库记录', + }, + ), + ] diff --git a/stock/migrations/0021_stockchangerecord_is_finished_and_more.py b/stock/migrations/0021_stockchangerecord_is_finished_and_more.py new file mode 100644 index 0000000..f582a30 --- /dev/null +++ b/stock/migrations/0021_stockchangerecord_is_finished_and_more.py @@ -0,0 +1,37 @@ +# Generated by Django 5.2.7 on 2025-11-04 05:57 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('basic_info', '0017_product_image'), + ('stock', '0020_stockchangerecord'), + ] + + operations = [ + migrations.AddField( + model_name='stockchangerecord', + name='is_finished', + field=models.BooleanField(default=False, verbose_name='完成出入库'), + ), + migrations.AddField( + model_name='stockchangerecord', + name='product', + field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.PROTECT, related_name='stock_change_records', to='basic_info.product', verbose_name='产品'), + preserve_default=False, + ), + migrations.AddField( + model_name='stockchangerecord', + name='source_id', + field=models.BigIntegerField(blank=True, null=True, verbose_name='来源单据ID'), + ), + migrations.AddField( + model_name='stockchangerecord', + name='warehouse', + field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.PROTECT, related_name='stock_change_records', to='basic_info.warehouse', verbose_name='仓库'), + preserve_default=False, + ), + ] diff --git a/stock/migrations/0022_stockchangerecord_quantity_stockchangerecord_unit.py b/stock/migrations/0022_stockchangerecord_quantity_stockchangerecord_unit.py new file mode 100644 index 0000000..8fb9521 --- /dev/null +++ b/stock/migrations/0022_stockchangerecord_quantity_stockchangerecord_unit.py @@ -0,0 +1,25 @@ +# Generated by Django 5.2.7 on 2025-11-04 06:05 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0021_stockchangerecord_is_finished_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='stockchangerecord', + name='quantity', + field=models.IntegerField(default=1, verbose_name='数量'), + preserve_default=False, + ), + migrations.AddField( + model_name='stockchangerecord', + name='unit', + field=models.IntegerField(choices=[(1, '米'), (2, '码'), (3, '公斤')], default=1, verbose_name='单位'), + preserve_default=False, + ), + ] diff --git a/stock/migrations/0023_stockchangerecord_num_of_rolls.py b/stock/migrations/0023_stockchangerecord_num_of_rolls.py new file mode 100644 index 0000000..1dde35d --- /dev/null +++ b/stock/migrations/0023_stockchangerecord_num_of_rolls.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.7 on 2025-11-04 06:21 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0022_stockchangerecord_quantity_stockchangerecord_unit'), + ] + + operations = [ + migrations.AddField( + model_name='stockchangerecord', + name='num_of_rolls', + field=models.IntegerField(blank=True, null=True, verbose_name='匹数'), + ), + ] diff --git a/stock/migrations/0024_stockchangerecord_created_by.py b/stock/migrations/0024_stockchangerecord_created_by.py new file mode 100644 index 0000000..f93ce40 --- /dev/null +++ b/stock/migrations/0024_stockchangerecord_created_by.py @@ -0,0 +1,21 @@ +# Generated by Django 5.2.7 on 2025-11-04 06:35 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0023_stockchangerecord_num_of_rolls'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.AddField( + model_name='stockchangerecord', + name='created_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='创建人'), + ), + ] diff --git a/stock/migrations/0025_alter_stockchangerecord_created_by.py b/stock/migrations/0025_alter_stockchangerecord_created_by.py new file mode 100644 index 0000000..7fe182e --- /dev/null +++ b/stock/migrations/0025_alter_stockchangerecord_created_by.py @@ -0,0 +1,21 @@ +# Generated by Django 5.2.7 on 2025-11-04 06:35 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0024_stockchangerecord_created_by'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.AlterField( + model_name='stockchangerecord', + name='created_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='操作人'), + ), + ] diff --git a/stock/migrations/0026_stockchangerecord_finished_at.py b/stock/migrations/0026_stockchangerecord_finished_at.py new file mode 100644 index 0000000..fe88503 --- /dev/null +++ b/stock/migrations/0026_stockchangerecord_finished_at.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.7 on 2025-11-04 06:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0025_alter_stockchangerecord_created_by'), + ] + + operations = [ + migrations.AddField( + model_name='stockchangerecord', + name='finished_at', + field=models.DateTimeField(blank=True, null=True, verbose_name='完成时间'), + ), + ] diff --git a/stock/migrations/0027_alter_inventory_num_of_rolls_and_more.py b/stock/migrations/0027_alter_inventory_num_of_rolls_and_more.py new file mode 100644 index 0000000..c2397ae --- /dev/null +++ b/stock/migrations/0027_alter_inventory_num_of_rolls_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 5.2.7 on 2025-11-04 07:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0026_stockchangerecord_finished_at'), + ] + + operations = [ + migrations.AlterField( + model_name='inventory', + name='num_of_rolls', + field=models.IntegerField(default=1, verbose_name='匹数'), + ), + migrations.AlterField( + model_name='stockchangerecord', + name='num_of_rolls', + field=models.IntegerField(default=1, verbose_name='匹数'), + ), + ] diff --git a/stock/migrations/0028_stocksnapshot.py b/stock/migrations/0028_stocksnapshot.py new file mode 100644 index 0000000..adcb732 --- /dev/null +++ b/stock/migrations/0028_stocksnapshot.py @@ -0,0 +1,40 @@ +# Generated by Django 5.2.7 on 2025-11-04 07:53 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('basic_info', '0017_product_image'), + ('stock', '0027_alter_inventory_num_of_rolls_and_more'), + ] + + operations = [ + migrations.CreateModel( + name='StockSnapshot', + fields=[ + ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')), + ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')), + ('id', models.BigAutoField(primary_key=True, serialize=False)), + ('delta', models.IntegerField(verbose_name='库存数量')), + ('quantity_before', models.IntegerField(verbose_name='变动前库存数量')), + ('quantity_after', models.IntegerField(verbose_name='变动后库存数量')), + ('unit', models.IntegerField(choices=[(1, '米'), (2, '码'), (3, '公斤')], verbose_name='单位')), + ('num_of_rolls', models.IntegerField(default=1, verbose_name='匹数')), + ('offset_to', models.BigIntegerField(blank=True, null=True, verbose_name='冲抵目标ID')), + ('offset_at', models.DateTimeField(blank=True, null=True, verbose_name='冲抵时间')), + ('cancelled', models.BooleanField(default=False, verbose_name='已取消')), + ('cancelled_at', models.DateTimeField(blank=True, null=True, verbose_name='取消时间')), + ('offset_id', models.BigIntegerField(blank=True, null=True, verbose_name='冲抵记录ID')), + ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='stock_snapshots', to='basic_info.product', verbose_name='产品')), + ('stock_change_record', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='stock_snapshots', to='stock.stockchangerecord', verbose_name='关联的库存变动记录')), + ('warehouse', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='stock_snapshots', to='basic_info.warehouse', verbose_name='仓库')), + ], + options={ + 'verbose_name': '库存快照', + 'verbose_name_plural': '库存快照', + }, + ), + ] diff --git a/stock/migrations/0029_alter_inventory_quantity_and_more.py b/stock/migrations/0029_alter_inventory_quantity_and_more.py new file mode 100644 index 0000000..bf9f54f --- /dev/null +++ b/stock/migrations/0029_alter_inventory_quantity_and_more.py @@ -0,0 +1,38 @@ +# Generated by Django 5.2.7 on 2025-11-04 08:53 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0028_stocksnapshot'), + ] + + operations = [ + migrations.AlterField( + model_name='inventory', + name='quantity', + field=models.DecimalField(decimal_places=2, max_digits=10, verbose_name='库存数量'), + ), + migrations.AlterField( + model_name='stockchangerecord', + name='quantity', + field=models.DecimalField(decimal_places=2, max_digits=10, verbose_name='数量'), + ), + migrations.AlterField( + model_name='stocksnapshot', + name='delta', + field=models.DecimalField(decimal_places=2, max_digits=10, verbose_name='库存数量'), + ), + migrations.AlterField( + model_name='stocksnapshot', + name='quantity_after', + field=models.DecimalField(decimal_places=2, max_digits=10, verbose_name='变动后库存数量'), + ), + migrations.AlterField( + model_name='stocksnapshot', + name='quantity_before', + field=models.DecimalField(decimal_places=2, max_digits=10, verbose_name='变动前库存数量'), + ), + ] diff --git a/stock/migrations/0030_alter_stocksnapshot_delta.py b/stock/migrations/0030_alter_stocksnapshot_delta.py new file mode 100644 index 0000000..fd01fe5 --- /dev/null +++ b/stock/migrations/0030_alter_stocksnapshot_delta.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.7 on 2025-11-04 09:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0029_alter_inventory_quantity_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='stocksnapshot', + name='delta', + field=models.DecimalField(decimal_places=2, max_digits=10, verbose_name='库存变动数量'), + ), + ] diff --git a/stock/models.py b/stock/models.py index 6a7c8f6..805331b 100644 --- a/stock/models.py +++ b/stock/models.py @@ -1,9 +1,13 @@ from django.db import models +from django.core.exceptions import ValidationError from flower.common import ModelBase from basic_info import models as basic_info_models +import decimal class PurchaseOrder(ModelBase): + """采购单模型""" + id = models.BigAutoField(primary_key=True) supplier = models.ForeignKey(basic_info_models.Supplier, on_delete=models.PROTECT, related_name='purchase_orders', verbose_name='供应商') order_date = models.DateField(verbose_name='订单日期') @@ -18,7 +22,114 @@ class PurchaseOrder(ModelBase): verbose_name_plural = '采购单' +class StockChangeSourceEnum(models.IntegerChoices): + """库存变动来源类型""" + + PURCHASE = 1, '采购' + SALES_RETURN = 2, '销退' + TRANSPORT_IN = 3, '调入' + RECHECK_ADD = 4, '盘盈' + + SALES = 5, '销售' + PURCHASE_RETURN = 6, '采购退货' + TRANSPORT_OUT = 7, '调出' + RECHECK_REMOVE = 8, '盘亏' + + +class StockChangeTypeEnum(models.IntegerChoices): + """库存变动类型""" + + ADD = 1, '入库' + REMOVE = 2, '出库' + + +class StockChangeRecord(ModelBase): + """库存变动记录模型""" + + id = models.BigAutoField(primary_key=True) + type = models.IntegerField(choices=StockChangeTypeEnum.choices, verbose_name='变动类型') + product = models.ForeignKey( + basic_info_models.Product, + on_delete=models.PROTECT, + related_name='stock_change_records', + verbose_name='产品', + ) + warehouse = models.ForeignKey( + basic_info_models.WareHouse, + on_delete=models.PROTECT, + related_name='stock_change_records', + verbose_name='仓库', + ) + source_type = models.IntegerField( + choices=StockChangeSourceEnum.choices, + verbose_name='变动来源', + ) + unit = models.IntegerField( + verbose_name='单位', + choices=basic_info_models.ProductUnitEnum.choices, + ) + num_of_rolls = models.IntegerField( + default=1, + verbose_name='匹数', + ) + created_by = models.ForeignKey( + 'auth.User', + on_delete=models.PROTECT, + null=True, + blank=True, + verbose_name='操作人', + ) + quantity = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='数量') + source_id = models.BigIntegerField(null=True, blank=True, verbose_name='来源单据ID') + is_finished = models.BooleanField(default=False, verbose_name='完成出入库') + finished_at = models.DateTimeField(null=True, blank=True, verbose_name='完成时间') + remarks = models.TextField(blank=True, null=True, verbose_name='备注') + + def __str__(self): + return f'出入库记录 {self.id} - 仓库:{self.warehouse.name} - 产品: {self.product.name}' + + class Meta: + verbose_name = '出入库记录' + verbose_name_plural = '出入库记录' + + def clean(self): + if self.type == StockChangeTypeEnum.ADD: + if self.source_type > 4: + raise ValidationError('入库记录的来源类型无效') + elif self.type == StockChangeTypeEnum.REMOVE: + if self.source_type < 5: + raise ValidationError('出库记录的来源类型无效') + + def save(self, *args, **kwargs): + self.full_clean() + super().save(*args, **kwargs) + + @property + def is_incoming(self) -> bool: + """判断是否为入库记录""" + return self.type == StockChangeTypeEnum.ADD + + @property + def is_outgoing(self) -> bool: + """判断是否为出库记录""" + return self.type == StockChangeTypeEnum.REMOVE + + @property + def delta(self) -> decimal.Decimal: + """计算库存变动的数量增减""" + + # 入库为正,出库为负 + if self.type == StockChangeTypeEnum.ADD: + return self.quantity + elif self.type == StockChangeTypeEnum.REMOVE: + return -self.quantity + else: + raise ValueError("未知的库存变动类型") + + class Inventory(ModelBase): + """库存模型""" + id = models.BigAutoField(primary_key=True) product = models.ForeignKey( basic_info_models.Product, @@ -32,8 +143,8 @@ class Inventory(ModelBase): related_name='inventories', verbose_name='仓库', ) - quantity = models.IntegerField(verbose_name='库存数量') - num_of_rolls = models.IntegerField(null=True, blank=True, verbose_name='匹数') + quantity = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='库存数量') + num_of_rolls = models.IntegerField(default=1, verbose_name='匹数') minimum_quantity = models.IntegerField(null=True, blank=True, verbose_name='最低库存量') spec = models.CharField(max_length=100, blank=True, null=True, verbose_name='规格') description = models.TextField(blank=True, null=True, verbose_name='备注描述') @@ -44,3 +155,70 @@ class Inventory(ModelBase): class Meta: verbose_name = '库存' verbose_name_plural = '库存' + unique_together = ('product', 'warehouse') + + +class StockSnapshot(ModelBase): + """库存变动快照模型""" + + id = models.BigAutoField(primary_key=True) + product = models.ForeignKey( + basic_info_models.Product, + on_delete=models.PROTECT, + related_name='stock_snapshots', + verbose_name='产品', + ) + warehouse = models.ForeignKey( + basic_info_models.WareHouse, + on_delete=models.PROTECT, + related_name='stock_snapshots', + verbose_name='仓库', + ) + delta = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='库存变动数量') + quantity_before = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='变动前库存数量') + quantity_after = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='变动后库存数量') + stock_change_record = models.ForeignKey( + StockChangeRecord, + on_delete=models.PROTECT, + related_name='stock_snapshots', + verbose_name='关联的库存变动记录', + ) + unit = models.IntegerField( + verbose_name='单位', + choices=basic_info_models.ProductUnitEnum.choices, + ) + num_of_rolls = models.IntegerField(default=1, verbose_name='匹数') + + # offset_to表示该快照被冲抵到的目标快照ID + # 当offset_to不为空时,cancelled不可为True 及 offset_id只能为空 + # 因为该记录是冲抵记录无法再取消,也不可能冲抵的同时被冲抵 + offset_to = models.BigIntegerField( + null=True, + blank=True, + verbose_name='冲抵目标ID', + ) + offset_at = models.DateTimeField( + null=True, + blank=True, + verbose_name='冲抵时间', + ) + + # 当cancelled为True时,offset_id不可为空,表示该快照已被冲抵 + cancelled = models.BooleanField(default=False, verbose_name='已取消') + cancelled_at = models.DateTimeField( + null=True, + blank=True, + verbose_name='取消时间', + ) + offset_id = models.BigIntegerField( + null=True, + blank=True, + verbose_name='冲抵记录ID', + ) + + def __str__(self): + return f'库存快照 {self.id} - 日期: {self.snapshot_date} - 产品: {self.product.name}' + + class Meta: + verbose_name = '库存快照' + verbose_name_plural = '库存快照' diff --git a/stock/services.py b/stock/services.py new file mode 100644 index 0000000..767ea4a --- /dev/null +++ b/stock/services.py @@ -0,0 +1,104 @@ +from . import models +from django.utils import timezone +import logging + + +logger = logging.getLogger(__name__) + + +def find_inventory(product_id: int, warehouse_id: int) -> models.Inventory | None: + """根据产品ID和仓库ID查找库存记录""" + + try: + inventory = models.Inventory.objects.get( + product_id=product_id, + warehouse_id=warehouse_id, + ) + return inventory + except models.Inventory.DoesNotExist: + return None + + +def create_stock_snapshot(stock_change_record: models.StockChangeRecord, inventory: models.Inventory) -> models.StockSnapshot: + """创建库存快照记录""" + + if not stock_change_record or stock_change_record.id is None: + raise ValueError("无效的库存变动记录") + + delta = stock_change_record.delta + + # 必须在库存变动发生后创建快照 + snapshot = models.StockSnapshot( + product_id=inventory.product_id, + warehouse_id=inventory.warehouse_id, + delta=delta, + quantity_before=inventory.quantity - delta, + quantity_after=inventory.quantity, + stock_change_record_id=stock_change_record.id, + unit=stock_change_record.unit, + num_of_rolls=stock_change_record.num_of_rolls or 1, + ) + snapshot.save() + logger.info( + f'创建库存快照,库存ID: {inventory.id}, 数量: {inventory.quantity}, ' + f'匹数: {inventory.num_of_rolls}' + ) + return snapshot + + +def make_stock_change_completed(stock_change_record: models.StockChangeRecord) -> bool: + """处理库存变动完成后的逻辑""" + # TODO: 这里可以添加事务处理以确保数据一致性 + + if not stock_change_record or stock_change_record.id is None: + # 无效的库存变动记录 + return False + + if stock_change_record.is_finished: + return True + + inventory_record = find_inventory( + product_id=stock_change_record.product_id, + warehouse_id=stock_change_record.warehouse_id, + ) + + if not inventory_record: + logger.info( + f'库存记录未找到,产品ID: {stock_change_record.product_id}, ' + f'仓库ID: {stock_change_record.warehouse_id},正在创建新的库存记录。' + ) + + # 如果没有找到库存记录且为入库,则创建一个新的库存记录 + + inventory_record = models.Inventory( + product_id=stock_change_record.product_id, + warehouse_id=stock_change_record.warehouse_id, + quantity=stock_change_record.delta, + num_of_rolls=stock_change_record.num_of_rolls or 0, + minimum_quantity=0, + ) + logger.info( + f'创建新的库存记录,产品ID: {inventory_record.product_id}, ' + f'仓库ID: {inventory_record.warehouse_id}, 数量: {inventory_record.quantity},' + f'匹数: {inventory_record.num_of_rolls}' + ) + else: + # 更新现有库存记录 + inventory_record.quantity += stock_change_record.delta + if stock_change_record.num_of_rolls: + inventory_record.num_of_rolls += stock_change_record.num_of_rolls + + logger.info( + f'更新库存记录 {inventory_record.id},新数量: {inventory_record.quantity}, ' + f'新匹数: {inventory_record.num_of_rolls}' + ) + + inventory_record.save() + create_stock_snapshot(stock_change_record, inventory_record) + stock_change_record.is_finished = True + stock_change_record.finished_at = timezone.now() + stock_change_record.save() + logger.info( + f'库存变动记录 {stock_change_record.id} 标记为已完成。' + ) + return True diff --git a/uv.lock b/uv.lock index c966713..7b4afb4 100644 --- a/uv.lock +++ b/uv.lock @@ -20,6 +20,40 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/17/9c/fc2331f538fbf7eedba64b2052e99ccf9ba9d6888e2f41441ee28847004b/asgiref-3.10.0-py3-none-any.whl", hash = "sha256:aef8a81283a34d0ab31630c9b7dfe70c812c95eba78171367ca8745e88124734", size = 24050, upload-time = "2025-10-05T09:15:05.11Z" }, ] +[[package]] +name = "certifi" +version = "2025.10.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/4c/5b/b6ce21586237c77ce67d01dc5507039d444b630dd76611bbca2d8e5dcd91/certifi-2025.10.5.tar.gz", hash = "sha256:47c09d31ccf2acf0be3f701ea53595ee7e0b8fa08801c6624be771df09ae7b43", size = 164519, upload-time = "2025-10-05T04:12:15.808Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e4/37/af0d2ef3967ac0d6113837b44a4f0bfe1328c2b9763bd5b1744520e5cfed/certifi-2025.10.5-py3-none-any.whl", hash = "sha256:0f212c2744a9bb6de0c56639a6f68afe01ecd92d91f14ae897c4fe7bbeeef0de", size = 163286, upload-time = "2025-10-05T04:12:14.03Z" }, +] + +[[package]] +name = "charset-normalizer" +version = "3.4.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/13/69/33ddede1939fdd074bce5434295f38fae7136463422fe4fd3e0e89b98062/charset_normalizer-3.4.4.tar.gz", hash = "sha256:94537985111c35f28720e43603b8e7b43a6ecfb2ce1d3058bbe955b73404e21a", size = 129418, upload-time = "2025-10-14T04:42:32.879Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/35/7051599bd493e62411d6ede36fd5af83a38f37c4767b92884df7301db25d/charset_normalizer-3.4.4-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:da3326d9e65ef63a817ecbcc0df6e94463713b754fe293eaa03da99befb9a5bd", size = 207746, upload-time = "2025-10-14T04:41:33.773Z" }, + { url = "https://files.pythonhosted.org/packages/10/9a/97c8d48ef10d6cd4fcead2415523221624bf58bcf68a802721a6bc807c8f/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8af65f14dc14a79b924524b1e7fffe304517b2bff5a58bf64f30b98bbc5079eb", size = 147889, upload-time = "2025-10-14T04:41:34.897Z" }, + { url = "https://files.pythonhosted.org/packages/10/bf/979224a919a1b606c82bd2c5fa49b5c6d5727aa47b4312bb27b1734f53cd/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:74664978bb272435107de04e36db5a9735e78232b85b77d45cfb38f758efd33e", size = 143641, upload-time = "2025-10-14T04:41:36.116Z" }, + { url = "https://files.pythonhosted.org/packages/ba/33/0ad65587441fc730dc7bd90e9716b30b4702dc7b617e6ba4997dc8651495/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:752944c7ffbfdd10c074dc58ec2d5a8a4cd9493b314d367c14d24c17684ddd14", size = 160779, upload-time = "2025-10-14T04:41:37.229Z" }, + { url = "https://files.pythonhosted.org/packages/67/ed/331d6b249259ee71ddea93f6f2f0a56cfebd46938bde6fcc6f7b9a3d0e09/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d1f13550535ad8cff21b8d757a3257963e951d96e20ec82ab44bc64aeb62a191", size = 159035, upload-time = "2025-10-14T04:41:38.368Z" }, + { url = "https://files.pythonhosted.org/packages/67/ff/f6b948ca32e4f2a4576aa129d8bed61f2e0543bf9f5f2b7fc3758ed005c9/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ecaae4149d99b1c9e7b88bb03e3221956f68fd6d50be2ef061b2381b61d20838", size = 152542, upload-time = "2025-10-14T04:41:39.862Z" }, + { url = "https://files.pythonhosted.org/packages/16/85/276033dcbcc369eb176594de22728541a925b2632f9716428c851b149e83/charset_normalizer-3.4.4-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:cb6254dc36b47a990e59e1068afacdcd02958bdcce30bb50cc1700a8b9d624a6", size = 149524, upload-time = "2025-10-14T04:41:41.319Z" }, + { url = "https://files.pythonhosted.org/packages/9e/f2/6a2a1f722b6aba37050e626530a46a68f74e63683947a8acff92569f979a/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c8ae8a0f02f57a6e61203a31428fa1d677cbe50c93622b4149d5c0f319c1d19e", size = 150395, upload-time = "2025-10-14T04:41:42.539Z" }, + { url = "https://files.pythonhosted.org/packages/60/bb/2186cb2f2bbaea6338cad15ce23a67f9b0672929744381e28b0592676824/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:47cc91b2f4dd2833fddaedd2893006b0106129d4b94fdb6af1f4ce5a9965577c", size = 143680, upload-time = "2025-10-14T04:41:43.661Z" }, + { url = "https://files.pythonhosted.org/packages/7d/a5/bf6f13b772fbb2a90360eb620d52ed8f796f3c5caee8398c3b2eb7b1c60d/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:82004af6c302b5d3ab2cfc4cc5f29db16123b1a8417f2e25f9066f91d4411090", size = 162045, upload-time = "2025-10-14T04:41:44.821Z" }, + { url = "https://files.pythonhosted.org/packages/df/c5/d1be898bf0dc3ef9030c3825e5d3b83f2c528d207d246cbabe245966808d/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:2b7d8f6c26245217bd2ad053761201e9f9680f8ce52f0fcd8d0755aeae5b2152", size = 149687, upload-time = "2025-10-14T04:41:46.442Z" }, + { url = "https://files.pythonhosted.org/packages/a5/42/90c1f7b9341eef50c8a1cb3f098ac43b0508413f33affd762855f67a410e/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:799a7a5e4fb2d5898c60b640fd4981d6a25f1c11790935a44ce38c54e985f828", size = 160014, upload-time = "2025-10-14T04:41:47.631Z" }, + { url = "https://files.pythonhosted.org/packages/76/be/4d3ee471e8145d12795ab655ece37baed0929462a86e72372fd25859047c/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:99ae2cffebb06e6c22bdc25801d7b30f503cc87dbd283479e7b606f70aff57ec", size = 154044, upload-time = "2025-10-14T04:41:48.81Z" }, + { url = "https://files.pythonhosted.org/packages/b0/6f/8f7af07237c34a1defe7defc565a9bc1807762f672c0fde711a4b22bf9c0/charset_normalizer-3.4.4-cp314-cp314-win32.whl", hash = "sha256:f9d332f8c2a2fcbffe1378594431458ddbef721c1769d78e2cbc06280d8155f9", size = 99940, upload-time = "2025-10-14T04:41:49.946Z" }, + { url = "https://files.pythonhosted.org/packages/4b/51/8ade005e5ca5b0d80fb4aff72a3775b325bdc3d27408c8113811a7cbe640/charset_normalizer-3.4.4-cp314-cp314-win_amd64.whl", hash = "sha256:8a6562c3700cce886c5be75ade4a5db4214fda19fede41d9792d100288d8f94c", size = 107104, upload-time = "2025-10-14T04:41:51.051Z" }, + { url = "https://files.pythonhosted.org/packages/da/5f/6b8f83a55bb8278772c5ae54a577f3099025f9ade59d0136ac24a0df4bde/charset_normalizer-3.4.4-cp314-cp314-win_arm64.whl", hash = "sha256:de00632ca48df9daf77a2c65a484531649261ec9f25489917f09e455cb09ddb2", size = 100743, upload-time = "2025-10-14T04:41:52.122Z" }, + { url = "https://files.pythonhosted.org/packages/0a/4c/925909008ed5a988ccbb72dcc897407e5d6d3bd72410d69e051fc0c14647/charset_normalizer-3.4.4-py3-none-any.whl", hash = "sha256:7a32c560861a02ff789ad905a2fe94e3f840803362c84fecf1851cb4cf3dc37f", size = 53402, upload-time = "2025-10-14T04:42:31.76Z" }, +] + [[package]] name = "django" version = "5.2.7" @@ -62,6 +96,17 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/49/e3/168274a8def4b9a2fb2540319a68914e8e4e529cd7f7b5f1ba8939d011bc/django_ninja-1.4.5-py3-none-any.whl", hash = "sha256:d779702ddc6e17b10739049ddb075a6a1e6c6270bdc04e0b0429f6adbf670373", size = 2426449, upload-time = "2025-10-19T18:28:00.518Z" }, ] +[[package]] +name = "django-qiniu-storage" +version = "2.3.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "qiniu" }, + { name = "requests" }, + { name = "six" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/bc/c0/a15b85a9f8bcfb951c0285adffc1cd3028f351216e1ceef957f05d2bffa5/django-qiniu-storage-2.3.1.tar.gz", hash = "sha256:26512584058636f24c69599da9770a4c52a508e8e5eb1de275287af4030926fe", size = 7421, upload-time = "2017-07-18T12:10:13.568Z" } + [[package]] name = "django-simpleui" version = "2025.6.24" @@ -80,7 +125,9 @@ dependencies = [ { name = "django-cors" }, { name = "django-environ" }, { name = "django-ninja" }, + { name = "django-qiniu-storage" }, { name = "django-simpleui" }, + { name = "pillow" }, ] [package.dev-dependencies] @@ -94,12 +141,56 @@ requires-dist = [ { name = "django-cors", specifier = ">=0.1" }, { name = "django-environ", specifier = ">=0.12.0" }, { name = "django-ninja", specifier = ">=1.4.5" }, + { name = "django-qiniu-storage", specifier = ">=2.3.1" }, { name = "django-simpleui", specifier = ">=2025.6.24" }, + { name = "pillow", specifier = ">=12.0.0" }, ] [package.metadata.requires-dev] dev = [{ name = "psycopg", extras = ["binary"], specifier = ">=3.2.12" }] +[[package]] +name = "idna" +version = "3.11" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902", size = 194582, upload-time = "2025-10-12T14:55:20.501Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea", size = 71008, upload-time = "2025-10-12T14:55:18.883Z" }, +] + +[[package]] +name = "pillow" +version = "12.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5a/b0/cace85a1b0c9775a9f8f5d5423c8261c858760e2466c79b2dd184638b056/pillow-12.0.0.tar.gz", hash = "sha256:87d4f8125c9988bfbed67af47dd7a953e2fc7b0cc1e7800ec6d2080d490bb353", size = 47008828, upload-time = "2025-10-15T18:24:14.008Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/54/2a/9a8c6ba2c2c07b71bec92cf63e03370ca5e5f5c5b119b742bcc0cde3f9c5/pillow-12.0.0-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:beeae3f27f62308f1ddbcfb0690bf44b10732f2ef43758f169d5e9303165d3f9", size = 4045531, upload-time = "2025-10-15T18:23:10.121Z" }, + { url = "https://files.pythonhosted.org/packages/84/54/836fdbf1bfb3d66a59f0189ff0b9f5f666cee09c6188309300df04ad71fa/pillow-12.0.0-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:d4827615da15cd59784ce39d3388275ec093ae3ee8d7f0c089b76fa87af756c2", size = 4120554, upload-time = "2025-10-15T18:23:12.14Z" }, + { url = "https://files.pythonhosted.org/packages/0d/cd/16aec9f0da4793e98e6b54778a5fbce4f375c6646fe662e80600b8797379/pillow-12.0.0-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:3e42edad50b6909089750e65c91aa09aaf1e0a71310d383f11321b27c224ed8a", size = 3576812, upload-time = "2025-10-15T18:23:13.962Z" }, + { url = "https://files.pythonhosted.org/packages/f6/b7/13957fda356dc46339298b351cae0d327704986337c3c69bb54628c88155/pillow-12.0.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:e5d8efac84c9afcb40914ab49ba063d94f5dbdf5066db4482c66a992f47a3a3b", size = 5252689, upload-time = "2025-10-15T18:23:15.562Z" }, + { url = "https://files.pythonhosted.org/packages/fc/f5/eae31a306341d8f331f43edb2e9122c7661b975433de5e447939ae61c5da/pillow-12.0.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:266cd5f2b63ff316d5a1bba46268e603c9caf5606d44f38c2873c380950576ad", size = 4650186, upload-time = "2025-10-15T18:23:17.379Z" }, + { url = "https://files.pythonhosted.org/packages/86/62/2a88339aa40c4c77e79108facbd307d6091e2c0eb5b8d3cf4977cfca2fe6/pillow-12.0.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:58eea5ebe51504057dd95c5b77d21700b77615ab0243d8152793dc00eb4faf01", size = 6230308, upload-time = "2025-10-15T18:23:18.971Z" }, + { url = "https://files.pythonhosted.org/packages/c7/33/5425a8992bcb32d1cb9fa3dd39a89e613d09a22f2c8083b7bf43c455f760/pillow-12.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f13711b1a5ba512d647a0e4ba79280d3a9a045aaf7e0cc6fbe96b91d4cdf6b0c", size = 8039222, upload-time = "2025-10-15T18:23:20.909Z" }, + { url = "https://files.pythonhosted.org/packages/d8/61/3f5d3b35c5728f37953d3eec5b5f3e77111949523bd2dd7f31a851e50690/pillow-12.0.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6846bd2d116ff42cba6b646edf5bf61d37e5cbd256425fa089fee4ff5c07a99e", size = 6346657, upload-time = "2025-10-15T18:23:23.077Z" }, + { url = "https://files.pythonhosted.org/packages/3a/be/ee90a3d79271227e0f0a33c453531efd6ed14b2e708596ba5dd9be948da3/pillow-12.0.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c98fa880d695de164b4135a52fd2e9cd7b7c90a9d8ac5e9e443a24a95ef9248e", size = 7038482, upload-time = "2025-10-15T18:23:25.005Z" }, + { url = "https://files.pythonhosted.org/packages/44/34/a16b6a4d1ad727de390e9bd9f19f5f669e079e5826ec0f329010ddea492f/pillow-12.0.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:fa3ed2a29a9e9d2d488b4da81dcb54720ac3104a20bf0bd273f1e4648aff5af9", size = 6461416, upload-time = "2025-10-15T18:23:27.009Z" }, + { url = "https://files.pythonhosted.org/packages/b6/39/1aa5850d2ade7d7ba9f54e4e4c17077244ff7a2d9e25998c38a29749eb3f/pillow-12.0.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:d034140032870024e6b9892c692fe2968493790dd57208b2c37e3fb35f6df3ab", size = 7131584, upload-time = "2025-10-15T18:23:29.752Z" }, + { url = "https://files.pythonhosted.org/packages/bf/db/4fae862f8fad0167073a7733973bfa955f47e2cac3dc3e3e6257d10fab4a/pillow-12.0.0-cp314-cp314-win32.whl", hash = "sha256:1b1b133e6e16105f524a8dec491e0586d072948ce15c9b914e41cdadd209052b", size = 6400621, upload-time = "2025-10-15T18:23:32.06Z" }, + { url = "https://files.pythonhosted.org/packages/2b/24/b350c31543fb0107ab2599464d7e28e6f856027aadda995022e695313d94/pillow-12.0.0-cp314-cp314-win_amd64.whl", hash = "sha256:8dc232e39d409036af549c86f24aed8273a40ffa459981146829a324e0848b4b", size = 7142916, upload-time = "2025-10-15T18:23:34.71Z" }, + { url = "https://files.pythonhosted.org/packages/0f/9b/0ba5a6fd9351793996ef7487c4fdbde8d3f5f75dbedc093bb598648fddf0/pillow-12.0.0-cp314-cp314-win_arm64.whl", hash = "sha256:d52610d51e265a51518692045e372a4c363056130d922a7351429ac9f27e70b0", size = 2523836, upload-time = "2025-10-15T18:23:36.967Z" }, + { url = "https://files.pythonhosted.org/packages/f5/7a/ceee0840aebc579af529b523d530840338ecf63992395842e54edc805987/pillow-12.0.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:1979f4566bb96c1e50a62d9831e2ea2d1211761e5662afc545fa766f996632f6", size = 5255092, upload-time = "2025-10-15T18:23:38.573Z" }, + { url = "https://files.pythonhosted.org/packages/44/76/20776057b4bfd1aef4eeca992ebde0f53a4dce874f3ae693d0ec90a4f79b/pillow-12.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:b2e4b27a6e15b04832fe9bf292b94b5ca156016bbc1ea9c2c20098a0320d6cf6", size = 4653158, upload-time = "2025-10-15T18:23:40.238Z" }, + { url = "https://files.pythonhosted.org/packages/82/3f/d9ff92ace07be8836b4e7e87e6a4c7a8318d47c2f1463ffcf121fc57d9cb/pillow-12.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:fb3096c30df99fd01c7bf8e544f392103d0795b9f98ba71a8054bcbf56b255f1", size = 6267882, upload-time = "2025-10-15T18:23:42.434Z" }, + { url = "https://files.pythonhosted.org/packages/9f/7a/4f7ff87f00d3ad33ba21af78bfcd2f032107710baf8280e3722ceec28cda/pillow-12.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7438839e9e053ef79f7112c881cef684013855016f928b168b81ed5835f3e75e", size = 8071001, upload-time = "2025-10-15T18:23:44.29Z" }, + { url = "https://files.pythonhosted.org/packages/75/87/fcea108944a52dad8cca0715ae6247e271eb80459364a98518f1e4f480c1/pillow-12.0.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5d5c411a8eaa2299322b647cd932586b1427367fd3184ffbb8f7a219ea2041ca", size = 6380146, upload-time = "2025-10-15T18:23:46.065Z" }, + { url = "https://files.pythonhosted.org/packages/91/52/0d31b5e571ef5fd111d2978b84603fce26aba1b6092f28e941cb46570745/pillow-12.0.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d7e091d464ac59d2c7ad8e7e08105eaf9dafbc3883fd7265ffccc2baad6ac925", size = 7067344, upload-time = "2025-10-15T18:23:47.898Z" }, + { url = "https://files.pythonhosted.org/packages/7b/f4/2dd3d721f875f928d48e83bb30a434dee75a2531bca839bb996bb0aa5a91/pillow-12.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:792a2c0be4dcc18af9d4a2dfd8a11a17d5e25274a1062b0ec1c2d79c76f3e7f8", size = 6491864, upload-time = "2025-10-15T18:23:49.607Z" }, + { url = "https://files.pythonhosted.org/packages/30/4b/667dfcf3d61fc309ba5a15b141845cece5915e39b99c1ceab0f34bf1d124/pillow-12.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:afbefa430092f71a9593a99ab6a4e7538bc9eabbf7bf94f91510d3503943edc4", size = 7158911, upload-time = "2025-10-15T18:23:51.351Z" }, + { url = "https://files.pythonhosted.org/packages/a2/2f/16cabcc6426c32218ace36bf0d55955e813f2958afddbf1d391849fee9d1/pillow-12.0.0-cp314-cp314t-win32.whl", hash = "sha256:3830c769decf88f1289680a59d4f4c46c72573446352e2befec9a8512104fa52", size = 6408045, upload-time = "2025-10-15T18:23:53.177Z" }, + { url = "https://files.pythonhosted.org/packages/35/73/e29aa0c9c666cf787628d3f0dcf379f4791fba79f4936d02f8b37165bdf8/pillow-12.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:905b0365b210c73afb0ebe9101a32572152dfd1c144c7e28968a331b9217b94a", size = 7148282, upload-time = "2025-10-15T18:23:55.316Z" }, + { url = "https://files.pythonhosted.org/packages/c1/70/6b41bdcddf541b437bbb9f47f94d2db5d9ddef6c37ccab8c9107743748a4/pillow-12.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:99353a06902c2e43b43e8ff74ee65a7d90307d82370604746738a1e0661ccca7", size = 2525630, upload-time = "2025-10-15T18:23:57.149Z" }, +] + [[package]] name = "psycopg" version = "3.2.12" @@ -178,6 +269,42 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/8a/ac/9fc61b4f9d079482a290afe8d206b8f490e9fd32d4fc03ed4fc698214e01/pydantic_core-2.41.4-cp314-cp314t-win_arm64.whl", hash = "sha256:d34f950ae05a83e0ede899c595f312ca976023ea1db100cd5aa188f7005e3ab0", size = 1973897, upload-time = "2025-10-14T10:22:13.444Z" }, ] +[[package]] +name = "qiniu" +version = "7.17.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "requests" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f8/bd/b4c669df1ee2a6dbaf23b14796d72445545bf9a913dff93c37eb79ee08b0/qiniu-7.17.0.tar.gz", hash = "sha256:4bcc61b6d53fa0416edd49f9e6290fb5e6bdf4056537936be1a6d48cd020f9fb", size = 62486, upload-time = "2025-07-11T07:32:43.364Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/49/1d/bd3703fe3c1c2efc1eff9314a9d2f5dd276ecb78d303634942756e231b0c/qiniu-7.17.0-py3-none-any.whl", hash = "sha256:3cd3d25ba1fb9abd2eefb98d5669873d7199e9d84decb25ff5db7968a08a9fb9", size = 81769, upload-time = "2025-07-11T07:32:41.665Z" }, +] + +[[package]] +name = "requests" +version = "2.32.5" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "certifi" }, + { name = "charset-normalizer" }, + { name = "idna" }, + { name = "urllib3" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c9/74/b3ff8e6c8446842c3f5c837e9c3dfcfe2018ea6ecef224c710c85ef728f4/requests-2.32.5.tar.gz", hash = "sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf", size = 134517, upload-time = "2025-08-18T20:46:02.573Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1e/db/4254e3eabe8020b458f1a747140d32277ec7a271daf1d235b70dc0b4e6e3/requests-2.32.5-py3-none-any.whl", hash = "sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6", size = 64738, upload-time = "2025-08-18T20:46:00.542Z" }, +] + +[[package]] +name = "six" +version = "1.17.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81", size = 34031, upload-time = "2024-12-04T17:35:28.174Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050, upload-time = "2024-12-04T17:35:26.475Z" }, +] + [[package]] name = "sqlparse" version = "0.5.3" @@ -216,3 +343,12 @@ sdist = { url = "https://files.pythonhosted.org/packages/95/32/1a225d6164441be76 wheels = [ { url = "https://files.pythonhosted.org/packages/5c/23/c7abc0ca0a1526a0774eca151daeb8de62ec457e77262b66b359c3c7679e/tzdata-2025.2-py2.py3-none-any.whl", hash = "sha256:1a403fada01ff9221ca8044d701868fa132215d84beb92242d9acd2147f667a8", size = 347839, upload-time = "2025-03-23T13:54:41.845Z" }, ] + +[[package]] +name = "urllib3" +version = "2.5.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/15/22/9ee70a2574a4f4599c47dd506532914ce044817c7752a79b6a51286319bc/urllib3-2.5.0.tar.gz", hash = "sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760", size = 393185, upload-time = "2025-06-18T14:07:41.644Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a7/c2/fe1e52489ae3122415c51f387e221dd0773709bad6c6cdaa599e8a2c5185/urllib3-2.5.0-py3-none-any.whl", hash = "sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc", size = 129795, upload-time = "2025-06-18T14:07:40.39Z" }, +]