VerificationNumSum+=bjdata*jfdata; }
int VerificationNum =(int)VerificationNumSum;
int sub11 = new Integer(newBoxNum.substring(10)).intValue(); //如果计算结果与第11位数是否相等 if(VerificationNum!=sub11){ return false; }
return true; }
/**
* 从oracle数据读取图片字节码生成图片文件 * @param img_num 图片编号(参数表编号) * @param file 文件地址 \
系统参数表 -- 创建表
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(\parameter_blob from t_sys_futvan where fnumber = '\ 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(\* where name = '\ \
BOTMappingInfo btpMappingInfo = null;
if (botmapping !=null && botmapping.size() == 1) { btpMappingInfo = botmapping.get(0); } else {
if(botmapping==null || botmapping.size()<1){
error = \未找到转换规则 规则编号:\ }
if(botmapping.size()>1){
error = \找到多条转换规则,请删除重复规则。 规则编号:\
}
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(\
alert2(\单据转换出错\ }else{
alert2(\单据转换出错\ } } }
/**
* 分摊功能
* @param Total 总数
* @param Allocations 分摊明细 * @param newScale 小数位数 * @return 分摊分集合
String [][]Allocations = new String[3][2]; Allocations[0][0] = \ Allocations[0][1] = \ Allocations[1][0] = \ Allocations[1][1] = \ Allocations[2][0] = \ Allocations[2][1] = \
String [][] rv = UtilClass.mathAllocation(new BigDecimal(\ */
public static String[][] mathAllocation(BigDecimal Total,String[][] Allocations,int newScale){ String[][] returnvalue = new String[Allocations.length][2]; BigDecimal sum = new BigDecimal(\
=
BigDecimal Allocationsum = new BigDecimal(\ try {
//获取明细总数
for(int i=0;i
if(Allocations[i][1]!=null&&!\ sum = sum.add(new BigDecimal(Allocations[i][1])); } }
//按比例分摊
for(int i=0;i
if(Allocations[i][1]!=null&&!\ 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] = \ } }
//判断分摊后每条记录数据是否与总数相同 for(int i=0;i if(returnvalue[i][1]!=null&&!\ 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 er.append(\ \ } alert2(\分摊出错\分摊总数:\ 明细:\ } return returnvalue; } } 百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库BOS笔记(6)在线全文阅读。
相关推荐: