Merge branch 'master' of http://121.40.234.130:8899/root/hl_one
This commit is contained in:
@@ -18,14 +18,6 @@ import java.sql.SQLException;
|
||||
//@Configuration
|
||||
@Slf4j
|
||||
public class DataBaseConfig {
|
||||
@Value("${erp.oracle.enabled}")
|
||||
private boolean oracleIsConnect;
|
||||
@Value("${erp.oracle.jdbcurl}")
|
||||
private String oracleJdbcUrl;
|
||||
@Value("${erp.oracle.username}")
|
||||
private String oracleUserName;
|
||||
@Value("${erp.oracle.password}")
|
||||
private String oraclePassword;
|
||||
|
||||
@Primary
|
||||
@Bean(name = "dataSource")
|
||||
@@ -34,60 +26,4 @@ public class DataBaseConfig {
|
||||
return new DruidDataSource();
|
||||
}
|
||||
|
||||
@Bean(name = "dataSource1")
|
||||
@ConditionalOnExpression("${erp.oracle.enabled:true}")
|
||||
public DataSource dataSource1() {
|
||||
System.out.println("是否连接oracle:"+oracleIsConnect);
|
||||
System.out.println("erp.oracle.jdbcurl:"+oracleJdbcUrl);
|
||||
System.out.println("erp.oracle.username:"+oracleUserName);
|
||||
System.out.println("erp.oracle.password:"+oraclePassword);
|
||||
log.info("是否连接oracle:"+oracleIsConnect);
|
||||
log.info("erp.oracle.jdbcurl:"+oracleJdbcUrl);
|
||||
log.info("erp.oracle.username:"+oracleUserName);
|
||||
log.info("erp.oracle.password:"+oraclePassword);
|
||||
|
||||
String jdbcUrl = oracleJdbcUrl;
|
||||
String userName = oracleUserName;
|
||||
String password =oraclePassword;
|
||||
|
||||
DruidDataSource druidDataSource = new DruidDataSource();
|
||||
String className;
|
||||
try {
|
||||
className = DriverManager.getDriver(jdbcUrl.trim()).getClass().getName();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Get class name error: =" + jdbcUrl);
|
||||
}
|
||||
if (StrUtil.isEmpty(className)) {
|
||||
DataTypeEnum dataTypeEnum = DataTypeEnum.urlOf(jdbcUrl);
|
||||
if (null == dataTypeEnum) {
|
||||
throw new RuntimeException("Not supported data type: jdbcUrl=" + jdbcUrl);
|
||||
}
|
||||
druidDataSource.setDriverClassName(dataTypeEnum.getDriver());
|
||||
} else {
|
||||
druidDataSource.setDriverClassName(className);
|
||||
}
|
||||
|
||||
|
||||
druidDataSource.setUrl(jdbcUrl);
|
||||
druidDataSource.setUsername(userName);
|
||||
druidDataSource.setPassword(password);
|
||||
// 配置获取连接等待超时的时间
|
||||
druidDataSource.setMaxWait(3000);
|
||||
// 配置初始化大小、最小、最大
|
||||
druidDataSource.setInitialSize(5);
|
||||
druidDataSource.setMinIdle(5);
|
||||
druidDataSource.setMaxActive(10);
|
||||
|
||||
// 如果链接出现异常则直接判定为失败而不是一直重试
|
||||
druidDataSource.setBreakAfterAcquireFailure(true);
|
||||
try {
|
||||
druidDataSource.init();
|
||||
} catch (SQLException e) {
|
||||
log.error("Exception during pool initialization", e);
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
||||
return druidDataSource;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -331,6 +331,6 @@ public class MaterialbaseServiceImpl implements MaterialbaseService{
|
||||
public void updateRedis() {
|
||||
JSONArray materialJsonArray = WQL.getWO("PDA_QUERY").addParam("flag", "5").process().getResultJSONArray(0);
|
||||
List<MaterialDto> finalMaterialList = materialJsonArray.toJavaList(MaterialDto.class);
|
||||
redisUtils.set("materialList", finalMaterialList);
|
||||
redisUtils.set("hl_one_wms:cacheLineHand:materialList", finalMaterialList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class WmsToSapServiceImpl implements WmsToSapService {
|
||||
} else {
|
||||
sale_jo.put("qty_unit_id", unit_jo.getString("measure_unit_id"));
|
||||
}
|
||||
sale_jo.put("plandeliver_date", row.getString("Edaut"));
|
||||
sale_jo.put("plandeliver_date", row.getString("Edatu"));
|
||||
sale_jo.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
sale_jo.put("create_name", SecurityUtils.getCurrentNickName());
|
||||
sale_jo.put("create_time", DateUtil.now());
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CacheLineHandController{
|
||||
//任务类型和任务ID校验,instruct_uuid为前端参数命名,本来应为task_id
|
||||
if(StringUtils.isNotEmpty(params)) {
|
||||
//限制查询参数过短,模糊力度大
|
||||
int length = params.length();
|
||||
int length = params.getBytes().length;
|
||||
if(length < 3) {
|
||||
throw new BizCoreException("您输入的条件匹配的范围太大,请重新输入稍长一点的内容。");
|
||||
}
|
||||
|
||||
@@ -79,15 +79,15 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
List<MaterialDto> materialList;
|
||||
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll();
|
||||
//12W种物料信息,查本地缓存
|
||||
materialList = cache.get("materialList");
|
||||
materialList = cache.get("hl_one_wms:cacheLineHand:materialList");
|
||||
if(null != materialList) {
|
||||
return getMaterialDto(materialList, param);
|
||||
}
|
||||
//2.查reids
|
||||
materialList = redisUtils.get("materialList", MaterialDto.class);
|
||||
materialList = redisUtils.get("hl_one_wms:cacheLineHand:materialList", MaterialDto.class);
|
||||
if(null != materialList) {
|
||||
// //设置本地缓存
|
||||
cache.setLocalCache("materialList", materialList);
|
||||
cache.setLocalCache("hl_one_wms:cacheLineHand:materialList", materialList);
|
||||
return getMaterialDto(materialList, param);
|
||||
}
|
||||
//3.查db
|
||||
@@ -95,10 +95,10 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
materialList = materialJsonArray.toJavaList(MaterialDto.class);
|
||||
//缓存到redis
|
||||
List<MaterialDto> finalMaterialList1 = materialList;
|
||||
CompletableFuture<Void> f1 = CompletableFuture.runAsync(() -> redisUtils.set("materialList", finalMaterialList1), pool);
|
||||
CompletableFuture<Void> f1 = CompletableFuture.runAsync(() -> redisUtils.set("hl_one_wms:cacheLineHand:materialList", finalMaterialList1), pool);
|
||||
//缓存到本地
|
||||
List<MaterialDto> finalMaterialList = materialList;
|
||||
CompletableFuture<Void> f2 = CompletableFuture.runAsync(() -> cache.setLocalCache("materialList", finalMaterialList), pool);
|
||||
CompletableFuture<Void> f2 = CompletableFuture.runAsync(() -> cache.setLocalCache("hl_one_wms:cacheLineHand:materialList", finalMaterialList), pool);
|
||||
f1.exceptionally((e) -> {
|
||||
throw new BadRequestException("物料信息缓存redis失败");
|
||||
});
|
||||
@@ -162,8 +162,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
map.put("status", task_status.replace("-1", ""));
|
||||
}
|
||||
//任务编号
|
||||
if(StrUtil.isNotEmpty(whereJson.getString("task_code"))) {
|
||||
map.put("task_code", "%" + whereJson.getString("task_code") + "%");
|
||||
if(StrUtil.isNotEmpty(whereJson.getString("inst_num"))) {
|
||||
map.put("inst_num", "%" + whereJson.getString("inst_num") + "%");
|
||||
}
|
||||
//起点
|
||||
if(StrUtil.isNotEmpty(whereJson.getString("start_point"))) {
|
||||
@@ -448,7 +448,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
throw new BadRequestException("箱子【" + vehicle_code + "】已在库内,无法入空箱!");
|
||||
}
|
||||
// 3.判断是否可以放入空箱子
|
||||
JSONObject json = positionTab.query("cacheLine_code = '" + cacheLine_code + "position_code = '" + position_code + "' and is_blank= '1'").uniqueResult(0);
|
||||
JSONObject json = positionTab.query("cacheLine_code = '" + cacheLine_code + "' and position_code = '" + position_code + "' and is_empty= '1'").uniqueResult(0);
|
||||
if(json == null) {
|
||||
throw new BadRequestException("无法找到缓存线【" + position_code + "】的空位,无法入空箱!");
|
||||
}
|
||||
@@ -542,7 +542,6 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
* 料箱码 vehicle_code
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String inOutExceptionInstConfirm(JSONObject param) {
|
||||
// 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
|
||||
String inOut_type = param.getString("inOut_type");
|
||||
@@ -560,17 +559,11 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
jsonObject.put("vehicle_code", vehicle_code);
|
||||
jsonObject.put("position_code", position_code);
|
||||
jsonArray.add(jsonObject);
|
||||
try {
|
||||
//TOFIX 等确定api后,换成下发的url
|
||||
return AcsUtil.notifyAcs("api", jsonArray).getString("status");
|
||||
}
|
||||
catch(Exception e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
//TOFIX 等确定api后,换成下发的url
|
||||
return AcsUtil.notifyAcs("api", jsonArray).getString("status");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String cacheLineExcepOpt(JSONObject param) {
|
||||
// 缓存线编码
|
||||
String wcsdevice_code = param.getString("wcsdevice_code");
|
||||
@@ -586,13 +579,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
jsonObject.put("type", type);
|
||||
jsonObject.put("wcsdevice_code", wcsdevice_code);
|
||||
jsonArray.add(jsonObject);
|
||||
try {
|
||||
//TOFIX 等确定api后,换成下发的url
|
||||
return AcsUtil.notifyAcs("api", jsonArray).getString("status");
|
||||
}
|
||||
catch(Exception e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
//TOFIX 等确定api后,换成下发的url
|
||||
return AcsUtil.notifyAcs("api", jsonArray).getString("status");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -840,10 +828,10 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
String pointCode = param.getString("wcsdevice_code");
|
||||
String productArea = param.getString("product_area");
|
||||
AtomicReference<JSONArray> res = new AtomicReference<>(new JSONArray());
|
||||
RedissonUtils.lock(()->{
|
||||
RedissonUtils.lock(() -> {
|
||||
// 生产区域
|
||||
res.set(WQL.getWO("PDA_QUERY").addParamMap(MapOf.of("flag", "8", "product_area", productArea, "cacheLine_code", pointCode)).process().getResultJSONArray(0));
|
||||
},pointCode,3);
|
||||
}, pointCode, 3);
|
||||
return res.get();
|
||||
}
|
||||
|
||||
@@ -854,7 +842,6 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteBox(JSONObject param) {
|
||||
WQLObject cvTab = WQLObject.getWQLObject("SCH_CacheLine_VehileMaterial");
|
||||
String vehicleCode = param.getString("vehicle_code");
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
输入.start_point TYPEAS s_string
|
||||
输入.end_point TYPEAS s_string
|
||||
输入.start_date TYPEAS s_string
|
||||
输入.vehicle_code TYPEAS s_string
|
||||
输入.end_date TYPEAS s_string
|
||||
输入.task_id TYPEAS s_string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user