From 2d69e0eb09abed5f2830d557b25f07778125b038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=93=B2=E5=A5=87?= <13840175730@139.com> Date: Sun, 11 May 2025 20:30:38 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=8A=80=E6=9C=AF=E5=87=86=E5=A4=87=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gj_erp/jszb/control/JszbController.java | 85 ++++++++++++ .../dsic/gj_erp/jszb/entity/PartFlowInfo.java | 128 ++++++++++++++++++ .../gj_erp/jszb/excel/CurvedFlatIron.java | 39 ++++++ .../gj_erp/jszb/excel/CurvedOuterPlate.java | 39 ++++++ .../jszb/excel/ExcelFlowInfoListener.java | 29 ++++ .../gj_erp/jszb/excel/FlowAndAssembly.java | 39 ++++++ .../gj_erp/jszb/excel/TProfileQuantity.java | 25 ++++ .../jszb/excel/TechnicalPreparation.java | 45 ++++++ .../jszb/mapper/PartFlowInfoMapper.java | 7 + .../gj_erp/jszb/service/FlowInfoService.java | 10 ++ 10 files changed, 446 insertions(+) create mode 100644 src/main/java/com/dsic/gj_erp/jszb/control/JszbController.java create mode 100644 src/main/java/com/dsic/gj_erp/jszb/entity/PartFlowInfo.java create mode 100644 src/main/java/com/dsic/gj_erp/jszb/excel/CurvedFlatIron.java create mode 100644 src/main/java/com/dsic/gj_erp/jszb/excel/CurvedOuterPlate.java create mode 100644 src/main/java/com/dsic/gj_erp/jszb/excel/ExcelFlowInfoListener.java create mode 100644 src/main/java/com/dsic/gj_erp/jszb/excel/FlowAndAssembly.java create mode 100644 src/main/java/com/dsic/gj_erp/jszb/excel/TProfileQuantity.java create mode 100644 src/main/java/com/dsic/gj_erp/jszb/excel/TechnicalPreparation.java create mode 100644 src/main/java/com/dsic/gj_erp/jszb/mapper/PartFlowInfoMapper.java create mode 100644 src/main/java/com/dsic/gj_erp/jszb/service/FlowInfoService.java diff --git a/src/main/java/com/dsic/gj_erp/jszb/control/JszbController.java b/src/main/java/com/dsic/gj_erp/jszb/control/JszbController.java new file mode 100644 index 0000000..3eb0d45 --- /dev/null +++ b/src/main/java/com/dsic/gj_erp/jszb/control/JszbController.java @@ -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 list = flowInfoService.list(Wrappers.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 objList = objectListener.getObjectList(); + List updateList=new ArrayList<>(); + objList.forEach(item->{ + PartFlowInfo one=null; + if (StrUtil.isNotEmpty(item.getCh())){ + one = flowInfoService.getOne(Wrappers.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.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<>(); + } + +} diff --git a/src/main/java/com/dsic/gj_erp/jszb/entity/PartFlowInfo.java b/src/main/java/com/dsic/gj_erp/jszb/entity/PartFlowInfo.java new file mode 100644 index 0000000..1057b83 --- /dev/null +++ b/src/main/java/com/dsic/gj_erp/jszb/entity/PartFlowInfo.java @@ -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; +} diff --git a/src/main/java/com/dsic/gj_erp/jszb/excel/CurvedFlatIron.java b/src/main/java/com/dsic/gj_erp/jszb/excel/CurvedFlatIron.java new file mode 100644 index 0000000..225ea7a --- /dev/null +++ b/src/main/java/com/dsic/gj_erp/jszb/excel/CurvedFlatIron.java @@ -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 CurvedFlatIron { + @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; +} diff --git a/src/main/java/com/dsic/gj_erp/jszb/excel/CurvedOuterPlate.java b/src/main/java/com/dsic/gj_erp/jszb/excel/CurvedOuterPlate.java new file mode 100644 index 0000000..a38a2a5 --- /dev/null +++ b/src/main/java/com/dsic/gj_erp/jszb/excel/CurvedOuterPlate.java @@ -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; +} diff --git a/src/main/java/com/dsic/gj_erp/jszb/excel/ExcelFlowInfoListener.java b/src/main/java/com/dsic/gj_erp/jszb/excel/ExcelFlowInfoListener.java new file mode 100644 index 0000000..21f2025 --- /dev/null +++ b/src/main/java/com/dsic/gj_erp/jszb/excel/ExcelFlowInfoListener.java @@ -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 { + + @Getter + List objectList = new ArrayList<>(); + + @Override + public void invoke(PartFlowInfo excelDemo, AnalysisContext analysisContext) { + objectList.add(excelDemo); + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + + } + +} diff --git a/src/main/java/com/dsic/gj_erp/jszb/excel/FlowAndAssembly.java b/src/main/java/com/dsic/gj_erp/jszb/excel/FlowAndAssembly.java new file mode 100644 index 0000000..d588414 --- /dev/null +++ b/src/main/java/com/dsic/gj_erp/jszb/excel/FlowAndAssembly.java @@ -0,0 +1,39 @@ +package com.dsic.gj_erp.jszb.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Getter; +import lombok.Setter; + +/** + * 流向(M、L)、组立(大、中)、种类(板) + */ +@Getter +@Setter +public class FlowAndAssembly { + @ExcelProperty("船号") + private String shipNumber; + @ExcelProperty("分段号") + private String sectionNumber; + @ExcelProperty("批量") + private Integer batch; + @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; +} diff --git a/src/main/java/com/dsic/gj_erp/jszb/excel/TProfileQuantity.java b/src/main/java/com/dsic/gj_erp/jszb/excel/TProfileQuantity.java new file mode 100644 index 0000000..6733f50 --- /dev/null +++ b/src/main/java/com/dsic/gj_erp/jszb/excel/TProfileQuantity.java @@ -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; +} diff --git a/src/main/java/com/dsic/gj_erp/jszb/excel/TechnicalPreparation.java b/src/main/java/com/dsic/gj_erp/jszb/excel/TechnicalPreparation.java new file mode 100644 index 0000000..ebabab4 --- /dev/null +++ b/src/main/java/com/dsic/gj_erp/jszb/excel/TechnicalPreparation.java @@ -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; +} diff --git a/src/main/java/com/dsic/gj_erp/jszb/mapper/PartFlowInfoMapper.java b/src/main/java/com/dsic/gj_erp/jszb/mapper/PartFlowInfoMapper.java new file mode 100644 index 0000000..89732c4 --- /dev/null +++ b/src/main/java/com/dsic/gj_erp/jszb/mapper/PartFlowInfoMapper.java @@ -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 { +} diff --git a/src/main/java/com/dsic/gj_erp/jszb/service/FlowInfoService.java b/src/main/java/com/dsic/gj_erp/jszb/service/FlowInfoService.java new file mode 100644 index 0000000..df8b7e3 --- /dev/null +++ b/src/main/java/com/dsic/gj_erp/jszb/service/FlowInfoService.java @@ -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 { +}