rev:定时导出EXCEL并上传到服务器
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package org.nl.wms.basedata.master.rest;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.basedata.master.service.SalesService;
|
||||
import org.nl.wms.basedata.master.service.dto.SalesDto;
|
||||
import org.nl.wms.basedata.master.service.dto.UnitDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author loujf
|
||||
* @date 2021-12-07
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@RequestMapping("/api/sales")
|
||||
@Slf4j
|
||||
public class SalesController {
|
||||
private final SalesService salesService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询业务员")
|
||||
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(salesService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("查询业务员")
|
||||
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SalesDto dto) {
|
||||
salesService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("查询业务员")
|
||||
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SalesDto dto) {
|
||||
salesService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("查询业务员")
|
||||
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
salesService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.nl.wms.basedata.master.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.basedata.master.service.dto.SalesDto;
|
||||
import org.nl.wms.basedata.master.service.dto.UnitDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author loujf
|
||||
* @description 服务接口
|
||||
* @date 2021-12-07
|
||||
**/
|
||||
public interface SalesService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<UnitDto>
|
||||
*/
|
||||
List<UnitDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param measure_unit_id ID
|
||||
* @return Unit
|
||||
*/
|
||||
SalesDto findById(Long measure_unit_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Unit
|
||||
*/
|
||||
SalesDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(SalesDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(SalesDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.nl.wms.basedata.master.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author loujf
|
||||
* @description /
|
||||
* @date 2021-12-07
|
||||
**/
|
||||
@Data
|
||||
public class SalesDto implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String sales_code;
|
||||
|
||||
private String sales_name;
|
||||
|
||||
private String area;
|
||||
|
||||
private String is_active;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package org.nl.wms.basedata.master.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.service.SalesService;
|
||||
import org.nl.wms.basedata.master.service.dto.SalesDto;
|
||||
import org.nl.wms.basedata.master.service.dto.UnitDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author loujf
|
||||
* @description 服务实现
|
||||
* @date 2021-12-07
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SalesServiceImpl implements SalesService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String where = "";
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
||||
String search = (String) whereJson.get("search");
|
||||
if (!StrUtil.isEmpty(search)) {
|
||||
where = " AND (sales_code like '%" + search + "%' OR sales_name like '%" + search + "%' ) ";
|
||||
}
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1 " + where, "sales_code");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UnitDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<UnitDto> list = arr.toJavaList(UnitDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SalesDto findById(Long id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
||||
JSONObject json = wo.query("id =" + id + "").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) {
|
||||
return null;
|
||||
}
|
||||
final SalesDto obj = json.toJavaObject(SalesDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SalesDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
||||
JSONObject json = wo.query("sales_code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) {
|
||||
return null;
|
||||
}
|
||||
final SalesDto obj = json.toJavaObject(SalesDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(SalesDto dto) {
|
||||
String sales_code = dto.getSales_code();
|
||||
SalesDto unitDto = this.findByCode(sales_code);
|
||||
if (unitDto != null) {
|
||||
throw new BadRequestException("存在相同的编码");
|
||||
}
|
||||
|
||||
dto.setId(IdUtil.getSnowflake(1, 1).nextId());
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(SalesDto dto) {
|
||||
SalesDto entity = this.findById(dto.getId());
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
String sales_code = dto.getSales_code();
|
||||
SalesDto unitDto = this.findByCode(sales_code);
|
||||
if (unitDto != null && !unitDto.getId().equals(dto.getId())) {
|
||||
throw new BadRequestException("存在相同的编码");
|
||||
}
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
||||
for (String id : ids) {
|
||||
wo.delete("id = '" + id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -306,5 +306,146 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "22"
|
||||
QUERY
|
||||
SELECT
|
||||
a.*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
ivt.*,
|
||||
attr.sect_id,
|
||||
attr.sect_code,
|
||||
attr.sect_name,
|
||||
attr.stor_name,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
unit.unit_name,
|
||||
region.region_name,
|
||||
sub.sap_pcsn,
|
||||
sub.package_box_sn,
|
||||
sub.sale_order_name,
|
||||
sub.customer_name,
|
||||
sub.customer_description,
|
||||
sub.date_of_production,
|
||||
DATEDIFF( NOW(), sub.date_of_FG_inbound ) AS sid_day,
|
||||
sub.quanlity_in_box,
|
||||
sub.width,
|
||||
sub.thickness,
|
||||
sub.mass_per_unit_area,
|
||||
sub.net_weight,
|
||||
sub.length,
|
||||
sub.is_un_plan_production,
|
||||
sub.un_plan_product_property1,
|
||||
sub.un_plan_product_property2,
|
||||
sub.un_plan_product_property3,
|
||||
sub.isUnPackBox,
|
||||
sub.isRePrintPackageBoxLabel,
|
||||
sub.width_standard,
|
||||
case when plan.paper_tube_or_FRP = '1' then '纸管' when plan.paper_tube_or_FRP = '2' then 'FRP管' end AS paper_type,
|
||||
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_material when plan.paper_tube_or_FRP = '2' then plan.FRP_material end AS paper_code,
|
||||
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_description when plan.paper_tube_or_FRP = '2' then plan.FRP_description end AS paper_name,
|
||||
sub.thickness_request,
|
||||
sub.box_weight,
|
||||
cust.sales_owner
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt
|
||||
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
|
||||
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id =attr.sect_id
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = ivt.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||
LEFT JOIN SCH_BASE_Region region ON region.region_id = ivt.region_id
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = ivt.pcsn AND attr.storagevehicle_code = sub.package_box_sn
|
||||
LEFT JOIN md_cs_customerbase cust ON cust.cust_code = sub.customer_name
|
||||
LEFT JOIN (SELECT
|
||||
container_name,
|
||||
MAX(paper_tube_or_FRP) AS paper_tube_or_FRP,
|
||||
MAX(paper_tube_material) AS paper_tube_material,
|
||||
MAX(paper_tube_description) AS paper_tube_description,
|
||||
MAX(paper_tube_model) AS paper_tube_model,
|
||||
MAX(FRP_material) AS FRP_material,
|
||||
MAX(FRP_description) AS FRP_description,
|
||||
MAX(FRP_model) AS FRP_model
|
||||
FROM
|
||||
pdm_bi_slittingproductionplan plan1
|
||||
WHERE
|
||||
plan1.is_delete = '0'
|
||||
GROUP BY container_name) plan ON plan.container_name = sub.container_name
|
||||
WHERE
|
||||
1 = 1
|
||||
|
||||
OPTION 输入.struct <> ""
|
||||
(
|
||||
ivt.struct_code like 输入.struct or
|
||||
ivt.struct_name like 输入.struct
|
||||
)
|
||||
ENDOPTION
|
||||
OPTION 输入.material <> ""
|
||||
(
|
||||
mater.material_code like 输入.material or
|
||||
mater.material_name like 输入.material
|
||||
)
|
||||
ENDOPTION
|
||||
OPTION 输入.pcsn <> ""
|
||||
ivt.pcsn like 输入.pcsn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.sap_pcsn <> ""
|
||||
sub.sap_pcsn like 输入.sap_pcsn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.stor_id <> ""
|
||||
attr.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.is_virtual = "0"
|
||||
sect.sect_type_attr <> '09'
|
||||
ENDOPTION
|
||||
OPTION 输入.is_virtual = "1"
|
||||
sect.sect_type_attr = '09'
|
||||
ENDOPTION
|
||||
OPTION 输入.package_box_sn <> ""
|
||||
sub.package_box_sn like 输入.package_box_sn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.sale_order_name <> ""
|
||||
sub.sale_order_name like 输入.sale_order_name
|
||||
ENDOPTION
|
||||
OPTION 输入.areas <> ""
|
||||
LEFT(sub.container_name,2) IN 输入.areas
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.rein_flag <> ""
|
||||
IFNULL(sub.sub_type,'') in 输入.rein_flag
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.ivt_status = "canuse_qty"
|
||||
ivt.canuse_qty > 0
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.ivt_status = "warehousing_qty"
|
||||
ivt.warehousing_qty > 0
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.ivt_status = "frozen_qty"
|
||||
ivt.frozen_qty > 0
|
||||
ENDOPTION
|
||||
) a
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
dis.pcsn,
|
||||
mst.bill_type
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
INNER JOIN ( SELECT MAX( iostorinvdis_id ) AS iostorinvdis_id, pcsn FROM st_ivt_iostorinvdis GROUP BY pcsn ) a ON a.iostorinvdis_id = dis.iostorinvdis_id
|
||||
INNER JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
) b ON a.pcsn = b.pcsn
|
||||
WHERE
|
||||
1=1
|
||||
order by a.instorage_time desc,a.package_box_sn
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
package org.nl.wms.sch.manage;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.nl.modules.common.config.FileProperties;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.tools.domain.LocalStorage;
|
||||
import org.nl.modules.tools.repository.LocalStorageRepository;
|
||||
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.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoSaveIvtExcel {
|
||||
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
private final FileProperties properties;
|
||||
|
||||
private final LocalStorageRepository localStorageRepository;
|
||||
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
RLock lock = redissonClient.getLock(this.getClass().getName());
|
||||
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
HSSFSheet sheet = workbook.createSheet("TestSheet");
|
||||
|
||||
HSSFRow row = sheet.createRow(0);
|
||||
|
||||
//设置第一列
|
||||
row.createCell(0).setCellValue("仓库");
|
||||
row.createCell(1).setCellValue("库区");
|
||||
row.createCell(2).setCellValue("木箱码");
|
||||
row.createCell(3).setCellValue("物料名称");
|
||||
row.createCell(4).setCellValue("子卷号");
|
||||
row.createCell(5).setCellValue("客户名称");
|
||||
row.createCell(6).setCellValue("销售订单");
|
||||
row.createCell(7).setCellValue("业务员");
|
||||
row.createCell(8).setCellValue("入库时间");
|
||||
row.createCell(9).setCellValue("单箱装卷数");
|
||||
row.createCell(10).setCellValue("库龄");
|
||||
row.createCell(11).setCellValue("产品规格(幅宽)");
|
||||
row.createCell(12).setCellValue("净重");
|
||||
row.createCell(13).setCellValue("长度");
|
||||
row.createCell(14).setCellValue("物料标准厚度");
|
||||
row.createCell(15).setCellValue("管件类型");
|
||||
row.createCell(16).setCellValue("管件描述");
|
||||
|
||||
//查询库存明细
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "22");
|
||||
|
||||
JSONArray resultJSONArray = WQL.getWO("QST_STRUCTIVT001").addParamMap(map).process().getResultJSONArray(0);
|
||||
|
||||
for (int i = 0; i < resultJSONArray.size(); i++) {
|
||||
HSSFRow row_dtl = sheet.createRow(i+1);
|
||||
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"));
|
||||
}
|
||||
|
||||
|
||||
String type = FileUtil.getFileType("xls");
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
||||
String nowStr = format.format(date) + "-";
|
||||
String path = properties.getPath().getPath() + type + File.separator + nowStr + "库存报表.xls";
|
||||
FileOutputStream fileOut = new FileOutputStream(path);
|
||||
LocalStorage localStorage = new LocalStorage(
|
||||
nowStr + "库存报表.xls",
|
||||
nowStr + "库存报表",
|
||||
"xls",
|
||||
path,
|
||||
type,
|
||||
"");
|
||||
localStorageRepository.save(localStorage);
|
||||
workbook.write(fileOut);
|
||||
|
||||
fileOut.close();
|
||||
} else {
|
||||
System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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