dev:EXCEL定时器问题修改
This commit is contained in:
@@ -82,21 +82,21 @@ public class AutoSaveIvtExcel {
|
||||
JSONObject dtl = resultJSONArray.getJSONObject(i);
|
||||
row_dtl.createCell(0).setCellValue(dtl.getString("stor_name"));
|
||||
row_dtl.createCell(1).setCellValue(dtl.getString("sect_name"));
|
||||
row_dtl.createCell(3).setCellValue(dtl.getString("package_box_sn"));
|
||||
row_dtl.createCell(4).setCellValue(dtl.getString("material_name"));
|
||||
row_dtl.createCell(5).setCellValue(dtl.getString("pcsn"));
|
||||
row_dtl.createCell(6).setCellValue(dtl.getString("customer_description"));
|
||||
row_dtl.createCell(7).setCellValue(dtl.getString("sale_order_name"));
|
||||
row_dtl.createCell(8).setCellValue(dtl.getString("sales_owner"));
|
||||
row_dtl.createCell(9).setCellValue(dtl.getString("instorage_time"));
|
||||
row_dtl.createCell(10).setCellValue(dtl.getString("quanlity_in_box"));
|
||||
row_dtl.createCell(11).setCellValue(dtl.getString("sid_day"));
|
||||
row_dtl.createCell(12).setCellValue(String.format("%.0f", dtl.getDoubleValue("width")));
|
||||
row_dtl.createCell(13).setCellValue(dtl.getString("net_weight"));
|
||||
row_dtl.createCell(14).setCellValue(dtl.getString("length"));
|
||||
row_dtl.createCell(15).setCellValue(dtl.getString("thickness_request"));
|
||||
row_dtl.createCell(16).setCellValue(dtl.getString("paper_type"));
|
||||
row_dtl.createCell(17).setCellValue(dtl.getString("paper_name"));
|
||||
row_dtl.createCell(2).setCellValue(dtl.getString("package_box_sn"));
|
||||
row_dtl.createCell(3).setCellValue(dtl.getString("material_name"));
|
||||
row_dtl.createCell(4).setCellValue(dtl.getString("pcsn"));
|
||||
row_dtl.createCell(5).setCellValue(dtl.getString("customer_description"));
|
||||
row_dtl.createCell(6).setCellValue(dtl.getString("sale_order_name"));
|
||||
row_dtl.createCell(7).setCellValue(dtl.getString("sales_owner"));
|
||||
row_dtl.createCell(8).setCellValue(dtl.getString("instorage_time"));
|
||||
row_dtl.createCell(9).setCellValue(dtl.getString("quanlity_in_box"));
|
||||
row_dtl.createCell(10).setCellValue(dtl.getString("sid_day"));
|
||||
row_dtl.createCell(11).setCellValue(String.format("%.0f", dtl.getDoubleValue("width")));
|
||||
row_dtl.createCell(12).setCellValue(dtl.getString("net_weight"));
|
||||
row_dtl.createCell(13).setCellValue(dtl.getString("length"));
|
||||
row_dtl.createCell(14).setCellValue(dtl.getString("thickness_request"));
|
||||
row_dtl.createCell(15).setCellValue(dtl.getString("paper_type"));
|
||||
row_dtl.createCell(16).setCellValue(dtl.getString("paper_name"));
|
||||
}
|
||||
|
||||
|
||||
@@ -126,51 +126,4 @@ public class AutoSaveIvtExcel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sendInfo(JSONArray send_rows) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
|
||||
String device_code = "BILL_INFO";
|
||||
JSONObject device_jo = wo.query("device_code = '" + device_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(device_jo.getString("upload_user"))) {
|
||||
return;
|
||||
}
|
||||
String upload_user = device_jo.getString("upload_user");
|
||||
String[] split = upload_user.split(",");
|
||||
JSONArray UserList = new JSONArray();
|
||||
if (split.length > 0) {
|
||||
for (String s : split) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("User", s);
|
||||
UserList.add(jo);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < send_rows.size(); i++) {
|
||||
JSONObject row = send_rows.getJSONObject(i);
|
||||
String bill_code = row.getString("bill_code");
|
||||
String Message = "出库单号为:" + bill_code + "的单据还未填写必填的发货信息并回传SAP,请及时回传!";
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("SendType", "L");
|
||||
jo.put("Title", "发货信息填写");
|
||||
jo.put("WarnType", "string");
|
||||
jo.put("MessageType", "P");
|
||||
jo.put("UserList", UserList);
|
||||
jo.put("Message", Message);
|
||||
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
|
||||
String api = "/FeiShuNoticesWebApi/CommunalApi";
|
||||
url = url + api;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(jo))
|
||||
.execute().body();
|
||||
log.info("飞书输入参数为:-------------------" + jo);
|
||||
log.info("飞书输出参数为:-------------------" + resultMsg);
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext.mes.service.LmsToMesService;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
@@ -45,6 +46,8 @@ public class AutoSendIvtExcel {
|
||||
|
||||
private final LocalStorageRepository localStorageRepository;
|
||||
|
||||
private final LmsToMesService lmsToMesService;
|
||||
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
RLock lock = redissonClient.getLock(this.getClass().getName());
|
||||
@@ -86,28 +89,28 @@ public class AutoSendIvtExcel {
|
||||
JSONObject dtl = resultJSONArray.getJSONObject(i);
|
||||
row_dtl.createCell(0).setCellValue(dtl.getString("stor_name"));
|
||||
row_dtl.createCell(1).setCellValue(dtl.getString("sect_name"));
|
||||
row_dtl.createCell(3).setCellValue(dtl.getString("package_box_sn"));
|
||||
row_dtl.createCell(4).setCellValue(dtl.getString("material_name"));
|
||||
row_dtl.createCell(5).setCellValue(dtl.getString("pcsn"));
|
||||
row_dtl.createCell(6).setCellValue(dtl.getString("customer_description"));
|
||||
row_dtl.createCell(7).setCellValue(dtl.getString("sale_order_name"));
|
||||
row_dtl.createCell(8).setCellValue(dtl.getString("sales_owner"));
|
||||
row_dtl.createCell(9).setCellValue(dtl.getString("instorage_time"));
|
||||
row_dtl.createCell(10).setCellValue(dtl.getString("quanlity_in_box"));
|
||||
row_dtl.createCell(11).setCellValue(dtl.getString("sid_day"));
|
||||
row_dtl.createCell(12).setCellValue(String.format("%.0f", dtl.getDoubleValue("width")));
|
||||
row_dtl.createCell(13).setCellValue(dtl.getString("net_weight"));
|
||||
row_dtl.createCell(14).setCellValue(dtl.getString("length"));
|
||||
row_dtl.createCell(15).setCellValue(dtl.getString("thickness_request"));
|
||||
row_dtl.createCell(16).setCellValue(dtl.getString("paper_type"));
|
||||
row_dtl.createCell(17).setCellValue(dtl.getString("paper_name"));
|
||||
row_dtl.createCell(2).setCellValue(dtl.getString("package_box_sn"));
|
||||
row_dtl.createCell(3).setCellValue(dtl.getString("material_name"));
|
||||
row_dtl.createCell(4).setCellValue(dtl.getString("pcsn"));
|
||||
row_dtl.createCell(5).setCellValue(dtl.getString("customer_description"));
|
||||
row_dtl.createCell(6).setCellValue(dtl.getString("sale_order_name"));
|
||||
row_dtl.createCell(7).setCellValue(dtl.getString("sales_owner"));
|
||||
row_dtl.createCell(8).setCellValue(dtl.getString("instorage_time"));
|
||||
row_dtl.createCell(9).setCellValue(dtl.getString("quanlity_in_box"));
|
||||
row_dtl.createCell(10).setCellValue(dtl.getString("sid_day"));
|
||||
row_dtl.createCell(11).setCellValue(String.format("%.0f", dtl.getDoubleValue("width")));
|
||||
row_dtl.createCell(12).setCellValue(dtl.getString("net_weight"));
|
||||
row_dtl.createCell(13).setCellValue(dtl.getString("length"));
|
||||
row_dtl.createCell(14).setCellValue(dtl.getString("thickness_request"));
|
||||
row_dtl.createCell(15).setCellValue(dtl.getString("paper_type"));
|
||||
row_dtl.createCell(16).setCellValue(dtl.getString("paper_name"));
|
||||
}
|
||||
|
||||
|
||||
String type = FileUtil.getFileType("xls");
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
||||
String nowStr = format.format(date) + "-";
|
||||
String nowStr = format.format(date);
|
||||
String path = properties.getPath().getPath() + type + File.separator + "当天库存报表.xls";
|
||||
FileOutputStream fileOut = new FileOutputStream(path);
|
||||
|
||||
@@ -119,8 +122,8 @@ public class AutoSendIvtExcel {
|
||||
localStorageRepository.save(local);
|
||||
}else {
|
||||
LocalStorage localStorage = new LocalStorage(
|
||||
nowStr + "库存报表.xls",
|
||||
nowStr + "库存报表",
|
||||
"当天库存报表.xls",
|
||||
"当天库存报表",
|
||||
"xls",
|
||||
path,
|
||||
type,
|
||||
@@ -130,6 +133,35 @@ public class AutoSendIvtExcel {
|
||||
workbook.write(fileOut);
|
||||
|
||||
fileOut.close();
|
||||
|
||||
// 调用接口返回飞书
|
||||
JSONObject paramFeiShu = new JSONObject();
|
||||
JSONArray UserList = new JSONArray();
|
||||
|
||||
String userList = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("USER_LIST_EXCEL").getValue();
|
||||
|
||||
String[] split = userList.split(",");
|
||||
if (split.length > 0) {
|
||||
for (String s : split) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("User", s);
|
||||
UserList.add(jo);
|
||||
}
|
||||
} else {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("User", "");
|
||||
UserList.add(jo);
|
||||
}
|
||||
paramFeiShu.put("UserList", UserList);
|
||||
paramFeiShu.put("Code", "ctp_AA1ohTlSSVfk");
|
||||
|
||||
String ip = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("EXCEL_SAVE_URL").getValue();
|
||||
JSONObject card = new JSONObject();
|
||||
card.put("downloadurl", ip+"file/文档/当天库存报表.xls");
|
||||
card.put("title", nowStr+"库存明细汇总");
|
||||
paramFeiShu.put("card", card);
|
||||
lmsToMesService.sendSalesIvtMsgParam(paramFeiShu);
|
||||
|
||||
} else {
|
||||
System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!");
|
||||
}
|
||||
@@ -139,51 +171,4 @@ public class AutoSendIvtExcel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sendInfo(JSONArray send_rows) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
|
||||
String device_code = "BILL_INFO";
|
||||
JSONObject device_jo = wo.query("device_code = '" + device_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(device_jo.getString("upload_user"))) {
|
||||
return;
|
||||
}
|
||||
String upload_user = device_jo.getString("upload_user");
|
||||
String[] split = upload_user.split(",");
|
||||
JSONArray UserList = new JSONArray();
|
||||
if (split.length > 0) {
|
||||
for (String s : split) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("User", s);
|
||||
UserList.add(jo);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < send_rows.size(); i++) {
|
||||
JSONObject row = send_rows.getJSONObject(i);
|
||||
String bill_code = row.getString("bill_code");
|
||||
String Message = "出库单号为:" + bill_code + "的单据还未填写必填的发货信息并回传SAP,请及时回传!";
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("SendType", "L");
|
||||
jo.put("Title", "发货信息填写");
|
||||
jo.put("WarnType", "string");
|
||||
jo.put("MessageType", "P");
|
||||
jo.put("UserList", UserList);
|
||||
jo.put("Message", Message);
|
||||
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
|
||||
String api = "/FeiShuNoticesWebApi/CommunalApi";
|
||||
url = url + api;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(jo))
|
||||
.execute().body();
|
||||
log.info("飞书输入参数为:-------------------" + jo);
|
||||
log.info("飞书输出参数为:-------------------" + resultMsg);
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user