add:质检基础数据

This commit is contained in:
zhangzhiqiang
2023-04-23 16:08:32 +08:00
parent 1ee9d7362b
commit 4460aeb7b2
5 changed files with 58 additions and 49 deletions

View File

@@ -1,7 +0,0 @@
package org.nl.common.handler;
@FunctionalInterface
public
interface LockProcess {
void process();
}

View File

@@ -0,0 +1,56 @@
package org.nl.config;
import cn.hutool.core.util.StrUtil;
import com.alibaba.druid.pool.DruidDataSource;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.enums.AcsTaskEnum;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.common.DataTypeEnum;
import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl;
import org.nl.wms.sch.tasks.SpeMachineryTask;
import org.nl.wms.sch.tasks.WashMachineryTask;
import org.nl.wms.sch.tasks.callMaterial.WrapCallMaterialTask;
import org.nl.wms.sch.tasks.sendEmpty.WrapSendEmptyTask;
import org.nl.wms.sch.tasks.sendMaterial.PlotterSendMaterialTask;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.system.ApplicationPid;
import org.springframework.context.SmartLifecycle;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import javax.sql.DataSource;
import java.sql.DriverManager;
import java.sql.SQLException;
@Configuration
@Slf4j
public class ConventConfig implements SmartLifecycle {
@Override
public void start() {
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_CALLTYPE_FULL, SpringContextHolder.getBean(SpeMachineryTask.class));
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_CALLTYPE_EMP, SpringContextHolder.getBean(SpeMachineryTask.class));
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_WASH_EMP, SpringContextHolder.getBean(WashMachineryTask.class));
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_PLOTTER_SEND_FULL, SpringContextHolder.getBean(PlotterSendMaterialTask.class));
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_WARP_CALL_FULL, SpringContextHolder.getBean(WrapCallMaterialTask.class));
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_WARP_SEND_EMP, SpringContextHolder.getBean(WrapSendEmptyTask.class));
System.out.println("初始化Task_Collent完成"+AcsToWmsServiceImpl.Task_Collent.size());
}
@Override
public void stop() {
}
@Override
public boolean isRunning() {
return false;
}
}

View File

@@ -1,29 +0,0 @@
package org.nl.config;
import cn.hutool.core.util.StrUtil;
import com.alibaba.druid.pool.DruidDataSource;
import lombok.extern.slf4j.Slf4j;
import org.nl.wms.common.DataTypeEnum;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import javax.sql.DataSource;
import java.sql.DriverManager;
import java.sql.SQLException;
//@Configuration
@Slf4j
public class DataBaseConfig {
@Primary
@Bean(name = "dataSource")
@ConfigurationProperties(prefix = "spring.datasource.druid")
public DataSource dataSource() {
return new DruidDataSource();
}
}

View File

@@ -52,7 +52,7 @@ import java.util.function.Supplier;
@Slf4j
public class AcsToWmsServiceImpl implements AcsToWmsService{
private static Map<AcsTaskEnum, AbstractAcsTask> Task_Factory = new HashMap<>();
public static Map<AcsTaskEnum, AbstractAcsTask> Task_Collent = new HashMap<>();
@Autowired
private TaskService taskService;
@Autowired
@@ -69,11 +69,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
AcsTaskEnum taskEnum = AcsTaskEnum.getType(param.getString("type"), "REQUEST_");
try {
RedissonUtils.lock(() -> {
},"ddd",3);
RedissonUtils.lock(()->{
//业务处理
Task_Factory.get(taskEnum).createTask(param);
Task_Collent.get(taskEnum).createTask(param);
},param.getString("type"),5);
}catch (Exception ex){
@@ -318,13 +316,4 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
wo.update(MapOf.of("real_qty",real_qty),"workorder_id = '"+workorder_id+"'");
}
}
@PostConstruct
public void init() {
Task_Factory.put(AcsTaskEnum.REQUEST_CALLTYPE_FULL, SpringContextHolder.getBean(SpeMachineryTask.class));
Task_Factory.put(AcsTaskEnum.REQUEST_CALLTYPE_EMP, SpringContextHolder.getBean(SpeMachineryTask.class));
Task_Factory.put(AcsTaskEnum.REQUEST_WASH_EMP, SpringContextHolder.getBean(WashMachineryTask.class));
Task_Factory.put(AcsTaskEnum.REQUEST_PLOTTER_SEND_FULL, SpringContextHolder.getBean(PlotterSendMaterialTask.class));
Task_Factory.put(AcsTaskEnum.REQUEST_WARP_CALL_FULL, SpringContextHolder.getBean(WrapCallMaterialTask.class));
Task_Factory.put(AcsTaskEnum.REQUEST_WARP_SEND_EMP, SpringContextHolder.getBean(WrapSendEmptyTask.class));
}
}