functiono(t,e){varr,o=Object.keys(t);returnObject.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){returnObject.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}functione(t){for(vare=1;e<arguments.length;e++){varr=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}returnt}functiona(e,t,r){returntine?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}functionr(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functionn(e,t){for(varr=0;r<t.length;r++){varo=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"ino&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}functioni(e,t,r){returnt&&n(e.prototype,t),r&&n(e,r),e}vart=require("topcam.scriptfunc").argv(),s=require("fs"),c=require("lodash"),u=t.ikm?"topcam":"aimdfm";t.ikm||(t.ikm=require("topcam.ikm6")(t));varb=t.ikm,p=t.gen,m=t.job||t.job_name,f=t.job_id,d=t.db||b.db,l=t.gui,g={};t.par?g=t.par:t.hasOwnProperty("script_parameter")&&(g=JSON.parse(t.script_parameter)),"aimdfm"===u&&b.crud("updateRow",{table:"pdm_aimdfm_task",data:{current_process_title:t.process_title},where:{id:t.task_id}});varj,h="ok",y=[],O=g,_={step:"orig",auto_save:"No",units:"mm"};for(jin_)O.hasOwnProperty(j)&&""!=O[j]||(O[j]=_[j]);varv=m.toLowerCase();try{if(!p.isJobExists({job:v}))throw"料号"+v+"不存在";if(p.isJobOpen({job:v})||p.openJob({job:v}),"aimdfm"==u){if(0!=p.checkInout({job:v,mode:"test"}))throw"the job check";p.checkInout({job:v,mode:"out"})}varw={name:"xiaobai"},k=function(){functiont(e){r(this,t),this.name=e.name,this.age=e.age,this.data=e.data}returni(t,[{key:"say",value:function(){b.msg("my age is ".concat(this.age,", my data is ").concat(c.toString(this.data)))}}]),t}(),S=[1,2,[3,4,5]],P=newk(e(e({},w),{},{age:18,data:S}));P.say(),/yes/gi.test(O.auto_save)&&(p.checkInout({job:v,mode:"out"}),p.saveJob({job:v}),p.checkInout({job:v,mode:"in"}));varE,T="Done";"aimdfm"===u&&(b.crud("updateRow",{table:"pdm_aimdfm_task",data:{progress:100},where:{id:t.task_id}}),E={type:"info",title:"操作完成, 请注意检查!"},p.hasError()&&(E={type:h="error",title:"GEN错误!",detail:[{desc:p.STATUS.join("\n")}]}),y.push(E),T={status:status,result_data:y});returnT}catch(e){0<p.STATUS.length&&b.msg(p.STATUS.join("\n")),b.msg(e),y.push({type:h="error",title:"脚本执行出错!",detail:[{desc:c.toString(e)}]});return"aimdfm"===u?{status:h,result_data:y}:"Error"}functionR(){varn=0<arguments.length&&void0!==arguments[0]?arguments[0]:{},i=p.getMatrix({job:v});returnObject.keys(i).reduce(function(e,t){varr,o=i[t],a=!0;for(rinn)o[r]&&(/object string|object number/gi.test({}.toString.call(n[r]))&&n[r]!=o[r]&&(a=!1),/object RegExp/gi.test({}.toString.call(n[r]))&&(newRegExp(n[r],"ig").test(o[r])||(a=!1)),/object function/gi.test({}.toString.call(n[r]))&&(n[r](o[r])||(a=!1)));returna&&e.push("info"==n.res?o:t),e},[])}