代码更新

This commit is contained in:
2022-07-12 14:48:33 +08:00
parent 39d6dcba8f
commit 92206a6711
6 changed files with 26 additions and 5 deletions

View File

@@ -500,15 +500,28 @@ public class FormulaServiceImpl implements FormulaService {
JSONObject json98jj = paraTab.query("material_id = '" + material_id + "' and para_code = 'QM001'").uniqueResult(0);
JSONObject json92jj = paraTab.query("material_id = '" + material_id + "' and para_code = 'QM002'").uniqueResult(0);
// 生成二维码
String create_time = jsonWork.getString("create_time");
BarcodeFormat qrCode = BarcodeFormat.QR_CODE;
BufferedImage imageCode = QrCodeUtil.generate(jsonWork.getString("workorder_id")+"#"+jsonMater.getString("ext_id")+"#"+jsonWork.getString("pcsn")+"#"+jsonWork.getString("workorder_qty")+"#"+create_time.substring(0,10), qrCode, 60, 60);
Workbook workbook = new Workbook();
// 获取模板地址
String template = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("EXCEL_PATH").getValue();
String code_template = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("CODE_EXCEL_PATH").getValue();
workbook.loadFromFile(template);
//获取第一张工作表并将二维码流put进去
Worksheet worksheet = workbook.getWorksheets().get(0);
worksheet.getPictures().add(1,1,imageCode);
workbook.saveToFile(code_template);
// 设置文件名和防止乱码现象
String fileName = URLEncoder.encode(jsonMater.getString("material_code")+"---"+jsonMst.getString("pcsn"), "UTF-8");
response.setHeader("Content-Disposition", "attachment; filename*=UTf-8''"+fileName+".xlsx");
// 获取输出流
ServletOutputStream outputStream = response.getOutputStream();
String template = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("EXCEL_PATH").getValue();
// String template = "D:\\work\\工艺控制卡模板.xlsx";
// 创建模板工作簿
ExcelWriter workBook = EasyExcel.write(outputStream, DataDto.class).withTemplate(template).build();
ExcelWriter workBook = EasyExcel.write(outputStream, DataDto.class).withTemplate(code_template).build();
// 获取第一个sheet
WriteSheet sheet = EasyExcel.writerSheet().build();

View File

@@ -117,6 +117,7 @@ public class ProductmaterialsetServiceImpl implements ProductmaterialsetService
setJson.put("set_material_id", (String) json.getString("material_id"));
setJson.put("set_prior_level", (String) json.getString("set_prior_level"));
setJson.put("is_calculate_forming", json.getString("is_calculate_forming"));
setJson.put("add_rate", json.getString("add_rate"));
setTab.insert(setJson);
}
} else {
@@ -141,6 +142,7 @@ public class ProductmaterialsetServiceImpl implements ProductmaterialsetService
setJson.put("set_material_id", (String) json.getString("material_id"));
setJson.put("set_prior_level", (String) json.getString("set_prior_level"));
setJson.put("is_calculate_forming", json.getString("is_calculate_forming"));
setJson.put("add_rate", json.getString("add_rate"));
setTab.insert(setJson);
}
}

View File

@@ -99,6 +99,7 @@
mset.set_type,
mset.set_prior_level,
mset.is_calculate_forming,
mset.add_rate,
c.class_name,
ext.old_mark
FROM