package com.kingdee.eas.custom;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import org.mozilla.javascript.Context;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.Colour;
import jxl.read.biff.BiffException;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import bsh.This;
import com.kingdee.bos.BOSException;
import com.kingdee.bos.ctrl.extendcontrols.KDBizPromptBox;
import com.kingdee.bos.ctrl.kdf.table.ICell;
import com.kingdee.bos.ctrl.kdf.table.IColumn;
import com.kingdee.bos.ctrl.kdf.table.KDTDefaultCellEditor;
import com.kingdee.bos.ctrl.kdf.table.KDTMergeManager;
import com.kingdee.bos.ctrl.kdf.table.KDTSelectBlock;
import com.kingdee.bos.ctrl.kdf.table.KDTable;
import com.kingdee.bos.ctrl.kdf.table.util.KDTableUtil;
import com.kingdee.bos.ctrl.swing.KDDatePicker;
import com.kingdee.bos.dao.IObjectCollection;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.metadata.bot.BOTMappingCollection;
import com.kingdee.bos.metadata.bot.BOTMappingFactory;
import com.kingdee.bos.metadata.bot.BOTMappingInfo;
import com.kingdee.bos.metadata.bot.BOTRelationCollection;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.metadata.entity.FilterItemInfo;
import com.kingdee.bos.metadata.query.util.CompareType;
import com.kingdee.bos.sql.ParserException;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.bos.ui.face.IUIWindow;
import com.kingdee.bos.ui.face.UIException;
import com.kingdee.bos.ui.face.UIFactory;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.eas.base.btp.BTPManagerFactory;
import com.kingdee.eas.base.btp.BTPTransformResult;
import com.kingdee.eas.base.btp.IBTPManager;
import com.kingdee.eas.base.codingrule.CodingRuleManagerFactory;
import com.kingdee.eas.base.codingrule.ICodingRuleManager;
import com.kingdee.eas.base.message.BMCMessageFactory;
import com.kingdee.eas.base.message.BMCMessageInfo;
import com.kingdee.eas.base.message.IBMCMessage;
import com.kingdee.eas.base.message.MsgBizType;
import com.kingdee.eas.base.message.MsgPriority;
import com.kingdee.eas.base.message.MsgStatus;
import com.kingdee.eas.base.message.MsgType;
import com.kingdee.eas.base.netctrl.IMutexServiceControl;
import com.kingdee.eas.base.netctrl.MutexParameter;
import com.kingdee.eas.base.netctrl.MutexServiceControlFactory;
import com.kingdee.eas.base.permission.UserInfo;
import com.kingdee.eas.basedata.master.auxacct.GeneralAsstActTypeGroupCollection;
import com.kingdee.eas.basedata.master.auxacct.GeneralAsstActTypeGroupFactory;
import com.kingdee.eas.basedata.org.AdminOrgUnitCollection;
import com.kingdee.eas.basedata.org.AdminOrgUnitFactory;
import com.kingdee.eas.basedata.org.AdminOrgUnitInfo;
import com.kingdee.eas.basedata.org.CtrlUnitCollection;
import com.kingdee.eas.basedata.org.CtrlUnitFactory;
import com.kingdee.eas.basedata.org.CtrlUnitInfo;
import com.kingdee.eas.basedata.org.PositionInfo;
import com.kingdee.eas.basedata.person.PersonCollection;
import com.kingdee.eas.basedata.person.PersonFactory;
import com.kingdee.eas.basedata.person.PersonInfo;
import com.kingdee.eas.common.client.OprtState;
import com.kingdee.eas.common.client.SysContext;
import com.kingdee.eas.common.client.UIContext;
import com.kingdee.eas.common.client.UIFactoryName;
import com.kingdee.eas.fm.common.FMIsqlFacadeFactory;
import com.kingdee.eas.fm.common.IFMIsqlFacade;
import com.kingdee.eas.framework.CoreBillBaseInfo;
import com.kingdee.eas.framework.client.CoreBillEditUI;
import com.kingdee.eas.framework.client.EditUI;
import com.kingdee.eas.hr.emp.PersonPositionFactory;
import com.kingdee.eas.hr.emp.PersonPositionInfo;
import com.kingdee.eas.util.SysUtil;
import com.kingdee.eas.util.client.EASResource;
import com.kingdee.eas.util.client.MsgBox;
import com.kingdee.jdbc.rowset.IRowSet;
import com.kingdee.util.Uuid;
/***
* EAS开发工具类
* @author 赵戬
*
*/
public class UtilClass {
/***
* 信息提示框
* @param value 提示内容
*/
public static void alert(String value){
MsgBox.showInfo(value);
SysUtil.abort();
} /***
* 信息提示框(带详细信息)
* @param value 提示内容
*/
public static void alert2(String Title,String info){
MsgBox.showDetailAndOK(null, Title, info, 0);
SysUtil.abort();
} /***
* 信息提示框(带提示)
* @return value 提示内容
*/
public static boolean alertReturn(String value){
return MsgBox.isYes(MsgBox.showConfirm2(value));
} /***
* 程序停止运行
*/
public static void Stop(){
SysUtil.abort();
} /**
* 单据数据加锁
* @param billId 单据ID
*/
public static void addBillDataLock(String BillFID){
IMutexServiceControl mutex = MutexServiceControlFactory.getRemoteInstance();
mutex.requestBizObjIDForUpdate(BillFID);
} /**
* 单据数据解锁
* @param billId 单据ID
*/
public static void removeBillDataLock(String BillFID){
IMutexServiceControl mutex = MutexServiceControlFactory.getRemoteInstance();
mutex.releaseObjIDForUpdate(BillFID);
} /**
* 根据ID获取数据是否加锁
* @param id 单据编号
* @return true 已加锁 or false 未加锁
*/
public static boolean getBillDataLockStatus(String BillFID){
IMutexServiceControl mutex = MutexServiceControlFactory.getRemoteInstance();
boolean returnvalue = false;
HashMap map = mutex.getObjIDForUpdateList();
for (Iterator iter = map.keySet().iterator(); iter.hasNext();) {
String key = iter.next().toString();
if(BillFID.equals(key.substring(0, 28))){
returnvalue = true;
}
}
return returnvalue;
} /**
* 表格获取选中行某列值
* 返回ArrayList集合
* @param tblMain 列表对象
* @param CellName 列名
* @return ArrayList集合
*
* 返回遍历
try {
ArrayList list = UtilClass.getTableCellsValue(kDTable1, "cell1");
if(list.size()>0){
for (Iterator iter = list.iterator(); iter.hasNext();) {
System.out.println((String)iter.next());
}
}else{
UtilClass.alert("请选择要操作的记录");
}
} catch (Exception e1) {
}
*/
public static ArrayList getTableCellsValue(KDTable tblMain, String CellName){
ICell cellstr;
Object strObj = null;
KDTSelectBlock block = null;
ArrayList returnValue = new ArrayList();
int size = tblMain.getSelectManager().size();
for (int i = 0; i < size; i++) {
block = tblMain.getSelectManager().get(i);
for (int j = block.getTop(); j <= block.getBottom(); j++) {
cellstr = tblMain.getRow(j).getCell(CellName);
strObj = cellstr.getValue();
returnValue.add(strObj);
}
}
return returnValue;
} /**
* 设置List默认查询条件
* @param mainQuery List MainQuery
* @param Filter 条件
* 例:UtilClass.setListQueryFilter(mainQuery, "orderid.batchnum is not null");
*/
public static void setListQueryFilter(EntityViewInfo mainQuery,String Filter){
try {
mainQuery.setFilter(Filter);
} catch (ParserException e) {
alert2("设置List默认查询条件出错!",e.getMessage());
}
}
/**
* 获取KDTable选择行的行号(选择行的第一行)
* @param tblMain
* @return 行号
*/
public static int getRowNumFirst(KDTable tblMain){
return tblMain.getSelectManager().get(0).getTop();
}
/**
* 获取KDTable选择行的行号
* @param tblMain
* @return 行号
*/
public static int[] getRowNum(KDTable tblMain){
return KDTableUtil.getSelectedRows(tblMain);
}
/**
* 导出KDTable表格数据到Excel文件
* @param table KDTable
* @param RowNums 行号集合 如果RowNums行数为0,导出全部数据
* return 生成文件目录
* 例:UtilClass.TableExpot(kDTable1, new int[0], null);
*/
public static String TableExpot(KDTable table,int[] RowNums,String FileName){
String returnvaleu = "";
String Filepath = "";
//打开目录选择器
try {
Filepath = UtilClass.OpenPathSelect();
String File = "";
if("".equals(Filepath)){
return returnvaleu;
}else{
if(FileName==null||"".equals(FileName)){
FileName = "temp";
}
File = Filepath+"\\"+FileName+".xls";
}
File file = new File(File);
//如果找到相同的文件,执行删除
if(file.exists() && file.isFile()){
file.delete();
}
WritableWorkbook wwb = Workbook.createWorkbook(new File(File));
//创建工作表
wwb.createSheet("sheet1", 0);
//获取工作表
WritableSheet ws = wwb.getSheet(0); //表头行样式
WritableCellFormat TableHead = new WritableCellFormat();
TableHead.setBorder(Border.ALL, BorderLineStyle.THIN);
TableHead.setAlignment(Alignment.CENTRE);
TableHead.setBackground(Colour.GRAY_25); //表体数据行样式
WritableCellFormat TableRow = new WritableCellFormat();
TableRow.setAlignment(Alignment.CENTRE); if(RowNums==null){
//生成表头
for(int i=0;i<table.getColumnCount();i++){
if(table.getHeadRow(0).getCell(i).getValue()!=null){
ws.addCell(new Label(i,0,table.getHeadRow(0).getCell(i).getValue().toString(),TableHead));
}
}
//生成表体数据
for(int i=0;i<table.getRowCount();i++){
for(int j=0;j<table.getColumnCount();j++){
if(table.getRow(i).getCell(j).getValue()!=null){
ws.addCell(new Label(j,i+1,table.getRow(i).getCell(j).getValue().toString(),TableRow));
}
}
}
}else{
//生成表头
for(int i=0;i<table.getColumnCount();i++){
if(table.getHeadRow(0).getCell(i).getValue()!=null){
ws.addCell(new Label(i,0,table.getHeadRow(0).getCell(i).getValue().toString(),TableHead));
}
}
//生成表体数据
for(int z=0;z<RowNums.length;z++){
int i = RowNums[z];
for(int j=0;j<table.getColumnCount();j++){
if(table.getRow(i).getCell(j).getValue()!=null){
ws.addCell(new Label(j,z+1,table.getRow(i).getCell(j).getValue().toString(),TableRow));
}
}
}
}
wwb.write();
wwb.close();
returnvaleu = File;
} catch (Exception e) {
alert2("生成Excel文件出错",Filepath);
}
return returnvaleu;
}
/***
* 设置表格列名
* @param Table Table名称
* @param Colunm 列名
* @param name 值
*
*/
public static void setTableColumnName(KDTable Table,String ColunmID,String ColunmName){
KDTable kt = new KDTable();
kt = Table;
kt.getHeadRow(0).getCell(ColunmID).setValue(ColunmName);
Table = kt;
}
/**
* 设置表格融合方式
* @param tblMain 表格
* @param type 融合方式 0 :行融合 1:列融合 2:自由融合
*/
public static void setTableMergeMode(KDTable tblMain,int type){
if(type==0){
tblMain.getMergeManager().setMergeMode(KDTMergeManager.FREE_ROW_MERGE);
}
if(type==1){
tblMain.getMergeManager().setMergeMode(KDTMergeManager.FREE_COLUMN_MERGE);
}
if(type==2){
tblMain.getMergeManager().setMergeMode(KDTMergeManager.FREE_MERGE);
}
}
/***
* 表格行选择器,从第R1行选到R2行
* @param tblMain 表格
* @param R1 开始行号
* @param R2 结束行号
*/
public static void setTableSelectRows(KDTable tblMain,int R1,int R2){
tblMain.getSelectManager().select(R1-1, 0, R2-1, 0);
} /**
* 设置按钮图片名称
* @param btnName 按钮名称
* @param imgName 图片名称
* EAS图片名称保存位置:BOS环境下 工程\lib\client\eas\eas_resource_common_ico.jar
*/
public static void setButtonImg(com.kingdee.bos.ctrl.swing.KDWorkButton ButtonName,String imgName){
ButtonName.setIcon(EASResource.getIcon(imgName));
ButtonName.setEnabled(true);
}
/**
* 设置F7
* @param F7Name F7名称
* @param ConditionSQL 过滤条件SQL(如果输入值不等于"",则添加条件)
* 例 " fbilltypestatr = '1' and (entrys.id is null or entrys.seq = 1)"
* @param Query 属性 例:"com.kingdee.eas.cmt.basedata.app.OperatorOrgQuery"
* @param EditFrmat 属性 例:"$number$"
* @param DisplayFormat 属性 例:"$name$"
* @param CommitFormat 属性 例:"$number$"
* @throws BOSException
*/
public static void setF7(KDBizPromptBox F7Name,String ConditionSQL ,String Query,String EditFrmat,String DisplayFormat,String CommitFormat){
//添加分录过滤条件
try {
EntityViewInfo view = new EntityViewInfo();
if(ConditionSQL != ""){
view.setFilter(ConditionSQL);
}
//设置F7属性
F7Name.setQueryInfo(Query);//关联Query
F7Name.setEditFormat(EditFrmat);//编辑样式
F7Name.setDisplayFormat(DisplayFormat);//展现样式
F7Name.setCommitFormat(CommitFormat);//提交样式
F7Name.setEntityViewInfo(view);
F7Name.setEnabledMultiSelection(false);
} catch (Exception e) {
alert2("F7["+F7Name+"]初始化出错,请联系管理员!",e.getMessage());
}
}
/**
* 设置分录F7
* @param col 列名 kdtEntrys.getColumn("boxType")
* @param ConditionSQL 过滤条件SQL(如果输入值不等于"",则添加条件)
* 例 " fbilltypestatr = '1' and (entrys.id is null or entrys.seq = 1)"
* @param Query 属性 例:"com.kingdee.eas.cmt.basedata.app.OperatorOrgQuery"
* @param EditFrmat 属性 例:"$number$"
* @param DisplayFormat 属性 例:"$name$"
* @param CommitFormat 属性 例:"$number$"
*/
public static void setEntryF7(IColumn col,String ConditionSQL ,String Query,String EditFrmat,String DisplayFormat,String CommitFormat){
try {
KDBizPromptBox prmt = new KDBizPromptBox();
EntityViewInfo view = new EntityViewInfo();
if(ConditionSQL != ""){
view.setFilter(ConditionSQL);
}
prmt.setQueryInfo(Query);
prmt.setEditFormat(EditFrmat);
prmt.setCommitFormat(CommitFormat);
prmt.setDisplayFormat(DisplayFormat);
prmt.setEntityViewInfo(view);
prmt.setEnabledMultiSelection(false);
KDTDefaultCellEditor editor = new KDTDefaultCellEditor(prmt);
col.setEditor(editor);
} catch (ParserException e) {
alert2("分录F7初始化出错,请联系管理员!",e.getMessage());
} }
/**
* 日期转换字符串
* @param date 日期
* @param type 显示格式 yyyy-MM-dd yyyy-MM-dd HH:mm:ss
* String returnvalue = UtilClass.DateToString(this.Startdatetest.getValue(), "yyyy-MM-dd");
*/
public static String DateToString (Object date,String type){
String returnvalue = "";
if(date != null){
try{
SimpleDateFormat sdf = new SimpleDateFormat(type);
returnvalue = sdf.format(date);
}
catch(Exception ex){
alert("日期格式转换出错");
}
}
return returnvalue;
}
/**
* 字符串转为日期
* @param DateStr 字符串
* @param type 类型 "yyyy-MM-dd HH:mm:ss"
* @return Date java.util.Date
*/
public static Date StringToDate(String DateStr,String type){
Date returnvalue = null;
try {
SimpleDateFormat sdf = new SimpleDateFormat(type);
returnvalue = sdf.parse(DateStr);
} catch (ParseException e) {
alert2("日期转换出错",DateStr+"-->"+type);
}
return returnvalue;
}
/**
* 设置DKDatePicker控件显示格式
* @param date 日期控制
* @param dateType 格式样式 例:"yyyy-MM-dd HH:mm:ss" "yyyy-MM-dd"
*/
public static void setKDDatePicker(KDDatePicker date,String dateType){
date.setDatePattern(dateType);
}
/**
* 获取当前时间(KDDatePicker控件)默认值 例如:创建时间 修改时间 审核时间
* @return java.sql.Timestamp 当前时间
*/
public static java.sql.Timestamp getTime(){
java.sql.Timestamp time = new java.sql.Timestamp(new java.util.Date().getTime());
return time;
} /**
* 打开文件
* @param FilePath 文件路径
*/
public static void OpenFile(String FilePath){
try {
Runtime.getRuntime().exec("cmd /c start \"\" \""+FilePath.replaceAll("\\\\", "\\\\\\\\")+"\"");
} catch (IOException e) {
alert2("打开文件出错",FilePath);
}
}
/**
* 打开文件选择器
* @return 文件路径
*/
public static String OpenFilesSelect(){
String returnvalue = "";
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("请选择文件");
chooser.showDialog(null, "确定");
if(chooser.getSelectedFile()!=null){
File file = chooser.getSelectedFile();
returnvalue = file.getPath();
}
return returnvalue;
} /**
* 打开目录选择器
* @return
*/
public static String OpenPathSelect(){
String returnvalue = "";
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setDialogTitle("请选择目录");
chooser.showDialog(null,"保存");
if(chooser.getSelectedFile()!=null){
File file = chooser.getSelectedFile();
returnvalue = file.getPath();
}
return returnvalue;
}
/**
* 向Excel文件插入数据
* @param File
* @param sheetNum 工作表序号
* @param y 行
* @param x 列
* @param value 内容
*/
public static void setExcelValue(String File,int sheetNum,int x,int y,String value){
try {
File file = new File(File);
//如果找到相同的文件,执行删除
if(!file.exists() && !file.isFile()){
return;
}
//Excel获得文件
Workbook wb = Workbook.getWorkbook(new File(File));
//打开一个文件的副本,并且指定数据写回到原文件
WritableWorkbook book = Workbook.createWorkbook(new File(File),wb);
//获取工作表
WritableSheet sheet=book.getSheet(sheetNum);
sheet.addCell(new Label(y,x,value));
book.write();
book.close();
} catch (Exception e) {
}
}
/**
* 读取Excel文件
* @param File 文件名
* @param sheetNum 工作表序号
* @param y 行
* @param x 列
*/
public static String getExcelValue(String File,int sheetNum,int y,int x){
String result = "";
try {
File file = new File(File);
//如果找到相同的文件,执行删除
if(!file.exists() && !file.isFile()){
alert(File+"文件没找到!");
}
Workbook book= Workbook.getWorkbook(new File(File));
//获得第一个工作表对象
Sheet sheet=book.getSheet(sheetNum);
//得到第一列第一行的单元格
Cell cell1=sheet.getCell(x,y);
result=cell1.getContents().toString();
book.close();
} catch (FileNotFoundException e) {
alert2("读取Excel文件出错","请关闭当前打开的Excel文件");
} catch (BiffException e) {
alert2("读取Excel文件出错",e.toString());
} catch (IOException e) {
alert2("读取Excel文件出错",e.toString());
}
return result;
} /**
* 读取Excel文件(第一sheet页中的内容)
* @param File 文件路径
* @param sheetNum sheet页号
* @return 二维数组
*
*/
public static Object[][] getExcelValue(String File,int sheetNum){
Object [][] returnvalue = null;
try {
Workbook book= Workbook.getWorkbook(new File(File));
Sheet sheet=book.getSheet(sheetNum);
returnvalue = new Object[sheet.getRows()][sheet.getColumns()];
for(int i=1;i<sheet.getRows();i++){
for(int j=0;j<sheet.getColumns();j++){
returnvalue[i][j]=sheet.getCell(j,i).getContents();
}
}
} catch (FileNotFoundException e) {
alert2("读取Excel文件出错","请关闭当前打开的Excel文件");
} catch (BiffException e) {
alert2("读取Excel文件出错",e.toString());
} catch (IOException e) {
alert2("读取Excel文件出错",e.toString());
}
return returnvalue;
} /***
* 发送即时消息
* @param FSuser 发送人ID
* @param JSuser 接收人ID
* @param MessageTitle 标题
* @param Messages 内容
*/
public static void addMessage(String FSuser,String JSuser,String MessageTitle,String Messages){
try {
IBMCMessage i = BMCMessageFactory.getRemoteInstance();
BMCMessageInfo info = new BMCMessageInfo();
info.setType(MsgType.ONLINE);// 消息类型,例如通知消息,任务消息,状态更新消息
info.setBizType(MsgBizType.ONLINE);// 业务类型,例如工作流,预警平台
info.setPriority(MsgPriority.HIGH); // 优先级
info.setStatus(MsgStatus.UNREADED); // 消息状态
info.setReceiver(JSuser); // 接收人ID (User的ID,不是Person的ID)
info.setSender(FSuser);// 消息发送人
info.setTitle(MessageTitle); // 消息标题
info.setBody(Messages);// 消息内容
i.submit(info);
} catch (Exception e) {
alert2("发送即时消息出错","标题:"+MessageTitle+" 内容:"+Messages);
}
} /**
* 列转行
* @param list 数据集合
* @param delimiter 分隔符 例:","
* @param bracketsLeft 左括号符号
* @param bracketsRight 右括号符号
* @return String
*/
public static String CellToRow(ArrayList list,String delimiter,String bracketsLeft,String bracketsRight){
String returnvalue = "";
for (Iterator iter = list.iterator(); iter.hasNext();){
if(!"".equals(bracketsLeft) && bracketsLeft != null && !"".equals(bracketsRight) && bracketsRight != null){
returnvalue += bracketsLeft + (String)iter.next() + bracketsRight;
}
returnvalue+=delimiter;
}
return returnvalue.substring(0, returnvalue.length()-1);
} /**
* 打开窗口
* @param URL UI地址
* @param ctx 参数集合
* @param openType 打开窗口类型 例:UIFactoryName.MODEL
* @param billStatus 单据状态 例:OprtState.ADDNEW
*
*
打开普通UI页面
HashMap cix = new HashMap();
String orderid = "asiofjlqkjwfklaslkasdf="
cix.put("orderid", orderid);
UtilClass.openUI("com.kingdee.eas.cmt.commission.client.GoodsUI", cix, UIFactoryName.MODEL, OprtState.ADDNEW); 打开单据EditUI页面
HashMap cix = new HashMap();
cix.put("ID", fid);
UtilClass.openUI("com.kingdee.eas.cmt.commission.client.CmtTranConsignEditUI", cix, UIFactoryName.NEWWIN, OprtState.VIEW); 在打开的单据获取前面页面传来的参数
this.getUIContext().get("orderid").toString()
*
*
*/
public static void openUI(String URL,HashMap ctx,String openType,String billStatus){
try {
IUIWindow ui = UIFactory.createUIFactory(openType).create(URL, ctx, null, billStatus);
ui.show();
} catch (UIException e) {
alert2("弹出UI程序出错:",URL);
}
} /**
* 发送参数
* @param ContextID 参数编号
* @param values 参数值
*/
public static void setSysContext(String ContextID,Object values){
SysContext.getSysContext().setProperty(ContextID, values);
} /**
* 获取参数
* @param ContextID 参数编号
* @return 参数值(Object)
*/
public static Object getSysContext(String ContextID){
return SysContext.getSysContext().getProperty(ContextID);
} /**
* 获取UI参数
* @param UI
* @return
*/
public static String getUIContext(CoreUIObject UI){
String returnvalue = "";
if(UI.getUIContext().get("UIClassParam")!=null){
returnvalue = UI.getUIContext().get("UIClassParam").toString();
}
return returnvalue;
} /**
* 创建单据编号
* @param Parameter 规则参数
* 参数说明:
* logo 编号头标示
* date 日期时间
* Delimiter 分隔符
* digit 序号位数
* isTissueIsolation 是否组织隔离(0:不隔离1:隔离)
* table 表名
* @return String 单据编号
*
* HashMap Parameter = new HashMap();
//编号头标示符号
Parameter.put("logo", "CMT");
//日期
Parameter.put("date", UtilClass.DateToString(UtilClass.getTime(), "yyyyMMdd"));
//分隔符
Parameter.put("Delimiter", "-");
//序号位数
Parameter.put("digit", "5");
//是否隔离组织0为不隔离1为隔离
Parameter.put("isTissueIsolation", "0");
//单据表名
Parameter.put("table", "T_BAS_VehicleType");
String billNum = UtilClass.createrBillNumber(Parameter);
*
*/
public static String createrBillNumber(HashMap Parameter){
StringBuffer returnvalue = new StringBuffer();
//编号头Logo
if(Parameter.get("logo")!=null){
returnvalue.append(Parameter.get("logo"));
}
//添加时间
if(Parameter.get("date")!=null){
if(Parameter.get("Delimiter")!=null){
returnvalue.append(Parameter.get("Delimiter"));
}
returnvalue.append(Parameter.get("date"));
}
//创建序号位(digit:序号位数)
if(Parameter.get("digit")!=null){
StringBuffer getDigitSQL = new StringBuffer();
Integer digit = new Integer(Parameter.get("digit").toString());
StringBuffer digitValue = new StringBuffer();
for(int i=0;i<digit.intValue();i++){
digitValue.append("0");
}
getDigitSQL.append("select trim(to_char(count(*)+1,'"+digitValue+"')) from "+Parameter.get("table")+" ");
//是否组织隔离
if("1".equals(Parameter.get("isTissueIsolation"))){
getDigitSQL.append(" where FControlUnitID = '"+getCU().getId()+"'");
}
if(Parameter.get("Delimiter")!=null){
returnvalue.append(Parameter.get("Delimiter"));
}
//获取数据库记录数
returnvalue.append(executeQueryString(getDigitSQL.toString()));
}
return returnvalue.toString();
} /**
* 当前登录组织
* @return
*/
public static CtrlUnitInfo getCU(){
return SysContext.getSysContext().getCurrentCtrlUnit();
} /**
* 判断当前组织是否为集团要目录
* @return boolean
*/
public static boolean isRootCU(){
if("1".equals(executeQueryString("select tc.flevel from t_org_baseunit tc where tc.fid = '"+getCU().getId()+"'"))){
return true;
}else{
return false;
}
} /**
* 获取集团组织ID
* @return
*/
public static CtrlUnitInfo getRootCU(){
CtrlUnitInfo cinfo = new CtrlUnitInfo();
try {
CtrlUnitCollection cinfos = CtrlUnitFactory.getRemoteInstance().getCtrlUnitCollection("select * where level = 1 ");
cinfo = cinfos.get(0);
} catch (BOSException e) {
alert2("获取集团组织ID出错",e.getMessage());
}
return cinfo;
}
/**
* 当前登录用户
* @return
*/
public static UserInfo getUser(){
return SysContext.getSysContext().getCurrentUserInfo();
}
/**
* 当前登陆人员
* @return
*/
public static PersonInfo getPerson(){
PersonInfo personinfo = null;
try {
PersonCollection Personcollection = PersonFactory.getRemoteInstance().getPersonCollection(" select * where name = '" + SysContext.getSysContext().getCurrentUserInfo().getName() +"'");
personinfo=Personcollection.get(0);
} catch (Exception e1) {
}
return personinfo;
}
/**
* 当前登录人员部门
* @return
*/
public static AdminOrgUnitInfo getDepartment(){
AdminOrgUnitInfo returnvalue = null;
try {
PersonPositionInfo PersonPosition = PersonPositionFactory.getRemoteInstance().getPersonPositionInfo("select primaryPosition.* where person = '" + getPerson().getId() + "'");
PositionInfo Position = PersonPosition.getPrimaryPosition();
AdminOrgUnitCollection collection = AdminOrgUnitFactory.getRemoteInstance().getAdminOrgUnitCollection(" select * where id= '" + Position.getAdminOrgUnit().getId() +"'");
returnvalue = collection.get(0);
} catch (Exception e2) {
}
return returnvalue;
} /**
* 通过fid获取表名
* @param fid
* @return 表名
*/
public static String getDBTableName(String fid){
String Tablename = "";
com.kingdee.bos.util.BOSObjectType bosType = BOSUuid.read(fid).getType();
try {
Tablename = FMIsqlFacadeFactory.getRemoteInstance().getTableNameByBosType(bosType);
} catch (BOSException e) {
alert2("获取表名出错",fid);
}
return Tablename;
} /**
* 执行SQL(查询,返回集合)
* @param sql
* @return
IRowSet rs = UtilClass.executeQuery(sql.toString());
while(rs.next()){
rs.getObject(1).toString();
}
*/
public static IRowSet executeQuery(String sql){
IRowSet returnvalue = null;
try {
IFMIsqlFacade db = com.kingdee.eas.fm.common.FMIsqlFacadeFactory.getRemoteInstance();
returnvalue = db.executeQuery(" /*dialect*/ "+sql, null);
} catch (Exception e) {
alert2("执行SQL出错",sql);
}
return returnvalue;
}
/**
* 执行SQL(查询,返回单看值)
* @param sql
* @return String
*/
public static String executeQueryString(String sql){
String returnvalue = null;
try {
IFMIsqlFacade db = com.kingdee.eas.fm.common.FMIsqlFacadeFactory.getRemoteInstance();
IRowSet rs = db.executeQuery(" /*dialect*/ "+sql, null);
while(rs.next()){
if(rs.getObject(1)!=null){
returnvalue = rs.getObject(1).toString();
}
}
} catch (Exception e) {
alert2("执行SQL出错",sql);
}
return returnvalue;
}
/**
* 执行SQL(新增,修改)
* @param sql
*/
public static void executeSql(String sql){
try {
IFMIsqlFacade db = com.kingdee.eas.fm.common.FMIsqlFacadeFactory.getRemoteInstance();
db.executeSql(" /*dialect*/ "+sql);
} catch (Exception e) {
alert2("执行SQL出错",sql);
}
} /**
* SQL数据导出到Excel文件
* @param sql
* @param FileName 文件名
*/
public static String SQLExpot(String sql,String FileName){
String returnvalue ="";
try {
if("".equals(sql)||sql==null){
return returnvalue;
}
if(FileName==null||"".equals(FileName)){
FileName = "temp";
}
String Filepath = UtilClass.OpenPathSelect();
String File = "";
if("".equals(Filepath)){
return returnvalue;
}else{
File = Filepath+"\\"+FileName+".xls";
}
File file = new File(File);
//如果找到相同的文件,执行删除
if(file.exists() && file.isFile()){
file.delete();
}
WritableWorkbook wwb = Workbook.createWorkbook(new File(File));
//创建工作表
wwb.createSheet("sheet1", 0);
//获取工作表
WritableSheet ws = wwb.getSheet(0); //表头行样式
WritableCellFormat TableHead = new WritableCellFormat();
TableHead.setBorder(Border.ALL, BorderLineStyle.THIN);
TableHead.setAlignment(Alignment.CENTRE);
TableHead.setBackground(Colour.GRAY_25); //表体数据行样式
WritableCellFormat TableRow = new WritableCellFormat();
TableRow.setAlignment(Alignment.CENTRE); IRowSet rs = UtilClass.executeQuery(sql);
//生成列名
for(int i=0;i<rs.getRowSetMetaData().getColumnCount();i++){
String columnName = rs.getRowSetMetaData().getColumnName(i+1);
ws.addCell(new Label(i,0,columnName,TableHead));
}
int z=1;
while(rs.next()){
for(int j=1;j<=rs.getRowSetMetaData().getColumnCount();j++){
if(rs.getObject(j)!=null){
ws.addCell(new Label(j-1,z,rs.getObject(j).toString(),TableRow));
}
}
z++;
}
wwb.write();
wwb.close();
} catch (Exception e) {
alert2("导出数据生成Excel文件出错",sql);
}
return returnvalue;
} /**
* 集装箱箱号正确性验证
* @param BoxNum 箱号
* @return Boolean
if(!UtilClass.BoxVerification(boxnum)){
if(!UtilClass.alertReturn("箱号:"+boxnum+" 不是国际标准箱号,是否保存?")){
UtilClass.Stop();
}
}
*/
public static boolean BoxVerification(String BoxNum){
HashMap bj = new HashMap();
bj.put("0", 0);
bj.put("1", 1);
bj.put("2", 2);
bj.put("3", 3);
bj.put("4", 4);
bj.put("5", 5);
bj.put("6", 6);
bj.put("7", 7);
bj.put("8", 8);
bj.put("9", 9);
bj.put("A", 10);
bj.put("B", 12);
bj.put("C", 13);
bj.put("D", 14);
bj.put("E", 15);
bj.put("F", 16);
bj.put("G", 17);
bj.put("H", 18);
bj.put("I", 19);
bj.put("J", 20);
bj.put("K", 21);
bj.put("L", 23);
bj.put("M", 24);
bj.put("N", 25);
bj.put("O", 26);
bj.put("P", 27);
bj.put("Q", 28);
bj.put("R", 29);
bj.put("S", 30);
bj.put("T", 31);
bj.put("U", 32);
bj.put("V", 34);
bj.put("W", 35);
bj.put("X", 36);
bj.put("Y", 37);
bj.put("Z", 38); //去掉箱号两边空格
String newBoxNum = BoxNum.trim(); //判断箱号是否为国际标准11位
if(newBoxNum.length() != 11){
return false;
} //判断前四位为字母 區別小寫
for(int i=0;i<4;i++){
String Nums = newBoxNum.substring(i, i+1);
char chs[] = Nums.toCharArray();
if((int)chs[0]<65 || (int)chs[0]>90){
return false;
}
} //判断后7位为数字
for(int i=4;i<11;i++){
String Nums = newBoxNum.substring(i, i+1);
char chs[] = Nums.toCharArray();
if((int)chs[0]<48 || (int)chs[0]>57){
return false;
}
} //判断第11数验证码是否正确
double VerificationNumSum = 0;
for(int i=0;i<10;i++){
//获取当前位字母或数字对应的数值
double bjdata = ((Integer)bj.get(newBoxNum.substring(i, i+1))).doubleValue();
//获取当前位对应的2的i次方
double jfdata = Math.pow(2,i);
VerificationNumSum+=bjdata*jfdata;
}
int VerificationNum =(int)VerificationNumSum%11;
int sub11 = new Integer(newBoxNum.substring(10)).intValue();
//如果计算结果与第11位数是否相等
if(VerificationNum!=sub11){
return false;
}
return true;
} /**
* 从oracle数据读取图片字节码生成图片文件
* @param img_num 图片编号(参数表编号)
* @param file 文件地址 "c://bmw.png" 系统参数表
-- 创建表
create table T_SYS_FUTVAN
(
FNUMBER NVARCHAR2(55),
FNAME NVARCHAR2(256),
PARAMETER_STRING NVARCHAR2(256),
PARAMETER_NUMBER NUMBER,
PARAMETER_DATE DATE,
PARAMETER_TIMESTAMP TIMESTAMP(6),
PARAMETER_BLOB BLOB
)
-- 创建字段说明
comment on column T_SYS_FUTVAN.FNUMBER
is '参数编号';
comment on column T_SYS_FUTVAN.FNAME
is '参数名称';
comment on column T_SYS_FUTVAN.PARAMETER_STRING
is '文本型参数';
comment on column T_SYS_FUTVAN.PARAMETER_NUMBER
is '数据型参数';
comment on column T_SYS_FUTVAN.PARAMETER_DATE
is '日期型参数';
comment on column T_SYS_FUTVAN.PARAMETER_TIMESTAMP
is '时间型参数';
comment on column T_SYS_FUTVAN.PARAMETER_BLOB
is '字节型参数';
*
*/
public static void getImgFromOracle(String img_num,String file){
try {
IRowSet rs = executeQuery("select parameter_blob from t_sys_futvan where fnumber = '"+img_num+"'");
while(rs.next()){
java.sql.Blob blob = rs.getBlob(1);
InputStream ins = blob.getBinaryStream();
File f = new File(file);
FileOutputStream fout = new FileOutputStream(f);
byte[]b = new byte[10244];
int len = 0;
while((len = ins.read(b)) != -1){
fout.write(b,0,len);
}
fout.close();
ins.close();
}
} catch (Exception e) {
System.out.println();
}
} /**
* BOTP单据转换
* @param botpNum 转换规则编号
* @param BillInfo 原单据
*/
public static void BOTP(String botpNum,CoreBillBaseInfo BillInfo){
String error = "";
try {
// 取得BOPT的映射
BOTMappingCollection botmapping = BOTMappingFactory.getRemoteInstance().getBOTMappingCollection("select * where name = '"+botpNum+"' ");
BOTMappingInfo btpMappingInfo = null;
if (botmapping !=null && botmapping.size() == 1) {
btpMappingInfo = botmapping.get(0);
} else {
if(botmapping==null || botmapping.size()<1){
error = "未找到转换规则 规则编号:"+botpNum;
}
if(botmapping.size()>1){
error = "找到多条转换规则,请删除重复规则。 规则编号:"+botpNum;
}
throw new Exception();
}
//执行单据转换
BTPTransformResult transformResult = BTPManagerFactory.getRemoteInstance().transform(BillInfo, btpMappingInfo); //取得目标单据列表
IObjectCollection toBillList = transformResult.getBills(); //保存目标单据
for (int i = 0; i < toBillList.size(); i++) {
CoreBillBaseInfo destBillInfo = (CoreBillBaseInfo) toBillList.getObject(i);
BTPManagerFactory.getRemoteInstance().saveRelations(destBillInfo, transformResult.getBOTRelationCollection());
} } catch (Exception e) {
if("".equals(error) || error == null){
alert2("单据转换出错",e.getMessage());
}else{
alert2("单据转换出错",error);
}
}
} /**
* 分摊功能
* @param Total 总数
* @param Allocations 分摊明细
* @param newScale 小数位数
* @return 分摊分集合
String [][]Allocations = new String[3][2];
Allocations[0][0] = "001";
Allocations[0][1] = "3";
Allocations[1][0] = "002";
Allocations[1][1] = "3";
Allocations[2][0] = "003";
Allocations[2][1] = "3";
String [][] rv = UtilClass.mathAllocation(new BigDecimal("100"), Allocations,2);
*/
public static String[][] mathAllocation(BigDecimal Total,String[][] Allocations,int newScale){
String[][] returnvalue = new String[Allocations.length][2];
BigDecimal sum = new BigDecimal("0");
BigDecimal Allocationsum = new BigDecimal("0");
try {
//获取明细总数
for(int i=0;i<Allocations.length;i++){
if(Allocations[i][1]!=null&&!"".equals(Allocations[i][1])){
sum = sum.add(new BigDecimal(Allocations[i][1]));
}
} //按比例分摊
for(int i=0;i<Allocations.length;i++){
if(Allocations[i][1]!=null&&!"".equals(Allocations[i][1])){
BigDecimal thisValue = new BigDecimal(Allocations[i][1]);
BigDecimal AllocationValue = thisValue.divide(sum,16, BigDecimal.ROUND_HALF_UP).multiply(Total).setScale(newScale, BigDecimal.ROUND_HALF_UP);
returnvalue[i][0] = Allocations[i][0];
returnvalue[i][1] = AllocationValue.toString();
}else{
returnvalue[i][0] = Allocations[i][0];
returnvalue[i][1] = "0";
}
} //判断分摊后每条记录数据是否与总数相同
for(int i=0;i<returnvalue.length;i++){
if(returnvalue[i][1]!=null&&!"".equals(returnvalue[i][1])){
Allocationsum = Allocationsum.add(new BigDecimal(returnvalue[i][1]));
}
} //如果分摊后结果与分摊前总数不一等。在分摊记录最后一条。加上。分摊后总数与分摊总数的差值
if(Allocationsum.compareTo(Total)!=0){
BigDecimal xz = new BigDecimal(returnvalue[returnvalue.length-1][1]).subtract(Allocationsum.subtract(Total));
returnvalue[returnvalue.length-1][1] = xz.toString();
}
} catch (Exception e) {
StringBuffer er = new StringBuffer();
for(int i=0;i<Allocations.length;i++){
er.append("| "+Allocations[i][0]+" "+Allocations[i][1]+" |");
}
alert2("分摊出错","分摊总数:"+Total.toString()+" 明细:"+er.toString());
}
return returnvalue;
} } /* --BOTP单据查询
select tbotpm.fname 转换规则编号,
tbotpm.fsrcentityalias_l2 源单据名称,
tbotpm.FSrcEntityFullName 源单据对象,
tbotpd.FSrcObjectID 源单据fid,
tbotpm.fdestentityalias_l2 目录单据名称,
tbotpm.FDestEntityFullName 目标单据对象,
tbotpd.FDestObjectID 目标单据fid
from T_BOT_Relation tbotpc
inner join t_bot_mapping tbotpm
on tbotpc.FBOTMappingID = tbotpm.fid
inner join t_bot_relationentry tbotpd
on tbotpc.fid = tbotpd.FKeyID --凭证查询
SELECT
DISTINCT VOUCHER.Fid 主表FID,
VOUCHER.Fnumber 凭证号,
TO_CHAR(VOUCHER.FBookedDate, 'YYYY-MM-DD') 记账日期,
ENTRIES.Fid 分录fid FROM T_GL_Voucher VOUCHER LEFT OUTER JOIN T_PM_User CASHIER
ON VOUCHER.FCashierID = CASHIER.FID LEFT OUTER JOIN T_BD_VoucherTypes VOUCHERTYPE
ON VOUCHER.FVoucherTypeID = VOUCHERTYPE.FID LEFT OUTER JOIN T_BD_Period PERIOD
ON VOUCHER.FPeriodID = PERIOD.FID LEFT OUTER JOIN T_PM_User AUDITOR
ON VOUCHER.FAuditorID = AUDITOR.FID LEFT OUTER JOIN T_PM_User HANDLER
ON VOUCHER.FHandlerID = HANDLER.FID LEFT OUTER JOIN T_PM_User CREATOR
ON VOUCHER.FCreatorID = CREATOR.FID LEFT OUTER JOIN T_PM_User POSTER
ON VOUCHER.FPosterID = POSTER.FID LEFT OUTER JOIN T_PM_User CANCELLER
ON VOUCHER.FCancellerID = CANCELLER.FID INNER JOIN T_GL_VoucherEntry ENTRIES
ON VOUCHER.FID = ENTRIES.FBillID LEFT OUTER JOIN T_ORG_BaseUnit COMPANY
ON VOUCHER.FCompanyID = COMPANY.FID left JOIN (SELECT DISTINCT VOUCHER.FID ID,
ASSISTRECORDS.FDescription FDescriptions,
ASSGRP.fnumbergroup_l2 fnumbergroup_l2s,
ASSISTRECORDS.FSettlementCode FSettlementCodes,
ASSISTRECORDS.Fid assFid
VOUCHER.FIsCheck ISCHECK,
VOUCHER.FCompanyID COMPANY.ID,
COMPANY.FName_l2 COMPANY.NAME,
PERIOD.FNumber PERIOD.NUMBER,
((TO_CHAR(PERIOD.FPeriodYear) || '.') ||
TO_CHAR(PERIOD.FPeriodNumber)) PERIOD,
VOUCHERTYPE.FName_l2 VOUCHERTYPE.NAME,
VOUCHERTYPE.FNumber VOUCHERTYPE.NUMBER,
VOUCHER.FNumber NUMBER,
VOUCHER.FBookedDate BOOKEDDATE,
VOUCHER.FBizDate BIZDATE,
VOUCHER.FSourceSys SOURCESYS,
VOUCHER.FSourceType SOURCETYPE,
CASHIER.FName_l2 CASHIER.NAME,
AUDITOR.FName_l2 AUDITOR.NAME,
CREATOR.FName_l2 CREATOR.NAME,
POSTER.FName_l2 POSTER.NAME,
VOUCHER.FBizStatus BIZSTATUS,
VOUCHER.FEntryCount ENTRYCOUNT,
ENTRIES.FID ENTRIES.ID,
ENTRIES.FSeq ENTRIES.SEQ,
ENTRIES.FDescription ENTRIES.DESCRIPTION,
ACCOUNT.FNumber ACCOUNT.NUMBER,
ACCOUNT.FLongName_l2 ACCOUNT.LONGNAME,
CURRENCY.FName_l2 CURRENCY.NAME,
CURRENCY.FPrecision CURRENCY.PRECISION,
ENTRIES.FOriginalAmount ENTRIES.ORIGINALAMOUNT,
CASE ENTRIES.FEntryDC
WHEN 1 THEN
ENTRIES.FLocalAmount
ELSE
NULL
END AS LOCALAMOUNTDEBIT,
CASE ENTRIES.FEntryDC
WHEN 1 THEN
NULL
ELSE
ENTRIES.FLocalAmount
END AS LOCALAMOUNTCREDIT,
CASE ENTRIES.FEntryDC
WHEN 1 THEN
ENTRIES.FReportingAmount
ELSE
NULL
END AS REPORTINGAMOUNTDEBIT,
CASE ENTRIES.FEntryDC
WHEN 1 THEN
NULL
ELSE
ENTRIES.FReportingAmount
END AS REPORTINGAMOUNTCREDIT,
VOUCHER.FHasCashAccount AS HASCASHACCOUNT,
VOUCHER.FDescription AS DESCRIPTION,
ENTRIES.FIsCussent AS ENTRIES.CUSSENT,
ASSGRP.FLongNameGroup_l2 AS ASSGRP.LONGNAMEGROUP,
VOUCHER.FAttachments AS ATTACHMENTS,
VOUCHER.FCreateTime AS CREATETIME,
ASSISTRECORDS.FDescription AS ASSISTRECORDS.DESCRIPTION,
ASSISTRECORDS.FOriginalAmount AS ASSISTRECORDS.ORIGINALAMOUNT,
ASSISTRECORDS.FLocalAmount AS ASSISTRECORDS.LOCALAMOUNT,
ASSISTRECORDS.FReportingAmount AS ASSISTRECORDS.REPORTINGAMOUNT,
ASSISTRECORDS.FQuantity AS ASSISTRECORDS.QUANTITY,
ENTRIES.FQuantity AS ENTRIES.QUANTITY,
VOUCHER.FIsCussent AS ISCUSSENT,
VOUCHER.FIsMgCtrl AS ISMGCTRL,
ASSISTRECORDS.FSettlementCode AS ASSISTRECORDS.SETTLEMENTCODE,
ASSISTRECORDS.FBizNumber AS ASSISTRECORDS.BIZNUMBER,
ASSISTRECORDS.FInvoiceNumber AS ASSISTRECORDS.INVOICENUMBER,
ASSISTRECORDS.FTicketNumber AS ASSISTRECORDS.TICKETNUMBER,
CUSTOMER.FNumber AS CUSTOMER.NUMBER,
SETTLEMENTTYPE.FNumber AS SETTLEMENTTYPE.NUMBER,
MATERIAL.FNumber AS MATERIAL.NUMBER,
ORGUNIT.FNumber AS ORGUNIT.NUMBER,
SUPPLIER.FNumber AS SUPPLIER.NUMBER,
ASSISTRECORDS.FHasEffected AS ASSISTRECORDS.HASEFFECTED,
ASSISTRECORDS.FFeeType AS ASSISTRECORDS.FEETYPE FROM T_GL_Voucher VOUCHER LEFT OUTER JOIN T_PM_User CASHIER
ON VOUCHER.FCashierID = CASHIER.FID LEFT OUTER JOIN T_BD_VoucherTypes VOUCHERTYPE
ON VOUCHER.FVoucherTypeID = VOUCHERTYPE.FID LEFT OUTER JOIN T_BD_Period PERIOD
ON VOUCHER.FPeriodID = PERIOD.FID LEFT OUTER JOIN T_PM_User AUDITOR
ON VOUCHER.FAuditorID = AUDITOR.FID LEFT OUTER JOIN T_PM_User HANDLER
ON VOUCHER.FHandlerID = HANDLER.FID LEFT OUTER JOIN T_PM_User CREATOR
ON VOUCHER.FCreatorID = CREATOR.FID LEFT OUTER JOIN T_PM_User POSTER
ON VOUCHER.FPosterID = POSTER.FID LEFT OUTER JOIN T_PM_User CANCELLER
ON VOUCHER.FCancellerID = CANCELLER.FID INNER JOIN T_GL_VoucherEntry ENTRIES
ON VOUCHER.FID = ENTRIES.FBillID LEFT OUTER JOIN T_ORG_BaseUnit COMPANY
ON VOUCHER.FCompanyID = COMPANY.FID LEFT OUTER JOIN T_BD_Currency CURRENCY
ON ENTRIES.FCurrencyID = CURRENCY.FID LEFT OUTER JOIN T_BD_AccountView ACCOUNT
ON ENTRIES.FAccountID = ACCOUNT.FID LEFT OUTER JOIN T_GL_VoucherAssistRecord ASSISTRECORDS
ON ENTRIES.FID = ASSISTRECORDS.FEntryID LEFT OUTER JOIN T_BD_AssistantHG ASSGRP
ON ASSISTRECORDS.FAssGrpID = ASSGRP.FID LEFT OUTER JOIN T_BD_Customer CUSTOMER
ON ASSISTRECORDS.FCustomerID = CUSTOMER.FID LEFT OUTER JOIN T_BD_SettlementType SETTLEMENTTYPE
ON ASSISTRECORDS.FSettlementTypeID = SETTLEMENTTYPE.FID LEFT OUTER JOIN T_BD_Material MATERIAL
ON ASSISTRECORDS.FMaterialID = MATERIAL.FID LEFT OUTER JOIN T_ORG_Company ORGUNIT
ON ASSISTRECORDS.FOrgUnitID = ORGUNIT.FID LEFT OUTER JOIN T_BD_Supplier SUPPLIER
ON ASSISTRECORDS.FSupplierID = SUPPLIER.FID LEFT OUTER JOIN T_PM_User HANDLER1
ON ASSISTRECORDS.FHandlerID = HANDLER1.FID) VCHIDQUERY
ON VOUCHER.FID = VCHIDQUERY.ID LEFT OUTER JOIN T_BD_Currency CURRENCY
ON ENTRIES.FCurrencyID = CURRENCY.FID LEFT OUTER JOIN T_BD_AccountView ACCOUNT
ON ENTRIES.FAccountID = ACCOUNT.FID
where COMPANY.Fname_L2 = '中床国际物流集团有限公司'
and TO_DATE(TO_CHAR(VOUCHER.FBookedDate, 'YYYY-MM-DD'), 'YYYY-MM-DD') >=
TO_DATE('2009-01-01', 'YYYY-MM-DD')
AND TO_DATE(TO_CHAR(VOUCHER.FBookedDate, 'YYYY-MM-DD'), 'YYYY-MM-DD') <=
TO_DATE('2009-12-31', 'YYYY-MM-DD') */

