diff --git a/ant-design-vue-jeecg/src/views/maker/ZyMakerList.vue b/ant-design-vue-jeecg/src/views/maker/ZyMakerList.vue index 69932155..d0bc67d8 100644 --- a/ant-design-vue-jeecg/src/views/maker/ZyMakerList.vue +++ b/ant-design-vue-jeecg/src/views/maker/ZyMakerList.vue @@ -214,9 +214,15 @@ export default { }else{ this.$message.warning(res.message); } + this.loading = true; + setTimeout(()=>{ + this.loading = false; + }, 2000); // this.$emit('valueChange',1) // this.close() }) + + }, initDictConfig() { }, diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/controller/ZyMakerController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/controller/ZyMakerController.java index d65a8253..aaec2b25 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/controller/ZyMakerController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/controller/ZyMakerController.java @@ -97,7 +97,10 @@ public class ZyMakerController extends JeecgController @PostMapping(value = "/listMakerAdd") public Result listMakerAdd() { //点击制单 点击后按产品模块分解成制单写入制单表 - zyMakerService.listMakerAdd(); + int distinct = zyMakerService.listMakerAdd(); + if (distinct == 0){ + return Result.error("已成功添加,不用重复添加"); + } //zyMakerService.save(zyMaker); return Result.OK("添加成功!"); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/entity/ZyMaker.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/entity/ZyMaker.java index dbf594e7..75abb538 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/entity/ZyMaker.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/entity/ZyMaker.java @@ -56,6 +56,7 @@ public class ZyMaker implements Serializable { // @ApiModelProperty(value = "所属部门") // private String sysOrgCode; /**制单编号*/ + //制单编号 工单编号(22)+顺序号(2) @Excel(name = "制单编号", width = 15) @ApiModelProperty(value = "制单编号") private String code; diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/IZyMakerService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/IZyMakerService.java index 36c4c9fd..73a9c2d8 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/IZyMakerService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/IZyMakerService.java @@ -14,7 +14,7 @@ import java.util.List; public interface IZyMakerService extends IService { //点击制单 点击后按产品模块分解成制单写入制单表 - void listMakerAdd(); + int listMakerAdd(); List ZyMakerVo(List records); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/impl/ZyMakerServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/impl/ZyMakerServiceImpl.java index 38479627..77dee4a9 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/impl/ZyMakerServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/impl/ZyMakerServiceImpl.java @@ -1,6 +1,5 @@ package org.jeecg.modules.maker.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.jeecg.modules.maker.entity.ZyMaker; import org.jeecg.modules.maker.mapper.ZyMakerMapper; import org.jeecg.modules.maker.service.IZyMakerService; @@ -18,8 +17,8 @@ import org.springframework.util.StringUtils; import javax.annotation.Resource; import java.util.ArrayList; import java.util.Collections; +import java.util.HashSet; import java.util.List; -import java.util.regex.Pattern; import java.util.stream.Collectors; /** @@ -41,18 +40,41 @@ public class ZyMakerServiceImpl extends ServiceImpl impl ////点击制单 点击后按产品模块分解成制单写入制单表 @Override - public void listMakerAdd() { + public int listMakerAdd() { + int distinct = 0; //先拿到所有产品 产品暂定为服装款式里面的数据 List workOrderList = workOrderService.list(); - for (WorkOrder workOrder : workOrderList) { - ZyMaker maker = new ZyMaker(); - //制单编号 工单编号(22)+顺序号(2) - maker.setCode(getMakerCode(workOrder.getProductCode())); - //工单编号 - maker.setWorkerCode(workOrder.getProductCode()); - this.save(maker); + + List makerList = this.list(); + List workOrderCollect = workOrderList.stream().map(WorkOrder::getProductCode).collect(Collectors.toList()); + //List collect = makerList.stream().map(ZyMaker::getWorkerCode).collect(Collectors.toList()); + //HashSet codeHashSet = new HashSet<>(collect); + HashSet codeHashSet = makerList.stream().map(ZyMaker::getWorkerCode).collect(Collectors.toCollection(HashSet::new)); + + for (String productCode : workOrderCollect) { + if (codeHashSet.add(productCode)) { + distinct = distinct + 1; + ZyMaker maker = new ZyMaker(); + //制单编号 工单编号(22)+顺序号(2) + String code =productCode+getMakerCode(productCode); + maker.setCode(code); + //工单编号 + maker.setWorkerCode(productCode); + this.save(maker); + } } +// for (WorkOrder workOrder : workOrderList) { +// ZyMaker maker = new ZyMaker(); +// //制单编号 工单编号(22)+顺序号(2) +// String code = workOrder.getProductCode()+getMakerCode(workOrder.getProductCode()); +// maker.setCode(code); +// //工单编号 +// maker.setWorkerCode(workOrder.getProductCode()); +// this.save(maker); +// } + + return distinct; } @Override