赫艾后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5451 lines
248 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
8 months ago
8 months ago
​
​
​
8 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
8 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 months ago
​
​
​
​
​
​
11 months ago
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 months ago
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
8 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
8 months ago
​
8 months ago
​
​
8 months ago
​
8 months ago
​
​
7 months ago
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
8 months ago
​
​
​
​
​
​
​
11 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
8 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
8 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
8 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
8 months ago
​
8 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 months ago
​
​
​
11 months ago
​
11 months ago
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
8 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
11 months ago
​
​
11 months ago
​
​
​
11 months ago
7 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.heai.modules.pms.mapper.QcMapper">
  4. <!-- ================================================= 检验方法 ================================================= -->
  5. <!-- 条件查询检验方法 -->
  6. <select id="qcMethodSearch" parameterType="com.heai.modules.pms.data.QcMethodData" resultType="com.heai.modules.pms.data.QcMethodData">
  7. SELECT
  8. qm.site,
  9. qm.bu_no,
  10. qm.method_no,
  11. qm.method_name,
  12. qm.create_date,
  13. qm.create_by,
  14. dbo.getOperatorDesc(qm.site, qm.create_by) as createByDesc,
  15. qm.method_remark,
  16. qm.update_date,
  17. qm.update_by,
  18. dbo.getOperatorDesc(qm.site, qm.update_by) as updateByDesc,
  19. qm.inspection_type_no,
  20. qit.inspection_type_name
  21. FROM qc_method as qm
  22. LEFT JOIN qc_inspection_type as qit on qm.site = qit.site and qm.inspection_type_no = qit.inspection_type_no
  23. <where>
  24. <if test="query.site != null and query.site != ''">
  25. AND qm.site = #{query.site}
  26. </if>
  27. <if test="query.methodNo != null and query.methodNo != ''">
  28. AND qm.method_no LIKE '%' + #{query.methodNo} +'%'
  29. </if>
  30. <if test="query.methodName != null and query.methodName != ''">
  31. AND qm.method_name LIKE '%' + #{query.methodName} +'%'
  32. </if>
  33. <if test="query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
  34. AND qm.inspection_type_no = #{query.inspectionTypeNo}
  35. </if>
  36. </where>
  37. </select>
  38. <!-- 获得检验方法单号 -->
  39. <select id="getMethodNo" resultType="string" parameterType="com.heai.modules.pms.data.QcMethodData">
  40. SELECT
  41. Right('0000' + convert(varchar(10),isnull(max(convert(INT,Right(method_no,4))),0)+1),4)
  42. FROM qc_method
  43. WHERE site = #{site} AND inspection_type_no = #{inspectionTypeNo} and bu_no = #{buNo}
  44. </select>
  45. <!-- 新增检验方法 -->
  46. <insert id="qcMethodSave" parameterType="com.heai.modules.pms.data.QcMethodData">
  47. INSERT INTO qc_method (site, bu_no, method_no, method_name, create_date, create_by, method_remark, update_date, update_by, inspection_type_no)
  48. VALUES (#{site}, #{buNo}, #{methodNo}, #{methodName}, GetDate(), #{createBy}, #{methodRemark}, getDate(), #{updateBy}, #{inspectionTypeNo})
  49. </insert>
  50. <!-- 修改检验方法 -->
  51. <update id="qcMethodUpdate" parameterType="com.heai.modules.pms.data.QcMethodData">
  52. UPDATE qc_method
  53. SET method_name = #{methodName},
  54. method_remark = #{methodRemark},
  55. update_date = getDate(),
  56. update_by = #{updateBy},
  57. inspection_type_no = #{inspectionTypeNo}
  58. WHERE site = #{site} and method_no = #{methodNo}
  59. </update>
  60. <!-- 检查方法是否在被项目使用 -->
  61. <select id="checkMethodIsUsed" parameterType="com.heai.modules.pms.data.QcMethodData" resultType="com.heai.modules.pms.data.EamPropertiesItemData">
  62. SELECT
  63. ItemNo
  64. FROM qc_method_item
  65. WHERE site = #{site} and method_no = #{methodNo} and bu_no = #{buNo}
  66. </select>
  67. <!-- 删除检验方法 -->
  68. <delete id="qcMethodDelete" parameterType="com.heai.modules.pms.data.QcMethodData">
  69. DELETE FROM qc_method
  70. WHERE site = #{site} and method_no = #{methodNo}
  71. </delete>
  72. <!-- ================================================= 检验项目 ================================================= -->
  73. <!-- 根据条件查询检验项目 -->
  74. <select id="qcItemSearch" parameterType="com.heai.modules.pms.data.QcItemData" resultType="com.heai.modules.pms.data.QcItemData">
  75. SELECT
  76. epi.site,
  77. epi.bu_no,
  78. epi.ItemNo,
  79. epi.ItemDesc,
  80. epi.DefaultValue,
  81. epi.ValueType,
  82. epi.ValueType_DB as valueTypeDb,
  83. epi.ValueChooseFlag,
  84. epi.CreatedDate,
  85. epi.CreatedBy,
  86. dbo.getOperatorDesc(epi.site, epi.CreatedBy) as createdByDesc,
  87. epi.MaxValue,
  88. epi.MinValue,
  89. epi.ItemRemark,
  90. epi.ItemType,
  91. epi.update_date,
  92. epi.update_by,
  93. dbo.getOperatorDesc(epi.site, epi.update_by) as updateByDesc,
  94. qm.method_no,
  95. qm.method_name,
  96. qm.method_remark,
  97. epi.inspection_type_no,
  98. qit.inspection_type_name,
  99. epi.item_sampling_quantity,
  100. epi.sampling_programme_no,
  101. qsip.sampling_programme_desc,
  102. epi.sampling_level_no,
  103. qsil.sampling_level_desc,
  104. epi.default_sampling_proportion,
  105. epi.collection_flag,
  106. epi.collection_source,
  107. epi.collection_method,
  108. CASE WHEN epi.collection_method = 'plc' THEN 'PLC'
  109. WHEN epi.collection_method = 'file' THEN '文件'
  110. WHEN epi.collection_method = 'image' THEN '图片'
  111. else '' end as collectionMethodDesc,
  112. epi.collection_condition,
  113. epi.collection_data_content
  114. FROM eam_properties_item as epi
  115. LEFT JOIN qc_method_item as qmi on epi.ItemNo = qmi.ItemNo and epi.site = qmi.site
  116. LEFT JOIN qc_method as qm on qmi.method_no = qm.method_no and qmi.site = qm.site
  117. LEFT JOIN qc_inspection_type as qit on qit.inspection_type_no = epi.inspection_type_no and qit.site = epi.site
  118. left join qc_sampling_inspection_programme as qsip on qsip.site = epi.site and qsip.sampling_programme_no = epi.sampling_programme_no
  119. left join qc_sampling_inspection_level as qsil on qsil.site = epi.site and qsil.sampling_level_no = epi.sampling_level_no
  120. <where>
  121. <if test="query.site != null and query.site != ''">
  122. AND epi.site LIKE '%' + #{query.site} +'%'
  123. </if>
  124. <if test="query.itemDesc != null and query.itemDesc != ''">
  125. AND epi.ItemDesc LIKE '%' + #{query.itemDesc} +'%'
  126. </if>
  127. <if test="query.itemNo != null and query.itemNo != ''">
  128. AND epi.ItemNo LIKE '%' + #{query.itemNo} +'%'
  129. </if>
  130. <if test="query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
  131. AND epi.inspection_type_no = #{query.inspectionTypeNo}
  132. </if>
  133. </where>
  134. </select>
  135. <!-- 检测是否存在该项目 -->
  136. <select id="checkQcItem" parameterType="com.heai.modules.pms.data.QcItemData" resultType="com.heai.modules.pms.data.QcItemData">
  137. SELECT ItemNo,
  138. ItemDesc
  139. FROM eam_properties_item
  140. WHERE site = #{site} and ItemNo = #{itemNo} and ItemType = #{itemType}
  141. </select>
  142. <!-- 获得检验项目单号 -->
  143. <select id="getItemNo" resultType="string" parameterType="com.heai.modules.pms.data.QcItemData">
  144. SELECT
  145. Right('0000' + convert(varchar(10),isnull(max(convert(INT,Right(ItemNo,4))),0)+1),4)
  146. FROM eam_properties_item
  147. WHERE site = #{site} and ItemType = 'D' and inspection_type_no = #{inspectionTypeNo} and bu_no = #{buNo}
  148. </select>
  149. <!-- 新增检验项目 -->
  150. <insert id="qcItemSave" parameterType="com.heai.modules.pms.data.QcItemData">
  151. INSERT INTO eam_properties_item (site,bu_no,ItemNo, ItemDesc, DefaultValue, ValueType, ValueType_DB, ValueChooseFlag, CreatedDate, CreatedBy, MaxValue, MinValue, ItemRemark, ItemType, update_date, update_by, inspection_type_no, item_sampling_quantity, sampling_programme_no, sampling_level_no, default_sampling_proportion, collection_flag, collection_source, collection_method, collection_condition, collection_data_content)
  152. VALUES (#{site},#{buNo}, #{itemNo}, #{itemDesc}, #{defaultValue}, #{valueType}, #{valueTypeDb}, #{valueChooseFlag}, GetDate(), #{createdBy}, #{maxValue,jdbcType=DECIMAL}, #{minValue,jdbcType=DECIMAL}, #{itemRemark}, #{itemType}, getDate(), #{updateBy}, #{inspectionTypeNo}, #{itemSamplingQuantity}, #{samplingProgrammeNo}, #{samplingLevelNo}, #{defaultSamplingProportion}, #{collectionFlag}, #{collectionSource}, #{collectionMethod}, #{collectionCondition}, #{collectionDataContent})
  153. </insert>
  154. <!-- 新增项目里的方法 -->
  155. <insert id="qcItemMethodSave" parameterType="com.heai.modules.pms.data.QcItemData">
  156. INSERT INTO qc_method_item (ItemNo, method_no, site,bu_no)
  157. VALUES (#{itemNo}, #{methodNo}, #{site},#{buNo})
  158. </insert>
  159. <!-- 修改检验项目 -->
  160. <update id="qcItemUpdate" parameterType="com.heai.modules.pms.data.QcItemData">
  161. UPDATE eam_properties_item
  162. SET ItemDesc = #{itemDesc},
  163. DefaultValue = #{defaultValue},
  164. ValueType = #{valueType},
  165. ValueType_DB = #{valueTypeDb},
  166. ValueChooseFlag = #{valueChooseFlag},
  167. MaxValue = #{maxValue,jdbcType=DECIMAL},
  168. MinValue = #{minValue,jdbcType=DECIMAL},
  169. ItemRemark = #{itemRemark},
  170. update_date = getDate(),
  171. update_by = #{updateBy},
  172. inspection_type_no = #{inspectionTypeNo},
  173. item_sampling_quantity = #{itemSamplingQuantity},
  174. sampling_programme_no = #{samplingProgrammeNo},
  175. sampling_level_no = #{samplingLevelNo},
  176. default_sampling_proportion = #{defaultSamplingProportion},
  177. collection_flag = #{collectionFlag},
  178. collection_source = #{collectionSource},
  179. collection_method = #{collectionMethod},
  180. collection_condition = #{collectionCondition},
  181. collection_data_content = #{collectionDataContent}
  182. WHERE site = #{site} and ItemNo = #{itemNo} and ItemType = #{itemType}
  183. </update>
  184. <!-- 修改项目中的方法 -->
  185. <update id="qcItemMethodUpdate" parameterType="com.heai.modules.pms.data.QcItemData">
  186. UPDATE qc_method_item
  187. SET method_no = #{methodNo}
  188. WHERE site = #{site} and ItemNo = #{itemNo}
  189. </update>
  190. <!-- 检查项目是否在被模板使用 -->
  191. <select id="checkItemIsUsed" parameterType="com.heai.modules.pms.data.QcItemData" resultType="com.heai.modules.pms.data.EamPropertiesModelDetailData">
  192. SELECT template_id
  193. FROM qc_template_detailed
  194. WHERE site = #{site} and ItemNo = #{itemNo} and bu_no = #{buNo}
  195. </select>
  196. <!-- 删除检验项目 -->
  197. <delete id="qcItemDelete" parameterType="com.heai.modules.pms.data.QcItemData">
  198. DELETE
  199. FROM eam_properties_item
  200. WHERE site = #{site} and ItemNo = #{itemNo} and ItemType = #{itemType}
  201. </delete>
  202. <!-- 删除项目-方法中间表数据 -->
  203. <delete id="qcItemMethodDelete" parameterType="com.heai.modules.pms.data.QcItemData">
  204. DELETE
  205. FROM qc_method_item
  206. WHERE site = #{site} and ItemNo = #{itemNo}
  207. </delete>
  208. <!-- ================================================= 质检员信息维护 ================================================= -->
  209. <!-- 查询质检员信息列表 -->
  210. <select id="inspectorSearch" resultType="com.heai.modules.pms.data.QcInspectorData">
  211. SELECT inspector_no,
  212. inspector_name,
  213. inspector_phone,
  214. inspector_type,
  215. inspector_active
  216. FROM qc_inspector
  217. </select>
  218. <!-- 检验是否已存在该质检员 -->
  219. <select id="checkInspector" resultType="com.heai.modules.pms.data.QcInspectorData">
  220. SELECT inspector_name
  221. FROM qc_inspector
  222. WHERE inspector_no = #{inspectorNo}
  223. </select>
  224. <!-- 新增质检员 -->
  225. <insert id="inspectorSave" parameterType="com.heai.modules.pms.data.QcInspectorData">
  226. INSERT INTO qc_inspector (inspector_no, inspector_name, inspector_phone, inspector_type, inspector_active, create_time)
  227. VALUES (#{inspectorNo}, #{inspectorName}, #{inspectorPhone}, #{inspectorType}, #{inspectorActive}, getDate())
  228. </insert>
  229. <!-- 修改质检员 -->
  230. <update id="inspectorUpdate" parameterType="com.heai.modules.pms.data.QcInspectorData">
  231. UPDATE qc_inspector
  232. SET inspector_name = #{inspectorName},
  233. inspector_phone = #{inspectorPhone},
  234. inspector_type = #{inspectorType},
  235. inspector_active = #{inspectorActive}
  236. WHERE inspector_no = #{inspectorNo}
  237. </update>
  238. <!-- 删除质检员 -->
  239. <delete id="inspectorDelete" parameterType="com.heai.modules.pms.data.QcInspectorData">
  240. DELETE FROM qc_inspector
  241. WHERE inspector_no = #{inspectorNo}
  242. </delete>
  243. <!-- ================================================= 抽样矩阵维护 ================================================= -->
  244. <!-- 查询抽样矩阵 -->
  245. <select id="samplingInspectionPlanSearch" parameterType="com.heai.modules.pms.data.QcSamplingInspectionPlanData" resultType="com.heai.modules.pms.data.QcSamplingInspectionPlanData">
  246. SELECT
  247. qsip.site,
  248. qsip.bu_no,
  249. qsip.sampling_plan_no,
  250. qsip.sampling_plan_desc,
  251. qsip.sampling_qty_no,
  252. qsiq.sampling_qty,
  253. qsiq.sampling_qty_desc,
  254. qsip.sampling_qty_rank_no,
  255. qsiqr.sampling_qty_rank_desc,
  256. qsiqr.min_qty,
  257. qsiqr.max_qty,
  258. qsip.sampling_level_no,
  259. qsil.sampling_level_desc,
  260. qsip.sampling_plan_active,
  261. case when qsip.sampling_plan_active = 'Y' then '是' when qsip.sampling_plan_active = 'N' then '否' else '' end as samplingPlanActiveDesc,
  262. qsip.create_date,
  263. qsip.create_by,
  264. dbo.getOperatorDesc(qsip.site, qsip.create_by) as createByDesc,
  265. qsip.update_date,
  266. qsip.update_by,
  267. dbo.getOperatorDesc(qsip.site, qsip.update_by) as updateByDesc
  268. FROM qc_sampling_inspection_plan as qsip
  269. LEFT JOIN qc_sampling_inspection_qty as qsiq ON qsip.sampling_qty_no = qsiq.sampling_qty_no and qsip.site = qsiq.site and qsip.bu_no = qsiq.bu_no
  270. LEFT JOIN qc_sampling_inspection_qty_rank as qsiqr ON qsip.sampling_qty_rank_no = qsiqr.sampling_qty_rank_no and qsip.site = qsiqr.site and qsip.bu_no = qsiqr.bu_no
  271. LEFT JOIN qc_sampling_inspection_level as qsil ON qsip.sampling_level_no = qsil.sampling_level_no and qsip.site = qsil.site and qsip.bu_no = qsil.bu_no
  272. <where>
  273. <if test="query.site != null and query.site != ''">
  274. AND qsip.site = #{query.site}
  275. </if>
  276. <if test="query.samplingQtyDesc != null and query.samplingQtyDesc != ''">
  277. AND qsiq.sampling_qty_desc LIKE '%' + #{query.samplingQtyDesc}+'%'
  278. </if>
  279. <if test="query.samplingLevelDesc != null and query.samplingLevelDesc != ''">
  280. AND qsil.sampling_level_desc LIKE '%' + #{query.samplingLevelDesc}+'%'
  281. </if>
  282. <if test="query.samplingPlanActive != null and query.samplingPlanActive != ''">
  283. AND qsip.sampling_plan_active = #{query.samplingPlanActive}
  284. </if>
  285. </where>
  286. </select>
  287. <!-- 根据三个编码查矩阵 -->
  288. <select id="selectSamplingPlanByNo" resultType="com.heai.modules.pms.data.QcSamplingInspectionPlanData" parameterType="com.heai.modules.pms.data.QcSamplingInspectionPlanData">
  289. SELECT
  290. site,
  291. bu_no,
  292. sampling_plan_no,
  293. sampling_qty_no,
  294. sampling_qty_rank_no,
  295. sampling_level_no,
  296. sampling_plan_active
  297. FROM qc_sampling_inspection_plan
  298. WHERE sampling_qty_no = #{samplingQtyNo} AND sampling_qty_rank_no = #{samplingQtyRankNo} AND sampling_level_no = #{samplingLevelNo} AND site = #{site} and bu_no = #{buNo}
  299. </select>
  300. <!-- 根据名称查矩阵 -->
  301. <select id="selectSamplingPlanByDesc" resultType="com.heai.modules.pms.data.QcSamplingInspectionPlanData" parameterType="com.heai.modules.pms.data.QcSamplingInspectionPlanData">
  302. SELECT
  303. site,
  304. bu_no,
  305. sampling_plan_no,
  306. sampling_qty_no,
  307. sampling_qty_rank_no,
  308. sampling_level_no,
  309. sampling_plan_active
  310. FROM qc_sampling_inspection_plan
  311. WHERE sampling_plan_desc = #{samplingPlanDesc} AND site = #{site} and bu_no = #{buNo}
  312. </select>
  313. <!-- 获取最大方矩阵编码 -->
  314. <select id="queryLastSamplingPlanNo" resultType="string" parameterType="com.heai.modules.pms.data.QcSamplingInspectionPlanData">
  315. SELECT top 1 sampling_plan_no
  316. FROM qc_sampling_inspection_plan
  317. where site = #{site} and bu_no = #{buNo}
  318. ORDER BY sampling_plan_no Desc
  319. </select>
  320. <!-- 新增抽样矩阵 -->
  321. <insert id="samplingInspectionPlanSave" parameterType="com.heai.modules.pms.data.QcSamplingInspectionPlanData">
  322. INSERT INTO qc_sampling_inspection_plan (site, bu_no, sampling_plan_no, sampling_plan_desc, sampling_qty_rank_no, sampling_level_no, sampling_qty_no, sampling_plan_active, create_date, create_by, update_date, update_by)
  323. VALUES (#{site}, #{buNo}, #{samplingPlanNo}, #{samplingPlanDesc}, #{samplingQtyRankNo}, #{samplingLevelNo}, #{samplingQtyNo}, #{samplingPlanActive}, getDate(), #{createBy}, getDate(), #{updateBy})
  324. </insert>
  325. <!-- 修改抽样矩阵 -->
  326. <update id="samplingInspectionPlanUpdate" parameterType="com.heai.modules.pms.data.QcSamplingInspectionPlanData">
  327. UPDATE qc_sampling_inspection_plan
  328. SET sampling_qty_rank_no = #{samplingQtyRankNo},
  329. sampling_level_no = #{samplingLevelNo},
  330. sampling_qty_no = #{samplingQtyNo},
  331. sampling_plan_active = #{samplingPlanActive},
  332. update_date = getDate(),
  333. update_by = #{updateBy}
  334. WHERE sampling_plan_no = #{samplingPlanNo} AND site = #{site} and bu_no = #{buNo}
  335. </update>
  336. <!-- 删除抽样矩阵 -->
  337. <delete id="samplingInspectionPlanDelete" parameterType="com.heai.modules.pms.data.QcSamplingInspectionPlanData">
  338. DELETE FROM qc_sampling_inspection_plan
  339. WHERE sampling_plan_no = #{samplingPlanNo} AND site = #{site} and bu_no = #{buNo}
  340. </delete>
  341. <!-- ================================================= 检验模板维护 ================================================= -->
  342. <!-- 查询模板 -->
  343. <select id="templateSearch" parameterType="com.heai.modules.pms.data.QcTemplateData" resultType="com.heai.modules.pms.data.QcTemplateData">
  344. SELECT
  345. qt.site,
  346. qt.bu_no,
  347. qt.template_id,
  348. qt.template_name,
  349. qt.template_remark,
  350. qt.template_type,
  351. qt.template_version,
  352. qt.sampling_programme_no,
  353. qsip.sampling_programme_Desc,
  354. qt.inspection_type_no,
  355. qit.inspection_type_name,
  356. qt.sampling_level_no,
  357. qsil.sampling_level_desc,
  358. qt.inspection_cycle,
  359. qt.create_time,
  360. qt.create_by,
  361. dbo.getOperatorDesc(qt.site, qt.create_by) as createByDesc,
  362. qt.update_date,
  363. qt.update_by,
  364. dbo.getOperatorDesc(qt.site, qt.update_by) as updateByDesc,
  365. qt.AQL,
  366. qt.AC,
  367. qt.RE,
  368. qt.default_sampling_quantity,
  369. qt.default_sampling_proportion
  370. FROM qc_template as qt
  371. LEFT JOIN qc_inspection_type as qit on qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
  372. LEFT JOIN qc_sampling_inspection_level as qsil on qt.sampling_level_no = qsil.sampling_level_no and qt.site = qsil.site and qt.bu_no = qsil.bu_no
  373. LEFT JOIN qc_sampling_inspection_programme as qsip on qt.sampling_programme_no = qsip.sampling_programme_no and qt.site = qsip.site and qt.bu_no = qsip.bu_no
  374. <where>
  375. <if test = "query.site != null and query.site != ''">
  376. AND qt.site = #{query.site}
  377. </if>
  378. <if test = "query.templateId != null and query.templateId != ''">
  379. AND qt.template_id LIKE '%' + #{query.templateId}+'%'
  380. </if>
  381. <if test = "query.templateName != null and query.templateName != ''">
  382. AND qt.template_name LIKE '%' + #{query.templateName}+'%'
  383. </if>
  384. <if test = "query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
  385. AND qt.inspection_type_no = #{query.inspectionTypeNo}
  386. </if>
  387. </where>
  388. order by qt.create_time desc
  389. </select>
  390. <!-- 获得检验模板单号 -->
  391. <select id="getTemplateNo" resultType="string" parameterType="com.heai.modules.pms.data.QcTemplateData">
  392. SELECT
  393. Right('0000' + convert(varchar(10),isnull(max(convert(INT,Right(template_id,3))),0)+1),3)
  394. FROM qc_template
  395. WHERE site = #{site} and inspection_type_no = #{inspectionTypeNo} and bu_no = #{buNo}
  396. </select>
  397. <!-- 新增模板 -->
  398. <insert id="templateSave" parameterType="com.heai.modules.pms.data.QcTemplateData">
  399. INSERT INTO qc_template (site,bu_no,template_id, template_name, template_version, template_remark, template_type, sampling_programme_no, inspection_type_no, create_time, create_by, sampling_level_no, inspection_cycle, AQL, AC, RE, default_sampling_quantity, default_sampling_proportion, update_date, update_by)
  400. VALUES (#{site},#{buNo}, #{templateId}, #{templateName},#{templateVersion}, #{templateRemark}, #{templateType}, #{samplingProgrammeNo}, #{inspectionTypeNo}, getDate(), #{createBy}, #{samplingLevelNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{aql}, #{ac}, #{re}, #{defaultSamplingQuantity}, #{defaultSamplingProportion}, getDate(), #{updateBy})
  401. </insert>
  402. <!-- 修改模板 -->
  403. <update id="templateUpdate" parameterType="com.heai.modules.pms.data.QcTemplateData">
  404. UPDATE qc_template
  405. SET template_name = #{templateName},
  406. template_version = #{templateVersion},
  407. template_remark = #{templateRemark},
  408. template_type = #{templateType},
  409. sampling_programme_no = #{samplingProgrammeNo},
  410. inspection_cycle = #{inspectionCycle},
  411. inspection_type_no = #{inspectionTypeNo},
  412. sampling_level_no = #{samplingLevelNo},
  413. AQL = #{aql},
  414. AC = #{ac},
  415. RE = #{re},
  416. default_sampling_quantity = #{defaultSamplingQuantity},
  417. default_sampling_proportion = #{defaultSamplingProportion},
  418. update_date = getDate(),
  419. update_by = #{updateBy}
  420. WHERE template_id = #{templateId} AND site = #{site}
  421. </update>
  422. <!-- 查询模板里的项目详情 -->
  423. <select id="templateDetailsSearch" resultType="com.heai.modules.pms.data.QcTemplateData">
  424. SELECT
  425. a.site,
  426. a.bu_no,
  427. a.template_id,
  428. a.ItemNo,
  429. b.ItemDesc,
  430. COALESCE(ad.default_value,a.default_value) AS default_value,
  431. b.ValueType,
  432. b.ValueType_DB,
  433. a.max_value,
  434. a.min_value,
  435. b.ItemRemark,
  436. b.ItemType,
  437. a.object_id,
  438. eo.objectDesc,
  439. b.item_sampling_quantity,
  440. b.sampling_programme_no,
  441. c.sampling_programme_desc,
  442. b.sampling_level_no,
  443. d.sampling_level_desc,
  444. b.default_sampling_proportion,a.order_id
  445. FROM qc_template_detailed a
  446. INNER JOIN eam_properties_item b ON a.ItemNo = b.ItemNo and a.site = b.site
  447. left join qc_part_attr_detailed ad on ad.item_no = b.ItemNo and b.site = ad.site and ad.attribute_no =#{attributeNo}
  448. left join qc_sampling_inspection_programme as c on b.site = c.site and b.sampling_programme_no = c.sampling_programme_no
  449. left join qc_sampling_inspection_level as d on b.site = d.site and b.sampling_level_no = d.sampling_level_no
  450. LEFT JOIN eam_object eo ON a.object_id = eo.ObjectID and a.site = b.site
  451. WHERE a.template_id = #{templateId} AND b.ItemType = #{itemType} and a.site = #{site}
  452. order by a.order_id,a.ItemNo
  453. </select>
  454. <!-- 查询模板里是否已存在该项目 -->
  455. <select id="selectItemDetails" resultType="com.heai.modules.pms.data.QcTemplateData">
  456. SELECT template_id,
  457. ItemNo,
  458. default_value,
  459. max_value,
  460. min_value
  461. FROM qc_template_detailed
  462. WHERE template_id = #{templateId} and ItemNo = #{itemNo} and site = #{site} and bu_no = #{buNo}
  463. </select>
  464. <!-- 查询项目的最大最小值 -->
  465. <select id="selectDetail" resultType="com.heai.modules.pms.data.QcTemplateData">
  466. SELECT ItemNo,
  467. DefaultValue,
  468. MaxValue,
  469. MinValue
  470. FROM eam_properties_item
  471. WHERE ItemNo = #{itemNo} and ItemType = #{itemType} and site = #{site}
  472. </select>
  473. <!-- 新增模板的检验项目 -->
  474. <insert id="addItemDetails" parameterType="com.heai.modules.pms.data.QcTemplateData">
  475. INSERT INTO qc_template_detailed (template_id, ItemNo, default_value, max_value, min_value, site, bu_no,order_id)
  476. VALUES (#{templateId}, #{itemNo}, #{defaultValue}, #{maxValue,jdbcType=DECIMAL}, #{minValue,jdbcType=DECIMAL}, #{site}, #{buNo},#{orderId})
  477. </insert>
  478. <!-- 删除模板的检验项目 -->
  479. <delete id="delItemDetails" >
  480. DELETE FROM qc_template_detailed
  481. WHERE template_id = #{templateId} and ItemNo = #{itemNo} and site = #{site} and bu_no = #{buNo}
  482. </delete>
  483. <!-- 获取当前模板不包含的项目 -->
  484. <select id="getItemList" resultType="com.heai.modules.pms.data.QcTemplateData">
  485. SELECT
  486. a.site,
  487. a.bu_no,
  488. a.itemNo,
  489. a.ItemDesc,
  490. a.DefaultValue,
  491. a.MaxValue,
  492. a.MinValue
  493. FROM eam_properties_item a
  494. LEFT JOIN qc_template_detailed b ON b.template_id = #{templateId} and b.ItemNo = a.ItemNo and a.site = b.site
  495. WHERE a.ItemType = #{itemType} and a.site = #{site} and b.template_id is null and dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) = #{inspectionTypeName}
  496. </select>
  497. <!-- 查询项目 -->
  498. <select id="getItem" resultType="com.heai.modules.pms.data.QcTemplateData">
  499. SELECT
  500. a.site,
  501. a.bu_no,
  502. a.itemNo,
  503. a.ItemDesc,
  504. a.DefaultValue,
  505. a.MaxValue,
  506. a.MinValue
  507. FROM eam_properties_item a
  508. LEFT JOIN qc_template_detailed b ON b.template_id = #{templateId} and b.ItemNo = a.ItemNo and a.site = b.site and a.bu_no = b.bu_no
  509. <where>
  510. a.ItemType = #{itemType} and a.site = #{site} and b.template_id is null and a.bu_no = #{buNo} and dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) = #{inspectionTypeName}
  511. <if test = "itemNo != null and itemNo != ''">
  512. AND a.ItemNo LIKE '%' + #{itemNo} + '%'
  513. </if>
  514. <if test = "itemDesc != null and itemDesc != ''">
  515. AND a.ItemDesc LIKE '%' + #{itemDesc} + '%'
  516. </if>
  517. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  518. AND a.inspection_type_no = #{inspectionTypeNo}
  519. </if>
  520. </where>
  521. </select>
  522. <!-- ===================== qc_part_attr_detailed 物料属性检验标准(site+attribute_no+item_no) ===================== -->
  523. <select id="partAttrDetailedSearch" resultType="com.heai.modules.pms.data.QcTemplateData">
  524. SELECT
  525. d.site,
  526. d.bu_no,
  527. d.attribute_no AS attributeNo,
  528. d.item_no AS itemNo,
  529. d.inspection_type_no AS inspectionTypeNo,
  530. b.ItemDesc,
  531. d.default_value AS defaultValue,
  532. b.ValueType AS valueType,
  533. b.ValueType_DB AS valueTypeDb,
  534. d.max_value AS maxValue,
  535. d.min_value AS minValue,
  536. b.ItemRemark AS itemRemark,
  537. b.ItemType AS itemType,
  538. d.object_id AS objectID,
  539. eo.objectDesc,
  540. d.order_id AS orderId
  541. FROM qc_part_attr_detailed d
  542. INNER JOIN eam_properties_item b ON d.item_no = b.ItemNo AND d.site = b.site
  543. LEFT JOIN eam_object eo ON d.object_id = eo.ObjectID AND d.site = b.site
  544. WHERE d.site = #{site}
  545. AND d.attribute_no = #{attributeNo}
  546. AND d.bu_no = #{buNo}
  547. ORDER BY d.order_id, d.item_no
  548. </select>
  549. <select id="getPartAttrItemList" resultType="com.heai.modules.pms.data.QcTemplateData">
  550. SELECT
  551. a.site,
  552. a.bu_no,
  553. a.itemNo,
  554. a.ItemDesc,
  555. a.DefaultValue,
  556. a.MaxValue,
  557. a.MinValue
  558. FROM eam_properties_item a
  559. LEFT JOIN qc_part_attr_detailed d
  560. ON d.site = a.site
  561. AND d.bu_no = #{buNo}
  562. AND d.attribute_no = #{attributeNo}
  563. AND d.item_no = a.ItemNo
  564. WHERE a.ItemType = #{itemType}
  565. AND a.site = #{site}
  566. AND a.bu_no = #{buNo}
  567. AND d.item_no IS NULL
  568. AND dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) = #{inspectionTypeName}
  569. </select>
  570. <select id="getPartAttrItem" resultType="com.heai.modules.pms.data.QcTemplateData">
  571. SELECT
  572. a.site,
  573. a.bu_no,
  574. a.itemNo,
  575. a.ItemDesc,
  576. a.DefaultValue,
  577. a.MaxValue,
  578. a.MinValue
  579. FROM eam_properties_item a
  580. LEFT JOIN qc_part_attr_detailed d
  581. ON d.site = a.site
  582. AND d.bu_no = #{buNo}
  583. AND d.attribute_no = #{attributeNo}
  584. AND d.item_no = a.ItemNo
  585. <where>
  586. a.ItemType = #{itemType}
  587. AND a.site = #{site}
  588. AND d.item_no IS NULL
  589. AND a.bu_no = #{buNo}
  590. AND dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) = #{inspectionTypeName}
  591. <if test="itemNo != null and itemNo != ''">
  592. AND a.ItemNo LIKE '%' + #{itemNo} + '%'
  593. </if>
  594. <if test="itemDesc != null and itemDesc != ''">
  595. AND a.ItemDesc LIKE '%' + #{itemDesc} + '%'
  596. </if>
  597. <if test="inspectionTypeNo != null and inspectionTypeNo != ''">
  598. AND a.inspection_type_no = #{inspectionTypeNo}
  599. </if>
  600. </where>
  601. </select>
  602. <select id="selectPartAttrItemDetails" resultType="com.heai.modules.pms.data.QcTemplateData">
  603. SELECT site, bu_no, attribute_no AS attributeNo, item_no AS itemNo
  604. FROM qc_part_attr_detailed
  605. WHERE site = #{site}
  606. AND bu_no = #{buNo}
  607. AND attribute_no = #{attributeNo}
  608. AND item_no = #{itemNo}
  609. </select>
  610. <insert id="insertPartAttrDetailed" parameterType="com.heai.modules.pms.data.QcTemplateData">
  611. INSERT INTO qc_part_attr_detailed
  612. (site, bu_no, attribute_no, item_no, inspection_type_no, default_value, max_value, min_value, object_id, order_id, create_time)
  613. VALUES
  614. (#{site}, #{buNo}, #{attributeNo}, #{itemNo}, #{inspectionTypeNo}, #{defaultValue}, #{maxValue,jdbcType=DECIMAL}, #{minValue,jdbcType=DECIMAL}, #{objectID}, #{orderId}, getDate())
  615. </insert>
  616. <delete id="deletePartAttrDetailed">
  617. DELETE FROM qc_part_attr_detailed
  618. WHERE site = #{site}
  619. AND bu_no = #{buNo}
  620. AND attribute_no = #{attributeNo}
  621. AND item_no = #{itemNo}
  622. </delete>
  623. <delete id="deletePartAttrDetailedAll" parameterType="com.heai.modules.pms.data.QcTemplateData">
  624. DELETE FROM qc_part_attr_detailed
  625. WHERE site = #{site}
  626. AND bu_no = #{buNo}
  627. AND attribute_no = #{attributeNo}
  628. </delete>
  629. <select id="getPartAttrDetailedMaxOrderId" resultType="java.lang.Integer">
  630. SELECT ISNULL(MAX(order_id), 0) + 1
  631. FROM qc_part_attr_detailed
  632. WHERE site = #{site}
  633. AND bu_no = #{buNo}
  634. AND attribute_no = #{attributeNo}
  635. </select>
  636. <select id="getUpPartAttrItemData" resultType="com.heai.modules.pms.data.QcTemplateData">
  637. SELECT TOP 1
  638. site,
  639. bu_no,
  640. attribute_no AS attributeNo,
  641. item_no AS itemNo,
  642. order_id AS orderId
  643. FROM qc_part_attr_detailed
  644. WHERE #{orderId} > order_id
  645. AND site = #{site}
  646. AND bu_no = #{buNo}
  647. AND attribute_no = #{attributeNo}
  648. ORDER BY order_id DESC
  649. </select>
  650. <select id="getDownPartAttrItemData" resultType="com.heai.modules.pms.data.QcTemplateData">
  651. SELECT TOP 1
  652. site,
  653. bu_no,
  654. attribute_no AS attributeNo,
  655. item_no AS itemNo,
  656. order_id AS orderId
  657. FROM qc_part_attr_detailed
  658. WHERE order_id > #{orderId}
  659. AND site = #{site}
  660. AND bu_no = #{buNo}
  661. AND attribute_no = #{attributeNo}
  662. ORDER BY order_id
  663. </select>
  664. <update id="updatePartAttrDetailedOrder">
  665. UPDATE qc_part_attr_detailed
  666. SET order_id = #{orderId}
  667. WHERE site = #{site}
  668. AND bu_no = #{buNo}
  669. AND attribute_no = #{attributeNo}
  670. AND item_no = #{itemNo}
  671. </update>
  672. <!-- 删除模板 -->
  673. <delete id="templateDelete" parameterType="com.heai.modules.pms.data.QcTemplateData">
  674. DELETE FROM qc_template
  675. WHERE template_id = #{templateId} AND site = #{site}
  676. </delete>
  677. <!-- 删除模板-项目中间表 -->
  678. <delete id="itemItemDelete" parameterType="com.heai.modules.pms.data.QcTemplateData">
  679. DELETE FROM qc_template_detailed
  680. WHERE template_id = #{templateId} and site = #{site}
  681. </delete>
  682. <!-- 搜索所有检验类型 -->
  683. <select id="inspectionTypeSearch" resultType="com.heai.modules.pms.data.QcInspectionTypeData" parameterType="com.heai.modules.pms.data.QcInspectionTypeData">
  684. SELECT inspection_type_no,
  685. inspection_type_name
  686. FROM qc_inspection_type
  687. WHERE site = #{site}
  688. </select>
  689. <!-- 搜索所有设备 -->
  690. <select id="objectSearch" resultType="com.heai.modules.pms.data.EamObjectData">
  691. SELECT
  692. ObjectID,
  693. ObjectDesc
  694. FROM eam_object
  695. WHERE Active = 'Y' and site = #{site} and bu_no = #{buNo}
  696. </select>
  697. <!-- 导入文件检验 -->
  698. <select id="getItemByItemNo" resultType="com.heai.modules.pms.data.EamPropertiesItemData" parameterType="com.heai.modules.pms.data.QcItemData">
  699. SELECT ItemDesc,
  700. ItemType
  701. FROM eam_properties_item
  702. WHERE ItemDesc = #{itemDesc}
  703. AND DefaultValue = #{defaultValue}
  704. AND MaxValue = #{maxValue}
  705. AND MinValue = #{minValue}
  706. AND ItemType = #{itemType}
  707. </select>
  708. <!-- 新增检验项目 -->
  709. <insert id="insertItem" parameterType="com.heai.modules.pms.data.EamPropertiesItemData">
  710. INSERT INTO eam_properties_item (ItemNo, ItemDesc,DefaultValue,ValueType,ValueType_DB, CreatedDate,CreatedBy,MaxValue, MinValue, ItemRemark,ItemType)
  711. VALUES(#{itemNo},#{itemDesc}, #{defaultValue}, #{valueType}, #{valueTypeDb}, GetDate(), #{createdBy}, #{maxValue,jdbcType=DECIMAL}, #{minValue,jdbcType=DECIMAL}, #{itemRemark}, #{itemType})
  712. </insert>
  713. <!-- &lt;!&ndash; 获取最大项目编码 &ndash;&gt;-->
  714. <!-- <select id="queryLastItemNo" resultType="string" parameterType="QcItemData">-->
  715. <!-- SELECT top 1 ItemNo-->
  716. <!-- FROM eam_properties_item-->
  717. <!-- WHERE ItemType = #{itemType}-->
  718. <!-- ORDER BY ItemNo Desc-->
  719. <!-- </select>-->
  720. <!-- 根据模板名称查询模板 -->
  721. <select id="selectTemplateByDesc" parameterType="com.heai.modules.pms.data.QcTemplateData" resultType="com.heai.modules.pms.data.QcTemplateData">
  722. SELECT template_id,
  723. template_name,
  724. template_version
  725. FROM qc_template
  726. WHERE template_name = #{templateName}
  727. AND site = #{site}
  728. AND template_version = #{templateVersion}
  729. </select>
  730. <delete id="delTemplateItem" parameterType="com.heai.modules.pms.data.QcTemplateData">
  731. delete qc_template_detailed
  732. WHERE template_id = #{templateId} and site = #{site} and bu_no = #{buNo}
  733. </delete>
  734. <!-- &lt;!&ndash; 修改项目明细的最大最小值 &ndash;&gt;-->
  735. <!-- <insert id="saveItemDetailed">-->
  736. <!-- INSERT INTO qc_template_detailed-->
  737. <!-- (site, bu_no, template_id, ItemNo, default_value, max_value, min_value)-->
  738. <!-- VALUES-->
  739. <!-- <foreach collection="list" item="item" separator=",">-->
  740. <!-- (#{item.site}, #{item.buNo}, #{item.templateId}, #{item.itemNo}, #{item.defaultValue}, #{item.maxValue,jdbcType=DECIMAL}, #{item.minValue,jdbcType=DECIMAL})-->
  741. <!-- </foreach>-->
  742. <!-- </insert>-->
  743. <!-- 修改项目明细的最大最小值 -->
  744. <insert id="saveItemDetailed">
  745. INSERT INTO qc_template_detailed
  746. (site, bu_no, template_id, ItemNo, default_value, max_value, min_value, order_id)
  747. VALUES
  748. (#{site}, #{buNo}, #{templateId}, #{itemNo}, #{defaultValue}, #{maxValue,jdbcType=DECIMAL}, #{minValue,jdbcType=DECIMAL},#{orderId})
  749. </insert>
  750. <!-- 查询项目明细 -->
  751. <select id="selectItem" resultType="com.heai.modules.pms.data.QcTemplateData">
  752. SELECT ItemNo,
  753. ItemDesc,
  754. DefaultValue,
  755. ValueType,
  756. ValueType_DB,
  757. MaxValue,
  758. MinValue,
  759. ItemRemark,
  760. ItemType,
  761. site,
  762. bu_no
  763. FROM eam_properties_item
  764. WHERE ItemNo = #{itemNo} AND ItemType = #{itemType} AND bu_no = #{buNo}
  765. </select>
  766. <!-- ================================================= 样本量维护 ================================================= -->
  767. <!-- 查询样本量 -->
  768. <select id="samplingQtySearch" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyData" resultType="com.heai.modules.pms.data.QcSamplingInspectionQtyData">
  769. SELECT
  770. site,
  771. bu_no,
  772. sampling_qty_no,
  773. sampling_qty_desc,
  774. sampling_qty,
  775. sampling_qty_remark,
  776. sampling_qty_active,
  777. case when sampling_qty_active = 'Y' then '是' when sampling_qty_active = 'N' then '否' else '' end as samplingQtyActiveDesc,
  778. create_date,
  779. create_by,
  780. dbo.getOperatorDesc(site, create_by) as createByDesc,
  781. update_date,
  782. update_by,
  783. dbo.getOperatorDesc(site, update_by) as updateByDesc
  784. FROM qc_sampling_inspection_qty
  785. <where>
  786. <if test="query.site != null and query.site != ''">
  787. AND site = #{query.site}
  788. </if>
  789. <if test="query.samplingQtyNo != null and query.samplingQtyNo != ''">
  790. AND sampling_qty_no LIKE '%' + #{query.samplingQtyNo} + '%'
  791. </if>
  792. <if test="query.samplingQtyDesc != null and query.samplingQtyDesc != ''">
  793. AND sampling_qty_desc LIKE '%' + #{query.samplingQtyDesc} + '%'
  794. </if>
  795. <if test="query.samplingQty != null">
  796. AND sampling_qty = #{query.samplingQty,jdbcType=DECIMAL}
  797. </if>
  798. <if test="query.samplingQtyActive != null and query.samplingQtyActive != ''">
  799. AND sampling_qty_active = #{query.samplingQtyActive}
  800. </if>
  801. </where>
  802. </select>
  803. <!-- 新增样本量 -->
  804. <insert id="samplingQtySave" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyData">
  805. INSERT INTO qc_sampling_inspection_qty (site, bu_no, sampling_qty_no, sampling_qty, sampling_qty_remark, sampling_qty_active, sampling_qty_desc, create_date, create_by, update_date, update_by)
  806. VALUES(#{site}, #{buNo}, #{samplingQtyNo}, #{samplingQty,jdbcType=DECIMAL}, #{samplingQtyRemark}, #{samplingQtyActive}, #{samplingQtyDesc}, getDate(), #{createBy}, getDate(), #{updateBy})
  807. </insert>
  808. <!-- 根据样本量字码查询样本量 -->
  809. <select id="selectSamplingQtyByDesc" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyData" resultType="com.heai.modules.pms.data.QcSamplingInspectionQtyData">
  810. SELECT
  811. site,
  812. bu_no,
  813. sampling_qty_no,
  814. sampling_qty_desc,
  815. sampling_qty,
  816. sampling_qty_remark,
  817. sampling_qty_active
  818. FROM qc_sampling_inspection_qty
  819. WHERE sampling_qty_desc = #{samplingQtyDesc} AND site = #{site} and bu_no = #{buNo}
  820. </select>
  821. <!-- 获取最大样本量编码 -->
  822. <select id="queryLastSamplingQtyNo" resultType="string" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyData">
  823. SELECT top 1 sampling_qty_no
  824. FROM qc_sampling_inspection_qty
  825. where site = #{site} and bu_no = #{buNo}
  826. ORDER BY sampling_qty_no Desc
  827. </select>
  828. <!-- 修改样本量 -->
  829. <update id="samplingQtyUpdate" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyData">
  830. UPDATE qc_sampling_inspection_qty
  831. SET sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  832. sampling_qty_desc = #{samplingQtyDesc},
  833. sampling_qty_remark = #{samplingQtyRemark},
  834. sampling_qty_active = #{samplingQtyActive},
  835. update_date = getDate(),
  836. update_by = #{updateBy}
  837. WHERE sampling_qty_no = #{samplingQtyNo} AND site = #{site} and bu_no = #{buNo}
  838. </update>
  839. <!-- 根据样本量编码查询矩阵 -->
  840. <select id="selectSamplingPlanBySamplingQtyNo" resultType="com.heai.modules.pms.data.QcSamplingInspectionPlanData" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyData">
  841. SELECT
  842. site,
  843. sampling_plan_no,
  844. sampling_qty_no,
  845. sampling_qty_rank_no,
  846. sampling_level_no,
  847. sampling_plan_active
  848. FROM qc_sampling_inspection_plan
  849. WHERE site = #{site} AND sampling_qty_no = #{samplingQtyNo} and bu_no = #{buNo}
  850. </select>
  851. <!-- 删除样本量 -->
  852. <delete id="samplingQtyDelete" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyData">
  853. DELETE FROM qc_sampling_inspection_qty
  854. WHERE site = #{site} AND sampling_qty_no = #{samplingQtyNo} AND sampling_qty_desc = #{samplingQtyDesc} and bu_no = #{buNo}
  855. </delete>
  856. <!-- ================================================= 批量级次维护 ================================================= -->
  857. <!-- 查询批量级次 -->
  858. <select id="samplingQtyRankSearch" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyRankData" resultType="com.heai.modules.pms.data.QcSamplingInspectionQtyRankData">
  859. SELECT
  860. site,
  861. bu_no,
  862. sampling_qty_rank_no,
  863. sampling_qty_rank_desc,
  864. min_qty,
  865. max_qty,
  866. sampling_qty_rank_active,
  867. case when sampling_qty_rank_active = 'Y' then '是' when sampling_qty_rank_active = 'N' then '否' else '' end as samplingQtyRankActiveDesc,
  868. sampling_qty_rank_Remark,
  869. create_date,
  870. create_by,
  871. dbo.getOperatorDesc(site, create_by) as createByDesc,
  872. update_date,
  873. update_by,
  874. dbo.getOperatorDesc(site, update_by) as updateByDesc
  875. FROM qc_sampling_inspection_qty_rank
  876. <where>
  877. <if test="query.site != null and query.site != ''">
  878. AND site = #{query.site}
  879. </if>
  880. <if test="query.samplingQtyRankNo != null and query.samplingQtyRankNo != ''">
  881. AND sampling_qty_rank_no LIKE '%' + #{query.samplingQtyRankNo}+'%'
  882. </if>
  883. <if test="query.samplingQtyRankDesc != null and query.samplingQtyRankDesc != ''">
  884. AND sampling_qty_rank_desc LIKE '%' + #{query.samplingQtyRankDesc}+'%'
  885. </if>
  886. <if test="query.samplingQtyRankActive != null and query.samplingQtyRankActive != ''">
  887. AND sampling_qty_rank_active = #{query.samplingQtyRankActive}
  888. </if>
  889. </where>
  890. </select>
  891. <!-- 根据名称查询批量级次 -->
  892. <select id="selectSamplingQtyRankByDesc" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyRankData" resultType="com.heai.modules.pms.data.QcSamplingInspectionQtyRankData">
  893. SELECT
  894. site,
  895. bu_no,
  896. sampling_qty_rank_no,
  897. sampling_qty_rank_desc,
  898. min_qty,
  899. max_qty,
  900. sampling_qty_rank_active,
  901. sampling_qty_rank_Remark
  902. FROM qc_sampling_inspection_qty_rank
  903. WHERE sampling_qty_rank_desc = #{samplingQtyRankDesc} AND site = #{site} and bu_no = #{buNo}
  904. </select>
  905. <!-- 获取最大批量级次编码 -->
  906. <select id="queryLastSamplingQtyRankNo" resultType="string" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyRankData">
  907. SELECT top 1 sampling_qty_rank_no
  908. FROM qc_sampling_inspection_qty_rank
  909. where site = #{site} and bu_no = #{buNo}
  910. ORDER BY sampling_qty_rank_no Desc
  911. </select>
  912. <!-- 新增批量级次 -->
  913. <insert id="samplingQtyRankSave" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyRankData">
  914. INSERT INTO qc_sampling_inspection_qty_rank (site, bu_no, sampling_qty_rank_no, sampling_qty_rank_desc, min_qty, max_qty, sampling_qty_rank_Remark, sampling_qty_rank_active, create_date, create_by, update_date, update_by)
  915. VALUES(#{site}, #{buNo}, #{samplingQtyRankNo}, #{samplingQtyRankDesc}, #{minQty,jdbcType=DECIMAL}, #{maxQty,jdbcType=DECIMAL}, #{samplingQtyRankRemark}, #{samplingQtyRankActive}, getDate(), #{createBy}, getDate(), #{updateBy})
  916. </insert>
  917. <!-- 根据批量级次编码查询矩阵 -->
  918. <select id="selectSamplingPlanBySamplingQtyRankNo" resultType="com.heai.modules.pms.data.QcSamplingInspectionPlanData" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyRankData">
  919. SELECT
  920. site,
  921. bu_no,
  922. sampling_plan_no,
  923. sampling_qty_no,
  924. sampling_qty_rank_no,
  925. sampling_level_no,
  926. sampling_plan_active
  927. FROM qc_sampling_inspection_plan
  928. WHERE site = #{site} AND sampling_qty_rank_no = #{samplingQtyRankNo} and bu_no = #{buNo}
  929. </select>
  930. <!-- 修改批量级次 -->
  931. <update id="samplingQtyRankUpdate" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyRankData">
  932. UPDATE qc_sampling_inspection_qty_rank
  933. SET sampling_qty_rank_desc = #{samplingQtyRankDesc},
  934. min_qty = #{minQty,jdbcType=DECIMAL},
  935. max_qty = #{maxQty,jdbcType=DECIMAL},
  936. sampling_qty_rank_Remark = #{samplingQtyRankRemark},
  937. sampling_qty_rank_active = #{samplingQtyRankActive},
  938. update_date = getDate(),
  939. update_by = #{updateBy}
  940. WHERE sampling_qty_rank_no = #{samplingQtyRankNo} AND site = #{site} and bu_no = #{buNo}
  941. </update>
  942. <!-- 删除批量级次 -->
  943. <delete id="samplingQtyRankDelete" parameterType="com.heai.modules.pms.data.QcSamplingInspectionQtyRankData">
  944. DELETE FROM qc_sampling_inspection_qty_rank
  945. WHERE site = #{site} and bu_no = #{buNo}
  946. AND sampling_qty_rank_no = #{samplingQtyRankNo}
  947. AND sampling_qty_rank_desc = #{samplingQtyRankDesc}
  948. </delete>
  949. <!-- ================================================= 检验等级维护 ================================================= -->
  950. <!-- 查询检验等级 -->
  951. <select id="samplingLevelSearch" parameterType="com.heai.modules.pms.data.QcSamplingInspectionLevelData" resultType="com.heai.modules.pms.data.QcSamplingInspectionLevelData">
  952. SELECT
  953. site,
  954. bu_no,
  955. sampling_level_no,
  956. sampling_level_desc,
  957. sampling_level_remark,
  958. sampling_level_active,
  959. case when sampling_level_active = 'Y' then '是' when sampling_level_active = 'N' then '否' else '' end as samplingLevelActiveDesc,
  960. create_date,
  961. create_by,
  962. dbo.getOperatorDesc(site, create_by) as createByDesc,
  963. update_date,
  964. update_by,
  965. dbo.getOperatorDesc(site, update_by) as updateByDesc
  966. FROM qc_sampling_inspection_level
  967. <where>
  968. <if test="query.site != null and query.site != ''">
  969. AND site = #{query.site}
  970. </if>
  971. <if test="query.samplingLevelNo != null and query.samplingLevelNo != ''">
  972. AND sampling_level_no LIKE '%' + #{query.samplingLevelNo}+'%'
  973. </if>
  974. <if test="query.samplingLevelDesc != null and query.samplingLevelDesc != ''">
  975. AND sampling_level_desc LIKE '%' + #{query.samplingLevelDesc}+'%'
  976. </if>
  977. <if test="query.samplingLevelActive != null and query.samplingLevelActive != ''">
  978. AND sampling_level_active = #{query.samplingLevelActive}
  979. </if>
  980. </where>
  981. </select>
  982. <!-- 根据名称查询检验等级 -->
  983. <select id="selectSamplingLevelByDesc" parameterType="com.heai.modules.pms.data.QcSamplingInspectionLevelData" resultType="com.heai.modules.pms.data.QcSamplingInspectionLevelData">
  984. SELECT
  985. site,
  986. bu_no,
  987. sampling_level_no,
  988. sampling_level_desc,
  989. sampling_level_remark,
  990. sampling_level_active
  991. FROM qc_sampling_inspection_level
  992. WHERE sampling_level_desc = #{samplingLevelDesc} AND site = #{site} and bu_no = #{buNo}
  993. </select>
  994. <!-- 获取最大检验等级编码 -->
  995. <select id="queryLastSamplingLevelNo" resultType="string" parameterType="com.heai.modules.pms.data.QcSamplingInspectionLevelData">
  996. SELECT top 1 sampling_level_no
  997. FROM qc_sampling_inspection_level
  998. where site = #{site} and bu_no = #{buNo}
  999. ORDER BY sampling_level_no Desc
  1000. </select>
  1001. <!-- 新增检验等级 -->
  1002. <insert id="samplingLevelSave" parameterType="com.heai.modules.pms.data.QcSamplingInspectionLevelData">
  1003. INSERT INTO qc_sampling_inspection_level (site, bu_no, sampling_level_no, sampling_level_desc, sampling_level_remark, sampling_level_active, create_date, create_by, update_date, update_by)
  1004. VALUES (#{site}, #{buNo}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingLevelRemark}, #{samplingLevelActive}, getDate(), #{createBy}, getDate(), #{updateBy})
  1005. </insert>
  1006. <!-- 根据检验等级编码查询矩阵 -->
  1007. <select id="selectSamplingPlanBySamplingLevelNo" resultType="com.heai.modules.pms.data.QcSamplingInspectionPlanData" parameterType="com.heai.modules.pms.data.QcSamplingInspectionLevelData">
  1008. SELECT
  1009. site,
  1010. bu_no,
  1011. sampling_plan_no,
  1012. sampling_qty_no,
  1013. sampling_qty_rank_no,
  1014. sampling_level_no,
  1015. sampling_plan_active
  1016. FROM qc_sampling_inspection_plan
  1017. WHERE site = #{site} and bu_no = #{buNo}
  1018. AND sampling_level_no = #{samplingLevelNo}
  1019. </select>
  1020. <!-- 修改检验等级 -->
  1021. <update id="samplingLevelUpdate" parameterType="com.heai.modules.pms.data.QcSamplingInspectionLevelData">
  1022. UPDATE qc_sampling_inspection_level
  1023. SET sampling_level_desc = #{samplingLevelDesc},
  1024. sampling_level_remark = #{samplingLevelRemark},
  1025. sampling_level_active = #{samplingLevelActive},
  1026. update_date = getDate(),
  1027. update_by = #{updateBy}
  1028. WHERE sampling_level_no = #{samplingLevelNo}
  1029. AND site = #{site} and bu_no = #{buNo}
  1030. </update>
  1031. <!-- 删除检验等级 -->
  1032. <delete id="samplingLevelDelete" parameterType="com.heai.modules.pms.data.QcSamplingInspectionLevelData">
  1033. DELETE FROM qc_sampling_inspection_level
  1034. WHERE site = #{site} and bu_no = #{buNo}
  1035. AND sampling_level_no = #{samplingLevelNo}
  1036. AND sampling_level_desc = #{samplingLevelDesc}
  1037. </delete>
  1038. <!-- ================================================= 物料属性设置维护 ================================================= -->
  1039. <!-- 查询物料属性 -->
  1040. <select id="qcPartAttributeSearch" parameterType="com.heai.modules.pms.data.QcPartAttributeData" resultType="com.heai.modules.pms.data.QcPartAttributeData">
  1041. SELECT
  1042. qa.site,
  1043. qa.bu_no,
  1044. p.PartNo as partNo,
  1045. p.PartDescription as partDesc,
  1046. p.cinv_source_code as cinvSourceCode,
  1047. p.sku as sku,
  1048. p.FamilyID,
  1049. p.invtype as familyName,
  1050. p.spec,
  1051. p.umid,
  1052. qa.supplier_no,
  1053. dbo.qc_get_supplier_name(qa.site, qa.supplier_no) as supplierDesc,
  1054. qa.attribute_remark,
  1055. qa.create_time,
  1056. qa.create_by,
  1057. dbo.getOperatorDesc(qa.site, qa.create_by) as createByDesc,
  1058. qa.attribute_type,
  1059. qa.update_date,
  1060. qa.update_by,
  1061. dbo.getOperatorDesc(qa.site, qa.update_by) as updateByDesc,
  1062. qa.exempt_inspection,
  1063. qa.iqc_exempt as iqcExempt,
  1064. qa.fai_exempt as faiExempt,
  1065. qa.ipqc_exempt as ipqcExempt,
  1066. qa.pqc_exempt as pqcExempt,
  1067. qa.fqc_exempt as fqcExempt,
  1068. qa.oqc_exempt as oqcExempt,
  1069. qa.sqc_exempt as sqcExempt,
  1070. qa.First_IPQC_Patrol_time as firstIPQCPatrolTime,
  1071. qa.Last_IPQC_Patrol_time as lastIPQCPatrolTime,
  1072. qa.Cycle_IPQC_Patrol_time as cycleIPQCPatrolTime,
  1073. qa.defaultValue,
  1074. qa.standardValue,
  1075. qa.maxValue,
  1076. qa.minValue
  1077. FROM qc_part_attribute qa
  1078. INNER JOIN part p on qa.attribute_no = p.PartNo and qa.site = p.site
  1079. <where>
  1080. and qa.attribute_type = #{query.attributeType}
  1081. <if test = "query.partNo != null and query.partNo != ''">
  1082. AND qa.attribute_no LIKE '%' + #{query.partNo}+'%'
  1083. </if>
  1084. <if test = "query.partDesc != null and query.partDesc != ''">
  1085. AND p.PartDescription LIKE '%' + #{query.partDesc}+'%'
  1086. </if>
  1087. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  1088. AND p.cinv_source_code LIKE '%' + #{query.cinvSourceCode}+'%'
  1089. </if>
  1090. <if test = "query.sku != null and query.sku != ''">
  1091. AND p.sku LIKE '%' + #{query.sku}+'%'
  1092. </if>
  1093. <if test = "query.familyName != null and query.familyName != ''">
  1094. AND p.invtype LIKE '%' + #{query.familyName}+'%'
  1095. </if>
  1096. </where>
  1097. </select>
  1098. <!-- 查询是否已有该物料属性 -->
  1099. <select id="selectPartAttributeByNo" resultType="com.heai.modules.pms.data.QcPartAttributeData" parameterType="com.heai.modules.pms.data.QcPartAttributeData">
  1100. SELECT
  1101. attribute_no,
  1102. supplier_no,
  1103. attribute_remark,
  1104. attribute_type
  1105. FROM qc_part_attribute
  1106. WHERE site = #{site} and attribute_no = #{partNo} and attribute_type = #{attributeType} and bu_no = #{buNo}
  1107. </select>
  1108. <!-- 新增物料属性 -->
  1109. <insert id="qcPartAttributeSave" parameterType="com.heai.modules.pms.data.QcPartAttributeData">
  1110. INSERT INTO qc_part_attribute (attribute_no, supplier_no, attribute_remark, create_time, create_by, attribute_type, site, exempt_inspection, iqc_exempt, fai_exempt, ipqc_exempt, pqc_exempt, fqc_exempt, oqc_exempt, sqc_exempt, bu_no,First_IPQC_Patrol_time,Last_IPQC_Patrol_time,Cycle_IPQC_Patrol_time,defaultValue,standardValue,maxValue,minValue)
  1111. VALUES(#{partNo}, #{supplierNo}, #{attributeRemark}, getDate(), #{createBy}, #{attributeType}, #{site}, #{exemptInspection}, #{iqcExempt}, #{faiExempt}, #{ipqcExempt}, #{pqcExempt}, #{fqcExempt}, #{oqcExempt}, #{sqcExempt}, #{buNo},#{firstIPQCPatrolTime},#{lastIPQCPatrolTime},#{cycleIPQCPatrolTime},#{defaultValue},#{standardValue},#{maxValue},#{minValue})
  1112. </insert>
  1113. <!-- 物料属性修改 -->
  1114. <update id="qcPartAttributeEdit" parameterType="com.heai.modules.pms.data.QcPartAttributeData">
  1115. UPDATE qc_part_attribute
  1116. SET attribute_remark = #{attributeRemark},
  1117. exempt_inspection = #{exemptInspection},
  1118. iqc_exempt = #{iqcExempt},
  1119. fai_exempt = #{faiExempt},
  1120. ipqc_exempt = #{ipqcExempt},
  1121. pqc_exempt = #{pqcExempt},
  1122. fqc_exempt = #{fqcExempt},
  1123. oqc_exempt = #{oqcExempt},
  1124. sqc_exempt = #{sqcExempt},
  1125. update_date = getDate(),
  1126. update_by = #{updateBy},
  1127. defaultValue = #{defaultValue},
  1128. standardValue = #{standardValue},
  1129. maxValue = #{maxValue},
  1130. minValue = #{minValue},
  1131. First_IPQC_Patrol_time = #{firstIPQCPatrolTime},
  1132. Last_IPQC_Patrol_time = #{lastIPQCPatrolTime},
  1133. Cycle_IPQC_Patrol_time = #{cycleIPQCPatrolTime}
  1134. WHERE site = #{site} and attribute_no = #{partNo} and attribute_type = #{attributeType} and bu_no = #{buNo}
  1135. </update>
  1136. <update id="syncPartExemptFlagsFromQcPartAttribute" parameterType="com.heai.modules.pms.data.QcPartAttributeData">
  1137. UPDATE part
  1138. SET iqc_exempt = #{iqcExempt},
  1139. fai_exempt = #{faiExempt},
  1140. ipqc_exempt = #{ipqcExempt},
  1141. pqc_exempt = #{pqcExempt},
  1142. fqc_exempt = #{fqcExempt},
  1143. sqc_exempt = #{sqcExempt}
  1144. WHERE site = #{site} AND partNo = #{partNo}
  1145. </update>
  1146. <update id="resetPartExemptFlags">
  1147. UPDATE part
  1148. SET iqc_exempt = 'N',
  1149. fai_exempt = 'N',
  1150. ipqc_exempt = 'N',
  1151. pqc_exempt = 'N',
  1152. fqc_exempt = 'N',
  1153. sqc_exempt = 'N'
  1154. WHERE site = #{site} AND partNo = #{partNo}
  1155. </update>
  1156. <!-- 删除物料属性 -->
  1157. <delete id="qcPartAttributeDelete" parameterType="com.heai.modules.pms.data.QcPartAttributeData">
  1158. DELETE FROM qc_part_attribute
  1159. WHERE site = #{site} and bu_no = #{buNo} and attribute_no = #{partNo} and attribute_type = #{attributeType}
  1160. </delete>
  1161. <!-- 删除物料属性模板 -->
  1162. <delete id="deletePartAttributeTemplate" parameterType="com.heai.modules.pms.data.QcPartAttributeData">
  1163. DELETE FROM qc_attribute_template
  1164. WHERE site = #{site} and bu_no = #{buNo} and attribute_no = #{partNo} and attribute_type = #{attributeType}
  1165. </delete>
  1166. <!-- 查询类别模板 -->
  1167. <select id="searchPartAttributeDetails" resultType="com.heai.modules.pms.data.QcTemplateData" parameterType="com.heai.modules.pms.data.QcTemplateData">
  1168. SELECT
  1169. qat.site,
  1170. qat.bu_no,
  1171. qpa.attribute_no,
  1172. qpa.attribute_type,
  1173. qt.template_id,
  1174. qt.template_name,
  1175. qt.template_remark,
  1176. qt.template_version,
  1177. qat.sampling_programme_no,
  1178. qsip.sampling_programme_desc,
  1179. qat.AQL,
  1180. qat.AC,
  1181. qat.RE,
  1182. qt.inspection_type_no,
  1183. qit.inspection_type_name,
  1184. qt.default_sampling_quantity,
  1185. qt.default_sampling_proportion,
  1186. qat.sampling_level_no,
  1187. qsil.sampling_level_desc,
  1188. qat.inspection_cycle,
  1189. qat.operation,
  1190. qat.manufacturer_id,
  1191. qat.ipqc_inspection_method,
  1192. dbo.qc_get_supplier_name(qat.site, qat.manufacturer_id) as manufacturerName,
  1193. qat.resource_id
  1194. FROM qc_attribute_template as qat
  1195. LEFT JOIN qc_part_attribute as qpa ON qpa.attribute_no = qat.attribute_no and qat.site = qpa.site and qat.bu_no = qpa.bu_no
  1196. LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site and qat.bu_no = qt.bu_no
  1197. LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no and qat.site = qsil.site and qat.bu_no = qsil.bu_no
  1198. LEFT JOIN qc_inspection_type as qit ON qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
  1199. LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no and qat.site = qsip.site and qat.bu_no = qsip.bu_no
  1200. <where>
  1201. qat.site = #{site} and qpa.attribute_type = #{attributeType} and qpa.attribute_no = #{attributeNo} and qat.bu_no = #{buNo}
  1202. <if test="inspectionTypeNo !=null and inspectionTypeNo != ''">
  1203. and qt.inspection_type_no = #{inspectionTypeNo}
  1204. </if>
  1205. <if test="operation !=null and operation != ''">
  1206. and qat.operation = #{operation}
  1207. </if>
  1208. </where>
  1209. </select>
  1210. <!-- 物料属性模板查重 -->
  1211. <select id="searchPartRepeat" resultType="com.heai.modules.pms.data.QcTemplateData" parameterType="com.heai.modules.pms.data.QcTemplateData">
  1212. SELECT
  1213. attribute_no,
  1214. template_id
  1215. FROM qc_attribute_template
  1216. WHERE attribute_no = #{attributeNo}
  1217. AND template_id = #{templateId}
  1218. AND attribute_type = #{attributeType}
  1219. AND special_field = #{specialField}
  1220. </select>
  1221. <!-- 新增物料属性模板 -->
  1222. <insert id="savePartAttributeDetails" parameterType="com.heai.modules.pms.data.QcTemplateData">
  1223. INSERT INTO qc_attribute_template
  1224. (attribute_no, template_id, sampling_level_no, inspection_cycle, sampling_programme_no, AQL, AC, RE,
  1225. attribute_type, operation, manufacturer_id, resource_id, site, bu_no, inspection_type_no)
  1226. VALUES
  1227. (#{attributeNo}, #{templateId}, #{samplingLevelNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{samplingProgrammeNo}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL},
  1228. #{attributeType}, #{operation}, #{manufacturerID}, #{resourceID}, #{site}, #{buNo}, #{inspectionTypeNo})
  1229. </insert>
  1230. <!-- 可选模板 -->
  1231. <select id="getTemplateList" resultType="com.heai.modules.pms.data.QcTemplateData" parameterType="com.heai.modules.pms.data.QcTemplateData">
  1232. SELECT
  1233. qt.template_id,
  1234. qt.template_name,
  1235. qit.inspection_type_name
  1236. FROM qc_template as qt
  1237. LEFT JOIN qc_attribute_template as qat ON qat.template_id = qt.template_id and qat.attribute_no = #{attributeNo}
  1238. LEFT JOIN qc_inspection_type AS qit ON qt.inspection_type_no = qit.inspection_type_no
  1239. <where>
  1240. qt.site = #{site}
  1241. AND qat.attribute_no is null
  1242. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  1243. AND qt.inspection_type_no = #{inspectionTypeNo}
  1244. </if>
  1245. <if test = "templateId != null and templateId != ''">
  1246. AND qt.template_id LIKE '%' + #{templateId}+'%'
  1247. </if>
  1248. <if test = "templateName != null and templateName != ''">
  1249. AND qt.template_name LIKE '%' + #{templateName}+'%'
  1250. </if>
  1251. </where>
  1252. </select>
  1253. <!-- 已有模板 -->
  1254. <select id="getPartTemplateList" resultType="com.heai.modules.pms.data.QcTemplateData" parameterType="com.heai.modules.pms.data.QcTemplateData">
  1255. SELECT
  1256. qt.template_id,
  1257. qt.template_name,
  1258. qit.inspection_type_name,
  1259. qat.operation,
  1260. qat.manufacturer_id,
  1261. dbo.qc_get_supplier_name(qt.site, qat.manufacturer_id) as manufacturerName,
  1262. qat.resource_id
  1263. FROM qc_attribute_template as qat
  1264. LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site and qat.bu_no = qt.bu_no
  1265. LEFT JOIN qc_inspection_type AS qit ON qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
  1266. WHERE qt.site = #{site} AND qat.attribute_no = #{attributeNo} and qt.bu_no = #{buNo}
  1267. </select>
  1268. <select id="countPartTemplateByTemplateId" resultType="java.lang.Integer" parameterType="com.heai.modules.pms.data.QcTemplateData">
  1269. SELECT COUNT(1)
  1270. FROM qc_attribute_template
  1271. <where>
  1272. site = #{site}
  1273. and bu_no = #{buNo}
  1274. and attribute_no = #{attributeNo}
  1275. and attribute_type = #{attributeType}
  1276. and template_id = #{templateId}
  1277. </where>
  1278. </select>
  1279. <!-- 物料可选模板 -->
  1280. <select id="getTemplateListAll" resultType="com.heai.modules.pms.data.QcTemplateData" parameterType="com.heai.modules.pms.data.QcTemplateData">
  1281. SELECT
  1282. qt.template_id,
  1283. qt.template_name,
  1284. qit.inspection_type_name
  1285. FROM qc_template as qt
  1286. LEFT JOIN qc_inspection_type AS qit ON qt.inspection_type_no = qit.inspection_type_no and qt.site = qit.site
  1287. <where>
  1288. qt.site = #{site} and qt.bu_no = #{buNo}
  1289. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  1290. AND qt.inspection_type_no = #{inspectionTypeNo}
  1291. </if>
  1292. <if test = "templateId != null and templateId != ''">
  1293. AND qt.template_id LIKE '%' + #{templateId}+'%'
  1294. </if>
  1295. <if test = "templateName != null and templateName != ''">
  1296. AND qt.template_name LIKE '%' + #{templateName}+'%'
  1297. </if>
  1298. </where>
  1299. </select>
  1300. <!-- 删除物料属性模板 -->
  1301. <delete id="deletePartAttributeDetails" parameterType="com.heai.modules.pms.data.QcTemplateData">
  1302. DELETE FROM qc_attribute_template
  1303. <where>
  1304. site = #{site} and bu_no = #{buNo} and attribute_no = #{attributeNo} and template_id = #{templateId} and attribute_type = #{attributeType}
  1305. <if test = "operation != null and operation != ''">
  1306. and operation = #{operation}
  1307. </if>
  1308. <if test = "resourceID != null and resourceID != ''">
  1309. and resource_id = #{resourceID}
  1310. </if>
  1311. <if test = "manufacturerID != null and manufacturerID != ''">
  1312. and manufacturer_id = #{manufacturerID}
  1313. </if>
  1314. </where>
  1315. </delete>
  1316. <!-- 查询模板的基础数据 -->
  1317. <select id="selectTemplateData" resultType="com.heai.modules.pms.data.QcTemplateData" parameterType="com.heai.modules.pms.data.QcTemplateData">
  1318. SELECT
  1319. template_id,
  1320. template_name,
  1321. sampling_programme_no,
  1322. sampling_level_no,
  1323. inspection_cycle,
  1324. AQL,
  1325. AC,
  1326. RE,
  1327. inspection_type_no
  1328. FROM qc_template
  1329. WHERE site = #{site} AND template_id = #{templateId} and bu_no = #{buNo}
  1330. </select>
  1331. <!-- 新增物料属性模板详情 -->
  1332. <update id="saveAttributeDetailed" parameterType="com.heai.modules.pms.data.QcTemplateData">
  1333. UPDATE qc_attribute_template
  1334. SET sampling_level_no = #{samplingLevelNo},
  1335. inspection_cycle = #{inspectionCycle,jdbcType=DECIMAL},
  1336. sampling_programme_no = #{samplingProgrammeNo},
  1337. AQL = #{aql,jdbcType=DECIMAL},
  1338. AC = #{ac,jdbcType=DECIMAL},
  1339. ipqc_inspection_method = #{ipqcInspectionMethod},
  1340. RE = #{re,jdbcType=DECIMAL}
  1341. <where>
  1342. site = #{site} and attribute_no = #{attributeNo} AND template_id = #{templateId} AND attribute_type = #{attributeType} and bu_no = #{buNo}
  1343. <if test = "operation != null and operation != ''">
  1344. AND operation = #{operation}
  1345. </if>
  1346. <if test = "resourceID != null and resourceID != ''">
  1347. AND resource_id = #{resourceID}
  1348. </if>
  1349. <if test = "manufacturerID != null and manufacturerID != ''">
  1350. AND manufacturer_id = #{manufacturerID}
  1351. </if>
  1352. </where>
  1353. </update>
  1354. <!-- 更新物料属性修改时间 -->
  1355. <update id="updatePartAttributeTime" parameterType="com.heai.modules.pms.data.QcTemplateData">
  1356. UPDATE qc_part_attribute
  1357. SET update_date = getDate(),
  1358. update_by = #{updateBy}
  1359. WHERE site = #{site} and attribute_no = #{attributeNo} and attribute_type = #{attributeType} and bu_no = #{buNo}
  1360. </update>
  1361. <!-- ================================================= 类别属性设置维护 ================================================= -->
  1362. <!-- 查询类别属性 -->
  1363. <select id="qcFamilyAttributeSearch" parameterType="com.heai.modules.pms.data.QcPartAttributeData" resultType="com.heai.modules.pms.data.QcPartAttributeData">
  1364. SELECT
  1365. qa.site,
  1366. qa.bu_no,
  1367. qa.attribute_no as familyID,
  1368. pf.FamilyName,
  1369. qa.supplier_no,
  1370. qa.attribute_remark,
  1371. qa.create_time,
  1372. qa.create_by,
  1373. qa.update_date,
  1374. qa.update_by,
  1375. qa.attribute_type
  1376. FROM qc_part_attribute as qa
  1377. LEFT JOIN PartFamily as pf on qa.attribute_no = pf.FamilyID and qa.site = pf.site
  1378. <where>
  1379. and qa.attribute_type = #{query.attributeType}
  1380. <if test="query.site != null and query.site != ''">
  1381. AND site = #{query.site}
  1382. </if>
  1383. <if test = "query.familyID != null and query.familyID != ''">
  1384. AND qa.attribute_no LIKE '%' + #{query.familyID}+'%'
  1385. </if>
  1386. <if test = "query.familyName != null and query.familyName != ''">
  1387. AND pf.FamilyName LIKE '%' + #{query.familyName}+'%'
  1388. </if>
  1389. </where>
  1390. </select>
  1391. <!-- 新增类别属性 -->
  1392. <insert id="qcFamilyAttributeSave" parameterType="com.heai.modules.pms.data.QcPartAttributeData">
  1393. INSERT INTO qc_part_attribute (attribute_no, attribute_remark, create_time, create_by, attribute_type, site, bu_no)
  1394. VALUES(#{familyID}, #{attributeRemark}, getDate(), #{createBy}, #{attributeType}, #{site}, #{buNo})
  1395. </insert>
  1396. <!-- 删除分类属性 -->
  1397. <delete id="qcFamilyAttributeDelete" parameterType="com.heai.modules.pms.data.QcPartAttributeData">
  1398. DELETE FROM qc_part_attribute
  1399. WHERE site = #{site} and attribute_no = #{familyID} and attribute_type = #{attributeType} and bu_no = #{buNo}
  1400. </delete>
  1401. <!-- 删除分类属性模板 -->
  1402. <delete id="deleteFamilyAttributeTemplate" parameterType="com.heai.modules.pms.data.QcPartAttributeData">
  1403. DELETE FROM qc_attribute_template
  1404. WHERE site = #{site} and attribute_no = #{familyID} and attribute_type = #{attributeType} and bu_no = #{buNo}
  1405. </delete>
  1406. <!-- ================================================= 抽样方案维护 ================================================= -->
  1407. <!-- 查询类别属性 -->
  1408. <select id="samplingProgrammeSearch" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData" resultType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1409. SELECT
  1410. site,
  1411. bu_no,
  1412. sampling_programme_no,
  1413. sampling_programme_desc,
  1414. sampling_programme_code,
  1415. create_time,
  1416. create_by,
  1417. dbo.getOperatorDesc(site, create_by) as createByDesc,
  1418. update_date,
  1419. update_by,
  1420. dbo.getOperatorDesc(site, update_by) as updateByDesc
  1421. FROM qc_sampling_inspection_programme
  1422. <where>
  1423. <if test="query.site != null and query.site != ''">
  1424. AND site = #{query.site}
  1425. </if>
  1426. <if test = "query.samplingProgrammeNo != null and query.samplingProgrammeNo != ''">
  1427. AND sampling_programme_no LIKE '%' + #{query.samplingProgrammeNo}+'%'
  1428. </if>
  1429. <if test = "query.samplingProgrammeCode != null and query.samplingProgrammeCode != ''">
  1430. AND sampling_programme_code LIKE '%' + #{query.samplingProgrammeCode}+'%'
  1431. </if>
  1432. <if test = "query.samplingProgrammeDesc != null and query.samplingProgrammeDesc != ''">
  1433. AND sampling_programme_desc LIKE '%' + #{query.samplingProgrammeDesc}+'%'
  1434. </if>
  1435. </where>
  1436. </select>
  1437. <!-- 新增抽样方案 -->
  1438. <insert id="samplingProgrammeSave" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1439. INSERT INTO qc_sampling_inspection_programme (site, bu_no, sampling_programme_no, sampling_programme_desc, sampling_programme_code, create_time, create_by, update_date, update_by)
  1440. VALUES(#{site}, #{buNo}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{samplingProgrammeCode}, getDate(), #{createBy}, getDate(), #{updateBy})
  1441. </insert>
  1442. <!-- 删除抽样方案 -->
  1443. <delete id="samplingProgrammeDelete" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1444. DELETE FROM qc_sampling_inspection_programme
  1445. WHERE site = #{site} and bu_no = #{buNo}
  1446. AND sampling_programme_no = #{samplingProgrammeNo}
  1447. </delete>
  1448. <!-- 删除抽样方案中的矩阵 -->
  1449. <delete id="deletePlanByProgrammeNo" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1450. DELETE FROM qc_programme_plan
  1451. WHERE sampling_programme_no = #{samplingProgrammeNo} and site = #{site} and bu_no = #{buNo}
  1452. </delete>
  1453. <!-- 根据名称查询抽样方案 -->
  1454. <select id="selectSamplingProgrammeByDesc" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData" resultType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1455. SELECT
  1456. site,
  1457. bu_no,
  1458. sampling_programme_no,
  1459. sampling_programme_desc
  1460. FROM qc_sampling_inspection_programme
  1461. WHERE sampling_programme_desc = #{samplingProgrammeDesc} AND site = #{site} and bu_no = #{buNo}
  1462. </select>
  1463. <!-- 获取最大抽样方案编码 -->
  1464. <select id="queryLastSamplingProgrammeNo" resultType="string" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1465. SELECT top 1 sampling_programme_no
  1466. FROM qc_sampling_inspection_programme
  1467. where site = #{site} and bu_no = #{buNo}
  1468. ORDER BY sampling_programme_no Desc
  1469. </select>
  1470. <!-- 搜索抽样方案中的矩阵 -->
  1471. <select id="searchSamplingProgrammeDetails" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData" resultType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1472. SELECT
  1473. qpp.site,
  1474. qpp.bu_no,
  1475. qpp.sampling_programme_no,
  1476. qsip.sampling_plan_no,
  1477. qsip.sampling_plan_Desc,
  1478. qsip.sampling_qty_no,
  1479. qsiq.sampling_qty_desc,
  1480. qsiq.sampling_qty,
  1481. qsip.sampling_qty_rank_no,
  1482. qsiqr.sampling_qty_rank_desc,
  1483. qsiqr.min_qty,
  1484. qsiqr.max_qty,
  1485. qsip.sampling_level_no,
  1486. qsil.sampling_level_desc,
  1487. qsip.sampling_plan_active
  1488. FROM qc_programme_plan as qpp
  1489. LEFT JOIN qc_sampling_inspection_plan as qsip on qpp.sampling_plan_no = qsip.sampling_plan_no and qpp.site = qsip.site and qpp.bu_no = qsip.bu_no
  1490. LEFT JOIN qc_sampling_inspection_qty as qsiq on qsip.sampling_qty_no = qsiq.sampling_qty_no and qsip.site = qsiq.site and qsip.bu_no = qsiq.bu_no
  1491. LEFT JOIN qc_sampling_inspection_qty_rank as qsiqr on qsip.sampling_qty_rank_no = qsiqr.sampling_qty_rank_no and qsip.site = qsiqr.site and qsip.bu_no = qsiqr.bu_no
  1492. LEFT JOIN qc_sampling_inspection_level as qsil on qsip.sampling_level_no = qsil.sampling_level_no and qsip.site = qsil.site and qsip.bu_no = qsil.bu_no
  1493. WHERE qpp.sampling_programme_no = #{samplingProgrammeNo} and qpp.site = #{site} and qpp.bu_no = #{buNo}
  1494. </select>
  1495. <!-- 获取该方案不包含的矩阵 -->
  1496. <select id="getPlanList" resultType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1497. SELECT
  1498. qip.sampling_plan_no,
  1499. qip.sampling_plan_desc
  1500. FROM qc_sampling_inspection_plan as qip
  1501. LEFT JOIN qc_programme_plan as qpp ON qpp.sampling_plan_no = qip.sampling_plan_no and qpp.sampling_programme_no = #{samplingProgrammeNo} and qpp.site = qip.site and qpp.bu_no = qip.bu_no
  1502. WHERE qip.site = #{site} and qip.bu_no = #{buNo} AND qpp.sampling_programme_no is null
  1503. </select>
  1504. <!-- 获取当前方案所包含的矩阵 -->
  1505. <select id="getProgrammePlanList" resultType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1506. SELECT
  1507. qip.sampling_plan_no,
  1508. qip.sampling_plan_desc
  1509. FROM qc_programme_plan as qpp
  1510. LEFT JOIN qc_sampling_inspection_plan as qip ON qpp.sampling_plan_no = qip.sampling_plan_no and qpp.site = qip.site and qpp.bu_no = qip.bu_no
  1511. WHERE qip.site = #{site} and qip.bu_no = #{buNo} AND qpp.sampling_programme_no = #{samplingProgrammeNo}
  1512. </select>
  1513. <!-- 查重 -->
  1514. <select id="searchPlanRepeat" resultType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1515. SELECT
  1516. sampling_plan_no,
  1517. sampling_programme_no
  1518. FROM qc_programme_plan
  1519. WHERE sampling_programme_no = #{samplingProgrammeNo} AND sampling_plan_no = #{samplingPlanNo} and site = #{site} and bu_no = #{buNo}
  1520. </select>
  1521. <!-- 新增抽样方案中的矩阵 -->
  1522. <insert id="saveSamplingProgrammeDetails" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1523. INSERT INTO qc_programme_plan (site, bu_no, sampling_programme_no, sampling_plan_no)
  1524. VALUES (#{site}, #{buNo}, #{samplingProgrammeNo}, #{samplingPlanNo})
  1525. </insert>
  1526. <!-- 更新抽样方案修改时间 -->
  1527. <update id="updateSamplingInspectionProgrammeDate" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1528. UPDATE qc_sampling_inspection_programme
  1529. SET update_date = getDate(),
  1530. update_by = #{updateBy}
  1531. WHERE site = #{site} AND sampling_programme_no = #{samplingProgrammeNo} and bu_no = #{buNo}
  1532. </update>
  1533. <!-- 删除抽样方案中的矩阵 -->
  1534. <delete id="deleteSamplingProgrammeDetails" parameterType="com.heai.modules.pms.data.QcSamplingInspectionProgrammeData">
  1535. DELETE FROM qc_programme_plan
  1536. WHERE sampling_programme_no = #{samplingProgrammeNo} and sampling_plan_no = #{samplingPlanNo} and site = #{site} and bu_no = #{buNo}
  1537. </delete>
  1538. <!-- ================================================= FAI检验维护 ================================================= -->
  1539. <!-- 查询FAI基础数据 -->
  1540. <select id="selectFAIBasicData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  1541. SELECT
  1542. top 1
  1543. a.orderno as orderNo,
  1544. j.part_no,
  1545. j.part_desc,
  1546. c.operation_desc,
  1547. b.approve_qty as rollQty,
  1548. a.s_resourceid as resourceId,
  1549. DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
  1550. a.itemno as itemNo,
  1551. a.id as ssrId
  1552. FROM soscheduledrouting as a
  1553. LEFT JOIN sfdc as b
  1554. ON a.site = b.site and a.seqno = b.assjob_seq_no and b.id in (
  1555. select min(sfdc.id)
  1556. from sfdc
  1557. group by sfdc.assjob_seq_no, site
  1558. )
  1559. LEFT JOIN so_routing as c
  1560. ON c.site = a.site and c.order_no = a.orderno and a.itemno = c.item_no
  1561. LEFT JOIN part j
  1562. ON a.site = j.site and a.part_no = j.part_no
  1563. WHERE a.itemno = '10'
  1564. AND a.id not in (select ssr_id from qc_fai_record)
  1565. AND b.approve_qty is not null
  1566. ORDER BY a.id desc
  1567. </select>
  1568. <!-- 获取该物料属性下维护的iqc -->
  1569. <select id="selectPartAttributeByPartNo" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  1570. SELECT
  1571. qat.site,
  1572. qat.bu_no,
  1573. qat.attribute_no,
  1574. qat.template_id,
  1575. qat.sampling_level_no,
  1576. qsil.sampling_level_desc,
  1577. qat.inspection_cycle,
  1578. qat.sampling_programme_no,
  1579. qsip.sampling_programme_desc,
  1580. qat.AQL,
  1581. qat.AC,
  1582. qat.RE,
  1583. qt.default_sampling_quantity,
  1584. qt.default_sampling_proportion
  1585. FROM qc_attribute_template as qat
  1586. LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site and qat.bu_no = qt.bu_no
  1587. LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no and qat.site = qsil.site and qat.bu_no = qsil.bu_no
  1588. LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no and qat.site = qsip.site and qat.bu_no = qsip.bu_no
  1589. WHERE qat.site = #{site} and qat.bu_no = #{buNo}
  1590. AND qat.attribute_no = #{partNo}
  1591. AND qat.attribute_type = #{attributeType}
  1592. AND qt.inspection_type_no = #{inspectionTypeNo}
  1593. AND qat.manufacturer_id = #{supplierNo}
  1594. </select>
  1595. <!-- 获取该物料属性下维护的ipqc -->
  1596. <select id="selectPartAttributeByOperationAndResource" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  1597. SELECT
  1598. qat.site,
  1599. qat.bu_no,
  1600. qat.attribute_no,
  1601. qat.template_id,
  1602. qat.sampling_level_no,
  1603. qsil.sampling_level_desc,
  1604. qat.inspection_cycle,
  1605. qat.sampling_programme_no,
  1606. qsip.sampling_programme_desc,
  1607. qat.AQL,
  1608. qat.AC,
  1609. qat.RE,
  1610. qt.default_sampling_quantity,
  1611. qt.default_sampling_proportion
  1612. FROM qc_attribute_template as qat
  1613. LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site and qat.bu_no = qt.bu_no
  1614. LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no and qat.site = qsil.site and qat.bu_no = qsil.bu_no
  1615. LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no and qat.site = qsip.site and qat.bu_no = qsip.bu_no
  1616. WHERE qat.site = #{site} and qat.bu_no = #{buNo}
  1617. AND qat.attribute_no = #{partNo}
  1618. AND qat.attribute_type = #{attributeType1}
  1619. AND qt.inspection_type_no = #{inspectionTypeNo}
  1620. AND qat.operation = #{operationDesc}
  1621. AND qat.resource_id = #{resourceId}
  1622. </select>
  1623. <!-- 获取模板详情 -->
  1624. <select id="selectTemplate" resultType="com.heai.modules.pms.data.QcFAIRecordData" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  1625. SELECT
  1626. qt.site,
  1627. qt.bu_no,
  1628. qt.template_id,
  1629. qt.sampling_level_no,
  1630. qsil.sampling_level_desc,
  1631. qt.inspection_cycle,
  1632. qt.sampling_programme_no,
  1633. qsip.sampling_programme_desc,
  1634. qt.AQL,
  1635. qt.AC,
  1636. qt.RE,
  1637. qt.default_sampling_quantity,
  1638. qt.default_sampling_proportion
  1639. FROM qc_template as qt
  1640. LEFT JOIN qc_sampling_inspection_level as qsil ON qt.sampling_level_no = qsil.sampling_level_no and qt.site = qsil.site and qt.bu_no = qsil.bu_no
  1641. LEFT JOIN qc_sampling_inspection_programme as qsip ON qt.sampling_programme_no = qsip.sampling_programme_no and qt.site = qsip.site and qt.bu_no = qsip.bu_no
  1642. WHERE qt.site = #{site} and qt.template_id = #{templateId} and qt.bu_no = #{buNo}
  1643. </select>
  1644. <select id="selectAttrTemplate" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  1645. SELECT B.TransNo,B.Site,
  1646. B.ItemNo,
  1647. B.FromOpsID,
  1648. B.FromWorkCenterNo,
  1649. B.ToWorkCenterNo,
  1650. B.ToOpsID,
  1651. B.OrderNo,
  1652. B.PartNo,
  1653. B.TransQty,
  1654. B.ConfirmQty,
  1655. B.TaskNo,
  1656. B.InsStatus,
  1657. B.ToConfirmQty,
  1658. B.seqNo,
  1659. A.FromProLineNo,
  1660. A.ToProLineNo,
  1661. A.ToWarehouseID,
  1662. A.FromEnteredby,
  1663. A.FromEnteredDate,
  1664. A.TransDate,
  1665. A.ToReceiver,
  1666. A.FromReceiver,
  1667. A.FromRemark,
  1668. A.ToRemark,
  1669. A.ConfirmedFlag,
  1670. A.ToConfirmedBy,
  1671. A.ToEnteredby,
  1672. A.ToEnteredDate,
  1673. A.LatestUpdatedBy,
  1674. A.LatestUpdatedDate,
  1675. A.RecordVersion,
  1676. A.Status,
  1677. A.ToTypeFlag_DB,
  1678. A.ToTypeFlag,
  1679. A.ConfirmedTransNo,
  1680. A.need_inspect_flag,
  1681. A.inspected_flag,
  1682. A.inspect_result,
  1683. A.inspect_remark,
  1684. A.NeedReceiveFlag
  1685. FROM SOOpsTransferHeader A
  1686. INNER JOIN SOOpsTransferDetail B ON A.Site = B.SITE AND A.TransNo = B.TransNo
  1687. INNER JOIN qc_attribute_template e on D.SITE = B.site and D.attribute_no = B.PartNo
  1688. WHERE A.SITE = #{site} AND E.bu_no = #{buNo} AND B.TransNo = #{refInfo1} AND B.ItemNo = #{refInfo2} AND E.inspection_type_no =#{inspectionTypeNo}
  1689. <if test="operation != null and operation != ''">
  1690. AND E.operation = #{operation}
  1691. </if>
  1692. <if test="resourceId != null and resourceId != ''">
  1693. AND E.resource_id = #{resourceId}
  1694. </if>
  1695. </select>
  1696. <select id="selectAttrTemplateByPartNo" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  1697. SELECT
  1698. B.TransNo,B.Site,
  1699. B.ItemNo,
  1700. B.FromOpsID,
  1701. B.FromWorkCenterNo,
  1702. B.ToWorkCenterNo,
  1703. B.ToOpsID,
  1704. B.OrderNo,
  1705. B.PartNo,
  1706. B.TransQty,
  1707. B.ConfirmQty,
  1708. B.TaskNo,
  1709. B.InsStatus,
  1710. B.ToConfirmQty,
  1711. B.seqNo,
  1712. A.FromProLineNo,
  1713. A.ToProLineNo,
  1714. A.ToWarehouseID,
  1715. A.FromEnteredby,
  1716. A.FromEnteredDate,
  1717. A.TransDate,
  1718. A.ToReceiver,
  1719. A.FromReceiver,
  1720. A.FromRemark,
  1721. A.ToRemark,
  1722. A.ConfirmedFlag,
  1723. A.ToConfirmedBy,
  1724. A.ToEnteredby,
  1725. A.ToEnteredDate,
  1726. A.LatestUpdatedBy,
  1727. A.LatestUpdatedDate,
  1728. A.RecordVersion,
  1729. A.Status,
  1730. A.ToTypeFlag_DB,
  1731. A.ToTypeFlag,
  1732. A.ConfirmedTransNo,
  1733. A.need_inspect_flag,
  1734. A.inspected_flag,
  1735. A.inspect_result,
  1736. A.inspect_remark,
  1737. A.NeedReceiveFlag,
  1738. T.template_id, T.sampling_level_no, T.sampling_programme_no, D.UMID, D.PartDescription, SUM(B.TransQty) AS total_required_qty, ISNULL(T.iqc_exempt, 'N'), ISNULL(T.fai_exempt, 'N'), ISNULL(T.ipqc_exempt, 'N'), ISNULL(T.pqc_exempt, 'N'), ISNULL(T.fqc_exempt, 'N'), ISNULL(T.oqc_exempt, 'N')
  1739. FROM SOOpsTransferHeader A
  1740. LEFT JOIN SOOpsTransferDetail B ON A.Site = B.SITE AND A.TransNo = B.TransNo
  1741. INNER JOIN part D ON D.SITE = B.Site AND D.PartNo = B.PartNo
  1742. --采用最小颗粒度匹配原则(① 物料+工序+机台 ② 物料+工序 ③ 物料)
  1743. OUTER APPLY (
  1744. SELECT TOP 1 S.*,O. iqc_exempt,O.fqc_exempt,O.ipqc_exempt,O.pqc_exempt,O.oqc_exempt,O.fai_exempt FROM qc_attribute_template s
  1745. INNER JOIN qc_part_attribute O ON S.site = O.site AND S.bu_no = O.bu_no AND S.attribute_no = O.attribute_no
  1746. WHERE O.site = #{site} AND O.attribute_no = 'FP00003' AND inspection_type_no = '101' --AND ipqc_inspection_method = '首检'
  1747. AND (
  1748. (S.operation = #{operator} AND S.resource_id = #{resourceId}) -- ① 物料+工序+机台
  1749. OR (S.operation = #{operator} AND ( S.resource_id IS NULL OR S.resource_id ='') ) -- ② 物料+工序
  1750. OR ((S.operation IS NULL OR S.operation = '') AND (S.resource_id IS NULL OR S.resource_id ='' )) -- ③ 物料
  1751. )
  1752. ORDER BY
  1753. CASE
  1754. WHEN S.operation = #{operator} AND S.resource_id = #{resourceId} THEN 1
  1755. WHEN S.operation = #{operator} AND S.resource_id IS NULL THEN 2
  1756. WHEN S.operation IS NULL AND S.resource_id IS NULL THEN 3
  1757. ELSE 4
  1758. END
  1759. ) T
  1760. WHERE A.SITE = #{site} AND t.bu_no = #{buNo} AND A.TransNo = #{refInfo1} AND B.ItemNo =#{refInfo2}
  1761. GROUP BY B.OrderNo,B.PartNo,T.template_id,T.sampling_level_no,T.sampling_programme_no, D.UMID,D.PartDescription,T.iqc_exempt,T.fai_exempt,T.ipqc_exempt,T.pqc_exempt,T.fqc_exempt,T.oqc_exempt;
  1762. </select>
  1763. <select id="selectTemplateByPartNo" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  1764. WITH base_data AS (
  1765. SELECT DISTINCT
  1766. B.TransNo,B.Site,
  1767. B.ItemNo,
  1768. B.FromOpsID,
  1769. B.FromWorkCenterNo,
  1770. B.ToWorkCenterNo,
  1771. B.ToOpsID,
  1772. B.OrderNo,
  1773. B.PartNo,
  1774. B.TransQty,
  1775. B.ConfirmQty,
  1776. B.TaskNo,
  1777. B.InsStatus,
  1778. B.ToConfirmQty,
  1779. B.seqNo,
  1780. A.FromProLineNo,
  1781. A.ToProLineNo,
  1782. A.ToWarehouseID,
  1783. A.FromEnteredby,
  1784. A.FromEnteredDate,
  1785. A.TransDate,
  1786. A.ToReceiver,
  1787. A.FromReceiver,
  1788. A.FromRemark,
  1789. A.ToRemark,
  1790. A.ConfirmedFlag,
  1791. A.ToConfirmedBy,
  1792. A.ToEnteredby,
  1793. A.ToEnteredDate,
  1794. A.LatestUpdatedBy,
  1795. A.LatestUpdatedDate,
  1796. A.RecordVersion,
  1797. A.Status,
  1798. A.ToTypeFlag_DB,
  1799. A.ToTypeFlag,
  1800. A.ConfirmedTransNo,
  1801. A.need_inspect_flag,
  1802. A.inspected_flag,
  1803. A.inspect_result,
  1804. A.inspect_remark,
  1805. A.NeedReceiveFlag,
  1806. qt.bu_no,
  1807. qt.template_id,
  1808. qt.sampling_level_no,
  1809. qsil.sampling_level_desc,
  1810. qt.inspection_cycle,
  1811. qt.sampling_programme_no,
  1812. qsip.sampling_programme_desc,
  1813. qt.AQL,
  1814. qt.AC,
  1815. qt.RE,
  1816. qt.default_sampling_quantity,
  1817. qt.default_sampling_proportion,
  1818. e.operation as attr_operation,
  1819. e.resource_id as attr_resource_id
  1820. FROM SOOpsTransferHeader A
  1821. INNER JOIN SOOpsTransferDetail B ON A.Site = B.SITE AND A.TransNo = B.TransNo
  1822. INNER JOIN part D ON D.SITE = B.Site AND D.PartNo = B.PartNo
  1823. INNER JOIN qc_attribute_template e on D.SITE = e.site and e.attribute_no = D.PartNo
  1824. INNER JOIN qc_template as qt ON E.SITE = qt.site AND E.bu_no = QT.bu_no AND e.template_id = qt.template_id
  1825. LEFT JOIN qc_sampling_inspection_level as qsil ON qt.sampling_level_no = qsil.sampling_level_no and qt.site = qsil.site and qt.bu_no = qsil.bu_no
  1826. LEFT JOIN qc_sampling_inspection_programme as qsip ON qt.sampling_programme_no = qsip.sampling_programme_no and qt.site = qsip.site and qt.bu_no = qsip.bu_no
  1827. WHERE A.SITE = #{site} AND qt.bu_no = #{buNo} AND A.TransNo = #{refInfo1} AND B.ItemNo = #{refInfo2} AND E.inspection_type_no = #{inspectionTypeNo}
  1828. ),
  1829. candidate_data AS (
  1830. SELECT *,
  1831. CASE
  1832. WHEN (#{operator} IS NOT NULL AND #{operator} != '') AND (#{resourceId} IS NOT NULL AND #{resourceId} != '')
  1833. AND attr_operation = #{operator} AND attr_resource_id = #{resourceId} THEN 1
  1834. WHEN (#{operator} IS NOT NULL AND #{operator} != '') AND (#{resourceId} IS NOT NULL AND #{resourceId} != '')
  1835. AND attr_operation = #{operator} THEN 2
  1836. WHEN (#{operator} IS NOT NULL AND #{operator} != '') AND (#{resourceId} IS NOT NULL AND #{resourceId} != '')
  1837. AND attr_resource_id = #{resourceId} THEN 3
  1838. WHEN (#{operator} IS NOT NULL AND #{operator} != '') AND (#{resourceId} IS NOT NULL AND #{resourceId} != '') THEN 4
  1839. WHEN (#{operator} IS NOT NULL AND #{operator} != '') AND (#{resourceId} IS NULL OR #{resourceId} = '')
  1840. AND attr_operation = #{operator} THEN 1
  1841. WHEN (#{operator} IS NOT NULL AND #{operator} != '') AND (#{resourceId} IS NULL OR #{resourceId} = '') THEN 2
  1842. WHEN (#{operator} IS NULL OR #{operator} = '') AND (#{resourceId} IS NOT NULL AND #{resourceId} != '')
  1843. AND attr_resource_id = #{resourceId} THEN 1
  1844. WHEN (#{operator} IS NULL OR #{operator} = '') AND (#{resourceId} IS NOT NULL AND #{resourceId} != '') THEN 2
  1845. ELSE 1
  1846. END AS match_level
  1847. FROM base_data
  1848. )
  1849. SELECT
  1850. TransNo, Site, ItemNo, FromOpsID, FromWorkCenterNo, ToWorkCenterNo, ToOpsID, OrderNo, PartNo, TransQty, ConfirmQty, TaskNo,
  1851. InsStatus, ToConfirmQty, seqNo, FromProLineNo, ToProLineNo, ToWarehouseID, FromEnteredby, FromEnteredDate, TransDate, ToReceiver,
  1852. FromReceiver, FromRemark, ToRemark, ConfirmedFlag, ToConfirmedBy, ToEnteredby, ToEnteredDate, LatestUpdatedBy, LatestUpdatedDate,
  1853. RecordVersion, Status, ToTypeFlag_DB, ToTypeFlag, ConfirmedTransNo, need_inspect_flag, inspected_flag, inspect_result, inspect_remark,
  1854. NeedReceiveFlag, bu_no, template_id, sampling_level_no, sampling_level_desc, inspection_cycle, sampling_programme_no,
  1855. sampling_programme_desc, AQL, AC, RE, default_sampling_quantity, default_sampling_proportion
  1856. FROM candidate_data
  1857. WHERE match_level = (SELECT MIN(match_level) FROM candidate_data)
  1858. </select>
  1859. <select id="selectTemplateByPartNoForOverLoad" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  1860. WITH base_data AS (
  1861. SELECT DISTINCT
  1862. qt.site,
  1863. qt.bu_no,
  1864. qt.template_id,
  1865. qt.sampling_level_no,
  1866. qsil.sampling_level_desc,
  1867. qt.inspection_cycle,
  1868. qt.sampling_programme_no,
  1869. qsip.sampling_programme_desc,
  1870. qt.AQL,
  1871. qt.AC,
  1872. qt.RE,
  1873. qt.default_sampling_quantity,
  1874. qt.default_sampling_proportion,
  1875. e.operation AS attr_operation,
  1876. e.resource_id AS attr_resource_id
  1877. FROM part d
  1878. INNER JOIN qc_attribute_template e ON d.site = e.site AND d.partNo = e.attribute_no
  1879. INNER JOIN qc_template qt ON e.site = qt.site AND e.bu_no = qt.bu_no AND e.template_id = qt.template_id
  1880. LEFT JOIN qc_sampling_inspection_level qsil ON qt.sampling_level_no = qsil.sampling_level_no AND qt.site = qsil.site AND qt.bu_no = qsil.bu_no
  1881. LEFT JOIN qc_sampling_inspection_programme qsip ON qt.sampling_programme_no = qsip.sampling_programme_no AND qt.site = qsip.site AND qt.bu_no = qsip.bu_no
  1882. WHERE d.site = #{site}
  1883. AND e.bu_no = #{buNo}
  1884. AND d.partNo = #{partNo}
  1885. AND e.inspection_type_no = #{inspectionTypeNo}
  1886. ),
  1887. candidate_data AS (
  1888. SELECT *,
  1889. CASE
  1890. WHEN attr_operation = #{operator} THEN 1
  1891. WHEN attr_resource_id = #{resourceId} THEN 1
  1892. ELSE 2
  1893. END AS match_level
  1894. FROM base_data
  1895. )
  1896. SELECT
  1897. site,
  1898. bu_no,
  1899. template_id,
  1900. sampling_level_no,
  1901. sampling_level_desc,
  1902. inspection_cycle,
  1903. sampling_programme_no,
  1904. sampling_programme_desc,
  1905. AQL,
  1906. AC,
  1907. RE,
  1908. default_sampling_quantity,
  1909. default_sampling_proportion
  1910. FROM candidate_data
  1911. WHERE match_level = (SELECT MIN(match_level) FROM candidate_data)
  1912. </select>
  1913. <!-- 新增FAI主记录信息 -->
  1914. <insert id="saveFAIRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  1915. INSERT INTO qc_fai_record (inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id, part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id)
  1916. VALUES(#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId}, #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId})
  1917. </insert>
  1918. <insert id="saveFAIDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  1919. INSERT INTO qc_fai_detailed_record
  1920. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  1921. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  1922. max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
  1923. VALUES
  1924. (#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc},
  1925. #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL},
  1926. #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo},#{orderId,jdbcType=INTEGER})
  1927. </insert>
  1928. <!-- 新增FAI明细记录信息 -->
  1929. <insert id="saveFAIDetailedRecords">
  1930. INSERT INTO qc_fai_detailed_record
  1931. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  1932. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  1933. max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
  1934. VALUES
  1935. <foreach collection="list" item="item" separator=",">
  1936. (#{item.inspectionNo}, #{item.orderNo}, #{item.templateId}, #{item.samplingLevelNo}, #{item.samplingLevelDesc}, #{item.samplingProgrammeNo}, #{item.samplingProgrammeDesc},
  1937. #{item.aql,jdbcType=DECIMAL}, #{item.ac,jdbcType=DECIMAL}, #{item.re,jdbcType=DECIMAL}, #{item.itemNo}, #{item.itemDesc}, #{item.objectId}, #{item.objectDesc}, #{item.defaultValue}, #{item.minValue,jdbcType=DECIMAL},
  1938. #{item.maxValue,jdbcType=DECIMAL}, #{item.valueTypeDb}, #{item.valueType}, #{item.site}, #{item.samplingQty,jdbcType=DECIMAL}, #{item.buNo}, #{item.orderId})
  1939. </foreach>
  1940. </insert>
  1941. <!-- 查询FAI主记录信息 -->
  1942. <select id="qcFAIInspectionSearch" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  1943. SELECT
  1944. a.inspection_no,
  1945. a.site,
  1946. a.bu_no,
  1947. a.state,
  1948. a.inspection_result,
  1949. a.task_date,
  1950. a.inspection_type_no,
  1951. dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) as inspectionTypeName,
  1952. a.inspection_cycle,
  1953. a.order_no,
  1954. a.operation_desc,
  1955. a.resource_id,
  1956. r.resource_desc,
  1957. a.part_no,
  1958. d.PartDescription as partDesc,
  1959. d.cinv_source_code as cinvSourceCode,
  1960. d.sku as sku,
  1961. d.invdefinetype as invdefinetype,
  1962. a.inspection_remark,
  1963. a.roll_qty,
  1964. a.sampling_qty,
  1965. a.disposal_measures,
  1966. a.disposal_remark,
  1967. a.inspector_date,
  1968. a.inspector_no,
  1969. u.user_display as inspectorName,
  1970. a.ssr_id,
  1971. a.unqualified_qty,
  1972. a.submit_flag,
  1973. a.seq_no,
  1974. a.batch_roll_no,
  1975. a.special_requirements,
  1976. a.work_center_no,
  1977. a.roll_no,
  1978. a.um_id,
  1979. um.UMName as umName,
  1980. a.action_date,
  1981. a.action_by,
  1982. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  1983. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  1984. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  1985. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  1986. a.pass_qty,
  1987. a.not_pass_qty,
  1988. a.batch_qualified_qty,
  1989. a.receipt_no,
  1990. a.receipt_item_no,
  1991. a.ref_info1,
  1992. a.ref_info2,
  1993. a.ref_info3,
  1994. a.ref_info4,
  1995. a.ref_info5
  1996. FROM qc_fai_record as a
  1997. left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.PartNo
  1998. left join sys_user as u on a.inspector_no = u.username
  1999. left join resource as r on a.site = r.site and a.resource_id = r.resource_id and a.work_center_no = r.work_center_no
  2000. left join UM as um on a.site = um.site and a.um_id = um.UMID
  2001. <where>
  2002. <if test="query.site != null and query.site != ''">
  2003. AND a.site = #{query.site}
  2004. </if>
  2005. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  2006. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  2007. </if>
  2008. <if test = "query.partNo != null and query.partNo != ''">
  2009. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  2010. </if>
  2011. <if test = "query.partDesc != null and query.partDesc != ''">
  2012. AND d.PartDescription LIKE '%' + #{query.partDesc} + '%'
  2013. </if>
  2014. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  2015. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  2016. </if>
  2017. <if test = "query.sku != null and query.sku != ''">
  2018. AND d.sku LIKE '%' + #{query.sku} + '%'
  2019. </if>
  2020. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  2021. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  2022. </if>
  2023. <if test = "query.states != null and query.states.size > 0">
  2024. AND a.state in
  2025. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  2026. #{item}
  2027. </foreach>
  2028. </if>
  2029. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  2030. AND a.inspection_result = #{query.inspectionResult}
  2031. </if>
  2032. <if test = "query.orderNo != null and query.orderNo != ''">
  2033. AND a.order_no LIKE '%' + #{query.orderNo} + '%'
  2034. </if>
  2035. <if test = "query.seqNo != null and query.seqNo != ''">
  2036. AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
  2037. </if>
  2038. <if test = "query.operationDesc != null and query.operationDesc != ''">
  2039. AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
  2040. </if>
  2041. <if test="query.startDate != null">
  2042. AND a.inspector_date >= #{query.startDate}
  2043. </if>
  2044. <if test="query.endDate != null">
  2045. AND #{query.endDate} >= a.inspector_date
  2046. </if>
  2047. <if test="query.startDate2 != null">
  2048. AND a.task_date >= #{query.startDate2}
  2049. </if>
  2050. <if test="query.endDate2 != null">
  2051. AND #{query.endDate2} >= a.task_date
  2052. </if>
  2053. </where>
  2054. ORDER BY
  2055. CASE WHEN a.state = '待检验' THEN 1
  2056. WHEN a.state = '待审核' THEN 2
  2057. WHEN a.state = '已完成' THEN 3
  2058. END, a.task_date desc
  2059. </select>
  2060. <!-- 获取物料的类别编码 -->
  2061. <select id="selectFamilyIdByPartNo" parameterType="string" resultType="string">
  2062. SELECT FamilyID
  2063. FROM part
  2064. WHERE PartNo = #{partNo} AND site = #{site}
  2065. </select>
  2066. <!-- FAI明细记录查询 -->
  2067. <select id="faiDetailSearch" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  2068. SELECT
  2069. a.site,
  2070. a.bu_no,
  2071. a.inspection_no,
  2072. a.order_no,
  2073. a.template_id,
  2074. a.sampling_level_no,
  2075. a.sampling_level_desc,
  2076. a.sampling_programme_no,
  2077. a.sampling_programme_desc,
  2078. a.AQL,
  2079. a.AC,
  2080. a.RE,
  2081. a.item_no,
  2082. a.item_desc,
  2083. a.object_id,
  2084. a.object_desc,
  2085. a.default_value,
  2086. a.min_value,
  2087. a.max_value,
  2088. a.text_value,
  2089. a.number_value,
  2090. a.value_type_db,
  2091. a.value_type,
  2092. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  2093. a.is_submit,
  2094. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  2095. a.sampling_qty,
  2096. dbo.qc_get_fai_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
  2097. c.method_no,
  2098. c.method_name,
  2099. c.method_remark,
  2100. (
  2101. SELECT COUNT(*)
  2102. FROM sys_oss
  2103. WHERE order_ref1 = a.site and order_ref2 = a.inspection_no and order_ref3 = a.item_no and order_ref4 = a.bu_no
  2104. ) AS imageDetailNum
  2105. FROM qc_fai_detailed_record as a
  2106. LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
  2107. LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
  2108. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  2109. order by a.order_id
  2110. </select>
  2111. <!-- 修改FAI主记录信息 -->
  2112. <update id="updateFAIMasterRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2113. UPDATE qc_fai_record
  2114. SET disposal_measures = #{disposalMeasures},
  2115. disposal_remark = #{disposalRemark},
  2116. inspection_result = #{inspectionResult},
  2117. inspector_no = #{inspectorNo},
  2118. state = #{state},
  2119. inspection_remark = #{inspectionRemark},
  2120. inspector_date = getDate(),
  2121. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2122. roll_qty = #{rollQty,jdbcType=DECIMAL},
  2123. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  2124. pass_qty = #{passQty,jdbcType=DECIMAL},
  2125. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  2126. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  2127. submit_date = getDate()
  2128. WHERE site = #{site} AND inspection_no = #{inspectionNo} and bu_no = #{buNo}
  2129. </update>
  2130. <!-- 修改FAI明细记录信息 -->
  2131. <update id="updateFAIDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2132. UPDATE qc_fai_detailed_record
  2133. SET item_result = #{itemResult},
  2134. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  2135. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2136. text_value = #{textValue},
  2137. number_value = #{numberValue,jdbcType=DECIMAL}
  2138. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2139. </update>
  2140. <!-- 修改子明细提交标识 -->
  2141. <update id="updateSubDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2142. UPDATE qc_fai_sub_detail_record
  2143. SET is_submit = 'Y'
  2144. WHERE inspection_no = #{inspectionNo}
  2145. </update>
  2146. <!-- 删除FAI检验记录 -->
  2147. <delete id="deleteFAIRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2148. DELETE FROM qc_fai_record
  2149. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2150. </delete>
  2151. <!-- 删除FAI明细记录信息 -->
  2152. <delete id="deleteFAIDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2153. DELETE FROM qc_fai_detailed_record
  2154. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2155. </delete>
  2156. <!-- 删除FAI子明细记录信息 -->
  2157. <delete id="deleteFAISubDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2158. DELETE FROM qc_fai_sub_detail_record
  2159. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2160. </delete>
  2161. <!-- 修改FAI主记录标识为已提交 -->
  2162. <update id="updateFAIMasterSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2163. UPDATE qc_fai_record
  2164. SET submit_flag = 'Y',
  2165. state = '已完成',
  2166. submit_date = getDate()
  2167. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2168. </update>
  2169. <!-- 修改FAI明细记录标识为已提交 -->
  2170. <update id="updateFAIDetailSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2171. UPDATE qc_fai_detailed_record
  2172. SET is_submit = 'Y'
  2173. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2174. </update>
  2175. <!-- 修改子明细记录标识为已提交 -->
  2176. <update id="updateFAISubDetailSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2177. UPDATE qc_fai_sub_detail_record
  2178. SET is_submit = 'Y'
  2179. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2180. </update>
  2181. <!-- 查询FAI检验记录是否已提交 -->
  2182. <select id="checkFAIIsSubmit" parameterType="com.heai.modules.pms.data.SubDetailValues" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  2183. SELECT submit_flag
  2184. FROM qc_fai_record
  2185. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2186. </select>
  2187. <!-- 删除子明细的老数据 -->
  2188. <delete id="delFAISubDetailedRecord" parameterType="com.heai.modules.pms.data.QcSubDetailInformationData">
  2189. DELETE FROM qc_fai_sub_detail_record
  2190. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2191. </delete>
  2192. <!-- 新增FAI子明细信息 -->
  2193. <insert id="saveFAISubDetailed">
  2194. INSERT INTO qc_fai_sub_detail_record
  2195. (inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e)
  2196. VALUES
  2197. <foreach collection="list" item="item" separator=",">
  2198. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
  2199. </foreach>
  2200. </insert>
  2201. <!-- 查询FAI的子明细 -->
  2202. <select id="selectFAISubDetailedRecord" parameterType="com.heai.modules.pms.data.SubDetailValues" resultType="com.heai.modules.pms.data.SubDetailValues">
  2203. SELECT
  2204. site,
  2205. bu_no,
  2206. sub_detail_value,
  2207. sampling_location,
  2208. is_submit,
  2209. sampling_location_b,
  2210. num,
  2211. sub_detail_value_b,
  2212. sub_detail_value_c,
  2213. sub_detail_value_d,
  2214. sub_detail_value_e
  2215. FROM qc_fai_sub_detail_record
  2216. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2217. <if test = "collectionDataContent != null and collectionDataContent != ''">
  2218. AND sub_detail_value ${collectionDataContent}
  2219. </if>
  2220. </select>
  2221. <!-- 获取该项目的子明细值 -->
  2222. <select id="selectFAISubDetailValue" parameterType="string" resultType="com.heai.modules.pms.data.SubDetailValues">
  2223. SELECT sub_detail_value,
  2224. sampling_location,
  2225. is_submit
  2226. FROM qc_fai_sub_detail_record
  2227. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
  2228. </select>
  2229. <!-- ================================================= IPQC检验维护 ================================================= -->
  2230. <!-- 查询IPQC基础数据 -->
  2231. <select id="selectIPQCBasicData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  2232. SELECT
  2233. top 1
  2234. a.orderno as orderNo,
  2235. j.part_no,
  2236. j.part_desc,
  2237. c.operation_desc,
  2238. b.approve_qty as rollQty,
  2239. a.s_resourceid as resourceId,
  2240. DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
  2241. a.itemno as itemNo,
  2242. a.id as ssrId
  2243. FROM soscheduledrouting as a
  2244. LEFT JOIN sfdc as b
  2245. ON a.site = b.site and a.seqno = b.assjob_seq_no and b.id in (
  2246. select max(sfdc.id)
  2247. from sfdc
  2248. group by sfdc.assjob_seq_no, site
  2249. )
  2250. LEFT JOIN so_routing as c
  2251. ON c.site = a.site and c.order_no = a.orderno and a.itemno = c.item_no
  2252. LEFT JOIN part j
  2253. ON a.site = j.site and a.part_no = j.part_no
  2254. LEFT JOIN (select ssr_id from qc_ipqc_record where check_type = '末件检') as temp
  2255. ON a.id = temp.ssr_id
  2256. WHERE b.approve_qty is not null and temp.ssr_id is null
  2257. ORDER BY a.id desc
  2258. </select>
  2259. <select id="qcExec" resultType="com.heai.modules.pms.data.QcFAIRecordData" parameterType="string" statementType="CALLABLE">
  2260. {CALL
  2261. getIpqcRecord(#{site,mode=IN,jdbcType=VARCHAR})
  2262. }
  2263. </select>
  2264. <insert id="saveIPQCDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2265. INSERT INTO qc_ipqc_detailed_record
  2266. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  2267. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  2268. max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
  2269. VALUES
  2270. (#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc},
  2271. #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL},
  2272. #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo},#{orderId,jdbcType=INTEGER})
  2273. </insert>
  2274. <!-- 新增IPQC明细记录信息 -->
  2275. <insert id="saveIPQCDetailedRecords">
  2276. INSERT INTO qc_ipqc_detailed_record
  2277. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  2278. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  2279. max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
  2280. VALUES
  2281. <foreach collection="list" item="item" separator=",">
  2282. (#{item.inspectionNo}, #{item.orderNo}, #{item.templateId}, #{item.samplingLevelNo}, #{item.samplingLevelDesc}, #{item.samplingProgrammeNo}, #{item.samplingProgrammeDesc},
  2283. #{item.aql,jdbcType=DECIMAL}, #{item.ac,jdbcType=DECIMAL}, #{item.re,jdbcType=DECIMAL}, #{item.itemNo}, #{item.itemDesc}, #{item.objectId}, #{item.objectDesc}, #{item.defaultValue}, #{item.minValue,jdbcType=DECIMAL},
  2284. #{item.maxValue,jdbcType=DECIMAL}, #{item.valueTypeDb}, #{item.valueType}, #{item.site}, #{item.samplingQty,jdbcType=DECIMAL}, #{item.buNo}, #{item.orderId})
  2285. </foreach>
  2286. </insert>
  2287. <!-- 新增IPQC主记录信息 -->
  2288. <insert id="saveIPQCRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2289. INSERT INTO qc_ipqc_record
  2290. (inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id,
  2291. part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id,ref_info1,ref_info2)
  2292. VALUES
  2293. (#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId},
  2294. #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId},#{refInfo1},#{refInfo2})
  2295. </insert>
  2296. <insert id="saveIQCRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2297. INSERT INTO qc_iqc_record
  2298. (inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id,
  2299. part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id,ref_info1,ref_info2)
  2300. VALUES
  2301. (#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId},
  2302. #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId},#{refInfo1},#{refInfo2})
  2303. </insert>
  2304. <insert id="saveSQCRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2305. INSERT INTO qc_sqc_record
  2306. (inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id,
  2307. part_no, roll_qty, sampling_qty, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id,ref_info1,ref_info2)
  2308. VALUES
  2309. (#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId},
  2310. #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId},#{refInfo1},#{refInfo2})
  2311. </insert>
  2312. <!-- 查询IPQC主记录信息 -->
  2313. <select id="qcIPQCInspectionSearch" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  2314. SELECT
  2315. a.inspection_no,
  2316. a.site,
  2317. a.bu_no,
  2318. a.state,
  2319. a.inspection_result,
  2320. a.task_date,
  2321. a.inspection_type_no,
  2322. a.inspection_cycle,
  2323. a.order_no,
  2324. a.operation_desc,
  2325. a.resource_id,
  2326. r.resource_desc,
  2327. a.part_no,
  2328. d.PartDescription as partDesc,
  2329. d.cinv_source_code as cinvSourceCode,
  2330. d.sku as sku,
  2331. d.invdefinetype as invdefinetype,
  2332. a.inspection_remark,
  2333. a.roll_qty,
  2334. a.sampling_qty,
  2335. a.disposal_measures,
  2336. a.disposal_remark,
  2337. a.inspector_date,
  2338. a.inspector_no,
  2339. u.user_display as inspectorName,
  2340. a.ssr_id,
  2341. a.unqualified_qty,
  2342. a.submit_flag,
  2343. a.seq_no,
  2344. a.batch_roll_no,
  2345. a.special_requirements,
  2346. a.work_center_no,
  2347. a.roll_no,
  2348. a.um_id,
  2349. um.UMName as umName,
  2350. a.action_date,
  2351. a.action_by,
  2352. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  2353. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  2354. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  2355. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  2356. a.pass_qty,
  2357. a.not_pass_qty,
  2358. a.batch_qualified_qty,
  2359. a.receipt_no,
  2360. a.receipt_item_no,
  2361. a.ref_info1,
  2362. a.ref_info2,
  2363. a.ref_info3,
  2364. a.ref_info4,
  2365. a.ref_info5
  2366. FROM qc_ipqc_record as a
  2367. left join part as d on a.site = d.site and a.part_no = d.partNo
  2368. left join sys_user as u on a.inspector_no = u.username
  2369. left join resource as r on a.site = r.site and a.resource_id = r.resource_id and a.work_center_no = r.work_center_no
  2370. left join UM as um on a.site = um.site and a.um_id = um.UMID
  2371. <where>
  2372. <if test="query.site != null and query.site != ''">
  2373. AND a.site = #{query.site}
  2374. </if>
  2375. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  2376. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  2377. </if>
  2378. <if test = "query.partNo != null and query.partNo != ''">
  2379. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  2380. </if>
  2381. <if test = "query.partDesc != null and query.partDesc != ''">
  2382. AND d.PartDescription LIKE '%' + #{query.partDesc} + '%'
  2383. </if>
  2384. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  2385. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  2386. </if>
  2387. <if test = "query.sku != null and query.sku != ''">
  2388. AND d.sku LIKE '%' + #{query.sku} + '%'
  2389. </if>
  2390. <if test = "query.states != null and query.states.size > 0">
  2391. AND a.state in
  2392. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  2393. #{item}
  2394. </foreach>
  2395. </if>
  2396. <if test = "query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
  2397. AND a.inspection_type_no = #{query.inspectionTypeNo}
  2398. </if>
  2399. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  2400. AND a.inspection_result = #{query.inspectionResult}
  2401. </if>
  2402. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  2403. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  2404. </if>
  2405. <if test = "query.orderNo != null and query.orderNo != ''">
  2406. AND a.order_no LIKE '%' + #{query.orderNo} + '%'
  2407. </if>
  2408. <if test = "query.seqNo != null and query.seqNo != ''">
  2409. AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
  2410. </if>
  2411. <if test = "query.operationDesc != null and query.operationDesc != ''">
  2412. AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
  2413. </if>
  2414. <if test="query.startDate != null">
  2415. AND a.inspector_date >= #{query.startDate}
  2416. </if>
  2417. <if test="query.endDate != null">
  2418. AND #{query.endDate} >= a.inspector_date
  2419. </if>
  2420. <if test="query.startDate2 != null">
  2421. AND a.task_date >= #{query.startDate2}
  2422. </if>
  2423. <if test="query.endDate2 != null">
  2424. AND #{query.endDate2} >= a.task_date
  2425. </if>
  2426. </where>
  2427. ORDER BY
  2428. CASE WHEN a.state = '待检验' THEN 1
  2429. WHEN a.state = '待审核' THEN 2
  2430. WHEN a.state = '已完成' THEN 3
  2431. END, a.task_date desc
  2432. </select>
  2433. <!-- IPQC明细记录查询 -->
  2434. <select id="ipqcDetailSearch" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  2435. SELECT
  2436. a.site,
  2437. a.bu_no,
  2438. a.inspection_no,
  2439. a.order_no,
  2440. a.template_id,
  2441. a.sampling_level_no,
  2442. a.sampling_level_desc,
  2443. a.sampling_programme_no,
  2444. a.sampling_programme_desc,
  2445. a.AQL,
  2446. a.AC,
  2447. a.RE,
  2448. a.item_no,
  2449. a.item_desc,
  2450. a.object_id,
  2451. a.object_desc,
  2452. a.default_value,
  2453. a.min_value,
  2454. a.max_value,
  2455. a.text_value,
  2456. a.number_value,
  2457. a.value_type_db,
  2458. a.value_type,
  2459. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  2460. a.is_submit,
  2461. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  2462. a.sampling_qty,
  2463. dbo.qc_get_ipqc_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
  2464. c.method_no,
  2465. c.method_name,
  2466. c.method_remark,
  2467. (
  2468. SELECT COUNT(*)
  2469. FROM sys_oss
  2470. WHERE order_ref1 = a.site and order_ref2 = a.inspection_no and order_ref3 = a.item_no and order_ref4 = a.bu_no
  2471. ) AS imageDetailNum
  2472. FROM qc_ipqc_detailed_record as a
  2473. LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
  2474. LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
  2475. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  2476. order by a.order_id
  2477. </select>
  2478. <!-- 删除IPQC检验记录 -->
  2479. <delete id="deleteIPQCRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2480. DELETE FROM qc_ipqc_record
  2481. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2482. </delete>
  2483. <!-- 删除IPQC明细记录信息 -->
  2484. <delete id="deleteIPQCDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2485. DELETE FROM qc_ipqc_detailed_record
  2486. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2487. </delete>
  2488. <!-- 删除IPQC子明细记录信息 -->
  2489. <delete id="deleteIPQCSubDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2490. DELETE FROM qc_ipqc_sub_detail_record
  2491. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2492. </delete>
  2493. <!-- 修改IPQC主记录信息 -->
  2494. <update id="updateIPQCMasterRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2495. UPDATE qc_ipqc_record
  2496. SET disposal_measures = #{disposalMeasures},
  2497. disposal_remark = #{disposalRemark},
  2498. inspection_result = #{inspectionResult},
  2499. inspector_no = #{inspectorNo},
  2500. state = #{state},
  2501. inspection_remark = #{inspectionRemark},
  2502. inspector_date = getDate(),
  2503. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2504. roll_qty = #{rollQty,jdbcType=DECIMAL},
  2505. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  2506. pass_qty = #{passQty,jdbcType=DECIMAL},
  2507. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  2508. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  2509. submit_date = getDate()
  2510. WHERE site = #{site} and inspection_no = #{inspectionNo} and bu_no = #{buNo}
  2511. </update>
  2512. <!-- 修改IPQC明细记录信息 -->
  2513. <update id="updateIPQCDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2514. UPDATE qc_ipqc_detailed_record
  2515. SET item_result = #{itemResult},
  2516. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  2517. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  2518. text_value = #{textValue},
  2519. number_value = #{numberValue,jdbcType=DECIMAL}
  2520. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2521. </update>
  2522. <!-- 修改IPQC主记录标识为已提交 -->
  2523. <update id="updateIPQCMasterSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2524. UPDATE qc_ipqc_record
  2525. SET submit_flag = 'Y',
  2526. state = '已完成',
  2527. submit_date = getDate()
  2528. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2529. </update>
  2530. <!-- 修改IPQC明细记录标识为已提交 -->
  2531. <update id="updateIPQCDetailSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2532. UPDATE qc_ipqc_detailed_record
  2533. SET is_submit = 'Y'
  2534. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2535. </update>
  2536. <!-- 修改IPQC子明细记录标识为已提交 -->
  2537. <update id="updateIPQCSubDetailSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2538. UPDATE qc_ipqc_sub_detail_record
  2539. SET is_submit = 'Y'
  2540. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2541. </update>
  2542. <!-- 删除IPQC子明细的老数据 -->
  2543. <delete id="delIPQCSubDetailedRecord" parameterType="com.heai.modules.pms.data.QcSubDetailInformationData">
  2544. DELETE FROM qc_ipqc_sub_detail_record
  2545. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2546. </delete>
  2547. <!-- 新增IPQC子明细信息 -->
  2548. <insert id="saveIPQCSubDetailed">
  2549. INSERT INTO qc_ipqc_sub_detail_record
  2550. (inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e)
  2551. VALUES
  2552. <foreach collection="list" item="item" separator=",">
  2553. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
  2554. </foreach>
  2555. </insert>
  2556. <!-- 查询IPQC的子明细 -->
  2557. <select id="selectIPQCSubDetailedRecord" parameterType="com.heai.modules.pms.data.SubDetailValues" resultType="com.heai.modules.pms.data.SubDetailValues">
  2558. SELECT
  2559. site,
  2560. bu_no,
  2561. sub_detail_value,
  2562. sampling_location,
  2563. is_submit,
  2564. sampling_location_b,
  2565. num,
  2566. sub_detail_value_b,
  2567. sub_detail_value_c,
  2568. sub_detail_value_d,
  2569. sub_detail_value_e
  2570. FROM qc_ipqc_sub_detail_record
  2571. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2572. <if test = "collectionDataContent != null and collectionDataContent != ''">
  2573. AND sub_detail_value ${collectionDataContent}
  2574. </if>
  2575. </select>
  2576. <!-- 查询IPQC检验记录是否已提交 -->
  2577. <select id="checkIPQCIsSubmit" parameterType="com.heai.modules.pms.data.SubDetailValues" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  2578. SELECT submit_flag
  2579. FROM qc_ipqc_record
  2580. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2581. </select>
  2582. <!-- 获取该项目的子明细值 -->
  2583. <select id="selectIPQCSubDetailValue" parameterType="string" resultType="com.heai.modules.pms.data.SubDetailValues">
  2584. SELECT sub_detail_value,
  2585. sampling_location,
  2586. is_submit
  2587. FROM qc_ipqc_sub_detail_record
  2588. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
  2589. </select>
  2590. <!-- 查询工序列表 -->
  2591. <select id="getOperationList" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  2592. SELECT
  2593. DISTINCT
  2594. a.seqno as seqNo,
  2595. a.orderno as orderNo,
  2596. j.partNo,
  2597. j.PartDescription,
  2598. j.invdefinetype,
  2599. j.sku,
  2600. c.OperationDesc as operationDesc,
  2601. a.itemno as operationNo,
  2602. a.s_resourceid as resourceId,
  2603. r.resource_desc as resourceDesc,
  2604. c.work_center_no
  2605. FROM soscheduledrouting as a
  2606. LEFT JOIN RoutingDetail AS c ON c.site = a.site AND a.itemno = c.itemNo
  2607. LEFT JOIN part j ON a.site = j.site and a.partNo = j.partNo
  2608. LEFT JOIN resource r ON a.site = r.site and a.s_resourceid = r.resource_id
  2609. WHERE a.site = #{site} and a.seqno = #{seqNo}
  2610. </select>
  2611. <!-- 根据工单号和工序号查出所有数据 -->
  2612. <select id="getResourceList" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  2613. SELECT
  2614. a.s_resourceid as resourceId,
  2615. DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
  2616. c.work_center_no
  2617. FROM soscheduledrouting as a
  2618. LEFT JOIN sfdc as b ON a.site = b.site and a.seqno = b.assjob_seq_no
  2619. LEFT JOIN so_routing as c ON c.site = a.site and c.order_no = a.orderno and a.itemno = c.item_no
  2620. LEFT JOIN part j ON a.site = j.site and a.part_no = j.part_no
  2621. WHERE a.site = #{site} and b.approve_qty is not null and a.seqno = #{seqNo}
  2622. ORDER BY a.id desc
  2623. </select>
  2624. <!-- a.orderno = #{orderNo} and c.operation_desc = #{operationDesc}-->
  2625. <!-- 查询机台名称 -->
  2626. <select id="selectResourceDesc" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  2627. SELECT distinct
  2628. resource_desc
  2629. FROM resource
  2630. WHERE site = #{site} and resource_id = #{resourceId}
  2631. </select>
  2632. <!-- 查询物料名称 -->
  2633. <select id="selectPartDesc" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  2634. SELECT distinct
  2635. part_desc
  2636. FROM part
  2637. WHERE site = #{site} and part_no = #{partNo}
  2638. </select>
  2639. <!-- ================================================= IQC检验维护 ================================================= -->
  2640. <!-- 查询IQC基础数据 -->
  2641. <select id="selectIQCBasicData" resultType="com.heai.modules.pms.data.QcFAIRecordData" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2642. SELECT
  2643. qir.inspection_no,
  2644. qir.state,
  2645. qir.create_date as taskDate,
  2646. qir.roll_no,
  2647. qir.part_no,
  2648. p.part_desc,
  2649. p.cinv_source_code,
  2650. p.sku as sku,
  2651. qir.roll_qty,
  2652. qir.print_flag,
  2653. qir.create_by,
  2654. qir.supplier_no,
  2655. qir.site,
  2656. qir.bu_no,
  2657. qir.po_orderNo,
  2658. qir.po_itemNo,
  2659. qir.roll_count
  2660. FROM qc_iqc_record as qir
  2661. LEFT JOIN part p ON qir.part_no = p.part_no and qir.site = p.site
  2662. WHERE qir.site in (select site from eam_access_site where username = #{userName})
  2663. and (qir.site + '-' + qir.bu_no) in (select * from dbo.query_bu(#{userName}))
  2664. and qir.detail_flag = 'N'
  2665. </select>
  2666. <!-- 新增IQC明细记录信息 -->
  2667. <insert id="saveIQCDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2668. INSERT INTO qc_iqc_detailed_record (inspection_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc, AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value, max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
  2669. VALUES(#{inspectionNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL}, #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty}, #{buNo},#{orderId,jdbcType=INTEGER})
  2670. </insert>
  2671. <insert id="saveIQCDetailedRecordByTemplate" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2672. INSERT INTO dbo.qc_iqc_detailed_record
  2673. (
  2674. inspection_no, template_id, sampling_level_no, sampling_level_desc,
  2675. sampling_programme_no, sampling_programme_desc, AQL, AC, RE,
  2676. item_no, item_desc, default_value, min_value, max_value,
  2677. item_result, value_type_db, value_type, is_submit, site, sampling_qty, bu_no, order_id
  2678. )
  2679. SELECT
  2680. #{inspectionNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc},
  2681. #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL},
  2682. A.ItemNo, B.ItemDesc,
  2683. COALESCE(C.default_value, A.default_value, B.defaultValue),
  2684. COALESCE(C.min_value, A.min_value, B.minvalue),
  2685. COALESCE(C.max_value, A.max_value, B.maxValue),
  2686. 'Y', B.ValueType_DB, B.ValueType, 'N', #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo}, A.order_id
  2687. FROM qc_template_detailed A
  2688. INNER JOIN eam_properties_item B ON A.SITE = B.SITE AND A.bu_no = B.bu_no AND A.ItemNo = B.ItemNo
  2689. LEFT JOIN qc_part_attr_detailed C ON B.site = C.site AND B.bu_no = C.bu_no AND B.ItemNo = C.item_no AND C.attribute_no = #{partNo}
  2690. WHERE A.SITE = #{site} AND A.bu_no = #{buNo} AND A.template_id = #{templateId}
  2691. </insert>
  2692. <insert id="saveFAIDetailedRecordByTemplate" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2693. INSERT INTO dbo.qc_fai_detailed_record
  2694. (
  2695. inspection_no, template_id, sampling_level_no, sampling_level_desc,
  2696. sampling_programme_no, sampling_programme_desc, AQL, AC, RE,
  2697. item_no, item_desc, object_id, object_desc, default_value, min_value, max_value,
  2698. item_result, value_type_db, value_type, is_submit, site, sampling_qty, bu_no, order_id,order_no
  2699. )
  2700. SELECT
  2701. #{inspectionNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc},
  2702. #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL},
  2703. A.ItemNo, B.ItemDesc, A.object_id, A.object_desc,
  2704. COALESCE(C.default_value, A.default_value, B.defaultValue),
  2705. COALESCE(C.min_value, A.min_value, B.minvalue),
  2706. COALESCE(C.max_value, A.max_value, B.maxValue),
  2707. 'Y', B.ValueType_DB, B.ValueType, 'N', #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo}, A.order_id,#{orderNo}
  2708. FROM qc_template_detailed A
  2709. INNER JOIN eam_properties_item B ON A.SITE = B.SITE AND A.bu_no = B.bu_no AND A.ItemNo = B.ItemNo
  2710. LEFT JOIN qc_part_attr_detailed C ON B.site = C.site AND B.bu_no = C.bu_no AND B.ItemNo = C.item_no AND C.attribute_no = #{partNo}
  2711. WHERE A.SITE = #{site} AND A.bu_no = #{buNo} AND A.template_id = #{templateId}
  2712. </insert>
  2713. <insert id="saveIPQCDetailedRecordByTemplate" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2714. INSERT INTO dbo.qc_ipqc_detailed_record
  2715. (
  2716. inspection_no, template_id, sampling_level_no, sampling_level_desc,
  2717. sampling_programme_no, sampling_programme_desc, AQL, AC, RE,
  2718. item_no, item_desc, object_id, object_desc, default_value, min_value, max_value,
  2719. item_result, value_type_db, value_type, is_submit, site, sampling_qty, bu_no, order_id,order_no
  2720. )
  2721. SELECT
  2722. #{inspectionNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc},
  2723. #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL},
  2724. A.ItemNo, B.ItemDesc, A.object_id, A.object_desc,
  2725. COALESCE(C.default_value, A.default_value, B.defaultValue),
  2726. COALESCE(C.min_value, A.min_value, B.minvalue),
  2727. COALESCE(C.max_value, A.max_value, B.maxValue),
  2728. 'Y', B.ValueType_DB, B.ValueType, 'N', #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo}, A.order_id,#{orderNo}
  2729. FROM qc_template_detailed A
  2730. INNER JOIN eam_properties_item B ON A.SITE = B.SITE AND A.bu_no = B.bu_no AND A.ItemNo = B.ItemNo
  2731. LEFT JOIN qc_part_attr_detailed C ON B.site = C.site AND B.bu_no = C.bu_no AND B.ItemNo = C.item_no AND C.attribute_no = #{partNo}
  2732. WHERE A.SITE = #{site} AND A.bu_no = #{buNo} AND A.template_id = #{templateId}
  2733. </insert>
  2734. <insert id="saveFQCDetailedRecordByTemplate" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2735. INSERT INTO dbo.qc_fqc_detailed_record
  2736. (
  2737. inspection_no, template_id, sampling_level_no, sampling_level_desc,
  2738. sampling_programme_no, sampling_programme_desc, AQL, AC, RE,
  2739. item_no, item_desc, object_id, default_value, min_value, max_value,
  2740. item_result, value_type_db, value_type, is_submit, site, sampling_qty, bu_no, order_id,order_no
  2741. )
  2742. SELECT
  2743. #{inspectionNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc},
  2744. #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL},
  2745. A.ItemNo, B.ItemDesc, A.object_id,
  2746. COALESCE(C.default_value, A.default_value, B.defaultValue),
  2747. COALESCE(C.min_value, A.min_value, B.minvalue),
  2748. COALESCE(C.max_value, A.max_value, B.maxValue),
  2749. 'Y', B.ValueType_DB, B.ValueType, 'N', #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo}, A.order_id,#{orderNo}
  2750. FROM qc_template_detailed A
  2751. INNER JOIN eam_properties_item B ON A.SITE = B.SITE AND A.bu_no = B.bu_no AND A.ItemNo = B.ItemNo
  2752. LEFT JOIN qc_part_attr_detailed C ON B.site = C.site AND B.bu_no = C.bu_no AND B.ItemNo = C.item_no AND C.attribute_no = #{partNo}
  2753. WHERE A.SITE = #{site} AND A.bu_no = #{buNo} AND A.template_id = #{templateId}
  2754. </insert>
  2755. <!-- 修改IQC检验记录 -->
  2756. <update id="updateIQCRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2757. UPDATE qc_iqc_record
  2758. SET inspection_type_no = #{inspectionTypeNo},
  2759. sampling_qty = #{samplingQty},
  2760. inspection_cycle = #{inspectionCycle},
  2761. part_no = #{partNo},
  2762. supplier_no = #{supplierNo},
  2763. part_desc = #{partDesc},
  2764. detail_flag = 'Y',
  2765. state = '未开始',
  2766. action_date = #{actionDate},
  2767. action_by = ''
  2768. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2769. </update>
  2770. <update id="updateFAIRecordOverLoad" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2771. UPDATE qc_fai_record
  2772. SET inspection_type_no = #{inspectionTypeNo},
  2773. sampling_qty = #{samplingQty},
  2774. inspection_cycle = #{inspectionCycle},
  2775. part_no = #{partNo},
  2776. state = '未开始',
  2777. action_date = '',
  2778. action_by = ''
  2779. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2780. </update>
  2781. <update id="updateIPQCRecordOverLoad" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2782. UPDATE qc_ipqc_record
  2783. SET inspection_type_no = #{inspectionTypeNo},
  2784. sampling_qty = #{samplingQty},
  2785. inspection_cycle = #{inspectionCycle},
  2786. part_no = #{partNo},
  2787. state = '未开始',
  2788. action_date = '',
  2789. action_by = ''
  2790. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2791. </update>
  2792. <update id="updateFQCRecordOverLoad" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  2793. UPDATE qc_fqc_record
  2794. SET inspection_type_no = #{inspectionTypeNo},
  2795. sampling_qty = #{samplingQty},
  2796. inspection_cycle = #{inspectionCycle},
  2797. part_no = #{partNo},
  2798. state = '未开始',
  2799. action_date = '',
  2800. action_by = ''
  2801. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  2802. </update>
  2803. <!-- 查询IQC主记录信息 -->
  2804. <select id="qcIQCInspectionSearch" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  2805. SELECT
  2806. a.inspection_no,
  2807. a.site,
  2808. a.bu_no,
  2809. a.state,
  2810. a.inspection_result,
  2811. a.create_date as taskDate,
  2812. a.inspection_type_no,
  2813. a.inspection_cycle,
  2814. a.part_no,
  2815. d.PartDescription as partDesc,
  2816. d.cinv_source_code as cinvSourceCode,
  2817. d.sku,
  2818. d.umid as umId,
  2819. d.invdefinetype as invdefinetype,
  2820. a.inspection_remark,
  2821. a.roll_qty,
  2822. a.sampling_qty,
  2823. a.disposal_measures,
  2824. a.disposal_remark,
  2825. a.inspector_date,
  2826. a.inspector_no,
  2827. u.user_display as inspectorName,
  2828. a.unqualified_quantity,
  2829. a.submit_flag,
  2830. a.roll_no,
  2831. a.supplier_no,
  2832. s.SupplierName as supplierDesc,
  2833. a.po_orderNo,
  2834. a.po_itemNo,
  2835. a.roll_count,
  2836. dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) as orderType,
  2837. a.action_date,
  2838. a.action_by,
  2839. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  2840. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  2841. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  2842. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  2843. a.submission_remark,
  2844. a.submission_type,
  2845. a.batch_no,
  2846. a.production_date,
  2847. a.expiration_warning_date,
  2848. a.expiration_date,
  2849. a.cancel_check_date,
  2850. a.submit_date,
  2851. a.pass_qty,
  2852. a.not_pass_qty,
  2853. a.batch_qualified_qty,
  2854. a.receipt_no,
  2855. a.receipt_item_no,
  2856. a.ref_info1,
  2857. a.ref_info2,
  2858. a.ref_info3,
  2859. a.ref_info4,
  2860. a.ref_info5
  2861. FROM qc_iqc_record as a
  2862. left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.partNo
  2863. left join view_Supplier as s on a.site = s.site and a.supplier_no = s.SupplierID
  2864. left join sys_user as u on a.inspector_no = u.username
  2865. <where>
  2866. <if test="query.site != null and query.site != ''">
  2867. AND a.site = #{query.site}
  2868. </if>
  2869. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  2870. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  2871. </if>
  2872. <if test = "query.states != null and query.states.size > 0">
  2873. AND a.state in
  2874. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  2875. #{item}
  2876. </foreach>
  2877. </if>
  2878. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  2879. AND a.inspection_result = #{query.inspectionResult}
  2880. </if>
  2881. <if test = "query.partNo != null and query.partNo != ''">
  2882. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  2883. </if>
  2884. <if test = "query.partDesc != null and query.partDesc != ''">
  2885. AND a.part_desc LIKE '%' + #{query.partDesc} + '%'
  2886. </if>
  2887. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  2888. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  2889. </if>
  2890. <if test = "query.sku != null and query.sku != ''">
  2891. AND d.sku LIKE '%' + #{query.sku} + '%'
  2892. </if>
  2893. <if test = "query.supplierDesc != null and query.supplierDesc != ''">
  2894. AND s.SupplierName LIKE '%' + #{query.supplierDesc} + '%'
  2895. </if>
  2896. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  2897. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  2898. </if>
  2899. <if test = "query.inspectorName != null and query.inspectorName != ''">
  2900. u.user_display LIKE '%' + #{query.inspectorName} + '%'
  2901. </if>
  2902. <if test="query.startDate != null">
  2903. AND a.inspector_date >= #{query.startDate}
  2904. </if>
  2905. <if test="query.endDate != null">
  2906. AND #{query.endDate} >= a.inspector_date
  2907. </if>
  2908. <if test="query.startDate2 != null">
  2909. AND a.create_date >= #{query.startDate2}
  2910. </if>
  2911. <if test="query.endDate2 != null">
  2912. AND #{query.endDate2} >= a.create_date
  2913. </if>
  2914. <if test = "query.poOrderNo != null and query.poOrderNo != ''">
  2915. AND a.po_orderNo LIKE '%' + #{query.poOrderNo} + '%'
  2916. </if>
  2917. <if test = "query.poItemNo != null and query.poItemNo != ''">
  2918. AND a.po_itemNo LIKE '%' + #{query.poItemNo} + '%'
  2919. </if>
  2920. <if test = "query.orderType != null and query.orderType != ''">
  2921. AND dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) = #{query.orderType}
  2922. </if>
  2923. <if test = "query.submissionType != null and query.submissionType != ''">
  2924. AND a.submission_type = #{query.submissionType}
  2925. </if>
  2926. <if test = "query.invdefinetype != null and query.invdefinetype != ''">
  2927. AND d.invdefinetype LIKE '%' + #{query.invdefinetype} + '%'
  2928. </if>
  2929. </where>
  2930. ORDER BY
  2931. CASE WHEN a.state = '待检验' THEN 1
  2932. WHEN a.state = '待审核' THEN 2
  2933. WHEN a.state = '已完成' THEN 3
  2934. END, a.create_date desc
  2935. </select>
  2936. <!-- IQC明细记录查询 -->
  2937. <select id="iqcDetailSearch" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  2938. SELECT
  2939. a.site,
  2940. a.bu_no,
  2941. a.inspection_no,
  2942. a.template_id,
  2943. a.sampling_level_no,
  2944. a.sampling_level_desc,
  2945. a.sampling_programme_no,
  2946. a.sampling_programme_desc,
  2947. a.AQL,
  2948. a.AC,
  2949. a.RE,
  2950. a.item_no,
  2951. a.item_desc,
  2952. a.object_id,
  2953. a.object_desc,
  2954. a.default_value,
  2955. a.min_value,
  2956. a.max_value,
  2957. a.text_value,
  2958. a.number_value,
  2959. a.value_type_db,
  2960. a.value_type,
  2961. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  2962. a.is_submit,
  2963. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  2964. dbo.qc_get_iqc_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
  2965. c.method_no,
  2966. c.method_name,
  2967. c.method_remark,
  2968. a.sampling_qty,
  2969. (
  2970. SELECT COUNT(*)
  2971. FROM sys_oss
  2972. WHERE order_ref1 = a.site and order_ref2 = a.inspection_no and order_ref3 = a.item_no and order_ref4 = a.bu_no
  2973. ) AS imageDetailNum
  2974. FROM qc_iqc_detailed_record as a
  2975. LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
  2976. LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
  2977. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  2978. order by a.order_id
  2979. </select>
  2980. <!-- 查询IQC的子明细 -->
  2981. <select id="selectIQCSubDetailedRecord" parameterType="com.heai.modules.pms.data.SubDetailValues" resultType="com.heai.modules.pms.data.SubDetailValues">
  2982. SELECT
  2983. site,
  2984. bu_no,
  2985. sub_detail_value,
  2986. sampling_location,
  2987. is_submit,
  2988. sampling_location_b,
  2989. num,
  2990. sub_detail_value_b,
  2991. sub_detail_value_c,
  2992. sub_detail_value_d,
  2993. sub_detail_value_e
  2994. FROM qc_iqc_sub_detail_record
  2995. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  2996. <if test = "collectionDataContent != null and collectionDataContent != ''">
  2997. AND sub_detail_value ${collectionDataContent}
  2998. </if>
  2999. </select>
  3000. <!-- 获取该项目的子明细值 -->
  3001. <select id="selectIQCSubDetailValue" parameterType="string" resultType="com.heai.modules.pms.data.SubDetailValues">
  3002. SELECT sub_detail_value,
  3003. sampling_location,
  3004. is_submit
  3005. FROM qc_iqc_sub_detail_record
  3006. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
  3007. </select>
  3008. <!-- 修改IQC主记录信息 -->
  3009. <update id="updateIQCMasterRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3010. UPDATE qc_iqc_record
  3011. SET disposal_measures = #{disposalMeasures},
  3012. disposal_remark = #{disposalRemark},
  3013. inspection_result = #{inspectionResult},
  3014. inspector_no = #{inspectorNo},
  3015. state = #{state},
  3016. inspection_remark = #{inspectionRemark},
  3017. inspector_date = getDate(),
  3018. roll_count = #{rollCount,jdbcType=DECIMAL},
  3019. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  3020. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  3021. pass_qty = #{passQty,jdbcType=DECIMAL},
  3022. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  3023. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  3024. submit_date = getDate()
  3025. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3026. </update>
  3027. <!-- 修改IQC明细记录信息 -->
  3028. <update id="updateIQCDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3029. UPDATE qc_iqc_detailed_record
  3030. SET item_result = #{itemResult},
  3031. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  3032. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  3033. text_value = #{textValue},
  3034. number_value = #{numberValue,jdbcType=DECIMAL}
  3035. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  3036. </update>
  3037. <!-- 查询该记录明细是否已存在 -->
  3038. <select id="checkIQCDetail" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  3039. SELECT inspection_no,
  3040. template_id
  3041. FROM qc_iqc_detailed_record
  3042. WHERE inspection_no = #{inspectionNo} and site = #{site}
  3043. </select>
  3044. <!-- 查询IQC检验记录是否已提交 -->
  3045. <select id="checkIQCIsSubmit" parameterType="com.heai.modules.pms.data.SubDetailValues" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  3046. SELECT submit_flag
  3047. FROM qc_iqc_record
  3048. WHERE inspection_no = #{inspectionNo} and site = #{site}
  3049. </select>
  3050. <!-- 删除IQC子明细的老数据 -->
  3051. <delete id="delIQCSubDetailedRecord" parameterType="com.heai.modules.pms.data.QcSubDetailInformationData">
  3052. DELETE FROM qc_iqc_sub_detail_record
  3053. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  3054. </delete>
  3055. <!-- ================================================= SQC检验维护 ================================================= -->
  3056. <!-- 查询SQC基础数据 -->
  3057. <select id="selectSQCBasicData" resultType="com.heai.modules.pms.data.QcFAIRecordData" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3058. SELECT
  3059. qir.inspection_no,
  3060. qir.state,
  3061. qir.create_date as taskDate,
  3062. qir.roll_no,
  3063. qir.part_no,
  3064. p.part_desc,
  3065. p.cinv_source_code,
  3066. p.sku as sku,
  3067. qir.roll_qty,
  3068. qir.print_flag,
  3069. qir.create_by,
  3070. qir.supplier_no,
  3071. qir.site,
  3072. qir.bu_no,
  3073. qir.po_orderNo,
  3074. qir.po_itemNo,
  3075. qir.roll_count
  3076. FROM qc_sqc_record as qir
  3077. LEFT JOIN part p ON qir.part_no = p.part_no and qir.site = p.site
  3078. WHERE qir.site in (select site from eam_access_site where username = #{userName})
  3079. and (qir.site + '-' + qir.bu_no) in (select * from dbo.query_bu(#{userName}))
  3080. and qir.detail_flag = 'N'
  3081. </select>
  3082. <!-- 新增SQC明细记录信息 -->
  3083. <insert id="saveSQCDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3084. INSERT INTO qc_sqc_detailed_record (inspection_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc, AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value, max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
  3085. VALUES(#{inspectionNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL}, #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty}, #{buNo},#{orderId,jdbcType=INTEGER})
  3086. </insert>
  3087. <!-- 修改SQC检验记录 -->
  3088. <update id="updateSQCRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3089. UPDATE qc_sqc_record
  3090. SET inspection_type_no = #{inspectionTypeNo},
  3091. sampling_qty = #{samplingQty},
  3092. inspection_cycle = #{inspectionCycle},
  3093. part_no = #{partNo},
  3094. supplier_no = #{supplierNo},
  3095. part_desc = #{partDesc},
  3096. detail_flag = 'Y',
  3097. state = '未开始',
  3098. action_date = '',
  3099. action_by = ''
  3100. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3101. </update>
  3102. <!-- 查询SQC主记录信息 -->
  3103. <select id="qcSQCInspectionSearch" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  3104. SELECT
  3105. a.inspection_no,
  3106. a.site,
  3107. a.bu_no,
  3108. a.state,
  3109. a.inspection_result,
  3110. a.create_date as taskDate,
  3111. a.inspection_type_no,
  3112. a.inspection_cycle,
  3113. a.part_no,
  3114. d.PartDescription as partDesc,
  3115. d.cinv_source_code as cinvSourceCode,
  3116. d.sku,
  3117. d.umid as umId,
  3118. d.invdefinetype as invdefinetype,
  3119. a.inspection_remark,
  3120. a.roll_qty,
  3121. a.sampling_qty,
  3122. a.disposal_measures,
  3123. a.disposal_remark,
  3124. a.inspector_date,
  3125. a.inspector_no,
  3126. u.user_display as inspectorName,
  3127. a.unqualified_quantity,
  3128. a.submit_flag,
  3129. a.roll_no,
  3130. a.supplier_no,
  3131. s.SupplierName as supplierDesc,
  3132. a.po_orderNo,
  3133. a.po_itemNo,
  3134. a.roll_count,
  3135. dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) as orderType,
  3136. a.action_date,
  3137. a.action_by,
  3138. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  3139. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  3140. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  3141. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  3142. a.submission_remark,
  3143. a.submission_type,
  3144. a.batch_no,
  3145. a.production_date,
  3146. a.expiration_warning_date,
  3147. a.expiration_date,
  3148. a.cancel_check_date,
  3149. a.submit_date,
  3150. a.pass_qty,
  3151. a.not_pass_qty,
  3152. a.batch_qualified_qty,
  3153. a.ref_info1,
  3154. a.ref_info2,
  3155. a.ref_info3,
  3156. a.ref_info4,
  3157. a.ref_info5
  3158. FROM qc_sqc_record as a
  3159. left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.partNo
  3160. left join view_Supplier as s on a.site = s.site and a.supplier_no = s.SupplierID
  3161. left join sys_user as u on a.inspector_no = u.username
  3162. <where>
  3163. <if test="query.site != null and query.site != ''">
  3164. AND a.site = #{query.site}
  3165. </if>
  3166. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  3167. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  3168. </if>
  3169. <if test = "query.states != null and query.states.size > 0">
  3170. AND a.state in
  3171. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  3172. #{item}
  3173. </foreach>
  3174. </if>
  3175. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  3176. AND a.inspection_result = #{query.inspectionResult}
  3177. </if>
  3178. <if test = "query.partNo != null and query.partNo != ''">
  3179. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  3180. </if>
  3181. <if test = "query.partDesc != null and query.partDesc != ''">
  3182. AND a.part_desc LIKE '%' + #{query.partDesc} + '%'
  3183. </if>
  3184. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  3185. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  3186. </if>
  3187. <if test = "query.sku != null and query.sku != ''">
  3188. AND d.sku LIKE '%' + #{query.sku} + '%'
  3189. </if>
  3190. <if test = "query.supplierDesc != null and query.supplierDesc != ''">
  3191. AND s.SupplierName LIKE '%' + #{query.supplierDesc} + '%'
  3192. </if>
  3193. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  3194. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  3195. </if>
  3196. <if test = "query.inspectorName != null and query.inspectorName != ''">
  3197. u.user_display LIKE '%' + #{query.inspectorName} + '%'
  3198. </if>
  3199. <if test="query.startDate != null">
  3200. AND a.inspector_date >= #{query.startDate}
  3201. </if>
  3202. <if test="query.endDate != null">
  3203. AND #{query.endDate} >= a.inspector_date
  3204. </if>
  3205. <if test="query.startDate2 != null">
  3206. AND a.create_date >= #{query.startDate2}
  3207. </if>
  3208. <if test="query.endDate2 != null">
  3209. AND #{query.endDate2} >= a.create_date
  3210. </if>
  3211. <if test = "query.poOrderNo != null and query.poOrderNo != ''">
  3212. AND a.po_orderNo LIKE '%' + #{query.poOrderNo} + '%'
  3213. </if>
  3214. <if test = "query.poItemNo != null and query.poItemNo != ''">
  3215. AND a.po_itemNo LIKE '%' + #{query.poItemNo} + '%'
  3216. </if>
  3217. <if test = "query.orderType != null and query.orderType != ''">
  3218. AND dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) = #{query.orderType}
  3219. </if>
  3220. <if test = "query.submissionType != null and query.submissionType != ''">
  3221. AND a.submission_type = #{query.submissionType}
  3222. </if>
  3223. <if test = "query.invdefinetype != null and query.invdefinetype != ''">
  3224. AND d.invdefinetype LIKE '%' + #{query.invdefinetype} + '%'
  3225. </if>
  3226. </where>
  3227. ORDER BY
  3228. CASE WHEN a.state = '待检验' THEN 1
  3229. WHEN a.state = '待审核' THEN 2
  3230. WHEN a.state = '已完成' THEN 3
  3231. END, a.create_date desc
  3232. </select>
  3233. <!-- SQC明细记录查询 -->
  3234. <select id="sqcDetailSearch" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  3235. SELECT
  3236. a.site,
  3237. a.bu_no,
  3238. a.inspection_no,
  3239. a.template_id,
  3240. a.sampling_level_no,
  3241. a.sampling_level_desc,
  3242. a.sampling_programme_no,
  3243. a.sampling_programme_desc,
  3244. a.AQL,
  3245. a.AC,
  3246. a.RE,
  3247. a.item_no,
  3248. a.item_desc,
  3249. a.object_id,
  3250. a.object_desc,
  3251. a.default_value,
  3252. a.min_value,
  3253. a.max_value,
  3254. a.text_value,
  3255. a.number_value,
  3256. a.value_type_db,
  3257. a.value_type,
  3258. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  3259. a.is_submit,
  3260. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  3261. (
  3262. SELECT COUNT(*)
  3263. FROM qc_sqc_sub_detail_record s
  3264. WHERE s.site = a.site and s.bu_no = a.bu_no and s.inspection_no = a.inspection_no and s.item_no = a.item_no
  3265. ) as subDetailRecordNum,
  3266. c.method_no,
  3267. c.method_name,
  3268. c.method_remark,
  3269. a.sampling_qty,
  3270. (
  3271. SELECT COUNT(*)
  3272. FROM sys_oss
  3273. WHERE order_ref1 = a.site and order_ref2 = a.inspection_no and order_ref3 = a.item_no and order_ref4 = a.bu_no
  3274. ) AS imageDetailNum
  3275. FROM qc_sqc_detailed_record as a
  3276. LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
  3277. LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
  3278. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  3279. order by a.order_id
  3280. </select>
  3281. <!-- 查询SQC的子明细 -->
  3282. <select id="selectSQCSubDetailedRecord" parameterType="com.heai.modules.pms.data.SubDetailValues" resultType="com.heai.modules.pms.data.SubDetailValues">
  3283. SELECT
  3284. site,
  3285. bu_no,
  3286. sub_detail_value,
  3287. sampling_location,
  3288. is_submit,
  3289. sampling_location_b,
  3290. num,
  3291. sub_detail_value_b,
  3292. sub_detail_value_c,
  3293. sub_detail_value_d,
  3294. sub_detail_value_e,
  3295. sub_detail_value_f,
  3296. sub_detail_value_g,
  3297. sub_detail_value_h,
  3298. sub_detail_value_i,
  3299. sub_detail_value_j
  3300. FROM qc_sqc_sub_detail_record
  3301. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  3302. <if test = "collectionDataContent != null and collectionDataContent != ''">
  3303. AND sub_detail_value ${collectionDataContent}
  3304. </if>
  3305. </select>
  3306. <!-- 获取该项目的子明细值 -->
  3307. <select id="selectSQCSubDetailValue" resultType="com.heai.modules.pms.data.SubDetailValues">
  3308. SELECT sub_detail_value,
  3309. sampling_location,
  3310. is_submit
  3311. FROM qc_sqc_sub_detail_record
  3312. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  3313. </select>
  3314. <!-- 修改SQC主记录信息 -->
  3315. <update id="updateSQCMasterRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3316. UPDATE qc_sqc_record
  3317. SET disposal_measures = #{disposalMeasures},
  3318. disposal_remark = #{disposalRemark},
  3319. inspection_result = #{inspectionResult},
  3320. inspector_no = #{inspectorNo},
  3321. state = #{state},
  3322. inspection_remark = #{inspectionRemark},
  3323. inspector_date = getDate(),
  3324. roll_count = #{rollCount,jdbcType=DECIMAL},
  3325. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  3326. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  3327. pass_qty = #{passQty,jdbcType=DECIMAL},
  3328. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  3329. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  3330. submit_date = getDate()
  3331. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3332. </update>
  3333. <!-- 修改SQC明细记录信息 -->
  3334. <update id="updateSQCDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3335. UPDATE qc_sqc_detailed_record
  3336. SET item_result = #{itemResult},
  3337. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  3338. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  3339. text_value = #{textValue},
  3340. number_value = #{numberValue,jdbcType=DECIMAL}
  3341. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  3342. </update>
  3343. <!-- 查询该记录明细是否已存在 -->
  3344. <select id="checkSQCDetail" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  3345. SELECT inspection_no,
  3346. template_id
  3347. FROM qc_sqc_detailed_record
  3348. WHERE inspection_no = #{inspectionNo} and site = #{site}
  3349. </select>
  3350. <!-- 查询SQC检验记录是否已提交 -->
  3351. <select id="checkSQCIsSubmit" parameterType="com.heai.modules.pms.data.SubDetailValues" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  3352. SELECT submit_flag
  3353. FROM qc_sqc_record
  3354. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3355. </select>
  3356. <!-- 删除SQC子明细的老数据 -->
  3357. <delete id="delSQCSubDetailedRecord" parameterType="com.heai.modules.pms.data.QcSubDetailInformationData">
  3358. DELETE FROM qc_sqc_sub_detail_record
  3359. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  3360. </delete>
  3361. <!-- 新增SQC子明细信息 -->
  3362. <insert id="saveSQCSubDetailed">
  3363. INSERT INTO qc_sqc_sub_detail_record
  3364. (inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e, sub_detail_value_f, sub_detail_value_g, sub_detail_value_h, sub_detail_value_i, sub_detail_value_j)
  3365. VALUES
  3366. <foreach collection="list" item="item" separator=",">
  3367. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE}, #{item.subDetailValueF}, #{item.subDetailValueG}, #{item.subDetailValueH}, #{item.subDetailValueI}, #{item.subDetailValueJ})
  3368. </foreach>
  3369. </insert>
  3370. <!-- 修改SQC主记录标识为已提交 -->
  3371. <update id="updateSQCMasterSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3372. UPDATE qc_sqc_record
  3373. SET submit_flag = 'Y',
  3374. state = '已完成',
  3375. submit_date = getDate()
  3376. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3377. </update>
  3378. <!-- 修改SQC明细记录标识为已提交 -->
  3379. <update id="updateSQCDetailSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3380. UPDATE qc_sqc_detailed_record
  3381. SET is_submit = 'Y'
  3382. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3383. </update>
  3384. <!-- 修改SQC子明细记录标识为已提交 -->
  3385. <update id="updateSQCSubDetailSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3386. UPDATE qc_sqc_sub_detail_record
  3387. SET is_submit = 'Y'
  3388. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3389. </update>
  3390. <!-- 删除SQC检验记录 -->
  3391. <delete id="deleteSQCRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3392. DELETE FROM qc_sqc_record
  3393. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3394. </delete>
  3395. <!-- 删除SQC明细记录信息 -->
  3396. <delete id="deleteSQCDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3397. DELETE FROM qc_sqc_detailed_record
  3398. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3399. </delete>
  3400. <!-- 删除SQC子明细记录信息 -->
  3401. <delete id="deleteSQCSubDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3402. DELETE FROM qc_sqc_sub_detail_record
  3403. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3404. </delete>
  3405. <!-- 新增IQC子明细信息 -->
  3406. <insert id="saveIQCSubDetailed">
  3407. INSERT INTO qc_iqc_sub_detail_record
  3408. (inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e)
  3409. VALUES
  3410. <foreach collection="list" item="item" separator=",">
  3411. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
  3412. </foreach>
  3413. </insert>
  3414. <!-- 修改IQC主记录标识为已提交 -->
  3415. <update id="updateIQCMasterSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3416. UPDATE qc_iqc_record
  3417. SET submit_flag = 'Y',
  3418. state = '已完成',
  3419. submit_date = getDate()
  3420. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3421. </update>
  3422. <!-- 修改IQC明细记录标识为已提交 -->
  3423. <update id="updateIQCDetailSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3424. UPDATE qc_iqc_detailed_record
  3425. SET is_submit = 'Y'
  3426. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3427. </update>
  3428. <!-- 修改IQC子明细记录标识为已提交 -->
  3429. <update id="updateIQCSubDetailSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3430. UPDATE qc_iqc_sub_detail_record
  3431. SET is_submit = 'Y'
  3432. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3433. </update>
  3434. <!-- 删除IQC检验记录 -->
  3435. <delete id="deleteIQCRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3436. DELETE FROM qc_iqc_record
  3437. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3438. </delete>
  3439. <!-- 删除IQC明细记录信息 -->
  3440. <delete id="deleteIQCDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3441. DELETE FROM qc_iqc_detailed_record
  3442. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3443. </delete>
  3444. <!-- 删除IQC子明细记录信息 -->
  3445. <delete id="deleteIQCSubDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3446. DELETE FROM qc_iqc_sub_detail_record
  3447. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3448. </delete>
  3449. <!-- 查询文件ID -->
  3450. <select id="queryFileId" parameterType="com.heai.modules.oss.entity.SysOssEntity" resultType="com.heai.modules.oss.entity.SysOssEntity">
  3451. SELECT id, file_name
  3452. FROM sys_oss
  3453. WHERE order_ref1 = #{orderRef1} and order_ref2 = #{orderRef2}
  3454. </select>
  3455. <!-- 获取工序列表 -->
  3456. <select id="getOperationDescList" parameterType="com.heai.modules.pms.data.QcPartAttributeData" resultType="com.heai.modules.pms.data.QcPartAttributeData">
  3457. select DISTINCT OperationDesc from RoutingDetail
  3458. <where>
  3459. <if test = "operationDesc != null and operationDesc != ''">
  3460. AND OperationDesc LIKE '%' + #{operationDesc} + '%'
  3461. </if>
  3462. </where>
  3463. </select>
  3464. <!-- 获取供应商列表 -->
  3465. <select id="getManufacturerList" parameterType="com.heai.modules.pms.data.QcPartAttributeData" resultType="com.heai.modules.pms.data.QcPartAttributeData">
  3466. SELECT
  3467. supplierID as manufacturerID,
  3468. supplierName as manufacturerName
  3469. FROM view_Supplier
  3470. <where>
  3471. site = #{site}
  3472. <if test = "manufacturerID != null and manufacturerID != ''">
  3473. AND supplierID LIKE '%' + #{manufacturerID} + '%'
  3474. </if>
  3475. <if test = "manufacturerName != null and manufacturerName != ''">
  3476. AND supplierName LIKE '%' + #{manufacturerName} + '%'
  3477. </if>
  3478. </where>
  3479. </select>
  3480. <!-- 获取机台列表 -->
  3481. <select id="getAllResourceList" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  3482. SELECT distinct
  3483. resource_id,
  3484. resource_desc
  3485. FROM resource
  3486. <where>
  3487. site = #{site}
  3488. <if test = "resourceId != null and resourceId != ''">
  3489. AND resource_id LIKE '%' + #{resourceId} + '%'
  3490. </if>
  3491. <if test = "resourceDesc != null and resourceDesc != ''">
  3492. AND resource_desc LIKE '%' + #{resourceDesc} + '%'
  3493. </if>
  3494. </where>
  3495. </select>
  3496. <!-- 获取工单列表 -->
  3497. <select id="getOrderNoList" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  3498. SELECT DISTINCT
  3499. a.orderno as orderNo
  3500. FROM soscheduledrouting as a
  3501. LEFT JOIN sfdc as b ON a.site = b.site and a.seqno = b.assjob_seq_no
  3502. LEFT JOIN so_routing as c ON c.site = a.site and c.order_no = a.orderno and a.itemno = c.item_no
  3503. LEFT JOIN part j ON a.site = j.site and a.part_no = j.part_no
  3504. <where>
  3505. a.site = #{site}
  3506. AND b.approve_qty is not null
  3507. <if test = "orderNo != null and orderNo != ''">
  3508. AND a.orderno LIKE '%' + #{orderNo} + '%'
  3509. </if>
  3510. </where>
  3511. order by a.orderno DESC
  3512. </select>
  3513. <!-- 查询FQC主记录信息 -->
  3514. <select id="qcFQCInspectionSearch" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  3515. SELECT
  3516. a.inspection_no,
  3517. a.site,
  3518. a.bu_no,
  3519. a.state,
  3520. a.inspection_result,
  3521. a.task_date,
  3522. a.inspection_type_no,
  3523. dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) as inspectionTypeName,
  3524. a.inspection_cycle,
  3525. a.order_no,
  3526. a.operation_desc,
  3527. a.resource_id,
  3528. r.resource_desc,
  3529. a.part_no,
  3530. d.PartDescription as partDesc,
  3531. d.cinv_source_code as cinvSourceCode,
  3532. d.sku as sku,
  3533. d.invdefinetype as invdefinetype,
  3534. a.inspection_remark,
  3535. a.roll_qty,
  3536. a.sampling_qty,
  3537. a.disposal_measures,
  3538. a.disposal_remark,
  3539. a.inspector_date,
  3540. a.inspector_no,
  3541. u.user_display as inspectorName,
  3542. a.ssr_id,
  3543. a.unqualified_qty,
  3544. a.submit_flag,
  3545. a.seq_no,
  3546. a.batch_roll_no,
  3547. a.special_requirements,
  3548. a.work_center_no,
  3549. a.roll_no,
  3550. a.um_id,
  3551. um.UMName as umName,
  3552. a.action_date,
  3553. a.action_by,
  3554. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
  3555. isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
  3556. isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
  3557. isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
  3558. a.pass_qty,
  3559. a.not_pass_qty,
  3560. a.batch_qualified_qty,
  3561. a.receipt_no,
  3562. a.receipt_item_no,
  3563. a.ref_info1,
  3564. a.ref_info2,
  3565. a.ref_info3,
  3566. a.ref_info4,
  3567. a.ref_info5
  3568. FROM qc_fqc_record as a
  3569. left join part as d on a.site = d.site and a.bu_no = d.sourceBu and a.part_no = d.partNo
  3570. left join sys_user as u on a.inspector_no = u.username
  3571. left join resource as r on a.site = r.site and a.resource_id = r.resource_id and a.work_center_no = r.work_center_no
  3572. left join UM as um on a.site = um.site and a.um_id = um.UMID
  3573. <where>
  3574. <if test="query.site != null and query.site != ''">
  3575. AND a.site = #{query.site}
  3576. </if>
  3577. <if test = "query.inspectionNo != null and query.inspectionNo != ''">
  3578. AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
  3579. </if>
  3580. <if test = "query.partNo != null and query.partNo != ''">
  3581. AND a.part_no LIKE '%' + #{query.partNo} + '%'
  3582. </if>
  3583. <if test = "query.partDesc != null and query.partDesc != ''">
  3584. AND d.PartDescription LIKE '%' + #{query.partDesc} + '%'
  3585. </if>
  3586. <if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
  3587. AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  3588. </if>
  3589. <if test = "query.sku != null and query.sku != ''">
  3590. AND d.sku LIKE '%' + #{query.sku} + '%'
  3591. </if>
  3592. <if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
  3593. AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
  3594. </if>
  3595. <if test = "query.states != null and query.states.size > 0">
  3596. AND a.state in
  3597. <foreach item="item" collection="query.states" open="(" separator="," close=")">
  3598. #{item}
  3599. </foreach>
  3600. </if>
  3601. <if test = "query.inspectionResult != null and query.inspectionResult != ''">
  3602. AND a.inspection_result = #{query.inspectionResult}
  3603. </if>
  3604. <if test = "query.orderNo != null and query.orderNo != ''">
  3605. AND a.order_no LIKE '%' + #{query.orderNo} + '%'
  3606. </if>
  3607. <if test = "query.seqNo != null and query.seqNo != ''">
  3608. AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
  3609. </if>
  3610. <if test = "query.operationDesc != null and query.operationDesc != ''">
  3611. AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
  3612. </if>
  3613. <if test="query.startDate != null">
  3614. AND a.inspector_date >= #{query.startDate}
  3615. </if>
  3616. <if test="query.endDate != null">
  3617. AND #{query.endDate} >= a.inspector_date
  3618. </if>
  3619. <if test="query.startDate2 != null">
  3620. AND a.task_date >= #{query.startDate2}
  3621. </if>
  3622. <if test="query.endDate2 != null">
  3623. AND #{query.endDate2} >= a.task_date
  3624. </if>
  3625. </where>
  3626. ORDER BY
  3627. CASE WHEN a.state = '待检验' THEN 1
  3628. WHEN a.state = '待审核' THEN 2
  3629. WHEN a.state = '已完成' THEN 3
  3630. END, a.task_date desc
  3631. </select>
  3632. <insert id="saveFQCDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3633. INSERT INTO qc_fqc_detailed_record
  3634. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  3635. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  3636. max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
  3637. VALUES
  3638. (#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc},
  3639. #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL},
  3640. #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo},#{orderId,jdbcType=INTEGER})
  3641. </insert>
  3642. <!-- 新增FQC明细记录信息 -->
  3643. <insert id="saveFQCDetailedRecords">
  3644. INSERT INTO qc_fqc_detailed_record
  3645. (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
  3646. AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
  3647. max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
  3648. VALUES
  3649. <foreach collection="list" item="item" separator=",">
  3650. (#{item.inspectionNo}, #{item.orderNo}, #{item.templateId}, #{item.samplingLevelNo}, #{item.samplingLevelDesc}, #{item.samplingProgrammeNo}, #{item.samplingProgrammeDesc},
  3651. #{item.aql,jdbcType=DECIMAL}, #{item.ac,jdbcType=DECIMAL}, #{item.re,jdbcType=DECIMAL}, #{item.itemNo}, #{item.itemDesc}, #{item.objectId}, #{item.objectDesc}, #{item.defaultValue}, #{item.minValue,jdbcType=DECIMAL},
  3652. #{item.maxValue,jdbcType=DECIMAL}, #{item.valueTypeDb}, #{item.valueType}, #{item.site}, #{item.samplingQty,jdbcType=DECIMAL}, #{item.buNo}, #{item.orderId})
  3653. </foreach>
  3654. </insert>
  3655. <!-- 新增FQC主记录信息 -->
  3656. <insert id="saveFQCRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3657. INSERT INTO qc_fqc_record
  3658. (inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id,
  3659. part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id,ref_info1,ref_info2)
  3660. VALUES
  3661. (#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId},
  3662. #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId},#{refInfo1},#{refInfo2})
  3663. </insert>
  3664. <!-- FQC明细记录查询 -->
  3665. <select id="fqcDetailSearch" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  3666. SELECT
  3667. a.site,
  3668. a.bu_no,
  3669. a.inspection_no,
  3670. a.order_no,
  3671. a.template_id,
  3672. a.sampling_level_no,
  3673. a.sampling_level_desc,
  3674. a.sampling_programme_no,
  3675. a.sampling_programme_desc,
  3676. a.AQL,
  3677. a.AC,
  3678. a.RE,
  3679. a.item_no,
  3680. a.item_desc,
  3681. a.object_id,
  3682. a.object_desc,
  3683. a.default_value,
  3684. a.min_value,
  3685. a.max_value,
  3686. a.text_value,
  3687. a.number_value,
  3688. a.value_type_db,
  3689. a.value_type,
  3690. case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
  3691. a.is_submit,
  3692. isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
  3693. a.sampling_qty,
  3694. dbo.qc_get_fqc_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
  3695. c.method_no,
  3696. c.method_name,
  3697. c.method_remark,
  3698. (
  3699. SELECT COUNT(*)
  3700. FROM sys_oss
  3701. WHERE order_ref1 = a.site and order_ref2 = a.inspection_no and order_ref3 = a.item_no and order_ref4 = a.bu_no
  3702. ) AS imageDetailNum
  3703. FROM qc_fqc_detailed_record as a
  3704. LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
  3705. LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
  3706. WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
  3707. order by a.order_id
  3708. </select>
  3709. <!-- 删除FQC检验记录 -->
  3710. <delete id="deleteFQCRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3711. DELETE FROM qc_fqc_record
  3712. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3713. </delete>
  3714. <!-- 删除FQC明细记录信息 -->
  3715. <delete id="deleteFQCDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3716. DELETE FROM qc_fqc_detailed_record
  3717. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3718. </delete>
  3719. <!-- 删除FQC子明细记录信息 -->
  3720. <delete id="deleteFQCSubDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3721. DELETE FROM qc_fqc_sub_detail_record
  3722. WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  3723. </delete>
  3724. <!-- 修改FQC主记录信息 -->
  3725. <update id="updateFQCMasterRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3726. UPDATE qc_fqc_record
  3727. SET disposal_measures = #{disposalMeasures},
  3728. disposal_remark = #{disposalRemark},
  3729. inspection_result = #{inspectionResult},
  3730. inspector_no = #{inspectorNo},
  3731. state = #{state},
  3732. inspection_remark = #{inspectionRemark},
  3733. inspector_date = getDate(),
  3734. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  3735. roll_qty = #{rollQty,jdbcType=DECIMAL},
  3736. unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
  3737. pass_qty = #{passQty,jdbcType=DECIMAL},
  3738. not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
  3739. batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
  3740. submit_date = getDate()
  3741. WHERE site = #{site} and inspection_no = #{inspectionNo} and bu_no = #{buNo}
  3742. </update>
  3743. <!-- 修改FQC明细记录信息 -->
  3744. <update id="updateFQCDetailedRecord" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3745. UPDATE qc_fqc_detailed_record
  3746. SET item_result = #{itemResult},
  3747. unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
  3748. sampling_qty = #{samplingQty,jdbcType=DECIMAL},
  3749. text_value = #{textValue},
  3750. number_value = #{numberValue,jdbcType=DECIMAL}
  3751. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  3752. </update>
  3753. <!-- 修改FQC主记录标识为已提交 -->
  3754. <update id="updateFQCMasterSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3755. UPDATE qc_fqc_record
  3756. SET submit_flag = 'Y',
  3757. state = '已完成',
  3758. submit_date = getDate()
  3759. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3760. </update>
  3761. <!-- 修改FAI明细记录标识为已提交 -->
  3762. <update id="updateFQCDetailSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3763. UPDATE qc_fqc_detailed_record
  3764. SET is_submit = 'Y'
  3765. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3766. </update>
  3767. <!-- 修改子明细记录标识为已提交 -->
  3768. <update id="updateFQCSubDetailSubmitFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3769. UPDATE qc_fqc_sub_detail_record
  3770. SET is_submit = 'Y'
  3771. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3772. </update>
  3773. <!-- 删除子明细的老数据 -->
  3774. <delete id="delFQCSubDetailedRecord" parameterType="com.heai.modules.pms.data.QcSubDetailInformationData">
  3775. DELETE FROM qc_fqc_sub_detail_record
  3776. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  3777. </delete>
  3778. <!-- 新增子明细信息 -->
  3779. <insert id="saveFQCSubDetailed">
  3780. INSERT INTO qc_fqc_sub_detail_record
  3781. (inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e)
  3782. VALUES
  3783. <foreach collection="list" item="item" separator=",">
  3784. (#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
  3785. </foreach>
  3786. </insert>
  3787. <!-- 查询FQC的子明细 -->
  3788. <select id="selectFQCSubDetailedRecord" parameterType="com.heai.modules.pms.data.SubDetailValues" resultType="com.heai.modules.pms.data.SubDetailValues">
  3789. SELECT
  3790. site,
  3791. bu_no,
  3792. sub_detail_value,
  3793. sampling_location,
  3794. is_submit,
  3795. sampling_location_b,
  3796. num,
  3797. sub_detail_value_b,
  3798. sub_detail_value_c,
  3799. sub_detail_value_d,
  3800. sub_detail_value_e
  3801. FROM qc_fqc_sub_detail_record
  3802. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
  3803. <if test = "collectionDataContent != null and collectionDataContent != ''">
  3804. AND sub_detail_value ${collectionDataContent}
  3805. </if>
  3806. </select>
  3807. <!-- 查询FQC检验记录是否已提交 -->
  3808. <select id="checkFQCIsSubmit" parameterType="com.heai.modules.pms.data.SubDetailValues" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  3809. SELECT submit_flag
  3810. FROM qc_fqc_record
  3811. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  3812. </select>
  3813. <!-- 获取该项目的子明细值 -->
  3814. <select id="selectFQCSubDetailValue" parameterType="string" resultType="com.heai.modules.pms.data.SubDetailValues">
  3815. SELECT sub_detail_value,
  3816. sampling_location,
  3817. is_submit
  3818. FROM qc_fqc_sub_detail_record
  3819. WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
  3820. </select>
  3821. <!-- 生成FQC检验单号 -->
  3822. <select id="selectFQCInspectionNo" resultType="string" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3823. SELECT
  3824. Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,4,10))),0)+1),8)
  3825. FROM qc_fqc_record
  3826. WHERE site = #{site} and bu_no = #{buNo}
  3827. </select>
  3828. <!-- 生成IPQC检验单号 -->
  3829. <select id="selectIPQCInspectionNo" resultType="string" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3830. SELECT
  3831. Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,5,10))),0)+1),8)
  3832. FROM qc_ipqc_record
  3833. WHERE site = #{site} and bu_no = #{buNo}
  3834. </select>
  3835. <select id="selectIQCInspectionNo" resultType="java.lang.String">
  3836. SELECT
  3837. Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,5,10))),0)+1),8)
  3838. FROM qc_iqc_record
  3839. WHERE site = #{site} and bu_no = #{buNo}
  3840. </select>
  3841. <select id="selectSQCInspectionNo" resultType="java.lang.String">
  3842. SELECT
  3843. Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,5,10))),0)+1),8)
  3844. FROM qc_sqc_record
  3845. WHERE site = #{site} and bu_no = #{buNo}
  3846. </select>
  3847. <!-- 生成FAI检验单号 -->
  3848. <select id="selectFAIInspectionNo" resultType="string" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3849. SELECT
  3850. Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,4,10))),0)+1),8)
  3851. FROM qc_fai_record
  3852. WHERE site = #{site} and bu_no = #{buNo}
  3853. </select>
  3854. <!-- 根据 site、po_orderNo、po_itemNo 从 view_po_order 中查出数据 -->
  3855. <select id="queryDataFromViewPoOrder" resultType="com.heai.modules.pms.data.PoOrderData" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3856. SELECT
  3857. site,
  3858. order_no,
  3859. item_no,
  3860. part_no,
  3861. part_desc,
  3862. spec,
  3863. supplier_id,
  3864. supplier_name,
  3865. order_qty,
  3866. created_date,
  3867. status,
  3868. citem_code,
  3869. citem_class,
  3870. sendto_address,
  3871. order_type
  3872. FROM view_po_order
  3873. WHERE site = #{site} and order_no = #{poOrderNo} and item_no = #{poItemNo}
  3874. </select>
  3875. <!-- 向收货任务表里添加数据 -->
  3876. <insert id="saveReceivingTask" parameterType="com.heai.modules.pms.data.PoOrderData">
  3877. INSERT INTO receiving_task (site, order_no, item_no, part_no, part_desc, spec, supplier_id, supplier_name, order_qty, created_date, status, citem_code, citem_class, sendto_address, order_type, inspection_no, batch_no, production_date, expiration_warning_date, expiration_date)
  3878. VALUES (#{site}, #{orderNo}, #{itemNo}, #{partNo}, #{partDesc}, #{spec}, #{supplierId}, #{supplierName}, #{orderQty}, getDate(), #{status}, #{citemCode}, #{citemClass}, #{sendtoAddress}, #{orderType}, #{inspectionNo}, #{batchNo}, #{productionDate}, #{expirationWarningDate}, #{expirationDate})
  3879. </insert>
  3880. <!-- 检查动控是否开启 -->
  3881. <select id="queryController" parameterType="com.heai.modules.sys.entity.SysSceneDynamicControlModelEntity" resultType="com.heai.modules.sys.entity.SysSceneDynamicControlModelEntity">
  3882. SELECT
  3883. type,
  3884. base_data,
  3885. base_desc,
  3886. status,
  3887. remark,
  3888. third_type,
  3889. second_type,
  3890. page_control,
  3891. control_style
  3892. FROM sys_scene_dynamic_control_model
  3893. where site = #{site} and control_no = #{controlNo}
  3894. </select>
  3895. <!-- 查询检验模板列表 -->
  3896. <select id="queryTemplateList" resultType="com.heai.modules.pms.data.QcTemplateData" parameterType="com.heai.modules.pms.data.QcTemplateData">
  3897. SELECT
  3898. site,
  3899. bu_no,
  3900. template_id as templateId,
  3901. template_name as templateName,
  3902. dbo.qc_get_inspection_type_name(site, inspection_type_no) as inspectionTypeName
  3903. FROM qc_template
  3904. <where>
  3905. site = #{site} and bu_no = #{buNo} and dbo.qc_get_inspection_type_name(site, inspection_type_no) = #{inspectionTypeName}
  3906. <if test = "templateId != null and templateId != ''">
  3907. AND template_id LIKE '%' + #{templateId}+'%'
  3908. </if>
  3909. <if test = "templateName != null and templateName != ''">
  3910. AND template_name LIKE '%' + #{templateName}+'%'
  3911. </if>
  3912. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  3913. AND inspection_type_no = #{inspectionTypeNo}
  3914. </if>
  3915. </where>
  3916. </select>
  3917. <!-- 查询检验模板列表 -->
  3918. <select id="getPartInformation" resultType="com.heai.modules.pms.data.QcFAIRecordData" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3919. select
  3920. part_no,
  3921. part_desc,
  3922. spec,
  3923. sku,
  3924. control_mes,
  3925. DefaultWarehouseID as defaultWarehouseId
  3926. from part
  3927. where site = #{site} and part_no = #{partNo}
  3928. </select>
  3929. <!-- 获取特殊工序列表 -->
  3930. <select id="getSpecialOperationList" resultType="com.heai.modules.pms.data.QcFAIRecordData" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3931. select
  3932. site,
  3933. operation_no,
  3934. operation_desc
  3935. from qc_special_task_operation
  3936. where site = #{site}
  3937. </select>
  3938. <!-- 获取处置措施列表 -->
  3939. <select id="disposalMeasuresSearch" resultType="com.heai.modules.pms.data.QcFAIRecordData" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3940. SELECT
  3941. id,
  3942. disposal_measures
  3943. FROM qc_disposal_measures
  3944. <where>
  3945. <if test = "inspectionTypeNo != '101'">
  3946. inspection_type != 'IPQC'
  3947. </if>
  3948. </where>
  3949. </select>
  3950. <!-- 查询文件路径 -->
  3951. <select id="searchItemFileUrl" resultType="com.heai.modules.oss.entity.SysOssEntity" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3952. SELECT
  3953. id,
  3954. url,
  3955. file_name
  3956. FROM sys_oss
  3957. WHERE order_ref1 = #{site} and order_ref2 = #{inspectionNo} and order_ref3 = #{itemNo} and order_ref4 = #{buNo}
  3958. </select>
  3959. <!-- 删除图片-->
  3960. <delete id="imageDelete" parameterType="com.heai.modules.oss.entity.SysOssEntity">
  3961. DELETE FROM sys_oss
  3962. WHERE id = #{id}
  3963. </delete>
  3964. <!-- 模糊查询标签号 -->
  3965. <select id="getRollNo" resultType="com.heai.modules.pms.data.QcFAIRecordData" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3966. SELECT DISTINCT top 3
  3967. a.seqno,
  3968. a.orderno,
  3969. b.roll_no
  3970. FROM soscheduledrouting AS a
  3971. LEFT JOIN sfdc_rolls AS b ON a.site = b.site AND a.seqno = b.createdops_seqno
  3972. WHERE a.site = #{site} and b.roll_no like '%' + #{rollNo} + '%'
  3973. </select>
  3974. <!-- 标签号回车事件 -->
  3975. <select id="rollNoEnter" resultType="com.heai.modules.pms.data.QcFAIRecordData" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3976. SELECT
  3977. a.site,
  3978. a.seqno as seqNo,
  3979. a.orderno as orderNo,
  3980. b.roll_no,
  3981. #{inspectionTypeNo} as inspectionTypeNo
  3982. FROM soscheduledrouting AS a
  3983. LEFT JOIN sfdc_rolls AS b ON a.site = b.site AND a.seqno = b.createdops_seqno
  3984. WHERE a.site = #{site} and b.roll_no = #{rollNo}
  3985. </select>
  3986. <!-- 查询物料列表 -->
  3987. <select id="queryPartList" resultType="com.heai.modules.pms.data.QcFAIRecordData" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  3988. SELECT
  3989. site,
  3990. PartNo,
  3991. PartDescription as part_desc,
  3992. sku,
  3993. spec
  3994. FROM part
  3995. <where>
  3996. site = #{site}
  3997. <if test = "partNo != null and partNo != ''">
  3998. AND PartNo LIKE '%' + #{partNo} + '%'
  3999. </if>
  4000. <if test = "partDesc != null and partDesc != ''">
  4001. AND PartDescription LIKE '%' + #{partDesc} + '%'
  4002. </if>
  4003. <if test = "sku != null and sku != ''">
  4004. AND sku LIKE '%' + #{sku} + '%'
  4005. </if>
  4006. </where>
  4007. </select>
  4008. <!-- 查询单位列表 -->
  4009. <select id="umSearch" resultType="com.heai.modules.pms.data.QcFAIRecordData" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4010. SELECT
  4011. site,
  4012. UMID as umId,
  4013. UMName as umName
  4014. FROM UM
  4015. WHERE site = #{site} and active = #{active}
  4016. </select>
  4017. <!-- 查询单位列表 -->
  4018. <select id="checkItem" resultType="com.heai.modules.pms.data.SubDetailValues" parameterType="com.heai.modules.pms.data.SubDetailValues">
  4019. SELECT
  4020. site,
  4021. bu_no,
  4022. inspection_no,
  4023. item_no,
  4024. value_type_db,
  4025. min_value,
  4026. max_value
  4027. <if test = "flag == 'IPQC'">
  4028. FROM qc_ipqc_detailed_record
  4029. </if>
  4030. <if test = "flag == 'IQC'">
  4031. FROM qc_iqc_detailed_record
  4032. </if>
  4033. <if test = "flag == 'FQC'">
  4034. FROM qc_fqc_detailed_record
  4035. </if>
  4036. <if test = "flag == 'FAI'">
  4037. FROM qc_fai_detailed_record
  4038. </if>
  4039. <if test = "flag == 'SQC'">
  4040. FROM qc_sqc_detailed_record
  4041. </if>
  4042. WHERE site = #{site} and inspection_no = #{inspectionNo} and item_no = #{itemNo} and bu_no = #{buNo}
  4043. order by order_id
  4044. </select>
  4045. <!-- 查询检验方法列表 -->
  4046. <select id="queryMethodList" resultType="com.heai.modules.pms.data.QcMethodData" parameterType="com.heai.modules.pms.data.QcMethodData">
  4047. SELECT
  4048. site,
  4049. bu_no,
  4050. method_no,
  4051. method_name,
  4052. inspection_type_no,
  4053. dbo.qc_get_inspection_type_name(site, inspection_type_no) as inspectionTypeName
  4054. FROM qc_method
  4055. <where>
  4056. site = #{site}
  4057. <if test = "methodNo != null and methodNo != ''">
  4058. AND method_no LIKE '%' + #{methodNo} + '%'
  4059. </if>
  4060. <if test = "methodName != null and methodName != ''">
  4061. AND method_name LIKE '%' + #{methodName} + '%'
  4062. </if>
  4063. <if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
  4064. AND inspection_type_no = #{inspectionTypeNo}
  4065. </if>
  4066. <if test="inspectionTypeName != null and inspectionTypeName != ''">
  4067. AND dbo.qc_get_inspection_type_name(site, inspection_type_no) = #{inspectionTypeName}
  4068. </if>
  4069. </where>
  4070. </select>
  4071. <!-- 修改detailFlag字段为N -->
  4072. <update id="updateIQCDetailFlag" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4073. UPDATE qc_iqc_record
  4074. SET detail_flag = 'N'
  4075. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4076. </update>
  4077. <!-- 查询检验方法唯一 -->
  4078. <select id="checkMethodOnlyOne" resultType="com.heai.modules.pms.data.QcMethodData" parameterType="com.heai.modules.pms.data.QcMethodData">
  4079. SELECT
  4080. site,
  4081. bu_no,
  4082. method_no
  4083. FROM qc_method
  4084. <where>
  4085. site = #{site} and bu_no = #{buNo} and method_no = #{methodNo}
  4086. </where>
  4087. </select>
  4088. <!-- 查询检验项目唯一 -->
  4089. <select id="checkItemOnlyOne" resultType="com.heai.modules.pms.data.QcItemData" parameterType="com.heai.modules.pms.data.QcItemData">
  4090. SELECT
  4091. site,
  4092. bu_no,
  4093. ItemNo,
  4094. ItemDesc
  4095. FROM eam_properties_item
  4096. <where>
  4097. site = #{site} and ItemNo = #{itemNo} and ItemType = #{itemType} and inspection_type_no = #{inspectionTypeNo}
  4098. </where>
  4099. </select>
  4100. <!-- 查询检验项目唯一 -->
  4101. <select id="checkTemplateOnlyOne" resultType="com.heai.modules.pms.data.QcTemplateData" parameterType="com.heai.modules.pms.data.QcTemplateData">
  4102. SELECT
  4103. site,
  4104. bu_no,
  4105. template_id,
  4106. template_name
  4107. FROM qc_template
  4108. <where>
  4109. site = #{site} and template_id = #{templateId}
  4110. </where>
  4111. </select>
  4112. <select id="searchSeqInfo" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  4113. SELECT DISTINCT
  4114. a.seqno,
  4115. a.orderno,
  4116. J.PartNo,
  4117. J.PartDescription as partDesc,
  4118. t.lotsize,
  4119. a.qtyrequired,
  4120. c.OperationDesc,
  4121. J.sku,
  4122. sum(roll_qty) as sjzs,
  4123. sum(roll_qty) as roll_qty
  4124. FROM soscheduledrouting AS a
  4125. inner JOIN RoutingDetail AS c ON c.site = a.site and a.partNO = C.PartNo AND a.itemno = c.itemNo
  4126. inner JOIN part AS J ON a.site = J.site AND a.partNo = J.PartNo
  4127. inner JOIN shoporder AS t ON a.site = t.site AND t.orderno = a.orderno
  4128. left join qc_ipqc_record as r on a.site = r.site and a.seqno = r.seq_no
  4129. WHERE
  4130. a.site = #{query.site}
  4131. <if test="query.orderNo != null and query.orderNo != ''">
  4132. AND a.orderno LIKE '%' + #{query.orderNo} + '%'
  4133. </if>
  4134. <if test="query.seqNo != null and query.seqNo != ''">
  4135. AND a.seqno LIKE '%' + #{query.seqNo} + '%'
  4136. </if>
  4137. <if test="query.sku != null and query.sku != ''">
  4138. AND j.sku LIKE '%' + #{query.sku} + '%'
  4139. </if>
  4140. <if test="query.partNo != null and query.partNo != ''">
  4141. AND J.PartNo LIKE '%' + #{query.partNo} + '%'
  4142. </if>
  4143. <if test="query.partDesc != null and query.partDesc != ''">
  4144. AND J.PartDescription LIKE '%' + #{query.partDesc} + '%'
  4145. </if>
  4146. <if test="query.operationDesc != null and query.operationDesc != ''">
  4147. AND c.OperationDesc LIKE '%' + #{query.operationDesc} + '%'
  4148. </if>
  4149. <if test="query.status != null and query.status != ''">
  4150. AND a.ClosedFlag = #{query.status}
  4151. </if>
  4152. group by a.seqno, a.orderno, J.PartNo, J.PartDescription, t.lotsize, a.qtyrequired, c.OperationDesc, J.sku
  4153. </select>
  4154. <select id="searchPartInfo" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  4155. select
  4156. PartNo,
  4157. PartDescription as part_desc,
  4158. sku,
  4159. cinv_source_code,
  4160. sourceBu
  4161. from
  4162. part
  4163. where
  4164. site = #{query.site}
  4165. <if test="query.partNo != null and query.partNo != ''">
  4166. AND PartNo LIKE '%' + #{query.partNo} + '%'
  4167. </if>
  4168. <if test="query.partDesc != null and query.partDesc != ''">
  4169. AND PartDescription LIKE '%' + #{query.partDesc} + '%'
  4170. </if>
  4171. <if test="query.sku != null and query.sku != ''">
  4172. AND sku LIKE '%' + #{query.sku} + '%'
  4173. </if>
  4174. <if test="query.cinvSourceCode != null and query.cinvSourceCode != ''">
  4175. AND cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
  4176. </if>
  4177. </select>
  4178. <select id="getInterfaceTimeData" parameterType="String" resultType="com.heai.modules.pms.data.InterfaceTimeData">
  4179. SELECT
  4180. id,
  4181. start_time,
  4182. end_time,
  4183. del_flag
  4184. FROM interface_time
  4185. WHERE del_flag = 'N' and site = #{site}
  4186. </select>
  4187. <update id="updateInterfaceTimeData" parameterType="com.heai.modules.pms.data.InterfaceTimeData">
  4188. UPDATE interface_time
  4189. set
  4190. updated_by = #{updatedBy},
  4191. updated_date = #{updatedDate},
  4192. del_flag = #{delFlag}
  4193. </update>
  4194. <select id="getInterfaceRdStyleData" parameterType="String" resultType="com.heai.modules.pms.data.RdStyleData">
  4195. SELECT
  4196. crdcode,
  4197. crdname,
  4198. iRdGrade,
  4199. rdtype,
  4200. brdend
  4201. FROM view_custdev_mes_rdstyle
  4202. WHERE crdname = #{crdName}
  4203. </select>
  4204. <insert id="insertHardtagPurchaseInStorageData" parameterType="com.heai.modules.pms.data.HardtagPurchaseInStorageCountData" useGeneratedKeys="true" keyProperty="id">
  4205. INSERT INTO purchase_in_storage_count
  4206. (site, trans_no, created_date, created_by, erp_flag, toacc, logindate, cordercode, cdepcode, cwhcode, crdcode, coutcode, ddate, bredvouch,
  4207. cmemo, verify, irowno, cinvcode, iquantity, citemcode, erp_remark, trans_date, csource, trans_type)
  4208. values (#{site}, #{transNo}, #{createdDate}, #{createdBy}, #{erpFlag}, #{toacc}, #{logindate}, #{cordercode}, #{cdepcode}, #{cwhcode}, #{crdcode}, #{coutcode}, #{ddate}, #{bredvouch},
  4209. #{cmemo}, #{verify}, #{irowno}, #{cinvcode}, #{iquantity}, #{citemcode}, #{erpRemark}, #{transDate}, #{csource}, #{transType})
  4210. </insert>
  4211. <insert id="batchSaveHrdtagTransHeader" parameterType="com.heai.modules.pms.data.HardtagTransHeaderData">
  4212. insert into TransHeader
  4213. (TransNo, Site, WarehouseID, TransDate, TransType_DB, TransType, UserName, Receiver, TransYear, TransMonth, PartnerID, PartnerType, AuthorizeFlag, AuthorizeDate, Authorizor, TransferFlag, TransferDate,
  4214. TransferGuys, VoucherDate, ProjectID, EnterDate, Remark, UseLocation, OrderRef1, LinkOrderFlag, DelAddID, Status, ProjectName, PartnerName, erp_warehouse_id, ERP,
  4215. department_no, picking_status, scan_type, inCategory, pmProject, remarks, item_no_mat, remark3, location_id, count_id)
  4216. values (#{TransNo}, #{Site}, #{WarehouseID}, #{TransDate}, #{TransTypeDB}, #{TransType}, #{UserName}, #{Receiver}, #{TransYear}, #{TransMonth}, #{PartnerID}, #{PartnerType}, #{AuthorizeFlag}, #{AuthorizeDate}, #{Authorizor}, #{TransferFlag}, #{TransferDate},
  4217. #{TransferGuys}, #{VoucherDate}, #{ProjectID}, #{EnterDate}, #{Remark}, #{UseLocation}, #{OrderRef1}, #{LinkOrderFlag}, #{DelAddID}, #{Status}, #{ProjectName}, #{PartnerName}, #{erpWarehouseId}, #{ERP},
  4218. #{departmentNo}, #{pickingStatus}, #{scanType}, #{inCategory}, #{pmProject}, #{remarks}, #{itemNoMat}, #{remark3}, #{locationId}, #{countId})
  4219. </insert>
  4220. <insert id="batchSaveHardtagTransDetail" parameterType="com.heai.modules.pms.data.HardtagTransDetailData">
  4221. INSERT INTO TransDetail
  4222. (TransNo, Site, PartNo, LocationID, TransQty, Direction, OrderRef1, ItemNo, OrderRef2, OrderRef3, OrderRef5, Remark, citem_code)
  4223. values
  4224. (#{TransNo}, #{Site}, #{PartNo}, #{LocationID}, #{TransQty}, #{Direction}, #{OrderRef1}, #{ItemNo}, #{OrderRef2}, #{OrderRef3}, #{OrderRef5}, #{Remark}, #{citemCode})
  4225. </insert>
  4226. <select id="getSendMailAddress" parameterType="String" resultType="com.heai.modules.pms.data.MailAddressData">
  4227. SELECT
  4228. id,
  4229. site,
  4230. bu_no,
  4231. mail_address,
  4232. send_type,
  4233. del_flag,
  4234. created_by,
  4235. created_date,
  4236. orderref1
  4237. FROM mailAddress
  4238. WHERE site = #{site} and send_type = #{type} and del_flag = 'N'
  4239. <if test="buNo != null and buNo != ''">
  4240. AND bu_no = #{buNo}
  4241. </if>
  4242. </select>
  4243. <select id="getSendMailFromAddress" resultType="com.heai.modules.pms.data.MailSendAddressData">
  4244. SELECT
  4245. port,
  4246. host,
  4247. username,
  4248. password,
  4249. emailForm,
  4250. timeout,
  4251. personal,
  4252. id
  4253. FROM mailSendAddress
  4254. where delFlag = 'N'
  4255. </select>
  4256. <!-- 新增发送邮件记录 -->
  4257. <insert id="saveSendMailRecord" parameterType="com.heai.modules.pms.data.SendMailRecord">
  4258. insert into send_mail_record
  4259. (site, bu_no, document_no, sender, recipient, send_date, type)
  4260. values
  4261. (#{site}, #{buNo}, #{documentNo}, #{sender}, #{recipient}, getDate(), #{type})
  4262. </insert>
  4263. <select id="orderTypeSearch" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  4264. SELECT distinct
  4265. order_type
  4266. FROM view_po_order
  4267. </select>
  4268. <update id="actionIQCInspection" parameterType="com.heai.modules.pms.data.EamObjectInData">
  4269. update qc_iqc_record
  4270. set action_date = getDate(),
  4271. action_by = #{actionBy},
  4272. state = #{state}
  4273. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  4274. </update>
  4275. <update id="actionSQCInspection" parameterType="com.heai.modules.pms.data.EamObjectInData">
  4276. update qc_sqc_record
  4277. set action_date = getDate(),
  4278. action_by = #{actionBy},
  4279. state = #{state}
  4280. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  4281. </update>
  4282. <update id="actionFAIInspection" parameterType="com.heai.modules.pms.data.EamObjectInData">
  4283. update qc_fai_record
  4284. set action_date = getDate(),
  4285. action_by = #{actionBy},
  4286. state = #{state}
  4287. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  4288. </update>
  4289. <update id="actionIPQCInspection" parameterType="com.heai.modules.pms.data.EamObjectInData">
  4290. update qc_ipqc_record
  4291. set action_date = getDate(),
  4292. action_by = #{actionBy},
  4293. state = #{state}
  4294. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  4295. </update>
  4296. <update id="actionFQCInspection" parameterType="com.heai.modules.pms.data.EamObjectInData">
  4297. update qc_fqc_record
  4298. set action_date = getDate(),
  4299. action_by = #{actionBy},
  4300. state = #{state}
  4301. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  4302. </update>
  4303. <insert id="addEquipmentDataAcquisition">
  4304. insert into Equipment_data_acquisition
  4305. (site, bu_no, equipment_no, inspection_no, create_date, create_by, item_no, collection_source, collection_method)
  4306. values
  4307. <foreach collection="list" item="item" separator=",">
  4308. (#{item.site}, #{item.buNo}, #{item.equipmentNo}, #{item.inspectionNo}, getDate(), #{item.actionBy}, #{item.itemNo}, #{item.collectionSource}, #{item.collectionMethod})
  4309. </foreach>
  4310. </insert>
  4311. <!-- 新增人员信息 -->
  4312. <insert id="saveOperator" >
  4313. INSERT INTO eam_actual_operator
  4314. (site, order_no, function_type, operator, bu_no)
  4315. VALUES
  4316. <foreach collection="list" item="item" separator=",">
  4317. (#{item.site}, #{item.orderNo}, #{item.functionType}, #{item.operator}, #{item.buNo})
  4318. </foreach>
  4319. </insert>
  4320. <!-- 删除之前的人员-->
  4321. <delete id="delOperator" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4322. DELETE FROM eam_actual_operator
  4323. WHERE site = #{site} and order_no = #{inspectionNo} and bu_no = #{buNo}
  4324. </delete>
  4325. <select id="getInspectionNo" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.EquipmentDataAcquisitionData">
  4326. select distinct
  4327. site,
  4328. bu_no,
  4329. equipment_no,
  4330. inspection_no,
  4331. item_no,
  4332. collection_source,
  4333. collection_method
  4334. from Equipment_data_acquisition
  4335. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  4336. </select>
  4337. <select id="getInspectionNoByItem" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.EquipmentDataAcquisitionData">
  4338. select distinct
  4339. site,
  4340. bu_no,
  4341. equipment_no,
  4342. inspection_no,
  4343. item_no,
  4344. collection_source,
  4345. collection_method
  4346. from Equipment_data_acquisition
  4347. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo} and item_no = #{itemNo}
  4348. </select>
  4349. <select id="dataAcquisition" parameterType="com.heai.modules.pms.data.EquipmentDataAcquisitionData" resultType="com.heai.modules.pms.data.SubDetailValues">
  4350. select
  4351. id,
  4352. site,
  4353. bu_no,
  4354. #{inspectionNo} as inspectionNo,
  4355. #{itemNo} as itemNo,
  4356. <if test='subDetailValueType == 0'>
  4357. ${collectionSource} as subDetailValue,
  4358. </if>
  4359. <if test='subDetailValueType == 1'>
  4360. ${collectionSource} as subDetailValueB,
  4361. </if>
  4362. <if test='subDetailValueType == 2'>
  4363. ${collectionSource} as subDetailValueC,
  4364. </if>
  4365. <if test='subDetailValueType == 3'>
  4366. ${collectionSource} as subDetailValueD,
  4367. </if>
  4368. <if test='subDetailValueType == 4'>
  4369. ${collectionSource} as subDetailValueE,
  4370. </if>
  4371. num,
  4372. #{collectionSource} as collectionSource,
  4373. #{collectionMethod} as collectionMethod
  4374. from Equipment_data_detail
  4375. where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo} and ${collectionSource} is not null and ${collectionSource} <![CDATA[<>]]> ''
  4376. <if test='collectionMethod == "plc"'>
  4377. AND inspection_no = #{inspectionNo}
  4378. </if>
  4379. <if test='collectionMethod == "RS232"'>
  4380. AND (inspection_no is null or inspection_no = '')
  4381. </if>
  4382. <if test = "collectionDataContent != null and collectionDataContent != ''">
  4383. AND ${collectionSource} ${collectionDataContent}
  4384. </if>
  4385. and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo})
  4386. </select>
  4387. <select id="dataAcquisitionB" parameterType="com.heai.modules.pms.data.EquipmentDataAcquisitionData" resultType="com.heai.modules.pms.data.SubDetailValues">
  4388. select
  4389. id,
  4390. site,
  4391. bu_no,
  4392. #{inspectionNo} as inspectionNo,
  4393. #{itemNo} as itemNo,
  4394. ${collectionSource} as subDetailValueB,
  4395. num,
  4396. #{collectionSource} as collectionSource
  4397. from Equipment_data_detail
  4398. where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo} and ${collectionSource} is not null and ${collectionSource} <![CDATA[<>]]> ''
  4399. <if test='collectionMethod == "plc"'>
  4400. AND inspection_no = #{inspectionNo}
  4401. </if>
  4402. <if test='collectionMethod == "RS232"'>
  4403. AND (inspection_no is null or inspection_no = '')
  4404. </if>
  4405. and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo})
  4406. </select>
  4407. <select id="dataAcquisition2" parameterType="com.heai.modules.pms.data.EquipmentDataAcquisitionData" resultType="com.heai.modules.oss.entity.SysOssEntity">
  4408. select
  4409. site as orderRef1,
  4410. bu_no as orderRef4,
  4411. #{inspectionNo} as orderRef2,
  4412. #{itemNo} as orderRef3,
  4413. ${collectionSource} as url
  4414. from Equipment_data_detail
  4415. where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo} and ${collectionSource} is not null and ${collectionSource} <![CDATA[<>]]> ''
  4416. and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo})
  4417. </select>
  4418. <select id="getIQCDetail" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.EquipmentDataAcquisitionData">
  4419. select
  4420. a.site,
  4421. a.bu_no,
  4422. b.collection_condition as equipmentNo,
  4423. #{inspectionNo} as inspectionNo,
  4424. a.item_no,
  4425. b.collection_source,
  4426. #{actionBy} as actionBy,
  4427. b.collection_method
  4428. from qc_iqc_detailed_record as a
  4429. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  4430. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '105' and b.collection_flag = 'Y'
  4431. order by a.order_id
  4432. </select>
  4433. <select id="getFAIDetail" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.EquipmentDataAcquisitionData">
  4434. select
  4435. a.site,
  4436. a.bu_no,
  4437. b.collection_condition as equipmentNo,
  4438. #{inspectionNo} as inspectionNo,
  4439. a.item_no,
  4440. b.collection_source,
  4441. #{actionBy} as actionBy,
  4442. b.collection_method
  4443. from qc_fai_detailed_record as a
  4444. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  4445. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '106' and b.collection_flag = 'Y'
  4446. order by order_id
  4447. </select>
  4448. <select id="getIPQCDetail" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.EquipmentDataAcquisitionData">
  4449. select
  4450. a.site,
  4451. a.bu_no,
  4452. b.collection_condition as equipmentNo,
  4453. #{inspectionNo} as inspectionNo,
  4454. a.item_no,
  4455. b.collection_source,
  4456. #{actionBy} as actionBy,
  4457. b.collection_method
  4458. from qc_ipqc_detailed_record as a
  4459. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  4460. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '101' and b.collection_flag = 'Y'
  4461. order by a.order_id
  4462. </select>
  4463. <select id="getFQCDetail" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.EquipmentDataAcquisitionData">
  4464. select
  4465. a.site,
  4466. a.bu_no,
  4467. b.collection_condition as equipmentNo,
  4468. #{inspectionNo} as inspectionNo,
  4469. a.item_no,
  4470. b.collection_source,
  4471. #{actionBy} as actionBy,
  4472. b.collection_method
  4473. from qc_fqc_detailed_record as a
  4474. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  4475. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '107' and b.collection_flag = 'Y'
  4476. order by a.order_id
  4477. </select>
  4478. <select id="querySubDetails" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.SubDetailValues">
  4479. select
  4480. b.site,
  4481. b.bu_no,
  4482. b.inspection_no,
  4483. b.item_no,
  4484. b.default_value,
  4485. b.min_value,
  4486. b.max_value,
  4487. b.value_type_db,
  4488. a.sub_detail_value
  4489. <if test="flag == 'iqc'">
  4490. from qc_iqc_sub_detail_record as a
  4491. left join qc_iqc_detailed_record as b on a.site = b.site and a.bu_no = b.bu_no and a.inspection_no = b.inspection_no and a.item_no = b.item_no
  4492. </if>
  4493. <if test="flag == 'ipqc'">
  4494. from qc_ipqc_sub_detail_record as a
  4495. left join qc_ipqc_detailed_record as b on a.site = b.site and a.bu_no = b.bu_no and a.inspection_no = b.inspection_no and a.item_no = b.item_no
  4496. </if>
  4497. <if test="flag == 'fqc'">
  4498. from qc_fqc_sub_detail_record as a
  4499. left join qc_fqc_detailed_record as b on a.site = b.site and a.bu_no = b.bu_no and a.inspection_no = b.inspection_no and a.item_no = b.item_no
  4500. </if>
  4501. <if test="flag == 'fai'">
  4502. from qc_fai_sub_detail_record as a
  4503. left join qc_fai_detailed_record as b on a.site = b.site and a.bu_no = b.bu_no and a.inspection_no = b.inspection_no and a.item_no = b.item_no
  4504. </if>
  4505. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and a.item_no = #{itemNo}
  4506. order by b.order_id
  4507. </select>
  4508. <insert id="saveFileList">
  4509. INSERT INTO sys_oss
  4510. (url, create_date, file_name, new_file_name, order_ref1, order_ref2, order_ref3, order_ref4)
  4511. VALUES
  4512. <foreach collection="list" item="item" separator=",">
  4513. (#{item.url}, getDate(), #{item.fileName}, #{item.newFileName}, #{item.orderRef1}, #{item.orderRef2}, #{item.orderRef3}, #{item.orderRef4})
  4514. </foreach>
  4515. </insert>
  4516. <select id="getEquipmentNoList" parameterType="com.heai.modules.pms.data.EquipmentFolderLocationData" resultType="com.heai.modules.pms.data.EquipmentFolderLocationData">
  4517. select
  4518. equipment_no
  4519. from Equipment_folder_location
  4520. where site = #{site} and bu_no = #{buNo}
  4521. </select>
  4522. <!-- 获取责任人员列表 -->
  4523. <select id="getResponsibleOperatorList" resultType="com.heai.modules.pms.data.EamAdminData" parameterType="com.heai.modules.pms.data.EamAdminData">
  4524. SELECT
  4525. operatorID as adminID,
  4526. operatorName as adminName
  4527. FROM operator
  4528. <where>
  4529. site = #{site}
  4530. <if test = "adminID != null and adminID != ''">
  4531. AND operator_id LIKE '%' + #{adminID} + '%'
  4532. </if>
  4533. <if test = "adminName != null and adminName != ''">
  4534. AND operator_name LIKE '%' + #{adminName} + '%'
  4535. </if>
  4536. </where>
  4537. </select>
  4538. <select id="getDataContentList" parameterType="com.heai.modules.pms.data.QcCollectionDataContentData" resultType="com.heai.modules.pms.data.QcCollectionDataContentData">
  4539. select
  4540. content_desc
  4541. from qc_collection_data_content
  4542. where site = #{site} and bu_no = #{buNo} and active = 'Y'
  4543. </select>
  4544. <select id="getItemCollectionDataContent" parameterType="com.heai.modules.pms.data.SubDetailValues" resultType="string">
  4545. select
  4546. collection_data_content
  4547. from eam_properties_item
  4548. where site = #{site} and bu_no = #{buNo} and ItemNo = #{itemNo}
  4549. </select>
  4550. <!-- 获取当前项目不包含的设备 -->
  4551. <select id="getObjectList1" resultType="com.heai.modules.pms.data.EamObjectInData" parameterType="com.heai.modules.pms.data.EamObjectInData">
  4552. SELECT
  4553. a.site,
  4554. a.bu_no,
  4555. a.ObjectID,
  4556. a.ObjectDesc
  4557. FROM eam_object as a
  4558. left join qc_item_object as b on a.site = b.site and a.bu_no = b.bu_no and a.ObjectID = b.ObjectID and b.ItemNo = #{itemNo}
  4559. where a.site = #{site} and a.bu_no = #{buNo} and b.ItemNo is null and a.active = 'Y'
  4560. </select>
  4561. <!-- 获取当前项目所包含的设备 -->
  4562. <select id="getObjectList2" resultType="com.heai.modules.pms.data.EamObjectInData" parameterType="com.heai.modules.pms.data.EamObjectInData">
  4563. SELECT
  4564. a.site,
  4565. a.bu_no,
  4566. a.ObjectID,
  4567. b.ObjectDesc,
  4568. a.default_flag
  4569. FROM qc_item_object a
  4570. LEFT JOIN eam_object b ON a.site = b.site and a.bu_no = b.bu_no and a.ObjectID = b.ObjectID
  4571. WHERE a.site = #{site} and a.bu_no = #{buNo} and a.ItemNo = #{itemNo}
  4572. </select>
  4573. <!-- 获取当前项目不包含的设备 -->
  4574. <select id="getObjectListBy" resultType="com.heai.modules.pms.data.EamObjectInData" parameterType="com.heai.modules.pms.data.EamObjectInData">
  4575. SELECT
  4576. a.site,
  4577. a.bu_no,
  4578. a.ObjectID,
  4579. a.ObjectDesc
  4580. FROM eam_object as a
  4581. left join qc_item_object as b on a.site = b.site and a.bu_no = b.bu_no and a.ObjectID = b.ObjectID and b.ItemNo = #{itemNo}
  4582. <where>
  4583. a.site = #{site} and a.bu_no = #{buNo} and b.ItemNo is null and a.active = 'Y'
  4584. <if test = "objectID != null and objectID != ''">
  4585. AND a.ObjectID LIKE '%' + #{objectID} + '%'
  4586. </if>
  4587. <if test = "objectDesc != null and objectDesc != ''">
  4588. AND a.ObjectDesc LIKE '%' + #{objectDesc} + '%'
  4589. </if>
  4590. </where>
  4591. </select>
  4592. <!-- 新增项目设备 -->
  4593. <insert id="addItemObject">
  4594. INSERT INTO qc_item_object
  4595. (site, bu_no, ItemNo, ObjectID, default_flag)
  4596. VALUES
  4597. <foreach collection="list" item="item" separator=",">
  4598. (#{item.site}, #{item.buNo}, #{item.itemNo}, #{item.objectID}, #{item.defaultFlag})
  4599. </foreach>
  4600. </insert>
  4601. <delete id="deleteItemObject">
  4602. DELETE FROM qc_item_object
  4603. WHERE
  4604. <foreach collection="list" item="item" separator=" or " index="index">
  4605. (site = #{item.site} and bu_no = #{item.buNo} and ItemNo = #{item.itemNo} and ObjectID = #{item.objectID})
  4606. </foreach>
  4607. </delete>
  4608. <update id="updateItemObject">
  4609. UPDATE qc_item_object
  4610. SET default_flag = #{defaultFlag}
  4611. WHERE site = #{site} and bu_no = #{buNo} and ItemNo = #{itemNo} and ObjectID = #{objectID}
  4612. </update>
  4613. <select id="getIQCInspectionDetail" parameterType="com.heai.modules.pms.data.EamObjectInData" resultType="com.heai.modules.pms.data.EamObjectInData">
  4614. select
  4615. a.site,
  4616. a.bu_no,
  4617. a.inspection_no,
  4618. a.item_no,
  4619. a.item_desc,
  4620. b.collection_source,
  4621. b.collection_method
  4622. from qc_iqc_detailed_record as a
  4623. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  4624. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '105' and b.collection_flag = 'Y'
  4625. order by a.order_id
  4626. </select>
  4627. <select id="getSQCInspectionDetail" parameterType="com.heai.modules.pms.data.EamObjectInData" resultType="com.heai.modules.pms.data.EamObjectInData">
  4628. select
  4629. a.site,
  4630. a.bu_no,
  4631. a.inspection_no,
  4632. a.item_no,
  4633. a.item_desc,
  4634. b.collection_source,
  4635. b.collection_method
  4636. from qc_sqc_detailed_record as a
  4637. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  4638. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '105' and b.collection_flag = 'Y'
  4639. order by a.order_id
  4640. </select>
  4641. <select id="getFAIInspectionDetail" parameterType="com.heai.modules.pms.data.EamObjectInData" resultType="com.heai.modules.pms.data.EamObjectInData">
  4642. select
  4643. a.site,
  4644. a.bu_no,
  4645. a.inspection_no,
  4646. a.item_no,
  4647. a.item_desc,
  4648. b.collection_source,
  4649. b.collection_method
  4650. from qc_fai_detailed_record as a
  4651. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  4652. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '106' and b.collection_flag = 'Y'
  4653. order by a.order_id
  4654. </select>
  4655. <select id="getFQCInspectionDetail" parameterType="com.heai.modules.pms.data.EamObjectInData" resultType="com.heai.modules.pms.data.EamObjectInData">
  4656. select
  4657. a.site,
  4658. a.bu_no,
  4659. a.inspection_no,
  4660. a.item_no,
  4661. a.item_desc,
  4662. b.collection_source,
  4663. b.collection_method
  4664. from qc_fqc_detailed_record as a
  4665. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  4666. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '107' and b.collection_flag = 'Y'
  4667. order by a.order_id
  4668. </select>
  4669. <select id="getIPQCInspectionDetail" parameterType="com.heai.modules.pms.data.EamObjectInData" resultType="com.heai.modules.pms.data.EamObjectInData">
  4670. select
  4671. a.site,
  4672. a.bu_no,
  4673. a.inspection_no,
  4674. a.item_no,
  4675. a.item_desc,
  4676. b.collection_source,
  4677. b.collection_method
  4678. from qc_ipqc_detailed_record as a
  4679. left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
  4680. where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '101' and b.collection_flag = 'Y'
  4681. order by a.order_id
  4682. </select>
  4683. <delete id="deleteEquipmentDataAcquisition" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4684. delete from Equipment_data_acquisition
  4685. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  4686. </delete>
  4687. <select id="getInspectionStandards" parameterType="com.heai.modules.pms.data.QcInspectionStandardData" resultType="com.heai.modules.pms.data.QcInspectionStandardData">
  4688. select
  4689. site,
  4690. bu_no,
  4691. template_id,
  4692. item_no,
  4693. default_value,
  4694. min_value,
  4695. max_value,
  4696. condition,
  4697. collection_source,
  4698. seq_no
  4699. from qc_inspection_standards
  4700. where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo}
  4701. </select>
  4702. <delete id="deleteInspectionStandard" parameterType="com.heai.modules.pms.data.QcInspectionStandardData">
  4703. delete from qc_inspection_standards
  4704. where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo}
  4705. </delete>
  4706. <delete id="deleteInspectionStandard2" parameterType="com.heai.modules.pms.data.QcTemplateData">
  4707. delete from qc_inspection_standards
  4708. where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo}
  4709. </delete>
  4710. <insert id="saveInspectionStandard">
  4711. INSERT INTO qc_inspection_standards
  4712. (site, bu_no, template_id, item_no, default_value, min_value, max_value, condition, collection_source, seq_no)
  4713. VALUES
  4714. <foreach collection="list" item="item" separator=",">
  4715. (#{item.site}, #{item.buNo}, #{item.templateId}, #{item.itemNo}, #{item.defaultValue}, #{item.minValue}, #{item.maxValue}, #{item.condition}, #{item.collectionSource}, #{item.seqNo})
  4716. </foreach>
  4717. </insert>
  4718. <insert id="saveEquipmentFolderLocationList">
  4719. insert into Equipment_folder_location
  4720. (folder_path,equipment_no,site,bu_no,file_no,backup_folder_path,IP,suffix,equipment_desc,backup_photo_path,batch_date,port,register_address,
  4721. register_num,register_num_columntype,register_address_inspection,register_num_inspection,register_num_inspection_columntype,unit_id,
  4722. excel_compare_fields_x,excel_compare_fields_y,initial_line,data_row,skip_line,cutting_symbol,transparent_flag,Formula_calculation,
  4723. Formula,Group_calculation,regexp,repair_type,buzzer,create_by,create_time)
  4724. values (#{folderPath}, #{equipmentNo}, #{site}, #{buNo}, #{fileNo}, #{backupFolderPath}, #{IP}, #{suffix}, #{equipmentDesc}, #{backupPhotoPath}, #{batchDate}, #{port}, #{registerAddress},
  4725. #{registerNum}, #{registerNumColumntype}, #{registerAddressInspection}, #{registerNumInspection}, #{registerNumInspectionColumntype}, #{unitId},
  4726. #{excelCompareFieldsX}, #{excelCompareFieldsY}, #{initialLine}, #{dataRow}, #{skipLine}, #{cuttingSymbol}, #{transparentFlag}, #{formulaCalculation},
  4727. #{formula}, #{groupCalculation}, #{regexp}, #{repairType}, #{buzzer}, #{createBy}, getDate())
  4728. </insert>
  4729. <select id="getInspectionTemplateDetail" parameterType="com.heai.modules.pms.data.QcFAIRecordData" resultType="com.heai.modules.pms.data.QcInspectionStandardData">
  4730. select
  4731. site,
  4732. bu_no,
  4733. template_id,
  4734. item_no
  4735. <if test="flag == 'iqc'">
  4736. from qc_iqc_detailed_record
  4737. </if>
  4738. <if test="flag == 'ipqc'">
  4739. from qc_ipqc_detailed_record
  4740. </if>
  4741. <if test="flag == 'fqc'">
  4742. from qc_fqc_detailed_record
  4743. </if>
  4744. <if test="flag == 'fai'">
  4745. from qc_fai_detailed_record
  4746. </if>
  4747. where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
  4748. order by order_id
  4749. </select>
  4750. <update id="updateEquipmentDataDetailInspectionNo" parameterType="com.heai.modules.pms.data.SubDetailValues">
  4751. update Equipment_data_detail
  4752. set inspection_no = #{inspectionNo}
  4753. where id = #{id}
  4754. </update>
  4755. <delete id="deleteInspectionFiles" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4756. delete sys_oss
  4757. where order_ref1 = #{site} and order_ref2 = #{inspectionNo} and order_ref4 = #{buNo}
  4758. </delete>
  4759. <select id="getUpItemdata" resultType="com.heai.modules.pms.data.QcTemplateData">
  4760. select
  4761. top 1
  4762. site,
  4763. bu_no,
  4764. template_id,
  4765. ItemNo,
  4766. order_id
  4767. from qc_template_detailed
  4768. where #{orderId} > order_id
  4769. and site = #{site}
  4770. and bu_no= #{buNo}
  4771. and template_id = #{templateId}
  4772. order by order_id desc
  4773. </select>
  4774. <select id="getDownItemdata" resultType="com.heai.modules.pms.data.QcTemplateData">
  4775. select
  4776. top 1
  4777. site,
  4778. bu_no,
  4779. template_id,
  4780. ItemNo,
  4781. order_id
  4782. from qc_template_detailed
  4783. where order_id > #{orderId}
  4784. and site = #{site}
  4785. and bu_no= #{buNo}
  4786. and template_id = #{templateId}
  4787. order by order_id
  4788. </select>
  4789. <update id="updateQcItemOrder">
  4790. update qc_template_detailed
  4791. set order_id=#{orderId}
  4792. where site = #{site}
  4793. and bu_no= #{buNo}
  4794. and template_id = #{templateId}
  4795. and ItemNo = #{itemNo}
  4796. </update>
  4797. <select id="getQCDetailOrderId" resultType="Integer">
  4798. SELECT isnull(max(order_id), 0) + 1
  4799. from qc_template_detailed
  4800. where site = #{site}
  4801. and bu_no= #{buNo}
  4802. and template_id = #{templateId}
  4803. </select>
  4804. <select id="updateQCDetailOrderIdNull">
  4805. UPDATE qc_template_detailed
  4806. SET qc_template_detailed.order_id = oi.rn
  4807. FROM (SELECT
  4808. site,
  4809. bu_no,
  4810. template_id,
  4811. ItemNo,
  4812. ROW_NUMBER() OVER (PARTITION BY site,bu_no,template_id ORDER BY ItemNo) AS rn
  4813. FROM qc_template_detailed
  4814. ) as oi
  4815. where qc_template_detailed.template_id = oi.template_id
  4816. AND qc_template_detailed.ItemNo = oi.ItemNo
  4817. and qc_template_detailed.order_id is null
  4818. </select>
  4819. <select id="selectInfoByInspectionNo" resultType="com.heai.modules.pms.data.PoOrderRollNoData" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4820. select
  4821. site,
  4822. citem_code,
  4823. inspection_no
  4824. from po_order_roll_no
  4825. where site = #{site} and citem_code = #{buNo} and inspection_no = #{inspectionNo}
  4826. </select>
  4827. <update id="updateIQCMasterSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4828. UPDATE qc_iqc_record
  4829. SET submit_flag = 'N',
  4830. state = '待检验',
  4831. cancel_check_by = #{updateBy},
  4832. cancel_check_date = getDate()
  4833. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4834. </update>
  4835. <update id="updateIQCDetailSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4836. UPDATE qc_iqc_detailed_record
  4837. SET is_submit = 'N'
  4838. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4839. </update>
  4840. <update id="updateIQCSubDetailSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4841. UPDATE qc_iqc_sub_detail_record
  4842. SET is_submit = 'N'
  4843. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4844. </update>
  4845. <update id="updateFAIMasterSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4846. UPDATE qc_fai_record
  4847. SET submit_flag = 'N',
  4848. state = '待检验',
  4849. cancel_check_by = #{updateBy},
  4850. cancel_check_date = getDate()
  4851. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4852. </update>
  4853. <update id="updateFAIDetailSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4854. UPDATE qc_fai_detailed_record
  4855. SET is_submit = 'N'
  4856. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4857. </update>
  4858. <update id="updateFAISubDetailSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4859. UPDATE qc_fai_sub_detail_record
  4860. SET is_submit = 'N'
  4861. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4862. </update>
  4863. <update id="updateIPQCMasterSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4864. UPDATE qc_ipqc_record
  4865. SET submit_flag = 'N',
  4866. state = '待检验',
  4867. cancel_check_by = #{updateBy},
  4868. cancel_check_date = getDate()
  4869. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4870. </update>
  4871. <update id="updateIPQCDetailSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4872. UPDATE qc_ipqc_detailed_record
  4873. SET is_submit = 'N'
  4874. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4875. </update>
  4876. <update id="updateIPQCSubDetailSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4877. UPDATE qc_ipqc_sub_detail_record
  4878. SET is_submit = 'N'
  4879. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4880. </update>
  4881. <update id="updateFQCMasterSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4882. UPDATE qc_fqc_record
  4883. SET submit_flag = 'N',
  4884. state = '待检验',
  4885. cancel_check_by = #{updateBy},
  4886. cancel_check_date = getDate()
  4887. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4888. </update>
  4889. <update id="updateFQCDetailSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4890. UPDATE qc_fqc_detailed_record
  4891. SET is_submit = 'N'
  4892. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4893. </update>
  4894. <update id="updateFQCSubDetailSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4895. UPDATE qc_fqc_sub_detail_record
  4896. SET is_submit = 'N'
  4897. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4898. </update>
  4899. <update id="updatePQCMasterSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4900. UPDATE qc_pqc_record
  4901. SET submit_flag = 'N',
  4902. state = '待检验',
  4903. cancel_check_by = #{updateBy},
  4904. cancel_check_date = getDate()
  4905. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4906. </update>
  4907. <update id="updatePQCDetailSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4908. UPDATE qc_pqc_detailed_record
  4909. SET is_submit = 'N'
  4910. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4911. </update>
  4912. <update id="updatePQCSubDetailSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4913. UPDATE qc_pqc_sub_detail_record
  4914. SET is_submit = 'N'
  4915. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4916. </update>
  4917. <!-- SQC取消审核 -->
  4918. <update id="updateSQCMasterSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4919. UPDATE qc_sqc_record
  4920. SET submit_flag = 'N',
  4921. state = '待检验',
  4922. cancel_check_by = #{updateBy},
  4923. cancel_check_date = getDate()
  4924. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4925. </update>
  4926. <update id="updateSQCDetailSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4927. UPDATE qc_sqc_detailed_record
  4928. SET is_submit = 'N'
  4929. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4930. </update>
  4931. <update id="updateSQCSubDetailSubmitFlag2" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4932. UPDATE qc_sqc_sub_detail_record
  4933. SET is_submit = 'N'
  4934. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  4935. </update>
  4936. <delete id="deleteReceivingTaskByInspectionNo" parameterType="com.heai.modules.pms.data.QcFAIRecordData">
  4937. delete receiving_task
  4938. where site = #{site} and citem_code = #{buNo} and inspection_no = #{inspectionNo}
  4939. </delete>
  4940. <delete id="deleteEquipmentFolderLocationList">
  4941. delete from Equipment_folder_location
  4942. where id = #{id}
  4943. </delete>
  4944. <select id="getQMSTask" resultType="com.heai.modules.pms.data.QmsTaskData">
  4945. select
  4946. id,
  4947. site,
  4948. bu_no,
  4949. part_no,
  4950. operation_desc,
  4951. s_resourceid,
  4952. qtyrequired,
  4953. create_date,
  4954. create_by,
  4955. inspection_type,
  4956. type,
  4957. order_no,
  4958. seqno,
  4959. template_id,
  4960. um_id,
  4961. work_center_no
  4962. from QMS_soscheduledrouting_TASK
  4963. where ISNULL(delete_flag, '') <![CDATA[<>]]> 'Y'
  4964. </select>
  4965. <select id="getSuffixList" resultType="java.lang.String">
  4966. select distinct suffix from Equipment_folder_location
  4967. </select>
  4968. <select id="checkEquipmentFolderLocation" resultType="java.lang.Integer">
  4969. select count(1)
  4970. from Equipment_folder_location
  4971. where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo}
  4972. </select>
  4973. <update id="updateQMSTaskById">
  4974. UPDATE QMS_soscheduledrouting_TASK
  4975. SET delete_flag = 'Y'
  4976. WHERE id = #{id}
  4977. </update>
  4978. <select id="queryEquipmentFolderLocationList" resultType="com.heai.modules.pms.data.QCEquipmentFolderLocation">
  4979. select efl.*
  4980. from Equipment_folder_location efl
  4981. <where>
  4982. <if test="params.site != null and params.site != ''">
  4983. and efl.site = #{params.site}
  4984. </if>
  4985. <if test="params.equipmentNo != null and params.equipmentNo != ''">
  4986. and efl.equipment_no like '%'+ #{params.equipmentNo} +'%'
  4987. </if>
  4988. <if test="params.equipmentDesc != null and params.equipmentDesc != ''">
  4989. and efl.equipment_desc like '%'+ #{params.equipmentDesc} +'%'
  4990. </if>
  4991. <if test="params.IP != null and params.IP != ''">
  4992. and efl.IP like '%'+ #{params.IP} +'%'
  4993. </if>
  4994. <if test="params.suffix != null and params.suffix != ''">
  4995. and efl.suffix like '%'+ #{params.suffix} +'%'
  4996. </if>
  4997. </where>
  4998. </select>
  4999. <select id="getPqcOperationDescList" resultType="com.heai.modules.pms.data.QcPartAttributeData">
  5000. select qro.description as operationDesc
  5001. from operation_resource a
  5002. left join qc_pqc_record_operation qro on a.operation = qro.code
  5003. GROUP BY qro.description
  5004. </select>
  5005. <select id="getQcIPQCInspection" resultType="com.heai.modules.pms.data.QcFAIRecordData">
  5006. select *
  5007. from qc_ipqc_record
  5008. where site = #{site} and seq_no = #{seqNo} and order_no = #{orderNo}
  5009. <if test=" inspectionTypeNo != null and inspectionTypeNo != ''">
  5010. and inspection_type_no = #{inspectionTypeNo}
  5011. </if>
  5012. </select>
  5013. <select id="selectMachineAndProcess" resultType="com.heai.modules.pms.entity.vo.MachineAndProcessVo">
  5014. select a.Site,a.OrderNo,a.ItemNo,a.OperationDesc,b.S_ResourceID,c.seqNo
  5015. from SORouting a
  5016. inner join SOScheduledRouting b on a.Site = b.Site and a.OrderNo = b.OrderNo and a.ItemNo = b.ItemNo
  5017. inner join SOOpsTransferDetail c on c.seqNo = b.SeqNo and c.Site = b.Site
  5018. where c.seqNo = #{seqNo} and a.Site = #{site}
  5019. </select>
  5020. <select id="getPartAttributeByPartNo" resultType="com.heai.modules.pms.data.QcPartAttributeData">
  5021. select top 1 attribute_no, supplier_no, defaultValue,maxValue,minValue,iqc_exempt,fai_exempt,ipqc_exempt,pqc_exempt,fqc_exempt,oqc_exempt,sqc_exempt
  5022. from qc_part_attribute
  5023. where attribute_no = #{partNo}
  5024. </select>
  5025. <update id="updateEquipmentFolderLocation">
  5026. UPDATE Equipment_folder_location
  5027. SET
  5028. folder_path = #{folderPath},
  5029. equipment_no = #{equipmentNo},
  5030. bu_no = #{buNo},
  5031. file_no = #{fileNo},
  5032. backup_folder_path = #{backupFolderPath},
  5033. IP = #{IP},
  5034. suffix = #{suffix},
  5035. equipment_desc = #{equipmentDesc},
  5036. backup_photo_path = #{backupPhotoPath},
  5037. batch_date = #{batchDate},
  5038. port = #{port},
  5039. register_address = #{registerAddress},
  5040. register_num = #{registerNum},
  5041. register_num_columntype = #{registerNumColumntype},
  5042. register_address_inspection = #{registerAddressInspection},
  5043. register_num_inspection = #{registerNumInspection},
  5044. register_num_inspection_columntype = #{registerNumInspectionColumntype},
  5045. unit_id = #{unitId},
  5046. excel_compare_fields_x = #{excelCompareFieldsX},
  5047. excel_compare_fields_y = #{excelCompareFieldsY},
  5048. initial_line = #{initialLine},
  5049. data_row = #{dataRow},
  5050. skip_line = #{skipLine},
  5051. cutting_symbol = #{cuttingSymbol},
  5052. transparent_flag = #{transparentFlag},
  5053. Formula_calculation = #{formulaCalculation},
  5054. Formula = #{formula},
  5055. Group_calculation = #{groupCalculation},
  5056. regexp = #{regexp},
  5057. repair_type = #{repairType},
  5058. buzzer = #{buzzer},
  5059. update_by = #{updateBy},
  5060. update_time = getDate()
  5061. WHERE id = #{id}
  5062. </update>
  5063. <update id="updatePQCMasterSubmitFlag">
  5064. UPDATE qc_pqc_record
  5065. SET submit_flag = 'Y',
  5066. state = '已完成',
  5067. submit_date = getDate()
  5068. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  5069. </update>
  5070. <update id="updatePQCDetailSubmitFlag">
  5071. UPDATE qc_pqc_detailed_record
  5072. SET is_submit = 'Y'
  5073. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  5074. </update>
  5075. <update id="updatePQCSubDetailSubmitFlag">
  5076. UPDATE qc_pqc_sub_detail_record
  5077. SET is_submit = 'Y'
  5078. WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
  5079. </update>
  5080. </mapper>