parent
be9e85fd37
commit
2d69e0eb09
@ -0,0 +1,85 @@
|
||||
package com.dsic.gj_erp.jszb.control;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.dsic.gj_erp.bean.ResultBean;
|
||||
import com.dsic.gj_erp.bean.jhgk.YdjhImportNew;
|
||||
import com.dsic.gj_erp.jszb.entity.PartFlowInfo;
|
||||
import com.dsic.gj_erp.jszb.excel.ExcelFlowInfoListener;
|
||||
import com.dsic.gj_erp.jszb.service.FlowInfoService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("jszb")
|
||||
@AllArgsConstructor
|
||||
public class JszbController {
|
||||
|
||||
private final FlowInfoService flowInfoService;
|
||||
|
||||
@GetMapping("exportJSzb")
|
||||
public void exportJSzb(String ch,String begin,String end){
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("getFlowInfoList")
|
||||
public ResultBean<?> getFlowInfoList(String ch,String begin,String end) {
|
||||
List<PartFlowInfo> list = flowInfoService.list(Wrappers.<PartFlowInfo>lambdaQuery()
|
||||
.eq(PartFlowInfo::getCh, ch)
|
||||
.eq(StrUtil.isEmpty(end) && StrUtil.isNotEmpty(begin), PartFlowInfo::getFd, begin)
|
||||
.between(StrUtil.isAllNotEmpty(begin, end), PartFlowInfo::getFd, begin, end)
|
||||
);
|
||||
return new ResultBean<>(list);
|
||||
}
|
||||
|
||||
@PostMapping("importFLowInfo")
|
||||
public ResultBean<?> importFLowInfo(@RequestParam("file") MultipartFile file) throws IOException {
|
||||
ExcelFlowInfoListener objectListener = new ExcelFlowInfoListener();
|
||||
EasyExcel.read(file.getInputStream(), PartFlowInfo.class, objectListener).sheet(0).headRowNumber(1).doRead();
|
||||
List<PartFlowInfo> objList = objectListener.getObjectList();
|
||||
List<PartFlowInfo> updateList=new ArrayList<>();
|
||||
objList.forEach(item->{
|
||||
PartFlowInfo one=null;
|
||||
if (StrUtil.isNotEmpty(item.getCh())){
|
||||
one = flowInfoService.getOne(Wrappers.<PartFlowInfo>lambdaQuery()
|
||||
.and(it->it.eq(PartFlowInfo::getCh, item.getCh())
|
||||
.or(it0->it0.eq(PartFlowInfo::getCh, item.getProject())))
|
||||
.and(it->it.eq(PartFlowInfo::getPartName, item.getPartName())
|
||||
.or(it0->it0.eq(PartFlowInfo::getPartName, item.getPartName0()))
|
||||
));
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(item.getProject())){
|
||||
one = flowInfoService.getOne(Wrappers.<PartFlowInfo>lambdaQuery()
|
||||
.eq(PartFlowInfo::getCh, item.getCh())
|
||||
.eq(PartFlowInfo::getPartName, item.getPartName())
|
||||
);
|
||||
}
|
||||
|
||||
if (one==null){
|
||||
one = new PartFlowInfo();
|
||||
}
|
||||
|
||||
BeanUtil.copyProperties(item,one);
|
||||
|
||||
if(item.getProject()!=null){
|
||||
one.setCh(item.getProject());
|
||||
one.setPartName(item.getPartName0());
|
||||
}
|
||||
|
||||
updateList.add(one);
|
||||
});
|
||||
|
||||
flowInfoService.saveOrUpdateBatch(updateList);
|
||||
return new ResultBean<>();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package com.dsic.gj_erp.jszb.entity;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("part_flow_info")
|
||||
public class PartFlowInfo {
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
@ExcelProperty("船号")
|
||||
private String ch;
|
||||
@ExcelProperty("分段号")
|
||||
private String fd;
|
||||
@ExcelProperty("批量")
|
||||
private Integer pl;
|
||||
@ExcelProperty("零件名称")
|
||||
private String partName;
|
||||
@ExcelProperty("种类")
|
||||
private String type;
|
||||
@ExcelProperty("规格")
|
||||
private String specification;
|
||||
@ExcelProperty("数量")
|
||||
private Integer quantity;
|
||||
@ExcelProperty("材质")
|
||||
private String material;
|
||||
@ExcelProperty("特征")
|
||||
private String feature;
|
||||
@ExcelProperty("流向")
|
||||
private String flow;
|
||||
@ExcelProperty("下级")
|
||||
private String nextLevel;
|
||||
@ExcelProperty("套料图信息")
|
||||
private String nestingInfo;
|
||||
@ExcelProperty("场地")
|
||||
private String location;
|
||||
|
||||
//========重量信息========
|
||||
@TableField(exist = false)
|
||||
@ExcelProperty("PROJECT")
|
||||
private String project;
|
||||
@TableField(exist = false)
|
||||
@ExcelProperty("BLOCK")
|
||||
private String block;
|
||||
@TableField(exist = false)
|
||||
@ExcelProperty("PARTNAME")
|
||||
private String partName0;
|
||||
@ExcelProperty("PARTNO")
|
||||
private String partNo;
|
||||
@ExcelProperty("MATERIAL")
|
||||
private String material0;
|
||||
@ExcelProperty("THICK")
|
||||
private String thickness;
|
||||
@ExcelProperty("TYPE")
|
||||
private String type0;
|
||||
@ExcelProperty("P")
|
||||
private Integer p;
|
||||
@ExcelProperty("C")
|
||||
private Integer c;
|
||||
@ExcelProperty("S")
|
||||
private Integer s;
|
||||
@ExcelProperty("NP")
|
||||
private Integer np;
|
||||
@ExcelProperty("NC")
|
||||
private Integer nc;
|
||||
@ExcelProperty("NS")
|
||||
private Integer ns;
|
||||
@ExcelProperty("AREA")
|
||||
private Double area;
|
||||
@ExcelProperty("WEIGHT")
|
||||
private Double weight;
|
||||
@ExcelProperty("CUTLEN")
|
||||
private Double cutLength;
|
||||
@ExcelProperty("MARKLEN")
|
||||
private Double markLength;
|
||||
@ExcelProperty("X-SIZE")
|
||||
private Double xSize;
|
||||
@ExcelProperty("Y-SIZE")
|
||||
private Double ySize;
|
||||
@ExcelProperty("OPTION")
|
||||
private String option;
|
||||
@ExcelProperty("MPARTNAME")
|
||||
private String mPartName;
|
||||
@ExcelProperty("SPARTNAME")
|
||||
private String sPartName;
|
||||
@ExcelProperty("LOT")
|
||||
private String lot;
|
||||
@ExcelProperty("BAREA")
|
||||
private Double bArea;
|
||||
@ExcelProperty("SANGLE")
|
||||
private Double sAngle;
|
||||
@ExcelProperty("SSIZE-X")
|
||||
private Double sSizeX;
|
||||
@ExcelProperty("SSIZE-Y")
|
||||
private Double sSizeY;
|
||||
@ExcelProperty("GOID")
|
||||
private Double goid;
|
||||
@ExcelProperty("DATE")
|
||||
private String date;
|
||||
@ExcelProperty("TIME")
|
||||
private String time;
|
||||
@ExcelProperty("SHAPE")
|
||||
private String shape;
|
||||
@ExcelProperty("ASSEMBLY")
|
||||
private String assembly;
|
||||
@ExcelProperty("OPTION1")
|
||||
private String option1;
|
||||
@ExcelProperty("OPTION2")
|
||||
private String option2;
|
||||
@ExcelProperty("OPTION3")
|
||||
private String option3;
|
||||
@ExcelProperty("OPTION4")
|
||||
private String option4;
|
||||
@ExcelProperty("OPTION5")
|
||||
private String option5;
|
||||
@ExcelProperty("DIRECTION")
|
||||
private String direction;
|
||||
@ExcelProperty("ISMODIFY")
|
||||
private Integer isModify;
|
||||
@ExcelProperty("NESTNAME")
|
||||
private String nestName;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.dsic.gj_erp.jszb.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 曲外板
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class CurvedOuterPlate {
|
||||
@ExcelProperty("船名")
|
||||
private String shipName;
|
||||
@ExcelProperty("段号")
|
||||
private String sectionNumber;
|
||||
@ExcelProperty("批量")
|
||||
private Integer batch;
|
||||
@ExcelProperty("零件号")
|
||||
private String partNumber;
|
||||
@ExcelProperty("材质")
|
||||
private String material;
|
||||
@ExcelProperty("规格")
|
||||
private String specification;
|
||||
@ExcelProperty("工序")
|
||||
private String process;
|
||||
@ExcelProperty("左")
|
||||
private Integer left;
|
||||
@ExcelProperty("中")
|
||||
private Integer center;
|
||||
@ExcelProperty("右")
|
||||
private Integer right;
|
||||
@ExcelProperty("长度")
|
||||
private Double length;
|
||||
@ExcelProperty("宽度")
|
||||
private Double width;
|
||||
@ExcelProperty("合计")
|
||||
private Integer total;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.dsic.gj_erp.jszb.excel;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.dsic.gj_erp.jszb.entity.PartFlowInfo;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Excel通用监听器
|
||||
*/
|
||||
public class ExcelFlowInfoListener extends AnalysisEventListener<PartFlowInfo> {
|
||||
|
||||
@Getter
|
||||
List<PartFlowInfo> objectList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void invoke(PartFlowInfo excelDemo, AnalysisContext analysisContext) {
|
||||
objectList.add(excelDemo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.dsic.gj_erp.jszb.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* T型材数量
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class TProfileQuantity {
|
||||
@ExcelProperty("分段号")
|
||||
private String sectionNumber;
|
||||
@ExcelProperty("批量")
|
||||
private Integer batch;
|
||||
@ExcelProperty("零件号")
|
||||
private String partNumber;
|
||||
@ExcelProperty("数量")
|
||||
private Integer quantity;
|
||||
@ExcelProperty("小组合计")
|
||||
private Integer smallGroupTotal;
|
||||
@ExcelProperty("大组合计")
|
||||
private Integer largeGroupTotal;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.dsic.gj_erp.jszb.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* T型材重量
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class TechnicalPreparation {
|
||||
@ExcelProperty("船名")
|
||||
private String shipName;
|
||||
@ExcelProperty("段号")
|
||||
private String sectionNumber;
|
||||
@ExcelProperty("零件号")
|
||||
private String partNumber;
|
||||
@ExcelProperty("材质")
|
||||
private String material;
|
||||
@ExcelProperty("规格")
|
||||
private String specification;
|
||||
@ExcelProperty("工序")
|
||||
private String process;
|
||||
@ExcelProperty("左")
|
||||
private Integer left;
|
||||
@ExcelProperty("中")
|
||||
private Integer center;
|
||||
@ExcelProperty("右")
|
||||
private Integer right;
|
||||
@ExcelProperty("重量")
|
||||
private Double weight;
|
||||
@ExcelProperty("数量")
|
||||
private Integer quantity;
|
||||
@ExcelProperty("总重量")
|
||||
private Double totalWeight;
|
||||
@ExcelProperty("长度")
|
||||
private Double length;
|
||||
@ExcelProperty("宽度")
|
||||
private Double width;
|
||||
@ExcelProperty("大/小/中组")
|
||||
private String group;
|
||||
@ExcelProperty("曲型")
|
||||
private String curveType;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.dsic.gj_erp.jszb.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dsic.gj_erp.jszb.entity.PartFlowInfo;
|
||||
|
||||
public interface PartFlowInfoMapper extends BaseMapper<PartFlowInfo> {
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.dsic.gj_erp.jszb.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dsic.gj_erp.jszb.entity.PartFlowInfo;
|
||||
import com.dsic.gj_erp.jszb.mapper.PartFlowInfoMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class FlowInfoService extends ServiceImpl<PartFlowInfoMapper, PartFlowInfo> {
|
||||
}
|
Loading…
Reference in new issue