master
xhj 2 years ago
parent 09407e3d5e
commit a5e0502127

@ -246,7 +246,7 @@ public class DmBchxmxp implements Serializable {
@TableField("YLZD5")
private Double ylzd5;
private int drcs;
private Integer drcs;
}

@ -190,5 +190,9 @@ public class DmBom implements Serializable {
private String tjbs;
private String zt;
private Integer cs;
}

@ -233,7 +233,7 @@ public class DmWlqd implements Serializable {
@TableField("LCM4")
private String lcm4;
private int drcs;
private Integer drcs;
@TableField(exist = false)

@ -0,0 +1,29 @@
package com.dsic.gj_erp.bean.jcsj.vo;
import com.dsic.gj_erp.bean.jcsj.DmBchxmxp;
import com.dsic.gj_erp.bean.jcsj.DmBchxylp;
import com.dsic.gj_erp.bean.jcsj.DmBclqmxp;
import com.dsic.gj_erp.bean.jcsj.DmWlqd;
import lombok.Data;
/**
* BomVO:
*
* @author xhj
* @date 2023/10/06
*/
@Data
public class BomVO {
private DmBclqmxp bclq;
private DmBchxmxp tlt;
private DmBchxylp tjb;
private DmWlqd ljb;
private Integer bclqs;
private Integer tlts;
private Integer tjbs;
private Integer cs;
}

@ -17,7 +17,7 @@ import java.io.Serializable;
@IdClass(Dm_zhbmp.PrimaryKey.class)
public class Dm_zhbmp {
@Id
private String BMLB;
@Id
private String BM;
@ -64,7 +64,7 @@ public class Dm_zhbmp {
@Data
public static class PrimaryKey implements Serializable {
private String BMLB;
private String BM;
}

@ -28,8 +28,8 @@ public class BomUploadController {
@PostMapping("/uploadBom")
@AuthFunction
@ResponseBody
public ResultBean uploadPl(@RequestParam("file") MultipartFile[] file , String czbh, String isupload, HttpServletRequest req) throws Exception, CustomException {
return bomUploadService.uploadZ( file , czbh, isupload, req);
public ResultBean uploadPl(@RequestParam("file") MultipartFile[] file , String czbh,String pl, String isupload, HttpServletRequest req) throws Exception, CustomException {
return bomUploadService.uploadZ( file , czbh, pl,isupload, req);
}

@ -3,6 +3,7 @@ package com.dsic.gj_erp.controller.jcsj;
import com.dsic.gj_erp.annotation.AuthFunction;
import com.dsic.gj_erp.bean.ResultBean;
import com.dsic.gj_erp.bean.jcsj.DmBom;
import com.dsic.gj_erp.bean.jcsj.vo.BomVO;
import com.dsic.gj_erp.exception.CustomException;
import com.dsic.gj_erp.service.jcsj.DmBomService;
import com.dsic.gj_erp.service.jcsj.impl.BomUploadServiceImpl;
@ -36,22 +37,27 @@ public class DmBomController {
@PostMapping("/getListBom")
public ResultBean getListBom(HttpServletRequest req, @RequestBody Map map) throws CustomException {
List<DmBom> listBom = dmBomService.getListBom(map);
List<BomVO> listBom = dmBomService.getListBom(req,map);
return new ResultBean(listBom);
}
@PostMapping("/getListBomRealy")
public ResultBean getListBomRealy(HttpServletRequest req, @RequestBody Map map) throws CustomException {
List<DmBom> listBom = dmBomService.getListBomRealy(req,map);
return new ResultBean(listBom);
}
@PostMapping("/addListBom")
@AuthFunction
public ResultBean addListBom(HttpServletRequest req, @RequestBody Map map) throws CustomException {
List<DmBom> dmBoms = bomUploadService.insertBom(req,(String) map.get("dcch"), (String) map.get("dcpl"));
List<BomVO> dmBoms = bomUploadService.insertBom(req,(String) map.get("dcch"), (String) map.get("dcpl"),"02");
// dmBomService.insertBoms(dmBoms);
return new ResultBean(dmBoms);
}
@PostMapping("/saveListBom")
public ResultBean saveListBom(HttpServletRequest req, @RequestBody List<DmBom> list) throws CustomException {
dmBomService.insertBoms(list);
public ResultBean saveListBom(HttpServletRequest req, @RequestBody List<BomVO> list) throws CustomException {
bomUploadService.saveBom(req,list);
//
return new ResultBean();
// return null;

@ -19,6 +19,8 @@ public interface Dm_zhbmpRepository extends JpaRepository<Dm_zhbmp,Dm_zhbmp.Prim
List<Map> findBMBM();
List<Dm_zhbmp> findByBMLB(String bmlb);
@Query(nativeQuery = true,value = "select bm,bmsm as bm from dm_zhbmp where bmlb = 'ZLLB'")
List<Dm_zhbmp> findByBMLBaa();
Dm_zhbmp findByBMLBAndBM(String bmlb,String bm);
Dm_zhbmp findByBMLBAndBmsm(String bmlb,String bmsm);
@Query(nativeQuery = true,value = "select bm as dwbm,bmsm as dwmc from dm_zhbmp where BMLB='BMBM' and (left(bm,3)='023' ) and isnull(ylzd3,'N')='D'")

@ -2,8 +2,10 @@ package com.dsic.gj_erp.service.jcsj;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dsic.gj_erp.bean.jcsj.DmBom;
import com.dsic.gj_erp.bean.jcsj.vo.BomVO;
import com.dsic.gj_erp.exception.CustomException;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@ -18,7 +20,8 @@ import java.util.Map;
public interface DmBomService extends IService<DmBom> {
List<DmBom>getListBom(Map map) throws CustomException;
List<BomVO>getListBom(HttpServletRequest req, Map map) throws CustomException;
List<DmBom>getListBomRealy(HttpServletRequest req, Map map) throws CustomException;
void insertBoms(List<DmBom> map) throws CustomException;
}

@ -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);

@ -4,12 +4,15 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsic.gj_erp.bean.jcsj.DmBom;
import com.dsic.gj_erp.bean.jcsj.vo.BomVO;
import com.dsic.gj_erp.exception.CustomException;
import com.dsic.gj_erp.mapper.jcsj.DmBomMapper;
import com.dsic.gj_erp.service.jcsj.DmBomService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@ -26,24 +29,61 @@ public class DmBomServiceImpl extends ServiceImpl<DmBomMapper, DmBom> implements
@Autowired
BomUploadServiceImpl bomUploadService;
@Autowired
DmBomMapper dmBomMapper;
@Override
public List<DmBom> getListBom(Map map) throws CustomException {
List<DmBom> list = this.list(new QueryWrapper<DmBom>().eq("sjch", map.get("dcch"))
.eq(StrUtil.isNotEmpty((String) map.get("fd")), "fd", map.get("dcfd"))
.eq(StrUtil.isNotEmpty((String) map.get("pl")), "fd", map.get("dcpl"))
);
public List<BomVO> getListBom(HttpServletRequest req,Map map) throws CustomException {
// if(map.get("zt").equals("01")){
List<BomVO> dmBoms = bomUploadService.insertBom(req, (String) map.get("dcch"), (String) map.get("dcpl"),"02");
return dmBoms;
// return dmBoms;
// }else{
// List<DmBom> list = this.list(new QueryWrapper<DmBom>().eq("sjch", map.get("dcch"))
// .eq(StrUtil.isNotEmpty((String) map.get("fd")), "fd", map.get("dcfd"))
// .eq(StrUtil.isNotEmpty((String) map.get("pl")), "fd", map.get("dcpl"))
// .eq(StrUtil.isNotEmpty((String) map.get("zt")), "zt", map.get("zt"))
// );
// return list;
// }
if(list.size()<=0){
// if(list.size()<=0){
//
// throw new CustomException(10105, "改bom尚未提交 请点击生成bom 查看数据");
// }
}
public List<DmBom> getListBomRealy(HttpServletRequest req,Map map) throws CustomException {
// return dmBoms;
// }else{
List<DmBom> list = this.list(new QueryWrapper<DmBom>().eq("dcch", map.get("dcch"))
.eq(StrUtil.isNotEmpty((String) map.get("fd")), "fd", map.get("dcfd"))
.eq(StrUtil.isNotEmpty((String) map.get("pl")), "fd", map.get("dcpl"))
.eq(StrUtil.isNotEmpty((String) map.get("zt")), "zt", map.get("zt"))
);
return list;
// }
// if(list.size()<=0){
//
// throw new CustomException(10105, "改bom尚未提交 请点击生成bom 查看数据");
// }
throw new CustomException(10105, "为老系统数据 请点击生成Bom");
}
return list;
}
@Override
public void insertBoms(List<DmBom> map) throws CustomException {
map.forEach(e->{
baseMapper.insertBom(e);
if(StringUtils.isBlank(e.getZt())){
e.setZt("02");
dmBomMapper.insertBom(e);
}
});
}

@ -153,7 +153,7 @@
,fkhxgs,fkqggs,fkpkgs
,fkqgs,fkdmgs,fkzpgs
,type,fds
,hxcd,lqbs,tjBs
,hxcd,lqbs,tjBs,zt,cs
)
values (#{pid,jdbcType=INTEGER},#{dcch,jdbcType=VARCHAR},#{mbch,jdbcType=VARCHAR}
@ -174,7 +174,7 @@
,#{fkhxgs,jdbcType=DECIMAL},#{fkqggs,jdbcType=DECIMAL},#{fkpkgs,jdbcType=DECIMAL}
,#{fkqgs,jdbcType=DECIMAL},#{fkdmgs,jdbcType=DECIMAL},#{fkzpgs,jdbcType=DECIMAL}
,#{type,jdbcType=VARCHAR},#{fds,jdbcType=VARCHAR}
,#{hxcd,jdbcType=DECIMAL},#{lqbs,jdbcType=VARCHAR},#{tjbs,jdbcType=VARCHAR}
,#{hxcd,jdbcType=DECIMAL},#{lqbs,jdbcType=VARCHAR},#{tjbs,jdbcType=VARCHAR},#{zt,jdbcType=VARCHAR},#{cs,jdbcType=INTEGER}
)
</insert>

Loading…
Cancel
Save