1.将套料图PDF文件上传功能合并到导入基础数据功能

2.导入基础数据的同时保存源文件到服务器,同时保存文件上传路径到数据库upload_file表
3.班组信息管理,班组人员查询
master
xiaoning 11 months ago
parent 971e71b59b
commit aaa8af3a81

@ -0,0 +1,56 @@
package com.dsic.gj_erp.bean.jcsj;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author xn
* @since 2024-06-04
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="DmBzry对象", description="")
public class DmBzry implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(value = "人员编码")
private String userCode;
@ApiModelProperty(value = "人员姓名")
private String userName;
@ApiModelProperty(value = "是否资源")
private String resource;
@ApiModelProperty(value = "班组长")
private String foreman;
@ApiModelProperty(value = "所属资源组")
private String resourcesCode;
@ApiModelProperty(value = "人员职务")
private String position;
@ApiModelProperty(value = "人员属性")
private String attribute;
@ApiModelProperty(value = "状态")
private String flagStatus;
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
}

@ -0,0 +1,52 @@
package com.dsic.gj_erp.bean.jcsj;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author xn
* @since 2024-05-30
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="DmBzzz对象", description="")
public class DmBzzz implements Serializable {
private static final long serialVersionUID=1L;
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
private String resourcesCode;//班组编码
private String resourcesName;//班组名称
private String resourcesType;//组织类型
private String factoryId;
private String factoryCode;
private String factoryName;//所属工厂
private String workshopId;
private String workshopCode;
private String workshopName;//所属车间
private String productionLineId;
private String productionLineCode;
private String productionLineName;//所属产线
private String companyId;
private String companyCode;
private String companyName;//所属公司
private String createDate;//创建时间
private String updateDate;//修改时间
private String flagStatus;//状态
private String resource;//是否资源
private String classification;//班组分类
private String comparisonCode;//外部对照码
}

@ -50,5 +50,9 @@ public class DmTltpdf implements Serializable {
@ApiModelProperty(value = "保存路径")
private String filePath;
private Double hxcd;
private Double qgcd;
private Double hxkc;
private Double qgkc;
}

