制单管理添加问题

zhc4dev
赵玉瑞 2 years ago
parent 544bf5664a
commit ccfe51ffd6
  1. 6
      ant-design-vue-jeecg/src/views/maker/ZyMakerList.vue
  2. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/controller/ZyMakerController.java
  3. 1
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/entity/ZyMaker.java
  4. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/IZyMakerService.java
  5. 42
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/maker/service/impl/ZyMakerServiceImpl.java

@ -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() {
},

@ -97,7 +97,10 @@ public class ZyMakerController extends JeecgController<ZyMaker, IZyMakerService>
@PostMapping(value = "/listMakerAdd")
public Result<?> listMakerAdd() {
//点击制单 点击后按产品模块分解成制单写入制单表
zyMakerService.listMakerAdd();
int distinct = zyMakerService.listMakerAdd();
if (distinct == 0){
return Result.error("已成功添加,不用重复添加");
}
//zyMakerService.save(zyMaker);
return Result.OK("添加成功!");
}

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

@ -14,7 +14,7 @@ import java.util.List;
public interface IZyMakerService extends IService<ZyMaker> {
//点击制单 点击后按产品模块分解成制单写入制单表
void listMakerAdd();
int listMakerAdd();
List<ZyMaker> ZyMakerVo(List<ZyMaker> records);
}

@ -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<ZyMakerMapper, ZyMaker> impl
////点击制单 点击后按产品模块分解成制单写入制单表
@Override
public void listMakerAdd() {
public int listMakerAdd() {
int distinct = 0;
//先拿到所有产品 产品暂定为服装款式里面的数据
List<WorkOrder> 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<ZyMaker> makerList = this.list();
List<String> workOrderCollect = workOrderList.stream().map(WorkOrder::getProductCode).collect(Collectors.toList());
//List<String> collect = makerList.stream().map(ZyMaker::getWorkerCode).collect(Collectors.toList());
//HashSet<String> codeHashSet = new HashSet<>(collect);
HashSet<String> 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

Loading…
Cancel
Save