package com.api.smartwg;

import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.workflow.request.RequestManager;

public class ChangeFieldValue extends BaseBean implements Action {

    @Override
    public String execute(RequestInfo requestInfo) {
        writeLog(">>>>>>>>>更新文件说明>>>>>>start");
        RequestManager requestManager = requestInfo.getRequestManager();
        String requestid = requestInfo.getRequestid();
        String tableName = requestManager.getBillTableName();
        RecordSet recordSet = new RecordSet();
        String sql = "select sqsy,wjgj from " + tableName + " where requestid = " + requestid;
        writeLog(">>>>>>>>>sql:" + sql);
        recordSet.executeQuery(sql);
        recordSet.next();
        String sqsy = Util.null2String(recordSet.getString("sqsy"));
        String docid = Util.null2String(recordSet.getString("wjgj"));
        writeLog(">>>>>>>>>sqsy:" + sqsy);
        writeLog(">>>>>>>>>docid:" + docid);
        sql = "update docdetail set smartwgflag = '" + sqsy + "' where id = '" + docid + "'";
        writeLog(">>>>>>>>>sql:" + sql);
        recordSet.executeUpdate(sql);
        return SUCCESS;
    }
}