@ -1,14 +1,29 @@
package com.dsic.gj_erp.controller.jcsj;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
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.DmTltpdf;
import com.dsic.gj_erp.exception.CustomException;
import com.dsic.gj_erp.mapper.jcsj.DmBomMapper;
import com.dsic.gj_erp.service.jcsj.DmBomService;
import com.dsic.gj_erp.service.jcsj.DmTltpdfService;
import com.dsic.gj_erp.service.jcsj.impl.BomUploadServiceImpl;
import io.swagger.annotations.Authorization;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.text.PDFTextStripper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
@ -23,18 +38,192 @@ import javax.servlet.http.HttpServletRequest;
public class BomUploadController {
@Autowired
BomUploadServiceImpl bomUploadService;
@Autowired
DmBomService dmBomService;
@Autowired
DmBomMapper bomMapper;
@Autowired
DmTltpdfService tltpdfService;
@PostMapping("/uploadBom")
@AuthFunction
@ResponseBody
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);
public ResultBean uploadPl(@RequestParam("file") MultipartFile[] file ,@RequestParam("tltList") MultipartFile[] tltList , String czbh,String pl, String isupload, HttpServletRequest req) throws Exception, CustomException {
String date=DateUtil.date().toString("yyyyMMdd");
String path="/"+czbh+"_"+pl+"/"+date+"/ERP";
ResultBean bean= bomUploadService.uploadZ( file , czbh, pl,isupload, req,path);
uploadPDF(tltList, czbh, pl,date);
return bean;
}
@Transactional
public ResultBean uploadPDF(MultipartFile[] fileList, String dcCh,String pl,String date)throws IOException {
}
for (MultipartFile file : fileList) {//船号_批量/日期/PDFERP
String url= com.dsic.gj_erp.util.FileUtil.handlerUpload(file,"/"+dcCh+"_"+pl+"/"+date+"/PDF");
PDDocument document = PDDocument.load(file.getInputStream());
int pageNum = document.getNumberOfPages();
PDFTextStripper stripper = new PDFTextStripper();
// stripper .setSortByPosition(true); //设置为true 则按照行进行读取默认是false
// // 3、获取指定页面的文本内容
// stripper.setStartPage(1);// 设置起始页面,表示读取第一个页面
// stripper.setEndPage(1); // 设置结束页面,表示读取第一个页面
// String[] text = stripper.getText(document).split("\r\n");
// String dcCh=text[46];
// String pl=text[38].substring(1,4);
// String th=text[29];
stripper.setStartPage(2);// 设置起始页面,表示读取第一个页面
stripper.setEndPage(2); // 设置结束页面,表示读取第一个页面
String[] text = stripper.getText(document).split("序号零件编号")[1].split(" ");
// String dcCh=text[2].split("\r\n")[1];
// String pl=text[3];
String th=text[6].substring(0,12);
//删除导入过的同船、批量、图号的数据,
tltpdfService.remove(new QueryWrapper<DmTltpdf>()
.eq("dc_ch",dcCh)
.eq("pl",pl)
.eq("th",th)
);
List<DmTltpdf> list=new ArrayList<>();
for (int i = 1; i <= pageNum; i++) {
stripper.setStartPage(i);
stripper.setEndPage(i);
String s = stripper.getText(document);//本页文字内容
String[] a=s.split("\r\n");//分行
String tlth="";
Double hxcd=0.0;
Double qgcd=0.0;
Double hxkc=0.0;
Double qgkc=0.0;
if (i>1){
tlth=s.split("序号零件编号")[1].split(" ")[5];
String num[]=s.split("序号零件编号")[1].split("\r\n");
hxcd=new Double(num[2]);
qgcd=new Double(num[3]);
hxkc=new Double(num[4]);
qgkc=new Double(num[5]);
}
// System.out.println("第 " + i +"/"+pageNum+ " 页 :" );
//按页保存
DmTltpdf tltpdf=new DmTltpdf();
tltpdf.setDcCh(dcCh);
tltpdf.setTh(th);
tltpdf.setPl(pl);
tltpdf.setTlth(tlth);
tltpdf.setPageNum(i +"/"+pageNum);
tltpdf.setContent(s);
tltpdf.setFilePath(url);
tltpdf.setHxcd(hxcd);
tltpdf.setQgcd(qgcd);
tltpdf.setHxkc(hxkc);
tltpdf.setQgkc(qgkc);
list.add(tltpdf);
//按行保存
// for (int j=0;j<a.length;j++){
// DmTltpdf tltpdf=new DmTltpdf();
// tltpdf.setDcCh(dcCh);
// tltpdf.setTh(th);
// tltpdf.setPl(pl);
// tltpdf.setTlth(tlth);
// tltpdf.setPageNum(i +"/"+pageNum);
// tltpdf.setRows((j+1) +"/"+a.length);
// tltpdf.setContent(a[j]);
// tltpdf.setFilePath(url);
// tltpdf.setHxcd(hxcd);
// tltpdf.setQgcd(qgcd);
// tltpdf.setHxkc(hxkc);
// tltpdf.setQgkc(qgkc);
// list.add(tltpdf);
// System.out.println("第 " + (j+1) +"/"+a.length+ " 行 :");
// System.out.println(a[j]);
// }
if (i==1)continue;
String tlth1[]=s.split("DNV\\+CCS")[1].split("\r\n");
Double ljzl=new Double(tlth1[1]);
if (ljzl==0.0)continue;
//根据当前页数据修改BOM中零件属性 坡口 打磨 曲
int ljCount= s.split("\\|")[0].split("\r\n").length;//零件数量
if (ljCount==11||ljCount==21||ljCount==31){
//取用下标count-1 至 count*2-2的数组为属性
String[] sxArray=getArrayByIndex(a,ljCount-1,ljCount*2-2);
//取用下标count*2-2 至 count*3-3 的数组,为零件号
String[] ljArray=getArrayByIndex(a,ljCount*2-2,ljCount*3-3);
System.out.println(ljCount);
System.out.println(i);
for (int j = 0; j < ljArray.length; j++) {
String ljbh;//零件号
String sx;//属性
if (i==0){
String[] b= ljArray[j].split("0\\|");
ljbh=b[b.length-1];
sx=sxArray[j].split("\\|")[4];
}else {
ljbh=ljArray[j];
sx=sxArray[j].split("\\|")[4];
}
updateBom(sx,dcCh,pl,tlth,ljbh);
}
}else if (ljCount==1){
//"1,11,21,31"
String[] ljxx= a[0].split("\\|");
String ljbh= ljxx[ljxx.length-1];//零件号
String sx= ljxx[4];//属性
updateBom(sx,dcCh,pl,tlth,ljbh);
}else {
//取用下标count 至 count*2-1的数组为属性
String[] sxArray=getArrayByIndex(a,ljCount,ljCount*2-1);
//取用下标count*2 至 count*3-1 的数组,为零件号
String[] ljArray=getArrayByIndex(a,ljCount*2,ljCount*3-1);
for (int j = 0; j < ljArray.length; j++) {
String ljbh=ljArray[j];//零件号
String sx=sxArray[j].split("\\|")[4];//属性
updateBom(sx,dcCh,pl,tlth,ljbh);
}
}
}
tltpdfService.saveBatch(list);
document.close();
}
return new ResultBean();
}
public String[] getArrayByIndex(String[] oldArray,int startIndex,int endIndex){
int newArraylen=endIndex-startIndex+1;
String[] array=new String[newArraylen];
for (int i = 0; i < newArraylen; i++) {
array[i]=oldArray[i+startIndex];
}
return array;
}
public void updateBom(String sx,String dcCh,String pl,String tlth,String ljbh){
// 坡口K/Y 曲工序D/Q 打磨E/F/G/H
if ("K,Y".indexOf(sx)>-1){
dmBomService.update(new UpdateWrapper<DmBom>().set("pkbs","Y")
.eq("dcch",dcCh)
.eq("pl",pl)
.eq("tzbh",tlth)
.eq("ljbh",ljbh)
);
}
if ("D,Q".indexOf(sx)>-1){
dmBomService.update(new UpdateWrapper<DmBom>().set("qbs","Y")
.eq("dcch",dcCh)
.eq("pl",pl)
.eq("tzbh",tlth)
.eq("ljbh",ljbh)
);
}
if ("E,F,G,H".indexOf(sx)>-1){
dmBomService.update(new UpdateWrapper<DmBom>().set("dmbs","Y")
.eq("dcch",dcCh)
.eq("pl",pl)
.eq("tzbh",tlth)
.eq("ljbh",ljbh)
);
}
}
}

