1.增加设备产能和工序CD配置接口

master
董哲奇 2 years ago
parent e5130fb7e9
commit 6e8779ca03

@ -71,6 +71,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>

@ -0,0 +1,67 @@
package com.dsic.gj_erp.config;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializationContext;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import java.time.Duration;
@EnableCaching
@Configuration
public class RedisConfig {
@Bean
public RedisTemplate<String, Object> redisTemplate(LettuceConnectionFactory lettuceConnectionFactory) {
// 设置序列化
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
jackson2JsonRedisSerializer.setObjectMapper(om);
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(lettuceConnectionFactory);
RedisSerializer<?> stringSerializer = new StringRedisSerializer();
redisTemplate.setKeySerializer(stringSerializer);
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
redisTemplate.setHashKeySerializer(stringSerializer);
redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);
redisTemplate.afterPropertiesSet();
return redisTemplate;
}
@Bean
public RedisCacheManager redisCacheManager(RedisConnectionFactory redisConnectionFactory){
RedisSerializer<String> redisSerializer = new StringRedisSerializer();
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
//解决查询缓存转换异常的问题
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);//这一句必须要,作用是序列化时将对象全类名一起保存下来
om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL);
jackson2JsonRedisSerializer.setObjectMapper(om);
//配置序列化(解决乱码的问题)
RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig()
.entryTtl(Duration.ofSeconds(-1))//设置 key 过期时间
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(redisSerializer)) //设置key序列化规则
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(jackson2JsonRedisSerializer))//设置value序列化规则
.disableCachingNullValues();
RedisCacheManager cacheManager = RedisCacheManager.builder(redisConnectionFactory)
.cacheDefaults(config)
.build();
return cacheManager;
}
}

@ -4,11 +4,13 @@ import cn.hutool.core.util.StrUtil;
import com.dsic.gj_erp.bean.ResultBean;
import com.dsic.gj_erp.pc.Manager;
import com.dsic.gj_erp.pc.service.三月滚动接口;
import com.dsic.gj_erp.pc.service.工序CD接口;
import com.dsic.gj_erp.pc.service.设备产能接口;
import com.dsic.gj_erp.pc.工序CD;
import com.dsic.gj_erp.pc.排产;
import com.dsic.gj_erp.pc.设备产能;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.concurrent.Semaphore;
@ -19,6 +21,8 @@ import java.util.concurrent.Semaphore;
public class 三月滚动排产控制器 {
private final 三月滚动接口 _三月滚动接口;
private final 设备产能接口 _设备产能接口;
private final 工序CD接口 _工序CD接口;
private static Semaphore semaphore = new Semaphore(1);
@ -78,4 +82,33 @@ public class 三月滚动排产控制器 {
return new ResultBean<>(map);
}
@GetMapping("getCdAll")
public ResultBean<?> 获取全部工序CD(){
Object o = _工序CD接口.get();
return new ResultBean<>(o);
}
@PostMapping("saveGxcd")
public ResultBean<?> 设置工序CD(@RequestBody 工序CD _工序CD){
_工序CD接口.save(_工序CD);
return new ResultBean<>();
}
@GetMapping("getSbcnAll")
public ResultBean<?> 获取全部产能(){
Object o = _设备产能接口.get();
return new ResultBean<>(o);
}
@PostMapping("saveSbcn")
public ResultBean<?> 设置产能(@RequestBody 设备产能 _设备产能){
_设备产能接口.save(_设备产能);
return new ResultBean<>();
}
@GetMapping("remove")
public ResultBean<?> 删除产能(String code){
_设备产能接口.remove(code);
return new ResultBean<>();
}
}

@ -31,7 +31,7 @@ public class SyUserLogController {
log.setYhms(name);
String ipAddr = IPUtils.getIpAddr(request);
log.setIp(ipAddr);
log.setMac(IPUtils.getMACAddress(ipAddr));
// log.setMac(IPUtils.getMACAddress(ipAddr));
log.setCreated(DateUtil.now());
log.insert();
return new ResultBean<>();

@ -7,16 +7,16 @@ import lombok.Getter;
public interface Constant {
//相对于钢料需求期
ImmutableMap<工序, Integer> 工序CD = ImmutableMap.<工序, Integer>builder()
.put(工序.上料, -10)
.put(工序.抛丸, -8)
.put(工序.理料, -8)
.put(工序.划线, -5)
.put(工序.切割, -5)
.put(工序.坡口, -3)
.put(工序.型材面板, -2)
.put(工序.上料, -14)
.put(工序.抛丸, -12)
.put(工序.理料, -11)
.put(工序.划线, -9)
.put(工序.切割, -7)
.put(工序.坡口, -5)
.put(工序.型材面板, -11)
.put(工序.曲型, -5)
.put(工序.打磨, -5)
.put(工序.预配盘, 0)
.put(工序.预配盘, -3)
.put(工序.光电结束, -3)
.put(工序.自由边处理,0)
.put(工序.号料,0)
@ -48,7 +48,7 @@ public interface Constant {
坡口01(工序.坡口, "坡口01", "", 2.0, 3.0, 100.0, 13.0, 13.0),
型材01(工序.型材面板, "型材01", "", 2.0, 3.0, 100.0, 13.0, 13.0),
曲加工01(工序.曲型, "曲加工01", "", 2.0, 3.0, 100.0, 13.0, 13.0),
打磨01(工序.打磨, "打磨01", "", 2.0, 3.0, 100.0, 13.0, 13.0),
打磨01(工序.打磨, "打磨01", "", 2.0, 3.0, 0, 0, 0),
自由边处理01(工序.自由边处理, "自由边处理01", "", 2.0, 3.0, 100.0, 13.0, 13.0),
光电01(工序.光电结束, "光电01", "", 2.0, 3.0, 100.0, 13.0, 13.0),

@ -19,6 +19,8 @@ import com.dsic.gj_erp.pc.dto.sb.*;
import com.dsic.gj_erp.pc.dto.tlt.*;
import com.dsic.gj_erp.pc.dto.排产结果;
import com.dsic.gj_erp.pc.dto.*;
import com.dsic.gj_erp.pc.service.工序CD接口;
import com.dsic.gj_erp.pc.service.设备产能接口;
import com.dsic.gj_erp.service.jcsj.EmGcrlService;
import com.dsic.gj_erp.service.jcsj.EmSbcnpService;
import com.dsic.gj_erp.service.jcsj.EmSbjbbService;
@ -34,7 +36,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import static com.dsic.gj_erp.pc.Constant.工序CD;
import static com.dsic.gj_erp.pc.Manager.排产;
import static com.dsic.gj_erp.pc.Manager.*;
@ -46,10 +47,16 @@ public class DataFactory {
Manager.排产结果=new ArrayList<>();
List<钢料需求> list=读取钢料需求();
工序CD接口 _工序CD接口 = getBean(工序CD接口.class);
List<工序CD> 工序CDS = _工序CD接口.get();
Map<Constant.工序,工序CD> 工序CDMap=new HashMap<>();
工序CDS.forEach(item->工序CDMap.put(item.getGx(),item));
list.forEach(钢料需求 -> {
CountDownLatch latch = new CountDownLatch(钢料需求.getBomList().size());
钢料需求.getBomList().forEach(bom -> {
套料图工序 _套料图工序 = 套料图工序工厂(bom);
_套料图工序.set工序CD(工序CDMap);
AtomicBoolean atomicBoolean = new AtomicBoolean(false);
if (_套料图工序!=null){
_套料图工序.set需求日期(钢料需求.getXzglxq());
@ -117,7 +124,7 @@ public class DataFactory {
.filter(it -> gx.getCode().contains(it.split("_")[1])).findFirst();
first.ifPresent(_code -> {
if (ObjUtil.isNotEmpty(套料图工序对应关系.get(_code))) {
Integer cd = 工序CD.get(gx);
Integer cd = Constant.工序CD.get(gx);
DateTime parse = DateUtil.parse(钢料需求.getXzglxq(), "yyyy/MM/dd");
DateTime dateTime = DateUtil.offsetDay(parse, cd);
资源 _资源 = 提取资源(dateTime);
@ -297,70 +304,54 @@ public class DataFactory {
}
public static 工序产能 工序产能工厂(Constant.工序 _工序) {
Map<String, 设备> _设备 = null;
设备产能接口 _设备产能接口 = getBean(设备产能接口.class);
List<设备产能> 设备产能 = _设备产能接口.get();
Map<String, 设备> _设备;
ImmutableMap.Builder<String, 设备> builder = ImmutableMap.builder();
switch (_工序) {
case 上料:
_设备 = ImmutableMap.<String, 设备>builder()
.put(Constant.设备产能.上料01.设备编号, new 设备01上料(Constant.设备产能.上料01))
.build();
设备产能.stream().filter(item->item.get_工序()==_工序).forEach(item->builder.put(item.getCode(),new 设备01上料(item)));
_设备 = builder.build();
return new 工序01上料(_设备);
case 抛丸:
_设备=ImmutableMap.<String, 设备>builder()
.put(Constant.设备产能.抛丸01.设备编号,new 设备02抛丸(Constant.设备产能.抛丸01))
.build();
设备产能.stream().filter(item->item.get_工序()==_工序).forEach(item->builder.put(item.getCode(),new 设备02抛丸(item)));
_设备 = builder.build();
return new 工序02抛丸(_设备);
case 理料:
_设备=ImmutableMap.<String, 设备>builder()
.put(Constant.设备产能.理料01.设备编号,new 设备03理料(Constant.设备产能.理料01))
.build();
设备产能.stream().filter(item->item.get_工序()==_工序).forEach(item->builder.put(item.getCode(),new 设备03理料(item)));
_设备 = builder.build();
return new 工序03理料(_设备);
case 划线:
_设备=ImmutableMap.<String, 设备>builder()
.put(Constant.设备产能.划线01.设备编号,new 设备04划线(Constant.设备产能.划线01))
.build();
设备产能.stream().filter(item->item.get_工序()==_工序).forEach(item->builder.put(item.getCode(),new 设备04划线(item)));
_设备 = builder.build();
return new 工序04划线(_设备);
case 切割:
_设备=ImmutableMap.<String, 设备>builder()
.put(Constant.设备产能.龙门01.设备编号,new 设备05切割(Constant.设备产能.龙门01))
.put(Constant.设备产能.火焰01.设备编号,new 设备05切割(Constant.设备产能.火焰01))
.put(Constant.设备产能.数控01.设备编号,new 设备05切割(Constant.设备产能.数控01))
.put(Constant.设备产能.火焰03.设备编号,new 设备05切割(Constant.设备产能.火焰03))
.put(Constant.设备产能.数控03.设备编号,new 设备05切割(Constant.设备产能.数控03))
.put(Constant.设备产能.龙门03.设备编号,new 设备05切割(Constant.设备产能.龙门03))
.put(Constant.设备产能.火焰02.设备编号,new 设备05切割(Constant.设备产能.火焰02))
.put(Constant.设备产能.数控02.设备编号,new 设备05切割(Constant.设备产能.数控02))
.put(Constant.设备产能.龙门02.设备编号,new 设备05切割(Constant.设备产能.龙门02))
.build();
设备产能.stream().filter(item->item.get_工序()==_工序).forEach(item->builder.put(item.getCode(),new 设备05切割(item)));
_设备 = builder.build();
return new 工序05切割(_设备);
case 坡口:
_设备=ImmutableMap.<String, 设备>builder()
.put(Constant.设备产能.坡口01.设备编号,new 设备07坡口(Constant.设备产能.坡口01))
.build();
设备产能.stream().filter(item->item.get_工序()==_工序).forEach(item->builder.put(item.getCode(),new 设备07坡口(item)));
_设备 = builder.build();
return new 工序07坡口(_设备);
case 型材面板:
_设备=ImmutableMap.<String, 设备>builder()
.put(Constant.设备产能.型材01.设备编号,new 设备10型材(Constant.设备产能.型材01))
.build();
设备产能.stream().filter(item->item.get_工序()==_工序).forEach(item->builder.put(item.getCode(),new 设备10型材(item)));
_设备 = builder.build();
return new 工序10型材(_设备);
case 曲型:
_设备=ImmutableMap.<String, 设备>builder()
.put(Constant.设备产能.曲加工01.设备编号,new 设备08曲面(Constant.设备产能.曲加工01))
.build();
设备产能.stream().filter(item->item.get_工序()==_工序).forEach(item->builder.put(item.getCode(),new 设备08曲面(item)));
_设备 = builder.build();
return new 工序08曲面(_设备);
case 打磨:
_设备=ImmutableMap.<String, 设备>builder()
.put(Constant.设备产能.打磨01.设备编号, new 设备09打磨(Constant.设备产能.打磨01))
.build();
设备产能.stream().filter(item->item.get_工序()==_工序).forEach(item->builder.put(item.getCode(),new 设备09打磨(item)));
_设备 = builder.build();
return new 工序09打磨(_设备);
case 自由边处理:
_设备=ImmutableMap.<String, 设备>builder()
.put(Constant.设备产能.自由边处理01.设备编号, new 设备21自由边处理(Constant.设备产能.自由边处理01))
.build();
设备产能.stream().filter(item->item.get_工序()==_工序).forEach(item->builder.put(item.getCode(),new 设备21自由边处理(item)));
_设备 = builder.build();
return new 工序21自由边处理(_设备);
case 光电结束:
_设备=ImmutableMap.<String, 设备>builder()
.put(Constant.设备产能.光电01.设备编号, new 设备31光电(Constant.设备产能.光电01))
.build();
设备产能.stream().filter(item->item.get_工序()==_工序).forEach(item->builder.put(item.getCode(),new 设备31光电(item)));
_设备 = builder.build();
return new 工序31光电(_设备);
// case 预配盘:
// return new 工序01上料(_工序,_设备);

@ -2,9 +2,14 @@ package com.dsic.gj_erp.pc.dto.sb;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.设备;
import com.dsic.gj_erp.pc.设备产能;
public class 设备01上料 extends 设备 {
public 设备01上料(设备产能 _设备产能) {
super(_设备产能);
}
public 设备01上料(Constant.设备产能 _设备产能) {
super(_设备产能);
}

@ -2,9 +2,14 @@ package com.dsic.gj_erp.pc.dto.sb;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.设备;
import com.dsic.gj_erp.pc.设备产能;
public class 设备02抛丸 extends 设备 {
public 设备02抛丸(设备产能 _设备产能){
super(_设备产能);
}
public 设备02抛丸(Constant.设备产能 _设备产能) {
super(_设备产能);
}

@ -2,9 +2,14 @@ package com.dsic.gj_erp.pc.dto.sb;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.设备;
import com.dsic.gj_erp.pc.设备产能;
public class 设备03理料 extends 设备 {
public 设备03理料(设备产能 _设备产能){
super(_设备产能);
}
public 设备03理料(Constant.设备产能 _设备产能) {
super(_设备产能);
}

@ -2,9 +2,14 @@ package com.dsic.gj_erp.pc.dto.sb;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.设备;
import com.dsic.gj_erp.pc.设备产能;
public class 设备04划线 extends 设备 {
public 设备04划线(设备产能 _设备产能){
super(_设备产能);
}
public 设备04划线(Constant.设备产能 _设备产能) {
super(_设备产能);
}

@ -2,6 +2,7 @@ package com.dsic.gj_erp.pc.dto.sb;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.设备;
import com.dsic.gj_erp.pc.设备产能;
import lombok.Getter;
import lombok.Setter;
@ -13,6 +14,10 @@ public class 设备05切割 extends 设备 {
protected double 白班时长=7.0;
protected double 二班时长;
public 设备05切割(设备产能 _设备产能){
super(_设备产能);
}
public 设备05切割(Constant.设备产能 _设备产能) {
super(_设备产能);
}

@ -2,9 +2,14 @@ package com.dsic.gj_erp.pc.dto.sb;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.设备;
import com.dsic.gj_erp.pc.设备产能;
public class 设备07坡口 extends 设备 {
public 设备07坡口(设备产能 _设备产能){
super(_设备产能);
}
public 设备07坡口(Constant.设备产能 _设备产能) {
super(_设备产能);
}

@ -2,9 +2,14 @@ package com.dsic.gj_erp.pc.dto.sb;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.设备;
import com.dsic.gj_erp.pc.设备产能;
public class 设备08曲面 extends 设备 {
public 设备08曲面(设备产能 _设备产能){
super(_设备产能);
}
public 设备08曲面(Constant.设备产能 _设备产能) {
super(_设备产能);
}

@ -2,9 +2,14 @@ package com.dsic.gj_erp.pc.dto.sb;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.设备;
import com.dsic.gj_erp.pc.设备产能;
public class 设备09打磨 extends 设备 {
public 设备09打磨(设备产能 _设备产能){
super(_设备产能);
}
public 设备09打磨(Constant.设备产能 _设备产能) {
super(_设备产能);
}

@ -2,9 +2,14 @@ package com.dsic.gj_erp.pc.dto.sb;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.设备;
import com.dsic.gj_erp.pc.设备产能;
public class 设备10型材 extends 设备 {
public 设备10型材(设备产能 _设备产能){
super(_设备产能);
}
public 设备10型材(Constant.设备产能 _设备产能) {
super(_设备产能);
}

@ -2,9 +2,14 @@ package com.dsic.gj_erp.pc.dto.sb;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.设备;
import com.dsic.gj_erp.pc.设备产能;
public class 设备21自由边处理 extends 设备 {
public 设备21自由边处理(设备产能 _设备产能){
super(_设备产能);
}
public 设备21自由边处理(Constant.设备产能 _设备产能) {
super(_设备产能);
}

@ -2,9 +2,14 @@ package com.dsic.gj_erp.pc.dto.sb;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.设备;
import com.dsic.gj_erp.pc.设备产能;
public class 设备31光电 extends 设备 {
public 设备31光电(设备产能 _设备产能){
super(_设备产能);
}
public 设备31光电(Constant.设备产能 _设备产能) {
super(_设备产能);
}

@ -9,15 +9,17 @@ import com.dsic.gj_erp.pc.Manager;
import com.dsic.gj_erp.pc.dto.data.Bom;
import com.dsic.gj_erp.pc.dto.data.钢料需求;
import com.dsic.gj_erp.pc.service.套料图工序接口;
import com.dsic.gj_erp.pc.工序CD;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
import static com.dsic.gj_erp.pc.Constant.工序CD;
//import static com.dsic.gj_erp.pc.Constant.工序CD;
import static com.dsic.gj_erp.pc.DataFactory.提取资源;
import static com.dsic.gj_erp.pc.DataFactory.搜索可用资源;
import static com.dsic.gj_erp.pc.Manager.from;
@ -32,6 +34,7 @@ public abstract class 套料图工序 implements 套料图工序接口 {
protected String 需求日期;
protected Date _需求日期;
protected List<Constant.工序> 工序;
protected Map<Constant.工序,工序CD> 工序CD;
public void run(AtomicBoolean atomicBoolean) {
if (ObjUtil.isEmpty(this.bom)||StrUtil.isEmpty(this.bom.getTzbh())){
@ -60,7 +63,7 @@ public abstract class 套料图工序 implements 套料图工序接口 {
}
protected boolean 占用资源(Constant.工序 _工序,double 需求数量){
Integer cd = 工序CD.get(_工序);
Integer cd = 工序CD.get(_工序).getCd();
DateTime dateTime = DateUtil.offsetDay(this._需求日期, cd);
资源 _资源 = 提取资源(dateTime);
AtomicBoolean 占用成功=new AtomicBoolean(false);

@ -3,6 +3,7 @@ package com.dsic.gj_erp.pc.dto;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.data.Bom;
import com.dsic.gj_erp.pc.service.设备接口;
import com.dsic.gj_erp.pc.设备产能;
import lombok.Getter;
import lombok.Setter;
@ -46,6 +47,15 @@ public abstract class 设备 implements 设备接口 {
this.资源占用图表.add(bom);
}
public 设备(设备产能 _设备产能){
this.设备编号= _设备产能.getCode();
this.设备名称= _设备产能.get设备名称();
this.白班设备产能= _设备产能.get白班设备产能();
this.二班设备产能= _设备产能.get二班设备产能();
this.资源占用图纸表=new ConcurrentLinkedDeque<>();
this.资源占用图表=new ConcurrentLinkedDeque<>();
}
public 设备(Constant.设备产能 _设备产能){
this.设备编号= _设备产能.设备编号;

@ -0,0 +1,51 @@
package com.dsic.gj_erp.pc.service;
import com.dsic.gj_erp.pc.工序CD;
import com.dsic.gj_erp.pc.设备产能;
import lombok.AllArgsConstructor;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
@Service
@AllArgsConstructor
public class 工序CD接口 {
private static final String KEY="gxcd";
private final RedisTemplate<String,Object> redisTemplate;
@CachePut(cacheNames = {KEY},key = "#cd.getGx()")
public Object save(工序CD cd){
return cd;
}
@Cacheable(value = {KEY},key = "#gx")
public Object get(String gx){
return new HashMap<>();
}
@CacheEvict(value = {KEY}, key="#gx")
public Object remove(String gx){
return new HashMap<>();
}
public List<工序CD> get(){
Set<String> keys = redisTemplate.keys(KEY+"::*");
List<工序CD> list=new ArrayList<>();
if (keys==null){
return new ArrayList<>();
}
for (String key:keys){
工序CD _工序CD= (工序CD) redisTemplate.opsForValue().get(key);
list.add(_工序CD);
}
return list;
}
}

@ -0,0 +1,48 @@
package com.dsic.gj_erp.pc.service;
import com.dsic.gj_erp.pc.设备产能;
import lombok.AllArgsConstructor;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
@AllArgsConstructor
public class 设备产能接口 {
private static final String KEY="sbcn";
private final RedisTemplate<String,Object> redisTemplate;
@CachePut(cacheNames = {KEY},key = "#sbcn.getCode()")
public Object save(设备产能 sbcn){
return sbcn;
}
@Cacheable(value = {KEY},key = "#code")
public Object get(String code){
return new HashMap<>();
}
@CacheEvict(value = {KEY}, key="#code")
public Object remove(String code){
return new HashMap<>();
}
public List<设备产能> get(){
Set<String> keys = redisTemplate.keys(KEY+"::*");
List<设备产能> list=new ArrayList<>();
if (keys==null){
return new ArrayList<>();
}
for (String key:keys){
设备产能 _设备产能= (设备产能) redisTemplate.opsForValue().get(key);
list.add(_设备产能);
}
return list;
}
}

@ -0,0 +1,11 @@
package com.dsic.gj_erp.pc;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class 工序CD {
private Constant.工序 gx;
private Integer cd;
}

@ -0,0 +1,19 @@
package com.dsic.gj_erp.pc;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class 设备产能 {
private Constant.工序 _工序;
private String code;
private String 设备名称;
private double 单台效率;
private double 单台产能;
private double 白班设备产能;
private double 二班设备产能;
private double 双班合计产能;
private boolean 禁用;
}
Loading…
Cancel
Save