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
|
ENDQUERY
|
||||||
ENDIF
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,6 @@ ENV = 'production'
|
|||||||
|
|
||||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
||||||
VUE_APP_BASE_API = 'http://47.97.157.227:8010'
|
VUE_APP_BASE_API = 'http://60.165.35.2:8011/'
|
||||||
# 如果接口是 http 形式, wss 需要改为 ws
|
# 如果接口是 http 形式, wss 需要改为 ws
|
||||||
VUE_APP_WS_API = 'ws://47.97.157.227:8010'
|
VUE_APP_WS_API = 'ws://60.165.35.2:8011/'
|
||||||
|
|||||||
185
lms/nladmin-ui/src/views/wms/basedata/master/sales/index.vue
Normal file
185
lms/nladmin-ui/src/views/wms/basedata/master/sales/index.vue
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!--工具栏-->
|
||||||
|
<div class="head-container">
|
||||||
|
<el-input
|
||||||
|
v-model="query.search"
|
||||||
|
clearable
|
||||||
|
style="width: 300px"
|
||||||
|
size="mini"
|
||||||
|
placeholder="输入单位编码或单位名称"
|
||||||
|
prefix-icon="el-icon-search"
|
||||||
|
class="filter-item"
|
||||||
|
/>
|
||||||
|
<rrOperation />
|
||||||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
|
<crudOperation :permission="permission" />
|
||||||
|
<!--表单组件-->
|
||||||
|
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
|
||||||
|
<el-form-item label="编码" prop="sales_code">
|
||||||
|
<el-input v-model="form.sales_code" style="width: 370px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="名称" prop="sales_name">
|
||||||
|
<el-input v-model="form.sales_name" style="width: 370px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="区域" prop="area">
|
||||||
|
<el-select
|
||||||
|
v-model="form.area"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
size="mini"
|
||||||
|
class="filter-item"
|
||||||
|
style="width: 370px;"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in areaList"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否启用" prop="is_active">
|
||||||
|
<el-radio v-model="form.is_active" label="0">否</el-radio>
|
||||||
|
<el-radio v-model="form.is_active" label="1">是</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||||
|
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||||
|
<el-table-column prop="sales_code" label="编码" />
|
||||||
|
<el-table-column prop="sales_name" label="名称" />
|
||||||
|
<el-table-column prop="area" label="区域" width="135" />
|
||||||
|
<el-table-column prop="is_active" label="启用 ">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.is_active"
|
||||||
|
active-color="#409EFF"
|
||||||
|
inactive-color="#F56C6C"
|
||||||
|
active-value="1"
|
||||||
|
inactive-value="0"
|
||||||
|
@change="changeEnabled(scope.row, scope.row.is_active)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column v-permission="['admin','mdPbMeasureunit:edit','mdPbMeasureunit:del']" fixed="right" label="操作" width="150px" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<udOperation
|
||||||
|
:data="scope.row"
|
||||||
|
:permission="permission"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudSales from '@/views/wms/basedata/master/sales/sales'
|
||||||
|
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
|
import udOperation from '@crud/UD.operation'
|
||||||
|
import pagination from '@crud/Pagination'
|
||||||
|
const defaultForm = { id: null, sales_code: null, sales_name: null, area: null, is_active: null }
|
||||||
|
export default {
|
||||||
|
dicts: ['is_used'],
|
||||||
|
name: 'Sales',
|
||||||
|
// eslint-disable-next-line vue/no-unused-components
|
||||||
|
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||||
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
|
cruds() {
|
||||||
|
return CRUD({ title: '业务员',
|
||||||
|
url: 'api/sales',
|
||||||
|
optShow: {
|
||||||
|
add: true,
|
||||||
|
reset: true
|
||||||
|
},
|
||||||
|
idField: 'id',
|
||||||
|
sort: 'sales_code,desc',
|
||||||
|
crudMethod: { ...crudSales }})
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
permission: {
|
||||||
|
},
|
||||||
|
areaList: [
|
||||||
|
{
|
||||||
|
'value': '华东区域',
|
||||||
|
'text': '华东区域'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'value': '华南区域',
|
||||||
|
'text': '华南区域'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'value': '华中区域',
|
||||||
|
'text': '华中区域'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'value': '中心区域',
|
||||||
|
'text': '中心区域'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
sales_code: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
sales_name: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
is_active: [
|
||||||
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||||
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
// 改变状态
|
||||||
|
changeEnabled(data, val) {
|
||||||
|
this.$confirm('此操作将 "' + this.dict.label.is_used[val] + '" ' + data.sales_code + ', 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
crudSales.edit(data).then(res => {
|
||||||
|
this.crud.notify(this.dict.label.is_used[val] + '成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
}).catch(() => {
|
||||||
|
if (data.is_active === '0') {
|
||||||
|
data.is_active = '1'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (data.is_active === '1') {
|
||||||
|
data.is_active = '0'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
if (data.is_active === '0') {
|
||||||
|
data.is_active = '1'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (data.is_active === '1') {
|
||||||
|
data.is_active = '0'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleChange(value) {
|
||||||
|
console.log(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
35
lms/nladmin-ui/src/views/wms/basedata/master/sales/sales.js
Normal file
35
lms/nladmin-ui/src/views/wms/basedata/master/sales/sales.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/sales',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: 'api/sales/',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/sales',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getUnit(params) {
|
||||||
|
return request({
|
||||||
|
url: 'api/sales/getUnit',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del, getUnit }
|
||||||
Reference in New Issue
Block a user