|
|
|
@ -2,10 +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.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
import com.dsic.gj_erp.bean.ResultBean;
|
|
|
|
|
import com.dsic.gj_erp.bean.jcsj.*;
|
|
|
|
|
import com.dsic.gj_erp.bean.jcsj.vo.BomVO;
|
|
|
|
|
import com.dsic.gj_erp.bean.jhgk.DmTzjh;
|
|
|
|
|
import com.dsic.gj_erp.bean.sy.Dm_zhbmp;
|
|
|
|
|
import com.dsic.gj_erp.dao.sy.Dm_zhbmpRepository;
|
|
|
|
@ -69,7 +71,7 @@ public class BomUploadServiceImpl {
|
|
|
|
|
@Autowired
|
|
|
|
|
DmBomService dmBomService;
|
|
|
|
|
|
|
|
|
|
public synchronized ResultBean uploadZ(MultipartFile[] file, String czbh, String isupload, HttpServletRequest req) throws IOException, CustomException, ScriptException {
|
|
|
|
|
public synchronized ResultBean uploadZ(MultipartFile[] file, String czbh,String pl, String isupload, HttpServletRequest req) throws IOException, CustomException, ScriptException {
|
|
|
|
|
String savePath = UUID.randomUUID().toString().replace("-", "");
|
|
|
|
|
//dezt="00";
|
|
|
|
|
File destFile = null;
|
|
|
|
@ -81,11 +83,19 @@ public class BomUploadServiceImpl {
|
|
|
|
|
int tld = 1;
|
|
|
|
|
int ldpt = 1;
|
|
|
|
|
String czbh1="";
|
|
|
|
|
String pl="";
|
|
|
|
|
String pl1="";
|
|
|
|
|
|
|
|
|
|
List<DmBom> list = dmBomService.list(new QueryWrapper<DmBom>().eq("sjch", czbh)
|
|
|
|
|
.eq(StrUtil.isNotEmpty((String) pl), "pl",pl)
|
|
|
|
|
);
|
|
|
|
|
if(list.size()>0){
|
|
|
|
|
throw new CustomException(10201, "船号"+czbh+"批量"+pl +"已经提交bom数据 不可修改");
|
|
|
|
|
}
|
|
|
|
|
for (MultipartFile f : file) {
|
|
|
|
|
String fname = f.getOriginalFilename();
|
|
|
|
|
;
|
|
|
|
|
fname= fname.substring(fname.lastIndexOf('/') + 1);
|
|
|
|
|
System.out.println("fname = " + fname);
|
|
|
|
|
System.out.println(f.getOriginalFilename());
|
|
|
|
|
destFile = FileUtil.file(savePath, fname);
|
|
|
|
|
try (InputStream inputStream = f.getInputStream()) {
|
|
|
|
@ -98,8 +108,7 @@ public class BomUploadServiceImpl {
|
|
|
|
|
// String delzt="00";
|
|
|
|
|
|
|
|
|
|
if (fname.contains("板材领取表")) {
|
|
|
|
|
Map map = this.bclqbUpload(lines, fname, req, isupload, bcdel);
|
|
|
|
|
bcdel++;
|
|
|
|
|
|
|
|
|
|
int indexOfUnderscore = fname.indexOf('_');
|
|
|
|
|
|
|
|
|
|
czbh1 = fname.substring(0, indexOfUnderscore);
|
|
|
|
@ -107,13 +116,15 @@ public class BomUploadServiceImpl {
|
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
|
|
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('批'));
|
|
|
|
|
|
|
|
|
|
Map map = this.bclqbUpload(lines, fname, req, isupload, bcdel);
|
|
|
|
|
bcdel++;
|
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
|
return new ResultBean(map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (fname.contains("型材领取表")) {
|
|
|
|
|
Map map = this.xclqbUpload(lines, fname, req, isupload, xcdel);
|
|
|
|
|
xcdel++;
|
|
|
|
|
|
|
|
|
|
int indexOfUnderscore = fname.indexOf('_');
|
|
|
|
|
|
|
|
|
|
czbh1 = fname.substring(0, indexOfUnderscore);
|
|
|
|
@ -121,13 +132,14 @@ public class BomUploadServiceImpl {
|
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
|
|
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('批'));
|
|
|
|
|
Map map = this.xclqbUpload(lines, fname, req, isupload, xcdel);
|
|
|
|
|
xcdel++;
|
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
|
return new ResultBean(map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (fname.contains("板材统计数据")) {
|
|
|
|
|
Map map = this.bctjUpload(lines, fname, req, isupload, bctjdel);
|
|
|
|
|
bctjdel++;
|
|
|
|
|
|
|
|
|
|
int indexOfUnderscore = fname.indexOf('_');
|
|
|
|
|
|
|
|
|
|
czbh1 = fname.substring(0, indexOfUnderscore);
|
|
|
|
@ -135,13 +147,14 @@ public class BomUploadServiceImpl {
|
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
|
|
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('批'));
|
|
|
|
|
Map map = this.bctjUpload(lines, fname, req, isupload, bctjdel);
|
|
|
|
|
bctjdel++;
|
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
|
return new ResultBean(map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (fname.contains("型材统计数据")) {
|
|
|
|
|
Map map = this.xctjUpload(lines, fname, req, isupload, xctjdel);
|
|
|
|
|
xctjdel++;
|
|
|
|
|
|
|
|
|
|
int indexOfUnderscore = fname.indexOf('_');
|
|
|
|
|
|
|
|
|
|
czbh1 = fname.substring(0, indexOfUnderscore);
|
|
|
|
@ -149,14 +162,15 @@ public class BomUploadServiceImpl {
|
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
|
|
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('批'));
|
|
|
|
|
Map map = this.xctjUpload(lines, fname, req, isupload, xctjdel);
|
|
|
|
|
xctjdel++;
|
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
|
return new ResultBean(map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fname.contains("套料图")) {
|
|
|
|
|
Map map = this.bctltUpload(lines, fname, req, isupload, tld);
|
|
|
|
|
tld++;
|
|
|
|
|
|
|
|
|
|
int indexOfUnderscore = fname.indexOf('_');
|
|
|
|
|
|
|
|
|
|
czbh1 = fname.substring(0, indexOfUnderscore);
|
|
|
|
@ -164,13 +178,14 @@ public class BomUploadServiceImpl {
|
|
|
|
|
int indexOfSecondUnderscore = fname.lastIndexOf('_');
|
|
|
|
|
|
|
|
|
|
pl = fname.substring(indexOfUnderscore + 1, fname.lastIndexOf('套'));
|
|
|
|
|
Map map = this.bctltUpload(lines, fname, req, isupload, tld);
|
|
|
|
|
tld++;
|
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
|
return new ResultBean(map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this.ssum(fname, '-') == 3) {
|
|
|
|
|
Map map = this.ljptbUpload(lines, fname, req, isupload, ldpt);
|
|
|
|
|
ldpt++;
|
|
|
|
|
|
|
|
|
|
int firstDashIndex = fname.indexOf("-");
|
|
|
|
|
if (firstDashIndex != -1) {
|
|
|
|
|
// 找到第二个短划线的位置,从第一个短划线的下一个位置开始搜索
|
|
|
|
@ -181,6 +196,8 @@ public class BomUploadServiceImpl {
|
|
|
|
|
pl = fname.substring(secondDashIndex + 1).split("-")[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Map map = this.ljptbUpload(lines, fname, req, isupload, ldpt);
|
|
|
|
|
ldpt++;
|
|
|
|
|
if (map.get("zt").equals("02")) {
|
|
|
|
|
return new ResultBean(map);
|
|
|
|
|
}
|
|
|
|
@ -188,7 +205,7 @@ public class BomUploadServiceImpl {
|
|
|
|
|
// del++;
|
|
|
|
|
}
|
|
|
|
|
FileUtil.del(new File(savePath));
|
|
|
|
|
List<DmBom> dmBoms = this.insertBom( req,czbh1, pl);
|
|
|
|
|
List<BomVO> dmBoms = this.insertBom( req,czbh, pl,"01");
|
|
|
|
|
Map map =new HashMap();
|
|
|
|
|
map.put("zt","01");
|
|
|
|
|
map.put("data",dmBoms);
|
|
|
|
@ -280,7 +297,7 @@ public class BomUploadServiceImpl {
|
|
|
|
|
dezt = "01";
|
|
|
|
|
if (bclqmxpListOld.size() <= 0) {
|
|
|
|
|
} else {
|
|
|
|
|
cs = bclqmxpListOld.get(0).getDrcs();
|
|
|
|
|
cs = null==bclqmxpListOld.get(0).getDrcs()?0:bclqmxpListOld.get(0).getDrcs();
|
|
|
|
|
}
|
|
|
|
|
map.put("zt", "01");
|
|
|
|
|
} else {
|
|
|
|
@ -418,7 +435,7 @@ public class BomUploadServiceImpl {
|
|
|
|
|
);
|
|
|
|
|
if (bclqmxpListOld.size() <= 0) {
|
|
|
|
|
} else {
|
|
|
|
|
cs = bclqmxpListOld.get(0).getDrcs();
|
|
|
|
|
cs = null==bclqmxpListOld.get(0).getDrcs()?0:bclqmxpListOld.get(0).getDrcs();
|
|
|
|
|
}
|
|
|
|
|
map.put("zt", "01");
|
|
|
|
|
} else {
|
|
|
|
@ -562,7 +579,7 @@ public class BomUploadServiceImpl {
|
|
|
|
|
bchxylpService.remove(new QueryWrapper<DmBchxylp>().eq("dc_ch", czbh).eq("dc_pl", pl).eq("hxfl", "B"));
|
|
|
|
|
if (tjListOld.size() <= 0) {
|
|
|
|
|
} else {
|
|
|
|
|
cs = tjListOld.get(0).getDrcs();
|
|
|
|
|
cs = null==tjListOld.get(0).getDrcs()?0:tjListOld.get(0).getDrcs();
|
|
|
|
|
}
|
|
|
|
|
map.put("zt", "01");
|
|
|
|
|
} else {
|
|
|
|
@ -728,7 +745,7 @@ public class BomUploadServiceImpl {
|
|
|
|
|
bchxylpService.remove(new QueryWrapper<DmBchxylp>().eq("dc_ch", czbh).eq("dc_pl", pl).eq("hxfl", "X"));
|
|
|
|
|
if (tjListOld.size() <= 0) {
|
|
|
|
|
} else {
|
|
|
|
|
cs = tjListOld.get(0).getDrcs();
|
|
|
|
|
cs = null==tjListOld.get(0).getDrcs()?0:tjListOld.get(0).getDrcs();
|
|
|
|
|
}
|
|
|
|
|
map.put("zt", "01");
|
|
|
|
|
dezt = "01";
|
|
|
|
@ -829,7 +846,7 @@ public class BomUploadServiceImpl {
|
|
|
|
|
bchxjbpService.remove(new QueryWrapper<DmBchxjbp>().eq("dc_ch", czbh).eq("dc_pl", pl));
|
|
|
|
|
if (tltListOld.size() <= 0) {
|
|
|
|
|
} else {
|
|
|
|
|
cs = tltListOld.get(0).getDrcs();
|
|
|
|
|
cs = null==tltListOld.get(0).getDrcs()?0:tltListOld.get(0).getDrcs();
|
|
|
|
|
}
|
|
|
|
|
map.put("zt", "01");
|
|
|
|
|
} else {
|
|
|
|
@ -1033,17 +1050,29 @@ public class BomUploadServiceImpl {
|
|
|
|
|
wlqdService.remove(new QueryWrapper<DmWlqd>().eq("dc_ch", czbh).eq("dc_pl", pl));
|
|
|
|
|
if (wlqdListOld.size() <= 0) {
|
|
|
|
|
} else {
|
|
|
|
|
cs = wlqdListOld.get(0).getDrcs();
|
|
|
|
|
cs = null==wlqdListOld.get(0).getDrcs()?0:wlqdListOld.get(0).getDrcs();
|
|
|
|
|
}
|
|
|
|
|
map.put("zt", "01");
|
|
|
|
|
} else {
|
|
|
|
|
map.put("zt", "01");
|
|
|
|
|
}
|
|
|
|
|
List<Dm_zhbmp> sjlxs = dm_zhbmpRepository.findByBMLB("SJLX");
|
|
|
|
|
List<Dm_zhbmp> zllbs = dm_zhbmpRepository.findByBMLB("ZLLB");
|
|
|
|
|
|
|
|
|
|
Map<String, String> sjlxMap = sjlxs.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
|
|
|
|
|
wlqdService.remove(new QueryWrapper<DmWlqd>().eq("dc_ch", czbh).eq("dc_fd", fd));
|
|
|
|
|
Map<String, String> zllbMap = zllbs.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
|
|
|
|
|
List<Dm_zhbmp> zllbs=null;
|
|
|
|
|
zllbs = dm_zhbmpRepository.findByBMLB("ZLLB");
|
|
|
|
|
System.out.println("zllbs = " + zllbs);
|
|
|
|
|
Map<String, String> zllbMap1 = zllbs.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
|
|
|
|
|
// Map<String, String> zllbMap = zllbs.stream().collect(
|
|
|
|
|
//
|
|
|
|
|
// Collectors.toMap(
|
|
|
|
|
// Dm_zhbmp::getBmsm,
|
|
|
|
|
// Dm_zhbmp::getBM
|
|
|
|
|
//
|
|
|
|
|
// )
|
|
|
|
|
//
|
|
|
|
|
// );
|
|
|
|
|
int xh = 1;
|
|
|
|
|
for (String ljline : lines) {
|
|
|
|
|
String[] ljlines = ljline.split(",");
|
|
|
|
@ -1086,7 +1115,7 @@ public class BomUploadServiceImpl {
|
|
|
|
|
wlqd.setZt("0");
|
|
|
|
|
String mc = ljlines[8].replace("組", "组");
|
|
|
|
|
//Dm_zhbmp zllb = dm_zhbmpRepository.findByBMLBAndBmsm("ZLLB", mc.trim());
|
|
|
|
|
String zllb = zllbMap.get(mc.trim());//
|
|
|
|
|
String zllb = zllbMap1.get(mc.trim());//
|
|
|
|
|
if (StringUtils.isBlank(zllb)) {
|
|
|
|
|
throw new CustomException(10104, "请查看零件配套表组立信息");
|
|
|
|
|
} else {
|
|
|
|
@ -1194,94 +1223,300 @@ public class BomUploadServiceImpl {
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<DmBom> insertBom( HttpServletRequest request,String dcch,String dcpl) throws CustomException {
|
|
|
|
|
public List<BomVO> insertBom( HttpServletRequest request,String dcch,String dcpl,String type ) throws CustomException {
|
|
|
|
|
|
|
|
|
|
List<DmBom> list = dmBomService.list(new QueryWrapper<DmBom>().eq("sjch", dcch)
|
|
|
|
|
.eq(StrUtil.isNotEmpty((String) dcpl), "pl",dcpl)
|
|
|
|
|
);
|
|
|
|
|
if(list.size()>0){
|
|
|
|
|
throw new CustomException(10201, "船号"+dcch+"批量"+dcpl +"已经提交bom数据 不可在此生成");
|
|
|
|
|
}
|
|
|
|
|
// dmBomService.remove(new QueryWrapper<DmBom>().eq("sjch",dcch).eq("pl",dcpl));
|
|
|
|
|
Map querMap= new HashMap();
|
|
|
|
|
querMap.put("dcch",dcch);
|
|
|
|
|
querMap.put("dcpl",dcpl);
|
|
|
|
|
querMap.put("delx","B");
|
|
|
|
|
querMap.put("hxfl","B");
|
|
|
|
|
// querMap.put("delx","B");
|
|
|
|
|
// querMap.put("hxfl","B");
|
|
|
|
|
List<DmBclqmxp> bcLQlList = bclqmxpService.getBcLQlList(querMap);
|
|
|
|
|
List<DmBchxmxp> tltList = bchxmxpService.getTLTList(querMap);
|
|
|
|
|
List<DmBchxylp> bcTJlList = bchxylpService.getBcTJlList(querMap);
|
|
|
|
|
List<DmBom> adds =new ArrayList<>();
|
|
|
|
|
/* bcLQlList.forEach(e->{
|
|
|
|
|
DmBom dmBom=new DmBom();
|
|
|
|
|
dmBom.setType("1");
|
|
|
|
|
dmBom.setSjch(e.getDcChZ());
|
|
|
|
|
dmBom.setPl(e.getDcPlZ());
|
|
|
|
|
dmBom.setFds(e.getDcFdZ());
|
|
|
|
|
dmBom.setZl(e.getDcZlZ());
|
|
|
|
|
dmBom.setWpcz(e.getWpxh());
|
|
|
|
|
dmBom.setWpgg(e.getWpgg());
|
|
|
|
|
dmBom.setBh( new BigDecimal(e.getWpgg().split("\\*")[0]));
|
|
|
|
|
dmBom.setBc(new BigDecimal(e.getWpgg().split("\\*")[2]));
|
|
|
|
|
//bcTJlList.stream().filter(fst->).collect(Collectors.toList());
|
|
|
|
|
});*/
|
|
|
|
|
tltList.forEach(e->{
|
|
|
|
|
if(StringUtils.isNotBlank(e.getWpggZ())){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DmBom dmBom=new DmBom();
|
|
|
|
|
dmBom.setQgcd(e.getYlzd4Z());
|
|
|
|
|
dmBom.setHxcd(e.getHxcdZ());
|
|
|
|
|
dmBom.setTzbh(e.getTzbhZ());
|
|
|
|
|
dmBom.setTlsl(e.getSl());
|
|
|
|
|
dmBom.setLjbh(e.getWph());
|
|
|
|
|
dmBom.setLjsl(e.getLjslZ());
|
|
|
|
|
dmBom.setSjch(e.getDcChZ());
|
|
|
|
|
dmBom.setPl(e.getDcPlZ());
|
|
|
|
|
dmBom.setFd(e.getWph().substring(0,4));
|
|
|
|
|
|
|
|
|
|
dmBom.setWpcz(e.getWpxhZ());
|
|
|
|
|
dmBom.setWpgg(e.getWpggZ());
|
|
|
|
|
System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ().split("\\*")[0]);
|
|
|
|
|
System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ());
|
|
|
|
|
dmBom.setBh( new BigDecimal(e.getWpggZ().split("\\*")[0]));
|
|
|
|
|
dmBom.setBc(new BigDecimal(e.getWpggZ().split("\\*")[2]));
|
|
|
|
|
String tzbh=e.getTzbhZ();
|
|
|
|
|
String hxlx="";
|
|
|
|
|
// 根据图纸编号获取 手工,数控 跨位,组立,、
|
|
|
|
|
if(tzbh.substring(4,5).equals("S")){
|
|
|
|
|
hxlx = "1030";
|
|
|
|
|
}else if(tzbh.substring(4,5).equals("N")){
|
|
|
|
|
hxlx = "1020";
|
|
|
|
|
}
|
|
|
|
|
List<Dm_zhbmp> zllbs = dm_zhbmpRepository.findByBMLB("ZLLB");
|
|
|
|
|
List<Dm_zhbmp> kwxxs = dm_zhbmpRepository.findByBMLB("KWXX");
|
|
|
|
|
List<Dm_zhbmp> qgkws = dm_zhbmpRepository.findByBMLB("QGKW");
|
|
|
|
|
Map<String, String> zllbMap = zllbs.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
|
|
|
|
|
Map<String, String> kwxxMap = kwxxs.stream().collect(Collectors.toMap(Dm_zhbmp::getBM, Dm_zhbmp::getBmsm));
|
|
|
|
|
Map<String, String> qgKwMap = qgkws.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
|
|
|
|
|
// 跨位
|
|
|
|
|
String s = kwxxMap.get(tzbh.substring(4,7));
|
|
|
|
|
|
|
|
|
|
String zl = this.getZL(tzbh);
|
|
|
|
|
List<Dm_zhbmp> zllbs = dm_zhbmpRepository.findByBMLB("ZLLB");
|
|
|
|
|
List<Dm_zhbmp> kwxxs = dm_zhbmpRepository.findByBMLB("KWXX");
|
|
|
|
|
List<Dm_zhbmp> qgkws = dm_zhbmpRepository.findByBMLB("QGKW");
|
|
|
|
|
Map<String, String> zllbMap = zllbs.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
|
|
|
|
|
Map<String, String> kwxxMap = kwxxs.stream().collect(Collectors.toMap(Dm_zhbmp::getBM, Dm_zhbmp::getBmsm));
|
|
|
|
|
Map<String, String> qgKwMap = qgkws.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
|
|
|
|
|
List<BomVO> adds =new ArrayList<>();
|
|
|
|
|
for (int i = 0; i <bcLQlList.size() ; i++) {
|
|
|
|
|
BomVO bomVO=new BomVO();
|
|
|
|
|
bomVO.setBclq(bcLQlList.get(i));
|
|
|
|
|
// bomVO.setBclqs(i);
|
|
|
|
|
adds.add(bomVO);
|
|
|
|
|
bomVO.setCs(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String zlbm = zllbMap.get(zl);
|
|
|
|
|
String zzcj = qgKwMap.get(s);
|
|
|
|
|
dmBom.setZl(zlbm);
|
|
|
|
|
dmBom.setKw(zzcj);
|
|
|
|
|
dmBom.setLqlb(hxlx);
|
|
|
|
|
List<DmBchxylp> collect = bcTJlList.stream().filter(fst -> fst.getTzbh().equals(e.getTzbhZ())).collect(Collectors.toList());
|
|
|
|
|
if(collect.size()>0){
|
|
|
|
|
dmBom.setTjbs("Y");
|
|
|
|
|
for (int i = 0; i <bcTJlList.size() ; i++) {
|
|
|
|
|
if(i==adds.size()){
|
|
|
|
|
BomVO bomVO=new BomVO();
|
|
|
|
|
bomVO.setTjb(bcTJlList.get(i));
|
|
|
|
|
bomVO.setCs(2);
|
|
|
|
|
adds.add(bomVO);
|
|
|
|
|
}else{
|
|
|
|
|
for(BomVO v: adds){
|
|
|
|
|
v.setTjb(bcTJlList.get(i));
|
|
|
|
|
v.setCs(2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<DmBclqmxp> collect1 = bcLQlList.stream().filter(fst -> fst.getWpgg().equals(e.getWpggZ()) && fst.getWpxh().equals(e.getWpxhZ())
|
|
|
|
|
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i <tltList.size() ; i++) {
|
|
|
|
|
if(i==adds.size()){
|
|
|
|
|
BomVO bomVO=new BomVO();
|
|
|
|
|
bomVO.setTlt(tltList.get(i));
|
|
|
|
|
bomVO.setCs(3);
|
|
|
|
|
adds.add(bomVO);
|
|
|
|
|
|
|
|
|
|
if(collect1.size()>0){
|
|
|
|
|
dmBom.setLqbs("Y");
|
|
|
|
|
}else{
|
|
|
|
|
for(BomVO v: adds){
|
|
|
|
|
v.setTlt(tltList.get(i));
|
|
|
|
|
v.setCs(3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
adds.add(dmBom);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
System.out.println(" = " +"tlt over" );
|
|
|
|
|
if(type.equals("01")){
|
|
|
|
|
List<DmWlqd> ljbList = wlqdService.getLJQDList(querMap);
|
|
|
|
|
for (int i = 0; i <ljbList.size() ; i++) {
|
|
|
|
|
if(i==adds.size()){
|
|
|
|
|
BomVO bomVO=new BomVO();
|
|
|
|
|
bomVO.setLjb(ljbList.get(i));
|
|
|
|
|
bomVO.setCs(4);
|
|
|
|
|
adds.add(bomVO);
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
for(BomVO v: adds){
|
|
|
|
|
v.setLjb(ljbList.get(i));
|
|
|
|
|
v.setCs(4);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// tltList.forEach(e->{
|
|
|
|
|
// if(StringUtils.isNotBlank(e.getWpggZ())){
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// DmBom dmBom=new DmBom();
|
|
|
|
|
// dmBom.setQgcd(e.getYlzd4Z());
|
|
|
|
|
// dmBom.setHxcd(e.getHxcdZ());
|
|
|
|
|
// dmBom.setTzbh(e.getTzbhZ());
|
|
|
|
|
// dmBom.setTlsl(e.getSl());
|
|
|
|
|
// dmBom.setLjbh(e.getWph());
|
|
|
|
|
// dmBom.setLjsl(e.getLjslZ());
|
|
|
|
|
// dmBom.setSjch(e.getDcChZ());
|
|
|
|
|
// dmBom.setPl(e.getDcPlZ());
|
|
|
|
|
// dmBom.setFd(e.getWph().substring(0,4));
|
|
|
|
|
//
|
|
|
|
|
// dmBom.setWpcz(e.getWpxhZ());
|
|
|
|
|
// dmBom.setWpgg(e.getWpggZ());
|
|
|
|
|
// System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ().split("\\*")[0]);
|
|
|
|
|
// System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ());
|
|
|
|
|
// dmBom.setBh( new BigDecimal(e.getWpggZ().split("\\*")[0]));
|
|
|
|
|
// dmBom.setBc(new BigDecimal(e.getWpggZ().split("\\*")[2]));
|
|
|
|
|
// String tzbh=e.getTzbhZ();
|
|
|
|
|
// String hxlx="";
|
|
|
|
|
// // 根据图纸编号获取 手工,数控 跨位,组立,、
|
|
|
|
|
// if(tzbh.substring(4,5).equals("S")){
|
|
|
|
|
// hxlx = "1030";
|
|
|
|
|
// }else if(tzbh.substring(4,5).equals("N")){
|
|
|
|
|
// hxlx = "1020";
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// // 跨位
|
|
|
|
|
// String s = kwxxMap.get(tzbh.substring(4,7));
|
|
|
|
|
//
|
|
|
|
|
// String zl = this.getZL(tzbh);
|
|
|
|
|
//
|
|
|
|
|
// String zlbm = zllbMap.get(zl);
|
|
|
|
|
// String zzcj = qgKwMap.get(s);
|
|
|
|
|
// dmBom.setZl(zlbm);
|
|
|
|
|
// dmBom.setKw(zzcj);
|
|
|
|
|
// dmBom.setLqlb(hxlx);
|
|
|
|
|
// List<DmBchxylp> collect = bcTJlList.stream().filter(fst -> fst.getTzbh().equals(e.getTzbhZ())).collect(Collectors.toList());
|
|
|
|
|
// if(collect.size()>0){
|
|
|
|
|
// dmBom.setTjbs("Y");
|
|
|
|
|
// }
|
|
|
|
|
// List<DmBclqmxp> collect1 = bcLQlList.stream().filter(fst -> fst.getWpgg().equals(e.getWpggZ()) && fst.getWpxh().equals(e.getWpxhZ())
|
|
|
|
|
//
|
|
|
|
|
// ).collect(Collectors.toList());
|
|
|
|
|
//
|
|
|
|
|
// if(collect1.size()>0){
|
|
|
|
|
// dmBom.setLqbs("Y");
|
|
|
|
|
// }
|
|
|
|
|
// adds.add(dmBom);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// dmBomService.insertBoms(adds);
|
|
|
|
|
return adds;
|
|
|
|
|
}
|
|
|
|
|
public List<DmBom> saveBom( HttpServletRequest request,List<BomVO>list) throws CustomException {
|
|
|
|
|
|
|
|
|
|
// List<DmBom> list = dmBomService.list(new QueryWrapper<DmBom>().eq("sjch", dcch)
|
|
|
|
|
// .eq(StrUtil.isNotEmpty((String) dcpl), "pl",dcpl)
|
|
|
|
|
// );
|
|
|
|
|
// if(list.size()>0){
|
|
|
|
|
// throw new CustomException(10201, "船号"+dcch+"批量"+dcpl +"已经提交bom数据 不可在此生成");
|
|
|
|
|
// }
|
|
|
|
|
//// dmBomService.remove(new QueryWrapper<DmBom>().eq("sjch",dcch).eq("pl",dcpl));
|
|
|
|
|
// Map querMap= new HashMap();
|
|
|
|
|
// querMap.put("dcch",dcch);
|
|
|
|
|
// querMap.put("dcpl",dcpl);
|
|
|
|
|
// querMap.put("delx","B");
|
|
|
|
|
// querMap.put("hxfl","B");
|
|
|
|
|
|
|
|
|
|
List<Dm_zhbmp> zllbs = dm_zhbmpRepository.findByBMLB("ZLLB");
|
|
|
|
|
List<Dm_zhbmp> kwxxs = dm_zhbmpRepository.findByBMLB("KWXX");
|
|
|
|
|
List<Dm_zhbmp> qgkws = dm_zhbmpRepository.findByBMLB("QGKW");
|
|
|
|
|
Map<String, String> zllbMap = zllbs.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
|
|
|
|
|
Map<String, String> kwxxMap = kwxxs.stream().collect(Collectors.toMap(Dm_zhbmp::getBM, Dm_zhbmp::getBmsm));
|
|
|
|
|
Map<String, String> qgKwMap = qgkws.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
|
|
|
|
|
List<DmBom> adds =new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
int cs= list.get(0).getCs();
|
|
|
|
|
if(2==cs){
|
|
|
|
|
|
|
|
|
|
ArrayList<BomVO> collect = list.stream().collect(
|
|
|
|
|
Collectors.collectingAndThen(
|
|
|
|
|
Collectors.toCollection(
|
|
|
|
|
() -> new TreeSet<>(
|
|
|
|
|
Comparator.comparing(
|
|
|
|
|
tc -> tc.getTjb().getWpgg() + ";" + tc.getTjb().getWpxh() + ";" + tc.getTjb().getTzbh() ))), ArrayList::new));
|
|
|
|
|
collect.forEach(i->{
|
|
|
|
|
DmBchxylp e =i.getTjb();
|
|
|
|
|
if(StringUtils.isNotBlank(e.getWpgg())){
|
|
|
|
|
|
|
|
|
|
DmBom dmBom=new DmBom();
|
|
|
|
|
dmBom.setCs(2);
|
|
|
|
|
// dmBom.setQgcd(e.getYlzd4Z());
|
|
|
|
|
//dmBom.setHxcd(e.getHxcdZ());
|
|
|
|
|
dmBom.setTzbh(e.getTzbh());
|
|
|
|
|
// dmBom.setTlsl(e.getSl());
|
|
|
|
|
//dmBom.setLjbh(e.getWph());
|
|
|
|
|
//dmBom.setLjsl(e.getLjslZ());
|
|
|
|
|
dmBom.setDcch(e.getDcCh());
|
|
|
|
|
dmBom.setPl(e.getDcPl());
|
|
|
|
|
//dmBom.setFd(e.getWph().substring(0,4));
|
|
|
|
|
|
|
|
|
|
dmBom.setWpcz(e.getWpxh());
|
|
|
|
|
dmBom.setWpgg(e.getWpgg());
|
|
|
|
|
System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpgg().split("\\*")[0]);
|
|
|
|
|
System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpgg());
|
|
|
|
|
dmBom.setBh( new BigDecimal(e.getWpgg().split("\\*")[0]));
|
|
|
|
|
dmBom.setBc(new BigDecimal(e.getWpgg().split("\\*")[2]));
|
|
|
|
|
String tzbh=e.getTzbh();
|
|
|
|
|
String hxlx="";
|
|
|
|
|
// 根据图纸编号获取 手工,数控 跨位,组立,、
|
|
|
|
|
if(tzbh.substring(4,5).equals("S")){
|
|
|
|
|
hxlx = "1030";
|
|
|
|
|
}else if(tzbh.substring(4,5).equals("N")){
|
|
|
|
|
hxlx = "1020";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 跨位
|
|
|
|
|
String s = kwxxMap.get(tzbh.substring(4,7));
|
|
|
|
|
|
|
|
|
|
String zl = this.getZL(tzbh);
|
|
|
|
|
|
|
|
|
|
String zlbm = zllbMap.get(zl);
|
|
|
|
|
String zzcj = qgKwMap.get(s);
|
|
|
|
|
dmBom.setZl(zlbm);
|
|
|
|
|
dmBom.setKw(zzcj);
|
|
|
|
|
dmBom.setLqlb(hxlx);
|
|
|
|
|
// 领取表找打 fds
|
|
|
|
|
if(e.getHxfl().equals("B")){
|
|
|
|
|
List<BomVO> collect11 = list.stream().filter(fst -> fst.getBclq().getWpgg().equals(e.getWpgg()) &&
|
|
|
|
|
fst.getBclq().getWpxh().equals(e.getWpxh())
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
if(collect11.size()>0){
|
|
|
|
|
dmBom.setFds(collect11.get(0).getBclq().getDcFdZ());
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
List<BomVO> collect11 = list.stream().filter(fst -> fst.getBclq().getWpxh().equals(e.getWpgg()) &&
|
|
|
|
|
fst.getBclq().getWpgg().equals(e.getWpxh())
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
if(collect11.size()>0){
|
|
|
|
|
dmBom.setFds(collect11.get(0).getBclq().getDcFdZ());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
adds.add(dmBom);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
list.forEach(i->{
|
|
|
|
|
DmBchxmxp e =i.getTlt();
|
|
|
|
|
if(StringUtils.isNotBlank(e.getWpggZ())){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DmBom dmBom=new DmBom();
|
|
|
|
|
dmBom.setCs(3);
|
|
|
|
|
dmBom.setQgcd(e.getYlzd4Z());
|
|
|
|
|
dmBom.setHxcd(e.getHxcdZ());
|
|
|
|
|
dmBom.setTzbh(e.getTzbhZ());
|
|
|
|
|
dmBom.setTlsl(e.getSl());
|
|
|
|
|
dmBom.setLjbh(e.getWph());
|
|
|
|
|
dmBom.setLjsl(e.getLjslZ());
|
|
|
|
|
dmBom.setDcch(e.getDcChZ());
|
|
|
|
|
dmBom.setPl(e.getDcPlZ());
|
|
|
|
|
dmBom.setFd(e.getWph().substring(0,4));
|
|
|
|
|
|
|
|
|
|
dmBom.setWpcz(e.getWpxhZ());
|
|
|
|
|
dmBom.setWpgg(e.getWpggZ());
|
|
|
|
|
System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ().split("\\*")[0]);
|
|
|
|
|
System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ());
|
|
|
|
|
dmBom.setBh( new BigDecimal(e.getWpggZ().split("\\*")[0]));
|
|
|
|
|
dmBom.setBc(new BigDecimal(e.getWpggZ().split("\\*")[2]));
|
|
|
|
|
String tzbh=e.getTzbhZ();
|
|
|
|
|
String hxlx="";
|
|
|
|
|
// 根据图纸编号获取 手工,数控 跨位,组立,、
|
|
|
|
|
if(tzbh.substring(4,5).equals("S")){
|
|
|
|
|
hxlx = "1030";
|
|
|
|
|
}else if(tzbh.substring(4,5).equals("N")){
|
|
|
|
|
hxlx = "1020";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 跨位
|
|
|
|
|
String s = kwxxMap.get(tzbh.substring(4,7));
|
|
|
|
|
|
|
|
|
|
String zl = this.getZL(tzbh);
|
|
|
|
|
|
|
|
|
|
String zlbm = zllbMap.get(zl);
|
|
|
|
|
String zzcj = qgKwMap.get(s);
|
|
|
|
|
dmBom.setZl(zlbm);
|
|
|
|
|
dmBom.setKw(zzcj);
|
|
|
|
|
dmBom.setLqlb(hxlx);
|
|
|
|
|
dmBom.setLqbs("Y");
|
|
|
|
|
adds.add(dmBom);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dmBomService.insertBoms(adds);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return adds;
|
|
|
|
|
}
|
|
|
|
|
// 根据套料图号得到组立信息。
|
|
|
|
|
public String getZL(String tzbh){
|
|
|
|
|
String bh=tzbh.substring(6,8);
|
|
|
|
|