-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcnlw.sql
4517 lines (4350 loc) · 235 KB
/
cnlw.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- phpMyAdmin SQL Dump
-- version phpStudy 2014
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生æˆæ—¥æœŸ: 2017 å¹?12 æœ?07 æ—?12:25
-- æœåŠ¡å™¨ç‰ˆæœ¬: 5.7.17
-- PHP 版本: 5.6.27
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- æ•°æ®åº“: `cnlw`
--
DELIMITER $$
--
-- å˜å‚¨è¿‡ç¨‹
--
CREATE DEFINER=`erp_admin`@`%` PROCEDURE `DOING_QUALITY`(IN `qc_no` VARCHAR(32),IN `day_plan_no` VARCHAR(32),IN `product_quality` text,IN `keyin_user` VARCHAR(50))
NO SQL
DETERMINISTIC
Label_Pro: BEGIN
DECLARE loop_count INT DEFAULT 0;
DECLARE qc_loop_count INT DEFAULT 0;
DECLARE product_item text;
DECLARE pr_level INT DEFAULT 0;
DECLARE qualified_count INT DEFAULT 0;
DECLARE defective_count INT DEFAULT 0;
DECLARE top_count INT DEFAULT 0;
START TRANSACTION;
/* 如果表ym_qc_batchä¸Âå˜在 day_plan_no的记录,则需è¦Â添加一æ¡记录*/
SET @strsql=CONCAT('SET @plan_count=(SELECT count(*) FROM ym_qc_batch WHERE day_plan_no=\'',day_plan_no,'\')');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
IF @plan_count < 1 THEN
INSERT INTO `ym_qc_batch`(`qc_no`, `day_plan_no`, `batch_no`, `mt_code`, `um`, `order_no`, `order_slv_no`, `qc_date`, `qualified_count`, `top_count`, `waste_count`, `defective_count`, `total`, `keyin_user`, `keyin_date`)
SELECT * FROM ( SELECT qc_no as `qc_no`, day_plan_no as `day_plan_no`,`wp`.`batch_no`, `wp`.`mt_code`, `pb`.`um` ,`wp`.`order_no`,`wp`.`order_slv_no`,sysdate(),0 as `qualified_count`, 0 as `top_count`, 0 as `waste_count`, 0 as `defective_count`, `wp`.`finish_qty` as `total`,keyin_user, sysdate() as `keyin_date` FROM `ym_workday_plan` as `wp` INNER JOIN `ym_product_batch` as `pb` ON `wp`.`batch_no`=`pb`.`batch_no` WHERE `wp`.`day_plan_no`=day_plan_no ) AS t;
END IF ;
/*SELECT json_extract(product_quality,'$.rows[0].um') as `www` ; SELECT json_length(product_quality,'$.rows') INTO @count ; */
SET @count=json_length(product_quality,'$.rows') ;
IF @count=0 THEN
SELECT -1001 AS RESULT_CODE;
ROLLBACK;
LEAVE label_pro ;
END IF;
SET loop_count=0;
WHILE loop_count<@count DO
/*质检产å“Âjson*/
SET @strsql = CONCAT('SELECT json_extract(\'',product_quality,'\'\,\'$.rows[',loop_count,']\') INTO @product_item ;');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
/*产å“Âç¼–å·*/
SET @strsql = CONCAT('SELECT json_extract(\'',@product_item,'\'\,\'$.product_no\') INTO @product_no');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
/*判定结果*/
SET @strsql = CONCAT('SET @pr_level = json_extract(\'',@product_item,'\'\,\'$.level\') ;');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
/*质检项数*/
SET @strsql = CONCAT(' SELECT json_length(\'',@product_item,'\'\,\'$.qc_option\') INTO @qc_count ;');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
SET qc_loop_count=0;
WHILE qc_loop_count < @qc_count DO
/*质检å‚数 @qc_option */
SET @strsql = CONCAT('SELECT json_extract(\'',@product_item,'\'\,\'$.qc_option[',qc_loop_count,']\') INTO @qc_option ;');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
SET @product_no=REPLACE(@product_no,'\"','');
SET @strsql = CONCAT('SELECT json_extract(\'',@qc_option,'\'\,\'$.qc_option_no\') INTO @qc_option_no ;');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
SET @qc_option_no=REPLACE(@qc_option_no,'\"','');
SET @strsql = CONCAT('SELECT json_extract(\'',@qc_option,'\'\,\'$.qc_value\') INTO @qc_value ;');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
SET @qc_value=REPLACE(@qc_value,'\"','');
INSERT INTO ym_product_qc_value(`product_no`, `day_plan_no`,`qc_no`, `qc_option_no`, `qc_value`, `keyin_user`, `keyin_date`)
VALUE (@product_no,day_plan_no,qc_no,@qc_option_no,@qc_value,keyin_user,sysdate());
SET @strsql=CONCAT('INSERT INTO ym_product_qc_value(product_no,day_plan_no,qc_no,qc_option_no,qc_value,keyin_user,keyin_date)
VALUE (\'',@product_no,'\'\,\'',day_plan_no,'\'\,\'',qc_no,'\'\,\'',@qc_option_no,'\'\,\'',@qc_value,'\'\,\'',keyin_user,
'\'\,\'',sysdate(),'\');');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
/*SELECT @strsql;*/
SET qc_loop_count=qc_loop_count+1;
END WHILE;
SET @strsql=CONCAT('UPDATE ym_product SET status\=2,qc_no\=\'',qc_no,'\'\,level\=\'',@pr_level,'\' WHERE product_no\=\'',@product_no,'\' ;');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
/*åˆ格0 ä¸Âåˆ格1 -1 未评定*/
IF @pr_level=0 THEN
SET @strsql=CONCAT('UPDATE ym_qc_batch SET qualified_count\=qualified_count+1,total\=total+1 WHERE day_plan_no\=\'',day_plan_no,'\' ;');
ELSEIF @pr_level=1 THEN
SET @strsql=CONCAT('UPDATE ym_qc_batch SET defective_count\=defective_count+1,total\=total+1 WHERE day_plan_no\=\'',day_plan_no,'\' ;');
ELSEIF @pr_level=2 THEN
SET @strsql=CONCAT('UPDATE ym_qc_batch SET top_count\=top_count+1,total\=total+1 WHERE day_plan_no\=\'',day_plan_no,'\' ;');
END IF ;
PREPARE strsql FROM @strsql;
EXECUTE strsql;
SET loop_count=loop_count+1;
END WHILE;
/* RESULT_CODE为0 æ“Â作æˆÂ功 SELECT `day_plan_no` FROM `ym_product` WHERE `status`=1 AND `day_plan_no`=' 判æ–Â还有没有没有检验的产å“Â,è¿â€Ã¥â€ºÅ¾RESULT_CODE 为1有就刷行本页,è¿â€Ã¥â€ºÅ¾RESULT_CODE 为2å¦则跳转到主页*/
SET @strsql=CONCAT('SET @product_count=(SELECT count(*) FROM ym_product WHERE status=1 AND day_plan_no=\'',day_plan_no,'\') ;');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
IF @product_count > 0 THEN
SELECT 1 AS RESULT_CODE;
ELSE
/*0 已完戠1 未开始 2 进行丠3 延迟 5å·²ç»Â质检 6完戠(入库) */
SET @strsql=CONCAT('UPDATE ym_workday_plan SET status = 5 WHERE day_plan_no\=\'',day_plan_no,'\' ;');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
SELECT 2 AS RESULT_CODE;
END IF ;
COMMIT;
END
;$$
CREATE DEFINER=`erp_admin`@`%` PROCEDURE `GET_BOM`(IN mt_code VARCHAR(10))
BEGIN
/*DECLARE minDate varchar(20) ;
DECLARE maxDate varchar(20) ;
DECLARE strsql varchar(1000);*/
SET @strsql = '';
DROP TABLE if exists bom_table;
CREATE TABLE bom_table
(
mt_code char(10) NOT NULL,
mt_name varchar(50) NOT NULL,
bom_level int(4) NOT NULL,
quantity int(10) NOT NULL,
um_code char(10) NOT NULL,
um_name varchar(50) NOT NULL,
pr_mt_code char(10) ,
pr_mt_name varchar(50),
src_mt_code char(10),
child_count TINYINT(1)
);
SET @bom_level = 1;
SET @sql1 = 'INSERT bom_table SELECT mt_code\,(select mt_name from ym_materiel where ym_materiel_bom.mt_code\=ym_materiel.mt_code limit 1) as mt_name\,';
SET @strsql = CONCAT(@sql1
,@bom_level
,' \,quantity\,um as um_code\,'
,' (select um_name from ym_um where ym_um.um_code\=ym_materiel_bom.um limit 1) as um_name\,'
,' ym_materiel_bom.pr_mt_code as pr_mt_code\,'
,' (select mt_name from ym_materiel where ym_materiel.mt_code\=ym_materiel_bom.pr_mt_code limit 1)as pr_mt_name \,'
,'\''
,mt_code
,'\''
,' \,( select count(cmb.mt_code) as child_count from ym_materiel_bom as cmb where cmb.pr_mt_code\=ym_materiel_bom.mt_code'
,' ) as child_count from ym_materiel_bom where ym_materiel_bom.pr_mt_code\=\''
,mt_code
,'\'');
prepare strsql from @strsql;
execute strsql;
WHILE row_count()>0
DO
SET @new_level = @bom_level +1;
SET @strsql = '';
SET @strsql = CONCAT('INSERT bom_table'
,' SELECT mb.mt_code,(SELECT mt_name from ym_materiel where ym_materiel.mt_code\= mb.mt_code limit 1) as mt_name\,'
,@new_level
,' \,mb.quantity\,mb.um as um_code\,(select um_name from ym_um where ym_um.um_code\=mb.um limit 1) as um_name\,'
,' mb.pr_mt_code\,'
,'(SELECT mt_name FROM ym_materiel where ym_materiel.mt_code\=\''
,mt_code
,'\''
,' LIMIT 1) as pr_mt_name\,'
,'\''
,mt_code
,'\''
,' \,(select count(mt_code) as child_count from ym_materiel_bom where ym_materiel_bom.pr_mt_code=mb.mt_code) as child_count FROM ym_materiel_bom as mb INNER JOIN bom_table tmb ON mb.pr_mt_code\=tmb.mt_code WHERE bom_level\='
,@bom_level);
SET @bom_level = @bom_level +1;
prepare strsql from @strsql;
execute strsql;
END WHILE;
SELECT * FROM bom_table ORDER BY bom_level ASC ;
END$$
CREATE DEFINER=`erp_admin`@`%` PROCEDURE `GET_QUALITY`(IN `product_no` VARCHAR(32))
NO SQL
DETERMINISTIC
Label_Pro: BEGIN
START TRANSACTION;
SELECT `mt_code` INTO @mt_code FROM `ym_product` WHERE `product_no`=product_no limit 1 ;
IF @mt_code IS NOT NULL THEN
SELECT *, (SELECT mt_name FROM ym_materiel WHERE mt_code=ym_materiel.mt_code limit 1) as mt_name,(SELECT um_name FROM ym_um WHERE ym_um.um_code=ym_qc_option.um_code limit 1) as um_name,(SELECT qc_value FROM ym_product_qc_value WHERE `product_no`=product_no AND qc_option_no=ym_qc_option.qc_option_no limit 1) as product_qc_value FROM ym_qc_option WHERE `mt_code`=@mt_code ORDER BY item_no ASC;
ELSE
SELECT -1001 AS RESULT_CODE;
ROLLBACK;
LEAVE label_pro ;
END IF;
END
;$$
CREATE DEFINER=`erp_admin`@`%` PROCEDURE `STOAGR_IN`(IN `tran_type` varchar(8), IN `mt_code` VARCHAR(32),IN `um` VARCHAR(32),IN `stroage_id` VARCHAR(32),IN `qty` int(11),
IN `trans_no` VARCHAR(32),IN `trans_slv_no` VARCHAR(32),
IN `in_no` VARCHAR(32),IN `in_slv_no` VARCHAR(32),IN `trans_id` VARCHAR(32),
IN `keyin_user` VARCHAR(32),IN `products_id_str` VARCHAR(5650))
NO SQL
DETERMINISTIC
Label_Pro: BEGIN
/*DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK;*/
START TRANSACTION;
/*???? 0D???????? OE?????? 0F ????????*/
IF tran_type ='0D' THEN /* ?????????? ?????? ???????? ?????*/
BEGIN
SELECT status INTO @status FROM ym_workday_plan WHERE day_plan_no=trans_slv_no ;
IF @status < 4 THEN
SELECT -1001 AS RESULT_CODE;
ROLLBACK;
LEAVE label_pro ;
END IF;
/* ?????????? */
SELECT `finish_qty` INTO @finish_qty FROM ym_workday_plan WHERE day_plan_no=trans_slv_no ;
SELECT `in_qty` INTO @in_qty FROM ym_workday_plan WHERE day_plan_no=trans_slv_no ;
IF @finish_qty < @in_qty + qty THEN
SELECT -1002 AS RESULT_CODE;
ROLLBACK;
LEAVE label_pro ;
END IF;
SET @strsql=CONCAT('UPDATE ym_workday_plan SET in_qty\=if(in_qty is null,0,in_qty)+',qty,' WHERE day_plan_no\=\'',trans_slv_no,'\'');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
IF ROW_COUNT()>0 THEN
SELECT `batch_no` INTO @batch_no FROM ym_workday_plan WHERE day_plan_no=trans_slv_no ;
SET @strsql=CONCAT('UPDATE ym_product_batch SET in_qty\=if(in_qty is null,0,in_qty)+',qty,' WHERE batch_no\=\'',@batch_no,'\'');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
END IF;
END;
ELSEIF tran_type='0E' THEN
BEGIN
/* ???????????????? ????????? */
SELECT `mt_num` INTO @mt_num FROM `ym_purchase_slv` WHERE `slv_no`=trans_slv_no ;
SELECT `mt_complete_num` INTO @mt_complete_num FROM `ym_purchase_slv` WHERE `slv_no`=trans_slv_no ;
IF @mt_num < @mt_complete_num + qty THEN
SELECT -1002 AS RESULT_CODE;
ROLLBACK;
LEAVE label_pro ;
END IF;
SET @strsql=CONCAT('UPDATE ym_purchase_slv SET mt_complete_num\=if(mt_complete_num is null,0,mt_complete_num)+',qty,' WHERE slv_no\=\'',trans_slv_no,'\'');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
END;
ELSEIF tran_type='0F' THEN
BEGIN
/* ???????????????? ??????????? */
SELECT `return_qty` INTO @return_qty FROM `ym_returns_slv` WHERE `returns_slv_no`=trans_slv_no ;
SELECT `in_qty` INTO @in_qty FROM `ym_returns_slv` WHERE `returns_slv_no`=trans_slv_no ;
IF @return_qty < @in_qty + qty THEN
SELECT -1002 AS RESULT_CODE;
ROLLBACK;
LEAVE label_pro ;
END IF;
/*UPDATE `ym_returns_slv` SET `in_qty`=`in_qty`+qty WHERE `returns_slv_no`=trans_slv_no ; SELECT @return_qty;SELECT @in_qty; SELECT @strsql;*/
SET @strsql=CONCAT('UPDATE ym_returns_slv SET in_qty\=if(in_qty is null,0,in_qty)+',qty,' WHERE returns_slv_no\=\'',trans_slv_no,'\'');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
END;
ELSE
BEGIN
/* ?????????? */
SELECT -2001 AS RESULT_CODE;
ROLLBACK;
LEAVE label_pro ;
END;
END IF;
SELECT ROW_COUNT() INTO @row_affect;
/* ?????? */
IF @row_affect>0 THEN
SET @strsql=CONCAT('INSERT INTO ym_storage_in_slv(in_slv_no\,in_no\,mt_code\,um\,in_qty\,storage_qty\,out_qty\,keyin_date\,',
'keyin_user\,trans_id\,flag_id\,trans_type\,trans_no\,trans_slv_no)VALUES(',
'\'',in_slv_no,'\'\,\'',in_no,'\'\,\'',mt_code,'\'\,\'',um,'\'\,\'',qty,'\'\,\'',qty,'\'\,\'',0,
'\'\,\'',sysdate(),'\'\,\'',keyin_user,'\'\,\'',trans_id,'\'\,\'',0,'\'\,\'',tran_type,
'\'\,\'',trans_no,'\'\,\'',trans_slv_no,'\')');
PREPARE strsql FROM @strsql;
EXECUTE strsql;
END IF;
/* ????????? 3??????*/
IF ( products_id_str IS NOT NULL ) OR ( products_id_str !='' ) THEN
UPDATE `ym_product` SET `status`=3 , `storage_id`=storage_id WHERE `product_no` in (products_id_str);
END IF;
/* ???????? */
INSERT INTO ym_storage_transaction(trans_id, storage_code, mt_code, um, trans_type, trans_date, trans_qty, trans_no, trans_slv_no, cust_code, to_bill_no,
to_bill_slv_no, basis_bill_no, basis_bill_slv_no, remark, keyin_user, keyin_date) VALUES
(trans_id,stroage_id,mt_code,um,tran_type,sysdate(),qty,trans_no,trans_slv_no,'',in_no,
in_slv_no,'','','',keyin_user,sysdate());
COMMIT;
/* RESULT_CODE?0 ???? ROLLBACK; */
SELECT 1 AS RESULT_CODE;
END
;$$
CREATE DEFINER=`erp_admin`@`%` PROCEDURE `STOAGR_OUT`(IN `tran_type` INT(2) UNSIGNED, IN `mt_code` VARCHAR(32),IN `um` VARCHAR(32),IN `stroage_id` VARCHAR(32),IN `qty` int(11),
IN `trans_no` VARCHAR(32),IN `trans_slv_no` VARCHAR(32),
IN `basis_bill_no` VARCHAR(32),IN `basis_bill_slv_no` VARCHAR(32),IN `to_bill_no` VARCHAR(32),IN `to_bill_slv_no` VARCHAR(32),IN `trans_id` VARCHAR(32),
IN `keyin_user` VARCHAR(32),IN `products_id_str` VARCHAR(5650))
NO SQL
DETERMINISTIC
Label_Pro: BEGIN
START TRANSACTION;
/* 判æ–库å˜çš„é‡ */
SELECT storage_qty INTO @storage_qty FROM ym_storage_in_slv WHERE in_slv_no=basis_bill_slv_no ;
IF @storage_qty < qty THEN
SELECT -1001 AS RESULT_CODE;
ROLLBACK;
LEAVE label_pro ;
END IF;
/*事务类型 为 0A 表示领料å•å‡ºåº“ 0B 表示订å•å‡ºåº“ 0C 表示采è´é€€è´§å‡ºåº“ 0D表示的是生产入库 OE表示采è´å…¥åº“ 0F 表示订å•é€€è´§å…¥åº“*/
IF tran_type ='0A' THEN /* æ–™å•å‡ºåº“äº‹åŠ¡ç±»åž‹å¤„ç† å…ˆåšå‡ºåº“å¤„ç† ç„¶åŽæ·»åŠ 事务记录 生æˆå‡ºåº“å•*/
BEGIN
/* ä¸èƒ½å¤Ÿè¶…å‡ºè¯·æ±‚æ•°é‡ */
SELECT req_qty INTO @req_qty FROM ym_product_picking_slv WHERE picking_slv_code=trans_slv_no ;
SELECT real_qty INTO @real_qty FROM ym_product_picking_slv WHERE picking_slv_code=trans_slv_no ;
IF @req_qty < @real_qty + qty THEN
SELECT -1002 AS RESULT_CODE;
ROLLBACK;
LEAVE label_pro ;
END IF;
UPDATE ym_storage_in_slv SET storage_qty=storage_qty-qty,out_qty=out_qty+qty WHERE in_slv_no=basis_bill_slv_no ;
IF ROW_COUNT()>0 THEN
UPDATE ym_product_picking_slv SET real_qty=real_qty+qty WHERE picking_slv_code=trans_slv_no ;
END IF;
END;
ELSEIF tran_type='0B' THEN
BEGIN
/* å·²ç»å‘货的数é‡åŠ 上本次å‘è´§çš„æ•°é‡ ä¸èƒ½å¤Ÿè¶…出订å•æ•°é‡ */
SELECT order_qty INTO @order_qty FROM ym_invoice_slv INNER JOIN ym_order_slv ON ym_invoice_slv.order_slv_no= ym_order_slv.order_slv_no WHERE invoice_slv_no=trans_slv_no ;
SELECT invoice_qty INTO @invoice_qty FROM ym_invoice_slv WHERE picking_slv_code=trans_slv_no ;
IF @order_qty < @invoice_qty + qty THEN
SELECT -1002 AS RESULT_CODE;
ROLLBACK;
LEAVE label_pro ;
END IF;
UPDATE ym_storage_in_slv SET storage_qty=storage_qty-qty,out_qty=out_qty+qty WHERE in_slv_no=basis_bill_slv_no ;
IF ROW_COUNT()>0 THEN
UPDATE ym_invoice_slv SET invoice_qty=invoice_qty+qty WHERE picking_slv_code=trans_slv_no ;
END IF;
END;
ELSEIF tran_type='0C' THEN
BEGIN
SELECT mt_return_num INTO @mt_return_num FROM ym_purchase_returns_slv WHERE returns_slv_no=trans_slv_no ;
SELECT mt_num INTO @mt_num FROM ym_invoice_slv WHERE picking_slv_code=trans_slv_no ;
IF @mt_num <@mt_return_num + qty THEN
SELECT -1002 AS RESULT_CODE;
ROLLBACK;
LEAVE label_pro ;
END IF;
UPDATE ym_storage_in_slv SET storage_qty=storage_qty-qty,out_qty=out_qty+qty WHERE in_slv_no=basis_bill_slv_no ;
IF ROW_COUNT()>0 THEN
UPDATE ym_purchase_returns_slv SET mt_return_num=mt_return_num+qty WHERE returns_slv_no=trans_slv_no ;
UPDATE ym_purchase_slv SET mt_return_num=mt_return_num+qty WHERE slv_no IN ( SELECT slv_no FROM ym_purchase_returns_slv WHERE returns_slv_no= trans_slv_no) ;
END IF;
END;
ELSE
BEGIN
/* ä¸å˜åœ¨çš„库å˜äº‹åŠ¡ç±»åž‹ */
SELECT -2001 AS RESULT_CODE;
ROLLBACK;
LEAVE label_pro ;
END;
END IF;
/* æ’入出库记录 */
INSERT INTO ym_storage_out_slv(out_no, out_slv_no, mt_code, um, out_qty, remark, keyin_date, keyin_user, trans_id,trans_type,trans_no,trans_slv_no)
VALUES
(to_bill_no,to_bill_slv_no,mt_code,um,qty,'',sysdate(),keyin_user,trans_id,tran_type,trans_no,trans_slv_no);
/* 更新产å“状æ€ä¸ºå‡ºåº“ 4表示产å“出库 */
IF (products_id_str IS NOT NULL) OR ( products_id_str !='' ) THEN
UPDATE ym_product SET status=4,storage_id='' WHERE product_no in (products_id_str) ;
END IF;
/* æ’入事务记录 */
INSERT INTO ym_storage_transaction(trans_id, storage_code, mt_code, um, trans_type, trans_date, trans_qty, trans_no, trans_slv_no, cust_code, to_bill_no,
to_bill_slv_no, basis_bill_no, basis_bill_slv_no, remark, keyin_user, keyin_date) VALUES
(trans_id,stroage_id,mt_code,um,'0A',sysdate(),qty,trans_no,trans_slv_no,'',to_bill_no,
to_bill_slv_no,basis_bill_no,basis_bill_slv_no,'',sysdate(),keyin_user);
COMMIT;
/* RESULT_CODE为0 æ“作æˆåŠŸ */
SELECT 0 AS RESULT_CODE;
END
;$$
CREATE DEFINER=`erp_admin`@`%` PROCEDURE `TEST`()
NO SQL
DETERMINISTIC
BEGIN
SELECT storage_qty INTO @storage_qty FROM ym_storage_in_slv limit 1 ;
SELECT @storage_qty ;
END$$
DELIMITER ;
-- --------------------------------------------------------
--
-- 表的结构 `bom_table`
--
CREATE TABLE IF NOT EXISTS `bom_table` (
`mt_code` char(10) NOT NULL,
`mt_name` varchar(50) NOT NULL,
`bom_level` int(4) NOT NULL,
`quantity` int(10) NOT NULL,
`um_code` char(10) NOT NULL,
`um_name` varchar(50) NOT NULL,
`pr_mt_code` char(10) DEFAULT NULL,
`pr_mt_name` varchar(50) DEFAULT NULL,
`src_mt_code` char(10) DEFAULT NULL,
`child_count` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- 转å˜è¡¨ä¸çš„æ•°æ® `bom_table`
--
INSERT INTO `bom_table` (`mt_code`, `mt_name`, `bom_level`, `quantity`, `um_code`, `um_name`, `pr_mt_code`, `pr_mt_name`, `src_mt_code`, `child_count`) VALUES
('d54c692a', '0x1213', 1, 30, '8a2f', ' å¨', '2ab396d4', '111222', '2ab396d4', 0),
('d54c692b', 'OX9000', 1, 300, '8a2f', ' å¨', '2ab396d4', '111222', '2ab396d4', 1),
('d54e', 'asddas', 2, 10, '8a2f', ' å¨', 'd54c692b', '111222', '2ab396d4', 0);
-- --------------------------------------------------------
--
-- 表的结构 `cn_admin`
--
CREATE TABLE IF NOT EXISTS `cn_admin` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(80) NOT NULL,
`name` varchar(80) NOT NULL,
`password` varchar(80) NOT NULL,
`email` varchar(300) NOT NULL,
`user_login` enum('Y','N') NOT NULL DEFAULT 'N',
`delete_reason` varchar(80) NOT NULL,
`createdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`modifydate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`deleted` enum('Y','N') NOT NULL DEFAULT 'N',
`mobile` varchar(14) NOT NULL COMMENT '用户电è¯',
`sex` tinyint(4) DEFAULT NULL COMMENT '0为女 1为男',
`imagin` varchar(255) NOT NULL COMMENT '用户头åƒ',
`birth` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`identity_id` varchar(18) DEFAULT NULL COMMENT '身份è¯',
`full_name` varchar(100) DEFAULT NULL COMMENT '姓å 与身份è¯ç›¸åŒ',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=24 ;
--
-- 转å˜è¡¨ä¸çš„æ•°æ® `cn_admin`
--
INSERT INTO `cn_admin` (`id`, `user_name`, `name`, `password`, `email`, `user_login`, `delete_reason`, `createdate`, `modifydate`, `deleted`, `mobile`, `sex`, `imagin`, `birth`, `identity_id`, `full_name`) VALUES
(21, '奇洛æŽç»´æ–¯', 'å°æŽ', 'e10adc3949ba59abbe56e057f20f883e', '[email protected]', 'N', '', '2016-12-14 17:35:08', '2016-12-14 17:42:51', 'N', '1388888888', NULL, '', '0000-00-00 00:00:00', '440xxxxxxxxxxxx', 'æŽèŽ‰èŽ‰'),
(22, 'peter', 'peter', 'e10adc3949ba59abbe56e057f20f883e', '[email protected]', 'N', '', '0000-00-00 00:00:00', '2017-01-19 05:20:10', 'N', '18399887288', NULL, '', '0000-00-00 00:00:00', '440199887263664758', 'peter parker'),
(23, 'joy', 'å°è¾›', 'e10adc3949ba59abbe56e057f20f883e', '[email protected]', 'N', '', '2016-12-14 17:44:51', '2016-12-14 17:46:57', 'N', '15888888888', NULL, '', '0000-00-00 00:00:00', '44822144564651561', '阿诺舒åŽè¾›åŠ›åŠ ');
-- --------------------------------------------------------
--
-- 表的结构 `cn_area`
--
CREATE TABLE IF NOT EXISTS `cn_area` (
`id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`pid` int(5) unsigned NOT NULL DEFAULT '0',
`name` varchar(120) DEFAULT NULL,
`type` tinyint(1) DEFAULT '2',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3410 ;
--
-- 转å˜è¡¨ä¸çš„æ•°æ® `cn_area`
--
INSERT INTO `cn_area` (`id`, `pid`, `name`, `type`) VALUES
(1, 0, 'ä¸å›½', 0),
(2, 1, '北京', 1),
(3, 1, '安徽', 1),
(4, 1, 'ç¦å»º', 1),
(5, 1, '甘肃', 1),
(6, 1, '广东', 1),
(7, 1, '广西', 1),
(8, 1, '贵州', 1),
(9, 1, 'æµ·å—', 1),
(10, 1, '河北', 1),
(11, 1, 'æ²³å—', 1),
(12, 1, '黑龙江', 1),
(13, 1, '湖北', 1),
(14, 1, 'æ¹–å—', 1),
(15, 1, 'å‰æž—', 1),
(16, 1, '江è‹', 1),
(17, 1, '江西', 1),
(18, 1, 'è¾½å®', 1),
(19, 1, '内蒙å¤', 1),
(20, 1, 'å®å¤', 1),
(21, 1, 'é’æµ·', 1),
(22, 1, '山东', 1),
(23, 1, '山西', 1),
(24, 1, '陕西', 1),
(25, 1, '上海', 1),
(26, 1, 'å››å·', 1),
(27, 1, '天津', 1),
(28, 1, '西è—', 1),
(29, 1, 'æ–°ç–†', 1),
(30, 1, '云å—', 1),
(31, 1, '浙江', 1),
(32, 1, 'é‡åº†', 1),
(33, 1, '香港', 1),
(34, 1, '澳门', 1),
(35, 1, 'å°æ¹¾', 1),
(36, 3, '安庆', 2),
(37, 3, 'èšŒåŸ ', 2),
(38, 3, '巢湖', 2),
(39, 3, 'æ± å·ž', 2),
(40, 3, 'æ»å·ž', 2),
(41, 3, '阜阳', 2),
(42, 3, '淮北', 2),
(43, 3, 'æ·®å—', 2),
(44, 3, '黄山', 2),
(45, 3, 'å…安', 2),
(46, 3, '马éžå±±', 2),
(47, 3, '宿州', 2),
(48, 3, '铜陵', 2),
(49, 3, '芜湖', 2),
(50, 3, '宣城', 2),
(51, 3, '亳州', 2),
(52, 2, '北京', 2),
(53, 4, 'ç¦å·ž', 2),
(54, 4, '龙岩', 2),
(55, 4, 'å—å¹³', 2),
(56, 4, 'å®å¾·', 2),
(57, 4, '莆田', 2),
(58, 4, '泉州', 2),
(59, 4, '三明', 2),
(60, 4, '厦门', 2),
(61, 4, '漳州', 2),
(62, 5, 'å…°å·ž', 2),
(63, 5, '白银', 2),
(64, 5, '定西', 2),
(65, 5, '甘å—', 2),
(66, 5, '嘉峪关', 2),
(67, 5, '金昌', 2),
(68, 5, '酒泉', 2),
(69, 5, '临å¤', 2),
(70, 5, '陇å—', 2),
(71, 5, '平凉', 2),
(72, 5, '庆阳', 2),
(73, 5, '天水', 2),
(74, 5, 'æ¦å¨', 2),
(75, 5, 'å¼ æŽ–', 2),
(76, 6, '广州', 2),
(77, 6, '深圳', 2),
(78, 6, '潮州', 2),
(79, 6, '东莞', 2),
(80, 6, '佛山', 2),
(81, 6, 'æ²³æº', 2),
(82, 6, 'æƒ å·ž', 2),
(83, 6, '江门', 2),
(84, 6, 'æ阳', 2),
(85, 6, '茂å', 2),
(86, 6, '梅州', 2),
(87, 6, '清远', 2),
(88, 6, '汕头', 2),
(89, 6, '汕尾', 2),
(90, 6, '韶关', 2),
(91, 6, '阳江', 2),
(92, 6, '云浮', 2),
(93, 6, '湛江', 2),
(94, 6, '肇庆', 2),
(95, 6, 'ä¸å±±', 2),
(96, 6, 'ç æµ·', 2),
(97, 7, 'å—å®', 2),
(98, 7, 'æ¡‚æž—', 2),
(99, 7, '百色', 2),
(100, 7, '北海', 2),
(101, 7, '崇左', 2),
(102, 7, '防城港', 2),
(103, 7, '贵港', 2),
(104, 7, 'æ²³æ± ', 2),
(105, 7, '贺州', 2),
(106, 7, 'æ¥å®¾', 2),
(107, 7, '柳州', 2),
(108, 7, '钦州', 2),
(109, 7, '梧州', 2),
(110, 7, '玉林', 2),
(111, 8, '贵阳', 2),
(112, 8, '安顺', 2),
(113, 8, '毕节', 2),
(114, 8, 'å…盘水', 2),
(115, 8, '黔东å—', 2),
(116, 8, 'é»”å—', 2),
(117, 8, '黔西å—', 2),
(118, 8, 'é“œä»', 2),
(119, 8, 'éµä¹‰', 2),
(120, 9, 'æµ·å£', 2),
(121, 9, '三亚', 2),
(122, 9, '白沙', 2),
(123, 9, 'ä¿äº', 2),
(124, 9, '昌江', 2),
(125, 9, '澄迈县', 2),
(126, 9, '定安县', 2),
(127, 9, '东方', 2),
(128, 9, 'ä¹ä¸œ', 2),
(129, 9, '临高县', 2),
(130, 9, '陵水', 2),
(131, 9, 'ç¼æµ·', 2),
(132, 9, 'ç¼ä¸', 2),
(133, 9, '屯昌县', 2),
(134, 9, '万å®', 2),
(135, 9, '文昌', 2),
(136, 9, '五指山', 2),
(137, 9, 'å„‹å·ž', 2),
(138, 10, '石家庄', 2),
(139, 10, 'ä¿å®š', 2),
(140, 10, '沧州', 2),
(141, 10, '承德', 2),
(142, 10, '邯郸', 2),
(143, 10, 'è¡¡æ°´', 2),
(144, 10, '廊åŠ', 2),
(145, 10, '秦皇岛', 2),
(146, 10, 'å”å±±', 2),
(147, 10, 'é‚¢å°', 2),
(148, 10, 'å¼ å®¶å£', 2),
(149, 11, '郑州', 2),
(150, 11, '洛阳', 2),
(151, 11, 'å¼€å°', 2),
(152, 11, '安阳', 2),
(153, 11, '鹤å£', 2),
(154, 11, '济æº', 2),
(155, 11, '焦作', 2),
(156, 11, 'å—阳', 2),
(157, 11, '平顶山', 2),
(158, 11, '三门峡', 2),
(159, 11, '商丘', 2),
(160, 11, '新乡', 2),
(161, 11, '信阳', 2),
(162, 11, '许昌', 2),
(163, 11, '周å£', 2),
(164, 11, '驻马店', 2),
(165, 11, '漯河', 2),
(166, 11, '濮阳', 2),
(167, 12, '哈尔滨', 2),
(168, 12, '大庆', 2),
(169, 12, '大兴安å²', 2),
(170, 12, '鹤岗', 2),
(171, 12, '黑河', 2),
(172, 12, '鸡西', 2),
(173, 12, '佳木斯', 2),
(174, 12, '牡丹江', 2),
(175, 12, '七å°æ²³', 2),
(176, 12, 'é½é½å“ˆå°”', 2),
(177, 12, 'åŒé¸å±±', 2),
(178, 12, '绥化', 2),
(179, 12, '伊春', 2),
(180, 13, 'æ¦æ±‰', 2),
(181, 13, '仙桃', 2),
(182, 13, 'é„‚å·ž', 2),
(183, 13, '黄冈', 2),
(184, 13, '黄石', 2),
(185, 13, 'è†é—¨', 2),
(186, 13, 'è†å·ž', 2),
(187, 13, '潜江', 2),
(188, 13, '神农架林区', 2),
(189, 13, 'åå °', 2),
(190, 13, 'éšå·ž', 2),
(191, 13, '天门', 2),
(192, 13, 'å’¸å®', 2),
(193, 13, '襄樊', 2),
(194, 13, 'åæ„Ÿ', 2),
(195, 13, '宜昌', 2),
(196, 13, 'æ©æ–½', 2),
(197, 14, 'é•¿æ²™', 2),
(198, 14, 'å¼ å®¶ç•Œ', 2),
(199, 14, '常德', 2),
(200, 14, '郴州', 2),
(201, 14, '衡阳', 2),
(202, 14, '怀化', 2),
(203, 14, '娄底', 2),
(204, 14, '邵阳', 2),
(205, 14, '湘æ½', 2),
(206, 14, '湘西', 2),
(207, 14, '益阳', 2),
(208, 14, '永州', 2),
(209, 14, '岳阳', 2),
(210, 14, 'æ ªæ´²', 2),
(211, 15, '长春', 2),
(212, 15, 'å‰æž—', 2),
(213, 15, '白城', 2),
(214, 15, '白山', 2),
(215, 15, 'è¾½æº', 2),
(216, 15, '四平', 2),
(217, 15, 'æ¾åŽŸ', 2),
(218, 15, '通化', 2),
(219, 15, '延边', 2),
(220, 16, 'å—京', 2),
(221, 16, 'è‹å·ž', 2),
(222, 16, 'æ— é”¡', 2),
(223, 16, '常州', 2),
(224, 16, '淮安', 2),
(225, 16, '连云港', 2),
(226, 16, 'å—通', 2),
(227, 16, '宿è¿', 2),
(228, 16, 'æ³°å·ž', 2),
(229, 16, 'å¾å·ž', 2),
(230, 16, 'ç›åŸŽ', 2),
(231, 16, '扬州', 2),
(232, 16, '镇江', 2),
(233, 17, 'å—昌', 2),
(234, 17, '抚州', 2),
(235, 17, '赣州', 2),
(236, 17, 'å‰å®‰', 2),
(237, 17, '景德镇', 2),
(238, 17, 'ä¹æ±Ÿ', 2),
(239, 17, 'è乡', 2),
(240, 17, '上饶', 2),
(241, 17, 'æ–°ä½™', 2),
(242, 17, '宜春', 2),
(243, 17, 'é¹°æ½', 2),
(244, 18, '沈阳', 2),
(245, 18, '大连', 2),
(246, 18, 'éžå±±', 2),
(247, 18, '本溪', 2),
(248, 18, 'æœé˜³', 2),
(249, 18, '丹东', 2),
(250, 18, '抚顺', 2),
(251, 18, '阜新', 2),
(252, 18, '葫芦岛', 2),
(253, 18, '锦州', 2),
(254, 18, '辽阳', 2),
(255, 18, '盘锦', 2),
(256, 18, 'é“å²', 2),
(257, 18, 'è¥å£', 2),
(258, 19, '呼和浩特', 2),
(259, 19, '阿拉善盟', 2),
(260, 19, '巴彦淖尔盟', 2),
(261, 19, '包头', 2),
(262, 19, '赤峰', 2),
(263, 19, '鄂尔多斯', 2),
(264, 19, '呼伦è´å°”', 2),
(265, 19, '通辽', 2),
(266, 19, '乌海', 2),
(267, 19, '乌兰察布市', 2),
(268, 19, '锡林éƒå‹’盟', 2),
(269, 19, '兴安盟', 2),
(270, 20, '银å·', 2),
(271, 20, '固原', 2),
(272, 20, '石嘴山', 2),
(273, 20, 'å´å¿ ', 2),
(274, 20, 'ä¸å«', 2),
(275, 21, '西å®', 2),
(276, 21, '果洛', 2),
(277, 21, '海北', 2),
(278, 21, '海东', 2),
(279, 21, 'æµ·å—', 2),
(280, 21, '海西', 2),
(281, 21, '黄å—', 2),
(282, 21, 'çŽ‰æ ‘', 2),
(283, 22, '济å—', 2),
(284, 22, 'é’å²›', 2),
(285, 22, '滨州', 2),
(286, 22, 'å¾·å·ž', 2),
(287, 22, '东è¥', 2),
(288, 22, 'èæ³½', 2),
(289, 22, '济å®', 2),
(290, 22, '莱芜', 2),
(291, 22, 'èŠåŸŽ', 2),
(292, 22, '临沂', 2),
(293, 22, '日照', 2),
(294, 22, '泰安', 2),
(295, 22, 'å¨æµ·', 2),
(296, 22, 'æ½åŠ', 2),
(297, 22, '烟å°', 2),
(298, 22, '枣庄', 2),
(299, 22, 'æ·„åš', 2),
(300, 23, '太原', 2),
(301, 23, 'é•¿æ²»', 2),
(302, 23, '大åŒ', 2),
(303, 23, '晋城', 2),
(304, 23, '晋ä¸', 2),
(305, 23, '临汾', 2),
(306, 23, 'å•æ¢', 2),
(307, 23, '朔州', 2),
(308, 23, '忻州', 2),
(309, 23, '阳泉', 2),
(310, 23, 'è¿åŸŽ', 2),
(311, 24, '西安', 2),
(312, 24, '安康', 2),
(313, 24, 'å®é¸¡', 2),
(314, 24, '汉ä¸', 2),
(315, 24, '商洛', 2),
(316, 24, 'é“œå·', 2),
(317, 24, 'æ¸å—', 2),
(318, 24, '咸阳', 2),
(319, 24, '延安', 2),
(320, 24, '榆林', 2),
(321, 25, '上海', 2),
(322, 26, 'æˆéƒ½', 2),
(323, 26, '绵阳', 2),
(324, 26, '阿å', 2),
(325, 26, 'å·´ä¸', 2),
(326, 26, '达州', 2),
(327, 26, '德阳', 2),
(328, 26, '甘åœ', 2),
(329, 26, '广安', 2),
(330, 26, '广元', 2),
(331, 26, 'ä¹å±±', 2),
(332, 26, '凉山', 2),
(333, 26, '眉山', 2),
(334, 26, 'å—å……', 2),
(335, 26, '内江', 2),
(336, 26, '攀æžèŠ±', 2),
(337, 26, 'é‚å®', 2),
(338, 26, '雅安', 2),
(339, 26, '宜宾', 2),
(340, 26, '资阳', 2),
(341, 26, '自贡', 2),
(342, 26, '泸州', 2),
(343, 27, '天津', 2),
(344, 28, '拉è¨', 2),
(345, 28, '阿里', 2),
(346, 28, '昌都', 2),
(347, 28, 'æž—èŠ', 2),
(348, 28, '那曲', 2),
(349, 28, '日喀则', 2),
(350, 28, 'å±±å—', 2),
(351, 29, '乌é²æœ¨é½', 2),
(352, 29, '阿克è‹', 2),
(353, 29, '阿拉尔', 2),
(354, 29, '巴音éƒæ¥ž', 2),
(355, 29, 'åšå°”塔拉', 2),
(356, 29, '昌å‰', 2),
(357, 29, '哈密', 2),
(358, 29, '和田', 2),
(359, 29, '喀什', 2),
(360, 29, '克拉玛ä¾', 2),
(361, 29, 'å…‹åœå‹’è‹', 2),
(362, 29, '石河å', 2),
(363, 29, '图木舒克', 2),
(364, 29, 'åé²ç•ª', 2),
(365, 29, 'äº”å®¶æ¸ ', 2),
(366, 29, '伊çŠ', 2),
(367, 30, '昆明', 2),
(368, 30, '怒江', 2),
(369, 30, '普洱', 2),
(370, 30, '丽江', 2),
(371, 30, 'ä¿å±±', 2),
(372, 30, '楚雄', 2),
(373, 30, '大ç†', 2),
(374, 30, 'å¾·å®', 2),
(375, 30, '迪庆', 2),
(376, 30, '红河', 2),
(377, 30, '临沧', 2),
(378, 30, '曲é–', 2),
(379, 30, '文山', 2),
(380, 30, '西åŒç‰ˆçº³', 2),
(381, 30, '玉溪', 2),
(382, 30, 'æ˜é€š', 2),
(383, 31, 'æå·ž', 2),
(384, 31, 'æ¹–å·ž', 2),
(385, 31, '嘉兴', 2),
(386, 31, '金åŽ', 2),
(387, 31, '丽水', 2),
(388, 31, 'å®æ³¢', 2),
(389, 31, 'ç»å…´', 2),
(390, 31, 'å°å·ž', 2),
(391, 31, '温州', 2),
(392, 31, '舟山', 2),
(393, 31, '衢州', 2),
(394, 32, 'é‡åº†', 2),
(395, 33, '香港', 2),
(396, 34, '澳门', 2),
(397, 35, 'å°æ¹¾', 2),
(398, 36, '迎江区', 3),
(399, 36, '大观区', 3),
(400, 36, '宜秀区', 3),
(401, 36, 'æ¡åŸŽå¸‚', 3),
(402, 36, '怀å®åŽ¿', 3),
(403, 36, '枞阳县', 3),
(404, 36, '潜山县', 3),
(405, 36, '太湖县', 3),
(406, 36, '宿æ¾åŽ¿', 3),
(407, 36, '望江县', 3),
(408, 36, '岳西县', 3),
(409, 37, 'ä¸å¸‚区', 3),
(410, 37, '东市区', 3),
(411, 37, '西市区', 3),
(412, 37, '郊区', 3),
(413, 37, '怀远县', 3),
(414, 37, '五河县', 3),
(415, 37, '固镇县', 3),
(416, 38, '居巢区', 3),
(417, 38, 'åºæ±ŸåŽ¿', 3),
(418, 38, 'æ— ä¸ºåŽ¿', 3),
(419, 38, 'å«å±±åŽ¿', 3),
(420, 38, '和县', 3),
(421, 39, 'è´µæ± åŒº', 3),
(422, 39, '东至县', 3),
(423, 39, '石å°åŽ¿', 3),
(424, 39, 'é’阳县', 3),
(425, 40, 'ç…çŠåŒº', 3),
(426, 40, 'å—谯区', 3),
(427, 40, '天长市', 3),
(428, 40, '明光市', 3),
(429, 40, 'æ¥å®‰åŽ¿', 3),
(430, 40, '全椒县', 3),
(431, 40, '定远县', 3),
(432, 40, '凤阳县', 3),
(433, 41, '蚌山区', 3),
(434, 41, 'é¾™å湖区', 3),
(435, 41, '禹会区', 3),
(436, 41, '淮上区', 3),
(437, 41, 'é¢å·žåŒº', 3),
(438, 41, 'é¢ä¸œåŒº', 3),
(439, 41, 'é¢æ³‰åŒº', 3),
(440, 41, '界首市', 3),
(441, 41, '临泉县', 3),
(442, 41, '太和县', 3),
(443, 41, '阜å—县', 3),
(444, 41, '颖上县', 3),
(445, 42, '相山区', 3),
(446, 42, 'æœé›†åŒº', 3),
(447, 42, '烈山区', 3),
(448, 42, '濉溪县', 3),
(449, 43, '田家庵区', 3),
(450, 43, '大通区', 3),
(451, 43, '谢家集区', 3),
(452, 43, '八公山区', 3),
(453, 43, '潘集区', 3),
(454, 43, '凤å°åŽ¿', 3),
(455, 44, '屯溪区', 3),