master
xhj 2 years ago
parent 8ab61396ed
commit fa52944ec4

@ -181,7 +181,7 @@ public class DmBom implements Serializable {
private String type; private String type;
@TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
private String fds; private String fds;
@ -193,6 +193,8 @@ public class DmBom implements Serializable {
private String zt; private String zt;
private Integer cs; private Integer cs;
@TableId(value = "idd", type = IdType.ASSIGN_UUID)
private String idd;
} }

@ -57,7 +57,16 @@ public class DmBomController {
@PostMapping("/saveListBom") @PostMapping("/saveListBom")
public ResultBean saveListBom(HttpServletRequest req, @RequestBody List<BomVO> list) throws CustomException { public ResultBean saveListBom(HttpServletRequest req, @RequestBody List<BomVO> list) throws CustomException {
bomUploadService.saveBom(req,list); bomUploadService.saveBom(req,list,"","",null);
//
return new ResultBean();
// return null;
}
@PostMapping("/copyListBom")
public ResultBean copyListBom(HttpServletRequest req, @RequestBody Map map) throws CustomException {
dmBomService.copyListBom(req,map);
// //
return new ResultBean(); return new ResultBean();
// return null; // return null;

@ -24,4 +24,6 @@ public interface DmBomService extends IService<DmBom> {
List<DmBom>getListBomRealy(HttpServletRequest req, Map map) throws CustomException; List<DmBom>getListBomRealy(HttpServletRequest req, Map map) throws CustomException;
void insertBoms(List<DmBom> map) throws CustomException; void insertBoms(List<DmBom> map) throws CustomException;
void copyListBom(HttpServletRequest req, Map map);
} }

@ -67,11 +67,10 @@ public class BomUploadServiceImpl {
DmCzplpNewService dmCzplpNewService; DmCzplpNewService dmCzplpNewService;
@Autowired @Autowired
DmTzjhService dmTzjhService; DmTzjhService dmTzjhService;
@Autowired @Autowired
DmBomService dmBomService; DmBomService dmBomService;
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) 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;
@ -82,19 +81,31 @@ public class BomUploadServiceImpl {
int xctjdel = 1; int xctjdel = 1;
int tld = 1; int tld = 1;
int ldpt = 1; int ldpt = 1;
String czbh1=""; String czbh1 = "";
String pl1=""; String pl1 = "";
// List<DmBom> list = dmBomService.list(new QueryWrapper<DmBom>().eq("sjch", czbh)
List<DmBom> list = dmBomService.list(new QueryWrapper<DmBom>().eq("sjch", czbh) // .eq(StrUtil.isNotEmpty((String) pl), "pl",pl)
.eq(StrUtil.isNotEmpty((String) pl), "pl",pl) // );
); // if(list.size()>0){
if(list.size()>0){ // throw new CustomException(10201, "船号"+czbh+"批量"+pl +"已经提交bom数据 不可修改");
throw new CustomException(10201, "船号"+czbh+"批量"+pl +"已经提交bom数据 不可修改"); // }
// 判断是否导入过
if (isupload.equals("01")) {
List<DmBclqjbp> bclqmxpListOld = bclqjbpService.list(new QueryWrapper<DmBclqjbp>().eq("DC_CH", czbh)
.eq("DC_PL", pl)
);
if (bclqmxpListOld.size() > 0) {
Map map = new HashMap();
map.put("zt", "02");
return new ResultBean(map);
}
} else {
} }
boolean fbom = false;
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);
System.out.println(f.getOriginalFilename()); System.out.println(f.getOriginalFilename());
destFile = FileUtil.file(savePath, fname); destFile = FileUtil.file(savePath, fname);
@ -106,17 +117,12 @@ public class BomUploadServiceImpl {
System.out.println("lines = " + e); System.out.println("lines = " + e);
}); });
// String delzt="00"; // String delzt="00";
if (fname.contains("板材领取表")) { if (fname.contains("板材领取表")) {
int indexOfUnderscore = fname.indexOf('_'); int indexOfUnderscore = fname.indexOf('_');
czbh1 = fname.substring(0, indexOfUnderscore); czbh1 = fname.substring(0, indexOfUnderscore);
// 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);
bcdel++; bcdel++;
if (map.get("zt").equals("02")) { if (map.get("zt").equals("02")) {
@ -124,13 +130,10 @@ public class BomUploadServiceImpl {
} }
} }
if (fname.contains("型材领取表")) { if (fname.contains("型材领取表")) {
int indexOfUnderscore = fname.indexOf('_'); int indexOfUnderscore = fname.indexOf('_');
czbh1 = fname.substring(0, indexOfUnderscore); czbh1 = fname.substring(0, indexOfUnderscore);
// 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);
xcdel++; xcdel++;
@ -139,13 +142,10 @@ public class BomUploadServiceImpl {
} }
} }
if (fname.contains("板材统计数据")) { if (fname.contains("板材统计数据")) {
int indexOfUnderscore = fname.indexOf('_'); int indexOfUnderscore = fname.indexOf('_');
czbh1 = fname.substring(0, indexOfUnderscore); czbh1 = fname.substring(0, indexOfUnderscore);
// 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);
bctjdel++; bctjdel++;
@ -154,13 +154,10 @@ public class BomUploadServiceImpl {
} }
} }
if (fname.contains("型材统计数据")) { if (fname.contains("型材统计数据")) {
int indexOfUnderscore = fname.indexOf('_'); int indexOfUnderscore = fname.indexOf('_');
czbh1 = fname.substring(0, indexOfUnderscore); czbh1 = fname.substring(0, indexOfUnderscore);
// 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);
xctjdel++; xctjdel++;
@ -168,15 +165,11 @@ public class BomUploadServiceImpl {
return new ResultBean(map); return new ResultBean(map);
} }
} }
if (fname.contains("套料图")) { if (fname.contains("套料图")) {
int indexOfUnderscore = fname.indexOf('_'); int indexOfUnderscore = fname.indexOf('_');
czbh1 = fname.substring(0, indexOfUnderscore); czbh1 = fname.substring(0, indexOfUnderscore);
// 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);
tld++; tld++;
@ -185,7 +178,6 @@ public class BomUploadServiceImpl {
} }
} }
if (this.ssum(fname, '-') == 3) { if (this.ssum(fname, '-') == 3) {
int firstDashIndex = fname.indexOf("-"); int firstDashIndex = fname.indexOf("-");
if (firstDashIndex != -1) { if (firstDashIndex != -1) {
// 找到第二个短划线的位置,从第一个短划线的下一个位置开始搜索 // 找到第二个短划线的位置,从第一个短划线的下一个位置开始搜索
@ -204,11 +196,30 @@ public class BomUploadServiceImpl {
} }
// del++; // del++;
} }
for (MultipartFile f : file) {
String fname = f.getOriginalFilename();
fname = fname.substring(fname.lastIndexOf('/') + 1);
if (fname.contains("板材统计数据")) {
fbom = true;
cs = 2;
}
if (fname.contains("型材统计数据")) {
fbom = true;
cs = 2;
}
if (fname.contains("套料图")) {
fbom = true;
cs = 3;
}
}
FileUtil.del(new File(savePath)); FileUtil.del(new File(savePath));
List<BomVO> dmBoms = this.insertBom( req,czbh, pl,"01"); List<BomVO> dmBoms = this.insertBom(req, czbh, pl, "01");
Map map =new HashMap(); if (fbom) {
map.put("zt","01"); this.saveBom(req, dmBoms, czbh, pl, cs);
map.put("data",dmBoms); }
Map map = new HashMap();
map.put("zt", "01");
map.put("data", dmBoms);
return new ResultBean(map); return new ResultBean(map);
} }
@ -277,7 +288,7 @@ public class BomUploadServiceImpl {
List<DmBclqmxp> bclqmxpListOld = bclqmxpService.list(new QueryWrapper<DmBclqmxp>().eq("DC_CH_z", bclqjbp.getDcCh()) List<DmBclqmxp> bclqmxpListOld = bclqmxpService.list(new QueryWrapper<DmBclqmxp>().eq("DC_CH_z", bclqjbp.getDcCh())
.eq("DC_PL_z", bclqjbp.getDcPl()).eq("DELX_z", "B") .eq("DC_PL_z", bclqjbp.getDcPl()).eq("DELX_z", "B")
); );
if (bclqmxpListOld.size() > 0 && "01".equals(zt)) { if (bclqmxpListOld.size() > 0 && "01".equals(zt) && bcdel == 1) {
// 提示是否覆盖 // 提示是否覆盖
map.put("zt", "02"); map.put("zt", "02");
return map; return map;
@ -297,7 +308,7 @@ public class BomUploadServiceImpl {
dezt = "01"; dezt = "01";
if (bclqmxpListOld.size() <= 0) { if (bclqmxpListOld.size() <= 0) {
} else { } else {
cs = null==bclqmxpListOld.get(0).getDrcs()?0:bclqmxpListOld.get(0).getDrcs(); cs = null == bclqmxpListOld.get(0).getDrcs() ? 0 : bclqmxpListOld.get(0).getDrcs();
} }
map.put("zt", "01"); map.put("zt", "01");
} else { } else {
@ -416,7 +427,7 @@ public class BomUploadServiceImpl {
// .eq("DC_ZL_z", bclqjbp.getDcZl()).eq("DC_PL_z", bclqjbp.getDcPl()).eq("DELX_z", "X")); // .eq("DC_ZL_z", bclqjbp.getDcZl()).eq("DC_PL_z", bclqjbp.getDcPl()).eq("DELX_z", "X"));
List<DmBclqmxp> bclqmxpListOld = bclqmxpService.list(new QueryWrapper<DmBclqmxp>().eq("DC_CH_z", bclqjbp.getDcCh()) List<DmBclqmxp> bclqmxpListOld = bclqmxpService.list(new QueryWrapper<DmBclqmxp>().eq("DC_CH_z", bclqjbp.getDcCh())
.eq("DC_PL_z", bclqjbp.getDcPl()).eq("DELX_z", "X")); .eq("DC_PL_z", bclqjbp.getDcPl()).eq("DELX_z", "X"));
if (bclqmxpListOld.size() > 0 && "01".equals(zt)) { if (bclqmxpListOld.size() > 0 && "01".equals(zt) && xcdel == 1) {
// 提示是否覆盖 // 提示是否覆盖
map.put("zt", "02"); map.put("zt", "02");
return map; return map;
@ -435,7 +446,7 @@ public class BomUploadServiceImpl {
); );
if (bclqmxpListOld.size() <= 0) { if (bclqmxpListOld.size() <= 0) {
} else { } else {
cs = null==bclqmxpListOld.get(0).getDrcs()?0:bclqmxpListOld.get(0).getDrcs(); cs = null == bclqmxpListOld.get(0).getDrcs() ? 0 : bclqmxpListOld.get(0).getDrcs();
} }
map.put("zt", "01"); map.put("zt", "01");
} else { } else {
@ -508,15 +519,14 @@ public class BomUploadServiceImpl {
bclqmxp.setShmsZ(bclqjbp.getShms()); bclqmxp.setShmsZ(bclqjbp.getShms());
xh++; xh++;
List<DmWpjbp> list = dmWpjbpServicel.list(new QueryWrapper<DmWpjbp>().eq("WPGG", bclqmxp.getWpxh()).eq("WPXH", bclqmxp.getWpgg()).eq("WPMC", bclqmxp.getWpmc())); List<DmWpjbp> list = dmWpjbpServicel.list(new QueryWrapper<DmWpjbp>().eq("WPGG", bclqmxp.getWpxh()).eq("WPXH", bclqmxp.getWpgg()).eq("WPMC", bclqmxp.getWpmc()));
if(list.size()<=0){ if (list.size() <= 0) {
List<DmWpjbp> list1 = dmWpjbpServicel.list(new QueryWrapper<DmWpjbp>().eq("WPGG", bclqmxp.getWpxh()).eq("WPXH", bclqmxp.getWpgg())); List<DmWpjbp> list1 = dmWpjbpServicel.list(new QueryWrapper<DmWpjbp>().eq("WPGG", bclqmxp.getWpxh()).eq("WPXH", bclqmxp.getWpgg()));
if(list.size()<=0){ if (list.size() <= 0) {
this.insertwpjbbByxcLq(bclqmxp.getWpmc(), bclqmxp.getWpgg(), bclqmxp.getWpxh(), bclqmxp.getDcChZ(), bclqmxp.getZdrZ());
this.insertwpjbbByxcLq(bclqmxp.getWpmc(),bclqmxp.getWpgg(),bclqmxp.getWpxh(),bclqmxp.getDcChZ(),bclqmxp.getZdrZ()); } else {
}else{
bclqmxp.setWph(list1.get(0).getWph()); bclqmxp.setWph(list1.get(0).getWph());
} }
}else { } else {
bclqmxp.setWph(list.get(0).getWph()); bclqmxp.setWph(list.get(0).getWph());
} }
addmx.add(bclqmxp); addmx.add(bclqmxp);
@ -538,7 +548,6 @@ public class BomUploadServiceImpl {
String czbh = fileName.substring(0, indexOfUnderscore); String czbh = fileName.substring(0, indexOfUnderscore);
// List<Dm_zhbmp> zllbs = dm_zhbmpRepository.findByBMLB("ZLLB"); // List<Dm_zhbmp> zllbs = dm_zhbmpRepository.findByBMLB("ZLLB");
// Map<String, String> zllbMap = 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));
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");
List<Dm_zhbmp> qgkws = dm_zhbmpRepository.findByBMLB("QGKW"); List<Dm_zhbmp> qgkws = dm_zhbmpRepository.findByBMLB("QGKW");
@ -571,7 +580,7 @@ public class BomUploadServiceImpl {
int cs = 0; int cs = 0;
//select count(*) into:li_zl from dm_bchxylp where dc_ch =:dc_ch and dc_pl =:dc_pl and zzcj =:ls_zzcj and hxfl ='B' and tzbh = :ls_import[1]; //select count(*) into:li_zl from dm_bchxylp where dc_ch =:dc_ch and dc_pl =:dc_pl and zzcj =:ls_zzcj and hxfl ='B' and tzbh = :ls_import[1];
List<DmBchxylp> tjListOld = bchxylpService.list(new QueryWrapper<DmBchxylp>().eq("dc_ch", czbh).eq("dc_pl", pl).eq("hxfl", "B")); List<DmBchxylp> tjListOld = bchxylpService.list(new QueryWrapper<DmBchxylp>().eq("dc_ch", czbh).eq("dc_pl", pl).eq("hxfl", "B"));
if (tjListOld.size() > 0 && "01".equals(zt)) { if (tjListOld.size() > 0 && "01".equals(zt) && bctjdel == 1) {
// 提示是否覆盖 // 提示是否覆盖
map.put("zt", "02"); map.put("zt", "02");
return map; return map;
@ -579,7 +588,7 @@ public class BomUploadServiceImpl {
bchxylpService.remove(new QueryWrapper<DmBchxylp>().eq("dc_ch", czbh).eq("dc_pl", pl).eq("hxfl", "B")); bchxylpService.remove(new QueryWrapper<DmBchxylp>().eq("dc_ch", czbh).eq("dc_pl", pl).eq("hxfl", "B"));
if (tjListOld.size() <= 0) { if (tjListOld.size() <= 0) {
} else { } else {
cs = null==tjListOld.get(0).getDrcs()?0:tjListOld.get(0).getDrcs(); cs = null == tjListOld.get(0).getDrcs() ? 0 : tjListOld.get(0).getDrcs();
} }
map.put("zt", "01"); map.put("zt", "01");
} else { } else {
@ -616,24 +625,24 @@ public class BomUploadServiceImpl {
bchxylp.setYlzd1(ls_jgdm); bchxylp.setYlzd1(ls_jgdm);
bchxylp.setZzcj(kw); bchxylp.setZzcj(kw);
bchxylp.setDrcs(cs + 1); bchxylp.setDrcs(cs + 1);
String tzbh=splitLine[0]; String tzbh = splitLine[0];
String hxlx=""; String hxlx = "";
if(tzbh.substring(4,5).equals("S")){ if (tzbh.substring(4, 5).equals("S")) {
hxlx = "1030"; hxlx = "1030";
}else if (tzbh.substring(4,5).equals("N")){ } else if (tzbh.substring(4, 5).equals("N")) {
hxlx = "1020"; hxlx = "1020";
} }
// 跨位 // 跨位
String s = kwxxMap.get(tzbh.substring(4,7)); String s = kwxxMap.get(tzbh.substring(4, 7));
if(StringUtils.isBlank(s)){ if (StringUtils.isBlank(s)) {
throw new CustomException(10106, fileName + "跨位信息不存在"); throw new CustomException(10106, fileName + "跨位信息不存在");
} }
String zl = this.getZL(tzbh); String zl = this.getZL(tzbh);
if(StringUtils.isBlank(zl)){ if (StringUtils.isBlank(zl)) {
throw new CustomException(10106, fileName + "组立信息不存在"); throw new CustomException(10106, fileName + "组立信息不存在");
} }
String zlbm = zllbMap.get(zl); String zlbm = zllbMap.get(zl);
String zzcj = qgKwMap.get(s); String zzcj = qgKwMap.get(s); //xhj
bchxylp.setYlzd1(hxlx); bchxylp.setYlzd1(hxlx);
bchxylp.setZzcj(zzcj); bchxylp.setZzcj(zzcj);
bchxylp.setDcZl(zlbm); bchxylp.setDcZl(zlbm);
@ -677,24 +686,24 @@ public class BomUploadServiceImpl {
bchxylp.setYlbh(splitLine[0].substring(1) + "S_" + i); bchxylp.setYlbh(splitLine[0].substring(1) + "S_" + i);
bchxylp.setYlgg(splitLine[5 + i]); bchxylp.setYlgg(splitLine[5 + i]);
bchxylp.setYlggs(ylggs); bchxylp.setYlggs(ylggs);
String tzbh=splitLine[0]; String tzbh = splitLine[0];
String hxlx=""; String hxlx = "";
if(tzbh.substring(4,5).equals("S")){ if (tzbh.substring(4, 5).equals("S")) {
hxlx = "1030"; hxlx = "1030";
}else if (tzbh.substring(4,5).equals("N")){ } else if (tzbh.substring(4, 5).equals("N")) {
hxlx = "1020"; hxlx = "1020";
} }
// 跨位 // 跨位
String s = kwxxMap.get(tzbh.substring(4,7)); String s = kwxxMap.get(tzbh.substring(4, 7));
if(StringUtils.isBlank(s)){ if (StringUtils.isBlank(s)) {
throw new CustomException(10106, fileName + "跨位信息不存在"); throw new CustomException(10106, fileName + "跨位信息不存在");
} }
String zl = this.getZL(tzbh); String zl = this.getZL(tzbh);
if(StringUtils.isBlank(zl)){ if (StringUtils.isBlank(zl)) {
throw new CustomException(10106, fileName + "组立信息不存在"); throw new CustomException(10106, fileName + "组立信息不存在");
} }
String zlbm = zllbMap.get(zl); String zlbm = zllbMap.get(zl);
String zzcj = qgKwMap.get(s); String zzcj = qgKwMap.get(s); //xhj
bchxylp.setYlzd1(hxlx); bchxylp.setYlzd1(hxlx);
bchxylp.setZzcj(zzcj); bchxylp.setZzcj(zzcj);
bchxylp.setDcZl(zlbm); bchxylp.setDcZl(zlbm);
@ -737,7 +746,7 @@ public class BomUploadServiceImpl {
int cs = 0; int cs = 0;
//select count(*) into:li_zl from dm_bchxylp where dc_ch =:dc_ch and dc_pl =:dc_pl and zzcj =:ls_zzcj and hxfl ='B' and tzbh = :ls_import[1]; //select count(*) into:li_zl from dm_bchxylp where dc_ch =:dc_ch and dc_pl =:dc_pl and zzcj =:ls_zzcj and hxfl ='B' and tzbh = :ls_import[1];
List<DmBchxylp> tjListOld = bchxylpService.list(new QueryWrapper<DmBchxylp>().eq("dc_ch", czbh).eq("dc_pl", pl).eq("hxfl", "X")); List<DmBchxylp> tjListOld = bchxylpService.list(new QueryWrapper<DmBchxylp>().eq("dc_ch", czbh).eq("dc_pl", pl).eq("hxfl", "X"));
if (tjListOld.size() > 0 && "01".equals(zt)) { if (tjListOld.size() > 0 && "01".equals(zt) && xctjdel == 1) {
// 提示是否覆盖 // 提示是否覆盖
map.put("zt", "02"); map.put("zt", "02");
return map; return map;
@ -745,7 +754,7 @@ public class BomUploadServiceImpl {
bchxylpService.remove(new QueryWrapper<DmBchxylp>().eq("dc_ch", czbh).eq("dc_pl", pl).eq("hxfl", "X")); bchxylpService.remove(new QueryWrapper<DmBchxylp>().eq("dc_ch", czbh).eq("dc_pl", pl).eq("hxfl", "X"));
if (tjListOld.size() <= 0) { if (tjListOld.size() <= 0) {
} else { } else {
cs = null==tjListOld.get(0).getDrcs()?0:tjListOld.get(0).getDrcs(); cs = null == tjListOld.get(0).getDrcs() ? 0 : tjListOld.get(0).getDrcs();
} }
map.put("zt", "01"); map.put("zt", "01");
dezt = "01"; dezt = "01";
@ -789,27 +798,24 @@ public class BomUploadServiceImpl {
bchxylp.setZdrq(DateUtil.format(DateUtil.date(), "yyyy/MM/dd")); bchxylp.setZdrq(DateUtil.format(DateUtil.date(), "yyyy/MM/dd"));
bchxylp.setDrcs(cs + 1); bchxylp.setDrcs(cs + 1);
ii++; ii++;
String tzbh = splitLine[0];
String hxlx = "";
String tzbh=splitLine[0]; if (tzbh.substring(4, 5).equals("S")) {
String hxlx="";
if(tzbh.substring(4,5).equals("S")){
hxlx = "1030"; hxlx = "1030";
}else if (tzbh.substring(4,5).equals("N")){ } else if (tzbh.substring(4, 5).equals("N")) {
hxlx = "1020"; hxlx = "1020";
} }
// 跨位 // 跨位
String s = kwxxMap.get(tzbh.substring(4,7)); String s = kwxxMap.get(tzbh.substring(4, 7));
if(StringUtils.isBlank(s)){ if (StringUtils.isBlank(s)) {
throw new CustomException(10106, fileName + "跨位信息不存在"); throw new CustomException(10106, fileName + "跨位信息不存在");
} }
String zl = this.getZL(tzbh); String zl = this.getZL(tzbh);
if(StringUtils.isBlank(zl)){ if (StringUtils.isBlank(zl)) {
throw new CustomException(10106, fileName + "组立信息不存在"); throw new CustomException(10106, fileName + "组立信息不存在");
} }
String zlbm = zllbMap.get(zl); String zlbm = zllbMap.get(zl);
String zzcj = qgKwMap.get(s); String zzcj = qgKwMap.get(s); //xhj
bchxylp.setZzcj(zzcj); bchxylp.setZzcj(zzcj);
bchxylp.setDcZl(zlbm); bchxylp.setDcZl(zlbm);
adds.add(bchxylp); adds.add(bchxylp);
@ -837,7 +843,7 @@ public class BomUploadServiceImpl {
Map<String, String> kwxxMap = kwxxs.stream().collect(Collectors.toMap(Dm_zhbmp::getBM, Dm_zhbmp::getBmsm)); 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)); Map<String, String> qgKwMap = qgkws.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
int cs = 0; int cs = 0;
if (tltListOld.size() > 0 && "01".equals(zt)) { if (tltListOld.size() > 0 && "01".equals(zt) && tld == 1) {
// 提示是否覆盖 // 提示是否覆盖
map.put("zt", "02"); map.put("zt", "02");
return map; return map;
@ -846,7 +852,7 @@ public class BomUploadServiceImpl {
bchxjbpService.remove(new QueryWrapper<DmBchxjbp>().eq("dc_ch", czbh).eq("dc_pl", pl)); bchxjbpService.remove(new QueryWrapper<DmBchxjbp>().eq("dc_ch", czbh).eq("dc_pl", pl));
if (tltListOld.size() <= 0) { if (tltListOld.size() <= 0) {
} else { } else {
cs = null==tltListOld.get(0).getDrcs()?0:tltListOld.get(0).getDrcs(); cs = null == tltListOld.get(0).getDrcs() ? 0 : tltListOld.get(0).getDrcs();
} }
map.put("zt", "01"); map.put("zt", "01");
} else { } else {
@ -868,22 +874,22 @@ public class BomUploadServiceImpl {
hxlx = "1020"; hxlx = "1020";
} }
// 根据图纸编号获取 手工,数控 跨位,组立,、 // 根据图纸编号获取 手工,数控 跨位,组立,、
if(tzbh.substring(4,5).equals("S")){ if (tzbh.substring(4, 5).equals("S")) {
hxlx = "1030"; hxlx = "1030";
}else if(tzbh.substring(4,5).equals("N")){ } else if (tzbh.substring(4, 5).equals("N")) {
hxlx = "1020"; hxlx = "1020";
} }
// 跨位 // 跨位
String s = kwxxMap.get(tzbh.substring(4,7)); String s = kwxxMap.get(tzbh.substring(4, 7));
if(StringUtils.isBlank(s)){ if (StringUtils.isBlank(s)) {
throw new CustomException(10106, fileName + "跨位信息不存在"); throw new CustomException(10106, fileName + "跨位信息不存在");
} }
String zl = this.getZL(tzbh); String zl = this.getZL(tzbh);
if(StringUtils.isBlank(zl)){ if (StringUtils.isBlank(zl)) {
throw new CustomException(10106, fileName + "组立信息不存在"); throw new CustomException(10106, fileName + "组立信息不存在");
} }
String zlbm = zllbMap.get(zl); String zlbm = zllbMap.get(zl);
String zzcj = qgKwMap.get(s); String zzcj = qgKwMap.get(s); //xhj
for (int i = 1; i <= ggsl; i++) { for (int i = 1; i <= ggsl; i++) {
DmBchxjbp bchxjbp = new DmBchxjbp(); DmBchxjbp bchxjbp = new DmBchxjbp();
String id = syService.f_getpjh("DM", "SYSTEM", "BCHX"); String id = syService.f_getpjh("DM", "SYSTEM", "BCHX");
@ -898,7 +904,7 @@ public class BomUploadServiceImpl {
ll_ii++; ll_ii++;
bchxjbp.setTzbh(tzbh + ll_ii); bchxjbp.setTzbh(tzbh + ll_ii);
} }
if (tzbh.substring(4,5).equals("X")) { if (tzbh.substring(4, 5).equals("X")) {
//todo //todo
// li_nu = 0 // li_nu = 0
// li_number = 0 // li_number = 0
@ -1021,7 +1027,6 @@ public class BomUploadServiceImpl {
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) throws CustomException {
List<DmWlqd> adds = new ArrayList<>(); List<DmWlqd> adds = new ArrayList<>();
Map map = new HashMap(); Map map = new HashMap();
String czbh = ""; String czbh = "";
String pl = ""; String pl = "";
String fd = ""; String fd = "";
@ -1050,17 +1055,16 @@ public class BomUploadServiceImpl {
wlqdService.remove(new QueryWrapper<DmWlqd>().eq("dc_ch", czbh).eq("dc_pl", pl)); wlqdService.remove(new QueryWrapper<DmWlqd>().eq("dc_ch", czbh).eq("dc_pl", pl));
if (wlqdListOld.size() <= 0) { if (wlqdListOld.size() <= 0) {
} else { } else {
cs = null==wlqdListOld.get(0).getDrcs()?0:wlqdListOld.get(0).getDrcs(); cs = null == wlqdListOld.get(0).getDrcs() ? 0 : wlqdListOld.get(0).getDrcs();
} }
map.put("zt", "01"); map.put("zt", "01");
} else { } else {
map.put("zt", "01"); map.put("zt", "01");
} }
List<Dm_zhbmp> sjlxs = dm_zhbmpRepository.findByBMLB("SJLX"); List<Dm_zhbmp> sjlxs = dm_zhbmpRepository.findByBMLB("SJLX");
Map<String, String> sjlxMap = sjlxs.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM)); 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)); wlqdService.remove(new QueryWrapper<DmWlqd>().eq("dc_ch", czbh).eq("dc_fd", fd));
List<Dm_zhbmp> zllbs=null; List<Dm_zhbmp> zllbs = null;
zllbs = dm_zhbmpRepository.findByBMLB("ZLLB"); zllbs = dm_zhbmpRepository.findByBMLB("ZLLB");
System.out.println("zllbs = " + zllbs); System.out.println("zllbs = " + zllbs);
Map<String, String> zllbMap1 = zllbs.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM)); Map<String, String> zllbMap1 = zllbs.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
@ -1195,9 +1199,9 @@ public class BomUploadServiceImpl {
} }
} }
public void insertwpjbbByxcLq(String wpmc,String wpxh,String wpgg,String ch,String username){ public void insertwpjbbByxcLq(String wpmc, String wpxh, String wpgg, String ch, String username) {
String wpid= syService.f_getpjh("SS","SYSTEM","WPH"); String wpid = syService.f_getpjh("SS", "SYSTEM", "WPH");
DmWpjbp wpjbp= new DmWpjbp(); DmWpjbp wpjbp = new DmWpjbp();
wpjbp.setWph(wpid); wpjbp.setWph(wpid);
wpjbp.setWpmc(wpmc); wpjbp.setWpmc(wpmc);
wpjbp.setWpflm("X"); wpjbp.setWpflm("X");
@ -1223,91 +1227,94 @@ public class BomUploadServiceImpl {
return count; return count;
} }
public List<BomVO> insertBom( HttpServletRequest request,String dcch,String dcpl,String type ) 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)
List<DmBom> list = dmBomService.list(new QueryWrapper<DmBom>().eq("sjch", dcch) // .eq(StrUtil.isNotEmpty((String) dcpl), "pl",dcpl)
.eq(StrUtil.isNotEmpty((String) dcpl), "pl",dcpl) // );
); // if(list.size()>0){
if(list.size()>0){ // throw new CustomException(10201, "船号"+dcch+"批量"+dcpl +"已经提交bom数据 不可在此生成");
throw new CustomException(10201, "船号"+dcch+"批量"+dcpl +"已经提交bom数据 不可在此生成"); // }
}
// dmBomService.remove(new QueryWrapper<DmBom>().eq("sjch",dcch).eq("pl",dcpl)); // dmBomService.remove(new QueryWrapper<DmBom>().eq("sjch",dcch).eq("pl",dcpl));
Map querMap= new HashMap(); Map querMap = new HashMap();
querMap.put("dcch",dcch); querMap.put("dcch", dcch);
querMap.put("dcpl",dcpl); querMap.put("dcpl", dcpl);
// querMap.put("delx","B"); // querMap.put("delx","B");
// querMap.put("hxfl","B"); // querMap.put("hxfl","B");
List<DmBclqmxp> bcLQlList = bclqmxpService.getBcLQlList(querMap); List<DmBclqmxp> bcLQlList = bclqmxpService.getBcLQlList(querMap);
List<DmBchxmxp> tltList = bchxmxpService.getTLTList(querMap); List<DmBchxmxp> tltList = bchxmxpService.getTLTList(querMap);
List<DmBchxylp> bcTJlList = bchxylpService.getBcTJlList(querMap); List<DmBchxylp> bcTJlList = bchxylpService.getBcTJlList(querMap);
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");
List<Dm_zhbmp> qgkws = dm_zhbmpRepository.findByBMLB("QGKW"); 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> 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> 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)); Map<String, String> qgKwMap = qgkws.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
List<BomVO> adds =new ArrayList<>(); List<BomVO> adds = new ArrayList<>();
for (int i = 0; i <bcLQlList.size() ; i++) { for (int i = 0; i < bcLQlList.size(); i++) {
BomVO bomVO=new BomVO(); BomVO bomVO = new BomVO();
bomVO.setBclq(bcLQlList.get(i)); bomVO.setBclq(bcLQlList.get(i));
// bomVO.setBclqs(i); // bomVO.setBclqs(i);
adds.add(bomVO); adds.add(bomVO);
bomVO.setCs(1); bomVO.setCs(1);
} }
for (int i = 0; i < bcTJlList.size(); ) {
for (int i = 0; i <bcTJlList.size() ; i++) { if (i == adds.size()) {
if(i==adds.size()){ BomVO bomVO = new BomVO();
BomVO bomVO=new BomVO();
bomVO.setTjb(bcTJlList.get(i)); bomVO.setTjb(bcTJlList.get(i));
bomVO.setCs(2); bomVO.setCs(2);
adds.add(bomVO); adds.add(bomVO);
}else{ i++;
for(BomVO v: adds){ } else {
for (BomVO v : adds) {
v.setTjb(bcTJlList.get(i)); v.setTjb(bcTJlList.get(i));
v.setCs(2); v.setCs(2);
i++;
if (i == bcTJlList.size()) {
break;
}
} }
} }
} }
for (int i = 0; i <tltList.size() ; i++) { for (int i = 0; i < tltList.size(); ) {
if(i==adds.size()){ if (i == adds.size()) {
BomVO bomVO=new BomVO(); BomVO bomVO = new BomVO();
bomVO.setTlt(tltList.get(i)); bomVO.setTlt(tltList.get(i));
bomVO.setCs(3); bomVO.setCs(3);
adds.add(bomVO); adds.add(bomVO);
i++;
}else{ } else {
for(BomVO v: adds){ for (BomVO v : adds) {
v.setTlt(tltList.get(i)); v.setTlt(tltList.get(i));
v.setCs(3); v.setCs(3);
i++;
if (i == tltList.size()) {
break;
}
} }
} }
} }
System.out.println(" = " +"tlt over" ); System.out.println(" = " + "tlt over");
if(type.equals("01")){ if (type.equals("01")) {
List<DmWlqd> ljbList = wlqdService.getLJQDList(querMap); List<DmWlqd> ljbList = wlqdService.getLJQDList(querMap);
for (int i = 0; i <ljbList.size() ; i++) { for (int i = 0; i < ljbList.size(); ) {
if(i==adds.size()){ if (i == adds.size()) {
BomVO bomVO=new BomVO(); BomVO bomVO = new BomVO();
bomVO.setLjb(ljbList.get(i)); bomVO.setLjb(ljbList.get(i));
bomVO.setCs(4); bomVO.setCs(4);
adds.add(bomVO); adds.add(bomVO);
i++;
}else{ } else {
for(BomVO v: adds){ for (BomVO v : adds) {
v.setLjb(ljbList.get(i)); v.setLjb(ljbList.get(i));
v.setCs(4); v.setCs(4);
i++;
if (i == ljbList.size()) {
break;
}
} }
} }
} }
} }
// tltList.forEach(e->{ // tltList.forEach(e->{
// if(StringUtils.isNotBlank(e.getWpggZ())){ // if(StringUtils.isNotBlank(e.getWpggZ())){
// //
@ -1365,106 +1372,97 @@ public class BomUploadServiceImpl {
// dmBomService.insertBoms(adds); // dmBomService.insertBoms(adds);
return 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) public List<DmBom> saveBom(HttpServletRequest request, List<BomVO> list, String czbh, String pl, Integer cs1) throws CustomException {
// .eq(StrUtil.isNotEmpty((String) dcpl), "pl",dcpl) if (StringUtils.isNotBlank(czbh) && StringUtils.isNotBlank(pl)) {
// ); List<DmBom> oloList = dmBomService.list(new QueryWrapper<DmBom>().eq("dcch", czbh)
// if(list.size()>0){ .eq("pl", pl)
// throw new CustomException(10201, "船号"+dcch+"批量"+dcpl +"已经提交bom数据 不可在此生成"); );
// } if (oloList.size() > 0) {
//// dmBomService.remove(new QueryWrapper<DmBom>().eq("sjch",dcch).eq("pl",dcpl)); dmBomService.remove(new QueryWrapper<DmBom>().eq("dcch", czbh).eq("pl", pl));
}
}
// Map querMap= new HashMap(); // Map querMap= new HashMap();
// querMap.put("dcch",dcch); // querMap.put("dcch",dcch);
// querMap.put("dcpl",dcpl); // querMap.put("dcpl",dcpl);
// querMap.put("delx","B"); // querMap.put("delx","B");
// querMap.put("hxfl","B"); // querMap.put("hxfl","B");
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");
List<Dm_zhbmp> qgkws = dm_zhbmpRepository.findByBMLB("QGKW"); 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> 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> 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)); Map<String, String> qgKwMap = qgkws.stream().collect(Collectors.toMap(Dm_zhbmp::getBmsm, Dm_zhbmp::getBM));
List<DmBom> adds =new ArrayList<>(); List<DmBom> adds = new ArrayList<>();
int cs = list.get(0).getCs();
int cs= list.get(0).getCs(); if (2 == cs) {
if(2==cs){
ArrayList<BomVO> collect = list.stream().collect( ArrayList<BomVO> collect = list.stream().collect(
Collectors.collectingAndThen( Collectors.collectingAndThen(
Collectors.toCollection( Collectors.toCollection(
() -> new TreeSet<>( () -> new TreeSet<>(
Comparator.comparing( Comparator.comparing(
tc -> tc.getTjb().getWpgg() + ";" + tc.getTjb().getWpxh() + ";" + tc.getTjb().getTzbh() ))), ArrayList::new)); tc -> tc.getTjb().getWpgg() + ";" + tc.getTjb().getWpxh() + ";" + tc.getTjb().getTzbh()))), ArrayList::new));
collect.forEach(i->{ collect.forEach(i -> {
DmBchxylp e =i.getTjb(); DmBchxylp e = i.getTjb();
if(StringUtils.isNotBlank(e.getWpgg())){ if (StringUtils.isNotBlank(e.getWpgg())) {
DmBom dmBom = new DmBom();
DmBom dmBom=new DmBom();
dmBom.setCs(2); dmBom.setCs(2);
// dmBom.setQgcd(e.getYlzd4Z()); // dmBom.setQgcd(e.getYlzd4Z());
//dmBom.setHxcd(e.getHxcdZ()); //dmBom.setHxcd(e.getHxcdZ());
dmBom.setTzbh(e.getTzbh()); dmBom.setTzbh(e.getTzbh());
// dmBom.setTlsl(e.getSl()); // dmBom.setTlsl(e.getSl());
//dmBom.setLjbh(e.getWph()); //dmBom.setLjbh(e.getWph());
//dmBom.setLjsl(e.getLjslZ()); //dmBom.setLjsl(e.getLjslZ());
dmBom.setDcch(e.getDcCh()); dmBom.setDcch(e.getDcCh());
dmBom.setPl(e.getDcPl()); dmBom.setPl(e.getDcPl());
//dmBom.setFd(e.getWph().substring(0,4)); //dmBom.setFd(e.getWph().substring(0,4));
dmBom.setSjch(e.getDcCh());
dmBom.setWpcz(e.getWpxh()); dmBom.setWpcz(e.getWpxh());
dmBom.setWpgg(e.getWpgg()); dmBom.setWpgg(e.getWpgg());
System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpgg().split("\\*")[0]); System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpgg().split("\\*")[0]);
System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpgg()); System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpgg());
dmBom.setBh( new BigDecimal(e.getWpgg().split("\\*")[0])); dmBom.setBh(new BigDecimal(e.getWpgg().split("\\*")[0]));
dmBom.setBc(new BigDecimal(e.getWpgg().split("\\*")[2])); dmBom.setBc(new BigDecimal(e.getWpgg().split("\\*")[2]));
String tzbh=e.getTzbh(); String tzbh = e.getTzbh();
String hxlx=""; String hxlx = "";
// 根据图纸编号获取 手工,数控 跨位,组立,、 // 根据图纸编号获取 手工,数控 跨位,组立,、
if(tzbh.substring(4,5).equals("S")){ if (tzbh.substring(4, 5).equals("S")) {
hxlx = "1030"; hxlx = "1030";
}else if(tzbh.substring(4,5).equals("N")){ } else if (tzbh.substring(4, 5).equals("N")) {
hxlx = "1020"; hxlx = "1020";
} }
// 跨位 // 跨位
String s = kwxxMap.get(tzbh.substring(4,7)); String s = kwxxMap.get(tzbh.substring(4, 7));
String zl = this.getZL(tzbh); String zl = this.getZL(tzbh);
String zlbm = zllbMap.get(zl); String zlbm = zllbMap.get(zl);
String zzcj = qgKwMap.get(s); String zzcj = qgKwMap.get(s);
dmBom.setZl(zlbm); dmBom.setZl(zlbm);
dmBom.setKw(zzcj); dmBom.setKw(zzcj);
dmBom.setLqlb(hxlx); dmBom.setLqlb(hxlx);
// 领取表找打 fds // 领取表找打 fds
if(e.getHxfl().equals("B")){ if (e.getHxfl().equals("B")) {
List<BomVO> collect11 = list.stream().filter(fst -> fst.getBclq().getWpgg().equals(e.getWpgg()) && List<BomVO> collect11 = list.stream().filter(fst -> fst.getBclq().getWpgg().equals(e.getWpgg()) &&
fst.getBclq().getWpxh().equals(e.getWpxh()) fst.getBclq().getWpxh().equals(e.getWpxh())
).collect(Collectors.toList()); ).collect(Collectors.toList());
if(collect11.size()>0){ if (collect11.size() > 0) {
dmBom.setFds(collect11.get(0).getBclq().getDcFdZ()); dmBom.setFds(collect11.get(0).getBclq().getDcFdZ());
} }
}else{ } else {
List<BomVO> collect11 = list.stream().filter(fst -> fst.getBclq().getWpxh().equals(e.getWpgg()) && List<BomVO> collect11 = list.stream().filter(fst -> fst.getBclq().getWpxh().equals(e.getWpgg()) &&
fst.getBclq().getWpgg().equals(e.getWpxh()) fst.getBclq().getWpgg().equals(e.getWpxh())
).collect(Collectors.toList()); ).collect(Collectors.toList());
if(collect11.size()>0){ if (collect11.size() > 0) {
dmBom.setFds(collect11.get(0).getBclq().getDcFdZ()); dmBom.setFds(collect11.get(0).getBclq().getDcFdZ());
} }
} }
adds.add(dmBom); adds.add(dmBom);
} }
}); });
} else {
}else { list.forEach(i -> {
list.forEach(i->{ DmBchxmxp e = i.getTlt();
DmBchxmxp e =i.getTlt(); if (StringUtils.isNotBlank(e.getWpggZ())) {
if(StringUtils.isNotBlank(e.getWpggZ())){ DmBom dmBom = new DmBom();
DmBom dmBom=new DmBom();
dmBom.setCs(3); dmBom.setCs(3);
dmBom.setQgcd(e.getYlzd4Z()); dmBom.setQgcd(e.getYlzd4Z());
dmBom.setHxcd(e.getHxcdZ()); dmBom.setHxcd(e.getHxcdZ());
@ -1474,29 +1472,26 @@ public class BomUploadServiceImpl {
dmBom.setLjsl(e.getLjslZ()); dmBom.setLjsl(e.getLjslZ());
dmBom.setDcch(e.getDcChZ()); dmBom.setDcch(e.getDcChZ());
dmBom.setPl(e.getDcPlZ()); dmBom.setPl(e.getDcPlZ());
dmBom.setFd(e.getWph().substring(0,4)); dmBom.setFd(e.getWph().substring(0, 4));
dmBom.setSjch(e.getDcChZ());
dmBom.setWpcz(e.getWpxhZ()); dmBom.setWpcz(e.getWpxhZ());
dmBom.setWpgg(e.getWpggZ()); dmBom.setWpgg(e.getWpggZ());
System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ().split("\\*")[0]); System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ().split("\\*")[0]);
System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ()); System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ());
dmBom.setBh( new BigDecimal(e.getWpggZ().split("\\*")[0])); dmBom.setBh(new BigDecimal(e.getWpggZ().split("\\*")[0]));
dmBom.setBc(new BigDecimal(e.getWpggZ().split("\\*")[2])); dmBom.setBc(new BigDecimal(e.getWpggZ().split("\\*")[2]));
String tzbh=e.getTzbhZ(); String tzbh = e.getTzbhZ();
String hxlx=""; String hxlx = "";
// 根据图纸编号获取 手工,数控 跨位,组立,、 // 根据图纸编号获取 手工,数控 跨位,组立,、
if(tzbh.substring(4,5).equals("S")){ if (tzbh.substring(4, 5).equals("S")) {
hxlx = "1030"; hxlx = "1030";
}else if(tzbh.substring(4,5).equals("N")){ } else if (tzbh.substring(4, 5).equals("N")) {
hxlx = "1020"; hxlx = "1020";
} }
// 跨位 // 跨位
System.out.println("tzbh = " + tzbh); System.out.println("tzbh = " + tzbh);
String s = kwxxMap.get(tzbh.substring(4,7)); String s = kwxxMap.get(tzbh.substring(4, 7));
String zl = this.getZL(tzbh); String zl = this.getZL(tzbh);
String zlbm = zllbMap.get(zl); String zlbm = zllbMap.get(zl);
String zzcj = qgKwMap.get(s); String zzcj = qgKwMap.get(s);
dmBom.setZl(zlbm); dmBom.setZl(zlbm);
@ -1506,44 +1501,34 @@ public class BomUploadServiceImpl {
adds.add(dmBom); adds.add(dmBom);
} }
}); });
} }
dmBomService.insertBoms(adds); dmBomService.insertBoms(adds);
return adds; return adds;
} }
// 根据套料图号得到组立信息。 // 根据套料图号得到组立信息。
public String getZL(String tzbh){ public String getZL(String tzbh) {
String bh=tzbh.substring(6,8); String bh = tzbh.substring(6, 8);
if (tzbh.substring(4,5).equals("X")) { if (tzbh.substring(4, 5).equals("X")) {
if("XX".equalsIgnoreCase(bh)){ if ("XX".equalsIgnoreCase(bh)) {
return "小组立"; return "小组立";
}else if ("XD".equalsIgnoreCase(bh)){ } else if ("XD".equalsIgnoreCase(bh)) {
return "中大组立"; return "中大组立";
} }
}else{ } else {
if("XX".equalsIgnoreCase(bh)){ if ("XX".equalsIgnoreCase(bh)) {
return "焊接机器人肘板"; return "焊接机器人肘板";
}else if ("GX".equalsIgnoreCase(bh)){ } else if ("GX".equalsIgnoreCase(bh)) {
return "光电"; return "光电";
} }
} }
String bh1=tzbh.substring(7,8); String bh1 = tzbh.substring(7, 8);
if("X".equalsIgnoreCase(bh1)){ if ("X".equalsIgnoreCase(bh1)) {
return"小组立"; return "小组立";
} }
if("D".equalsIgnoreCase(bh1)){ if ("D".equalsIgnoreCase(bh1)) {
return"中大组立"; return "中大组立";
} }
return ""; return "";
} }
} }

