|
楼主 |
发表于 2016-2-20 10:32:42
|
显示全部楼层
本帖最后由 mabaor 于 2016-2-20 15:39 编辑
第三个错误:麻烦大家帮助找一找,
在做第6个视频时,代码检查无错误,但运行时提示错误
代码如下(本代码已做更新,可以正常运行):
import java.util.Iterator;
import com.justep.system.util.*;
import com.justep.system.process.*;
import com.justep.system.context.*;
import com.justep.system.opm.*;
import com.justep.system.data.*;
import com.justep.system.action.*;
import com.justep.model.*;
public class InboundProcess {
//在入库申请流转后,在库表中增加采购计划的意见
public static void businessActivity1AfterAdvance() {
try{
//把流程记录里的附言拿出来到sContent变量中
String taskID=ProcessUtils.getProcessContext().getTask().getId(); //拿到流程taskID
String ksql="select SA_Task.sContent from SA_Task SA_Task Where SA_Task='"+taskID+"'";
com.justep.system.data.Table table=KSQL.select(ksql, null, "/system/data", null);
Iterator<Row> rows=table.iterator();
Row row=rows.next();
String sContent=row.getString("sContent");
//如果用户写了附言,把这个附言放入到入库主表的sContent字段中
if(sContent!=null){
String key=ProcessUtils.getProcessData1();
String ksql1="update FI_InboundMain FI_InboundMain set FI_InboundMain.fReportAdvice='"+sContent+"' where FI_InboundMain='"+key+"'";
KSQL.executeUpdate(ksql1, null, "/fishbeardemo/warehouse/data", null);
}
}catch (Exception e){
throw new RuntimeException(e.getMessage());
}
}
//在入库操作流转后,将库管员信息附到入库单主表的相应字段上去
public static void businessActivity2AfterAdvance() {
try{
//把流程记录里的附言拿出来到sContent变量中
String taskID=ProcessUtils.getProcessContext().getTask().getId(); //拿到流程taskID
String ksql="select SA_Task.sContent from SA_Task SA_Task where SA_Task='"+taskID+"'";
com.justep.system.data.Table table=KSQL.select(ksql, null, "/system/data", null);
Iterator<Row> rows=table.iterator();
Row row=rows.next();
String sContent=row.getString("sContent");
//把库管员的name,id,操作时间放到主表中
String key=ProcessUtils.getProcessData1();
String ksql1="update FI_InboundMain FI_InboundMain set FI_InboundMain.f1stName=:currentPersonName(),FI_InboundMain.f1stID=:currentPersonID(),FI_InboundMain.f1stTime=:currentDateTime()";
//上句如果想用JAVA内的操作者Name,则将FI_InboundMain.F1stName=:currentPersonName()转换为FI_InboundMain.F1stName='"+Contexthelper.getPerson().getName()+"' 如果是ID则换成ID
if(sContent!=null){
ksql1=ksql1+", FI_InboundMain.f1stAdvice='"+sContent+"' ";
}
ksql1=ksql1+" where FI_InboundMain='"+key+"'";
KSQL.executeUpdate(ksql1, null, "/fishbeardemo/warehouse/data", null);
}catch(Exception e){
throw new RuntimeException(e.getMessage());
}
}
//当流程状态终止时,将流程状态字段设置为"已终止"
public static void inboundProcessAfterAbort() {
try{
String key=ProcessUtils.getProcessData1();
String ksql="update FI_InboundMain FI_InboundMain set FI_InboundMain.fProcState='已终止' where FI_InboundMain='"+key+"'";
KSQL.executeUpdate(ksql, null, "/fishbeardemo/warehouse/data", null);
}catch(Exception e){
throw new RuntimeException(e.getMessage());
}
}
//当流程结束时,将流程状态字段设置为"已结束"
public static void inboundProcessAfterFinish(){
try{
String key=ProcessUtils.getProcessData1();
String ksql="update FI_InboundMain FI_InboundMain set FI_InboundMain.fProcState='已结束' where FI_InboundMain='"+key+"'";
KSQL.executeUpdate(ksql, null, "/fishbeardemo/warehouse/data", null) ;
}catch(Exception e){
throw new RuntimeException(e.getMessage());
}
}
}
经运行入库单流转时,出现如下错误
提示: 执行KSQL出错, KSQL: slect SA_Task.sContent() from SA_Task SA_Task where SA_Task='858B623158344DBAAB6C50A360802672'
--> sql:
--> binds: []
at InboundProcess.businessActivity1AfterAdvance(InboundProcess.java:30)
... 37 more
|
|