本帖最后由 meiji 于 2017-12-16 09:19 编辑
org.mozilla.javascript.EvaluatorException: Can't find method cn.myapps.util.DateUtil.format(java.lang.String,string). (baselib#1030)
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(Unknown Source)
at org.mozilla.javascript.Context.reportRuntimeError(Unknown Source)
at org.mozilla.javascript.Context.reportRuntimeError(Unknown Source)
at org.mozilla.javascript.Context.reportRuntimeError1(Unknown Source)
at org.mozilla.javascript.NativeJavaMethod.call(Unknown Source)
at org.mozilla.javascript.optimizer.OptRuntime.call2(Unknown Source)
at org.mozilla.javascript.gen.c3209._c58(baselib:1030)
at org.mozilla.javascript.gen.c3209.call(baselib)
at org.mozilla.javascript.optimizer.OptRuntime.callName(Unknown Source)
at org.mozilla.javascript.gen.c3236._c1(Form.訂單分行詳情.Field(16001d65f7b-11e7-6df5-0177e840-b4dc-577af35a65f4).Lead_Time_Correct.ValueScript:3)
at org.mozilla.javascript.gen.c3236.call(Form.訂單分行詳情.Field(16001d65f7b-11e7-6df5-0177e840-b4dc-577af35a65f4).Lead_Time_Correct.ValueScript)
at org.mozilla.javascript.optimizer.OptRuntime.callName0(Unknown Source)
at org.mozilla.javascript.gen.c3236._c0(Form.訂單分行詳情.Field(16001d65f7b-11e7-6df5-0177e840-b4dc-577af35a65f4).Lead_Time_Correct.ValueScript:56)
at org.mozilla.javascript.gen.c3236.call(Form.訂單分行詳情.Field(16001d65f7b-11e7-6df5-0177e840-b4dc-577af35a65f4).Lead_Time_Correct.ValueScript)
at org.mozilla.javascript.ContextFactory.doTopCall(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.doTopCall(Unknown Source)
at org.mozilla.javascript.gen.c3236.call(Form.訂單分行詳情.Field(16001d65f7b-11e7-6df5-0177e840-b4dc-577af35a65f4).Lead_Time_Correct.ValueScript)
at org.mozilla.javascript.gen.c3236.exec(Form.訂單分行詳情.Field(16001d65f7b-11e7-6df5-0177e840-b4dc-577af35a65f4).Lead_Time_Correct.ValueScript)
at cn.myapps.core.macro.runner.JavaScriptRunner.run(JavaScriptRunner.java:135)
at cn.myapps.core.dynaform.form.ejb.FormField.runValueScript(FormField.java:550)
at cn.myapps.core.dynaform.form.ejb.InputField.recalculate(InputField.java:364)
at cn.myapps.core.dynaform.form.ejb.Form.recalculateDocument(Form.java:2172)
at cn.myapps.core.dynaform.form.ejb.Form.createDocument(Form.java:1195)
at cn.myapps.core.dynaform.form.ejb.Form.createDocument(Form.java:1139)
at cn.myapps.core.dynaform.dts.excelimport.config.AbstractImportProvider.creatDocument4Rollback(AbstractImportProvider.java:406)
at cn.myapps.core.dynaform.dts.excelimport.config.AbstractImportProvider.creatDocument(AbstractImportProvider.java:208)
at cn.myapps.core.dynaform.dts.excelimport.config.ImpExcelToDoc.creatDocument(ImpExcelToDoc.java:35)
at cn.myapps.core.dynaform.dts.excelimport.config.action.ImportExcelAction.improtExcelToDocument(ImportExcelAction.java:150)
at sun.reflect.GeneratedMethodAccessor1613.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:892)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1294)
at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:117)
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:108)
at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1370)
at ognl.ASTMethod.getValueBody(ASTMethod.java:91)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
at ognl.SimpleNode.getValue(SimpleNode.java:258)
at ognl.Ognl.getValue(Ognl.java:467)
at ognl.Ognl.getValue(Ognl.java:431)
at com.opensymphony.xwork2.ognl.OgnlUtil$3.execute(OgnlUtil.java:352)
at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUtil.java:404)
at com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:350)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:430)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:290)
at org.apache.struts2.interceptor.BackgroundProcess$1.run(BackgroundProcess.java:58)
at java.lang.Thread.run(Thread.java:745)
- function checkLeadTime() { // 返回YES or NO
- // var date_placed = getItemValueAsDate("date_placed"); [color=Red]//已經在別處宣告過 這裡不再次宣告[/color]
- date_placed=format(date_placed,"yyyy-MM-dd HH:mm:ss"); [color=Red]只要用了format就報錯 原因不明????[/color]
- var po_due_date = getItemValueAsDate("po_due_date");
- po_due_date=format(po_due_date,"yyyy-MM-dd HH:mm:ss");
- // var age_class = getPoLineInfo3(po_number, po_line, pn);
- var rts="";
- var eop ="";
- var eol ="";
- #include "取得料號資訊";
- getPnDate(PN);// 回傳rts,eop,eol
- // println(rts+eop+eol+PN+date_placed);
- #include "判斷AgeClass";
- var age_class=getAgeClass(date_placed,rts,eop,eol);
- println(" date_place=" + date_placed);
- println(" po_due_date=" + po_due_date);
- println(" age_class=" + age_class);
- // var
- // leadtime=po_due_date-date_placed;//計算Leadtime(po_due_date-date_placed)-----日期不能直接互減!!!
- // var starttime = format(date_placed, "yyyy-MM-dd HH:mm:ss");
- // var endtime = format(po_due_date, "yyyy-MM-dd HH:mm:ss");
- var leadtime = diffDays(date_placed, po_due_date);
- var leadtimeset = getLeadTimeSet(age_class);
- println("leadtime=" + leadtime);
- println("leadtimeset=" + leadtimeset);
- if (leadtime >= leadtimeset) {
- var lead_time_correct = "YES";
- return lead_time_correct;
- } else {
- var lead_time_correct = "NO";
- return lead_time_correct;
- }
-
- function getLeadTimeSet(age_classx) {// 傳入PN的ageclass,返回leadtime天數
- println("getLeadTimeSet(age_classx)");
- println(age_classx);
- println(typeof (age_classx));
-
- if (age_classx != null ) {
- var sql = "select * from TLK_Lead_Time與交期提醒 where ITEM_PN_STATUS ='" + age_classx + "'";// 判斷TLK_Lead_Time與交期提醒中,不同的ageclass設定之對應的leadtime
- var query = queryBySQL(sql);
- if (query != null) {
- var iter = query.iterator();
- if (iter != null && iter.hasNext()) {
- doc = iter.next();
- var leadtime = doc.getItemValueAsString("LEAD_TIME");
- return leadtime;
- }
- }
- }
- }
- }
- checkLeadTime();
复制代码
|