Online defect detection and process adjustment method and software for WEDM