EAS常用工具类的更多相关文章

  1. js常用工具类.

    一些js的工具类 复制代码 /** * Created by sevennight on 15-1-31. * js常用工具类 */ /** * 方法作用:[格式化时间] * 使用方法 * 示例: * ...

  2. IOS开发--常用工具类收集整理(Objective-C)(持续更新)

    前言:整理和收集了IOS项目开发常用的工具类,最后也给出了源码下载链接. 这些可复用的工具,一定会给你实际项目开发工作锦上添花,会给你带来大大的工作效率. 重复造轮子的事情,除却自我多练习编码之外,就 ...

  3. Apache Commons 常用工具类整理

    其实一直都在使用常用工具类,只是从没去整理过,今天空了把一些常用的整理一下吧 怎么使用的一看就明白,另外还有注释,最后的使用pom引入的jar包 public class ApacheCommonsT ...

  4. Android 常用工具类之SPUtil,可以修改默认sp文件的路径

    参考: 1. 利用Java反射机制改变SharedPreferences存储路径    Singleton1900 2. Android快速开发系列 10个常用工具类 Hongyang import ...

  5. 封装一个简单好用的打印Log的工具类And快速开发系列 10个常用工具类

    快速开发系列 10个常用工具类 http://blog.csdn.net/lmj623565791/article/details/38965311 ------------------------- ...

  6. javaweb常用工具类及配置文件备份

    Javaweb常用工具类及配置文件备份   做一个代码备份,以后常用到的. hibernate工具类备份 package com.dly.service; /*  * hibernate获取sessi ...

  7. [C#] 常用工具类——直接在浏览器输出数据

    /// <summary> /// <para> </para> /// 常用工具类——直接在浏览器输出数据 /// <para> ---------- ...

  8. [C#] 常用工具类——加密解密类

    using System; using System.Configuration; using System.Collections.Generic; using System.Text; using ...

  9. C#常用工具类——Excel操作类

    /// 常用工具类——Excel操作类 /// <para> ------------------------------------------------</para> / ...

随机推荐

  1. 欧拉图 欧拉回路 欧拉通路 Euler

    欧拉图 本文链接:http://www.cnblogs.com/Ash-ly/p/5397702.html 定义: 欧拉回路:图G的一个回路,如果恰通过图G的每一条边,则该回路称为欧拉回路,具有欧拉回 ...

  2. SCU - 4439 Vertex Cover (图的最小点覆盖集)

    Vertex Cover frog has a graph with \(n\) vertices \(v(1), v(2), \dots, v(n)\) and \(m\) edges \((v(a ...

  3. RabbitMQ (九) 消息的参数详解

    上篇文章讲了声明一个队列时的参数设置,这篇文章主要说一说发布消息时的参数设置. 发布消息时的完整入参是这样的: channel.BasicPublish ( exchange: "test_ ...

  4. shell脚本--字符串处理和动态数组

    Linux下的文本处理命令,以清晰的列分割数据为高效处理源: awk 的gsub函数可替换指定字符串 echo "<tr><td>col1</td>< ...

  5. 安装SQL2008时显示必须重启计算机才可以继续安装的错误—解决办法

    数据库学习已经有一段时间了,前几天进入了SQL视频的学习,在安装数据库的时候,出现问题,总显示重启失败 ,无法继续安装,如图所示 出现这种问题 ,应该如何解决呢? 解决方法如下: (1).开始菜单-搜 ...

  6. [BZOJ 1500] 维护序列

    Link: BZOJ 1500 传送门 Solution: 可能平衡树维护序列的所有操作都在这了吧…… 对序列的维护$fhq treap$和$Splay$都能做 有几个注意点: 1.维护序列时始终记得 ...

  7. 【最短路】【spfa】hdu6071 Lazy Running

    给你一个4个点的环,问你从2号点出发, 再回到2号点,长度>=K的最短路是多少.环上的边长度不超过30000. 跑出来所有dis(2,j)以后,然后for一遍j,根据dis(2,j)+t*2*w ...

  8. 【状压DP】BZOJ2734-[HNOI2012]集合选数

    已经八月份了药丸,开始肝作业并且准备高考啦!! [题目大意] <集合论与图论>这门课程有一道作业题,要求同学们求出{1, 2, 3, 4, 5}的所有满足以 下条件的子集:若 x 在该子集 ...

  9. pymysql与mysql各功能

    pymysql # 增删改操作 import pymysql client=pymysql.connect( host='127.0.0.1', port=3306, user='root', pas ...

  10. LinkedList源码及解析

    package java.util; import java.util.function.Consumer; /** * LinkedList基于链表实现 * 实现了List.Deque.Clonea ...