|
|
@ -13,13 +13,20 @@ import com.dsic.gj_erp.bean.sy.Dm_zhbmp;
|
|
|
|
import com.dsic.gj_erp.dao.sy.Dm_zhbmpRepository;
|
|
|
|
import com.dsic.gj_erp.dao.sy.Dm_zhbmpRepository;
|
|
|
|
import com.dsic.gj_erp.exception.CustomException;
|
|
|
|
import com.dsic.gj_erp.exception.CustomException;
|
|
|
|
import com.dsic.gj_erp.mapper.jcsj.DmBchxmxpMapper;
|
|
|
|
import com.dsic.gj_erp.mapper.jcsj.DmBchxmxpMapper;
|
|
|
|
|
|
|
|
import com.dsic.gj_erp.mapper.jcsj.DmBomMapper;
|
|
|
|
import com.dsic.gj_erp.service.jcsj.*;
|
|
|
|
import com.dsic.gj_erp.service.jcsj.*;
|
|
|
|
import com.dsic.gj_erp.service.jhgk.DmTzjhService;
|
|
|
|
import com.dsic.gj_erp.service.jhgk.DmTzjhService;
|
|
|
|
import com.dsic.gj_erp.service.sy.SYService;
|
|
|
|
import com.dsic.gj_erp.service.sy.SYService;
|
|
|
|
|
|
|
|
import io.swagger.annotations.Authorization;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
|
|
|
|
|
|
import org.apache.pdfbox.text.PDFTextStripper;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.script.ScriptException;
|
|
|
|
import javax.script.ScriptException;
|
|
|
@ -70,9 +77,11 @@ public class BomUploadServiceImpl {
|
|
|
|
DmTzjhService dmTzjhService;
|
|
|
|
DmTzjhService dmTzjhService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
DmBomService dmBomService;
|
|
|
|
DmBomService dmBomService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
DmBomMapper bomMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public synchronized ResultBean uploadZ(MultipartFile[] file, String czbh, String pl, String isupload, HttpServletRequest req) throws IOException, CustomException, ScriptException {
|
|
|
|
public synchronized ResultBean uploadZ(MultipartFile[] file, String czbh, String pl, String isupload, HttpServletRequest req,String path) throws IOException, CustomException, ScriptException {
|
|
|
|
String savePath = UUID.randomUUID().toString().replace("-", "");
|
|
|
|
String savePath = UUID.randomUUID().toString().replace("-", "");
|
|
|
|
//dezt="00";
|
|
|
|
//dezt="00";
|
|
|
|
File destFile = null;
|
|
|
|
File destFile = null;
|
|
|
@ -128,6 +137,7 @@ public class BomUploadServiceImpl {
|
|
|
|
boolean fbom = false;
|
|
|
|
boolean fbom = false;
|
|
|
|
Integer cs = null;
|
|
|
|
Integer cs = null;
|
|
|
|
for (MultipartFile f : file) {
|
|
|
|
for (MultipartFile f : file) {
|
|
|
|
|
|
|
|
|
|
|
|
String fname = f.getOriginalFilename();
|
|
|
|
String fname = f.getOriginalFilename();
|
|
|
|
fname = fname.substring(fname.lastIndexOf('/') + 1);
|
|
|
|
fname = fname.substring(fname.lastIndexOf('/') + 1);
|
|
|
|
System.out.println("fname = " + fname);
|
|
|
|
System.out.println("fname = " + fname);
|
|
|
@ -147,7 +157,8 @@ public class BomUploadServiceImpl {
|
|
|
|
// 2. 第一个_后面批前面的字符
|
|
|
|
// 2. 第一个_后面批前面的字符
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('批'));
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('批'));
|
|
|
|
Map map = this.bclqbUpload(lines, fname, req, isupload, bcdel);
|
|
|
|
|
|
|
|
|
|
|
|
Map map = this.bclqbUpload(lines, fname, req, isupload, bcdel,f, path);
|
|
|
|
bcdel++;
|
|
|
|
bcdel++;
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
return new ResultBean(map);
|
|
|
|
return new ResultBean(map);
|
|
|
@ -159,7 +170,7 @@ public class BomUploadServiceImpl {
|
|
|
|
// 2. 第一个_后面批前面的字符
|
|
|
|
// 2. 第一个_后面批前面的字符
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('批'));
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('批'));
|
|
|
|
Map map = this.xclqbUpload(lines, fname, req, isupload, xcdel);
|
|
|
|
Map map = this.xclqbUpload(lines, fname, req, isupload, xcdel,f, path);
|
|
|
|
xcdel++;
|
|
|
|
xcdel++;
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
return new ResultBean(map);
|
|
|
|
return new ResultBean(map);
|
|
|
@ -171,7 +182,7 @@ public class BomUploadServiceImpl {
|
|
|
|
// 2. 第一个_后面批前面的字符
|
|
|
|
// 2. 第一个_后面批前面的字符
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('批'));
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('批'));
|
|
|
|
Map map = this.bctjUpload(lines, fname, req, isupload, bctjdel);
|
|
|
|
Map map = this.bctjUpload(lines, fname, req, isupload, bctjdel,f, path);
|
|
|
|
bctjdel++;
|
|
|
|
bctjdel++;
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
return new ResultBean(map);
|
|
|
|
return new ResultBean(map);
|
|
|
@ -183,7 +194,7 @@ public class BomUploadServiceImpl {
|
|
|
|
// 2. 第一个_后面批前面的字符
|
|
|
|
// 2. 第一个_后面批前面的字符
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('批'));
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('批'));
|
|
|
|
Map map = this.xctjUpload(lines, fname, req, isupload, xctjdel);
|
|
|
|
Map map = this.xctjUpload(lines, fname, req, isupload, xctjdel,f, path);
|
|
|
|
xctjdel++;
|
|
|
|
xctjdel++;
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
return new ResultBean(map);
|
|
|
|
return new ResultBean(map);
|
|
|
@ -195,7 +206,7 @@ public class BomUploadServiceImpl {
|
|
|
|
// 2. 第一个_后面批前面的字符
|
|
|
|
// 2. 第一个_后面批前面的字符
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('套'));
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('套'));
|
|
|
|
Map map = this.bctltUpload(lines, fname, req, isupload, tld);
|
|
|
|
Map map = this.bctltUpload(lines, fname, req, isupload, tld,f, path);
|
|
|
|
tld++;
|
|
|
|
tld++;
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
return new ResultBean(map);
|
|
|
|
return new ResultBean(map);
|
|
|
@ -212,7 +223,8 @@ public class BomUploadServiceImpl {
|
|
|
|
pl = fname.substring(secondDashIndex + 1).split("-")[0];
|
|
|
|
pl = fname.substring(secondDashIndex + 1).split("-")[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Map map = this.ljptbUpload(lines, fname, req, isupload, ldpt);
|
|
|
|
|
|
|
|
|
|
|
|
Map map = this.ljptbUpload(lines, fname, req, isupload, ldpt,f, path);
|
|
|
|
ldpt++;
|
|
|
|
ldpt++;
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
return new ResultBean(map);
|
|
|
|
return new ResultBean(map);
|
|
|
@ -255,7 +267,7 @@ public class BomUploadServiceImpl {
|
|
|
|
* // 根据船号 ,pi量全部删除 型材是否 插入 物品基本表
|
|
|
|
* // 根据船号 ,pi量全部删除 型材是否 插入 物品基本表
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public Map bclqbUpload(List<String> lines, String fileName, HttpServletRequest req, String zt, int bcdel) throws CustomException {
|
|
|
|
public Map bclqbUpload(List<String> lines, String fileName, HttpServletRequest req, String zt, int bcdel,MultipartFile file,String path) throws CustomException {
|
|
|
|
// 判断是否重复导入
|
|
|
|
// 判断是否重复导入
|
|
|
|
Map map = new HashMap();
|
|
|
|
Map map = new HashMap();
|
|
|
|
String id = syService.f_getpjh("DM", "SYSTEM", "CLDE");
|
|
|
|
String id = syService.f_getpjh("DM", "SYSTEM", "CLDE");
|
|
|
@ -414,10 +426,13 @@ public class BomUploadServiceImpl {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
bclqjbpService.save(bclqjbp);
|
|
|
|
bclqjbpService.save(bclqjbp);
|
|
|
|
|
|
|
|
//上传文件到服务器
|
|
|
|
|
|
|
|
saveFile(file,path,(String) req.getAttribute("yhms"));
|
|
|
|
|
|
|
|
|
|
|
|
return map;
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public Map xclqbUpload(List<String> lines, String fileName, HttpServletRequest req, String zt, int xcdel) throws CustomException {
|
|
|
|
public Map xclqbUpload(List<String> lines, String fileName, HttpServletRequest req, String zt, int xcdel,MultipartFile file,String path) throws CustomException {
|
|
|
|
// 判断是否重复导入
|
|
|
|
// 判断是否重复导入
|
|
|
|
Map map = new HashMap();
|
|
|
|
Map map = new HashMap();
|
|
|
|
String id = syService.f_getpjh("DM", "SYSTEM", "CLDE");
|
|
|
|
String id = syService.f_getpjh("DM", "SYSTEM", "CLDE");
|
|
|
@ -560,6 +575,8 @@ public class BomUploadServiceImpl {
|
|
|
|
bclqmxpService.saveBatch(addmx);
|
|
|
|
bclqmxpService.saveBatch(addmx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bclqjbpService.save(bclqjbp);
|
|
|
|
bclqjbpService.save(bclqjbp);
|
|
|
|
|
|
|
|
//上传文件到服务器
|
|
|
|
|
|
|
|
saveFile(file,path,(String) req.getAttribute("yhms"));
|
|
|
|
return map;
|
|
|
|
return map;
|
|
|
|
// 判断 INSERT INTO DM_WPJBP(WPH,WPMC,WPFLM,WPXH,WPGG,DC_CH,ZDRY,XGSJ,WPJB,GZLX,JLDW,JLDW1 )
|
|
|
|
// 判断 INSERT INTO DM_WPJBP(WPH,WPMC,WPFLM,WPXH,WPGG,DC_CH,ZDRY,XGSJ,WPJB,GZLX,JLDW,JLDW1 )
|
|
|
|
// VALUES (:ls_wpbm,:as_wpmc,:as_wpfl,:as_wpxh,:as_wpgg,:as_dc_ch,:gs_user,:gs_xtrq,'Y','M',:ls_jldw,'19') ;
|
|
|
|
// VALUES (:ls_wpbm,:as_wpmc,:as_wpfl,:as_wpxh,:as_wpgg,:as_dc_ch,:gs_user,:gs_xtrq,'Y','M',:ls_jldw,'19') ;
|
|
|
@ -567,7 +584,7 @@ public class BomUploadServiceImpl {
|
|
|
|
|
|
|
|
|
|
|
|
//C16K-2_011批量手工板材统计数据_3跨.BC
|
|
|
|
//C16K-2_011批量手工板材统计数据_3跨.BC
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public Map bctjUpload(List<String> lines, String fileName, HttpServletRequest req, String zt, int bctjdel) throws CustomException {
|
|
|
|
public Map bctjUpload(List<String> lines, String fileName, HttpServletRequest req, String zt, int bctjdel,MultipartFile file,String path) throws CustomException {
|
|
|
|
Map map = new HashMap();
|
|
|
|
Map map = new HashMap();
|
|
|
|
List<DmBchxylp> adds = new ArrayList<>();
|
|
|
|
List<DmBchxylp> adds = new ArrayList<>();
|
|
|
|
int indexOfUnderscore = fileName.indexOf('_');
|
|
|
|
int indexOfUnderscore = fileName.indexOf('_');
|
|
|
@ -739,12 +756,14 @@ public class BomUploadServiceImpl {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (adds.size() > 0) {
|
|
|
|
if (adds.size() > 0) {
|
|
|
|
bchxylpService.saveBatch(adds);
|
|
|
|
bchxylpService.saveBatch(adds);
|
|
|
|
|
|
|
|
//上传文件到服务器
|
|
|
|
|
|
|
|
saveFile(file,path,(String) req.getAttribute("yhms"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public Map xctjUpload(List<String> lines, String fileName, HttpServletRequest req, String zt, int xctjdel) throws CustomException {
|
|
|
|
public Map xctjUpload(List<String> lines, String fileName, HttpServletRequest req, String zt, int xctjdel,MultipartFile file,String path) throws CustomException {
|
|
|
|
Map map = new HashMap();
|
|
|
|
Map map = new HashMap();
|
|
|
|
List<Dm_zhbmp> zllbs = dm_zhbmpRepository.findByBMLB("ZLLB");
|
|
|
|
List<Dm_zhbmp> zllbs = dm_zhbmpRepository.findByBMLB("ZLLB");
|
|
|
|
List<Dm_zhbmp> kwxxs = dm_zhbmpRepository.findByBMLB("KWXX");
|
|
|
|
List<Dm_zhbmp> kwxxs = dm_zhbmpRepository.findByBMLB("KWXX");
|
|
|
@ -849,11 +868,13 @@ public class BomUploadServiceImpl {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (adds.size() > 0) {
|
|
|
|
if (adds.size() > 0) {
|
|
|
|
bchxylpService.saveBatch(adds);
|
|
|
|
bchxylpService.saveBatch(adds);
|
|
|
|
|
|
|
|
//上传文件到服务器
|
|
|
|
|
|
|
|
saveFile(file,path,(String) req.getAttribute("yhms"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public Map bctltUpload(List<String> lines, String fileName, HttpServletRequest req, String zt, int tld) throws CustomException, ScriptException {
|
|
|
|
public Map bctltUpload(List<String> lines, String fileName, HttpServletRequest req, String zt, int tld,MultipartFile file,String path) throws CustomException, ScriptException {
|
|
|
|
Map map = new HashMap();
|
|
|
|
Map map = new HashMap();
|
|
|
|
List<DmBchxjbp> adds = new ArrayList<>();
|
|
|
|
List<DmBchxjbp> adds = new ArrayList<>();
|
|
|
|
List<DmBchxmxp> addmxs = new ArrayList<>();
|
|
|
|
List<DmBchxmxp> addmxs = new ArrayList<>();
|
|
|
@ -1034,6 +1055,8 @@ public class BomUploadServiceImpl {
|
|
|
|
bchxjbpService.saveBatch(adds);
|
|
|
|
bchxjbpService.saveBatch(adds);
|
|
|
|
dmBchxmxpMapper.updateWpgg(czbh, pl);
|
|
|
|
dmBchxmxpMapper.updateWpgg(czbh, pl);
|
|
|
|
dmBchxmxpMapper.updateWph(czbh, pl);
|
|
|
|
dmBchxmxpMapper.updateWph(czbh, pl);
|
|
|
|
|
|
|
|
//上传文件到服务器
|
|
|
|
|
|
|
|
saveFile(file,path,(String) req.getAttribute("yhms"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 反写批量表 零件编号 前4位是分段号
|
|
|
|
// 反写批量表 零件编号 前4位是分段号
|
|
|
|
addmxs.forEach(e -> {
|
|
|
|
addmxs.forEach(e -> {
|
|
|
@ -1053,7 +1076,7 @@ public class BomUploadServiceImpl {
|
|
|
|
return map;
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public Map ljptbUpload(List<String> lines, String fileName, HttpServletRequest req, String zt, int ldpt) throws CustomException {
|
|
|
|
public Map ljptbUpload(List<String> lines, String fileName, HttpServletRequest req, String zt, int ldpt,MultipartFile file,String path) throws CustomException {
|
|
|
|
List<DmWlqd> adds = new ArrayList<>();
|
|
|
|
List<DmWlqd> adds = new ArrayList<>();
|
|
|
|
Map map = new HashMap();
|
|
|
|
Map map = new HashMap();
|
|
|
|
String czbh = "";
|
|
|
|
String czbh = "";
|
|
|
@ -1160,6 +1183,8 @@ public class BomUploadServiceImpl {
|
|
|
|
if (adds.size() > 0) {
|
|
|
|
if (adds.size() > 0) {
|
|
|
|
wlqdService.saveBatch(adds);
|
|
|
|
wlqdService.saveBatch(adds);
|
|
|
|
insertWpjbbByLjptb(adds);
|
|
|
|
insertWpjbbByLjptb(adds);
|
|
|
|
|
|
|
|
//上传文件到服务器
|
|
|
|
|
|
|
|
saveFile(file,path,(String) req.getAttribute("yhms"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
adds.forEach(e -> {
|
|
|
|
adds.forEach(e -> {
|
|
|
|
UpdateWrapper<DmCzplpNew> qw = new UpdateWrapper<>();
|
|
|
|
UpdateWrapper<DmCzplpNew> qw = new UpdateWrapper<>();
|
|
|
@ -1663,10 +1688,6 @@ public class BomUploadServiceImpl {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据套料图号得到组立信息。
|
|
|
|
// 根据套料图号得到组立信息。
|
|
|
|
public String getZL(String tzbh) {
|
|
|
|
public String getZL(String tzbh) {
|
|
|
|
String bh = tzbh.substring(6, 8);
|
|
|
|
String bh = tzbh.substring(6, 8);
|
|
|
@ -1692,4 +1713,11 @@ public class BomUploadServiceImpl {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void saveFile(MultipartFile file,String path,String yhdm){
|
|
|
|
|
|
|
|
String url= com.dsic.gj_erp.util.FileUtil.handlerUpload(file,path);
|
|
|
|
|
|
|
|
bomMapper.insertFile(url,yhdm);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|