@ -53,8 +53,7 @@ public class DmBomController {
BomUploadServiceImpl bomUploadService;
@Autowired
SYService syService;
@Autowired
DmTltpdfService tltpdfService;
@PostMapping("/saveDegs")
@AuthFunction
@ -68,137 +67,7 @@ public class DmBomController {
}
return new ResultBean();
}
@PostMapping("/uploadPDF")
@Authorization("")
@Transactional
@ResponseBody
public ResultBean uploadPDF(@RequestParam("file") MultipartFile[] fileList)throws IOException {
for (MultipartFile file : fileList) {
String url= FileUtil.handlerUpload(file,"/tltpdf");
PDDocument document = PDDocument.load(file.getInputStream());
int pageNum = document.getNumberOfPages();
PDFTextStripper stripper = new PDFTextStripper();
// stripper .setSortByPosition(true); //设置为true 则按照行进行读取默认是false
// // 3、获取指定页面的文本内容
stripper.setStartPage(1);// 设置起始页面这里设置成2就表示读取第一个页面
stripper.setEndPage(1); // 设置结束页面这里设置成2就表示读取第一个页面
String[] text = stripper.getText(document).split("\r\n");
String dcCh=text[46];
String pl=text[38].substring(1,4);
String th=text[29];
//删除导入过的同船、批量、图号的数据,
tltpdfService.remove(new QueryWrapper<DmTltpdf>()
.eq("dc_ch",dcCh)
.eq("pl",pl)
.eq("th",th)
);
List<DmTltpdf> list=new ArrayList<>();
for (int i = 1; i <= pageNum; i++) {
stripper.setStartPage(i);
stripper.setEndPage(i);
String s = stripper.getText(document);//本页文字内容
String[] a=s.split("\r\n");//分行
String tlth=i>1?s.split("序号零件编号")[1].split(" ")[5]:"";
// System.out.println("第 " + i +"/"+pageNum+ " 页 :" );
for (int j=0;j<a.length;j++){
DmTltpdf tltpdf=new DmTltpdf();
tltpdf.setDcCh(dcCh);
tltpdf.setTh(th);
tltpdf.setPl(pl);
tltpdf.setTlth(tlth);
tltpdf.setPageNum(i +"/"+pageNum);
tltpdf.setRows((j+1) +"/"+a.length);
tltpdf.setContent(a[j]);
tltpdf.setFilePath(url);
list.add(tltpdf);
// System.out.println("第 " + (j+1) +"/"+a.length+ " 行 :");
// System.out.println(a[j]);
}
if (i==1)continue;
//根据当前页数据修改BOM中零件属性 坡口 打磨 曲
int ljCount= s.split("\\|")[0].split("\r\n").length;//零件数量
if (ljCount==11||ljCount==21||ljCount==31){
//取用下标count-1 至 count*2-2的数组为属性
String[] sxArray=getArrayByIndex(a,ljCount-1,ljCount*2-2);
//取用下标count*2-2 至 count*3-3 的数组,为零件号
String[] ljArray=getArrayByIndex(a,ljCount*2-2,ljCount*3-3);
System.out.println(ljCount);
System.out.println(i);
for (int j = 0; j < ljArray.length; j++) {
String ljbh;//零件号
String sx;//属性
if (i==0){
String[] b= ljArray[j].split("0\\|");
ljbh=b[b.length-1];
sx=sxArray[j].split("\\|")[4];
}else {
ljbh=ljArray[j];
sx=sxArray[j].split("\\|")[4];
}
updateBom(sx,dcCh,pl,tlth,ljbh);
}
}else if (ljCount==1){
//"1,11,21,31"
String[] ljxx= a[0].split("\\|");
String ljbh= ljxx[ljxx.length-1];//零件号
String sx= ljxx[4];//属性
updateBom(sx,dcCh,pl,tlth,ljbh);
}else {
//取用下标count 至 count*2-1的数组为属性
String[] sxArray=getArrayByIndex(a,ljCount,ljCount*2-1);
//取用下标count*2 至 count*3-1 的数组,为零件号
String[] ljArray=getArrayByIndex(a,ljCount*2,ljCount*3-1);
for (int j = 0; j < ljArray.length; j++) {
String ljbh=ljArray[j];//零件号
String sx=sxArray[j].split("\\|")[4];//属性
updateBom(sx,dcCh,pl,tlth,ljbh);
}
}
}
tltpdfService.saveBatch(list);
document.close();
}
return new ResultBean();
}
public String[] getArrayByIndex(String[] oldArray,int startIndex,int endIndex){
int newArraylen=endIndex-startIndex+1;
String[] array=new String[newArraylen];
for (int i = 0; i < newArraylen; i++) {
array[i]=oldArray[i+startIndex];
}
return array;
}
public void updateBom(String sx,String dcCh,String pl,String tlth,String ljbh){
// 坡口K/Y 曲工序D/Q 打磨E/F/G/H
if ("K,Y".indexOf(sx)>-1){
dmBomService.update(new UpdateWrapper<DmBom>().set("pkbs","Y")
.eq("dcch",dcCh)
.eq("pl",pl)
.eq("tzbh",tlth)
.eq("ljbh",ljbh)
);
}
if ("D,Q".indexOf(sx)>-1){
dmBomService.update(new UpdateWrapper<DmBom>().set("qbs","Y")
.eq("dcch",dcCh)
.eq("pl",pl)
.eq("tzbh",tlth)
.eq("ljbh",ljbh)
);
}
if ("E,F,G,H".indexOf(sx)>-1){
dmBomService.update(new UpdateWrapper<DmBom>().set("dmbs","Y")
.eq("dcch",dcCh)
.eq("pl",pl)
.eq("tzbh",tlth)
.eq("ljbh",ljbh)
);
}
}
@PostMapping("/getListBom")
public ResultBean getListBom(HttpServletRequest req, @RequestBody Map map) throws CustomException {
List<BomVO> listBom = dmBomService.getListBom(req,map);

@ -0,0 +1,40 @@
package com.dsic.gj_erp.controller.jcsj;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsic.gj_erp.bean.ResultBean;
import com.dsic.gj_erp.bean.jcsj.DmBzry;
import com.dsic.gj_erp.bean.jcsj.DmBzzz;
import com.dsic.gj_erp.service.jcsj.DmBzryService;
import com.dsic.gj_erp.service.jcsj.DmBzzzService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author xn
* @since 2024-06-04
*/
@RestController
@RequestMapping("/dmBzry")
public class DmBzryController {
@Autowired
DmBzryService service;
@PostMapping(value = "/getList")
public ResultBean getList(@RequestBody DmBzry t){
List<DmBzry> list=service.list(new QueryWrapper<DmBzry>()
.eq("resources_code",t.getResourcesCode())
.eq("flag_status","1"));
return new ResultBean(list);
}
}

@ -0,0 +1,59 @@
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.DmBzzz;
import com.dsic.gj_erp.service.jcsj.DmBzzzService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
*
* </p>
*
* @author xn
* @since 2024-05-30
*/
@RestController
@RequestMapping("/dmBzzz")
public class DmBzzzController {
@Autowired
DmBzzzService service;
@PostMapping(value = "/getList")
public ResultBean getList(@RequestBody DmBzzz t){
List<DmBzzz> list=service.list();
return new ResultBean(list);
}
@AuthFunction()
@PostMapping(value = "/save")
public ResultBean save(@RequestBody DmBzzz team){
service.save(team);
return new ResultBean();
}
@AuthFunction()
@PostMapping(value = "/update")
public ResultBean update(@RequestBody DmBzzz team){
service.updateById(team);
return new ResultBean();
}
@AuthFunction()
@PostMapping(value = "/del")
public ResultBean del(@RequestBody List<DmBzzz> list){
List<String> idList=list.stream().map(DmBzzz::getId).collect(Collectors.toList());
service.removeByIds(idList);
return new ResultBean();
}
}

@ -2,6 +2,7 @@ package com.dsic.gj_erp.mapper.jcsj;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsic.gj_erp.bean.jcsj.DmBom;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -19,4 +20,6 @@ public interface DmBomMapper extends BaseMapper<DmBom> {
int insertBoms(List<DmBom> dmMfgDetails);
int insertBom(DmBom dmMfgDetails);
int insertFile(@Param("filepath")String filepath,@Param("yhdm") String yhdm);
}

@ -0,0 +1,17 @@
package com.dsic.gj_erp.mapper.jcsj;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsic.gj_erp.bean.jcsj.DmBzry;
/**
* <p>
* Mapper
* </p>
*
* @author xn
* @since 2024-06-04
*/
public interface DmBzryMapper extends BaseMapper<DmBzry> {
}

@ -0,0 +1,17 @@
package com.dsic.gj_erp.mapper.jcsj;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsic.gj_erp.bean.jcsj.DmBzzz;
/**
* <p>
* Mapper
* </p>
*
* @author xn
* @since 2024-05-30
*/
public interface DmBzzzMapper extends BaseMapper<DmBzzz> {
}

@ -0,0 +1,17 @@
package com.dsic.gj_erp.service.jcsj;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dsic.gj_erp.bean.jcsj.DmBzry;
/**
* <p>
*
* </p>
*
* @author xn
* @since 2024-06-04
*/
public interface DmBzryService extends IService<DmBzry> {
}

@ -0,0 +1,17 @@
package com.dsic.gj_erp.service.jcsj;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dsic.gj_erp.bean.jcsj.DmBzzz;
/**
* <p>
*
* </p>
*
* @author xn
* @since 2024-05-30
*/
public interface DmBzzzService extends IService<DmBzzz> {
}

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

@ -0,0 +1,21 @@
package com.dsic.gj_erp.service.jcsj.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsic.gj_erp.bean.jcsj.DmBzry;
import com.dsic.gj_erp.mapper.jcsj.DmBzryMapper;
import com.dsic.gj_erp.service.jcsj.DmBzryService;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author xn
* @since 2024-06-04
*/
@Service
public class DmBzryServiceImpl extends ServiceImpl<DmBzryMapper, DmBzry> implements DmBzryService {
}

@ -0,0 +1,21 @@
package com.dsic.gj_erp.service.jcsj.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsic.gj_erp.bean.jcsj.DmBzzz;
import com.dsic.gj_erp.mapper.jcsj.DmBzzzMapper;
import com.dsic.gj_erp.service.jcsj.DmBzzzService;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author xn
* @since 2024-05-30
*/
@Service
public class DmBzzzServiceImpl extends ServiceImpl<DmBzzzMapper, DmBzzz> implements DmBzzzService {
}

@ -212,6 +212,9 @@
</insert>
<insert id="insertFile">
insert into upload_file(filepath,drr)values(#{filepath},#{yhdm})
</insert>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dsic.gj_erp.mapper.jcsj.DmBzryMapper">
</mapper>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dsic.gj_erp.mapper.jcsj.DmBzzzMapper">
</mapper>
Loading…
Cancel
Save