万材erp项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

182 lines
8.1 KiB

import com.ruoyi.common.utils.BartenderUtils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.IOException;
import java.util.ArrayList;
/**
* Created by sunzhenhu on 2021/6/30 13:46
*/
public class Test01 {
// private int[] att=new String[]{
// "1","2"
// };
private ArrayList<String> list;
@Autowired
private BartenderUtils bartenderUtils;
@Test
public void test() throws IOException {
// File file = new File("D:/work/temp.xls");
// InputStream inputStream = null;
// Workbook workbook = null;
// try {
// inputStream = new FileInputStream(file);
// workbook = WorkbookFactory.create(inputStream);
// inputStream.close();
// //工作表对象
// Sheet sheet = workbook.getSheetAt(0);
// //总行数
// int rowLength = sheet.getLastRowNum()+1;
// //根据第一行,获取总列数
// Row row = sheet.getRow(0);
// //总列数
// int colLength = row.getLastCellNum();
// //得到指定的单元格
// Cell cell = row.getCell(0);
// System.out.println("行数:" + rowLength + ",列数:" + colLength);
// list = new ArrayList<String>();
// // 从第二行开始读取
// for (int i = 1; i < rowLength; i++) {
// row = sheet.getRow(i);
// // 获取第二列的内容
// cell = row.getCell(1);
// if(cell != null){
// String temp = cell.getStringCellValue();
// if(temp != "EW_N" && !list.contains(temp)){
// list.add(temp);
// }
// }
// }
// System.out.println(list.size());
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// String convert="0123456789BCDFGHJKLMNPQRSTVWXYZ";
////// System.out.println(list.get(0));
////
//
// BufferedWriter out = new BufferedWriter(new FileWriter("D:\\test.txt"));
// for (int i=1;i<=923521-1;i++){
// int dec=i;
// String result=base(dec,convert);
// int dis=4-result.length();
// for (int j=1;j<=dis;j++){
// result="0"+result;
// }
// out.write(result+"\n");
//
// System.out.println(result);
// }
}
public String base(int num,String convert){
if (num<convert.length()){
return convert.substring(num,num+1);
}
int high = num / convert.length();
int unit=num%convert.length();
return base(high,convert)+convert.substring(unit,unit+1);
}
@Test
public void test2(){
}
// @Test
// public void test3() {
// int result=1;
// // 要运行COM组件,需要先将jacob-1.19-x64.dll放到jdk的bin目录下,不然会报错。如果是32位jdk放入32位的dll文件
// ComThread.InitSTA();
// // 加载Bartender进程,需要先安装Bartender,我安装的是BT2019R4版本。
// ActiveXComponent btApp = new ActiveXComponent("BarTender.Application");
// // 加载Bartender模板控件
// Dispatch btFormats = btApp.getProperty("Formats").toDispatch();
// /**
// * format方法: 1、 Print方法:这个就是最常用的打印方法,里面可设置打印的任务名,是否等待打印完成,等待超时时间,打印过程输出的信息。 2、
// * PrintOut方法:如果你需要在打印时出现打印设置对话框和状态框,你可以选择这个方法来实现。 3、Save方法:保存对Format的更改。
// * 4、SetNamedSubStringValue方法:设置某个特定的SubString的值,这里就可以作为一个动态改变打印内容的方法。
// * 5、SetPromt方法:跟SetNamedSubStringValue方法类似,不过他设置的是打印提示的值,某些标签通过设置可以在打印的时候弹出对话框,输入某些变量的值来改变打印内容,这个方法就是动态设置这些变量的。不过在集成中比较少用。
// * 6、IdenticalCopiesOfLabel属性:这个是设置打印时要打印多少份相同的标签的,默认为标签设置。
// * 7、NumberSerializedLabels属性:这个是序列化打印时使用的,当你的标签启动了序列化后,这个属性代表的就是打印的份数,譬如你的序列化初始数据是1,增量为1,NumberSerializedLabels设置为5,那么就会打印出1、2、3、4、5,五个标签出来。
// * 8、Printer属性:指定要使用的打印机,默认为软件指定的默认打印机。
// * 9、PrintToFile属性:标示是马上用打印机打印出实物,还是生成一个打印文件。
// */
//
// //File file = ResourceUtils.getFile("classpath:static/ruiyi/code.btw");
//// File file = ResourceUtils.getFile("classpath:static/ruiyi/code2.btw");
//// ClassPathResource classPathResource = new ClassPathResource("static/ruiyi/code2.btw");
// File file=new File("D:\\work\\code2.btw");
// if(file.exists()) {
// // 调用模板
//
// Dispatch btFormat = Dispatch.call(btFormats, "Open",
// file.getPath(), false, "")
// .toDispatch();
//// List<Object> codeList= (List<Object>) valueArray.get(0);
//
//// for(int i=0;i<codeList.size();i++) {
////
//// Object obj=codeList.get(i);
////
////// // 传递参数,参数名称要和Bartender中设置的名称一样,不然会失败
////// Dispatch.call(btFormat, "SetNamedSubStringValue", "box_id", temp.getBox_id());
////// Dispatch.call(btFormat, "SetNamedSubStringValue", "batch", "123");
////// Dispatch.call(btFormat, "SetNamedSubStringValue", "vendor", "a0060");
////
//// Class cls = obj.getClass();
//// Field[] fields = cls.getDeclaredFields();
//// for (int j=0;j<fields.length;j++){
//// Field field=fields[j];
//// field.setAccessible(true);
//// System.out.println(field.getName());
//// System.out.println(field.get(obj));
//// Dispatch.call(btFormat, "SetNamedSubStringValue", field.getName(), field.get(obj));
//// }
////
//// // 设置打印份数,默认是1份可以不设置
//// Dispatch printSetup = Dispatch.get(btFormat, "PrintSetup").toDispatch();
//// Dispatch.put(printSetup, "IdenticalCopiesOfLabel", 2);
////
//// // 打印,Bartender会自动选择模板中设置的打印机打印
//// Dispatch.call(btFormat, "PrintOut", false, false); // 第二个参数设置是否跳出打印属性;
//// }
//
//
// // 打印完成,关闭模板控件
// Dispatch.call(btFormat, "Close", 0);
//
// // 关闭Bartender进程
// Dispatch.call(btApp, "Quit", 0);
// }
//
//
// }
public static void main(String[] args) {
// Calendar calendar=Calendar.getInstance();
// calendar.setTimeInMillis(Calendar.getInstance().getTimeInMillis());//时间戳
// calendar.setFirstDayOfWeek(Calendar.MONDAY);//设置星期一为一周开始的第一天
// calendar.setMinimalDaysInFirstWeek(4);//
// int year = calendar.get(Calendar.YEAR);
// int month = calendar.get(Calendar.MONTH);
//// int date = calendar.get(Calendar.DATE);
// int weekOfYear=calendar.get(Calendar.WEEK_OF_YEAR);
// if (month==11&&weekOfYear==1){
// year++;
// }else if(month==0&&weekOfYear>50){
// year--;
// }
// year=year%10;
// String weekYear=weekOfYear+"";
// for (int i=0;i<2;i++){
// if (weekYear.length()<2){
// weekYear="0"+weekYear;
// }
// }
// String result=year+""+weekYear;
// System.out.println(result);
}
}