| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import com.mes.core.ProjectConfigManager;
- /**
- * 测试前缀白名单功能
- */
- public class TestPrefixWhitelist {
- public static void main(String[] args) {
- ProjectConfigManager pm = ProjectConfigManager.getInstance();
- System.out.println("=== 当前产品:" + pm.getCurrentProductId() + " ===");
- // 测试工件码前缀
- System.out.println("\n【工件码前缀白名单】");
- String[] productPrefixes = pm.getProductPrefixes();
- if (productPrefixes != null) {
- for (String prefix : productPrefixes) {
- System.out.println(" - " + prefix);
- }
- System.out.println("提示文本: " + pm.getProductPrefixHint());
- }
- // 测试冷板码前缀
- System.out.println("\n【冷板码前缀白名单】");
- String[] coldPlatePrefixes = pm.getColdPlatePrefixes();
- if (coldPlatePrefixes != null) {
- for (String prefix : coldPlatePrefixes) {
- System.out.println(" - " + prefix);
- }
- System.out.println("提示文本: " + pm.getColdPlatePrefixHint());
- }
- // 测试底护板码前缀
- System.out.println("\n【底护板码前缀白名单】");
- String[] bottomPlatePrefixes = pm.getBottomPlatePrefixes();
- if (bottomPlatePrefixes != null) {
- for (String prefix : bottomPlatePrefixes) {
- System.out.println(" - " + prefix);
- }
- System.out.println("提示文本: " + pm.getBottomPlatePrefixHint());
- }
- // 测试匹配逻辑
- System.out.println("\n【匹配测试】");
- String[] testCodes = {"+KA99123", "+KC14456", "+KB98789", "+INVALID"};
- for (String code : testCodes) {
- boolean match = pm.matchProductPrefix(code);
- System.out.println(" " + code + " -> " + (match ? "✓ 匹配" : "✗ 不匹配"));
- }
- // 测试冷板码匹配
- System.out.println("\n【冷板码匹配测试】");
- String[] testColdPlates = {"+KB004123", "2510456", "+INVALID"};
- for (String code : testColdPlates) {
- boolean match = pm.matchColdPlatePrefix(code);
- System.out.println(" " + code + " -> " + (match ? "✓ 匹配" : "✗ 不匹配"));
- }
- }
- }
|