|
|
|
@ -2,9 +2,12 @@ package com.dsic.gj_erp.service.jcsj.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.dsic.gj_erp.bean.ResultBean;
|
|
|
|
|
import com.dsic.gj_erp.bean.jcsj.*;
|
|
|
|
|
import com.dsic.gj_erp.bean.jcsj.vo.BomVO;
|
|
|
|
@ -21,8 +24,10 @@ import com.dsic.gj_erp.service.jhgk.DmTzjhService;
|
|
|
|
|
import com.dsic.gj_erp.service.jhgk.DmYdjhService;
|
|
|
|
|
import com.dsic.gj_erp.service.pgd.PgdTzjhService;
|
|
|
|
|
import com.dsic.gj_erp.service.sy.SYService;
|
|
|
|
|
import com.dsic.gj_erp.util.ExcelUtil;
|
|
|
|
|
import com.dsic.gj_erp.util.MyFileUtil;
|
|
|
|
|
import com.dsic.gj_erp.util.ObjConvertUtils;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -36,6 +41,8 @@ import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -46,6 +53,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
* @author xn
|
|
|
|
|
* @since 2023-09-11
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service
|
|
|
|
|
public class BomUploadServiceImpl {
|
|
|
|
|
private static String dezt;
|
|
|
|
@ -89,6 +97,65 @@ public class BomUploadServiceImpl {
|
|
|
|
|
@Autowired
|
|
|
|
|
DmYdjhService dmYdjhService;
|
|
|
|
|
|
|
|
|
|
public void updateYdjhYlUseInfo(MultipartFile[] file,String dcCh,String dcPl){
|
|
|
|
|
try {
|
|
|
|
|
String p=".*用板统计表.*[.xlsx?|.xls?]$";
|
|
|
|
|
Pattern r = Pattern.compile(p);
|
|
|
|
|
Arrays.stream(file)
|
|
|
|
|
.filter(item -> {
|
|
|
|
|
if(item.getOriginalFilename()!=null){
|
|
|
|
|
Matcher m = r.matcher(item.getOriginalFilename());
|
|
|
|
|
return m.matches();
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}).forEach(item->{
|
|
|
|
|
if(StrUtil.isNotEmpty(item.getOriginalFilename())){
|
|
|
|
|
String tzbh="";
|
|
|
|
|
try {
|
|
|
|
|
List<String> lines = ExcelUtil.ReadExcelByLine(item.getInputStream(), item.getOriginalFilename());
|
|
|
|
|
boolean handlerFlag=false;
|
|
|
|
|
for (int i = 1; i < lines.size(); i++) {
|
|
|
|
|
String lastLine=lines.get(i-1);
|
|
|
|
|
if (StrUtil.containsAll(lastLine,"船号","批量")){
|
|
|
|
|
handlerFlag=false;
|
|
|
|
|
}
|
|
|
|
|
String line=lines.get(i);
|
|
|
|
|
if (StrUtil.containsAll(line,"船研所船体室套料科","打印时间")){
|
|
|
|
|
handlerFlag=false;
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.containsAll(lastLine,"余料编号","余料规格","调用信息","转出信息")){
|
|
|
|
|
handlerFlag=true;
|
|
|
|
|
}
|
|
|
|
|
if (handlerFlag){
|
|
|
|
|
String[] split = line.split(" ");
|
|
|
|
|
if (StrUtil.isAllEmpty(split)){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (split.length<=8){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
tzbh=split[8];
|
|
|
|
|
if (StrUtil.isEmpty(tzbh)){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dmYdjhService.update(Wrappers.<DmYdjh>update().set("jhsyylbh",tzbh)
|
|
|
|
|
.eq("dc_ch", dcCh)
|
|
|
|
|
.eq("dc_pl", dcPl)
|
|
|
|
|
.eq("tzbh", split[1])
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
log.info("修正余料计划调用信息失败,船号:{},批次:{},图号:{}",dcCh,dcPl,tzbh);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
log.info("修正余料计划调用信息失败,船号:{},批次:{}",dcCh,dcPl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public ResultBean uploadZ(MultipartFile[] file, String czbh, String pl, String isupload, HttpServletRequest req,String path) throws IOException, CustomException, ScriptException {
|
|
|
|
|
String savePath = UUID.randomUUID().toString().replace("-", "");
|
|
|
|
|