@ -80,11 +80,11 @@ public class DmBomServiceImpl extends ServiceImpl<DmBomMapper, DmBom> implements
@Override @Override
public void insertBoms(List<DmBom> map) throws CustomException { public void insertBoms(List<DmBom> map) throws CustomException {
// dmBomMapper.insertBoms(map); // dmBomMapper.insertBoms(map);
this.saveBatch(map,1000);
List<List<DmBom>> partition = ListUtil.partition(map, 50); // List<List<DmBom>> partition = ListUtil.partition(map, 50);
for (List<DmBom> users : partition) { // for (List<DmBom> users : partition) {
dmBomMapper.insertBoms(users); // dmBomMapper.insertBoms(users);
} // }
// map.forEach(e->{ // map.forEach(e->{
// if(StringUtils.isBlank(e.getZt())){ // if(StringUtils.isBlank(e.getZt())){
@ -95,4 +95,18 @@ public class DmBomServiceImpl extends ServiceImpl<DmBomMapper, DmBom> implements
// }); // });
} }
@Override
public void copyListBom(HttpServletRequest req, Map map) {
String czbh=(String) map.get("czbh");
String sjch=(String) map.get("sjch");
List<DmBom> list= this.list(new QueryWrapper<DmBom>().eq("dcch",sjch));
list.forEach(e->{
e.setMbch(e.getDcch());
e.setDcch(czbh);
e.setSjch("");
});
//this.saveBatch()
}
} }

@ -101,9 +101,9 @@
DM_BCLQJBP.lqzl as lqzlZ, DM_BCLQJBP.lqzl as lqzlZ,
DM_BCLQJBP.shzl as shzlZ, DM_BCLQJBP.shzl as shzlZ,
DM_BCLQJBP.ylzl as ylzlZ DM_BCLQJBP.ylzl as ylzlZ
FROM DM_BCLQMXP,DM_WPJBP,DM_BCLQJBP FROM DM_BCLQJBP,DM_BCLQMXP left join DM_WPJBP on DM_BCLQMXP.WPH = DM_WPJBP.WPH
WHERE DM_BCLQMXP.WPH *= DM_WPJBP.WPH WHERE
AND DM_BCLQMXP.LQBH = DM_BCLQJBP.LQBH DM_BCLQMXP.LQBH = DM_BCLQJBP.LQBH
<if test=" dcpl!=null and dcpl!=''"> <if test=" dcpl!=null and dcpl!=''">
and DM_BCLQJBP.dc_pl=#{dcpl} and DM_BCLQJBP.dc_pl=#{dcpl}
</if> </if>

Loading…
Cancel
Save