rev:集群相关修改
This commit is contained in:
@@ -13,6 +13,5 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Data
|
||||
public class ESConfig {
|
||||
|
||||
@Value(("${es.index}"))
|
||||
private String index;
|
||||
}
|
||||
|
||||
@@ -1315,11 +1315,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String point_type = task_jo.getString("task_type");
|
||||
//取货完成
|
||||
if ("1".equals(type)) {
|
||||
if ("010602".equals(point_type) || "010606".equals(point_type)) {
|
||||
if ("010602".equals(point_type)) {
|
||||
JSONObject point1_jo = ivt_shaftivt.query("point_code = '" + task_jo.getString("point_code1") + "'").uniqueResult(0);
|
||||
point1_jo.put("have_qzz", "0");
|
||||
ivt_shaftivt.update(point1_jo);
|
||||
} else if ("010607".equals(point_type) || "010603".equals(point_type)) {
|
||||
} else if ("010607".equals(point_type) || "010603".equals(point_type) || "010606".equals(point_type)) {
|
||||
JSONObject point1_jo = ivt_shaftivt.query("point_code = '" + task_jo.getString("point_code1") + "'").uniqueResult(0);
|
||||
point1_jo.put("qzz_size", "");
|
||||
point1_jo.put("qzz_generation", "");
|
||||
@@ -1388,6 +1388,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
paperTrussTask.immediateNotifyAcs(null);
|
||||
}
|
||||
} else {
|
||||
//判断当前套管工位上是否存在可用的纸管或任务
|
||||
JSONObject tggw_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '4' AND product_area = '" + product_area + "'").uniqueResult(0);
|
||||
JSONObject tggw_task = WQLObject.getWQLObject("sch_base_task").query("point_code1 = '"+tggw_jo.getString("point_code")+"' AND task_type = '010607' AND is_delete = '0' ADN task_status < '07'").uniqueResult(0);
|
||||
//判断在等待任务数量范围内是否存在符合的纸管,如果存在则等待,不存在则创建空载具入库任务
|
||||
boolean need_wait = this.judgeWait(product_area, vehicle_jo);
|
||||
if (!need_wait) {
|
||||
|
||||
@@ -57,6 +57,16 @@ public class PackagePointIvtDto implements Serializable {
|
||||
*/
|
||||
private String tube_name1;
|
||||
|
||||
/**
|
||||
* 子卷号1编码
|
||||
*/
|
||||
private String container_name1;
|
||||
|
||||
/**
|
||||
* 子卷号2编码
|
||||
*/
|
||||
private String container_name2;
|
||||
|
||||
/**
|
||||
* 顺序号
|
||||
*/
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package org.nl.wms.sch.manage;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
@@ -17,9 +19,12 @@ import org.nl.wms.sch.tasks.CutConveyorTask;
|
||||
import org.nl.wms.sch.tasks.PaperTrussTask;
|
||||
import org.nl.wms.sch.tasks.PaperTubeTask;
|
||||
import org.nl.wms.sch.tasks.URLEnum;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -34,20 +39,35 @@ public class AutoCallEmptyVehicle {
|
||||
|
||||
private final WmsToAcsService wmsToAcsService;
|
||||
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
for (URLEnum url : URLEnum.values()) {
|
||||
String product_area = url.getProduct_area();
|
||||
JSONObject nbj_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("product_area = '" + product_area + "' AND point_type = '9'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(nbj_jo)) {
|
||||
continue;
|
||||
RLock lock = redissonClient.getLock(this.getClass().getName());
|
||||
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock){
|
||||
// log.info("AutoCallEmptyVehicle"+ DateUtil.now()+"执行!!!!");
|
||||
for (URLEnum url : URLEnum.values()) {
|
||||
String product_area = url.getProduct_area();
|
||||
JSONObject nbj_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("product_area = '" + product_area + "' AND point_type = '9'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(nbj_jo)) {
|
||||
continue;
|
||||
}
|
||||
if (nbj_jo.getString("is_used").equals("1")) {
|
||||
//上半部分
|
||||
this.callEmptyVehicle(product_area, "0");
|
||||
//下半部分
|
||||
this.callEmptyVehicle(product_area, "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nbj_jo.getString("is_used").equals("1")) {
|
||||
//上半部分
|
||||
this.callEmptyVehicle(product_area, "0");
|
||||
//下半部分
|
||||
this.callEmptyVehicle(product_area, "1");
|
||||
}finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void callEmptyVehicle(String product_area, String point_location) {
|
||||
|
||||
@@ -1,32 +1,55 @@
|
||||
package org.nl.wms.sch.manage;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoQueryBillInfo {
|
||||
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
//查询已经处于分配中、分配完但还未回传给MES的销售出库单
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_iostorinv");
|
||||
String nofity_day = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("NOFITY_DAY").getValue();
|
||||
JSONArray send_rows = new JSONArray();
|
||||
if (Integer.parseInt(nofity_day) == 0) {
|
||||
send_rows = wo.query("(bill_type = '1001' OR bill_type = '1004') AND bill_status = '99' AND confirm_time > '2023-09-01' AND is_delete = '0' AND ( IFNULL(trans_code,'') = '' OR IFNULL( deliveryaddress, '' ) = '' OR IFNULL( deliveryunit, '' ) = '' OR (IFNULL(trans_code,'') <> '00000000' AND IFNULL(estimated_freight,0) = 0) OR IFNULL(estimated_freight,'') = '' OR IFNULL(order_number,'') = '' OR IFNULL(car_type,'') = '')").getResultJSONArray(0);
|
||||
} else {
|
||||
send_rows = wo.query("(bill_type = '1001' OR bill_type = '1004') AND bill_status = '99' AND confirm_time > '2023-09-01' AND is_delete = '0' AND ( IFNULL(trans_code,'') = '' OR IFNULL( deliveryaddress, '' ) = '' OR IFNULL( deliveryunit, '' ) = '' OR (IFNULL(trans_code,'') <> '00000000' AND IFNULL(estimated_freight,0) = 0) OR IFNULL(estimated_freight,'') = '' OR IFNULL(order_number,'') = '' OR IFNULL(car_type,'') = '') AND TIMESTAMPDIFF(DAY,confirm_time,NOW()) >= " + nofity_day).getResultJSONArray(0);
|
||||
RLock lock = redissonClient.getLock(this.getClass().getName());
|
||||
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
System.out.println("AutoQueryBillInfo" + DateUtil.now() + "执行!!!!");
|
||||
//查询已经处于分配中、分配完但还未回传给MES的销售出库单
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_iostorinv");
|
||||
String nofity_day = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("NOFITY_DAY").getValue();
|
||||
JSONArray send_rows = new JSONArray();
|
||||
if (Integer.parseInt(nofity_day) == 0) {
|
||||
send_rows = wo.query("(bill_type = '1001' OR bill_type = '1004') AND bill_status = '99' AND confirm_time > '2023-09-01' AND is_delete = '0' AND ( IFNULL(trans_code,'') = '' OR IFNULL( deliveryaddress, '' ) = '' OR IFNULL( deliveryunit, '' ) = '' OR (IFNULL(trans_code,'') <> '00000000' AND IFNULL(estimated_freight,0) = 0) OR IFNULL(estimated_freight,'') = '' OR IFNULL(order_number,'') = '' OR IFNULL(car_type,'') = '')").getResultJSONArray(0);
|
||||
} else {
|
||||
send_rows = wo.query("(bill_type = '1001' OR bill_type = '1004') AND bill_status = '99' AND confirm_time > '2023-09-01' AND is_delete = '0' AND ( IFNULL(trans_code,'') = '' OR IFNULL( deliveryaddress, '' ) = '' OR IFNULL( deliveryunit, '' ) = '' OR (IFNULL(trans_code,'') <> '00000000' AND IFNULL(estimated_freight,0) = 0) OR IFNULL(estimated_freight,'') = '' OR IFNULL(order_number,'') = '' OR IFNULL(car_type,'') = '') AND TIMESTAMPDIFF(DAY,confirm_time,NOW()) >= " + nofity_day).getResultJSONArray(0);
|
||||
}
|
||||
this.sendInfo(send_rows);
|
||||
} else {
|
||||
System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
this.sendInfo(send_rows);
|
||||
}
|
||||
|
||||
void sendInfo(JSONArray send_rows) {
|
||||
|
||||
@@ -6,42 +6,60 @@ import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoQueryConRem {
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
//查询立库贴标、捆扎机剩余材料是否低于下限
|
||||
JSONArray rows = new JSONArray();
|
||||
//捆扎米数
|
||||
String lash_num_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_up").getValue();
|
||||
//捆扎下限
|
||||
String lash_num_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_down").getValue();
|
||||
if (Double.parseDouble(lash_num_down) >= Double.parseDouble(lash_num_up)) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", "NKZ01");
|
||||
jo.put("device_name", "一楼入库北区捆扎位1");
|
||||
jo.put("param_name", "lash_num_up");
|
||||
rows.add(jo);
|
||||
}
|
||||
//标签纸数量
|
||||
String label_num_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("label_num_up").getValue();
|
||||
//标签纸下限
|
||||
String label_num_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_down").getValue();
|
||||
if (Double.parseDouble(label_num_down) >= Double.parseDouble(label_num_up)) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", "NTB01");
|
||||
jo.put("device_name", "一楼入库北区贴标位1");
|
||||
jo.put("param_name", "label_num_up");
|
||||
rows.add(jo);
|
||||
}
|
||||
this.sendInfo(rows);
|
||||
RLock lock = redissonClient.getLock(this.getClass().getName());
|
||||
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock){
|
||||
//查询立库贴标、捆扎机剩余材料是否低于下限
|
||||
JSONArray rows = new JSONArray();
|
||||
//捆扎米数
|
||||
String lash_num_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_up").getValue();
|
||||
//捆扎下限
|
||||
String lash_num_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_down").getValue();
|
||||
if (Double.parseDouble(lash_num_down) >= Double.parseDouble(lash_num_up)) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", "NKZ01");
|
||||
jo.put("device_name", "一楼入库北区捆扎位1");
|
||||
jo.put("param_name", "lash_num_up");
|
||||
rows.add(jo);
|
||||
}
|
||||
//标签纸数量
|
||||
String label_num_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("label_num_up").getValue();
|
||||
//标签纸下限
|
||||
String label_num_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_down").getValue();
|
||||
if (Double.parseDouble(label_num_down) >= Double.parseDouble(label_num_up)) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", "NTB01");
|
||||
jo.put("device_name", "一楼入库北区贴标位1");
|
||||
jo.put("param_name", "label_num_up");
|
||||
rows.add(jo);
|
||||
}
|
||||
this.sendInfo(rows);
|
||||
}
|
||||
}finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sendInfo(JSONArray send_rows) {
|
||||
@@ -65,7 +83,7 @@ public class AutoQueryConRem {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
String Message = row.getString("device_name") + "消耗材料已低于下限,请及时更换。并将系统对应的:" + row.getString("param_name" + "进行维护!");
|
||||
String Message = row.getString("device_name") + "消耗材料已低于下限,请及时更换。并将系统对应的:" + row.getString("param_name") + "进行维护!";
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("SendType", "L");
|
||||
jo.put("Title", "捆扎、贴标预警信息");
|
||||
|
||||
@@ -5,15 +5,19 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.sch.tasks.URLEnum;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -23,45 +27,59 @@ public class AutoQueryDeviceStatus {
|
||||
private RedisUtils redisUtils;
|
||||
private final WmsToAcsService wmsToAcsService;
|
||||
|
||||
public void run() {
|
||||
for (URLEnum url : URLEnum.values()) {
|
||||
try {
|
||||
String product_area = url.getProduct_area();
|
||||
//通过ACS接口获取温度
|
||||
JSONArray device_rows = WQL.getWO("PDA_02").addParam("flag", "15").addParam("product_area", product_area).process().getResultJSONArray(0);
|
||||
if (device_rows.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
JSONObject jo = wmsToAcsService.getHotPointStatus(device_rows);
|
||||
JSONArray de_rows = jo.getJSONArray("data");
|
||||
for (int i = 0; i < de_rows.size(); i++) {
|
||||
JSONObject row = de_rows.getJSONObject(i);
|
||||
String device_code = row.getString("device_code");
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("temperature", row.getString("now_temperature"));
|
||||
//获取倒计时,分,秒
|
||||
String countdown_house = row.getString("countdown_house");
|
||||
String countdown_min = row.getString("countdown_min");
|
||||
String countdown_sec = row.getString("countdown_sec");
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
if (StrUtil.isEmpty(countdown_house)) {
|
||||
countdown_house = "0";
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
RLock lock = redissonClient.getLock(this.getClass().getName());
|
||||
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock){
|
||||
for (URLEnum url : URLEnum.values()) {
|
||||
try {
|
||||
String product_area = url.getProduct_area();
|
||||
//通过ACS接口获取温度
|
||||
JSONArray device_rows = WQL.getWO("PDA_02").addParam("flag", "15").addParam("product_area", product_area).process().getResultJSONArray(0);
|
||||
if (device_rows.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
JSONObject jo = wmsToAcsService.getHotPointStatus(device_rows);
|
||||
JSONArray de_rows = jo.getJSONArray("data");
|
||||
for (int i = 0; i < de_rows.size(); i++) {
|
||||
JSONObject row = de_rows.getJSONObject(i);
|
||||
String device_code = row.getString("device_code");
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("temperature", row.getString("now_temperature"));
|
||||
//获取倒计时,分,秒
|
||||
String countdown_house = row.getString("countdown_house");
|
||||
String countdown_min = row.getString("countdown_min");
|
||||
String countdown_sec = row.getString("countdown_sec");
|
||||
|
||||
if (StrUtil.isEmpty(countdown_house)) {
|
||||
countdown_house = "0";
|
||||
}
|
||||
if (StrUtil.isEmpty(countdown_min)) {
|
||||
countdown_min = "0";
|
||||
}
|
||||
if (StrUtil.isEmpty(countdown_sec)) {
|
||||
countdown_sec = "0";
|
||||
}
|
||||
String last_time = countdown_house + "小时" + countdown_min + "分钟";
|
||||
map.put("last_time", last_time);
|
||||
redisUtils.hset(device_code, "temperature", row.getString("temperature"));
|
||||
redisUtils.hset(device_code, "last_time", last_time);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
}
|
||||
if (StrUtil.isEmpty(countdown_min)) {
|
||||
countdown_min = "0";
|
||||
}
|
||||
if (StrUtil.isEmpty(countdown_sec)) {
|
||||
countdown_sec = "0";
|
||||
}
|
||||
String last_time = countdown_house + "小时" + countdown_min + "分钟";
|
||||
map.put("last_time", last_time);
|
||||
redisUtils.hset(device_code, "temperature", row.getString("temperature"));
|
||||
redisUtils.hset(device_code, "last_time", last_time);
|
||||
|
||||
}
|
||||
}
|
||||
}finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
@@ -15,9 +16,12 @@ import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext.mes.service.LmsToMesService;
|
||||
import org.nl.wms.sch.AutoQueryEnum;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@@ -27,33 +31,47 @@ public class AutoQueryProudDayData {
|
||||
|
||||
private final LmsToMesService lmsToMesService;
|
||||
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
JSONObject param = new JSONObject();
|
||||
RLock lock = redissonClient.getLock(this.getClass().getName());
|
||||
boolean tryLock = lock.tryLock(0,600, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock){
|
||||
JSONObject param = new JSONObject();
|
||||
|
||||
JSONArray UserList = new JSONArray();
|
||||
JSONArray UserList = new JSONArray();
|
||||
|
||||
String userList = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("USER_LIST_FEISHU").getValue();
|
||||
String userList = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("USER_LIST_FEISHU").getValue();
|
||||
|
||||
String[] split = userList.split(",");
|
||||
if (split.length > 0) {
|
||||
for (String s : split) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("User", s);
|
||||
UserList.add(jo);
|
||||
String[] split = userList.split(",");
|
||||
if (split.length > 0) {
|
||||
for (String s : split) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("User", s);
|
||||
UserList.add(jo);
|
||||
}
|
||||
} else {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("User", "");
|
||||
UserList.add(jo);
|
||||
}
|
||||
param.put("UserList", UserList);
|
||||
|
||||
param.put("Code", "ctp_AAyBZtDQiYwG");
|
||||
param.put("card", data());
|
||||
|
||||
// 调用接口
|
||||
//lmsToMesService.proudDayData(param);
|
||||
}else {
|
||||
System.out.println("定时器当前被锁住!");
|
||||
}
|
||||
}catch (Exception e){
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("User", "");
|
||||
UserList.add(jo);
|
||||
}
|
||||
param.put("UserList", UserList);
|
||||
|
||||
param.put("Code", "ctp_AAyBZtDQiYwG");
|
||||
param.put("card", data());
|
||||
|
||||
// 调用接口
|
||||
lmsToMesService.proudDayData(param);
|
||||
|
||||
}
|
||||
|
||||
public JSONObject data() {
|
||||
|
||||
@@ -7,23 +7,42 @@ import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoQueryUpload {
|
||||
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
//查询已经处于分配中、分配完但还未回传给MES的销售出库单
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_iostorinv");
|
||||
JSONArray send_rows = wo.query("bill_type = '1001' AND bill_status IN ( '30', '40' ) AND stor_code = 'AC01' AND upload_mes = '0' AND is_delete = '0'").getResultJSONArray(0);
|
||||
this.sendInfo(send_rows);
|
||||
RLock lock = redissonClient.getLock(this.getClass().getName());
|
||||
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock){
|
||||
//查询已经处于分配中、分配完但还未回传给MES的销售出库单
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_iostorinv");
|
||||
JSONArray send_rows = wo.query("bill_type = '1001' AND bill_status IN ( '30', '40' ) AND stor_code = 'AC01' AND upload_mes = '0' AND is_delete = '0'").getResultJSONArray(0);
|
||||
this.sendInfo(send_rows);
|
||||
}
|
||||
}finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void sendInfo(JSONArray send_rows) {
|
||||
|
||||
@@ -6,31 +6,46 @@ import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoSendFeiShu {
|
||||
|
||||
private final RedissonClient redissonClient;
|
||||
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
RLock lock = redissonClient.getLock(this.getClass().getName());
|
||||
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
|
||||
//查询故障了还未发送的
|
||||
JSONArray send_rows = wo.query("error > '0' AND IFNULL(is_upload,'0') = '0' AND upload_flag = '1'").getResultJSONArray(0);
|
||||
this.sendInfo(send_rows);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
|
||||
//查询故障了还未发送的
|
||||
JSONArray send_rows = wo.query("error > '0' AND IFNULL(is_upload,'0') = '0' AND upload_flag = '1'").getResultJSONArray(0);
|
||||
this.sendInfo(send_rows);
|
||||
|
||||
//查询已经发送了但是还是故障中的
|
||||
String resend_time = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("RESEND_TIME").getValue();
|
||||
JSONArray resend_rows = wo.query("error > '0' AND is_upload = '1' AND upload_flag = '1' AND TIMESTAMPDIFF(MINUTE,upload_time,NOW()) > " + resend_time).getResultJSONArray(0);
|
||||
this.sendInfo(resend_rows);
|
||||
|
||||
|
||||
//查询已经发送了但是还是故障中的
|
||||
String resend_time = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("RESEND_TIME").getValue();
|
||||
JSONArray resend_rows = wo.query("error > '0' AND is_upload = '1' AND upload_flag = '1' AND TIMESTAMPDIFF(MINUTE,upload_time,NOW()) > " + resend_time).getResultJSONArray(0);
|
||||
this.sendInfo(resend_rows);
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sendInfo(JSONArray device_rows) {
|
||||
|
||||
@@ -891,10 +891,10 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
row_map.put("material_code", material_code);
|
||||
row_map.put("sale_order_name", sale_order_name);
|
||||
row_map.put("sect_id", sect_id);
|
||||
row_map.put("flag", "11");
|
||||
row_map.put("flag", "111");
|
||||
|
||||
// 获取系统参数入库到第几层 0-3层都可 1-1层 2-2层 3-3层
|
||||
String in_layer_num = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("in_layer_num").getValue();
|
||||
String in_layer_num;
|
||||
|
||||
/*
|
||||
* 判断木箱高度能入第几层:
|
||||
@@ -923,7 +923,23 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
row_map.put("in_layer_num", in_layer_num);
|
||||
|
||||
//查询到当前可用的巷道
|
||||
JSONArray rowArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
JSONArray rowArr2 = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
JSONArray rowArr = new JSONArray();
|
||||
for (int i = 0; i < rowArr2.size(); i++) {
|
||||
JSONObject jo = rowArr2.getJSONObject(i);
|
||||
String block_num = jo.getString("block_num");
|
||||
String row_num = jo.getString("row_num");
|
||||
String placement_type = jo.getString("placement_type");
|
||||
row_map.put("block_num", block_num);
|
||||
row_map.put("row_num", row_num);
|
||||
row_map.put("placement_type", placement_type);
|
||||
row_map.put("flag", "112");
|
||||
JSONObject row_jo = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().uniqueResult(0);
|
||||
int num = row_jo.getIntValue("num");
|
||||
if (num > 0) {
|
||||
rowArr.add(jo);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < rowArr.size(); i++) {
|
||||
JSONObject row_jo = rowArr.getJSONObject(i);
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
输入.point_code TYPEAS s_string
|
||||
输入.row_num TYPEAS s_string
|
||||
输入.block_num TYPEAS s_string
|
||||
输入.placement_type TYPEAS s_string
|
||||
输入.sql_str TYPEAS f_string
|
||||
输入.in_stor_id TYPEAS f_string
|
||||
输入.in_layer_num TYPEAS f_string
|
||||
@@ -471,6 +472,70 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "111"
|
||||
QUERY
|
||||
SELECT
|
||||
count(sa.struct_code) AS num,
|
||||
sa.block_num,
|
||||
sa.row_num,
|
||||
sa.placement_type
|
||||
FROM
|
||||
st_ivt_structivt ivt
|
||||
INNER JOIN pdm_bi_subpackagerelation sub ON sub.container_name = ivt.pcsn
|
||||
LEFT JOIN st_ivt_structattr sa ON sa.struct_code = ivt.struct_code
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt.material_id
|
||||
WHERE
|
||||
sa.sect_id = 输入.sect_id
|
||||
OPTION 输入.material_code <> ""
|
||||
mb.material_code = 输入.material_code
|
||||
ENDOPTION
|
||||
OPTION 输入.sale_order_name <> ""
|
||||
sub.sale_order_name = 输入.sale_order_name
|
||||
ENDOPTION
|
||||
GROUP BY
|
||||
sa.block_num,sa.row_num,sa.placement_type
|
||||
ORDER BY
|
||||
sa.placement_type desc,num
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "112"
|
||||
QUERY
|
||||
SELECT
|
||||
count(sa.struct_code) AS num,
|
||||
sa.block_num,
|
||||
sa.row_num,
|
||||
sa.placement_type
|
||||
FROM
|
||||
st_ivt_structattr sa
|
||||
WHERE
|
||||
IFNULL(sa.storagevehicle_code,'') = ''
|
||||
AND
|
||||
sa.lock_type = '1'
|
||||
AND
|
||||
sa.is_delete = '0'
|
||||
AND
|
||||
sa.is_used = '1'
|
||||
OPTION 输入.in_layer_num <> ""
|
||||
sa.layer_num in 输入.in_layer_num
|
||||
ENDOPTION
|
||||
OPTION 输入.col_num <> ""
|
||||
sa.layer_num = 输入.col_num
|
||||
ENDOPTION
|
||||
OPTION 输入.block_num <> ""
|
||||
sa.block_num = 输入.block_num
|
||||
ENDOPTION
|
||||
OPTION 输入.row_num <> ""
|
||||
sa.row_num = 输入.row_num
|
||||
ENDOPTION
|
||||
OPTION 输入.placement_type <> ""
|
||||
sa.placement_type = 输入.placement_type
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "12"
|
||||
QUERY
|
||||
SELECT
|
||||
|
||||
Reference in New Issue
Block a user